Lines Matching full:wm8994

3  * wm8994.c  --  WM8994 ALSA SoC Audio driver
30 #include <linux/mfd/wm8994/core.h>
31 #include <linux/mfd/wm8994/registers.h>
32 #include <linux/mfd/wm8994/pdata.h>
33 #include <linux/mfd/wm8994/gpio.h>
35 #include "wm8994.h"
113 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_micd_set_rate() local
114 struct wm8994 *control = wm8994->wm8994; in wm8958_micd_set_rate()
120 idle = !wm8994->jack_mic; in wm8958_micd_set_rate()
124 sysclk = wm8994->aifclk[1]; in wm8958_micd_set_rate()
126 sysclk = wm8994->aifclk[0]; in wm8958_micd_set_rate()
131 } else if (wm8994->jackdet) { in wm8958_micd_set_rate()
164 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in configure_aif_clock() local
174 switch (wm8994->sysclk[aif]) { in configure_aif_clock()
176 rate = wm8994->mclk_rate[0]; in configure_aif_clock()
181 rate = wm8994->mclk_rate[1]; in configure_aif_clock()
186 rate = wm8994->fll[0].out; in configure_aif_clock()
191 rate = wm8994->fll[1].out; in configure_aif_clock()
206 wm8994->aifclk[aif] = rate; in configure_aif_clock()
218 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in configure_clock() local
232 if (wm8994->aifclk[0] == wm8994->aifclk[1]) { in configure_clock()
237 if (wm8994->aifclk[0] < wm8994->aifclk[1]) in configure_clock()
325 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_drc() local
326 struct wm8994 *control = wm8994->wm8994; in wm8994_set_drc()
329 int cfg = wm8994->drc_cfg[drc]; in wm8994_set_drc()
362 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_put_drc_enum() local
363 struct wm8994 *control = wm8994->wm8994; in wm8994_put_drc_enum()
374 wm8994->drc_cfg[drc] = value; in wm8994_put_drc_enum()
385 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_get_drc_enum() local
390 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc]; in wm8994_get_drc_enum()
397 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_retune_mobile() local
398 struct wm8994 *control = wm8994->wm8994; in wm8994_set_retune_mobile()
403 if (!pdata || !wm8994->num_retune_mobile_texts) in wm8994_set_retune_mobile()
420 cfg = wm8994->retune_mobile_cfg[block]; in wm8994_set_retune_mobile()
425 wm8994->retune_mobile_texts[cfg]) == 0 && in wm8994_set_retune_mobile()
427 - wm8994->dac_rates[iface]) < best_val) { in wm8994_set_retune_mobile()
430 - wm8994->dac_rates[iface]); in wm8994_set_retune_mobile()
438 wm8994->dac_rates[iface]); in wm8994_set_retune_mobile()
469 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_put_retune_mobile_enum() local
470 struct wm8994 *control = wm8994->wm8994; in wm8994_put_retune_mobile_enum()
481 wm8994->retune_mobile_cfg[block] = value; in wm8994_put_retune_mobile_enum()
492 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_get_retune_mobile_enum() local
498 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block]; in wm8994_get_retune_mobile_enum()
744 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm1811_jackdet_set_mode() local
746 if (!wm8994->jackdet || !wm8994->micdet[0].jack) in wm1811_jackdet_set_mode()
749 if (wm8994->active_refcount) in wm1811_jackdet_set_mode()
752 if (mode == wm8994->jackdet_mode) in wm1811_jackdet_set_mode()
755 wm8994->jackdet_mode = mode; in wm1811_jackdet_set_mode()
767 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in active_reference() local
769 mutex_lock(&wm8994->accdet_lock); in active_reference()
771 wm8994->active_refcount++; in active_reference()
774 wm8994->active_refcount); in active_reference()
779 mutex_unlock(&wm8994->accdet_lock); in active_reference()
784 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in active_dereference() local
787 mutex_lock(&wm8994->accdet_lock); in active_dereference()
789 wm8994->active_refcount--; in active_dereference()
792 wm8994->active_refcount); in active_dereference()
794 if (wm8994->active_refcount == 0) { in active_dereference()
796 if (wm8994->jack_mic || wm8994->mic_detecting) in active_dereference()
804 mutex_unlock(&wm8994->accdet_lock); in active_dereference()
811 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in clk_sys_event() local
825 if (wm8994->jackdet && !wm8994->clk_has_run) { in clk_sys_event()
827 &wm8994->jackdet_bootstrap, in clk_sys_event()
829 wm8994->clk_has_run = true; in clk_sys_event()
843 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in vmid_reference() local
847 wm8994->vmid_refcount++; in vmid_reference()
850 wm8994->vmid_refcount); in vmid_reference()
852 if (wm8994->vmid_refcount == 1) { in vmid_reference()
859 switch (wm8994->vmid_mode) { in vmid_reference()
922 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in vmid_dereference() local
924 wm8994->vmid_refcount--; in vmid_dereference()
927 wm8994->vmid_refcount); in vmid_dereference()
929 if (wm8994->vmid_refcount == 0) { in vmid_dereference()
930 if (wm8994->hubs.lineout1_se) in vmid_dereference()
937 if (wm8994->hubs.lineout2_se) in vmid_dereference()
1041 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_update_vu_bits() local
1042 struct wm8994 *control = wm8994->wm8994; in wm8994_update_vu_bits()
1061 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif_mclk_set() local
1085 ret = clk_prepare_enable(wm8994->mclk[clk_idx].clk); in aif_mclk_set()
1092 clk_disable_unprepare(wm8994->mclk[clk_idx].clk); in aif_mclk_set()
1102 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif1clk_ev() local
1103 struct wm8994 *control = wm8994->wm8994; in aif1clk_ev()
1111 case WM8994: in aif1clk_ev()
1126 if (wm8994->channels[0] <= 2) in aif1clk_ev()
1299 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif1clk_late_ev() local
1303 wm8994->aif1clk_enable = 1; in aif1clk_late_ev()
1306 wm8994->aif1clk_disable = 1; in aif1clk_late_ev()
1317 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif2clk_late_ev() local
1321 wm8994->aif2clk_enable = 1; in aif2clk_late_ev()
1324 wm8994->aif2clk_disable = 1; in aif2clk_late_ev()
1335 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in late_enable_ev() local
1339 if (wm8994->aif1clk_enable) { in late_enable_ev()
1345 wm8994->aif1clk_enable = 0; in late_enable_ev()
1347 if (wm8994->aif2clk_enable) { in late_enable_ev()
1353 wm8994->aif2clk_enable = 0; in late_enable_ev()
1368 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in late_disable_ev() local
1372 if (wm8994->aif1clk_disable) { in late_disable_ev()
1377 wm8994->aif1clk_disable = 0; in late_disable_ev()
1379 if (wm8994->aif2clk_disable) { in late_disable_ev()
1384 wm8994->aif2clk_disable = 0; in late_disable_ev()
2122 static int wm8994_get_fll_config(struct wm8994 *control, struct fll_div *fll, in wm8994_get_fll_config()
2176 case WM8994: in wm8994_get_fll_config()
2208 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in _wm8994_set_fll() local
2209 struct wm8994 *control = wm8994->wm8994; in _wm8994_set_fll()
2240 src = wm8994->fll[id].src; in _wm8994_set_fll()
2256 if (wm8994->fll[id].src == src && in _wm8994_set_fll()
2257 wm8994->fll[id].in == freq_in && wm8994->fll[id].out == freq_out) in _wm8994_set_fll()
2267 ret = wm8994_get_fll_config(control, &fll, wm8994->fll[id].in, in _wm8994_set_fll()
2268 wm8994->fll[id].out); in _wm8994_set_fll()
2300 mclk = wm8994->mclk[WM8994_MCLK1].clk; in _wm8994_set_fll()
2303 mclk = wm8994->mclk[WM8994_MCLK2].clk; in _wm8994_set_fll()
2312 if (wm8994->fll_byp && src == WM8994_FLL_SRC_BCLK && in _wm8994_set_fll()
2354 try_wait_for_completion(&wm8994->fll_locked[id]); in _wm8994_set_fll()
2358 mclk = wm8994->mclk[WM8994_MCLK1].clk; in _wm8994_set_fll()
2361 mclk = wm8994->mclk[WM8994_MCLK2].clk; in _wm8994_set_fll()
2382 case WM8994: in _wm8994_set_fll()
2405 if (wm8994->fll_locked_irq) { in _wm8994_set_fll()
2406 time_left = wait_for_completion_timeout(&wm8994->fll_locked[id], in _wm8994_set_fll()
2417 case WM8994: in _wm8994_set_fll()
2433 wm8994->fll[id].in = freq_in; in _wm8994_set_fll()
2434 wm8994->fll[id].out = freq_out; in _wm8994_set_fll()
2435 wm8994->fll[id].src = src; in _wm8994_set_fll()
2443 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) { in _wm8994_set_fll()
2446 wm8994->aifdiv[0] = snd_soc_component_read(component, WM8994_AIF1_RATE) in _wm8994_set_fll()
2448 wm8994->aifdiv[1] = snd_soc_component_read(component, WM8994_AIF2_RATE) in _wm8994_set_fll()
2455 } else if (wm8994->aifdiv[0]) { in _wm8994_set_fll()
2458 wm8994->aifdiv[0]); in _wm8994_set_fll()
2461 wm8994->aifdiv[1]); in _wm8994_set_fll()
2463 wm8994->aifdiv[0] = 0; in _wm8994_set_fll()
2464 wm8994->aifdiv[1] = 0; in _wm8994_set_fll()
2487 static int wm8994_set_mclk_rate(struct wm8994_priv *wm8994, unsigned int id, in wm8994_set_mclk_rate() argument
2492 if (!wm8994->mclk[id].clk || *freq == wm8994->mclk_rate[id]) in wm8994_set_mclk_rate()
2495 ret = clk_set_rate(wm8994->mclk[id].clk, *freq); in wm8994_set_mclk_rate()
2499 *freq = clk_get_rate(wm8994->mclk[id].clk); in wm8994_set_mclk_rate()
2508 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_dai_sysclk() local
2523 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_MCLK1; in wm8994_set_dai_sysclk()
2525 ret = wm8994_set_mclk_rate(wm8994, dai->id - 1, &freq); in wm8994_set_dai_sysclk()
2529 wm8994->mclk_rate[0] = freq; in wm8994_set_dai_sysclk()
2536 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_MCLK2; in wm8994_set_dai_sysclk()
2538 ret = wm8994_set_mclk_rate(wm8994, dai->id - 1, &freq); in wm8994_set_dai_sysclk()
2542 wm8994->mclk_rate[1] = freq; in wm8994_set_dai_sysclk()
2548 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_FLL1; in wm8994_set_dai_sysclk()
2553 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_FLL2; in wm8994_set_dai_sysclk()
2587 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) { in wm8994_set_dai_sysclk()
2590 wm8994->aifdiv[0] = snd_soc_component_read(component, WM8994_AIF1_RATE) in wm8994_set_dai_sysclk()
2592 wm8994->aifdiv[1] = snd_soc_component_read(component, WM8994_AIF2_RATE) in wm8994_set_dai_sysclk()
2599 } else if (wm8994->aifdiv[0]) { in wm8994_set_dai_sysclk()
2602 wm8994->aifdiv[0]); in wm8994_set_dai_sysclk()
2605 wm8994->aifdiv[1]); in wm8994_set_dai_sysclk()
2607 wm8994->aifdiv[0] = 0; in wm8994_set_dai_sysclk()
2608 wm8994->aifdiv[1] = 0; in wm8994_set_dai_sysclk()
2617 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_bias_level() local
2618 struct wm8994 *control = wm8994->wm8994; in wm8994_set_bias_level()
2690 wm8994->cur_fw = NULL; in wm8994_set_bias_level()
2699 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_vmid_mode() local
2706 if (wm8994->hubs.lineout1_se) { in wm8994_vmid_mode()
2712 if (wm8994->hubs.lineout2_se) { in wm8994_vmid_mode()
2721 wm8994->vmid_mode = mode; in wm8994_vmid_mode()
2729 if (wm8994->hubs.lineout1_se) { in wm8994_vmid_mode()
2735 if (wm8994->hubs.lineout2_se) { in wm8994_vmid_mode()
2742 wm8994->vmid_mode = mode; in wm8994_vmid_mode()
2758 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_dai_fmt() local
2759 struct wm8994 *control = wm8994->wm8994; in wm8994_set_dai_fmt()
2914 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_hw_params() local
2915 struct wm8994 *control = wm8994->wm8994; in wm8994_hw_params()
2938 wm8994->lrclk_shared[0]) { in wm8994_hw_params()
2951 wm8994->lrclk_shared[1]) { in wm8994_hw_params()
2983 wm8994->channels[id] = params_channels(params); in wm8994_hw_params()
2985 wm8994->channels[id] > pdata->max_channels_clocked[id]) { in wm8994_hw_params()
2987 pdata->max_channels_clocked[id], wm8994->channels[id]); in wm8994_hw_params()
2988 wm8994->channels[id] = pdata->max_channels_clocked[id]; in wm8994_hw_params()
2991 switch (wm8994->channels[id]) { in wm8994_hw_params()
3011 dai->id, wm8994->aifclk[id], bclk_rate); in wm8994_hw_params()
3013 if (wm8994->channels[id] == 1 && in wm8994_hw_params()
3017 if (wm8994->aifclk[id] == 0) { in wm8994_hw_params()
3025 - wm8994->aifclk[id]); in wm8994_hw_params()
3028 - wm8994->aifclk[id]); in wm8994_hw_params()
3045 cur_val = (wm8994->aifclk[id] * 10 / bclk_divs[i]) - bclk_rate; in wm8994_hw_params()
3050 bclk_rate = wm8994->aifclk[id] * 10 / bclk_divs[best]; in wm8994_hw_params()
3075 wm8994->dac_rates[0] = params_rate(params); in wm8994_hw_params()
3080 wm8994->dac_rates[1] = params_rate(params); in wm8994_hw_params()
3094 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_aif3_hw_params() local
3095 struct wm8994 *control = wm8994->wm8994; in wm8994_aif3_hw_params()
3234 .name = "wm8994-aif1",
3255 .name = "wm8994-aif2",
3276 .name = "wm8994-aif3",
3301 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_suspend() local
3304 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) { in wm8994_component_suspend()
3305 memcpy(&wm8994->fll_suspend[i], &wm8994->fll[i], in wm8994_component_suspend()
3320 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_resume() local
3323 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) { in wm8994_component_resume()
3324 if (!wm8994->fll_suspend[i].out) in wm8994_component_resume()
3328 wm8994->fll_suspend[i].src, in wm8994_component_resume()
3329 wm8994->fll_suspend[i].in, in wm8994_component_resume()
3330 wm8994->fll_suspend[i].out); in wm8994_component_resume()
3343 static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) in wm8994_handle_retune_mobile_pdata() argument
3345 struct snd_soc_component *component = wm8994->hubs.component; in wm8994_handle_retune_mobile_pdata()
3346 struct wm8994 *control = wm8994->wm8994; in wm8994_handle_retune_mobile_pdata()
3350 wm8994->retune_mobile_enum, in wm8994_handle_retune_mobile_pdata()
3354 wm8994->retune_mobile_enum, in wm8994_handle_retune_mobile_pdata()
3358 wm8994->retune_mobile_enum, in wm8994_handle_retune_mobile_pdata()
3369 wm8994->num_retune_mobile_texts = 0; in wm8994_handle_retune_mobile_pdata()
3370 wm8994->retune_mobile_texts = NULL; in wm8994_handle_retune_mobile_pdata()
3372 for (j = 0; j < wm8994->num_retune_mobile_texts; j++) { in wm8994_handle_retune_mobile_pdata()
3374 wm8994->retune_mobile_texts[j]) == 0) in wm8994_handle_retune_mobile_pdata()
3378 if (j != wm8994->num_retune_mobile_texts) in wm8994_handle_retune_mobile_pdata()
3382 t = krealloc(wm8994->retune_mobile_texts, in wm8994_handle_retune_mobile_pdata()
3384 (wm8994->num_retune_mobile_texts + 1), in wm8994_handle_retune_mobile_pdata()
3390 t[wm8994->num_retune_mobile_texts] = in wm8994_handle_retune_mobile_pdata()
3394 wm8994->num_retune_mobile_texts++; in wm8994_handle_retune_mobile_pdata()
3395 wm8994->retune_mobile_texts = t; in wm8994_handle_retune_mobile_pdata()
3399 wm8994->num_retune_mobile_texts); in wm8994_handle_retune_mobile_pdata()
3401 wm8994->retune_mobile_enum.items = wm8994->num_retune_mobile_texts; in wm8994_handle_retune_mobile_pdata()
3402 wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts; in wm8994_handle_retune_mobile_pdata()
3404 ret = snd_soc_add_component_controls(wm8994->hubs.component, controls, in wm8994_handle_retune_mobile_pdata()
3407 dev_err(wm8994->hubs.component->dev, in wm8994_handle_retune_mobile_pdata()
3411 static void wm8994_handle_pdata(struct wm8994_priv *wm8994) in wm8994_handle_pdata() argument
3413 struct snd_soc_component *component = wm8994->hubs.component; in wm8994_handle_pdata()
3414 struct wm8994 *control = wm8994->wm8994; in wm8994_handle_pdata()
3436 SOC_ENUM_EXT("AIF1DRC1 Mode", wm8994->drc_enum, in wm8994_handle_pdata()
3438 SOC_ENUM_EXT("AIF1DRC2 Mode", wm8994->drc_enum, in wm8994_handle_pdata()
3440 SOC_ENUM_EXT("AIF2DRC Mode", wm8994->drc_enum, in wm8994_handle_pdata()
3445 wm8994->drc_texts = devm_kcalloc(wm8994->hubs.component->dev, in wm8994_handle_pdata()
3447 if (!wm8994->drc_texts) in wm8994_handle_pdata()
3451 wm8994->drc_texts[i] = pdata->drc_cfgs[i].name; in wm8994_handle_pdata()
3453 wm8994->drc_enum.items = pdata->num_drc_cfgs; in wm8994_handle_pdata()
3454 wm8994->drc_enum.texts = wm8994->drc_texts; in wm8994_handle_pdata()
3456 ret = snd_soc_add_component_controls(wm8994->hubs.component, controls, in wm8994_handle_pdata()
3461 ret = snd_soc_add_component_controls(wm8994->hubs.component, in wm8994_handle_pdata()
3467 dev_err(wm8994->hubs.component->dev, in wm8994_handle_pdata()
3475 wm8994_handle_retune_mobile_pdata(wm8994); in wm8994_handle_pdata()
3477 snd_soc_add_component_controls(wm8994->hubs.component, wm8994_eq_controls, in wm8994_handle_pdata()
3489 * wm8994_mic_detect - Enable microphone detection via the WM8994 IRQ
3491 * @component: WM8994 component
3495 * Enable microphone detection via IRQ on the WM8994. If GPIOs are
3497 * data configuration is needed for WM8994 and processor GPIOs should
3507 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_mic_detect() local
3509 struct wm8994 *control = wm8994->wm8994; in wm8994_mic_detect()
3512 if (control->type != WM8994) { in wm8994_mic_detect()
3513 dev_warn(component->dev, "Not a WM8994\n"); in wm8994_mic_detect()
3521 micdet = &wm8994->micdet[0]; in wm8994_mic_detect()
3528 micdet = &wm8994->micdet[1]; in wm8994_mic_detect()
3551 if (wm8994->micdet[0].jack || wm8994->micdet[1].jack) in wm8994_mic_detect()
3577 struct regmap *regmap = priv->wm8994->regmap; in wm8994_mic_work()
3578 struct device *dev = priv->wm8994->dev; in wm8994_mic_work()
3657 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm1811_micd_stop() local
3659 if (!wm8994->jackdet) in wm1811_micd_stop()
3666 if (wm8994->wm8994->pdata.jd_ext_cap) in wm1811_micd_stop()
3672 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_button_det() local
3694 snd_soc_jack_report(wm8994->micdet[0].jack, report, in wm8958_button_det()
3695 wm8994->btn_mask); in wm8958_button_det()
3700 struct wm8994_priv *wm8994 = container_of(work, in wm8958_open_circuit_work() local
3703 struct device *dev = wm8994->wm8994->dev; in wm8958_open_circuit_work()
3705 mutex_lock(&wm8994->accdet_lock); in wm8958_open_circuit_work()
3707 wm1811_micd_stop(wm8994->hubs.component); in wm8958_open_circuit_work()
3711 wm8994->jack_mic = false; in wm8958_open_circuit_work()
3712 wm8994->mic_detecting = true; in wm8958_open_circuit_work()
3714 wm8958_micd_set_rate(wm8994->hubs.component); in wm8958_open_circuit_work()
3716 snd_soc_jack_report(wm8994->micdet[0].jack, 0, in wm8958_open_circuit_work()
3717 wm8994->btn_mask | in wm8958_open_circuit_work()
3720 mutex_unlock(&wm8994->accdet_lock); in wm8958_open_circuit_work()
3726 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_mic_id() local
3734 &wm8994->open_circuit_work, in wm8958_mic_id()
3745 wm8994->mic_detecting = false; in wm8958_mic_id()
3746 wm8994->jack_mic = true; in wm8958_mic_id()
3750 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADSET, in wm8958_mic_id()
3757 wm8994->mic_detecting = false; in wm8958_mic_id()
3764 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE, in wm8958_mic_id()
3772 struct wm8994_priv *wm8994 = container_of(work, struct wm8994_priv, in wm1811_mic_work() local
3774 struct wm8994 *control = wm8994->wm8994; in wm1811_mic_work()
3775 struct snd_soc_component *component = wm8994->hubs.component; in wm1811_mic_work()
3786 mutex_lock(&wm8994->accdet_lock); in wm1811_mic_work()
3791 if (wm8994->micd_cb) { in wm1811_mic_work()
3792 wm8994->micd_cb(wm8994->micd_cb_data); in wm1811_mic_work()
3798 wm8994->mic_detecting = true; in wm1811_mic_work()
3805 mutex_unlock(&wm8994->accdet_lock); in wm1811_mic_work()
3812 struct wm8994_priv *wm8994 = data; in wm1811_jackdet_irq() local
3813 struct wm8994 *control = wm8994->wm8994; in wm1811_jackdet_irq()
3814 struct snd_soc_component *component = wm8994->hubs.component; in wm1811_jackdet_irq()
3821 cancel_delayed_work_sync(&wm8994->mic_complete_work); in wm1811_jackdet_irq()
3823 mutex_lock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3828 mutex_unlock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3851 &wm8994->mic_work, in wm1811_jackdet_irq()
3856 /* Release wm8994->accdet_lock to avoid deadlock: in wm1811_jackdet_irq()
3857 * cancel_delayed_work_sync() takes wm8994->mic_work internal in wm1811_jackdet_irq()
3858 * lock and wm1811_mic_work takes wm8994->accdet_lock */ in wm1811_jackdet_irq()
3859 mutex_unlock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3860 cancel_delayed_work_sync(&wm8994->mic_work); in wm1811_jackdet_irq()
3861 mutex_lock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3870 wm8994->mic_detecting = false; in wm1811_jackdet_irq()
3871 wm8994->jack_mic = false; in wm1811_jackdet_irq()
3877 mutex_unlock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3884 snd_soc_jack_report(wm8994->micdet[0].jack, in wm1811_jackdet_irq()
3887 snd_soc_jack_report(wm8994->micdet[0].jack, 0, in wm1811_jackdet_irq()
3889 wm8994->btn_mask); in wm1811_jackdet_irq()
3893 snd_soc_jack_report(wm8994->micdet[0].jack, 0, 0); in wm1811_jackdet_irq()
3901 struct wm8994_priv *wm8994 = container_of(work, in wm1811_jackdet_bootstrap() local
3904 wm1811_jackdet_irq(0, wm8994); in wm1811_jackdet_bootstrap()
3932 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_mic_detect() local
3933 struct wm8994 *control = wm8994->wm8994; in wm8958_mic_detect()
3950 wm8994->micdet[0].jack = jack; in wm8958_mic_detect()
3953 wm8994->micd_cb = det_cb; in wm8958_mic_detect()
3954 wm8994->micd_cb_data = det_cb_data; in wm8958_mic_detect()
3956 wm8994->mic_detecting = true; in wm8958_mic_detect()
3957 wm8994->jack_mic = false; in wm8958_mic_detect()
3961 wm8994->mic_id_cb = id_cb; in wm8958_mic_detect()
3962 wm8994->mic_id_cb_data = id_cb_data; in wm8958_mic_detect()
3964 wm8994->mic_id_cb = wm8958_mic_id; in wm8958_mic_detect()
3965 wm8994->mic_id_cb_data = component; in wm8958_mic_detect()
3976 wm8994->btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | in wm8958_mic_detect()
3989 if (wm8994->jackdet) { in wm8958_mic_detect()
4022 struct wm8994_priv *wm8994 = container_of(work, in wm8958_mic_work() local
4025 struct snd_soc_component *component = wm8994->hubs.component; in wm8958_mic_work()
4029 mutex_lock(&wm8994->accdet_lock); in wm8958_mic_work()
4031 wm8994->mic_id_cb(wm8994->mic_id_cb_data, wm8994->mic_status); in wm8958_mic_work()
4033 mutex_unlock(&wm8994->accdet_lock); in wm8958_mic_work()
4040 struct wm8994_priv *wm8994 = data; in wm8958_mic_irq() local
4041 struct snd_soc_component *component = wm8994->hubs.component; in wm8958_mic_irq()
4052 cancel_delayed_work_sync(&wm8994->mic_complete_work); in wm8958_mic_irq()
4053 cancel_delayed_work_sync(&wm8994->open_circuit_work); in wm8958_mic_irq()
4090 if (wm8994->jackdet) { in wm8958_mic_irq()
4100 snd_soc_jack_report(wm8994->micdet[0].jack, 0, in wm8958_mic_irq()
4102 wm8994->btn_mask); in wm8958_mic_irq()
4103 wm8994->mic_detecting = true; in wm8958_mic_irq()
4107 wm8994->mic_status = reg; in wm8958_mic_irq()
4108 id_delay = wm8994->wm8994->pdata.mic_id_delay; in wm8958_mic_irq()
4110 if (wm8994->mic_detecting) in wm8958_mic_irq()
4112 &wm8994->mic_complete_work, in wm8958_mic_irq()
4152 struct wm8994 *control = dev_get_drvdata(component->dev->parent); in wm8994_component_probe()
4153 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_probe() local
4159 wm8994->hubs.component = component; in wm8994_component_probe()
4161 mutex_init(&wm8994->accdet_lock); in wm8994_component_probe()
4162 INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap, in wm8994_component_probe()
4164 INIT_DELAYED_WORK(&wm8994->open_circuit_work, in wm8994_component_probe()
4168 case WM8994: in wm8994_component_probe()
4169 INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work); in wm8994_component_probe()
4172 INIT_DELAYED_WORK(&wm8994->mic_work, wm1811_mic_work); in wm8994_component_probe()
4178 INIT_DELAYED_WORK(&wm8994->mic_complete_work, wm8958_mic_work); in wm8994_component_probe()
4180 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) in wm8994_component_probe()
4181 init_completion(&wm8994->fll_locked[i]); in wm8994_component_probe()
4183 wm8994->micdet_irq = control->pdata.micdet_irq; in wm8994_component_probe()
4185 /* By default use idle_bias_off, will override for WM8994 */ in wm8994_component_probe()
4190 case WM8994: in wm8994_component_probe()
4199 wm8994->hubs.dcs_codes_l = -5; in wm8994_component_probe()
4200 wm8994->hubs.dcs_codes_r = -5; in wm8994_component_probe()
4201 wm8994->hubs.hp_startup_mode = 1; in wm8994_component_probe()
4202 wm8994->hubs.dcs_readback_mode = 1; in wm8994_component_probe()
4203 wm8994->hubs.series_startup = 1; in wm8994_component_probe()
4206 wm8994->hubs.dcs_readback_mode = 2; in wm8994_component_probe()
4209 wm8994->hubs.micd_scthr = true; in wm8994_component_probe()
4213 wm8994->hubs.dcs_readback_mode = 1; in wm8994_component_probe()
4214 wm8994->hubs.hp_startup_mode = 1; in wm8994_component_probe()
4215 wm8994->hubs.micd_scthr = true; in wm8994_component_probe()
4221 wm8994->fll_byp = true; in wm8994_component_probe()
4227 wm8994->hubs.dcs_readback_mode = 2; in wm8994_component_probe()
4228 wm8994->hubs.no_series_update = 1; in wm8994_component_probe()
4229 wm8994->hubs.hp_startup_mode = 1; in wm8994_component_probe()
4230 wm8994->hubs.no_cache_dac_hp_direct = true; in wm8994_component_probe()
4231 wm8994->fll_byp = true; in wm8994_component_probe()
4233 wm8994->hubs.dcs_codes_l = -9; in wm8994_component_probe()
4234 wm8994->hubs.dcs_codes_r = -7; in wm8994_component_probe()
4244 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, in wm8994_component_probe()
4246 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, in wm8994_component_probe()
4248 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, in wm8994_component_probe()
4252 case WM8994: in wm8994_component_probe()
4253 if (wm8994->micdet_irq) in wm8994_component_probe()
4254 ret = request_threaded_irq(wm8994->micdet_irq, NULL, in wm8994_component_probe()
4259 wm8994); in wm8994_component_probe()
4261 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4264 wm8994); in wm8994_component_probe()
4272 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4275 wm8994); in wm8994_component_probe()
4281 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4284 wm8994); in wm8994_component_probe()
4290 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4293 wm8994); in wm8994_component_probe()
4302 if (wm8994->micdet_irq) { in wm8994_component_probe()
4303 ret = request_threaded_irq(wm8994->micdet_irq, NULL, in wm8994_component_probe()
4308 wm8994); in wm8994_component_probe()
4314 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, in wm8994_component_probe()
4316 wm8994); in wm8994_component_probe()
4323 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4326 wm8994); in wm8994_component_probe()
4328 wm8994->jackdet = true; in wm8994_component_probe()
4335 wm8994->fll_locked_irq = true; in wm8994_component_probe()
4336 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { in wm8994_component_probe()
4337 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4340 &wm8994->fll_locked[i]); in wm8994_component_probe()
4342 wm8994->fll_locked_irq = false; in wm8994_component_probe()
4358 wm8994->lrclk_shared[0] = 1; in wm8994_component_probe()
4361 wm8994->lrclk_shared[0] = 0; in wm8994_component_probe()
4370 wm8994->lrclk_shared[1] = 1; in wm8994_component_probe()
4373 wm8994->lrclk_shared[1] = 0; in wm8994_component_probe()
4407 case WM8994: in wm8994_component_probe()
4429 wm8994->hubs.check_class_w_digital = wm8994_check_class_w_digital; in wm8994_component_probe()
4432 wm8994_handle_pdata(wm8994); in wm8994_component_probe()
4441 case WM8994: in wm8994_component_probe()
4501 ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, in wm8994_component_probe()
4503 &wm8994->hubs); in wm8994_component_probe()
4505 wm8994->hubs.dcs_done_irq = true; in wm8994_component_probe()
4509 case WM8994: in wm8994_component_probe()
4551 if (wm8994->jackdet) in wm8994_component_probe()
4552 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994); in wm8994_component_probe()
4553 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994); in wm8994_component_probe()
4554 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994); in wm8994_component_probe()
4555 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994); in wm8994_component_probe()
4556 if (wm8994->micdet_irq) in wm8994_component_probe()
4557 free_irq(wm8994->micdet_irq, wm8994); in wm8994_component_probe()
4558 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) in wm8994_component_probe()
4559 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, in wm8994_component_probe()
4560 &wm8994->fll_locked[i]); in wm8994_component_probe()
4561 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, in wm8994_component_probe()
4562 &wm8994->hubs); in wm8994_component_probe()
4563 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, component); in wm8994_component_probe()
4564 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, component); in wm8994_component_probe()
4565 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, component); in wm8994_component_probe()
4572 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_remove() local
4573 struct wm8994 *control = wm8994->wm8994; in wm8994_component_remove()
4576 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) in wm8994_component_remove()
4577 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, in wm8994_component_remove()
4578 &wm8994->fll_locked[i]); in wm8994_component_remove()
4580 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, in wm8994_component_remove()
4581 &wm8994->hubs); in wm8994_component_remove()
4582 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, component); in wm8994_component_remove()
4583 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, component); in wm8994_component_remove()
4584 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, component); in wm8994_component_remove()
4586 if (wm8994->jackdet) in wm8994_component_remove()
4587 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994); in wm8994_component_remove()
4590 case WM8994: in wm8994_component_remove()
4591 if (wm8994->micdet_irq) in wm8994_component_remove()
4592 free_irq(wm8994->micdet_irq, wm8994); in wm8994_component_remove()
4593 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, in wm8994_component_remove()
4594 wm8994); in wm8994_component_remove()
4595 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, in wm8994_component_remove()
4596 wm8994); in wm8994_component_remove()
4597 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, in wm8994_component_remove()
4598 wm8994); in wm8994_component_remove()
4603 if (wm8994->micdet_irq) in wm8994_component_remove()
4604 free_irq(wm8994->micdet_irq, wm8994); in wm8994_component_remove()
4607 release_firmware(wm8994->mbc); in wm8994_component_remove()
4608 release_firmware(wm8994->mbc_vss); in wm8994_component_remove()
4609 release_firmware(wm8994->enh_eq); in wm8994_component_remove()
4610 kfree(wm8994->retune_mobile_texts); in wm8994_component_remove()
4626 struct wm8994_priv *wm8994; in wm8994_probe() local
4629 wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv), in wm8994_probe()
4631 if (wm8994 == NULL) in wm8994_probe()
4633 platform_set_drvdata(pdev, wm8994); in wm8994_probe()
4635 mutex_init(&wm8994->fw_lock); in wm8994_probe()
4637 wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); in wm8994_probe()
4639 wm8994->mclk[WM8994_MCLK1].id = "MCLK1"; in wm8994_probe()
4640 wm8994->mclk[WM8994_MCLK2].id = "MCLK2"; in wm8994_probe()
4642 ret = devm_clk_bulk_get_optional(pdev->dev.parent, ARRAY_SIZE(wm8994->mclk), in wm8994_probe()
4643 wm8994->mclk); in wm8994_probe()
4668 struct wm8994_priv *wm8994 = dev_get_drvdata(dev); in wm8994_suspend() local
4671 if (wm8994->jackdet && !wm8994->active_refcount) in wm8994_suspend()
4672 regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2, in wm8994_suspend()
4674 wm8994->jackdet_mode); in wm8994_suspend()
4681 struct wm8994_priv *wm8994 = dev_get_drvdata(dev); in wm8994_resume() local
4683 if (wm8994->jackdet && wm8994->jackdet_mode) in wm8994_resume()
4684 regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2, in wm8994_resume()
4698 .name = "wm8994-codec",
4707 MODULE_DESCRIPTION("ASoC WM8994 driver");
4710 MODULE_ALIAS("platform:wm8994-codec");