* [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver
@ 2026-06-11 3:18 Zhang Yi
2026-06-11 3:18 ` [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Modify the initialization configuration and routes for ES8389,
and add private members.
Describe the added private members in `devicetree/bindings`
v1 -> v0:
-The binding patch has been placed before the corresponding code patch
-Provide a more detailed description of the binding patch
-Provide a more detailed description of the patch about HPF
Zhang Yi (7):
ASoC: dt-bindings: ES8389: Add members about HPF and clock
ASoC: codecs: ES8389: Modify volatile_register
ASoC: codecs: ES8389: Fix the issue about mclk_src
ASoC: codecs: ES8389: Modify the clock table
ASoC: codecs: ES8389: Modify the initial configuration
ASoC: codecs: ES8389: Add private members related to HPF
ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX
.../bindings/sound/everest,es8389.yaml | 23 +++
sound/soc/codecs/es8389.c | 141 +++++++++++++-----
sound/soc/codecs/es8389.h | 6 +-
3 files changed, 128 insertions(+), 42 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
2026-06-11 3:28 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 2/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Add members related to HPF and mclk_source
The value of HPF is not dB, it is just the value of registers
And add HPF settings to the example
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
.../bindings/sound/everest,es8389.yaml | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/everest,es8389.yaml b/Documentation/devicetree/bindings/sound/everest,es8389.yaml
index 75ce0bc48..be92014c0 100644
--- a/Documentation/devicetree/bindings/sound/everest,es8389.yaml
+++ b/Documentation/devicetree/bindings/sound/everest,es8389.yaml
@@ -38,6 +38,27 @@ properties:
description:
Interface power supply.
+ everest,mclk-from-sclk:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ Indicates that SCLK is used as the internal clock.
+
+ everest,hpfl:
+ $ref: /schemas/types.yaml#/definitions/uint8
+ description:
+ the HPF value of ADCL.
+ minimum: 0x00
+ maximum: 0x0f
+ default: 0x0a
+
+ everest,hpfr:
+ $ref: /schemas/types.yaml#/definitions/uint8
+ description:
+ the HPF value of ADCR.
+ minimum: 0x00
+ maximum: 0x0f
+ default: 0x0a
+
required:
- compatible
- reg
@@ -58,5 +79,7 @@ examples:
#sound-dai-cells = <0>;
vddd-supply = <&vdd3v3>;
vdda-supply = <&vdd3v3>;
+ everest,hpfl = [0a];
+ everest,hpfr = [0a];
};
};
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v1 2/7] ASoC: codecs: ES8389: Modify volatile_register
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-11 3:18 ` [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
2026-06-11 3:31 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
` (4 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Mark some registers that are not volatile as false
And modified the logic for `cache_bypass` during `8389_resume`.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 449d9574b..be7a36f17 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -50,10 +50,29 @@ static const char * const es8389_core_supplies[] = {
static bool es8389_volatile_register(struct device *dev,
unsigned int reg)
{
- if ((reg <= 0xff))
- return true;
- else
+ switch (reg) {
+ case ES8389_ADCL_VOL:
+ case ES8389_ADCR_VOL:
+ case ES8389_MIC1_GAIN:
+ case ES8389_MIC2_GAIN:
+ case ES8389_DACL_VOL:
+ case ES8389_DACR_VOL:
+ case ES8389_ALC_ON:
+ case ES8389_ALC_CTL:
+ case ES8389_ALC_TARGET:
+ case ES8389_ALC_GAIN:
+ case ES8389_ADC_MUTE:
+ case ES8389_OSR_VOL:
+ case ES8389_DAC_INV:
+ case ES8389_MIX_VOL:
+ case ES8389_DAC_MIX:
+ case ES8389_ADC_RESET:
+ case ES8389_ADC_MODE:
+ case ES8389_DMIC_EN:
return false;
+ default:
+ return true;
+ }
}
static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -9550, 50, 0);
@@ -861,13 +880,13 @@ static int es8389_resume(struct snd_soc_component *component)
regcache_cache_only(es8389->regmap, false);
regcache_cache_bypass(es8389->regmap, true);
regmap_read(es8389->regmap, ES8389_RESET, ®v);
- regcache_cache_bypass(es8389->regmap, false);
if (regv == 0xff)
es8389_init(component);
else
es8389_set_bias_level(component, SND_SOC_BIAS_ON);
+ regcache_cache_bypass(es8389->regmap, false);
regcache_sync(es8389->regmap);
return 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v1 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-11 3:18 ` [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
2026-06-11 3:18 ` [PATCH v1 2/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
2026-06-11 3:32 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 4/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Fix the issue with incorrect modifications to mclk_src
When the system needs to be configured to use the MCLK from the SCLK pin,
the code still sets the relevant registers to use the MCLK from the MCLK pin
And setting `mclk_src` to `u8` is inappropriate,
because the purpose of `mclk_src` is to determine whether to use SCLK as MCLK.
Therefore, we will change the `mclk_src` member from `u8` to `bool`.
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 12 ++++--------
sound/soc/codecs/es8389.h | 5 ++---
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index be7a36f17..886069be1 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -36,8 +36,8 @@ struct es8389_private {
unsigned int sysclk;
int mastermode;
- u8 mclk_src;
u8 vddd;
+ bool mclk_src;
int version;
enum snd_soc_bias_level bias_level;
};
@@ -607,9 +607,9 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream,
regmap_update_bits(es8389->regmap, ES8389_ADC_FORMAT_MUTE, ES8389_DATA_LEN_MASK, state);
regmap_update_bits(es8389->regmap, ES8389_DAC_FORMAT_MUTE, ES8389_DATA_LEN_MASK, state);
- if (es8389->mclk_src == ES8389_SCLK_PIN) {
+ if (es8389->mclk_src) {
regmap_update_bits(es8389->regmap, ES8389_MASTER_CLK,
- ES8389_MCLK_SOURCE, es8389->mclk_src);
+ ES8389_MCLK_MASK, ES8389_MCLK_FROM_SCLK);
es8389->sysclk = params_channels(params) * params_width(params) * params_rate(params);
}
@@ -897,11 +897,7 @@ static int es8389_probe(struct snd_soc_component *component)
int ret, i;
struct es8389_private *es8389 = snd_soc_component_get_drvdata(component);
- ret = device_property_read_u8(component->dev, "everest,mclk-src", &es8389->mclk_src);
- if (ret != 0) {
- dev_dbg(component->dev, "mclk-src return %d", ret);
- es8389->mclk_src = ES8389_MCLK_SOURCE;
- }
+ es8389->mclk_src = device_property_read_bool(component->dev, "everest,mclk-from-sclk");
for (i = 0; i < ARRAY_SIZE(es8389_core_supplies); i++)
es8389->core_supply[i].supply = es8389_core_supplies[i];
diff --git a/sound/soc/codecs/es8389.h b/sound/soc/codecs/es8389.h
index d21e72f87..7f1212219 100644
--- a/sound/soc/codecs/es8389.h
+++ b/sound/soc/codecs/es8389.h
@@ -116,9 +116,8 @@
#define ES8389_TDM_SLOT (0x70 << 0)
#define ES8389_TDM_SHIFT 4
-#define ES8389_MCLK_SOURCE (1 << 6)
-#define ES8389_MCLK_PIN (1 << 6)
-#define ES8389_SCLK_PIN (0 << 6)
+#define ES8389_MCLK_MASK (3 << 6)
+#define ES8389_MCLK_FROM_SCLK (1 << 6)
/* ES8389_FMT */
#define ES8389_S24_LE (0 << 5)
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v1 4/7] ASoC: codecs: ES8389: Modify the clock table
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
` (2 preceding siblings ...)
2026-06-11 3:18 ` [PATCH v1 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
2026-06-11 3:27 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 5/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Updated the configuration for certain frequencies
If get_coeff does not find a value that matches the condition, return -EINVAL
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 49 +++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 23 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 886069be1..647d9d628 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -434,52 +434,54 @@ static const struct _coeff_div coeff_div[] = {
{36, 576000, 16000, 0x00, 0x55, 0x84, 0xD0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x23, 0x8F, 0xBF, 0xC0, 0x1F, 0x8F, 0x01, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{48, 768000, 16000, 0x02, 0x57, 0x04, 0xC0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{50, 800000, 16000, 0x00, 0x7E, 0x01, 0xD9, 0x00, 0xC2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {64, 1024000, 16000, 0x00, 0x45, 0x24, 0xC0, 0x01, 0xD1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {72, 1152000, 16000, 0x00, 0x45, 0x24, 0xC0, 0x01, 0xD1, 0x90, 0x00, 0x00, 0x23, 0x8F, 0xBF, 0xC0, 0x1F, 0x8F, 0x01, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {64, 1024000, 16000, 0x00, 0x45, 0x24, 0xC0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {72, 1152000, 16000, 0x00, 0x45, 0x24, 0xC0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x23, 0x8F, 0xBF, 0xC0, 0x1F, 0x8F, 0x01, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{96, 1536000, 16000, 0x02, 0x55, 0x84, 0xD0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{128, 2048000, 16000, 0x00, 0x51, 0x04, 0xD0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{144, 2304000, 16000, 0x00, 0x51, 0x00, 0xC0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x23, 0x8F, 0xBF, 0xC0, 0x1F, 0x8F, 0x01, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {150, 2400000, 16000, 0x02, 0x7E, 0x01, 0xC9, 0x00, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{192, 3072000, 16000, 0x02, 0x65, 0x25, 0xE0, 0x00, 0xE1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {256, 4096000, 16000, 0x00, 0x41, 0x04, 0xC0, 0x01, 0xD1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {256, 4096000, 16000, 0x00, 0x41, 0x04, 0xC0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{300, 4800000, 16000, 0x02, 0x66, 0x01, 0xD9, 0x00, 0xC2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{384, 6144000, 16000, 0x02, 0x51, 0x04, 0xD0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {512, 8192000, 16000, 0x01, 0x41, 0x04, 0xC0, 0x01, 0xD1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {512, 8192000, 16000, 0x01, 0x41, 0x04, 0xC0, 0x01, 0xC1, 0x90, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{750, 12000000, 16000, 0x0E, 0x7E, 0x01, 0xC9, 0x00, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {768, 12288000, 16000, 0x02, 0x41, 0x04, 0xC0, 0x01, 0xD1, 0x90, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {1024, 16384000, 16000, 0x03, 0x41, 0x04, 0xC0, 0x01, 0xD1, 0x90, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {768, 12288000, 16000, 0x02, 0x41, 0x04, 0xC0, 0x01, 0xC1, 0x90, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {1024, 16384000, 16000, 0x03, 0x41, 0x04, 0xC0, 0x01, 0xC1, 0x90, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{1152, 18432000, 16000, 0x08, 0x51, 0x04, 0xD0, 0x01, 0xC1, 0x90, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{1200, 19200000, 16000, 0x0B, 0x66, 0x01, 0xD9, 0x00, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{1500, 24000000, 16000, 0x0E, 0x26, 0x01, 0xD9, 0x00, 0xC2, 0x80, 0xC0, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
- {1536, 24576000, 16000, 0x05, 0x41, 0x04, 0xC0, 0x01, 0xD1, 0x90, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
+ {1536, 24576000, 16000, 0x05, 0x41, 0x04, 0xC0, 0x01, 0xC1, 0x90, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0xFF, 0x7F, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{1625, 26000000, 16000, 0x40, 0x6E, 0x05, 0xC8, 0x01, 0xC2, 0x90, 0xC0, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x12, 0x31, 0x0E, 2, 2},
{800, 19200000, 24000, 0x07, 0x66, 0x01, 0xD9, 0x00, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0xC7, 0x95, 0x00, 0x12, 0x00, 0x1A, 0x49, 0x14, 2, 2},
{375, 12000000, 32000, 0x0E, 0x2E, 0x05, 0xC8, 0x00, 0xC2, 0x80, 0x40, 0x01, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x23, 0x61, 0x1B, 2, 0},
- {600, 19200000, 32000, 0x05, 0x46, 0x01, 0xD8, 0x10, 0xD2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x23, 0x61, 0x1B, 2, 2},
- {32, 1411200, 44100, 0x00, 0x45, 0xA4, 0xD0, 0x10, 0xD1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {600, 19200000, 32000, 0x05, 0x46, 0x01, 0xD8, 0x10, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x23, 0x61, 0x1B, 2, 2},
+ {32, 1411200, 44100, 0x00, 0x45, 0xA4, 0xD0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{64, 2822400, 44100, 0x00, 0x51, 0x00, 0xC0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {128, 5644800, 44100, 0x00, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {256, 11289600, 44100, 0x01, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {512, 22579200, 44100, 0x03, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {32, 1536000, 48000, 0x00, 0x45, 0xA4, 0xD0, 0x10, 0xD1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {128, 5644800, 44100, 0x00, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {256, 11289600, 44100, 0x01, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {512, 22579200, 44100, 0x03, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {32, 1536000, 48000, 0x00, 0x45, 0xA4, 0xD0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{48, 2304000, 48000, 0x02, 0x55, 0x04, 0xC0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{50, 2400000, 48000, 0x00, 0x76, 0x01, 0xC8, 0x10, 0xC2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{64, 3072000, 48000, 0x00, 0x51, 0x04, 0xC0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {100, 4800000, 48000, 0x00, 0x46, 0x01, 0xD8, 0x10, 0xD2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {100, 4800000, 48000, 0x00, 0x46, 0x01, 0xD8, 0x10, 0xC2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{125, 6000000, 48000, 0x04, 0x6E, 0x05, 0xC8, 0x10, 0xC2, 0x80, 0x00, 0x01, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {128, 6144000, 48000, 0x00, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {200, 9600000, 48000, 0x01, 0x46, 0x01, 0xD8, 0x10, 0xD2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {128, 6144000, 48000, 0x00, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {200, 9600000, 48000, 0x01, 0x46, 0x01, 0xD8, 0x10, 0xC2, 0x80, 0x00, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{250, 12000000, 48000, 0x04, 0x76, 0x01, 0xC8, 0x10, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {256, 12288000, 48000, 0x01, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {384, 18432000, 48000, 0x02, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {400, 19200000, 48000, 0x03, 0x46, 0x01, 0xD8, 0x10, 0xD2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {500, 24000000, 48000, 0x04, 0x46, 0x01, 0xD8, 0x10, 0xD2, 0x80, 0xC0, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
- {512, 24576000, 48000, 0x03, 0x41, 0x04, 0xD0, 0x10, 0xD1, 0x80, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {256, 12288000, 48000, 0x01, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {384, 18432000, 48000, 0x02, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0x40, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {400, 19200000, 48000, 0x03, 0x46, 0x01, 0xD8, 0x10, 0xC2, 0x80, 0x40, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {500, 24000000, 48000, 0x04, 0x46, 0x01, 0xD8, 0x10, 0xC2, 0x80, 0xC0, 0x00, 0x18, 0x95, 0xD0, 0xC0, 0x63, 0x95, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
+ {512, 24576000, 48000, 0x03, 0x41, 0x04, 0xD0, 0x10, 0xC1, 0x80, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{800, 38400000, 48000, 0x18, 0x45, 0x04, 0xC0, 0x10, 0xC1, 0x80, 0xC0, 0x00, 0x1F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x00, 0x12, 0x00, 0x35, 0x91, 0x28, 2, 2},
{128, 11289600, 88200, 0x00, 0x50, 0x00, 0xC0, 0x10, 0xC1, 0x80, 0x40, 0x00, 0x9F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x32, 0x89, 0x25, 2, 2},
- {64, 6144000, 96000, 0x00, 0x41, 0x00, 0xD0, 0x10, 0xD1, 0x80, 0x00, 0x00, 0x9F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x35, 0x91, 0x28, 2, 2},
+ {64, 6144000, 96000, 0x00, 0x41, 0x00, 0xD0, 0x10, 0xC1, 0x80, 0x00, 0x00, 0x9F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x35, 0x91, 0x28, 2, 2},
{96, 9216000, 96000, 0x02, 0x43, 0x00, 0xC0, 0x10, 0xC0, 0x80, 0x00, 0x00, 0x9F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x35, 0x91, 0x28, 2, 2},
{256, 24576000, 96000, 0x00, 0x40, 0x00, 0xC0, 0x10, 0xC1, 0x80, 0xC0, 0x00, 0x9F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x35, 0x91, 0x28, 2, 2},
{128, 24576000, 192000, 0x00, 0x50, 0x00, 0xC0, 0x18, 0xC1, 0x81, 0xC0, 0x00, 0x8F, 0x7F, 0xBF, 0xC0, 0x3F, 0x7F, 0x80, 0x12, 0xC0, 0x3F, 0xF9, 0x3F, 2, 2},
+ {64, 12288000, 192000, 0x00, 0x41, 0x00, 0xC0, 0x18, 0xC1, 0x80, 0x00, 0x00, 0x8F, 0x7F, 0xEF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x3F, 0xF9, 0x3F, 1, 0},
};
static inline int get_coeff(u8 vddd, u8 dmic, int mclk, int rate)
@@ -657,7 +659,8 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream,
regmap_write(es8389->regmap, ES8389_SYSTEM18, coeff_div[coeff].Reg0x18);
regmap_write(es8389->regmap, ES8389_SYSTEM19, coeff_div[coeff].Reg0x19);
} else {
- dev_warn(component->dev, "Clock coefficients do not match");
+ dev_err(component->dev, "Clock coefficients do not match");
+ return -EINVAL;
}
return 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v1 5/7] ASoC: codecs: ES8389: Modify the initial configuration
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
` (3 preceding siblings ...)
2026-06-11 3:18 ` [PATCH v1 4/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
2026-06-11 3:26 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 6/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
2026-06-11 3:18 ` [PATCH v1 7/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Zhang Yi
6 siblings, 1 reply; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Modify the initial configuration
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 647d9d628..284eb707f 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -793,7 +793,7 @@ static void es8389_init(struct snd_soc_component *component)
regmap_read(es8389->regmap, ES8389_MAX_REGISTER, ®);
es8389->version = reg;
- regmap_write(es8389->regmap, ES8389_ISO_CTL, 0x00);
+ regmap_write(es8389->regmap, ES8389_ISO_CTL, 0x56);
regmap_write(es8389->regmap, ES8389_RESET, 0x7E);
regmap_write(es8389->regmap, ES8389_ISO_CTL, 0x38);
regmap_write(es8389->regmap, ES8389_ADC_HPF1, 0x64);
@@ -845,7 +845,7 @@ static void es8389_init(struct snd_soc_component *component)
regmap_write(es8389->regmap, ES8389_SCLK_DIV, 0x04);
regmap_write(es8389->regmap, ES8389_LRCK_DIV1, 0x01);
regmap_write(es8389->regmap, ES8389_LRCK_DIV2, 0x00);
- regmap_write(es8389->regmap, ES8389_OSC_CLK, 0x00);
+ regmap_write(es8389->regmap, ES8389_OSC_CLK, 0x10);
regmap_write(es8389->regmap, ES8389_ADC_OSR, 0x1F);
regmap_write(es8389->regmap, ES8389_ADC_DSP, 0x7F);
regmap_write(es8389->regmap, ES8389_ADC_MUTE, 0xC0);
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v1 6/7] ASoC: codecs: ES8389: Add private members related to HPF
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
` (4 preceding siblings ...)
2026-06-11 3:18 ` [PATCH v1 5/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
2026-06-11 3:18 ` [PATCH v1 7/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Zhang Yi
6 siblings, 0 replies; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Add private members related to HPF.
And defines ES8389_HPF_DEFAULT
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 18 ++++++++++++++++--
sound/soc/codecs/es8389.h | 1 +
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 284eb707f..2460cf977 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -36,6 +36,8 @@ struct es8389_private {
unsigned int sysclk;
int mastermode;
+ u8 hpfl;
+ u8 hpfr;
u8 vddd;
bool mclk_src;
int version;
@@ -743,8 +745,8 @@ static int es8389_mute(struct snd_soc_dai *dai, int mute, int direction)
regmap_update_bits(es8389->regmap, ES8389_DAC_FORMAT_MUTE,
0x03, 0x00);
} else {
- regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, 0x0a);
- regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, 0x0a);
+ regmap_update_bits(es8389->regmap, ES8389_ADC_HPF1, 0x0f, es8389->hpfl);
+ regmap_update_bits(es8389->regmap, ES8389_ADC_HPF2, 0x0f, es8389->hpfr);
regmap_update_bits(es8389->regmap, ES8389_ADC_FORMAT_MUTE,
0x03, 0x00);
}
@@ -902,6 +904,18 @@ static int es8389_probe(struct snd_soc_component *component)
es8389->mclk_src = device_property_read_bool(component->dev, "everest,mclk-from-sclk");
+ ret = device_property_read_u8(component->dev, "everest,hpfl", &es8389->hpfl);
+ if (ret != 0) {
+ dev_dbg(component->dev, "hpfl return %d\n", ret);
+ es8389->hpfl = ES8389_HPF_DEFAULT;
+ }
+
+ ret = device_property_read_u8(component->dev, "everest,hpfr", &es8389->hpfr);
+ if (ret != 0) {
+ dev_dbg(component->dev, "hpfr return %d\n", ret);
+ es8389->hpfr = ES8389_HPF_DEFAULT;
+ }
+
for (i = 0; i < ARRAY_SIZE(es8389_core_supplies); i++)
es8389->core_supply[i].supply = es8389_core_supplies[i];
ret = devm_regulator_bulk_get(component->dev, ARRAY_SIZE(es8389_core_supplies), es8389->core_supply);
diff --git a/sound/soc/codecs/es8389.h b/sound/soc/codecs/es8389.h
index 7f1212219..81353dcec 100644
--- a/sound/soc/codecs/es8389.h
+++ b/sound/soc/codecs/es8389.h
@@ -105,6 +105,7 @@
#define ES8389_MIC_SEL_MASK (7 << 4)
#define ES8389_MIC_DEFAULT (1 << 4)
+#define ES8389_HPF_DEFAULT (0x0A << 0)
#define ES8389_MASTER_MODE_EN (1 << 0)
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v1 7/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
` (5 preceding siblings ...)
2026-06-11 3:18 ` [PATCH v1 6/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
@ 2026-06-11 3:18 ` Zhang Yi
6 siblings, 0 replies; 13+ messages in thread
From: Zhang Yi @ 2026-06-11 3:18 UTC (permalink / raw)
To: linux-sound, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
Add INPUTL MUX and INPUTR MUX in route
Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
---
sound/soc/codecs/es8389.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
index 2460cf977..23e85ddfe 100644
--- a/sound/soc/codecs/es8389.c
+++ b/sound/soc/codecs/es8389.c
@@ -164,6 +164,16 @@ static const struct soc_enum alc_ramprate =
static const struct soc_enum alc_winsize =
SOC_ENUM_SINGLE(ES8389_ALC_CTL, 0, 16, winsize);
+static const char *const es8389_adcl_mux_txt[] = {
+ "Normal",
+ "ADC2 channel to ADC1 channel",
+};
+
+static const char *const es8389_adcr_mux_txt[] = {
+ "Normal",
+ "ADC1 channel to ADC2 channel",
+};
+
static const char *const es8389_outl_mux_txt[] = {
"Normal",
"DAC2 channel to DAC1 channel",
@@ -191,6 +201,20 @@ static const unsigned int es8389_pga_values[] = {
1, 5, 6
};
+static const struct soc_enum es8389_adcl_mux_enum =
+ SOC_ENUM_SINGLE(ES8389_ADC_MODE, 5,
+ ARRAY_SIZE(es8389_adcl_mux_txt), es8389_adcl_mux_txt);
+
+static const struct snd_kcontrol_new es8389_adcl_mux_controls =
+ SOC_DAPM_ENUM("INPUTL MUX", es8389_adcl_mux_enum);
+
+static const struct soc_enum es8389_adcr_mux_enum =
+ SOC_ENUM_SINGLE(ES8389_ADC_MODE, 4,
+ ARRAY_SIZE(es8389_adcr_mux_txt), es8389_adcr_mux_txt);
+
+static const struct snd_kcontrol_new es8389_adcr_mux_controls =
+ SOC_DAPM_ENUM("INPUTR MUX", es8389_adcr_mux_enum);
+
static const struct soc_enum es8389_outl_mux_enum =
SOC_ENUM_SINGLE(ES8389_DAC_MIX, 5,
ARRAY_SIZE(es8389_outl_mux_txt), es8389_outl_mux_txt);
@@ -319,6 +343,8 @@ static const struct snd_soc_dapm_widget es8389_dapm_widgets[] = {
&es8389_adc_mixer_controls[0],
ARRAY_SIZE(es8389_adc_mixer_controls)),
SND_SOC_DAPM_MUX("ADC MUX", SND_SOC_NOPM, 0, 0, &es8389_dmic_mux_controls),
+ SND_SOC_DAPM_MUX("INPUTL MUX", SND_SOC_NOPM, 0, 0, &es8389_adcl_mux_controls),
+ SND_SOC_DAPM_MUX("INPUTR MUX", SND_SOC_NOPM, 0, 0, &es8389_adcr_mux_controls),
SND_SOC_DAPM_MUX("OUTL MUX", SND_SOC_NOPM, 0, 0, &es8389_outl_mux_controls),
SND_SOC_DAPM_MUX("OUTR MUX", SND_SOC_NOPM, 0, 0, &es8389_outr_mux_controls),
@@ -332,10 +358,15 @@ static const struct snd_soc_dapm_route es8389_dapm_routes[] = {
{"ADCL", NULL, "PGAL"},
{"ADCR", NULL, "PGAR"},
+ {"INPUTL MUX", "Normal", "ADCL"},
+ {"INPUTL MUX", "ADC2 channel to ADC1 channel", "ADCR"},
+ {"INPUTR MUX", "Normal", "ADCR"},
+ {"INPUTR MUX", "ADC1 channel to ADC2 channel", "ADCL"},
+
{"ADC Mixer", "DACL ADCL Mixer", "DACL"},
{"ADC Mixer", "DACR ADCR Mixer", "DACR"},
- {"ADC Mixer", NULL, "ADCL"},
- {"ADC Mixer", NULL, "ADCR"},
+ {"ADC Mixer", NULL, "INPUTL MUX"},
+ {"ADC Mixer", NULL, "INPUTR MUX"},
{"ADC MUX", "AMIC", "ADC Mixer"},
{"ADC MUX", "DMIC", "DMIC"},
--
2.17.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v1 5/7] ASoC: codecs: ES8389: Modify the initial configuration
2026-06-11 3:18 ` [PATCH v1 5/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
@ 2026-06-11 3:26 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-06-11 3:26 UTC (permalink / raw)
To: Zhang Yi; +Cc: robh, devicetree, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The return values of multiple `regmap_read()` calls are ignored, leading to the use of uninitialized stack variables.
--
commit eeca5823fe9bef5ffe179596ec0a3aab2d9ba07a
Author: Zhang Yi <zhangyi@everest-semi.com>
ASoC: codecs: ES8389: Modify the initial configuration
Modify the initial configuration.
> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 647d9d62820e6..284eb707f9f7f 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c
> @@ -793,7 +793,7 @@ static void es8389_init(struct snd_soc_component *component)
>
> regmap_read(es8389->regmap, ES8389_MAX_REGISTER, ®);
> es8389->version = reg;
[Severity: High]
This isn't a bug introduced by this patch, but I noticed the return value of
regmap_read() is ignored here. If the read fails, 'reg' will remain
uninitialized, and es8389->version will be corrupted with stack garbage.
Could this also cause unpredictable behavior in other parts of the driver?
Similar unchecked regmap_read() calls seem to exist in:
- es8389_pcm_hw_params() (corrupting dmic_enable)
- es8389_mute() (triggering spurious state changes)
- es8389_resume() (potentially triggering es8389_init() erroneously)
> - regmap_write(es8389->regmap, ES8389_ISO_CTL, 0x00);
> + regmap_write(es8389->regmap, ES8389_ISO_CTL, 0x56);
> regmap_write(es8389->regmap, ES8389_RESET, 0x7E);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611031824.4628-1-zhangyi@everest-semi.com?part=5
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 4/7] ASoC: codecs: ES8389: Modify the clock table
2026-06-11 3:18 ` [PATCH v1 4/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
@ 2026-06-11 3:27 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-06-11 3:27 UTC (permalink / raw)
To: Zhang Yi; +Cc: devicetree, conor+dt, robh
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Flawed clock coefficient matching logic makes `dmic_sel = 0` and `dvdd_vol = 0` act as wildcards, leading to incorrect hardware configuration and dead code.
- [High] Unchecked `regmap_read()` return value leads to the use of uninitialized stack memory for hardware configuration.
--
commit b24373f65176191e8456a8034960817f67429760
Author: Zhang Yi <zhangyi@everest-semi.com>
ASoC: codecs: ES8389: Modify the clock table
Updated the configuration for certain frequencies
If get_coeff does not find a value that matches the condition, return -EINVAL
> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 886069be1535f..647d9d62820e6 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c
[ ... ]
> @@ -434,52 +434,54 @@ static const struct _coeff_div coeff_div[] = {
[ ... ]
> {256, 24576000, 96000, 0x00, 0x40, 0x00, 0xC0, 0x10, 0xC1, 0x80, 0xC0, 0x00, 0x9F, 0x7F, 0xBF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x35, 0x91, 0x28, 2, 2},
> {128, 24576000, 192000, 0x00, 0x50, 0x00, 0xC0, 0x18, 0xC1, 0x81, 0xC0, 0x00, 0x8F, 0x7F, 0xBF, 0xC0, 0x3F, 0x7F, 0x80, 0x12, 0xC0, 0x3F, 0xF9, 0x3F, 2, 2},
> + {64, 12288000, 192000, 0x00, 0x41, 0x00, 0xC0, 0x18, 0xC1, 0x80, 0x00, 0x00, 0x8F, 0x7F, 0xEF, 0xC0, 0x7F, 0x7F, 0x80, 0x12, 0xC0, 0x3F, 0xF9, 0x3F, 1, 0},
[Severity: High]
This is a pre-existing issue, but will the wildcard matching logic in
get_coeff() cause this new entry to match incorrectly?
In get_coeff(), the wildcard logic uses modulo 2:
dmic_det |= ~(coeff_div[i].dmic_sel % 2) & 0x01;
For dmic_sel = 0, 0 % 2 == 0, which forces dmic_det to 1 regardless of the
requested dmic state. This makes 0 behave exactly like the 2 wildcard. As a
result, entries intending to strictly match dmic = 0 (such as this newly
added entry) will incorrectly match any DMIC state.
Could this also cause existing entries like `{... 2, 0}` to mask subsequent
`{... 2, 1}` entries, resulting in unreachable dead code and incorrect
hardware coefficients being applied?
> };
>
> static inline int get_coeff(u8 vddd, u8 dmic, int mclk, int rate)
[ ... ]
> @@ -657,7 +659,8 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream,
> regmap_write(es8389->regmap, ES8389_SYSTEM18, coeff_div[coeff].Reg0x18);
> regmap_write(es8389->regmap, ES8389_SYSTEM19, coeff_div[coeff].Reg0x19);
> } else {
> - dev_warn(component->dev, "Clock coefficients do not match");
> + dev_err(component->dev, "Clock coefficients do not match");
> + return -EINVAL;
[Severity: High]
This is a pre-existing issue, but could the lack of error checking on
regmap_read() lead to the use of uninitialized stack memory for hardware
configuration?
Earlier in es8389_pcm_hw_params(), the driver calls regmap_read() without
validating its return value:
regmap_read(es8389->regmap, ES8389_DMIC_EN, ®v);
dmic_enable = regv >> 7 & 0x01;
If the underlying communication fails, the local variable regv remains
uninitialized. This stack memory is then immediately evaluated when selecting
coefficients. Could this cause the driver to select and apply random,
non-deterministic clock coefficients to the hardware?
> }
>
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611031824.4628-1-zhangyi@everest-semi.com?part=4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock
2026-06-11 3:18 ` [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
@ 2026-06-11 3:28 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-06-11 3:28 UTC (permalink / raw)
To: Zhang Yi; +Cc: conor+dt, devicetree, robh
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Adding Devicetree properties ('everest,hpfl', 'everest,hpfr') that represent raw register values instead of physical hardware descriptions, and statically configuring audio processing features that should be ALSA kcontrols.
- [Medium] Custom clock routing property 'everest,mclk-from-sclk' bypasses standard ASoC clock configuration APIs.
--
commit f53482d6ef6f3f66c8185a876c24dae03171cfd8
Author: Zhang Yi <zhangyi@everest-semi.com>
ASoC: dt-bindings: ES8389: Add members about HPF and clock
Add members related to HPF and mclk_source. The value of HPF is not dB, it
is just the value of registers. And add HPF settings to the example.
> diff --git a/Documentation/devicetree/bindings/sound/everest,es8389.yaml b/Documentation/devicetree/bindings/sound/everest,es8389.yaml
> index 75ce0bc489045..be92014c0c597 100644
> --- a/Documentation/devicetree/bindings/sound/everest,es8389.yaml
> +++ b/Documentation/devicetree/bindings/sound/everest,es8389.yaml
> @@ -38,6 +38,27 @@ properties:
> description:
> Interface power supply.
>
> + everest,mclk-from-sclk:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description:
> + Indicates that SCLK is used as the internal clock.
[Severity: Medium]
Does this custom boolean flag bypass standard ASoC clock configuration APIs?
Statically configuring the codec to use SCLK as the internal clock via
devicetree limits machine driver flexibility. ASoC clock routing decisions
are normally handled dynamically by the machine driver using standard APIs
like snd_soc_dai_set_sysclk() and the standard devicetree clocks property.
A later commit in the series (ASoC: codecs: ES8389: Fix the issue about
mclk_src) addresses a type mismatch where the driver initially expected a u8
instead of a boolean, but the architectural bypass issue remains.
> +
> + everest,hpfl:
> + $ref: /schemas/types.yaml#/definitions/uint8
> + description:
> + the HPF value of ADCL.
> + minimum: 0x00
> + maximum: 0x0f
> + default: 0x0a
> +
> + everest,hpfr:
> + $ref: /schemas/types.yaml#/definitions/uint8
> + description:
> + the HPF value of ADCR.
> + minimum: 0x00
> + maximum: 0x0f
> + default: 0x0a
[Severity: Medium]
Should these properties be represented as ALSA kcontrols instead?
Devicetree is designed to describe hardware topology and physical
characteristics, not to pass raw register configurations. Audio processing
parameters like a High-Pass Filter (HPF) should be exposed to userspace as
ALSA kcontrols so they can be dynamically adjusted or bypassed.
In sound/soc/codecs/es8389.c:es8389_probe(), the driver reads these custom
raw register properties directly. Can we expose these as kcontrols instead?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611031824.4628-1-zhangyi@everest-semi.com?part=1
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 2/7] ASoC: codecs: ES8389: Modify volatile_register
2026-06-11 3:18 ` [PATCH v1 2/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
@ 2026-06-11 3:31 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-06-11 3:31 UTC (permalink / raw)
To: Zhang Yi; +Cc: conor+dt, devicetree, robh
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete volatile register whitelist causes state loss on suspend/resume.
- [High] Ignored `regmap_read()` return values lead to the use of uninitialized stack variables.
- [High] Unbalanced clock prepare/enable and disable/unprepare calls due to manual bias level manipulation.
--
commit 13fa26be72cc2a7540f3f86a2ef766aae985561e
Author: Zhang Yi <zhangyi@everest-semi.com>
ASoC: codecs: ES8389: Modify volatile_register
Mark some registers that are not volatile as false
And modified the logic for cache_bypass during 8389_resume.
> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index 449d9574b03a8..be7a36f17083f 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c
> @@ -50,10 +50,29 @@ static const char * const es8389_core_supplies[] = {
> static bool es8389_volatile_register(struct device *dev,
> unsigned int reg)
> {
> - if ((reg <= 0xff))
> - return true;
> - else
> + switch (reg) {
> + case ES8389_ADCL_VOL:
> + case ES8389_ADCR_VOL:
> + case ES8389_MIC1_GAIN:
> + case ES8389_MIC2_GAIN:
> + case ES8389_DACL_VOL:
> + case ES8389_DACR_VOL:
> + case ES8389_ALC_ON:
> + case ES8389_ALC_CTL:
> + case ES8389_ALC_TARGET:
> + case ES8389_ALC_GAIN:
> + case ES8389_ADC_MUTE:
> + case ES8389_OSR_VOL:
> + case ES8389_DAC_INV:
> + case ES8389_MIX_VOL:
> + case ES8389_DAC_MIX:
> + case ES8389_ADC_RESET:
> + case ES8389_ADC_MODE:
> + case ES8389_DMIC_EN:
> return false;
> + default:
> + return true;
> + }
> }
[Severity: High]
This isn't a bug introduced by this patch, but will this incomplete whitelist
cause state loss across suspend/resume cycles?
Because the default case marks all unlisted registers as volatile, critical
configuration registers like ES8389_ADC_HPF2, ES8389_MASTER_MODE, and
ES8389_CLK_DIV1 are omitted from the cache.
Since regcache_sync() skips volatile registers, won't es8389_init() just
overwrite these with default values during resume, discarding any active
user configurations?
[ ... ]
> @@ -861,13 +880,13 @@ static int es8389_resume(struct snd_soc_component *component)
> regcache_cache_only(es8389->regmap, false);
> regcache_cache_bypass(es8389->regmap, true);
> regmap_read(es8389->regmap, ES8389_RESET, ®v);
[Severity: High]
This is a pre-existing issue, but does this code risk branching on an
uninitialized variable?
If regmap_read() fails during early resume, regv will contain uninitialized
stack memory. The subsequent check against 0xff will yield unpredictable
results, potentially skipping the required initialization.
The same issue appears to exist in es8389_init() when reading
ES8389_MAX_REGISTER into the local variable reg before assigning it to
es8389->version. Could we check the return values of these reads?
> - regcache_cache_bypass(es8389->regmap, false);
>
> if (regv == 0xff)
> es8389_init(component);
> else
> es8389_set_bias_level(component, SND_SOC_BIAS_ON);
[Severity: High]
This is a pre-existing issue, but does calling es8389_set_bias_level()
directly from the resume and suspend handlers conflict with the ASoC DAPM
framework?
Since DAPM independently transitions bias levels and triggers the
registered set_bias_level callback, it seems this direct call would cause
clk_prepare_enable() to run multiple times on resume, leaking the clock
reference count.
Similarly, during suspend, wouldn't redundant calls to
clk_disable_unprepare() cause a clock underflow warning?
>
> + regcache_cache_bypass(es8389->regmap, false);
> regcache_sync(es8389->regmap);
>
> return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611031824.4628-1-zhangyi@everest-semi.com?part=2
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src
2026-06-11 3:18 ` [PATCH v1 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
@ 2026-06-11 3:32 ` sashiko-bot
0 siblings, 0 replies; 13+ messages in thread
From: sashiko-bot @ 2026-06-11 3:32 UTC (permalink / raw)
To: Zhang Yi; +Cc: conor+dt, devicetree, robh
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing symmetric constraints for channels and sample bits allows concurrent streams to corrupt shared clock configuration.
- [High] Concurrent `hw_params` calls can race, leading to corrupted internal state and interleaved register writes.
--
commit 58316d49bbe1cd5f1a16ef61d0304cd59b1dd9ba
Author: Zhang Yi <zhangyi@everest-semi.com>
ASoC: codecs: ES8389: Fix the issue about mclk_src
Fix the issue with incorrect modifications to mclk_src when configuring
the system to use MCLK from the SCLK pin. Changes the mclk_src member
from u8 to bool to better represent its purpose.
> diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c
> index be7a36f17083f..886069be1535f 100644
> --- a/sound/soc/codecs/es8389.c
> +++ b/sound/soc/codecs/es8389.c
[ ... ]
> @@ -607,9 +607,9 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream,
> regmap_update_bits(es8389->regmap, ES8389_ADC_FORMAT_MUTE, ES8389_DATA_LEN_MASK, state);
> regmap_update_bits(es8389->regmap, ES8389_DAC_FORMAT_MUTE, ES8389_DATA_LEN_MASK, state);
>
> - if (es8389->mclk_src == ES8389_SCLK_PIN) {
> + if (es8389->mclk_src) {
> regmap_update_bits(es8389->regmap, ES8389_MASTER_CLK,
> - ES8389_MCLK_SOURCE, es8389->mclk_src);
> + ES8389_MCLK_MASK, ES8389_MCLK_FROM_SCLK);
> es8389->sysclk = params_channels(params) * params_width(params) * params_rate(params);
[Severity: High]
This is a pre-existing issue, but I noticed the driver dynamically calculates
a shared internal clock (es8389->sysclk) based on the stream parameters here.
Since the es8389_dai definition doesn't set .symmetric_channels = 1 or
.symmetric_sample_bits = 1, couldn't user-space concurrently open playback
and capture streams with different channel counts or bit widths?
Would the second stream silently recalculate and overwrite the hardware clock
registers, breaking the already-running stream?
[Severity: High]
This is also a pre-existing issue, but does this function need locking to
protect against concurrent execution?
ALSA's PCM core does not serialize hw_params calls between separate playback
and capture substreams on the same DAI. If playback and capture streams
execute hw_params simultaneously, couldn't they race when updating shared
driver state like es8389->sysclk and es8389->vddd?
Later in this function, there's a sequence of about 20 non-atomic regmap_write
operations to clock control registers:
regmap_write(es8389->regmap, ES8389_CLK_DIV1, coeff_div[coeff].Reg0x04);
regmap_write(es8389->regmap, ES8389_CLK_MUL, coeff_div[coeff].Reg0x05);
...
Could concurrent execution interleave these hardware register writes and
potentially leave the codec's clocking tree in an invalid state?
> }
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260611031824.4628-1-zhangyi@everest-semi.com?part=3
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-06-11 3:32 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-11 3:18 [PATCH v1 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Zhang Yi
2026-06-11 3:18 ` [PATCH v1 1/7] ASoC: dt-bindings: ES8389: Add members about HPF and clock Zhang Yi
2026-06-11 3:28 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 2/7] ASoC: codecs: ES8389: Modify volatile_register Zhang Yi
2026-06-11 3:31 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 3/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Zhang Yi
2026-06-11 3:32 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 4/7] ASoC: codecs: ES8389: Modify the clock table Zhang Yi
2026-06-11 3:27 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 5/7] ASoC: codecs: ES8389: Modify the initial configuration Zhang Yi
2026-06-11 3:26 ` sashiko-bot
2026-06-11 3:18 ` [PATCH v1 6/7] ASoC: codecs: ES8389: Add private members related to HPF Zhang Yi
2026-06-11 3:18 ` [PATCH v1 7/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Zhang Yi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox