diff mbox series

[06/16] ASoC: cs42l42: Reset GPIO is mandatory

Message ID 20211015133619.4698-7-rf@opensource.cirrus.com (mailing list archive)
State New, archived
Headers show
Series ASoC: cs42l42: Collection of bugfixes | expand

Commit Message

Richard Fitzgerald Oct. 15, 2021, 1:36 p.m. UTC
The hard RESET must be used to correctly power-up the cs42l42, as
described in the datasheet.

The code was getting the GPIO with devm_gpiod_get_optional(). Change
this to devm_gpiod_get().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 sound/soc/codecs/cs42l42.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Mark Brown Oct. 15, 2021, 2:30 p.m. UTC | #1
On Fri, Oct 15, 2021 at 02:36:09PM +0100, Richard Fitzgerald wrote:

> The hard RESET must be used to correctly power-up the cs42l42, as
> described in the datasheet.

> The code was getting the GPIO with devm_gpiod_get_optional(). Change
> this to devm_gpiod_get().

Does that power sequencing have to be done by the CPU though?  Usually
if a GPIO is not supplied it's because the sequencing is done during the
general power up sequence (PMICs can be programmed to assert GPIOs as
part of the their sequencing for example).
diff mbox series

Patch

diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c
index 0ecf2129ea45..629a0783e693 100644
--- a/sound/soc/codecs/cs42l42.c
+++ b/sound/soc/codecs/cs42l42.c
@@ -2034,17 +2034,14 @@  static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
 	}
 
 	/* Reset the Device */
-	cs42l42->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
-		"reset", GPIOD_OUT_LOW);
+	cs42l42->reset_gpio = devm_gpiod_get(&i2c_client->dev, "reset", GPIOD_OUT_LOW);
 	if (IS_ERR(cs42l42->reset_gpio)) {
 		ret = PTR_ERR(cs42l42->reset_gpio);
+		dev_err(&i2c_client->dev, "Failed to request reset gpio: %d\n", ret);
 		goto err_disable;
 	}
 
-	if (cs42l42->reset_gpio) {
-		dev_dbg(&i2c_client->dev, "Found reset GPIO\n");
-		gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
-	}
+	gpiod_set_value_cansleep(cs42l42->reset_gpio, 1);
 	usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2);
 
 	/* Request IRQ */