ASoC: es9356: fix the capture gain dB scale
PATCH v2 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.
---
v2: add the Fixes: tag pointing at the commit that introduced the wrong
TLV step units (suggested by the Sashiko review). No code change.
sound/soc/codecs/es9356.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/es9356.c +2 -2
@@ -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
Quoted 24 lines
sound/soc/codecs/es9356.c:es9356_sdca_io_init() { ... regcache_cache_only(es9356->regmap, false); if (es9356->first_hw_init) { regcache_cache_bypass(es9356->regmap, true); } else { /* update count of parent 'active' children */ pm_runtime_set_active(&slave->dev); ret = es9356_register_init(es9356); if (ret < 0) return -EINVAL; } ... }If
regmap_read(es9356->regmap, ES9356_VERSION, &version)fails ines9356_register_init()duringes9356_sdw_update_status()->es9356_sdca_io_init(), this early return leaveses9356->regmapwith cache-only mode disabled whilees9356->hw_initandes9356->first_hw_initremain false, allowing subsequent mixer control accesses to issue SoundWire bus transactions to an uninitialized device.
Quoted 2 lines
Should this error path restore
regcache_cache_only(es9356->regmap, true)and return ret instead of masking the error code with-EINVAL?
That makes sense. I will include that in the next version.
Mark Brown
maintainerQuoted 1 line · Zachary Huang
ASoC: es9356: fix the capture gain dB scale
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: es9356: fix the capture gain dB scale
https://git.kernel.org/broonie/sound/c/412a061ebf8c
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark