@@ -283,6 +283,7 @@ static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0);
283283static const DECLARE_TLV_DB_SCALE (wm8994_3d_tlv , -1600 , 183 , 0 ) ;
284284static const DECLARE_TLV_DB_SCALE (eq_tlv , -1200 , 100 , 0 ) ;
285285static const DECLARE_TLV_DB_SCALE (ng_tlv , -10200 , 600 , 0 ) ;
286+ static const DECLARE_TLV_DB_SCALE (mixin_boost_tlv , 0 , 900 , 0 ) ;
286287
287288#define WM8994_DRC_SWITCH (xname , reg , shift ) \
288289{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
@@ -703,6 +704,13 @@ SOC_SINGLE_TLV("AIF2DAC Noise Gate Threshold Volume",
703704 7 , 1 , ng_tlv ),
704705};
705706
707+ static const struct snd_kcontrol_new wm1811_snd_controls [] = {
708+ SOC_SINGLE_TLV ("MIXINL IN1LP Boost Volume" , WM8994_INPUT_MIXER_1 , 7 , 1 , 0 ,
709+ mixin_boost_tlv ),
710+ SOC_SINGLE_TLV ("MIXINL IN1RP Boost Volume" , WM8994_INPUT_MIXER_1 , 8 , 1 , 0 ,
711+ mixin_boost_tlv ),
712+ };
713+
706714static int clk_sys_event (struct snd_soc_dapm_widget * w ,
707715 struct snd_kcontrol * kcontrol , int event )
708716{
@@ -2053,6 +2061,15 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
20532061 WM8958_CP_DISCH );
20542062 }
20552063 break ;
2064+
2065+ case WM1811 :
2066+ if (wm8994 -> revision < 2 ) {
2067+ snd_soc_write (codec , 0x102 , 0x3 );
2068+ snd_soc_write (codec , 0x5d , 0x7e );
2069+ snd_soc_write (codec , 0x5e , 0x0 );
2070+ snd_soc_write (codec , 0x102 , 0x0 );
2071+ }
2072+ break ;
20562073 }
20572074
20582075 /* Discharge LINEOUT1 & 2 */
@@ -2168,10 +2185,18 @@ static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
21682185
21692186 /* The AIF2 format configuration needs to be mirrored to AIF3
21702187 * on WM8958 if it's in use so just do it all the time. */
2171- if (control -> type == WM8958 && dai -> id == 2 )
2172- snd_soc_update_bits (codec , WM8958_AIF3_CONTROL_1 ,
2173- WM8994_AIF1_LRCLK_INV |
2174- WM8958_AIF3_FMT_MASK , aif1 );
2188+ switch (control -> type ) {
2189+ case WM1811 :
2190+ case WM8958 :
2191+ if (dai -> id == 2 )
2192+ snd_soc_update_bits (codec , WM8958_AIF3_CONTROL_1 ,
2193+ WM8994_AIF1_LRCLK_INV |
2194+ WM8958_AIF3_FMT_MASK , aif1 );
2195+ break ;
2196+
2197+ default :
2198+ break ;
2199+ }
21752200
21762201 snd_soc_update_bits (codec , aif1_reg ,
21772202 WM8994_AIF1_BCLK_INV | WM8994_AIF1_LRCLK_INV |
@@ -2258,6 +2283,7 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
22582283 break ;
22592284 case 3 :
22602285 switch (control -> type ) {
2286+ case WM1811 :
22612287 case WM8958 :
22622288 aif1_reg = WM8958_AIF3_CONTROL_1 ;
22632289 break ;
@@ -2384,6 +2410,7 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
23842410 switch (dai -> id ) {
23852411 case 3 :
23862412 switch (control -> type ) {
2413+ case WM1811 :
23872414 case WM8958 :
23882415 aif1_reg = WM8958_AIF3_CONTROL_1 ;
23892416 break ;
@@ -2614,6 +2641,7 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state)
26142641 case WM8994 :
26152642 snd_soc_update_bits (codec , WM8994_MICBIAS , WM8994_MICD_ENA , 0 );
26162643 break ;
2644+ case WM1811 :
26172645 case WM8958 :
26182646 snd_soc_update_bits (codec , WM8958_MIC_DETECT_1 ,
26192647 WM8958_MICD_ENA , 0 );
@@ -2682,6 +2710,7 @@ static int wm8994_resume(struct snd_soc_codec *codec)
26822710 snd_soc_update_bits (codec , WM8994_MICBIAS ,
26832711 WM8994_MICD_ENA , WM8994_MICD_ENA );
26842712 break ;
2713+ case WM1811 :
26852714 case WM8958 :
26862715 if (wm8994 -> jack_cb )
26872716 snd_soc_update_bits (codec , WM8958_MIC_DETECT_1 ,
@@ -2980,8 +3009,13 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
29803009 struct wm8994_priv * wm8994 = snd_soc_codec_get_drvdata (codec );
29813010 struct wm8994 * control = codec -> control_data ;
29823011
2983- if (control -> type != WM8958 )
3012+ switch (control -> type ) {
3013+ case WM1811 :
3014+ case WM8958 :
3015+ break ;
3016+ default :
29843017 return - EINVAL ;
3018+ }
29853019
29863020 if (jack ) {
29873021 if (!cb ) {
@@ -3135,6 +3169,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
31353169 wm8994 -> hubs .dcs_readback_mode = 1 ;
31363170 break ;
31373171
3172+ case WM1811 :
3173+ wm8994 -> hubs .dcs_readback_mode = 2 ;
3174+ wm8994 -> hubs .no_series_update = 1 ;
3175+
3176+ switch (wm8994 -> revision ) {
3177+ case 0 :
3178+ case 1 :
3179+ wm8994 -> hubs .dcs_codes_l = -7 ;
3180+ wm8994 -> hubs .dcs_codes_r = -4 ;
3181+ break ;
3182+ default :
3183+ break ;
3184+ }
3185+
3186+ snd_soc_update_bits (codec , WM8994_ANALOGUE_HP_1 ,
3187+ WM1811_HPOUT1_ATTN , WM1811_HPOUT1_ATTN );
3188+ break ;
3189+
31383190 default :
31393191 break ;
31403192 }
@@ -3195,6 +3247,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
31953247 break ;
31963248
31973249 case WM8958 :
3250+ case WM1811 :
31983251 if (wm8994 -> micdet_irq ) {
31993252 ret = request_threaded_irq (wm8994 -> micdet_irq , NULL ,
32003253 wm8958_mic_irq ,
@@ -3357,6 +3410,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
33573410 ARRAY_SIZE (wm8994_dac_widgets ));
33583411 }
33593412 break ;
3413+
3414+ case WM1811 :
3415+ snd_soc_add_controls (codec , wm8958_snd_controls ,
3416+ ARRAY_SIZE (wm8958_snd_controls ));
3417+ snd_soc_dapm_new_controls (dapm , wm8958_dapm_widgets ,
3418+ ARRAY_SIZE (wm8958_dapm_widgets ));
3419+ snd_soc_dapm_new_controls (dapm , wm8994_lateclk_widgets ,
3420+ ARRAY_SIZE (wm8994_lateclk_widgets ));
3421+ snd_soc_dapm_new_controls (dapm , wm8994_adc_widgets ,
3422+ ARRAY_SIZE (wm8994_adc_widgets ));
3423+ snd_soc_dapm_new_controls (dapm , wm8994_dac_widgets ,
3424+ ARRAY_SIZE (wm8994_dac_widgets ));
3425+ break ;
33603426 }
33613427
33623428
@@ -3393,6 +3459,12 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
33933459
33943460 wm8958_dsp2_init (codec );
33953461 break ;
3462+ case WM1811 :
3463+ snd_soc_dapm_add_routes (dapm , wm8994_lateclk_intercon ,
3464+ ARRAY_SIZE (wm8994_lateclk_intercon ));
3465+ snd_soc_dapm_add_routes (dapm , wm8958_intercon ,
3466+ ARRAY_SIZE (wm8958_intercon ));
3467+ break ;
33963468 }
33973469
33983470 return 0 ;
@@ -3448,6 +3520,7 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
34483520 wm8994 );
34493521 break ;
34503522
3523+ case WM1811 :
34513524 case WM8958 :
34523525 if (wm8994 -> micdet_irq )
34533526 free_irq (wm8994 -> micdet_irq , wm8994 );
0 commit comments