43
43
#define WM8994_NUM_DRC 3
44
44
#define WM8994_NUM_EQ 3
45
45
46
- static struct {
46
+ struct wm8994_reg_mask {
47
47
unsigned int reg ;
48
48
unsigned int mask ;
49
- } wm8994_vu_bits [] = {
49
+ };
50
+
51
+ static struct wm8994_reg_mask wm8994_vu_bits [] = {
50
52
{ WM8994_LEFT_LINE_INPUT_1_2_VOLUME , WM8994_IN1_VU },
51
53
{ WM8994_RIGHT_LINE_INPUT_1_2_VOLUME , WM8994_IN1_VU },
52
54
{ WM8994_LEFT_LINE_INPUT_3_4_VOLUME , WM8994_IN2_VU },
@@ -60,14 +62,10 @@ static struct {
60
62
61
63
{ WM8994_AIF1_DAC1_LEFT_VOLUME , WM8994_AIF1DAC1_VU },
62
64
{ WM8994_AIF1_DAC1_RIGHT_VOLUME , WM8994_AIF1DAC1_VU },
63
- { WM8994_AIF1_DAC2_LEFT_VOLUME , WM8994_AIF1DAC2_VU },
64
- { WM8994_AIF1_DAC2_RIGHT_VOLUME , WM8994_AIF1DAC2_VU },
65
65
{ WM8994_AIF2_DAC_LEFT_VOLUME , WM8994_AIF2DAC_VU },
66
66
{ WM8994_AIF2_DAC_RIGHT_VOLUME , WM8994_AIF2DAC_VU },
67
67
{ WM8994_AIF1_ADC1_LEFT_VOLUME , WM8994_AIF1ADC1_VU },
68
68
{ WM8994_AIF1_ADC1_RIGHT_VOLUME , WM8994_AIF1ADC1_VU },
69
- { WM8994_AIF1_ADC2_LEFT_VOLUME , WM8994_AIF1ADC2_VU },
70
- { WM8994_AIF1_ADC2_RIGHT_VOLUME , WM8994_AIF1ADC2_VU },
71
69
{ WM8994_AIF2_ADC_LEFT_VOLUME , WM8994_AIF2ADC_VU },
72
70
{ WM8994_AIF2_ADC_RIGHT_VOLUME , WM8994_AIF1ADC2_VU },
73
71
{ WM8994_DAC1_LEFT_VOLUME , WM8994_DAC1_VU },
@@ -76,6 +74,14 @@ static struct {
76
74
{ WM8994_DAC2_RIGHT_VOLUME , WM8994_DAC2_VU },
77
75
};
78
76
77
+ /* VU bitfields for ADC2, DAC2 not available on WM1811 */
78
+ static struct wm8994_reg_mask wm8994_adc2_dac2_vu_bits [] = {
79
+ { WM8994_AIF1_DAC2_LEFT_VOLUME , WM8994_AIF1DAC2_VU },
80
+ { WM8994_AIF1_DAC2_RIGHT_VOLUME , WM8994_AIF1DAC2_VU },
81
+ { WM8994_AIF1_ADC2_LEFT_VOLUME , WM8994_AIF1ADC2_VU },
82
+ { WM8994_AIF1_ADC2_RIGHT_VOLUME , WM8994_AIF1ADC2_VU },
83
+ };
84
+
79
85
static int wm8994_drc_base [] = {
80
86
WM8994_AIF1_DRC1_1 ,
81
87
WM8994_AIF1_DRC2_1 ,
@@ -1030,6 +1036,26 @@ static bool wm8994_check_class_w_digital(struct snd_soc_component *component)
1030
1036
return true;
1031
1037
}
1032
1038
1039
+ static void wm8994_update_vu_bits (struct snd_soc_component * component )
1040
+ {
1041
+ struct wm8994_priv * wm8994 = snd_soc_component_get_drvdata (component );
1042
+ struct wm8994 * control = wm8994 -> wm8994 ;
1043
+ int i ;
1044
+
1045
+ for (i = 0 ; i < ARRAY_SIZE (wm8994_vu_bits ); i ++ )
1046
+ snd_soc_component_write (component , wm8994_vu_bits [i ].reg ,
1047
+ snd_soc_component_read (component ,
1048
+ wm8994_vu_bits [i ].reg ));
1049
+ if (control -> type == WM1811 )
1050
+ return ;
1051
+
1052
+ for (i = 0 ; i < ARRAY_SIZE (wm8994_adc2_dac2_vu_bits ); i ++ )
1053
+ snd_soc_component_write (component ,
1054
+ wm8994_adc2_dac2_vu_bits [i ].reg ,
1055
+ snd_soc_component_read (component ,
1056
+ wm8994_adc2_dac2_vu_bits [i ].reg ));
1057
+ }
1058
+
1033
1059
static int aif_mclk_set (struct snd_soc_component * component , int aif , bool enable )
1034
1060
{
1035
1061
struct wm8994_priv * wm8994 = snd_soc_component_get_drvdata (component );
@@ -1076,7 +1102,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1076
1102
struct wm8994_priv * wm8994 = snd_soc_component_get_drvdata (component );
1077
1103
struct wm8994 * control = wm8994 -> wm8994 ;
1078
1104
int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA ;
1079
- int ret , i ;
1105
+ int ret ;
1080
1106
int dac ;
1081
1107
int adc ;
1082
1108
int val ;
@@ -1144,10 +1170,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1144
1170
break ;
1145
1171
1146
1172
case SND_SOC_DAPM_POST_PMU :
1147
- for (i = 0 ; i < ARRAY_SIZE (wm8994_vu_bits ); i ++ )
1148
- snd_soc_component_write (component , wm8994_vu_bits [i ].reg ,
1149
- snd_soc_component_read (component ,
1150
- wm8994_vu_bits [i ].reg ));
1173
+ wm8994_update_vu_bits (component );
1151
1174
break ;
1152
1175
1153
1176
case SND_SOC_DAPM_PRE_PMD :
@@ -1181,7 +1204,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1181
1204
struct snd_kcontrol * kcontrol , int event )
1182
1205
{
1183
1206
struct snd_soc_component * component = snd_soc_dapm_to_component (w -> dapm );
1184
- int ret , i ;
1207
+ int ret ;
1185
1208
int dac ;
1186
1209
int adc ;
1187
1210
int val ;
@@ -1237,10 +1260,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1237
1260
break ;
1238
1261
1239
1262
case SND_SOC_DAPM_POST_PMU :
1240
- for (i = 0 ; i < ARRAY_SIZE (wm8994_vu_bits ); i ++ )
1241
- snd_soc_component_write (component , wm8994_vu_bits [i ].reg ,
1242
- snd_soc_component_read (component ,
1243
- wm8994_vu_bits [i ].reg ));
1263
+ wm8994_update_vu_bits (component );
1244
1264
break ;
1245
1265
1246
1266
case SND_SOC_DAPM_PRE_PMD :
@@ -4346,6 +4366,14 @@ static int wm8994_component_probe(struct snd_soc_component *component)
4346
4366
wm8994_vu_bits [i ].mask ,
4347
4367
wm8994_vu_bits [i ].mask );
4348
4368
4369
+ if (control -> type != WM1811 ) {
4370
+ for (i = 0 ; i < ARRAY_SIZE (wm8994_adc2_dac2_vu_bits ); i ++ )
4371
+ snd_soc_component_update_bits (component ,
4372
+ wm8994_adc2_dac2_vu_bits [i ].reg ,
4373
+ wm8994_adc2_dac2_vu_bits [i ].mask ,
4374
+ wm8994_adc2_dac2_vu_bits [i ].mask );
4375
+ }
4376
+
4349
4377
/* Set the low bit of the 3D stereo depth so TLV matches */
4350
4378
snd_soc_component_update_bits (component , WM8994_AIF1_DAC1_FILTERS_2 ,
4351
4379
1 << WM8994_AIF1DAC1_3D_GAIN_SHIFT ,
0 commit comments