diff options
| author | Antti Laakso <antti.laakso@linux.intel.com> | 2026-03-11 15:19:09 +0200 |
|---|---|---|
| committer | Hans Verkuil <hverkuil+cisco@kernel.org> | 2026-03-25 18:44:36 +0100 |
| commit | eac4a8e26d57e7d3a3b749c2551ffd13451517cb (patch) | |
| tree | e250832be646ef28a91152358bfeeec43e080410 /drivers | |
| parent | 13abea47768245365c859e214794b9ac85a2accb (diff) | |
gpio: tps68470: Add i2c daisy chain support
The tps68470 daisy chain make use of gpio 1 and 2. When in use, these
gpios must be configured as inputs without pull-up.
Signed-off-by: Antti Laakso <antti.laakso@linux.intel.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/gpio/gpio-tps68470.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-tps68470.c b/drivers/gpio/gpio-tps68470.c index d4fbdf90e190..8541acecfbbe 100644 --- a/drivers/gpio/gpio-tps68470.c +++ b/drivers/gpio/gpio-tps68470.c @@ -120,6 +120,17 @@ static int tps68470_gpio_input(struct gpio_chip *gc, unsigned int offset) TPS68470_GPIO_MODE_MASK, 0x00); } +static int tps68470_enable_i2c_daisy_chain(struct gpio_chip *gc) +{ + int ret; + + ret = tps68470_gpio_input(gc, 1); + if (ret) + return ret; + + return tps68470_gpio_input(gc, 2); +} + static const char *tps68470_names[TPS68470_N_GPIO] = { "gpio.0", "gpio.1", "gpio.2", "gpio.3", "gpio.4", "gpio.5", "gpio.6", @@ -129,6 +140,7 @@ static const char *tps68470_names[TPS68470_N_GPIO] = { static int tps68470_gpio_probe(struct platform_device *pdev) { struct tps68470_gpio_data *tps68470_gpio; + int ret; tps68470_gpio = devm_kzalloc(&pdev->dev, sizeof(*tps68470_gpio), GFP_KERNEL); @@ -149,7 +161,14 @@ static int tps68470_gpio_probe(struct platform_device *pdev) tps68470_gpio->gc.base = -1; tps68470_gpio->gc.parent = &pdev->dev; - return devm_gpiochip_add_data(&pdev->dev, &tps68470_gpio->gc, tps68470_gpio); + ret = devm_gpiochip_add_data(&pdev->dev, &tps68470_gpio->gc, tps68470_gpio); + if (ret) + return ret; + + if (device_property_present(&pdev->dev, "daisy-chain-enable")) + ret = tps68470_enable_i2c_daisy_chain(&tps68470_gpio->gc); + + return ret; } static struct platform_driver tps68470_gpio_driver = { |
