* [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver
@ 2026-06-08 8:35 Michael Zhang
2026-06-08 8:35 ` [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register Michael Zhang
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw)
To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi
From: Zhang Yi <zhangyi@everest-semi.com>
v0:
- Modify volatile_register
- Add MCLK_MASK to resolve the issue related to mclk_src
- Modify configuration about clock
- Add private members about HPF at driver and devicetree
- Add INPUT MUX at route
Zhang Yi (7):
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
ASoC: dt-bindings: ES8389: Add members about HPF
.../bindings/sound/everest,es8389.yaml | 18 +++
sound/soc/codecs/es8389.c | 130 +++++++++++++-----
sound/soc/codecs/es8389.h | 8 +-
3 files changed, 121 insertions(+), 35 deletions(-)
--
2.54.0.windows.1
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 2026-06-08 8:50 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Michael Zhang ` (5 subsequent siblings) 6 siblings, 1 reply; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> Mark some registers that are not volatile as false Signed-off-by: Zhang Yi <zhangyi@everest-semi.com> --- sound/soc/codecs/es8389.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c index 449d9574b03a..9c816491648c 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_ADC_HPF1: + case ES8389_ADC_HPF2: + 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: return false; + default: + return true; + } } static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -9550, 50, 0); -- 2.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register 2026-06-08 8:35 ` [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register Michael Zhang @ 2026-06-08 8:50 ` sashiko-bot 0 siblings, 0 replies; 13+ messages in thread From: sashiko-bot @ 2026-06-08 8:50 UTC (permalink / raw) To: Michael Zhang; +Cc: robh, devicetree, conor+dt Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: Pre-existing issues: - [High] Incomplete volatile register whitelist in es8389_volatile_register defaults critical configuration registers to volatile, preventing caching and causing state loss on system resume. -- commit 6d3835182ae5a01c7bc864c068b51c95ea47c9c2 Author: Zhang Yi <zhangyi@everest-semi.com> ASoC: codecs: ES8389: Modify volatile_register This commit modifies the volatile register handling for the ES8389 codec. It replaces a simple address range check with a specific whitelist of registers that should be considered non-volatile. > diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c > --- 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_ADC_HPF1: > + case ES8389_ADC_HPF2: [ ... ] > + case ES8389_MIX_VOL: > + case ES8389_DAC_MIX: > + case ES8389_ADC_RESET: > return false; > + default: > + return true; > + } > } [Severity: High] This is a pre-existing issue, but since you are updating the volatile register logic here, could this default-to-true behavior cause problems during system resume? Critical configuration registers like ES8389_DMIC_EN and ES8389_ADC_MODE (managed by the 'ADC MUX' user kcontrol), as well as format registers configured by es8389_set_dai_fmt() (e.g., ES8389_ADC_FORMAT_MUTE and ES8389_DAC_FORMAT_MUTE), are not explicitly listed in this switch statement. Because they fall through to this default case, they are marked as volatile and bypass the regmap cache. When the system resumes from suspend, regcache_sync() will not restore these registers. If the codec resets these registers to hardware defaults upon resuming, won't user-selected mux configurations and DAI formats be permanently lost, potentially breaking the audio path? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260608083540.12581-1-zhangyi@everest-semi.com?part=1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v0 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang 2026-06-08 8:35 ` [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 2026-06-08 8:52 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 3/7] ASoC: codecs: ES8389: Modify the clock table Michael Zhang ` (4 subsequent siblings) 6 siblings, 1 reply; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> Fix the issue with incorrect modifications to mclk_src Signed-off-by: Zhang Yi <zhangyi@everest-semi.com> --- sound/soc/codecs/es8389.c | 2 +- sound/soc/codecs/es8389.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c index 9c816491648c..638eb1f0462e 100644 --- a/sound/soc/codecs/es8389.c +++ b/sound/soc/codecs/es8389.c @@ -609,7 +609,7 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream, if (es8389->mclk_src == ES8389_SCLK_PIN) { regmap_update_bits(es8389->regmap, ES8389_MASTER_CLK, - ES8389_MCLK_SOURCE, es8389->mclk_src); + ES8389_MCLK_MASK, es8389->mclk_src); es8389->sysclk = params_channels(params) * params_width(params) * params_rate(params); } diff --git a/sound/soc/codecs/es8389.h b/sound/soc/codecs/es8389.h index d21e72f876a6..13ce241774dc 100644 --- a/sound/soc/codecs/es8389.h +++ b/sound/soc/codecs/es8389.h @@ -116,9 +116,10 @@ #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_SOURCE (0 << 6) +#define ES8389_MCLK_PIN (0 << 6) +#define ES8389_SCLK_PIN (1 << 6) /* ES8389_FMT */ #define ES8389_S24_LE (0 << 5) -- 2.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v0 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src 2026-06-08 8:35 ` [PATCH v0 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Michael Zhang @ 2026-06-08 8:52 ` sashiko-bot 0 siblings, 0 replies; 13+ messages in thread From: sashiko-bot @ 2026-06-08 8:52 UTC (permalink / raw) To: Michael Zhang; +Cc: robh, conor+dt, devicetree Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Devicetree ABI Breakage and Hardware Leak in mclk_src Evaluation -- commit 901f3e10a3b9643fed9b6bed617589331a04275d Author: Zhang Yi <zhangyi@everest-semi.com> ASoC: codecs: ES8389: Fix the issue about mclk_src This commit addresses an issue with incorrect modifications to the mclk_src configuration by updating the bitmask logic and hardware register definitions. > diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c > index 9c816491648c7..638eb1f0462ea 100644 > --- a/sound/soc/codecs/es8389.c > +++ b/sound/soc/codecs/es8389.c > @@ -609,7 +609,7 @@ static int es8389_pcm_hw_params(struct snd_pcm_substream *substream, > > if (es8389->mclk_src == ES8389_SCLK_PIN) { [Severity: High] Does this change break the devicetree ABI? In es8389_probe(), the driver reads the "everest,mclk-src" devicetree property directly into the es8389->mclk_src variable: sound/soc/codecs/es8389.c:es8389_probe() { ... ret = device_property_read_u8(component->dev, "everest,mclk-src", &es8389->mclk_src); ... } Since ES8389_SCLK_PIN is redefined below as (1 << 6), any existing device trees using logical values like <0> or <1> will fail this equality check. This will silently bypass the SCLK configuration and break audio functionality, unless device tree authors now populate the property with the raw hardware bitmask <64>. > regmap_update_bits(es8389->regmap, ES8389_MASTER_CLK, > - ES8389_MCLK_SOURCE, es8389->mclk_src); > + ES8389_MCLK_MASK, es8389->mclk_src); > es8389->sysclk = params_channels(params) * params_width(params) * params_rate(params); > } [ ... ] > diff --git a/sound/soc/codecs/es8389.h b/sound/soc/codecs/es8389.h > index d21e72f876a60..13ce241774dc8 100644 > --- a/sound/soc/codecs/es8389.h > +++ b/sound/soc/codecs/es8389.h > @@ -116,9 +116,10 @@ > #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_SOURCE (0 << 6) > +#define ES8389_MCLK_PIN (0 << 6) > +#define ES8389_SCLK_PIN (1 << 6) -- Sashiko AI review · https://sashiko.dev/#/patchset/20260608083540.12581-1-zhangyi@everest-semi.com?part=2 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v0 3/7] ASoC: codecs: ES8389: Modify the clock table 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang 2026-06-08 8:35 ` [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register Michael Zhang 2026-06-08 8:35 ` [PATCH v0 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 2026-06-08 8:51 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 4/7] ASoC: codecs: ES8389: Modify the initial configuration Michael Zhang ` (3 subsequent siblings) 6 siblings, 1 reply; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> Updated the configuration for certain frequencies Signed-off-by: Zhang Yi <zhangyi@everest-semi.com> --- sound/soc/codecs/es8389.c | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c index 638eb1f0462e..cd8284da8c62 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) -- 2.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v0 3/7] ASoC: codecs: ES8389: Modify the clock table 2026-06-08 8:35 ` [PATCH v0 3/7] ASoC: codecs: ES8389: Modify the clock table Michael Zhang @ 2026-06-08 8:51 ` sashiko-bot 0 siblings, 0 replies; 13+ messages in thread From: sashiko-bot @ 2026-06-08 8:51 UTC (permalink / raw) To: Michael Zhang; +Cc: conor+dt, devicetree, robh Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider: Pre-existing issues: - [High] Bitwise logic in get_coeff() incorrectly treats dmic_sel=0 and dvdd_vol=0 as wildcards, shadowing specific clock configurations and breaking newly added entries. - [High] Regulator reference leak on component removal. - [High] Use of uninitialized memory if regmap_read fails in es8389_pcm_hw_params. - [High] Use of uninitialized memory if regmap_read fails in es8389_resume. - [High] es8389_pcm_hw_params silently ignores missing clock coefficients. -- commit a0eb9b57ebbdde5147755b4d72d8594f88569a95 Author: Zhang Yi <zhangyi@everest-semi.com> ASoC: codecs: ES8389: Modify the clock table Updated the configuration for certain frequencies in the es8389 codec. > diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c > index 638eb1f0462ea..cd8284da8c62c 100644 > --- a/sound/soc/codecs/es8389.c > +++ b/sound/soc/codecs/es8389.c > @@ -434,52 +434,54 @@ static const struct _coeff_div coeff_div[] = { [ ... ] > {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) [Severity: High] This is a pre-existing issue, but modifying this table highlights a bug in get_coeff() that affects how these entries are matched. Does the bitwise logic in get_coeff() incorrectly treat dmic_sel=0 and dvdd_vol=0 as wildcards? sound/soc/codecs/es8389.c:get_coeff() { ... vddd_det |= ~(coeff_div[i].dvdd_vol % 2) & 0x01; dmic_det |= ~(coeff_div[i].dmic_sel % 2) & 0x01; if (vddd_det && dmic_det) return i; ... } This unconditionally evaluates to 1 when dmic_sel or dvdd_vol is 0, turning 0 into a wildcard instead of an exact match. This can shadow specific clock configurations and render subsequent array entries with the same rate/mclk unreachable. [Severity: High] This is a pre-existing issue, but could we fix a regulator reference leak on component removal? In es8389_probe(), regulators are retrieved and manually enabled, but the corresponding es8389_remove() component teardown function does not disable them: sound/soc/codecs/es8389.c:es8389_remove() { struct es8389_private *es8389 = snd_soc_component_get_drvdata(component); ... regmap_write(es8389->regmap, ES8389_ISO_CTL, 0xC1); regmap_write(es8389->regmap, ES8389_PULL_DOWN, 0x00); } Does this leak the regulator references when the I2C driver is unbound or the module is removed? [Severity: High] This is a pre-existing issue, but does this code use uninitialized memory if regmap_read() fails? sound/soc/codecs/es8389.c:es8389_pcm_hw_params() { ... regmap_read(es8389->regmap, ES8389_DMIC_EN, ®v); dmic_enable = regv >> 7 & 0x01; ... } The return value of regmap_read() is ignored. If the I2C read fails, regv contains uninitialized stack memory, causing dmic_enable to be randomly set and potentially leading to invalid clock configurations. [Severity: High] This is a pre-existing issue, but does this code use uninitialized memory if regmap_read() fails upon resuming? sound/soc/codecs/es8389.c:es8389_resume() { ... regmap_read(es8389->regmap, ES8389_RESET, ®v); regcache_cache_bypass(es8389->regmap, false); if (regv == 0xff) ... } Similar to hw_params, if the hardware is unresponsive and the read fails, regv contains uninitialized stack memory, potentially causing unpredictable branching. [Severity: High] This is a pre-existing issue, but does es8389_pcm_hw_params() silently ignore missing clock coefficients? sound/soc/codecs/es8389.c:es8389_pcm_hw_params() { ... } else { dev_warn(component->dev, "Clock coefficients do not match"); } return 0; } If get_coeff() fails to find a valid clock configuration, this function logs a warning but still returns 0 (success). Can this mislead the ALSA core into running audio with a misconfigured codec clock tree? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260608083540.12581-1-zhangyi@everest-semi.com?part=3 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v0 4/7] ASoC: codecs: ES8389: Modify the initial configuration 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang ` (2 preceding siblings ...) 2026-06-08 8:35 ` [PATCH v0 3/7] ASoC: codecs: ES8389: Modify the clock table Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 2026-06-08 8:46 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 5/7] ASoC: codecs: ES8389: Add private members related to HPF Michael Zhang ` (2 subsequent siblings) 6 siblings, 1 reply; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> 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 cd8284da8c62..ad016c255c77 100644 --- a/sound/soc/codecs/es8389.c +++ b/sound/soc/codecs/es8389.c @@ -792,7 +792,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); @@ -844,7 +844,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.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v0 4/7] ASoC: codecs: ES8389: Modify the initial configuration 2026-06-08 8:35 ` [PATCH v0 4/7] ASoC: codecs: ES8389: Modify the initial configuration Michael Zhang @ 2026-06-08 8:46 ` sashiko-bot 0 siblings, 0 replies; 13+ messages in thread From: sashiko-bot @ 2026-06-08 8:46 UTC (permalink / raw) To: Michael Zhang; +Cc: robh, conor+dt, devicetree Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider: Pre-existing issues: - [High] Resource leaks due to missing cleanup in component remove callback. - [High] Uninitialized stack variables are used due to missing `regmap_read` error handling. - [High] Hardware sequencing violation: clock is enabled before power supplies. - [High] Hardware sequencing violation and mclk enablement bypass during resume. -- commit d35264c96a589a7e049b06bc9a887fbec2163074 Author: Zhang Yi <zhangyi@everest-semi.com> ASoC: codecs: ES8389: Modify the initial configuration This commit modifies the initial configuration for the ES8389 codec. It changes the values written to the ES8389_ISO_CTL and ES8389_OSC_CLK registers during the initialization sequence. > diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c > index cd8284da8c62c..ad016c255c773 100644 > --- a/sound/soc/codecs/es8389.c > +++ b/sound/soc/codecs/es8389.c > @@ -792,7 +792,7 @@ static void es8389_init(struct snd_soc_component *component) > > regmap_read(es8389->regmap, ES8389_MAX_REGISTER, ®); [Severity: High] This isn't a bug introduced by this patch, but I noticed that regmap_read() is called without checking the return value. If the I2C read fails, the stack variable reg remains uninitialized. Does this code unintentionally use an uninitialized value for es8389->version and in other functions like es8389_pcm_hw_params() or es8389_mute()? For example, in es8389_resume(): sound/soc/codecs/es8389.c:es8389_resume() { ... regmap_read(es8389->regmap, ES8389_RESET, ®v); if (regv == 0xff) ... } If the read fails, regv could be uninitialized stack garbage, potentially causing it to take the 0xff branch incorrectly. > 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); [ ... ] > @@ -844,7 +844,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); [Severity: High] This isn't a bug introduced by this patch, but looking at the component remove callback, is it possible that we are leaking the clock and regulator resources? In es8389_probe(), the clock and regulators are enabled: sound/soc/codecs/es8389.c:es8389_probe() { ... ret = clk_prepare_enable(es8389->mclk); ... ret = regulator_bulk_enable(ARRAY_SIZE(es8389_core_supplies), es8389->core_supply); ... } However, es8389_remove() does not seem to call clk_disable_unprepare() or regulator_bulk_disable(). Could this permanently leak these resources every time the sound card is bound and unbound? [Severity: High] This is a pre-existing issue, but does the power sequencing in es8389_probe() follow standard hardware requirements? sound/soc/codecs/es8389.c:es8389_probe() { ... ret = clk_prepare_enable(es8389->mclk); ... ret = regulator_bulk_enable(ARRAY_SIZE(es8389_core_supplies), es8389->core_supply); ... } The clock is enabled before the core power supplies are enabled. Can driving a clock signal into an unpowered IC draw power through the clock pin's ESD protection diodes, potentially causing unpredictable logic states? [Severity: High] This is another pre-existing issue, but could we bypass the master clock enablement during resume? sound/soc/codecs/es8389.c:es8389_resume() { ... regmap_read(es8389->regmap, ES8389_RESET, ®v); if (regv == 0xff) es8389_init(component); else es8389_set_bias_level(component, SND_SOC_BIAS_ON); ... } During es8389_suspend(), the bias level drops to STANDBY, disabling the master clock. In es8389_resume(), if the register read returns 0xff, es8389_init() is called instead of es8389_set_bias_level(..., SND_SOC_BIAS_ON). Does this result in writing to the codec registers without the master clock enabled, and leaving the master clock permanently disabled after the resume completes? -- Sashiko AI review · https://sashiko.dev/#/patchset/20260608083540.12581-1-zhangyi@everest-semi.com?part=4 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v0 5/7] ASoC: codecs: ES8389: Add private members related to HPF 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang ` (3 preceding siblings ...) 2026-06-08 8:35 ` [PATCH v0 4/7] ASoC: codecs: ES8389: Modify the initial configuration Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 2026-06-08 8:49 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 6/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Michael Zhang 2026-06-08 8:35 ` [PATCH v0 7/7] ASoC: dt-bindings: ES8389: Add members about HPF Michael Zhang 6 siblings, 1 reply; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> 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 ad016c255c77..743cfca2a6ab 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 mclk_src; u8 vddd; int version; @@ -742,8 +744,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); } @@ -905,6 +907,18 @@ static int es8389_probe(struct snd_soc_component *component) es8389->mclk_src = ES8389_MCLK_SOURCE; } + ret = device_property_read_u8(component->dev, "everest,hpfl", &es8389->hpfl); + if (ret != 0) { + dev_dbg(component->dev, "hpfl return %d", 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", 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 13ce241774dc..197e6f7b27e9 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.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v0 5/7] ASoC: codecs: ES8389: Add private members related to HPF 2026-06-08 8:35 ` [PATCH v0 5/7] ASoC: codecs: ES8389: Add private members related to HPF Michael Zhang @ 2026-06-08 8:49 ` sashiko-bot 0 siblings, 0 replies; 13+ messages in thread From: sashiko-bot @ 2026-06-08 8:49 UTC (permalink / raw) To: Michael Zhang; +Cc: devicetree, robh, conor+dt Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Missing newline `\n` in `dev_dbg` format strings. -- commit 237c4458de0007d329850d65722e75250d0003bc Author: Zhang Yi <zhangyi@everest-semi.com> ASoC: codecs: ES8389: Add private members related to HPF This commit adds private members related to the High Pass Filter (HPF) for the ES8389 codec. It introduces device property reads during probe to configure these values. > diff --git a/sound/soc/codecs/es8389.c b/sound/soc/codecs/es8389.c > --- a/sound/soc/codecs/es8389.c > +++ b/sound/soc/codecs/es8389.c [ ... ] > @@ -905,6 +907,18 @@ static int es8389_probe(struct snd_soc_component *component) > es8389->mclk_src = ES8389_MCLK_SOURCE; > } > > + ret = device_property_read_u8(component->dev, "everest,hpfl", &es8389->hpfl); > + if (ret != 0) { > + dev_dbg(component->dev, "hpfl return %d", ret); [Severity: Low] Is there a missing newline at the end of this dev_dbg format string? > + 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", ret); [Severity: Low] Does this dev_dbg format string also need a terminating newline? > + es8389->hpfr = ES8389_HPF_DEFAULT; > + } > + -- Sashiko AI review · https://sashiko.dev/#/patchset/20260608083540.12581-1-zhangyi@everest-semi.com?part=5 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v0 6/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang ` (4 preceding siblings ...) 2026-06-08 8:35 ` [PATCH v0 5/7] ASoC: codecs: ES8389: Add private members related to HPF Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 2026-06-08 8:35 ` [PATCH v0 7/7] ASoC: dt-bindings: ES8389: Add members about HPF Michael Zhang 6 siblings, 0 replies; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> 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 743cfca2a6ab..8922fc990096 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.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v0 7/7] ASoC: dt-bindings: ES8389: Add members about HPF 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang ` (5 preceding siblings ...) 2026-06-08 8:35 ` [PATCH v0 6/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Michael Zhang @ 2026-06-08 8:35 ` Michael Zhang 6 siblings, 0 replies; 13+ messages in thread From: Michael Zhang @ 2026-06-08 8:35 UTC (permalink / raw) To: alsa-devel, broonie, devicetree; +Cc: tiwai, robh, krzk+dt, conor+dt, Zhang Yi From: Zhang Yi <zhangyi@everest-semi.com> Add members related to HPF Signed-off-by: Zhang Yi <zhangyi@everest-semi.com> --- .../bindings/sound/everest,es8389.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/everest,es8389.yaml b/Documentation/devicetree/bindings/sound/everest,es8389.yaml index 75ce0bc48904..eb4639f60f09 100644 --- a/Documentation/devicetree/bindings/sound/everest,es8389.yaml +++ b/Documentation/devicetree/bindings/sound/everest,es8389.yaml @@ -38,6 +38,22 @@ properties: description: Interface power supply. + 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 +74,7 @@ examples: #sound-dai-cells = <0>; vddd-supply = <&vdd3v3>; vdda-supply = <&vdd3v3>; + everest,hpfl = [0a]; + everest,hpfr = [0a]; }; }; -- 2.54.0.windows.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-06-08 8:52 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-08 8:35 [PATCH v0 0/7] ASoC: codecs: ES8389: Modify the ES8389 driver Michael Zhang 2026-06-08 8:35 ` [PATCH v0 1/7] ASoC: codecs: ES8389: Modify volatile_register Michael Zhang 2026-06-08 8:50 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 2/7] ASoC: codecs: ES8389: Fix the issue about mclk_src Michael Zhang 2026-06-08 8:52 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 3/7] ASoC: codecs: ES8389: Modify the clock table Michael Zhang 2026-06-08 8:51 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 4/7] ASoC: codecs: ES8389: Modify the initial configuration Michael Zhang 2026-06-08 8:46 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 5/7] ASoC: codecs: ES8389: Add private members related to HPF Michael Zhang 2026-06-08 8:49 ` sashiko-bot 2026-06-08 8:35 ` [PATCH v0 6/7] ASoC: codecs: ES8389: Add INPUTL MUX and INPUTR MUX Michael Zhang 2026-06-08 8:35 ` [PATCH v0 7/7] ASoC: dt-bindings: ES8389: Add members about HPF Michael Zhang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox