* [PATCH 1/2] ASoC: dt-bindings: es8316: Add regulator supplies
2026-07-23 7:54 [PATCH 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
@ 2026-07-23 7:54 ` Hongyang Zhao
2026-07-24 9:53 ` Krzysztof Kozlowski
2026-07-23 7:54 ` [PATCH 2/2] ASoC: codecs: es8316: Add regulator support Hongyang Zhao
1 sibling, 1 reply; 5+ messages in thread
From: Hongyang Zhao @ 2026-07-23 7:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Daniel Drake, Katsuhiro Suzuki, Matteo Martelli,
Binbin Zhou, Jaroslav Kysela, Takashi Iwai
Cc: Konrad Dybcio, Roger Shimizu, linux-sound, devicetree,
linux-kernel, Hongyang Zhao
The ES8316 has separate AVDD, CPVDD, DVDD and PVDD supply inputs
for its analog, charge pump, digital core and digital I/O domains.
Describe all four inputs so boards can model the codec power topology.
Keep the properties optional for compatibility with existing
descriptions.
Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
---
.../devicetree/bindings/sound/everest,es8316.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/everest,es8316.yaml b/Documentation/devicetree/bindings/sound/everest,es8316.yaml
index fe5d938ca310..f45f59b7b070 100644
--- a/Documentation/devicetree/bindings/sound/everest,es8316.yaml
+++ b/Documentation/devicetree/bindings/sound/everest,es8316.yaml
@@ -49,6 +49,18 @@ properties:
items:
- const: mclk
+ avdd-supply:
+ description: Regulator providing the analog supply, from 2.0 V to 3.6 V
+
+ cpvdd-supply:
+ description: Regulator providing the charge pump supply, from 1.6 V to 2.0 V
+
+ dvdd-supply:
+ description: Regulator providing the digital core supply, from 1.6 V to 3.6 V
+
+ pvdd-supply:
+ description: Regulator providing the digital I/O supply, from 1.6 V to 3.6 V
+
interrupts:
maxItems: 1
description: Headphone detect interrupt
@@ -77,6 +89,10 @@ examples:
reg = <0x11>;
clocks = <&clks 10>;
clock-names = "mclk";
+ avdd-supply = <®_3p3v>;
+ cpvdd-supply = <®_1p8v>;
+ dvdd-supply = <®_1p8v>;
+ pvdd-supply = <®_1p8v>;
#sound-dai-cells = <0>;
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] ASoC: codecs: es8316: Add regulator support
2026-07-23 7:54 [PATCH 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
2026-07-23 7:54 ` [PATCH 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
@ 2026-07-23 7:54 ` Hongyang Zhao
1 sibling, 0 replies; 5+ messages in thread
From: Hongyang Zhao @ 2026-07-23 7:54 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Daniel Drake, Katsuhiro Suzuki, Matteo Martelli,
Binbin Zhou, Jaroslav Kysela, Takashi Iwai
Cc: Konrad Dybcio, Roger Shimizu, linux-sound, devicetree,
linux-kernel, Hongyang Zhao
ES8316 has separate AVDD, CPVDD, DVDD and PVDD supply inputs.
Request the supplies during I2C probe. Enable them before enabling MCLK
and accessing the device registers, and disable them on probe failure
and component removal.
Leave the supplies enabled during system suspend because the existing
suspend and resume callbacks do not handle a complete power loss.
Powering the codec down would require separate reset and
reinitialization support.
Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
---
sound/soc/codecs/es8316.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 3abe77423f29..904056b2569a 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -14,6 +14,7 @@
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -30,10 +31,20 @@ static const unsigned int supported_mclk_lrck_ratios[] = {
256, 384, 400, 500, 512, 768, 1024
};
+static const char * const es8316_supply_names[] = {
+ "avdd",
+ "cpvdd",
+ "dvdd",
+ "pvdd",
+};
+
+#define ES8316_NUM_SUPPLIES ARRAY_SIZE(es8316_supply_names)
+
struct es8316_priv {
struct mutex lock;
struct clk *mclk;
struct regmap *regmap;
+ struct regulator_bulk_data supplies[ES8316_NUM_SUPPLIES];
struct snd_soc_component *component;
struct snd_soc_jack *jack;
int irq;
@@ -767,10 +778,16 @@ static int es8316_probe(struct snd_soc_component *component)
if (!es8316->mclk)
dev_warn(component->dev, "assuming static mclk\n");
+ ret = regulator_bulk_enable(ES8316_NUM_SUPPLIES, es8316->supplies);
+ if (ret) {
+ dev_err(component->dev, "unable to enable supplies\n");
+ return ret;
+ }
+
ret = clk_prepare_enable(es8316->mclk);
if (ret) {
dev_err(component->dev, "unable to enable mclk\n");
- return ret;
+ goto err_disable_supplies;
}
/* Reset codec and enable current state machine */
@@ -793,6 +810,11 @@ static int es8316_probe(struct snd_soc_component *component)
snd_soc_component_write(component, ES8316_CLKMGR_ADCOSR, 0x32);
return 0;
+
+err_disable_supplies:
+ regulator_bulk_disable(ES8316_NUM_SUPPLIES, es8316->supplies);
+
+ return ret;
}
static void es8316_remove(struct snd_soc_component *component)
@@ -800,6 +822,7 @@ static void es8316_remove(struct snd_soc_component *component)
struct es8316_priv *es8316 = snd_soc_component_get_drvdata(component);
clk_disable_unprepare(es8316->mclk);
+ regulator_bulk_disable(ES8316_NUM_SUPPLIES, es8316->supplies);
}
static int es8316_resume(struct snd_soc_component *component)
@@ -862,7 +885,7 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
{
struct device *dev = &i2c_client->dev;
struct es8316_priv *es8316;
- int ret;
+ int i, ret;
es8316 = devm_kzalloc(&i2c_client->dev, sizeof(struct es8316_priv),
GFP_KERNEL);
@@ -871,6 +894,14 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
i2c_set_clientdata(i2c_client, es8316);
+ for (i = 0; i < ES8316_NUM_SUPPLIES; i++)
+ es8316->supplies[i].supply = es8316_supply_names[i];
+
+ ret = devm_regulator_bulk_get(dev, ES8316_NUM_SUPPLIES,
+ es8316->supplies);
+ if (ret)
+ return dev_err_probe(dev, ret, "unable to get supplies\n");
+
es8316->regmap = devm_regmap_init_i2c(i2c_client, &es8316_regmap);
if (IS_ERR(es8316->regmap))
return PTR_ERR(es8316->regmap);
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread