[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251217-sound-soc-codecs-tvl320adcx140-v1-6-293dea149d7b@pengutronix.de>
Date: Wed, 17 Dec 2025 14:54:56 +0100
From: Sascha Hauer <s.hauer@...gutronix.de>
To: Shenghao Ding <shenghao-ding@...com>, Kevin Lu <kevin-lu@...com>,
Baojun Xu <baojun.xu@...com>, Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>, Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Clark Williams <clrkwllms@...nel.org>, Steven Rostedt <rostedt@...dmis.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Andrew Davis <afd@...com>,
Dan Murphy <dmurphy@...com>
Cc: linux-sound@...r.kernel.org, linux-kernel@...r.kernel.org,
Kevin Lu <luminlong@....com>, linux-rt-devel@...ts.linux.dev,
devicetree@...r.kernel.org, Sascha Hauer <s.hauer@...gutronix.de>,
Emil-Juhl <emdj@...g-olufsen.dk>
Subject: [PATCH 06/11] ASoC: tlv320adcx140: add avdd and iovdd supply
From: Emil-Juhl <emdj@...g-olufsen.dk>
The datasheet, under "10 Power Supply Recommendations" section,
specifies that both the AVDD and IOVDD supplies must be up and stable
for at least 100us before the SHDNZ can be released. After that, the
chip is ready to receive commands after another 2ms.
Currently the driver doesn't contain any options to bind AVDD and IOVDD
supplies to the tlv320adcx140.
This commit adds bindings for AVDD and IOVDD supplies which the driver
will enable when used.
Signed-off-by: Emil-Juhl <emdj@...g-olufsen.dk>
Signed-off-by: Sascha Hauer <s.hauer@...gutronix.de>
---
sound/soc/codecs/tlv320adcx140.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 444c0e80f0907de201ed1818b5612164a48b0fca..a7200e149e5f40ddd61e3c0455b796c81f55e2e8 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -22,8 +22,16 @@
#include "tlv320adcx140.h"
+static const char *const adcx140_supply_names[] = {
+ "avdd",
+ "iovdd",
+};
+
+#define ADCX140_NUM_SUPPLIES ARRAY_SIZE(adcx140_supply_names)
+
struct adcx140_priv {
struct regulator *supply_areg;
+ struct regulator_bulk_data supplies[ADCX140_NUM_SUPPLIES];
struct gpio_desc *gpio_reset;
struct regmap *regmap;
struct device *dev;
@@ -1104,6 +1112,8 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
static int adcx140_pwr_off(struct adcx140_priv *adcx140)
{
+ int ret;
+
regcache_cache_only(adcx140->regmap, true);
regcache_mark_dirty(adcx140->regmap);
@@ -1117,6 +1127,14 @@ static int adcx140_pwr_off(struct adcx140_priv *adcx140)
*/
usleep_range(30000, 100000);
+ /* Power off the regulators, `avdd` and `iovdd` */
+ ret = regulator_bulk_disable(ARRAY_SIZE(adcx140->supplies),
+ adcx140->supplies);
+ if (ret) {
+ dev_err(adcx140->dev, "Failed to disable supplies: %d\n", ret);
+ return ret;
+ }
+
return 0;
}
@@ -1124,6 +1142,14 @@ static int adcx140_pwr_on(struct adcx140_priv *adcx140)
{
int ret;
+ /* Power on the regulators, `avdd` and `iovdd` */
+ ret = regulator_bulk_enable(ARRAY_SIZE(adcx140->supplies),
+ adcx140->supplies);
+ if (ret) {
+ dev_err(adcx140->dev, "Failed to enable supplies: %d\n", ret);
+ return ret;
+ }
+
/* De-assert the reset GPIO */
gpiod_set_value_cansleep(adcx140->gpio_reset, 1);
@@ -1234,6 +1260,16 @@ static int adcx140_i2c_probe(struct i2c_client *i2c)
adcx140->phase_calib_on = false;
adcx140->dev = &i2c->dev;
+ for (int i = 0; i < ADCX140_NUM_SUPPLIES; i++)
+ adcx140->supplies[i].supply = adcx140_supply_names[i];
+
+ ret = devm_regulator_bulk_get(&i2c->dev, ADCX140_NUM_SUPPLIES,
+ adcx140->supplies);
+ if (ret) {
+ dev_err_probe(&i2c->dev, ret, "Failed to request supplies\n");
+ return ret;
+ }
+
adcx140->gpio_reset = devm_gpiod_get_optional(adcx140->dev,
"reset", GPIOD_OUT_LOW);
if (IS_ERR(adcx140->gpio_reset))
--
2.47.3
Powered by blists - more mailing lists