Skip to contentSkip to conversation

iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()

PATCH Applied Fabio Estevam 3 participants 4 messages Nov 22, 2024 – Dec 8, 2024 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: adc: ti-ads124s08: Use gpiod_set_value_cansleep()

Using gpiod_set_value() to control the reset GPIO causes some verbose warnings during boot when the reset GPIO is controlled by an I2C IO expander.

As the caller can sleep, use the gpiod_set_value_cansleep() variant to fix the issue.

Tested on a custom i.MX93 board with a ADS124S08 ADC.

Fixes e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")
---
 drivers/iio/adc/ti-ads124s08.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-ads124s08.c +2 -2
index 425b48d8986f..f452f57f11c9 100644
@@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
 	struct ads124s_private *priv = iio_priv(indio_dev);
 
 	if (priv->reset_gpio) {
-		gpiod_set_value(priv->reset_gpio, 0);
+		gpiod_set_value_cansleep(priv->reset_gpio, 0);
 		udelay(200);
-		gpiod_set_value(priv->reset_gpio, 1);
+		gpiod_set_value_cansleep(priv->reset_gpio, 1);
 	} else {
 		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
 	}
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 4 lines · On Fri, 22 Nov 2024 13:43:08 -0300 Fabio Estevam <[email protected]> wrote:

Using gpiod_set_value() to control the reset GPIO causes some verbose warnings during boot when the reset GPIO is controlled by an I2C IO expander.

Quoted 8 lines

As the caller can sleep, use the gpiod_set_value_cansleep() variant to fix the issue.

Tested on a custom i.MX93 board with a ADS124S08 ADC.

Fixes e717f8c6dfec ("iio: adc: Add the TI ads124s08 ADC code")

Hmm. Could be considered a feature, but fair enough as the change is trivial and you are setting it on a real board.

Applied to the fixes-togreg branch of iio.git.

Thanks,

Jonathan

Quoted 20 lines
---
 drivers/iio/adc/ti-ads124s08.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/adc/ti-ads124s08.c +2 -2
index 425b48d8986f..f452f57f11c9 100644
@@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
 	struct ads124s_private *priv = iio_priv(indio_dev);
 
 	if (priv->reset_gpio) {
-		gpiod_set_value(priv->reset_gpio, 0);
+		gpiod_set_value_cansleep(priv->reset_gpio, 0);
 		udelay(200);
-		gpiod_set_value(priv->reset_gpio, 1);
+		gpiod_set_value_cansleep(priv->reset_gpio, 1);
 	} else {
 		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
 	}
#2 lore raw
Quoted 15 lines · Jonathan Cameron
Quoted 8 lines · On Fri, 22 Nov 2024 13:43:08 -0300 Fabio Estevam <[email protected]> wrote:

Using gpiod_set_value() to control the reset GPIO causes some verbose warnings during boot when the reset GPIO is controlled by an I2C IO expander.

As the caller can sleep, use the gpiod_set_value_cansleep() variant to fix the issue.

Tested on a custom i.MX93 board with a ADS124S08 ADC.

Hmm. Could be considered a feature, but fair enough as the change is trivial and you are setting it on a real board.

Applied to the fixes-togreg branch of iio.git.

...

Quoted 7 lines

drivers/iio/adc/ti-ads124s08.c static int ads124s_reset(struct iio_dev *indio_dev) · line 187

Quoted 7 lines
drivers/iio/adc/ti-ads124s08.c +1 -1
@@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
 	struct ads124s_private *priv = iio_priv(indio_dev);
 
 	if (priv->reset_gpio) {
-		gpiod_set_value(priv->reset_gpio, 0);
+		gpiod_set_value_cansleep(priv->reset_gpio, 0);
 		udelay(200);

Obviously if you allow that change, you should switch to fsleep() here.

Quoted 5 lines
Quoted 5 lines
drivers/iio/adc/ti-ads124s08.c +1 -1
-		gpiod_set_value(priv->reset_gpio, 1);
+		gpiod_set_value_cansleep(priv->reset_gpio, 1);
 	} else {
 		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
 	}
Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer
#3 lore raw
Quoted 22 lines · On Sat, 7 Dec 2024 20:34:30 +0200 Andy Shevchenko…
Quoted 15 lines · Jonathan Cameron
Quoted 8 lines · On Fri, 22 Nov 2024 13:43:08 -0300 Fabio Estevam <[email protected]> wrote:

Using gpiod_set_value() to control the reset GPIO causes some verbose warnings during boot when the reset GPIO is controlled by an I2C IO expander.

As the caller can sleep, use the gpiod_set_value_cansleep() variant to fix the issue.

Tested on a custom i.MX93 board with a ADS124S08 ADC.

Hmm. Could be considered a feature, but fair enough as the change is trivial and you are setting it on a real board.

Applied to the fixes-togreg branch of iio.git.

...

Quoted 3 lines
Quoted 3 lines
drivers/iio/adc/ti-ads124s08.c +0 -0
@@ -183,9 +183,9 @@ static int ads124s_reset(struct iio_dev *indio_dev)
 	struct ads124s_private *priv = iio_priv(indio_dev);
 
Quoted 6 lines
Quoted 4 lines

drivers/iio/adc/ti-ads124s08.c static int ads124s_reset(struct iio_dev *indio_dev) · line 187

Quoted 4 lines
drivers/iio/adc/ti-ads124s08.c +1 -1
 	if (priv->reset_gpio) {
-		gpiod_set_value(priv->reset_gpio, 0);
+		gpiod_set_value_cansleep(priv->reset_gpio, 0);
 		udelay(200);  

Obviously if you allow that change, you should switch to fsleep() here.

True, that would be a nice follow up tidying up.

Jonathan

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
drivers/iio/adc/ti-ads124s08.c +1 -1
-		gpiod_set_value(priv->reset_gpio, 1);
+		gpiod_set_value_cansleep(priv->reset_gpio, 1);
 	} else {
 		return ads124s_write_cmd(indio_dev, ADS124S08_CMD_RESET);
 	}