Skip to contentSkip to conversation

ASoC: es9356: fix the capture gain dB scale

PATCH Superseded Zachary Huang 2 participants 2 messages Nov 6

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: es9356: fix the capture gain dB scale

The two capture gain controls are declared with a TLV step of 3 (FU33, analog mic) and 6 (FU11, DMIC). The TLV step is expressed in 0.01 dB units, so this advertises 0.03 dB and 0.06 dB per step: with a value range of 0..10 and 0..3 the whole controls appear to span only 0.30 dB and 0.18 dB.

The hardware steps are 3 dB and 6 dB, i.e. 0..30 dB and 0..18 dB. Measured on a MECHREVO WUJIE 14SAH (ES9356 on SoundWire link 0) by recording the same signal at all four FU11 settings:

    FU11=0   rms  523  (-35.9 dBFS)
    FU11=1   rms 1007  (-30.3 dBFS)
    FU11=2   rms 2011  (-24.2 dBFS)
    FU11=3   rms 3794  (-18.7 dBFS)

That is about +6 dB per step, matching the hardware definition rather than the advertised 0.06 dB.

Because userspace (alsamixer, PipeWire/WirePlumber) derives the volume from this TLV, the capture gain currently looks like a control without any usable range, which is also why the default setting seems impossible to raise from the desktop.

Assisted-by LLM
---
 sound/soc/codecs/es9356.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/es9356.c +2 -2
index c54bf05..ce48b1e 100644
@@ -74,8 +74,8 @@ static int es9356_sdw_component_probe(struct snd_soc_component *component)
 }
 
 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -9600, 12, 0);
-static const DECLARE_TLV_DB_SCALE(amic_gain_tlv, 0, 3, 0);
-static const DECLARE_TLV_DB_SCALE(dmic_gain_tlv, 0, 6, 0);
+static const DECLARE_TLV_DB_SCALE(amic_gain_tlv, 0, 300, 0);
+static const DECLARE_TLV_DB_SCALE(dmic_gain_tlv, 0, 600, 0);
 
 static const struct snd_kcontrol_new es9356_sdca_controls[] = {
 	SDCA_SINGLE_Q78_TLV("FU41 Left Playback Volume",
Signature · 1 line
2.53.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] ASoC: es9356: missing Fixes trailer for commit 5d9cb740cd38 --

Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] ASoC: es9356: missing Fixes trailer for commit 5d9cb740cd38 --

commit 52267100487603f3acb6a660175cdbfe55292773
Author: Zachary Huang <[email protected]>

Quoted 20 lines

ASoC: es9356: fix the capture gain dB scale

The two capture gain controls are declared with a TLV step of 3 (FU33, analog mic) and 6 (FU11, DMIC). The TLV step is expressed in 0.01 dB units, so this advertises 0.03 dB and 0.06 dB per step: with a value range of 0..10 and 0..3 the whole controls appear to span only 0.30 dB and 0.18 dB.

The hardware steps are 3 dB and 6 dB, i.e. 0..30 dB and 0..18 dB. Measured on a MECHREVO WUJIE 14SAH (ES9356 on SoundWire link 0) by recording the same signal at all four FU11 settings:

    FU11=0   rms  523  (-35.9 dBFS)
    FU11=1   rms 1007  (-30.3 dBFS)
    FU11=2   rms 2011  (-24.2 dBFS)
    FU11=3   rms 3794  (-18.7 dBFS)

That is about +6 dB per step, matching the hardware definition rather than the advertised 0.06 dB.

Quoted 7 lines

Because userspace (alsamixer, PipeWire/WirePlumber) derives the volume from this TLV, the capture gain currently looks like a control without any usable range, which is also why the default setting seems impossible to raise from the desktop.

Assisted-by LLM

[Severity: Low]
Should this bug fix include a Fixes: tag for the commit that introduced the driver with the wrong TLV step units:

Fixes 5d9cb740cd38 ("ASoC: es9356-sdca: Add ES9356 SDCA driver")
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1