Re: [PATCH v7 08/10] i2c: of-prober: Add GPIO support to simple helpers
From: Andrey Skvortsov
Date: Sun Sep 15 2024 - 05:47:06 EST
Hi,
On 24-09-11 15:27, Chen-Yu Tsai wrote:
> Add GPIO support to the simple helpers for the I2C OF component prober.
> Components that the prober intends to probe likely require their
> regulator supplies be enabled, and GPIOs be toggled to enable them or
> bring them out of reset before they will respond to probe attempts.
> Regulator supplies were handled in the previous patch.
>
> The assumption is that the same class of components to be probed are
> always connected in the same fashion with the same regulator supply
> and GPIO. The names may vary due to binding differences, but the
> physical layout does not change.
>
> This supports at most one GPIO pin. The user must specify the GPIO name,
> the polarity, and the amount of time to wait after the GPIO is toggled.
> Devices with more than one GPIO pin likely require specific power
> sequencing beyond what generic code can easily support.
>
> Signed-off-by: Chen-Yu Tsai <wenst@xxxxxxxxxxxx>
> diff --git a/include/linux/i2c-of-prober.h b/include/linux/i2c-of-prober.h
> index 541451fbf58d..c5e241163c94 100644
> --- a/include/linux/i2c-of-prober.h
> +++ b/include/linux/i2c-of-prober.h
> @@ -83,6 +83,7 @@ int i2c_of_probe_component(struct device *dev, const struct i2c_of_probe_cfg *cf
> *
> * The following helpers are provided:
> * * i2c_of_probe_simple_get_res()
> + * * i2c_of_probe_simple_free_res_early()
> * * i2c_of_probe_simple_free_res_late()
> * * i2c_of_probe_simple_enable()
> * * i2c_of_probe_simple_cleanup()
> @@ -92,24 +93,33 @@ int i2c_of_probe_component(struct device *dev, const struct i2c_of_probe_cfg *cf
> * struct i2c_of_probe_simple_opts - Options for simple I2C component prober callbacks
> * @res_node_compatible: Compatible string of device node to retrieve resources from.
> * @supply_name: Name of regulator supply.
> + * @gpio_name: Name of GPIO.
> * @post_power_on_delay_ms: Delay in ms after regulators are powered on. Passed to msleep().
> + * @post_reset_deassert_delay_ms: Delay in ms after GPIOs are set. Passed to msleep().
> + * @gpio_high_to_enable: %true if GPIO should be set to electrical high to enable component.
> */
> struct i2c_of_probe_simple_opts {
> const char *res_node_compatible;
> const char *supply_name;
> + const char *gpio_name;
> unsigned int post_power_on_delay_ms;
> + unsigned int post_reset_deassert_delay_ms;
> + bool gpio_high_to_enable;
Missing '#include <linux/types.h>', otherwise compiler complains
about unknown bool type, when 'i2c-of-prober.h' included without any
previous includes.
--
Best regards,
Andrey Skvortsov