iio: resolver: ad2s1210: add reset gpio support
Subsystems (2)
David Lechner
reviewerPATCH 1/1 iio: resolver: ad2s1210: add reset gpio support
This adds support for the optional reset gpio to the ad2s1210 resolver driver. If the gpio is present in the device tree, it is toggled during driver probe before the reset of the device initialization. As per the devicetree bindings, it is expected for the gpio to configured as active low.
--- drivers/iio/resolver/ad2s1210.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/iio/resolver/ad2s1210.c +12 -0
@@ -1426,6 +1426,7 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st) {struct device *dev = &st->sdev->dev;struct gpio_descs *resolution_gpios; +struct gpio_desc *reset_gpio;DECLARE_BITMAP (bitmap,2 );int ret;
@@ -1481,6 +1482,17 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st) "failed to set resolution gpios\n"); } +/* If the optional reset GPIO is present, toggle it to do a hard reset. */ + reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (reset_gpio)) +return dev_err_probe (dev,PTR_ERR (reset_gpio), +"failed to request reset GPIO\n" ); + +if (reset_gpio) { +udelay (10 ); +gpiod_set_value (reset_gpio,0 ); + } +return 0 ; }
Signature · 1 line
2.42.0
Quoted 12 lines
-----Original Message-----
From: David Lechner <[email protected]>
Sent: Montag, 16. Oktober 2023 17:43
To: [email protected]
Cc: David Lechner <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Sa, Nuno <[email protected]>; [email protected]
Subject: [PATCH] iio: resolver: ad2s1210: add reset gpio support
Quoted 8 lines
This adds support for the optional reset gpio to the ad2s1210 resolver driver. If the gpio is present in the device tree, it is toggled during driver probe before the reset of the device initialization. As per the devicetree bindings, it is expected for the gpio to configured as active low.
Suggested-by Michael Hennerich <[email protected]>Signed-off-by David Lechner <[email protected]>---
Quoted 37 lines
drivers/iio/resolver/ad2s1210.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/iio/resolver/ad2s1210.c +12
-0@@ -1426,6 +1426,7 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st) {struct device *dev = &st->sdev->dev;struct gpio_descs *resolution_gpios; +struct gpio_desc *reset_gpio;DECLARE_BITMAP (bitmap,2 );int ret;@@ -1481,6 +1482,17 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st) "failed to set resolution gpios\n"); } +/* If the optional reset GPIO is present, toggle it to do a hard reset. */ + reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (reset_gpio)) +return dev_err_probe (dev,PTR_ERR (reset_gpio), +"failed to request reset GPIO\n" ); + +if (reset_gpio) { +udelay (10 ); +gpiod_set_value (reset_gpio,0 ); + } +return 0 ;}
--
2.42.0
Jonathan Cameron
maintainerQuoted 15 lines · Michael
Quoted 15 lines
-----Original Message-----
From: David Lechner <[email protected]>
Sent: Montag, 16. Oktober 2023 17:43
To: [email protected]
Cc: David Lechner <[email protected]>; Jonathan Cameron <[email protected]>; Hennerich, Michael <[email protected]>; Sa, Nuno <[email protected]>; [email protected]
Subject: [PATCH] iio: resolver: ad2s1210: add reset gpio supportThis adds support for the optional reset gpio to the ad2s1210 resolver driver. If the gpio is present in the device tree, it is toggled during driver probe before the reset of the device initialization. As per the devicetree bindings, it is expected for the gpio to configured as active low.
Quoted 5 lines
Quoted 3 lines
Suggested-by Michael Hennerich <[email protected]>Signed-off-by David Lechner <[email protected]>---
Applied and pushed out as testing for 0-day to poke at it.
Thanks,
Jonathan
Quoted 39 lines
Quoted 38 lines
drivers/iio/resolver/ad2s1210.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/iio/resolver/ad2s1210.c +12
-0@@ -1426,6 +1426,7 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st) {struct device *dev = &st->sdev->dev;struct gpio_descs *resolution_gpios; +struct gpio_desc *reset_gpio;DECLARE_BITMAP (bitmap,2 );int ret;@@ -1481,6 +1482,17 @@ static int ad2s1210_setup_gpios(struct ad2s1210_state *st) "failed to set resolution gpios\n"); } +/* If the optional reset GPIO is present, toggle it to do a hard reset. */ + reset_gpio =devm_gpiod_get_optional (dev,"reset" ,GPIOD_OUT_HIGH ); +if (IS_ERR (reset_gpio)) +return dev_err_probe (dev,PTR_ERR (reset_gpio), +"failed to request reset GPIO\n" ); + +if (reset_gpio) { +udelay (10 ); +gpiod_set_value (reset_gpio,0 ); + } +return 0 ;}
--
2.42.0