2022-06-03 18:58:50

by Charles Keepax

[permalink] [raw]
Subject: [PATCH 0/6] Fixup Cirrus SX control usage

Mostly the usage of the SX controls seems to match the lowest gain
value + number of gain levels expected. The one notable exception
there being cs53l30 as David noted. However, there are a couple of
other places where the minimum value/TLVs are slightly incorrectly
specified.

There are two I couldn't quite work out yet, any input on these
greatly appreciated:

SOC_DOUBLE_R_SX_TLV("Speaker Volume", CS42L52_SPKA_VOL, CS42L52_SPKB_VOL,
0, 0x40, 0xC0, hl_tlv),

0.5dB step
0x40 - -96dB
0x00 - 0dB

This one is weird, the datasheet says 0x40 is the minimum, which
matches, but the datasheet also says 0.5dB steps to 0x00 being 0dB
which doesn't match with 0x40 being the minimum, or 0xC0 being
the number of levels. Some clarification will needed from the
hardware guys.

SOC_SINGLE_SX_TLV("Beep Volume", CS42L56_BEEP_FREQ_OFFTIME,
0, 0x07, 0x23, beep_tlv),

2dB step
0x07 - -50dB
0x00 - 0dB
0x06 - +6dB

The minimum checks out at 0x07, but rest of this is weird. The values
in the datasheet don't make sense, based on starting at -50dB with
a 2dB step, 0x06 should equate to 12dB, over 31 volume levels, not
6dB over 35 volume levels as stated. The control specifies 0x23(35)
levels, which takes us up to a final value of 0x0A at 20dB. Again
some clarification from the hardware guys might be needed here.

Finally it is worth noting I don't actually have hardware for most of
these devices, so mostly this is just build tested.

Thanks,
Charles

Charles Keepax (6):
ASoC: cs42l52: Fix TLV scales for mixer controls
ASoC: cs35l36: Update digital volume TLV
ASoC: cs53l30: Correct number of volume levels on SX controls
ASoC: cs42l52: Correct TLV for Bypass Volume
ASoC: cs42l56: Correct typo in minimum level for SX volume controls
ASoC: cs42l51: Correct minimum value for SX volume control

sound/soc/codecs/cs35l36.c | 3 ++-
sound/soc/codecs/cs42l51.c | 2 +-
sound/soc/codecs/cs42l52.c | 8 +++++---
sound/soc/codecs/cs42l56.c | 4 ++--
sound/soc/codecs/cs53l30.c | 16 ++++++++--------
5 files changed, 18 insertions(+), 15 deletions(-)

--
2.30.2


2022-06-05 18:03:54

by Charles Keepax

[permalink] [raw]
Subject: [PATCH 1/6] ASoC: cs42l52: Fix TLV scales for mixer controls

The datasheet specifies the range of the mixer volumes as between
-51.5dB and 12dB with a 0.5dB step. Update the TLVs for this.

Signed-off-by: Charles Keepax <[email protected]>
---
sound/soc/codecs/cs42l52.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 9b182b585be4c..02c25399cf8a2 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -137,7 +137,7 @@ static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0);

static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0);

-static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0);
+static DECLARE_TLV_DB_SCALE(mix_tlv, -5150, 50, 0);

static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0);

@@ -364,7 +364,7 @@ static const struct snd_kcontrol_new cs42l52_snd_controls[] = {
CS42L52_ADCB_VOL, 0, 0xA0, 0x78, ipd_tlv),
SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume",
CS42L52_ADCA_MIXER_VOL, CS42L52_ADCB_MIXER_VOL,
- 0, 0x19, 0x7F, ipd_tlv),
+ 0, 0x19, 0x7F, mix_tlv),

SOC_DOUBLE("ADC Switch", CS42L52_ADC_MISC_CTL, 0, 1, 1, 0),

--
2.30.2