* [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies
2026-08-12 9:35 [PATCH v2 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
@ 2026-08-12 9:35 ` Hongyang Zhao
2026-08-12 19:28 ` Rob Herring (Arm)
2026-08-12 19:42 ` Rob Herring
2026-08-12 9:35 ` [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support Hongyang Zhao
2026-08-12 10:49 ` [PATCH v2 0/2] ASoC: " Mark Brown
2 siblings, 2 replies; 7+ messages in thread
From: Hongyang Zhao @ 2026-08-12 9:35 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.
The binding also covers ES8311 and ES8323, whose supply inputs differ,
so restrict these properties to the ES8316 compatible. Keep them
optional for compatibility with existing descriptions.
Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
---
.../devicetree/bindings/sound/everest,es8316.yaml | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/everest,es8316.yaml b/Documentation/devicetree/bindings/sound/everest,es8316.yaml
index fe5d938ca310..276c73bb4790 100644
--- a/Documentation/devicetree/bindings/sound/everest,es8316.yaml
+++ b/Documentation/devicetree/bindings/sound/everest,es8316.yaml
@@ -30,6 +30,17 @@ description: |
allOf:
- $ref: dai-common.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: everest,es8316
+ else:
+ properties:
+ avdd-supply: false
+ cpvdd-supply: false
+ dvdd-supply: false
+ pvdd-supply: false
properties:
compatible:
@@ -49,6 +60,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 +100,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] 7+ messages in thread* Re: [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies
2026-08-12 9:35 ` [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
@ 2026-08-12 19:28 ` Rob Herring (Arm)
2026-08-12 19:42 ` Rob Herring
1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2026-08-12 19:28 UTC (permalink / raw)
To: Hongyang Zhao
Cc: linux-sound, linux-kernel, Matteo Martelli, Takashi Iwai,
Konrad Dybcio, Krzysztof Kozlowski, Liam Girdwood, Binbin Zhou,
Roger Shimizu, Daniel Drake, Mark Brown, Conor Dooley, devicetree,
Jaroslav Kysela, Katsuhiro Suzuki
On Wed, 12 Aug 2026 17:35:43 +0800, Hongyang Zhao wrote:
> 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.
>
> The binding also covers ES8311 and ES8323, whose supply inputs differ,
> so restrict these properties to the ES8316 compatible. Keep them
> optional for compatibility with existing descriptions.
>
> Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
> ---
> .../devicetree/bindings/sound/everest,es8316.yaml | 27 ++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/everest,es8316.yaml: allOf:1: 'then' is a dependency of 'if'
hint: Keywords must be a subset of known json-schema keywords
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/everest,es8316.yaml: allOf:1: 'then' is a dependency of 'else'
hint: Keywords must be a subset of known json-schema keywords
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.kernel.org/project/devicetree/patch/20260812-es8316-regulator-next-20260722-v2-1-e7078bc9bc9c@thundersoft.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies
2026-08-12 9:35 ` [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
2026-08-12 19:28 ` Rob Herring (Arm)
@ 2026-08-12 19:42 ` Rob Herring
1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring @ 2026-08-12 19:42 UTC (permalink / raw)
To: Hongyang Zhao
Cc: Liam Girdwood, Mark Brown, Krzysztof Kozlowski, Conor Dooley,
Daniel Drake, Katsuhiro Suzuki, Matteo Martelli, Binbin Zhou,
Jaroslav Kysela, Takashi Iwai, Konrad Dybcio, Roger Shimizu,
linux-sound, devicetree, linux-kernel
On Wed, Aug 12, 2026 at 05:35:43PM +0800, Hongyang Zhao wrote:
> 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.
>
> The binding also covers ES8311 and ES8323, whose supply inputs differ,
> so restrict these properties to the ES8316 compatible. Keep them
> optional for compatibility with existing descriptions.
>
> Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
> ---
> .../devicetree/bindings/sound/everest,es8316.yaml | 27 ++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/everest,es8316.yaml b/Documentation/devicetree/bindings/sound/everest,es8316.yaml
> index fe5d938ca310..276c73bb4790 100644
> --- a/Documentation/devicetree/bindings/sound/everest,es8316.yaml
> +++ b/Documentation/devicetree/bindings/sound/everest,es8316.yaml
> @@ -30,6 +30,17 @@ description: |
>
> allOf:
> - $ref: dai-common.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + const: everest,es8316
> + else:
Missing 'then'. You need to invert the 'if'.
Looks like Mark already applied, so you'll need to send incremental
patch.
Rob
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support
2026-08-12 9:35 [PATCH v2 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
2026-08-12 9:35 ` [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
@ 2026-08-12 9:35 ` Hongyang Zhao
2026-08-12 9:57 ` sashiko-bot
2026-08-12 10:49 ` [PATCH v2 0/2] ASoC: " Mark Brown
2 siblings, 1 reply; 7+ messages in thread
From: Hongyang Zhao @ 2026-08-12 9:35 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 and enable the supplies during I2C probe, before initializing
the regmap. Keep them enabled for the lifetime of the I2C device so the
regmap cannot access an unpowered device and its cache remains
synchronized if the ASoC component is unbound and rebound.
Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
---
sound/soc/codecs/es8316.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 87f331868dc7..24ec8b211cdb 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -15,6 +15,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>
@@ -31,6 +32,13 @@ 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",
+};
+
struct es8316_priv {
struct mutex lock;
struct clk *mclk;
@@ -866,6 +874,11 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
i2c_set_clientdata(i2c_client, es8316);
+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(es8316_supply_names),
+ es8316_supply_names);
+ if (ret)
+ return dev_err_probe(dev, ret, "unable to enable 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] 7+ messages in thread* Re: [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support
2026-08-12 9:35 ` [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support Hongyang Zhao
@ 2026-08-12 9:57 ` sashiko-bot
0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-08-12 9:57 UTC (permalink / raw)
To: Hongyang Zhao; +Cc: conor+dt, robh, devicetree
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
New issues:
- [Medium] Potential I2C communication failure due to missing stabilization delay after enabling regulators.
Pre-existing issues:
- [Critical] Use-After-Free of snd_soc_component in the IRQ handler due to devres teardown order.
- [High] Regmap cache desynchronization due to pre-existing hardware reset defeating the patch's premise.
--
--- Patch [2]: [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support ---
commit 3daba0da576ac350b6f022776265341a98e4d7f5
Author: Hongyang Zhao <hongyang.zhao@thundersoft.com>
ASoC: codecs: es8316: Add regulator support
ES8316 has separate AVDD, CPVDD, DVDD and PVDD supply inputs.
> Request and enable the supplies during I2C probe, before initializing
> the regmap. Keep them enabled for the lifetime of the I2C device so the
> regmap cannot access an unpowered device and its cache remains
> synchronized if the ASoC component is unbound and rebound.
[Severity: High]
This isn't a bug introduced by this patch, but does the pre-existing hardware
reset in es8316_probe() defeat the premise of keeping the regmap synchronized?
When the component is unbound and rebound, es8316_probe() executes:
sound/soc/codecs/es8316.c:es8316_probe() {
...
snd_soc_component_write(component, ES8316_RESET, 0x3f);
...
}
This wipes the physical chip state without marking the regcache dirty.
Consequently, subsequent ALSA control writes matching the stale cache might be
dropped, leading to silent audio or incorrect settings.
> Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
> diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
> index 87f331868dc7f..24ec8b211cdba 100644
> --- a/sound/soc/codecs/es8316.c
> +++ b/sound/soc/codecs/es8316.c
[ ... ]
> @@ -866,6 +874,11 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
>
> i2c_set_clientdata(i2c_client, es8316);
>
> + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(es8316_supply_names),
> + es8316_supply_names);
[Severity: Medium]
Will this lack of stabilization delay cause I2C communication failures?
If the ES8316 requires a delay after power is applied before its I2C state
machine is ready, the first I2C write during the component probe could
receive a NACK. Might it be safer to add a small post-power-on delay here?
> + if (ret)
> + return dev_err_probe(dev, ret, "unable to enable supplies\n");
> +
[Severity: Critical]
This is a pre-existing issue, but is there a use-after-free risk during
devres teardown?
During module removal or I2C device unbind, devres tears down resources in
reverse order of allocation. The IRQ is requested later in this function
before the component memory is allocated via devres.
If the hardware asserts the IRQ in the narrow window after the component
is freed but before the IRQ is disabled and freed, es8316_irq() will
dereference the freed component pointer:
sound/soc/codecs/es8316.c:es8316_irq() {
...
dev_dbg(comp->dev, "gpio flags %#04x\n", flags);
...
}
Can this lead to memory corruption if the handler executes late?
> es8316->regmap = devm_regmap_init_i2c(i2c_client, &es8316_regmap);
> if (IS_ERR(es8316->regmap))
> return PTR_ERR(es8316->regmap);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260812-es8316-regulator-next-20260722-v2-0-e7078bc9bc9c@thundersoft.com?part=2
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] ASoC: es8316: Add regulator support
2026-08-12 9:35 [PATCH v2 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
2026-08-12 9:35 ` [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
2026-08-12 9:35 ` [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support Hongyang Zhao
@ 2026-08-12 10:49 ` Mark Brown
2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-08-12 10:49 UTC (permalink / raw)
To: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Daniel Drake, Katsuhiro Suzuki, Matteo Martelli, Binbin Zhou,
Jaroslav Kysela, Takashi Iwai, Hongyang Zhao
Cc: Konrad Dybcio, Roger Shimizu, linux-sound, devicetree,
linux-kernel
On Wed, 12 Aug 2026 17:35:42 +0800, Hongyang Zhao wrote:
> ASoC: es8316: Add regulator support
>
> Add regulator support for the four ES8316 power domains so board
> descriptions can model and control the codec supplies.
>
> The binding patch documents AVDD, CPVDD, DVDD and PVDD as optional
> supplies for ES8316, preserving compatibility with existing device-tree
> descriptions. The driver patch enables the supplies before initializing
> the regmap and keeps them enabled for the lifetime of the I2C device.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3
Thanks!
[1/2] ASoC: dt-bindings: es8316: Add regulator supplies
https://git.kernel.org/broonie/sound/c/e9966d450b46
[2/2] ASoC: codecs: es8316: Add regulator support
https://git.kernel.org/broonie/sound/c/c60279912ef0
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread