Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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):
<https://www.elinfor.com/pdf/RealtekMicroelectronics/ALC5670-VB-
RealtekMicroelectronics.pdf>

Switch from SOC_ENUM_SINGLE_DECL to SOC_VALUE_ENUM_SINGLE_DECL
to handle discrete values.

Signed-off-by: Alex Tran <alex.t.tran@gmail.com>
Link: https://patch.msgid.link/20250929004625.1310721-1-alex.t.tran@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Alex Tran and committed by
Mark Brown
6621b0f1 79c36ecf

+17 -13
+17 -13
sound/soc/codecs/rt5670.c
··· 1153 1153 static const struct snd_kcontrol_new rt5670_dac1r_mux = 1154 1154 SOC_DAPM_ENUM("DAC1 R source", rt5670_dac1r_enum); 1155 1155 1156 - /*DAC2 L/R source*/ /* MX-1B [6:4] [2:0] */ 1157 - /* TODO Use SOC_VALUE_ENUM_SINGLE_DECL */ 1158 - static const char * const rt5670_dac12_src[] = { 1159 - "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", 1160 - "Bass", "VAD_ADC", "IF4 DAC" 1161 - }; 1156 + /* DAC2 L source*/ /* MX-1B [6:4] */ 1157 + static const char *const rt5670_dac12_src[] = { 1158 + "IF1 DAC", "IF2 DAC", "TxDC DAC", "VAD_ADC" 1159 + }; /* VAD_ADC or TxDP_ADC_R */ 1162 1160 1163 - static SOC_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL, 1164 - RT5670_DAC2_L_SEL_SFT, rt5670_dac12_src); 1161 + static const unsigned int rt5670_dac12_values[] = { 0, 1, 3, 5 }; 1162 + 1163 + static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2l_enum, RT5670_DAC_CTRL, 1164 + RT5670_DAC2_L_SEL_SFT, RT5670_DAC2_L_SEL_MASK, 1165 + rt5670_dac12_src, rt5670_dac12_values); 1165 1166 1166 1167 static const struct snd_kcontrol_new rt5670_dac_l2_mux = 1167 1168 SOC_DAPM_ENUM("DAC2 L source", rt5670_dac2l_enum); 1168 1169 1169 - static const char * const rt5670_dacr2_src[] = { 1170 - "IF1 DAC", "IF2 DAC", "IF3 DAC", "TxDC DAC", "TxDP ADC", "IF4 DAC" 1171 - }; 1170 + /*DAC2 R source*/ /* MX-1B [2:0] */ 1171 + static const char *const rt5670_dacr2_src[] = { "IF1 DAC", "IF2 DAC", 1172 + "TxDC DAC", "TxDP ADC" }; 1172 1173 1173 - static SOC_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL, 1174 - RT5670_DAC2_R_SEL_SFT, rt5670_dacr2_src); 1174 + static const unsigned int rt5670_dacr2_values[] = { 0, 1, 3, 4 }; 1175 + 1176 + static SOC_VALUE_ENUM_SINGLE_DECL(rt5670_dac2r_enum, RT5670_DAC_CTRL, 1177 + RT5670_DAC2_R_SEL_SFT, RT5670_DAC2_R_SEL_MASK, 1178 + rt5670_dacr2_src, rt5670_dacr2_values); 1175 1179 1176 1180 static const struct snd_kcontrol_new rt5670_dac_r2_mux = 1177 1181 SOC_DAPM_ENUM("DAC2 R source", rt5670_dac2r_enum);