Lines Matching refs:codec

109 static void wm8958_micd_set_rate(struct snd_soc_codec *codec)  in wm8958_micd_set_rate()  argument
111 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8958_micd_set_rate()
120 sysclk = snd_soc_read(codec, WM8994_CLOCKING_1); in wm8958_micd_set_rate()
151 dev_dbg(codec->dev, "MICD rate %d,%d for %dHz %s\n", in wm8958_micd_set_rate()
155 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm8958_micd_set_rate()
160 static int configure_aif_clock(struct snd_soc_codec *codec, int aif) in configure_aif_clock() argument
162 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in configure_aif_clock()
200 dev_dbg(codec->dev, "Dividing AIF%d clock to %dHz\n", in configure_aif_clock()
206 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1 + offset, in configure_aif_clock()
213 static int configure_clock(struct snd_soc_codec *codec) in configure_clock() argument
215 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in configure_clock()
219 configure_aif_clock(codec, 0); in configure_clock()
220 configure_aif_clock(codec, 1); in configure_clock()
230 wm8958_micd_set_rate(codec); in configure_clock()
239 change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, in configure_clock()
242 snd_soc_dapm_sync(&codec->dapm); in configure_clock()
244 wm8958_micd_set_rate(codec); in configure_clock()
252 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); in check_clk_sys() local
253 int reg = snd_soc_read(codec, WM8994_CLOCKING_1); in check_clk_sys()
302 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_put_drc_sw() local
312 ret = snd_soc_read(codec, mc->reg); in wm8994_put_drc_sw()
321 static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) in wm8994_set_drc() argument
323 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_drc()
331 save = snd_soc_read(codec, base); in wm8994_set_drc()
336 snd_soc_update_bits(codec, base + i, 0xffff, in wm8994_set_drc()
339 snd_soc_update_bits(codec, base, WM8994_AIF1DAC1_DRC_ENA | in wm8994_set_drc()
359 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_put_drc_enum() local
360 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_put_drc_enum()
374 wm8994_set_drc(codec, drc); in wm8994_put_drc_enum()
382 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_get_drc_enum() local
383 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_get_drc_enum()
393 static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) in wm8994_set_retune_mobile() argument
395 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_retune_mobile()
432 dev_dbg(codec->dev, "ReTune Mobile %d %s/%dHz for %dHz sample rate\n", in wm8994_set_retune_mobile()
441 save = snd_soc_read(codec, base); in wm8994_set_retune_mobile()
445 snd_soc_update_bits(codec, base + i, 0xffff, in wm8994_set_retune_mobile()
448 snd_soc_update_bits(codec, base, WM8994_AIF1DAC1_EQ_ENA, save); in wm8994_set_retune_mobile()
466 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_put_retune_mobile_enum() local
467 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_put_retune_mobile_enum()
481 wm8994_set_retune_mobile(codec, block); in wm8994_put_retune_mobile_enum()
489 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_get_retune_mobile_enum() local
490 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_get_retune_mobile_enum()
742 static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode) in wm1811_jackdet_set_mode() argument
744 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm1811_jackdet_set_mode()
761 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in wm1811_jackdet_set_mode()
765 static void active_reference(struct snd_soc_codec *codec) in active_reference() argument
767 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in active_reference()
773 dev_dbg(codec->dev, "Active refcount incremented, now %d\n", in active_reference()
777 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_AUDIO); in active_reference()
782 static void active_dereference(struct snd_soc_codec *codec) in active_dereference() argument
784 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in active_dereference()
791 dev_dbg(codec->dev, "Active refcount decremented, now %d\n", in active_dereference()
801 wm1811_jackdet_set_mode(codec, mode); in active_dereference()
810 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in clk_sys_event() local
811 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in clk_sys_event()
815 return configure_clock(codec); in clk_sys_event()
834 configure_clock(codec); in clk_sys_event()
841 static void vmid_reference(struct snd_soc_codec *codec) in vmid_reference() argument
843 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in vmid_reference()
845 pm_runtime_get_sync(codec->dev); in vmid_reference()
849 dev_dbg(codec->dev, "Referencing VMID, refcount is now %d\n", in vmid_reference()
853 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, in vmid_reference()
857 wm_hubs_vmid_ena(codec); in vmid_reference()
864 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
876 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_reference()
883 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
891 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
903 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_reference()
910 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
919 static void vmid_dereference(struct snd_soc_codec *codec) in vmid_dereference() argument
921 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in vmid_dereference()
925 dev_dbg(codec->dev, "Dereferencing VMID, refcount is now %d\n", in vmid_dereference()
930 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, in vmid_dereference()
937 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, in vmid_dereference()
944 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_dereference()
950 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_dereference()
956 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, in vmid_dereference()
962 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, in vmid_dereference()
969 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_dereference()
975 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_dereference()
979 pm_runtime_put(codec->dev); in vmid_dereference()
985 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in vmid_event() local
989 vmid_reference(codec); in vmid_event()
993 vmid_dereference(codec); in vmid_event()
1000 static bool wm8994_check_class_w_digital(struct snd_soc_codec *codec) in wm8994_check_class_w_digital() argument
1006 reg = snd_soc_read(codec, WM8994_DAC1_LEFT_MIXER_ROUTING); in wm8994_check_class_w_digital()
1009 dev_vdbg(codec->dev, "Class W source AIF2DAC\n"); in wm8994_check_class_w_digital()
1013 dev_vdbg(codec->dev, "Class W source AIF1DAC2\n"); in wm8994_check_class_w_digital()
1017 dev_vdbg(codec->dev, "Class W source AIF1DAC1\n"); in wm8994_check_class_w_digital()
1021 dev_vdbg(codec->dev, "DAC mixer setting: %x\n", reg); in wm8994_check_class_w_digital()
1025 reg_r = snd_soc_read(codec, WM8994_DAC1_RIGHT_MIXER_ROUTING); in wm8994_check_class_w_digital()
1027 dev_vdbg(codec->dev, "Left and right DAC mixers different\n"); in wm8994_check_class_w_digital()
1032 snd_soc_update_bits(codec, WM8994_CLASS_W_1, in wm8994_check_class_w_digital()
1041 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif1clk_ev() local
1042 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in aif1clk_ev()
1065 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); in aif1clk_ev()
1076 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_2); in aif1clk_ev()
1087 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif1clk_ev()
1089 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif1clk_ev()
1091 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif1clk_ev()
1096 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, mask, in aif1clk_ev()
1101 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, mask, in aif1clk_ev()
1110 snd_soc_write(codec, wm8994_vu_bits[i].reg, in aif1clk_ev()
1111 snd_soc_read(codec, in aif1clk_ev()
1117 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif1clk_ev()
1119 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif1clk_ev()
1122 val = snd_soc_read(codec, WM8994_CLOCKING_1); in aif1clk_ev()
1127 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif1clk_ev()
1139 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif2clk_ev() local
1147 val = snd_soc_read(codec, WM8994_AIF2_CONTROL_1); in aif2clk_ev()
1158 val = snd_soc_read(codec, WM8994_AIF2_CONTROL_2); in aif2clk_ev()
1168 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif2clk_ev()
1171 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif2clk_ev()
1174 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif2clk_ev()
1179 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif2clk_ev()
1184 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif2clk_ev()
1193 snd_soc_write(codec, wm8994_vu_bits[i].reg, in aif2clk_ev()
1194 snd_soc_read(codec, in aif2clk_ev()
1200 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif2clk_ev()
1203 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif2clk_ev()
1207 val = snd_soc_read(codec, WM8994_CLOCKING_1); in aif2clk_ev()
1212 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif2clk_ev()
1224 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif1clk_late_ev() local
1225 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in aif1clk_late_ev()
1242 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif2clk_late_ev() local
1243 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in aif2clk_late_ev()
1260 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in late_enable_ev() local
1261 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in late_enable_ev()
1267 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, in late_enable_ev()
1275 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, in late_enable_ev()
1293 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in late_disable_ev() local
1294 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in late_disable_ev()
1300 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, in late_disable_ev()
1307 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, in late_disable_ev()
1335 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in dac_ev() local
1338 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in dac_ev()
1376 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in post_ev() local
1377 dev_dbg(codec->dev, "SRC status: %x\n", in post_ev()
1378 snd_soc_read(codec, in post_ev()
1444 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); in wm8994_put_class_w() local
1449 wm_hubs_update_class_w(codec); in wm8994_put_class_w()
2129 static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, in _wm8994_set_fll() argument
2132 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in _wm8994_set_fll()
2155 reg = snd_soc_read(codec, WM8994_FLL1_CONTROL_1 + reg_offset); in _wm8994_set_fll()
2196 clk1 = snd_soc_read(codec, WM8994_CLOCKING_1); in _wm8994_set_fll()
2201 reg = snd_soc_read(codec, aif_reg); in _wm8994_set_fll()
2205 dev_err(codec->dev, "FLL%d is currently providing SYSCLK\n", in _wm8994_set_fll()
2211 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, in _wm8994_set_fll()
2216 dev_dbg(codec->dev, "Bypassing FLL%d\n", id + 1); in _wm8994_set_fll()
2217 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, in _wm8994_set_fll()
2224 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_2 + reg_offset, in _wm8994_set_fll()
2228 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_3 + reg_offset, in _wm8994_set_fll()
2231 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_4 + reg_offset, in _wm8994_set_fll()
2236 snd_soc_update_bits(codec, WM8958_FLL1_EFS_1 + reg_offset, in _wm8994_set_fll()
2239 snd_soc_update_bits(codec, WM8958_FLL1_EFS_2 + reg_offset, in _wm8994_set_fll()
2242 snd_soc_update_bits(codec, WM8958_FLL1_EFS_2 + reg_offset, in _wm8994_set_fll()
2246 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, in _wm8994_set_fll()
2262 active_reference(codec); in _wm8994_set_fll()
2266 vmid_reference(codec); in _wm8994_set_fll()
2270 vmid_reference(codec); in _wm8994_set_fll()
2284 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, in _wm8994_set_fll()
2292 dev_warn(codec->dev, in _wm8994_set_fll()
2301 vmid_dereference(codec); in _wm8994_set_fll()
2305 vmid_dereference(codec); in _wm8994_set_fll()
2311 active_dereference(codec); in _wm8994_set_fll()
2320 configure_clock(codec); in _wm8994_set_fll()
2327 dev_dbg(codec->dev, "Configuring AIFs for 128fs\n"); in _wm8994_set_fll()
2329 wm8994->aifdiv[0] = snd_soc_read(codec, WM8994_AIF1_RATE) in _wm8994_set_fll()
2331 wm8994->aifdiv[1] = snd_soc_read(codec, WM8994_AIF2_RATE) in _wm8994_set_fll()
2334 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in _wm8994_set_fll()
2336 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in _wm8994_set_fll()
2339 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in _wm8994_set_fll()
2342 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in _wm8994_set_fll()
2367 return _wm8994_set_fll(dai->codec, id, src, freq_in, freq_out); in wm8994_set_fll()
2373 struct snd_soc_codec *codec = dai->codec; in wm8994_set_dai_sysclk() local
2374 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_dai_sysclk()
2423 snd_soc_update_bits(codec, WM8994_CLOCKING_2, in wm8994_set_dai_sysclk()
2425 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2, in wm8994_set_dai_sysclk()
2428 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2, in wm8994_set_dai_sysclk()
2436 configure_clock(codec); in wm8994_set_dai_sysclk()
2443 dev_dbg(codec->dev, "Configuring AIFs for 128fs\n"); in wm8994_set_dai_sysclk()
2445 wm8994->aifdiv[0] = snd_soc_read(codec, WM8994_AIF1_RATE) in wm8994_set_dai_sysclk()
2447 wm8994->aifdiv[1] = snd_soc_read(codec, WM8994_AIF2_RATE) in wm8994_set_dai_sysclk()
2450 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in wm8994_set_dai_sysclk()
2452 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in wm8994_set_dai_sysclk()
2455 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in wm8994_set_dai_sysclk()
2458 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in wm8994_set_dai_sysclk()
2469 static int wm8994_set_bias_level(struct snd_soc_codec *codec, in wm8994_set_bias_level() argument
2472 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_bias_level()
2475 wm_hubs_set_bias_level(codec, level); in wm8994_set_bias_level()
2486 snd_soc_update_bits(codec, WM8958_MICBIAS1, in wm8994_set_bias_level()
2488 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8994_set_bias_level()
2495 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) in wm8994_set_bias_level()
2496 active_reference(codec); in wm8994_set_bias_level()
2500 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { in wm8994_set_bias_level()
2505 snd_soc_update_bits(codec, in wm8994_set_bias_level()
2517 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, in wm8994_set_bias_level()
2524 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE) in wm8994_set_bias_level()
2525 active_dereference(codec); in wm8994_set_bias_level()
2531 snd_soc_update_bits(codec, WM8958_MICBIAS1, in wm8994_set_bias_level()
2534 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8994_set_bias_level()
2544 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) in wm8994_set_bias_level()
2549 codec->dapm.bias_level = level; in wm8994_set_bias_level()
2554 int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode) in wm8994_vmid_mode() argument
2556 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_vmid_mode()
2557 struct snd_soc_dapm_context *dapm = &codec->dapm; in wm8994_vmid_mode()
2614 struct snd_soc_codec *codec = dai->codec; in wm8994_set_dai_fmt() local
2615 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_dai_fmt()
2717 snd_soc_update_bits(codec, WM8958_AIF3_CONTROL_1, in wm8994_set_dai_fmt()
2726 snd_soc_update_bits(codec, aif1_reg, in wm8994_set_dai_fmt()
2730 snd_soc_update_bits(codec, ms_reg, WM8994_AIF1_MSTR, in wm8994_set_dai_fmt()
2732 snd_soc_update_bits(codec, dac_reg, in wm8994_set_dai_fmt()
2734 snd_soc_update_bits(codec, adc_reg, in wm8994_set_dai_fmt()
2769 struct snd_soc_codec *codec = dai->codec; in wm8994_hw_params() local
2770 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_hw_params()
2798 dev_dbg(codec->dev, "AIF1 using split LRCLK\n"); in wm8994_hw_params()
2811 dev_dbg(codec->dev, "AIF2 using split LRCLK\n"); in wm8994_hw_params()
2870 (snd_soc_read(codec, aif1_reg) & 0x18) == 0x18) in wm8994_hw_params()
2920 snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_WL_MASK, aif1); in wm8994_hw_params()
2921 snd_soc_update_bits(codec, aif2_reg, WM8994_AIF1_MONO, aif2); in wm8994_hw_params()
2922 snd_soc_update_bits(codec, bclk_reg, WM8994_AIF1_BCLK_DIV_MASK, bclk); in wm8994_hw_params()
2923 snd_soc_update_bits(codec, lrclk_reg, WM8994_AIF1DAC_RATE_MASK, in wm8994_hw_params()
2925 snd_soc_update_bits(codec, rate_reg, WM8994_AIF1_SR_MASK | in wm8994_hw_params()
2932 wm8994_set_retune_mobile(codec, 0); in wm8994_hw_params()
2933 wm8994_set_retune_mobile(codec, 1); in wm8994_hw_params()
2937 wm8994_set_retune_mobile(codec, 2); in wm8994_hw_params()
2949 struct snd_soc_codec *codec = dai->codec; in wm8994_aif3_hw_params() local
2950 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_aif3_hw_params()
2986 return snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_WL_MASK, aif1); in wm8994_aif3_hw_params()
2991 struct snd_soc_codec *codec = codec_dai->codec; in wm8994_aif_mute() local
3011 snd_soc_update_bits(codec, mute_reg, WM8994_AIF1DAC1_MUTE, reg); in wm8994_aif_mute()
3018 struct snd_soc_codec *codec = codec_dai->codec; in wm8994_set_tristate() local
3039 return snd_soc_update_bits(codec, reg, mask, val); in wm8994_set_tristate()
3044 struct snd_soc_codec *codec = dai->codec; in wm8994_aif2_probe() local
3047 snd_soc_update_bits(codec, WM8994_GPIO_3, in wm8994_aif2_probe()
3049 snd_soc_update_bits(codec, WM8994_GPIO_4, in wm8994_aif2_probe()
3051 snd_soc_update_bits(codec, WM8994_GPIO_5, in wm8994_aif2_probe()
3152 static int wm8994_codec_suspend(struct snd_soc_codec *codec) in wm8994_codec_suspend() argument
3154 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_suspend()
3160 ret = _wm8994_set_fll(codec, i + 1, 0, 0, 0); in wm8994_codec_suspend()
3162 dev_warn(codec->dev, "Failed to stop FLL%d: %d\n", in wm8994_codec_suspend()
3166 wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); in wm8994_codec_suspend()
3171 static int wm8994_codec_resume(struct snd_soc_codec *codec) in wm8994_codec_resume() argument
3173 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_resume()
3180 ret = _wm8994_set_fll(codec, i + 1, in wm8994_codec_resume()
3185 dev_warn(codec->dev, "Failed to restore FLL%d: %d\n", in wm8994_codec_resume()
3198 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm8994_handle_retune_mobile_pdata() local
3251 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", in wm8994_handle_retune_mobile_pdata()
3257 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls, in wm8994_handle_retune_mobile_pdata()
3260 dev_err(wm8994->hubs.codec->dev, in wm8994_handle_retune_mobile_pdata()
3266 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm8994_handle_pdata() local
3274 wm_hubs_handle_analogue_pdata(codec, pdata->lineout1_diff, in wm8994_handle_pdata()
3285 dev_dbg(codec->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); in wm8994_handle_pdata()
3298 wm8994->drc_texts = devm_kzalloc(wm8994->hubs.codec->dev, in wm8994_handle_pdata()
3309 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls, in wm8994_handle_pdata()
3312 wm8994_set_drc(codec, i); in wm8994_handle_pdata()
3314 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, in wm8994_handle_pdata()
3320 dev_err(wm8994->hubs.codec->dev, in wm8994_handle_pdata()
3324 dev_dbg(codec->dev, "%d ReTune Mobile configurations\n", in wm8994_handle_pdata()
3330 snd_soc_add_codec_controls(wm8994->hubs.codec, wm8994_eq_controls, in wm8994_handle_pdata()
3335 snd_soc_write(codec, WM8958_MICBIAS1 + i, in wm8994_handle_pdata()
3356 int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, in wm8994_mic_detect() argument
3359 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_mic_detect()
3365 dev_warn(codec->dev, "Not a WM8994\n"); in wm8994_mic_detect()
3373 ret = snd_soc_dapm_force_enable_pin(&codec->dapm, in wm8994_mic_detect()
3376 ret = snd_soc_dapm_disable_pin(&codec->dapm, in wm8994_mic_detect()
3382 ret = snd_soc_dapm_force_enable_pin(&codec->dapm, in wm8994_mic_detect()
3385 ret = snd_soc_dapm_disable_pin(&codec->dapm, in wm8994_mic_detect()
3389 dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); in wm8994_mic_detect()
3394 dev_warn(codec->dev, "Failed to configure MICBIAS%d: %d\n", in wm8994_mic_detect()
3397 dev_dbg(codec->dev, "Configuring microphone detection on %d %p\n", in wm8994_mic_detect()
3410 snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, reg); in wm8994_mic_detect()
3413 snd_soc_update_bits(codec, WM8994_IRQ_DEBOUNCE, in wm8994_mic_detect()
3418 snd_soc_dapm_sync(&codec->dapm); in wm8994_mic_detect()
3491 struct snd_soc_codec *codec = priv->hubs.codec; in wm8994_mic_irq() local
3494 trace_snd_soc_jack_irq(dev_name(codec->dev)); in wm8994_mic_irq()
3497 pm_wakeup_event(codec->dev, 300); in wm8994_mic_irq()
3506 static void wm1811_micd_stop(struct snd_soc_codec *codec) in wm1811_micd_stop() argument
3508 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm1811_micd_stop()
3513 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); in wm1811_micd_stop()
3515 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); in wm1811_micd_stop()
3518 snd_soc_dapm_disable_pin(&codec->dapm, in wm1811_micd_stop()
3522 static void wm8958_button_det(struct snd_soc_codec *codec, u16 status) in wm8958_button_det() argument
3524 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8958_button_det()
3559 wm1811_micd_stop(wm8994->hubs.codec); in wm8958_open_circuit_work()
3566 wm8958_micd_set_rate(wm8994->hubs.codec); in wm8958_open_circuit_work()
3577 struct snd_soc_codec *codec = data; in wm8958_mic_id() local
3578 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8958_mic_id()
3583 dev_dbg(codec->dev, "Detected open circuit\n"); in wm8958_mic_id()
3595 dev_dbg(codec->dev, "Detected microphone\n"); in wm8958_mic_id()
3600 wm8958_micd_set_rate(codec); in wm8958_mic_id()
3608 dev_dbg(codec->dev, "Detected headphone\n"); in wm8958_mic_id()
3611 wm8958_micd_set_rate(codec); in wm8958_mic_id()
3614 wm1811_micd_stop(codec); in wm8958_mic_id()
3627 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm1811_mic_work() local
3629 pm_runtime_get_sync(codec->dev); in wm1811_mic_work()
3633 snd_soc_dapm_force_enable_pin(&codec->dapm, in wm1811_mic_work()
3635 snd_soc_dapm_sync(&codec->dapm); in wm1811_mic_work()
3640 dev_dbg(codec->dev, "Starting mic detection\n"); in wm1811_mic_work()
3651 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC); in wm1811_mic_work()
3653 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm1811_mic_work()
3659 pm_runtime_put(codec->dev); in wm1811_mic_work()
3666 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm1811_jackdet_irq() local
3670 pm_runtime_get_sync(codec->dev); in wm1811_jackdet_irq()
3676 reg = snd_soc_read(codec, WM1811_JACKDET_CTRL); in wm1811_jackdet_irq()
3678 dev_err(codec->dev, "Failed to read jack status: %d\n", reg); in wm1811_jackdet_irq()
3680 pm_runtime_put(codec->dev); in wm1811_jackdet_irq()
3684 dev_dbg(codec->dev, "JACKDET %x\n", reg); in wm1811_jackdet_irq()
3689 dev_dbg(codec->dev, "Jack detected\n"); in wm1811_jackdet_irq()
3691 wm8958_micd_set_rate(codec); in wm1811_jackdet_irq()
3693 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm1811_jackdet_irq()
3697 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, in wm1811_jackdet_irq()
3705 dev_dbg(codec->dev, "Jack not detected\n"); in wm1811_jackdet_irq()
3709 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm1811_jackdet_irq()
3713 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, in wm1811_jackdet_irq()
3718 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm1811_jackdet_irq()
3720 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); in wm1811_jackdet_irq()
3727 snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2"); in wm1811_jackdet_irq()
3741 pm_runtime_put(codec->dev); in wm1811_jackdet_irq()
3769 int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, in wm8958_mic_detect() argument
3773 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8958_mic_detect()
3786 snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS"); in wm8958_mic_detect()
3787 snd_soc_dapm_sync(&codec->dapm); in wm8958_mic_detect()
3804 wm8994->mic_id_cb_data = codec; in wm8958_mic_detect()
3807 wm8958_micd_set_rate(codec); in wm8958_mic_detect()
3819 snd_soc_update_bits(codec, WM8958_MIC_DETECT_2, in wm8958_mic_detect()
3822 WARN_ON(codec->dapm.bias_level > SND_SOC_BIAS_STANDBY); in wm8958_mic_detect()
3830 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, in wm8958_mic_detect()
3833 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8958_mic_detect()
3836 snd_soc_update_bits(codec, WM8994_LDO_1, in wm8958_mic_detect()
3838 wm1811_jackdet_set_mode(codec, in wm8958_mic_detect()
3841 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm8958_mic_detect()
3846 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm8958_mic_detect()
3848 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_NONE); in wm8958_mic_detect()
3849 snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS"); in wm8958_mic_detect()
3850 snd_soc_dapm_sync(&codec->dapm); in wm8958_mic_detect()
3862 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm8958_mic_work() local
3864 pm_runtime_get_sync(codec->dev); in wm8958_mic_work()
3872 pm_runtime_put(codec->dev); in wm8958_mic_work()
3878 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm8958_mic_irq() local
3886 if (!(snd_soc_read(codec, WM8958_MIC_DETECT_1) & WM8958_MICD_ENA)) in wm8958_mic_irq()
3892 pm_runtime_get_sync(codec->dev); in wm8958_mic_irq()
3899 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3); in wm8958_mic_irq()
3901 dev_err(codec->dev, in wm8958_mic_irq()
3904 pm_runtime_put(codec->dev); in wm8958_mic_irq()
3909 dev_dbg(codec->dev, "Mic detect data not valid\n"); in wm8958_mic_irq()
3920 dev_warn(codec->dev, "No impedance range reported for jack\n"); in wm8958_mic_irq()
3923 trace_snd_soc_jack_irq(dev_name(codec->dev)); in wm8958_mic_irq()
3928 ret = snd_soc_read(codec, WM1811_JACKDET_CTRL); in wm8958_mic_irq()
3930 dev_err(codec->dev, "Failed to read jack status: %d\n", in wm8958_mic_irq()
3933 dev_dbg(codec->dev, "Ignoring removed jack\n"); in wm8958_mic_irq()
3952 wm8958_button_det(codec, reg); in wm8958_mic_irq()
3955 pm_runtime_put(codec->dev); in wm8958_mic_irq()
3961 struct snd_soc_codec *codec = data; in wm8994_fifo_error() local
3963 dev_err(codec->dev, "FIFO error\n"); in wm8994_fifo_error()
3970 struct snd_soc_codec *codec = data; in wm8994_temp_warn() local
3972 dev_err(codec->dev, "Thermal warning\n"); in wm8994_temp_warn()
3979 struct snd_soc_codec *codec = data; in wm8994_temp_shut() local
3981 dev_crit(codec->dev, "Thermal shutdown\n"); in wm8994_temp_shut()
3986 static int wm8994_codec_probe(struct snd_soc_codec *codec) in wm8994_codec_probe() argument
3988 struct wm8994 *control = dev_get_drvdata(codec->dev->parent); in wm8994_codec_probe()
3989 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_probe()
3990 struct snd_soc_dapm_context *dapm = &codec->dapm; in wm8994_codec_probe()
3994 wm8994->hubs.codec = codec; in wm8994_codec_probe()
4021 codec->dapm.idle_bias_off = 1; in wm8994_codec_probe()
4029 codec->dapm.idle_bias_off = 0; in wm8994_codec_probe()
4069 snd_soc_update_bits(codec, WM8994_ANALOGUE_HP_1, in wm8994_codec_probe()
4078 wm8994_fifo_error, "FIFO error", codec); in wm8994_codec_probe()
4080 wm8994_temp_warn, "Thermal warning", codec); in wm8994_codec_probe()
4082 wm8994_temp_shut, "Thermal shutdown", codec); in wm8994_codec_probe()
4099 dev_warn(codec->dev, in wm8994_codec_probe()
4109 dev_warn(codec->dev, in wm8994_codec_probe()
4118 dev_warn(codec->dev, in wm8994_codec_probe()
4127 dev_warn(codec->dev, in wm8994_codec_probe()
4141 dev_warn(codec->dev, in wm8994_codec_probe()
4177 pm_runtime_get_sync(codec->dev); in wm8994_codec_probe()
4185 dev_err(codec->dev, "Failed to read GPIO1 state: %d\n", ret); in wm8994_codec_probe()
4197 dev_err(codec->dev, "Failed to read GPIO6 state: %d\n", ret); in wm8994_codec_probe()
4207 pm_runtime_put(codec->dev); in wm8994_codec_probe()
4211 snd_soc_update_bits(codec, wm8994_vu_bits[i].reg, in wm8994_codec_probe()
4216 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2, in wm8994_codec_probe()
4219 snd_soc_update_bits(codec, WM8994_AIF1_DAC2_FILTERS_2, in wm8994_codec_probe()
4222 snd_soc_update_bits(codec, WM8994_AIF2_DAC_FILTERS_2, in wm8994_codec_probe()
4232 snd_soc_update_bits(codec, WM8994_AIF1_CONTROL_1, in wm8994_codec_probe()
4243 snd_soc_update_bits(codec, WM8958_MICBIAS1, in wm8994_codec_probe()
4245 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8994_codec_probe()
4253 wm_hubs_update_class_w(codec); in wm8994_codec_probe()
4257 wm_hubs_add_analogue_controls(codec); in wm8994_codec_probe()
4258 snd_soc_add_codec_controls(codec, wm8994_snd_controls, in wm8994_codec_probe()
4284 snd_soc_add_codec_controls(codec, wm8958_snd_controls, in wm8994_codec_probe()
4306 snd_soc_add_codec_controls(codec, wm8958_snd_controls, in wm8994_codec_probe()
4319 wm_hubs_add_analogue_routes(codec, 0, 0); in wm8994_codec_probe()
4357 wm8958_dsp2_init(codec); in wm8994_codec_probe()
4382 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); in wm8994_codec_probe()
4383 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); in wm8994_codec_probe()
4384 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); in wm8994_codec_probe()
4389 static int wm8994_codec_remove(struct snd_soc_codec *codec) in wm8994_codec_remove() argument
4391 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_remove()
4401 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); in wm8994_codec_remove()
4402 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); in wm8994_codec_remove()
4403 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); in wm8994_codec_remove()