diff mbox series

[v2,2/3] ASoC: cs4265: Fix the reset_gpio polarity

Message ID 20211229114457.4101989-2-festevam@gmail.com
State New
Headers show
Series [v2,1/3] ASoC: cs4265: Fix part number ID error message | expand

Commit Message

Fabio Estevam Dec. 29, 2021, 11:44 a.m. UTC
From: Fabio Estevam <festevam@denx.de>

Currently, the reset_gpio polarity handling is done backwards.

The gpiod API takes the logic value of the GPIO, not the physical one.

As per the CS4265 datasheet:

"When RESET is low, the CS4265 enters a low-power mode and all
internal states are reset"

If a devicetree describes reset_gpio as active-low, the correct behaviour
would be to retrieve the GPIO and put in its active state (GPIOD_OUT_HIGH)
and then move it to its inactive state so that it can be operational
(logic level 0).

Fix it accordingly.

Fixes: fb6f806967f6 ("ASoC: Add support for the CS4265 CODEC")
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Newly introduced patch.

 sound/soc/codecs/cs4265.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index b89002189a2b..294fa7ac16cb 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -590,13 +590,13 @@  static int cs4265_i2c_probe(struct i2c_client *i2c_client,
 	}
 
 	cs4265->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
-		"reset", GPIOD_OUT_LOW);
+		"reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(cs4265->reset_gpio))
 		return PTR_ERR(cs4265->reset_gpio);
 
 	if (cs4265->reset_gpio) {
 		mdelay(1);
-		gpiod_set_value_cansleep(cs4265->reset_gpio, 1);
+		gpiod_set_value_cansleep(cs4265->reset_gpio, 0);
 	}
 
 	i2c_set_clientdata(i2c_client, cs4265);