diff mbox series

sound: soc: codecs: tlv320aic3x: Fix codec gpio-reset

Message ID 20240930-wip-bhahn-tlv320aic3x_fix_reset-v1-1-c040d86a4b93@phytec.de
State New
Headers show
Series sound: soc: codecs: tlv320aic3x: Fix codec gpio-reset | expand

Commit Message

Benjamin Hahn Sept. 30, 2024, 7:16 a.m. UTC
The TLV320AIC3007 requires a hardware reset after power-up for proper
operation. After all power supplies are at their specified values,
the RESET pin must be driven low for at least 10 ns. Even though the
datasheet sais min 10ns, I needed more than 10ns when testing this out.
15ns worked for me.

Signed-off-by: Benjamin Hahn <B.Hahn@phytec.de>
---
 sound/soc/codecs/tlv320aic3x.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


---
base-commit: ad46e8f95e931e113cb98253daf6d443ac244cde
change-id: 20240930-wip-bhahn-tlv320aic3x_fix_reset-cca918a4889d

Best regards,
diff mbox series

Patch

diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 56e795a00e22..d002fc0b99b5 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1367,8 +1367,11 @@  static int aic3x_regulator_event(struct notifier_block *nb,
 		 * Put codec to reset and require cache sync as at least one
 		 * of the supplies was disabled
 		 */
-		if (aic3x->gpio_reset)
+		if (aic3x->gpio_reset) {
 			gpiod_set_value(aic3x->gpio_reset, 1);
+			ndelay(15);
+			gpiod_set_value(aic3x->gpio_reset, 0);
+		}
 		regcache_mark_dirty(aic3x->regmap);
 	}
 
@@ -1813,6 +1816,10 @@  int aic3x_probe(struct device *dev, struct regmap *regmap, kernel_ulong_t driver
 
 	gpiod_set_consumer_name(aic3x->gpio_reset, "tlv320aic3x reset");
 
+	/* CODEC datasheet says minimum of 10ns */
+	ndelay(15);
+	gpiod_set_value(aic3x->gpio_reset, 0);
+
 	for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++)
 		aic3x->supplies[i].supply = aic3x_supply_names[i];