Re: [PATCH v2 3/4] gpio: aggregator: Set up a parser of delay line parameters

From: Geert Uytterhoeven
Date: Thu Jun 15 2023 - 03:49:47 EST


Hi Andy,

On Thu, Jun 15, 2023 at 1:14 AM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
> The aggregator mode can also handle properties of the platform,
> that do not belong to the GPIO controller itself. One of such
> a property is a signal delay line. Set up a parser to support it.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Thanks for your patch!

Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

One suggestion for improvement below...

> --- a/drivers/gpio/gpio-aggregator.c
> +++ b/drivers/gpio/gpio-aggregator.c
> @@ -525,7 +580,9 @@ static int gpio_aggregator_probe(struct platform_device *pdev)
> return PTR_ERR(descs[i]);
> }
>
> - fwd = gpiochip_fwd_create(dev, n, descs);
> + delay_line = fwnode_device_is_compatible(dev_fwnode(dev), "gpio-delay");

Please do not use explicit checks for compatible values in .probe()
methods. Instead, use device_get_match_data() to get the feature
flag(s). This will also make it easier to scale to other external
components later.

> +
> + fwd = gpiochip_fwd_create(dev, n, descs, delay_line);
> if (IS_ERR(fwd))
> return PTR_ERR(fwd);
>
> @@ -534,6 +591,15 @@ static int gpio_aggregator_probe(struct platform_device *pdev)
> }
>
> static const struct of_device_id gpio_aggregator_dt_ids[] = {
> + /*
> + * The GPIO delay provides a way to configure platform specific delays
> + * for GPIO ramp-up or ramp-down delays. This can serve the following
> + * purposes:
> + * - Open-drain output using an RC filter
> + */
> + {
> + .compatible = "gpio-delay",

.data = (void *)FWD_FEATURE_DELAY,

> + },
> /*
> * Add GPIO-operated devices controlled from userspace below,
> * or use "driver_override" in sysfs.

Gr{oetje,eeting}s,

Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds