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 snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in configure_clock()
216 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in configure_clock()
220 configure_aif_clock(codec, 0); in configure_clock()
221 configure_aif_clock(codec, 1); in configure_clock()
231 wm8958_micd_set_rate(codec); in configure_clock()
240 change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, in configure_clock()
245 wm8958_micd_set_rate(codec); in configure_clock()
253 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); in check_clk_sys() local
254 int reg = snd_soc_read(codec, WM8994_CLOCKING_1); in check_clk_sys()
303 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_put_drc_sw() local
313 ret = snd_soc_read(codec, mc->reg); in wm8994_put_drc_sw()
322 static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) in wm8994_set_drc() argument
324 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_drc()
332 save = snd_soc_read(codec, base); in wm8994_set_drc()
337 snd_soc_update_bits(codec, base + i, 0xffff, in wm8994_set_drc()
340 snd_soc_update_bits(codec, base, WM8994_AIF1DAC1_DRC_ENA | in wm8994_set_drc()
360 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_put_drc_enum() local
361 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_put_drc_enum()
375 wm8994_set_drc(codec, drc); in wm8994_put_drc_enum()
383 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_get_drc_enum() local
384 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_get_drc_enum()
394 static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) in wm8994_set_retune_mobile() argument
396 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_retune_mobile()
433 dev_dbg(codec->dev, "ReTune Mobile %d %s/%dHz for %dHz sample rate\n", in wm8994_set_retune_mobile()
442 save = snd_soc_read(codec, base); in wm8994_set_retune_mobile()
446 snd_soc_update_bits(codec, base + i, 0xffff, in wm8994_set_retune_mobile()
449 snd_soc_update_bits(codec, base, WM8994_AIF1DAC1_EQ_ENA, save); in wm8994_set_retune_mobile()
467 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_put_retune_mobile_enum() local
468 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_put_retune_mobile_enum()
482 wm8994_set_retune_mobile(codec, block); in wm8994_put_retune_mobile_enum()
490 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); in wm8994_get_retune_mobile_enum() local
491 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_get_retune_mobile_enum()
743 static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode) in wm1811_jackdet_set_mode() argument
745 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm1811_jackdet_set_mode()
762 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in wm1811_jackdet_set_mode()
766 static void active_reference(struct snd_soc_codec *codec) in active_reference() argument
768 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in active_reference()
774 dev_dbg(codec->dev, "Active refcount incremented, now %d\n", in active_reference()
778 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_AUDIO); in active_reference()
783 static void active_dereference(struct snd_soc_codec *codec) in active_dereference() argument
785 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in active_dereference()
792 dev_dbg(codec->dev, "Active refcount decremented, now %d\n", in active_dereference()
802 wm1811_jackdet_set_mode(codec, mode); in active_dereference()
811 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in clk_sys_event() local
812 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in clk_sys_event()
816 return configure_clock(codec); in clk_sys_event()
835 configure_clock(codec); in clk_sys_event()
842 static void vmid_reference(struct snd_soc_codec *codec) in vmid_reference() argument
844 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in vmid_reference()
846 pm_runtime_get_sync(codec->dev); in vmid_reference()
850 dev_dbg(codec->dev, "Referencing VMID, refcount is now %d\n", in vmid_reference()
854 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, in vmid_reference()
858 wm_hubs_vmid_ena(codec); in vmid_reference()
865 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
877 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_reference()
884 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
892 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
904 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_reference()
911 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_reference()
920 static void vmid_dereference(struct snd_soc_codec *codec) in vmid_dereference() argument
922 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in vmid_dereference()
926 dev_dbg(codec->dev, "Dereferencing VMID, refcount is now %d\n", in vmid_dereference()
931 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, in vmid_dereference()
938 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, in vmid_dereference()
945 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_dereference()
951 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_dereference()
957 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, in vmid_dereference()
963 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, in vmid_dereference()
970 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, in vmid_dereference()
976 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, in vmid_dereference()
980 pm_runtime_put(codec->dev); in vmid_dereference()
986 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in vmid_event() local
990 vmid_reference(codec); in vmid_event()
994 vmid_dereference(codec); in vmid_event()
1001 static bool wm8994_check_class_w_digital(struct snd_soc_codec *codec) in wm8994_check_class_w_digital() argument
1007 reg = snd_soc_read(codec, WM8994_DAC1_LEFT_MIXER_ROUTING); in wm8994_check_class_w_digital()
1010 dev_vdbg(codec->dev, "Class W source AIF2DAC\n"); in wm8994_check_class_w_digital()
1014 dev_vdbg(codec->dev, "Class W source AIF1DAC2\n"); in wm8994_check_class_w_digital()
1018 dev_vdbg(codec->dev, "Class W source AIF1DAC1\n"); in wm8994_check_class_w_digital()
1022 dev_vdbg(codec->dev, "DAC mixer setting: %x\n", reg); in wm8994_check_class_w_digital()
1026 reg_r = snd_soc_read(codec, WM8994_DAC1_RIGHT_MIXER_ROUTING); in wm8994_check_class_w_digital()
1028 dev_vdbg(codec->dev, "Left and right DAC mixers different\n"); in wm8994_check_class_w_digital()
1033 snd_soc_update_bits(codec, WM8994_CLASS_W_1, in wm8994_check_class_w_digital()
1042 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif1clk_ev() local
1043 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in aif1clk_ev()
1066 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1); in aif1clk_ev()
1077 val = snd_soc_read(codec, WM8994_AIF1_CONTROL_2); in aif1clk_ev()
1088 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif1clk_ev()
1090 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif1clk_ev()
1092 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif1clk_ev()
1097 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, mask, in aif1clk_ev()
1102 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, mask, in aif1clk_ev()
1111 snd_soc_write(codec, wm8994_vu_bits[i].reg, in aif1clk_ev()
1112 snd_soc_read(codec, in aif1clk_ev()
1118 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif1clk_ev()
1120 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif1clk_ev()
1123 val = snd_soc_read(codec, WM8994_CLOCKING_1); in aif1clk_ev()
1128 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif1clk_ev()
1140 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif2clk_ev() local
1148 val = snd_soc_read(codec, WM8994_AIF2_CONTROL_1); in aif2clk_ev()
1159 val = snd_soc_read(codec, WM8994_AIF2_CONTROL_2); in aif2clk_ev()
1169 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif2clk_ev()
1172 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif2clk_ev()
1175 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif2clk_ev()
1180 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif2clk_ev()
1185 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif2clk_ev()
1194 snd_soc_write(codec, wm8994_vu_bits[i].reg, in aif2clk_ev()
1195 snd_soc_read(codec, in aif2clk_ev()
1201 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in aif2clk_ev()
1204 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, in aif2clk_ev()
1208 val = snd_soc_read(codec, WM8994_CLOCKING_1); in aif2clk_ev()
1213 snd_soc_update_bits(codec, WM8994_CLOCKING_1, in aif2clk_ev()
1225 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif1clk_late_ev() local
1226 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in aif1clk_late_ev()
1243 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in aif2clk_late_ev() local
1244 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in aif2clk_late_ev()
1261 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in late_enable_ev() local
1262 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in late_enable_ev()
1268 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, in late_enable_ev()
1276 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, in late_enable_ev()
1294 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in late_disable_ev() local
1295 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in late_disable_ev()
1301 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, in late_disable_ev()
1308 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, in late_disable_ev()
1336 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in dac_ev() local
1339 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, in dac_ev()
1377 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); in post_ev() local
1378 dev_dbg(codec->dev, "SRC status: %x\n", in post_ev()
1379 snd_soc_read(codec, in post_ev()
1445 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); in wm8994_put_class_w() local
1450 wm_hubs_update_class_w(codec); in wm8994_put_class_w()
2132 static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src, in _wm8994_set_fll() argument
2135 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in _wm8994_set_fll()
2158 reg = snd_soc_read(codec, WM8994_FLL1_CONTROL_1 + reg_offset); in _wm8994_set_fll()
2199 clk1 = snd_soc_read(codec, WM8994_CLOCKING_1); in _wm8994_set_fll()
2204 reg = snd_soc_read(codec, aif_reg); in _wm8994_set_fll()
2208 dev_err(codec->dev, "FLL%d is currently providing SYSCLK\n", in _wm8994_set_fll()
2214 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, in _wm8994_set_fll()
2219 dev_dbg(codec->dev, "Bypassing FLL%d\n", id + 1); in _wm8994_set_fll()
2220 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, in _wm8994_set_fll()
2227 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_2 + reg_offset, in _wm8994_set_fll()
2231 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_3 + reg_offset, in _wm8994_set_fll()
2234 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_4 + reg_offset, in _wm8994_set_fll()
2239 snd_soc_update_bits(codec, WM8958_FLL1_EFS_1 + reg_offset, in _wm8994_set_fll()
2242 snd_soc_update_bits(codec, WM8958_FLL1_EFS_2 + reg_offset, in _wm8994_set_fll()
2245 snd_soc_update_bits(codec, WM8958_FLL1_EFS_2 + reg_offset, in _wm8994_set_fll()
2249 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_5 + reg_offset, in _wm8994_set_fll()
2265 active_reference(codec); in _wm8994_set_fll()
2269 vmid_reference(codec); in _wm8994_set_fll()
2273 vmid_reference(codec); in _wm8994_set_fll()
2287 snd_soc_update_bits(codec, WM8994_FLL1_CONTROL_1 + reg_offset, in _wm8994_set_fll()
2295 dev_warn(codec->dev, in _wm8994_set_fll()
2304 vmid_dereference(codec); in _wm8994_set_fll()
2308 vmid_dereference(codec); in _wm8994_set_fll()
2314 active_dereference(codec); in _wm8994_set_fll()
2323 configure_clock(codec); in _wm8994_set_fll()
2330 dev_dbg(codec->dev, "Configuring AIFs for 128fs\n"); in _wm8994_set_fll()
2332 wm8994->aifdiv[0] = snd_soc_read(codec, WM8994_AIF1_RATE) in _wm8994_set_fll()
2334 wm8994->aifdiv[1] = snd_soc_read(codec, WM8994_AIF2_RATE) in _wm8994_set_fll()
2337 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in _wm8994_set_fll()
2339 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in _wm8994_set_fll()
2342 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in _wm8994_set_fll()
2345 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in _wm8994_set_fll()
2370 return _wm8994_set_fll(dai->codec, id, src, freq_in, freq_out); in wm8994_set_fll()
2376 struct snd_soc_codec *codec = dai->codec; in wm8994_set_dai_sysclk() local
2377 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_dai_sysclk()
2426 snd_soc_update_bits(codec, WM8994_CLOCKING_2, in wm8994_set_dai_sysclk()
2428 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2, in wm8994_set_dai_sysclk()
2431 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2, in wm8994_set_dai_sysclk()
2439 configure_clock(codec); in wm8994_set_dai_sysclk()
2446 dev_dbg(codec->dev, "Configuring AIFs for 128fs\n"); in wm8994_set_dai_sysclk()
2448 wm8994->aifdiv[0] = snd_soc_read(codec, WM8994_AIF1_RATE) in wm8994_set_dai_sysclk()
2450 wm8994->aifdiv[1] = snd_soc_read(codec, WM8994_AIF2_RATE) in wm8994_set_dai_sysclk()
2453 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in wm8994_set_dai_sysclk()
2455 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in wm8994_set_dai_sysclk()
2458 snd_soc_update_bits(codec, WM8994_AIF1_RATE, in wm8994_set_dai_sysclk()
2461 snd_soc_update_bits(codec, WM8994_AIF2_RATE, in wm8994_set_dai_sysclk()
2472 static int wm8994_set_bias_level(struct snd_soc_codec *codec, in wm8994_set_bias_level() argument
2475 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_bias_level()
2478 wm_hubs_set_bias_level(codec, level); in wm8994_set_bias_level()
2489 snd_soc_update_bits(codec, WM8958_MICBIAS1, in wm8994_set_bias_level()
2491 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8994_set_bias_level()
2498 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) in wm8994_set_bias_level()
2499 active_reference(codec); in wm8994_set_bias_level()
2503 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { in wm8994_set_bias_level()
2508 snd_soc_update_bits(codec, in wm8994_set_bias_level()
2520 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, in wm8994_set_bias_level()
2527 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_PREPARE) in wm8994_set_bias_level()
2528 active_dereference(codec); in wm8994_set_bias_level()
2534 snd_soc_update_bits(codec, WM8958_MICBIAS1, in wm8994_set_bias_level()
2537 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8994_set_bias_level()
2547 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_STANDBY) in wm8994_set_bias_level()
2555 int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode) in wm8994_vmid_mode() argument
2557 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_vmid_mode()
2558 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8994_vmid_mode()
2615 struct snd_soc_codec *codec = dai->codec; in wm8994_set_dai_fmt() local
2616 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_set_dai_fmt()
2718 snd_soc_update_bits(codec, WM8958_AIF3_CONTROL_1, in wm8994_set_dai_fmt()
2727 snd_soc_update_bits(codec, aif1_reg, in wm8994_set_dai_fmt()
2731 snd_soc_update_bits(codec, ms_reg, WM8994_AIF1_MSTR, in wm8994_set_dai_fmt()
2733 snd_soc_update_bits(codec, dac_reg, in wm8994_set_dai_fmt()
2735 snd_soc_update_bits(codec, adc_reg, in wm8994_set_dai_fmt()
2770 struct snd_soc_codec *codec = dai->codec; in wm8994_hw_params() local
2771 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_hw_params()
2799 dev_dbg(codec->dev, "AIF1 using split LRCLK\n"); in wm8994_hw_params()
2812 dev_dbg(codec->dev, "AIF2 using split LRCLK\n"); in wm8994_hw_params()
2871 (snd_soc_read(codec, aif1_reg) & 0x18) == 0x18) in wm8994_hw_params()
2921 snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_WL_MASK, aif1); in wm8994_hw_params()
2922 snd_soc_update_bits(codec, aif2_reg, WM8994_AIF1_MONO, aif2); in wm8994_hw_params()
2923 snd_soc_update_bits(codec, bclk_reg, WM8994_AIF1_BCLK_DIV_MASK, bclk); in wm8994_hw_params()
2924 snd_soc_update_bits(codec, lrclk_reg, WM8994_AIF1DAC_RATE_MASK, in wm8994_hw_params()
2926 snd_soc_update_bits(codec, rate_reg, WM8994_AIF1_SR_MASK | in wm8994_hw_params()
2933 wm8994_set_retune_mobile(codec, 0); in wm8994_hw_params()
2934 wm8994_set_retune_mobile(codec, 1); in wm8994_hw_params()
2938 wm8994_set_retune_mobile(codec, 2); in wm8994_hw_params()
2950 struct snd_soc_codec *codec = dai->codec; in wm8994_aif3_hw_params() local
2951 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_aif3_hw_params()
2987 return snd_soc_update_bits(codec, aif1_reg, WM8994_AIF1_WL_MASK, aif1); in wm8994_aif3_hw_params()
2992 struct snd_soc_codec *codec = codec_dai->codec; in wm8994_aif_mute() local
3012 snd_soc_update_bits(codec, mute_reg, WM8994_AIF1DAC1_MUTE, reg); in wm8994_aif_mute()
3019 struct snd_soc_codec *codec = codec_dai->codec; in wm8994_set_tristate() local
3040 return snd_soc_update_bits(codec, reg, mask, val); in wm8994_set_tristate()
3045 struct snd_soc_codec *codec = dai->codec; in wm8994_aif2_probe() local
3048 snd_soc_update_bits(codec, WM8994_GPIO_3, in wm8994_aif2_probe()
3050 snd_soc_update_bits(codec, WM8994_GPIO_4, in wm8994_aif2_probe()
3052 snd_soc_update_bits(codec, WM8994_GPIO_5, in wm8994_aif2_probe()
3153 static int wm8994_codec_suspend(struct snd_soc_codec *codec) in wm8994_codec_suspend() argument
3155 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_suspend()
3161 ret = _wm8994_set_fll(codec, i + 1, 0, 0, 0); in wm8994_codec_suspend()
3163 dev_warn(codec->dev, "Failed to stop FLL%d: %d\n", in wm8994_codec_suspend()
3167 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); in wm8994_codec_suspend()
3172 static int wm8994_codec_resume(struct snd_soc_codec *codec) in wm8994_codec_resume() argument
3174 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_resume()
3181 ret = _wm8994_set_fll(codec, i + 1, in wm8994_codec_resume()
3186 dev_warn(codec->dev, "Failed to restore FLL%d: %d\n", in wm8994_codec_resume()
3199 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm8994_handle_retune_mobile_pdata() local
3252 dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", in wm8994_handle_retune_mobile_pdata()
3258 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls, in wm8994_handle_retune_mobile_pdata()
3261 dev_err(wm8994->hubs.codec->dev, in wm8994_handle_retune_mobile_pdata()
3267 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm8994_handle_pdata() local
3275 wm_hubs_handle_analogue_pdata(codec, pdata->lineout1_diff, in wm8994_handle_pdata()
3286 dev_dbg(codec->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); in wm8994_handle_pdata()
3299 wm8994->drc_texts = devm_kzalloc(wm8994->hubs.codec->dev, in wm8994_handle_pdata()
3310 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, controls, in wm8994_handle_pdata()
3313 wm8994_set_drc(codec, i); in wm8994_handle_pdata()
3315 ret = snd_soc_add_codec_controls(wm8994->hubs.codec, in wm8994_handle_pdata()
3321 dev_err(wm8994->hubs.codec->dev, in wm8994_handle_pdata()
3325 dev_dbg(codec->dev, "%d ReTune Mobile configurations\n", in wm8994_handle_pdata()
3331 snd_soc_add_codec_controls(wm8994->hubs.codec, wm8994_eq_controls, in wm8994_handle_pdata()
3336 snd_soc_write(codec, WM8958_MICBIAS1 + i, in wm8994_handle_pdata()
3357 int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, in wm8994_mic_detect() argument
3360 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8994_mic_detect()
3361 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_mic_detect()
3367 dev_warn(codec->dev, "Not a WM8994\n"); in wm8994_mic_detect()
3387 dev_warn(codec->dev, "Invalid MICBIAS %d\n", micbias); in wm8994_mic_detect()
3392 dev_warn(codec->dev, "Failed to configure MICBIAS%d: %d\n", in wm8994_mic_detect()
3395 dev_dbg(codec->dev, "Configuring microphone detection on %d %p\n", in wm8994_mic_detect()
3408 snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, reg); in wm8994_mic_detect()
3411 snd_soc_update_bits(codec, WM8994_IRQ_DEBOUNCE, in wm8994_mic_detect()
3489 struct snd_soc_codec *codec = priv->hubs.codec; in wm8994_mic_irq() local
3492 trace_snd_soc_jack_irq(dev_name(codec->dev)); in wm8994_mic_irq()
3495 pm_wakeup_event(codec->dev, 300); in wm8994_mic_irq()
3504 static void wm1811_micd_stop(struct snd_soc_codec *codec) in wm1811_micd_stop() argument
3506 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm1811_micd_stop()
3507 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm1811_micd_stop()
3512 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0); in wm1811_micd_stop()
3514 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); in wm1811_micd_stop()
3520 static void wm8958_button_det(struct snd_soc_codec *codec, u16 status) in wm8958_button_det() argument
3522 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8958_button_det()
3557 wm1811_micd_stop(wm8994->hubs.codec); in wm8958_open_circuit_work()
3564 wm8958_micd_set_rate(wm8994->hubs.codec); in wm8958_open_circuit_work()
3575 struct snd_soc_codec *codec = data; in wm8958_mic_id() local
3576 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8958_mic_id()
3581 dev_dbg(codec->dev, "Detected open circuit\n"); in wm8958_mic_id()
3593 dev_dbg(codec->dev, "Detected microphone\n"); in wm8958_mic_id()
3598 wm8958_micd_set_rate(codec); in wm8958_mic_id()
3606 dev_dbg(codec->dev, "Detected headphone\n"); in wm8958_mic_id()
3609 wm8958_micd_set_rate(codec); in wm8958_mic_id()
3612 wm1811_micd_stop(codec); in wm8958_mic_id()
3625 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm1811_mic_work() local
3626 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm1811_mic_work()
3628 pm_runtime_get_sync(codec->dev); in wm1811_mic_work()
3638 dev_dbg(codec->dev, "Starting mic detection\n"); in wm1811_mic_work()
3649 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC); in wm1811_mic_work()
3651 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm1811_mic_work()
3657 pm_runtime_put(codec->dev); in wm1811_mic_work()
3664 struct snd_soc_codec *codec = wm8994->hubs.codec; in wm1811_jackdet_irq() local
3665 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm1811_jackdet_irq()
3669 pm_runtime_get_sync(codec->dev); in wm1811_jackdet_irq()
3675 reg = snd_soc_read(codec, WM1811_JACKDET_CTRL); in wm1811_jackdet_irq()
3677 dev_err(codec->dev, "Failed to read jack status: %d\n", reg); in wm1811_jackdet_irq()
3679 pm_runtime_put(codec->dev); in wm1811_jackdet_irq()
3683 dev_dbg(codec->dev, "JACKDET %x\n", reg); in wm1811_jackdet_irq()
3688 dev_dbg(codec->dev, "Jack detected\n"); in wm1811_jackdet_irq()
3690 wm8958_micd_set_rate(codec); in wm1811_jackdet_irq()
3692 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm1811_jackdet_irq()
3696 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, in wm1811_jackdet_irq()
3704 dev_dbg(codec->dev, "Jack not detected\n"); in wm1811_jackdet_irq()
3708 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm1811_jackdet_irq()
3712 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, in wm1811_jackdet_irq()
3717 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, in wm1811_jackdet_irq()
3719 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK); in wm1811_jackdet_irq()
3740 pm_runtime_put(codec->dev); in wm1811_jackdet_irq()
3768 int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, in wm8958_mic_detect() argument
3772 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8958_mic_detect()
3773 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 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(snd_soc_codec_get_bias_level(codec) > 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()
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 snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); in wm8994_codec_probe()
3989 struct wm8994 *control = dev_get_drvdata(codec->dev->parent); in wm8994_codec_probe()
3990 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_probe()
3994 wm8994->hubs.codec = codec; 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()
4100 dev_warn(codec->dev, in wm8994_codec_probe()
4110 dev_warn(codec->dev, in wm8994_codec_probe()
4119 dev_warn(codec->dev, in wm8994_codec_probe()
4128 dev_warn(codec->dev, in wm8994_codec_probe()
4143 dev_warn(codec->dev, in wm8994_codec_probe()
4179 pm_runtime_get_sync(codec->dev); in wm8994_codec_probe()
4187 dev_err(codec->dev, "Failed to read GPIO1 state: %d\n", ret); in wm8994_codec_probe()
4199 dev_err(codec->dev, "Failed to read GPIO6 state: %d\n", ret); in wm8994_codec_probe()
4209 pm_runtime_put(codec->dev); in wm8994_codec_probe()
4213 snd_soc_update_bits(codec, wm8994_vu_bits[i].reg, in wm8994_codec_probe()
4218 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2, in wm8994_codec_probe()
4221 snd_soc_update_bits(codec, WM8994_AIF1_DAC2_FILTERS_2, in wm8994_codec_probe()
4224 snd_soc_update_bits(codec, WM8994_AIF2_DAC_FILTERS_2, in wm8994_codec_probe()
4234 snd_soc_update_bits(codec, WM8994_AIF1_CONTROL_1, in wm8994_codec_probe()
4245 snd_soc_update_bits(codec, WM8958_MICBIAS1, in wm8994_codec_probe()
4247 snd_soc_update_bits(codec, WM8958_MICBIAS2, in wm8994_codec_probe()
4255 wm_hubs_update_class_w(codec); in wm8994_codec_probe()
4259 wm_hubs_add_analogue_controls(codec); in wm8994_codec_probe()
4260 snd_soc_add_codec_controls(codec, wm8994_snd_controls, in wm8994_codec_probe()
4286 snd_soc_add_codec_controls(codec, wm8958_snd_controls, in wm8994_codec_probe()
4308 snd_soc_add_codec_controls(codec, wm8958_snd_controls, in wm8994_codec_probe()
4321 wm_hubs_add_analogue_routes(codec, 0, 0); in wm8994_codec_probe()
4359 wm8958_dsp2_init(codec); in wm8994_codec_probe()
4384 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); in wm8994_codec_probe()
4385 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); in wm8994_codec_probe()
4386 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); in wm8994_codec_probe()
4391 static int wm8994_codec_remove(struct snd_soc_codec *codec) in wm8994_codec_remove() argument
4393 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); in wm8994_codec_remove()
4403 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec); in wm8994_codec_remove()
4404 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec); in wm8994_codec_remove()
4405 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec); in wm8994_codec_remove()