Re: [RFC 10/12] staging: media: max96712: add gpiochip functionality
From: Linus Walleij
Date: Thu Feb 06 2025 - 13:41:31 EST
Hi Laurentiu,
thanks for your patch!
On Fri, Jan 31, 2025 at 5:35 PM Laurentiu Palcu
<laurentiu.palcu@xxxxxxxxxxx> wrote:
> The deserializer has GPIOs that can be used for various purposes. Add
> support for gpiochip.
>
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@xxxxxxxxxxx>
Since you are using CONFIG_GPIOLIB unconditionally you need
to add
select GPIOLIB
in the Kconfig for this driver, or the autobuilder will soon start to
spam you with compilation errors.
> +static int max96712_gpiochip_probe(struct max96712_priv *priv)
> +{
> + struct device *dev = &priv->client->dev;
> + struct gpio_chip *gc = &priv->gpio_chip;
> + int i, ret = 0;
> +
> + gc->label = dev_name(dev);
> + gc->parent = dev;
I don't think you need to assign parent. (Default)
> + gc->owner = THIS_MODULE;
Or this. (Default)
> + gc->ngpio = MAX96712_NUM_GPIO;
> + gc->base = -1;
> + gc->can_sleep = true;
> + gc->get_direction = max96712_gpio_get_direction;
> + gc->direction_input = max96712_gpio_direction_in;
> + gc->direction_output = max96712_gpio_direction_out;
> + gc->request = gpiochip_generic_request;
> + gc->set = max96712_gpiochip_set;
> + gc->get = max96712_gpiochip_get;
> + gc->of_gpio_n_cells = 2;
Isn't that the default? Do you need to assign this?
Other than that this looks good, so with the small fix above:
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Yours,
Linus Walleij