From: Alex Tran Date: Mon, 29 Sep 2025 00:46:25 +0000 (-0700) Subject: ASoC: codecs: rt5670: use SOC_VALUE_ENUM_SINGLE_DECL for DAC2 L/R MX-1B X-Git-Tag: v6.19-rc1~156^2~3^2~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6621b0f118d500092f5f3d72ddddb22aeeb3c3a0;p=thirdparty%2Fkernel%2Flinux.git ASoC: codecs: rt5670: use SOC_VALUE_ENUM_SINGLE_DECL for DAC2 L/R MX-1B DAC2 L/R source selection fields (MX-1B [6:4] and [2:0]) contain non contiguous values due to reserved bits documented in datasheet (page 66): Switch from SOC_ENUM_SINGLE_DECL to SOC_VALUE_ENUM_SINGLE_DECL to handle discrete values. Signed-off-by: Alex Tran Link: https://patch.msgid.link/20250929004625.1310721-1-alex.t.tran@gmail.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index efd26082f19ab..4c75a3e71859b 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c @@ -1153,25 +1153,29 @@ static SOC_ENUM_SINGLE_DECL(rt5670_dac1r_enum, RT5670_AD_DA_MIXER, static const struct snd_kcontrol_new rt5670_dac1r_mux = SOC_DAPM_ENUM("DAC1 R source", rt5670_dac1r_enum); -/*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */ -/* TODO Use SOC_VALUE_ENUM_SINGLE_DECL */ -static const char * const rt5670_dac12_src[] = { - "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", - "Bass", "VAD_ADC", "IF4 DAC" -}; +/* DAC2 L source*/ /* MX-1B [6:4] */ +static const char *const rt5670_dac12_src[] = { + "IF1 DAC", "IF2 DAC", "TxDC DAC", "VAD_ADC" +}; /* VAD_ADC or TxDP_ADC_R */ + +static const unsigned int rt5670_dac12_values[] = { 0, 1, 3, 5 }; -static SOC_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL, - RT5670_DAC2_L_SEL_SFT, rt5670_dac12_src); +static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL, + RT5670_DAC2_L_SEL_SFT, RT5670_DAC2_L_SEL_MASK, + rt5670_dac12_src, rt5670_dac12_values); static const struct snd_kcontrol_new rt5670_dac_l2_mux = SOC_DAPM_ENUM("DAC2 L source", rt5670_dac2l_enum); -static const char * const rt5670_dacr2_src[] = { - "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", "TxDP ADC", "IF4 DAC" -}; +/*DAC2 R source*/ /* MX-1B [2:0] */ +static const char *const rt5670_dacr2_src[] = { "IF1 DAC", "IF2 DAC", + "TxDC DAC", "TxDP ADC" }; + +static const unsigned int rt5670_dacr2_values[] = { 0, 1, 3, 4 }; -static SOC_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL, - RT5670_DAC2_R_SEL_SFT, rt5670_dacr2_src); +static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL, + RT5670_DAC2_R_SEL_SFT, RT5670_DAC2_R_SEL_MASK, + rt5670_dacr2_src, rt5670_dacr2_values); static const struct snd_kcontrol_new rt5670_dac_r2_mux = SOC_DAPM_ENUM("DAC2 R source", rt5670_dac2r_enum);