• Home
  • Raw
  • Download

Lines Matching full:wm8994

2  * wm8994.c  --  WM8994 ALSA SoC Audio driver
34 #include <linux/mfd/wm8994/core.h>
35 #include <linux/mfd/wm8994/registers.h>
36 #include <linux/mfd/wm8994/pdata.h>
37 #include <linux/mfd/wm8994/gpio.h>
39 #include "wm8994.h"
111 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_micd_set_rate() local
112 struct wm8994 *control = wm8994->wm8994; in wm8958_micd_set_rate()
118 idle = !wm8994->jack_mic; in wm8958_micd_set_rate()
122 sysclk = wm8994->aifclk[1]; in wm8958_micd_set_rate()
124 sysclk = wm8994->aifclk[0]; in wm8958_micd_set_rate()
129 } else if (wm8994->jackdet) { in wm8958_micd_set_rate()
162 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in configure_aif_clock() local
172 switch (wm8994->sysclk[aif]) { in configure_aif_clock()
174 rate = wm8994->mclk[0]; in configure_aif_clock()
179 rate = wm8994->mclk[1]; in configure_aif_clock()
184 rate = wm8994->fll[0].out; in configure_aif_clock()
189 rate = wm8994->fll[1].out; in configure_aif_clock()
204 wm8994->aifclk[aif] = rate; in configure_aif_clock()
216 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in configure_clock() local
230 if (wm8994->aifclk[0] == wm8994->aifclk[1]) { in configure_clock()
235 if (wm8994->aifclk[0] < wm8994->aifclk[1]) in configure_clock()
324 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_drc() local
325 struct wm8994 *control = wm8994->wm8994; in wm8994_set_drc()
328 int cfg = wm8994->drc_cfg[drc]; in wm8994_set_drc()
361 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_put_drc_enum() local
362 struct wm8994 *control = wm8994->wm8994; in wm8994_put_drc_enum()
373 wm8994->drc_cfg[drc] = value; in wm8994_put_drc_enum()
384 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_get_drc_enum() local
389 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc]; in wm8994_get_drc_enum()
396 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_retune_mobile() local
397 struct wm8994 *control = wm8994->wm8994; in wm8994_set_retune_mobile()
402 if (!pdata || !wm8994->num_retune_mobile_texts) in wm8994_set_retune_mobile()
419 cfg = wm8994->retune_mobile_cfg[block]; in wm8994_set_retune_mobile()
424 wm8994->retune_mobile_texts[cfg]) == 0 && in wm8994_set_retune_mobile()
426 - wm8994->dac_rates[iface]) < best_val) { in wm8994_set_retune_mobile()
429 - wm8994->dac_rates[iface]); in wm8994_set_retune_mobile()
437 wm8994->dac_rates[iface]); in wm8994_set_retune_mobile()
468 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_put_retune_mobile_enum() local
469 struct wm8994 *control = wm8994->wm8994; in wm8994_put_retune_mobile_enum()
480 wm8994->retune_mobile_cfg[block] = value; in wm8994_put_retune_mobile_enum()
491 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_get_retune_mobile_enum() local
497 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block]; in wm8994_get_retune_mobile_enum()
750 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm1811_jackdet_set_mode() local
752 if (!wm8994->jackdet || !wm8994->micdet[0].jack) in wm1811_jackdet_set_mode()
755 if (wm8994->active_refcount) in wm1811_jackdet_set_mode()
758 if (mode == wm8994->jackdet_mode) in wm1811_jackdet_set_mode()
761 wm8994->jackdet_mode = mode; in wm1811_jackdet_set_mode()
773 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in active_reference() local
775 mutex_lock(&wm8994->accdet_lock); in active_reference()
777 wm8994->active_refcount++; in active_reference()
780 wm8994->active_refcount); in active_reference()
785 mutex_unlock(&wm8994->accdet_lock); in active_reference()
790 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in active_dereference() local
793 mutex_lock(&wm8994->accdet_lock); in active_dereference()
795 wm8994->active_refcount--; in active_dereference()
798 wm8994->active_refcount); in active_dereference()
800 if (wm8994->active_refcount == 0) { in active_dereference()
802 if (wm8994->jack_mic || wm8994->mic_detecting) in active_dereference()
810 mutex_unlock(&wm8994->accdet_lock); in active_dereference()
817 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in clk_sys_event() local
831 if (wm8994->jackdet && !wm8994->clk_has_run) { in clk_sys_event()
833 &wm8994->jackdet_bootstrap, in clk_sys_event()
835 wm8994->clk_has_run = true; in clk_sys_event()
849 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in vmid_reference() local
853 wm8994->vmid_refcount++; in vmid_reference()
856 wm8994->vmid_refcount); in vmid_reference()
858 if (wm8994->vmid_refcount == 1) { in vmid_reference()
865 switch (wm8994->vmid_mode) { in vmid_reference()
928 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in vmid_dereference() local
930 wm8994->vmid_refcount--; in vmid_dereference()
933 wm8994->vmid_refcount); in vmid_dereference()
935 if (wm8994->vmid_refcount == 0) { in vmid_dereference()
936 if (wm8994->hubs.lineout1_se) in vmid_dereference()
943 if (wm8994->hubs.lineout2_se) in vmid_dereference()
1049 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif1clk_ev() local
1050 struct wm8994 *control = wm8994->wm8994; in aif1clk_ev()
1058 case WM8994: in aif1clk_ev()
1069 if (wm8994->channels[0] <= 2) in aif1clk_ev()
1232 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif1clk_late_ev() local
1236 wm8994->aif1clk_enable = 1; in aif1clk_late_ev()
1239 wm8994->aif1clk_disable = 1; in aif1clk_late_ev()
1250 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in aif2clk_late_ev() local
1254 wm8994->aif2clk_enable = 1; in aif2clk_late_ev()
1257 wm8994->aif2clk_disable = 1; in aif2clk_late_ev()
1268 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in late_enable_ev() local
1272 if (wm8994->aif1clk_enable) { in late_enable_ev()
1278 wm8994->aif1clk_enable = 0; in late_enable_ev()
1280 if (wm8994->aif2clk_enable) { in late_enable_ev()
1286 wm8994->aif2clk_enable = 0; in late_enable_ev()
1301 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in late_disable_ev() local
1305 if (wm8994->aif1clk_disable) { in late_disable_ev()
1310 wm8994->aif1clk_disable = 0; in late_disable_ev()
1312 if (wm8994->aif2clk_disable) { in late_disable_ev()
1317 wm8994->aif2clk_disable = 0; in late_disable_ev()
2055 static int wm8994_get_fll_config(struct wm8994 *control, struct fll_div *fll, in wm8994_get_fll_config()
2109 case WM8994: in wm8994_get_fll_config()
2141 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in _wm8994_set_fll() local
2142 struct wm8994 *control = wm8994->wm8994; in _wm8994_set_fll()
2172 src = wm8994->fll[id].src; in _wm8994_set_fll()
2188 if (wm8994->fll[id].src == src && in _wm8994_set_fll()
2189 wm8994->fll[id].in == freq_in && wm8994->fll[id].out == freq_out) in _wm8994_set_fll()
2199 ret = wm8994_get_fll_config(control, &fll, wm8994->fll[id].in, in _wm8994_set_fll()
2200 wm8994->fll[id].out); in _wm8994_set_fll()
2223 if (wm8994->fll_byp && src == WM8994_FLL_SRC_BCLK && in _wm8994_set_fll()
2265 try_wait_for_completion(&wm8994->fll_locked[id]); in _wm8994_set_fll()
2274 case WM8994: in _wm8994_set_fll()
2297 if (wm8994->fll_locked_irq) { in _wm8994_set_fll()
2298 timeout = wait_for_completion_timeout(&wm8994->fll_locked[id], in _wm8994_set_fll()
2309 case WM8994: in _wm8994_set_fll()
2325 wm8994->fll[id].in = freq_in; in _wm8994_set_fll()
2326 wm8994->fll[id].out = freq_out; in _wm8994_set_fll()
2327 wm8994->fll[id].src = src; in _wm8994_set_fll()
2335 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) { in _wm8994_set_fll()
2338 wm8994->aifdiv[0] = snd_soc_component_read32(component, WM8994_AIF1_RATE) in _wm8994_set_fll()
2340 wm8994->aifdiv[1] = snd_soc_component_read32(component, WM8994_AIF2_RATE) in _wm8994_set_fll()
2347 } else if (wm8994->aifdiv[0]) { in _wm8994_set_fll()
2350 wm8994->aifdiv[0]); in _wm8994_set_fll()
2353 wm8994->aifdiv[1]); in _wm8994_set_fll()
2355 wm8994->aifdiv[0] = 0; in _wm8994_set_fll()
2356 wm8994->aifdiv[1] = 0; in _wm8994_set_fll()
2383 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_dai_sysclk() local
2398 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_MCLK1; in wm8994_set_dai_sysclk()
2399 wm8994->mclk[0] = freq; in wm8994_set_dai_sysclk()
2406 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_MCLK2; in wm8994_set_dai_sysclk()
2407 wm8994->mclk[1] = freq; in wm8994_set_dai_sysclk()
2413 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_FLL1; in wm8994_set_dai_sysclk()
2418 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_FLL2; in wm8994_set_dai_sysclk()
2452 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) { in wm8994_set_dai_sysclk()
2455 wm8994->aifdiv[0] = snd_soc_component_read32(component, WM8994_AIF1_RATE) in wm8994_set_dai_sysclk()
2457 wm8994->aifdiv[1] = snd_soc_component_read32(component, WM8994_AIF2_RATE) in wm8994_set_dai_sysclk()
2464 } else if (wm8994->aifdiv[0]) { in wm8994_set_dai_sysclk()
2467 wm8994->aifdiv[0]); in wm8994_set_dai_sysclk()
2470 wm8994->aifdiv[1]); in wm8994_set_dai_sysclk()
2472 wm8994->aifdiv[0] = 0; in wm8994_set_dai_sysclk()
2473 wm8994->aifdiv[1] = 0; in wm8994_set_dai_sysclk()
2482 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_bias_level() local
2483 struct wm8994 *control = wm8994->wm8994; in wm8994_set_bias_level()
2555 wm8994->cur_fw = NULL; in wm8994_set_bias_level()
2564 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_vmid_mode() local
2571 if (wm8994->hubs.lineout1_se) { in wm8994_vmid_mode()
2577 if (wm8994->hubs.lineout2_se) { in wm8994_vmid_mode()
2586 wm8994->vmid_mode = mode; in wm8994_vmid_mode()
2594 if (wm8994->hubs.lineout1_se) { in wm8994_vmid_mode()
2600 if (wm8994->hubs.lineout2_se) { in wm8994_vmid_mode()
2607 wm8994->vmid_mode = mode; in wm8994_vmid_mode()
2623 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_set_dai_fmt() local
2624 struct wm8994 *control = wm8994->wm8994; in wm8994_set_dai_fmt()
2779 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_hw_params() local
2780 struct wm8994 *control = wm8994->wm8994; in wm8994_hw_params()
2803 wm8994->lrclk_shared[0]) { in wm8994_hw_params()
2816 wm8994->lrclk_shared[1]) { in wm8994_hw_params()
2848 wm8994->channels[id] = params_channels(params); in wm8994_hw_params()
2850 wm8994->channels[id] > pdata->max_channels_clocked[id]) { in wm8994_hw_params()
2852 pdata->max_channels_clocked[id], wm8994->channels[id]); in wm8994_hw_params()
2853 wm8994->channels[id] = pdata->max_channels_clocked[id]; in wm8994_hw_params()
2856 switch (wm8994->channels[id]) { in wm8994_hw_params()
2876 dai->id, wm8994->aifclk[id], bclk_rate); in wm8994_hw_params()
2878 if (wm8994->channels[id] == 1 && in wm8994_hw_params()
2882 if (wm8994->aifclk[id] == 0) { in wm8994_hw_params()
2890 - wm8994->aifclk[id]); in wm8994_hw_params()
2893 - wm8994->aifclk[id]); in wm8994_hw_params()
2910 cur_val = (wm8994->aifclk[id] * 10 / bclk_divs[i]) - bclk_rate; in wm8994_hw_params()
2915 bclk_rate = wm8994->aifclk[id] * 10 / bclk_divs[best]; in wm8994_hw_params()
2940 wm8994->dac_rates[0] = params_rate(params); in wm8994_hw_params()
2945 wm8994->dac_rates[1] = params_rate(params); in wm8994_hw_params()
2959 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_aif3_hw_params() local
2960 struct wm8994 *control = wm8994->wm8994; in wm8994_aif3_hw_params()
3095 .name = "wm8994-aif1",
3116 .name = "wm8994-aif2",
3138 .name = "wm8994-aif3",
3163 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_suspend() local
3166 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) { in wm8994_component_suspend()
3167 memcpy(&wm8994->fll_suspend[i], &wm8994->fll[i], in wm8994_component_suspend()
3182 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_resume() local
3185 for (i = 0; i < ARRAY_SIZE(wm8994->fll); i++) { in wm8994_component_resume()
3186 if (!wm8994->fll_suspend[i].out) in wm8994_component_resume()
3190 wm8994->fll_suspend[i].src, in wm8994_component_resume()
3191 wm8994->fll_suspend[i].in, in wm8994_component_resume()
3192 wm8994->fll_suspend[i].out); in wm8994_component_resume()
3205 static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) in wm8994_handle_retune_mobile_pdata() argument
3207 struct snd_soc_component *component = wm8994->hubs.component; in wm8994_handle_retune_mobile_pdata()
3208 struct wm8994 *control = wm8994->wm8994; in wm8994_handle_retune_mobile_pdata()
3212 wm8994->retune_mobile_enum, in wm8994_handle_retune_mobile_pdata()
3216 wm8994->retune_mobile_enum, in wm8994_handle_retune_mobile_pdata()
3220 wm8994->retune_mobile_enum, in wm8994_handle_retune_mobile_pdata()
3231 wm8994->num_retune_mobile_texts = 0; in wm8994_handle_retune_mobile_pdata()
3232 wm8994->retune_mobile_texts = NULL; in wm8994_handle_retune_mobile_pdata()
3234 for (j = 0; j < wm8994->num_retune_mobile_texts; j++) { in wm8994_handle_retune_mobile_pdata()
3236 wm8994->retune_mobile_texts[j]) == 0) in wm8994_handle_retune_mobile_pdata()
3240 if (j != wm8994->num_retune_mobile_texts) in wm8994_handle_retune_mobile_pdata()
3244 t = krealloc(wm8994->retune_mobile_texts, in wm8994_handle_retune_mobile_pdata()
3246 (wm8994->num_retune_mobile_texts + 1), in wm8994_handle_retune_mobile_pdata()
3252 t[wm8994->num_retune_mobile_texts] = in wm8994_handle_retune_mobile_pdata()
3256 wm8994->num_retune_mobile_texts++; in wm8994_handle_retune_mobile_pdata()
3257 wm8994->retune_mobile_texts = t; in wm8994_handle_retune_mobile_pdata()
3261 wm8994->num_retune_mobile_texts); in wm8994_handle_retune_mobile_pdata()
3263 wm8994->retune_mobile_enum.items = wm8994->num_retune_mobile_texts; in wm8994_handle_retune_mobile_pdata()
3264 wm8994->retune_mobile_enum.texts = wm8994->retune_mobile_texts; in wm8994_handle_retune_mobile_pdata()
3266 ret = snd_soc_add_component_controls(wm8994->hubs.component, controls, in wm8994_handle_retune_mobile_pdata()
3269 dev_err(wm8994->hubs.component->dev, in wm8994_handle_retune_mobile_pdata()
3273 static void wm8994_handle_pdata(struct wm8994_priv *wm8994) in wm8994_handle_pdata() argument
3275 struct snd_soc_component *component = wm8994->hubs.component; in wm8994_handle_pdata()
3276 struct wm8994 *control = wm8994->wm8994; in wm8994_handle_pdata()
3298 SOC_ENUM_EXT("AIF1DRC1 Mode", wm8994->drc_enum, in wm8994_handle_pdata()
3300 SOC_ENUM_EXT("AIF1DRC2 Mode", wm8994->drc_enum, in wm8994_handle_pdata()
3302 SOC_ENUM_EXT("AIF2DRC Mode", wm8994->drc_enum, in wm8994_handle_pdata()
3307 wm8994->drc_texts = devm_kcalloc(wm8994->hubs.component->dev, in wm8994_handle_pdata()
3309 if (!wm8994->drc_texts) in wm8994_handle_pdata()
3313 wm8994->drc_texts[i] = pdata->drc_cfgs[i].name; in wm8994_handle_pdata()
3315 wm8994->drc_enum.items = pdata->num_drc_cfgs; in wm8994_handle_pdata()
3316 wm8994->drc_enum.texts = wm8994->drc_texts; in wm8994_handle_pdata()
3318 ret = snd_soc_add_component_controls(wm8994->hubs.component, controls, in wm8994_handle_pdata()
3323 ret = snd_soc_add_component_controls(wm8994->hubs.component, in wm8994_handle_pdata()
3329 dev_err(wm8994->hubs.component->dev, in wm8994_handle_pdata()
3337 wm8994_handle_retune_mobile_pdata(wm8994); in wm8994_handle_pdata()
3339 snd_soc_add_component_controls(wm8994->hubs.component, wm8994_eq_controls, in wm8994_handle_pdata()
3351 * wm8994_mic_detect - Enable microphone detection via the WM8994 IRQ
3353 * @component: WM8994 component
3357 * Enable microphone detection via IRQ on the WM8994. If GPIOs are
3359 * data configuration is needed for WM8994 and processor GPIOs should
3369 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_mic_detect() local
3371 struct wm8994 *control = wm8994->wm8994; in wm8994_mic_detect()
3374 if (control->type != WM8994) { in wm8994_mic_detect()
3375 dev_warn(component->dev, "Not a WM8994\n"); in wm8994_mic_detect()
3383 micdet = &wm8994->micdet[0]; in wm8994_mic_detect()
3390 micdet = &wm8994->micdet[1]; in wm8994_mic_detect()
3413 if (wm8994->micdet[0].jack || wm8994->micdet[1].jack) in wm8994_mic_detect()
3439 struct regmap *regmap = priv->wm8994->regmap; in wm8994_mic_work()
3440 struct device *dev = priv->wm8994->dev; in wm8994_mic_work()
3519 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm1811_micd_stop() local
3521 if (!wm8994->jackdet) in wm1811_micd_stop()
3528 if (wm8994->wm8994->pdata.jd_ext_cap) in wm1811_micd_stop()
3534 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_button_det() local
3556 snd_soc_jack_report(wm8994->micdet[0].jack, report, in wm8958_button_det()
3557 wm8994->btn_mask); in wm8958_button_det()
3562 struct wm8994_priv *wm8994 = container_of(work, in wm8958_open_circuit_work() local
3565 struct device *dev = wm8994->wm8994->dev; in wm8958_open_circuit_work()
3567 mutex_lock(&wm8994->accdet_lock); in wm8958_open_circuit_work()
3569 wm1811_micd_stop(wm8994->hubs.component); in wm8958_open_circuit_work()
3573 wm8994->jack_mic = false; in wm8958_open_circuit_work()
3574 wm8994->mic_detecting = true; in wm8958_open_circuit_work()
3576 wm8958_micd_set_rate(wm8994->hubs.component); in wm8958_open_circuit_work()
3578 snd_soc_jack_report(wm8994->micdet[0].jack, 0, in wm8958_open_circuit_work()
3579 wm8994->btn_mask | in wm8958_open_circuit_work()
3582 mutex_unlock(&wm8994->accdet_lock); in wm8958_open_circuit_work()
3588 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_mic_id() local
3596 &wm8994->open_circuit_work, in wm8958_mic_id()
3607 wm8994->mic_detecting = false; in wm8958_mic_id()
3608 wm8994->jack_mic = true; in wm8958_mic_id()
3612 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADSET, in wm8958_mic_id()
3619 wm8994->mic_detecting = false; in wm8958_mic_id()
3626 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE, in wm8958_mic_id()
3634 struct wm8994_priv *wm8994 = container_of(work, struct wm8994_priv, in wm1811_mic_work() local
3636 struct wm8994 *control = wm8994->wm8994; in wm1811_mic_work()
3637 struct snd_soc_component *component = wm8994->hubs.component; in wm1811_mic_work()
3648 mutex_lock(&wm8994->accdet_lock); in wm1811_mic_work()
3653 if (wm8994->micd_cb) { in wm1811_mic_work()
3654 wm8994->micd_cb(wm8994->micd_cb_data); in wm1811_mic_work()
3660 wm8994->mic_detecting = true; in wm1811_mic_work()
3667 mutex_unlock(&wm8994->accdet_lock); in wm1811_mic_work()
3674 struct wm8994_priv *wm8994 = data; in wm1811_jackdet_irq() local
3675 struct wm8994 *control = wm8994->wm8994; in wm1811_jackdet_irq()
3676 struct snd_soc_component *component = wm8994->hubs.component; in wm1811_jackdet_irq()
3683 cancel_delayed_work_sync(&wm8994->mic_complete_work); in wm1811_jackdet_irq()
3685 mutex_lock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3690 mutex_unlock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3713 &wm8994->mic_work, in wm1811_jackdet_irq()
3718 cancel_delayed_work_sync(&wm8994->mic_work); in wm1811_jackdet_irq()
3727 wm8994->mic_detecting = false; in wm1811_jackdet_irq()
3728 wm8994->jack_mic = false; in wm1811_jackdet_irq()
3734 mutex_unlock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3741 snd_soc_jack_report(wm8994->micdet[0].jack, in wm1811_jackdet_irq()
3744 snd_soc_jack_report(wm8994->micdet[0].jack, 0, in wm1811_jackdet_irq()
3746 wm8994->btn_mask); in wm1811_jackdet_irq()
3750 snd_soc_jack_report(wm8994->micdet[0].jack, 0, 0); in wm1811_jackdet_irq()
3758 struct wm8994_priv *wm8994 = container_of(work, in wm1811_jackdet_bootstrap() local
3761 wm1811_jackdet_irq(0, wm8994); in wm1811_jackdet_bootstrap()
3785 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8958_mic_detect() local
3786 struct wm8994 *control = wm8994->wm8994; in wm8958_mic_detect()
3803 wm8994->micdet[0].jack = jack; in wm8958_mic_detect()
3806 wm8994->micd_cb = det_cb; in wm8958_mic_detect()
3807 wm8994->micd_cb_data = det_cb_data; in wm8958_mic_detect()
3809 wm8994->mic_detecting = true; in wm8958_mic_detect()
3810 wm8994->jack_mic = false; in wm8958_mic_detect()
3814 wm8994->mic_id_cb = id_cb; in wm8958_mic_detect()
3815 wm8994->mic_id_cb_data = id_cb_data; in wm8958_mic_detect()
3817 wm8994->mic_id_cb = wm8958_mic_id; in wm8958_mic_detect()
3818 wm8994->mic_id_cb_data = component; in wm8958_mic_detect()
3829 wm8994->btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | in wm8958_mic_detect()
3842 if (wm8994->jackdet) { in wm8958_mic_detect()
3875 struct wm8994_priv *wm8994 = container_of(work, in wm8958_mic_work() local
3878 struct snd_soc_component *component = wm8994->hubs.component; in wm8958_mic_work()
3882 mutex_lock(&wm8994->accdet_lock); in wm8958_mic_work()
3884 wm8994->mic_id_cb(wm8994->mic_id_cb_data, wm8994->mic_status); in wm8958_mic_work()
3886 mutex_unlock(&wm8994->accdet_lock); in wm8958_mic_work()
3893 struct wm8994_priv *wm8994 = data; in wm8958_mic_irq() local
3894 struct snd_soc_component *component = wm8994->hubs.component; in wm8958_mic_irq()
3905 cancel_delayed_work_sync(&wm8994->mic_complete_work); in wm8958_mic_irq()
3906 cancel_delayed_work_sync(&wm8994->open_circuit_work); in wm8958_mic_irq()
3943 if (wm8994->jackdet) { in wm8958_mic_irq()
3953 snd_soc_jack_report(wm8994->micdet[0].jack, 0, in wm8958_mic_irq()
3955 wm8994->btn_mask); in wm8958_mic_irq()
3956 wm8994->mic_detecting = true; in wm8958_mic_irq()
3960 wm8994->mic_status = reg; in wm8958_mic_irq()
3961 id_delay = wm8994->wm8994->pdata.mic_id_delay; in wm8958_mic_irq()
3963 if (wm8994->mic_detecting) in wm8958_mic_irq()
3965 &wm8994->mic_complete_work, in wm8958_mic_irq()
4005 struct wm8994 *control = dev_get_drvdata(component->dev->parent); in wm8994_component_probe()
4006 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_probe() local
4012 wm8994->hubs.component = component; in wm8994_component_probe()
4014 mutex_init(&wm8994->accdet_lock); in wm8994_component_probe()
4015 INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap, in wm8994_component_probe()
4017 INIT_DELAYED_WORK(&wm8994->open_circuit_work, in wm8994_component_probe()
4021 case WM8994: in wm8994_component_probe()
4022 INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work); in wm8994_component_probe()
4025 INIT_DELAYED_WORK(&wm8994->mic_work, wm1811_mic_work); in wm8994_component_probe()
4031 INIT_DELAYED_WORK(&wm8994->mic_complete_work, wm8958_mic_work); in wm8994_component_probe()
4033 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) in wm8994_component_probe()
4034 init_completion(&wm8994->fll_locked[i]); in wm8994_component_probe()
4036 wm8994->micdet_irq = control->pdata.micdet_irq; in wm8994_component_probe()
4038 /* By default use idle_bias_off, will override for WM8994 */ in wm8994_component_probe()
4043 case WM8994: in wm8994_component_probe()
4052 wm8994->hubs.dcs_codes_l = -5; in wm8994_component_probe()
4053 wm8994->hubs.dcs_codes_r = -5; in wm8994_component_probe()
4054 wm8994->hubs.hp_startup_mode = 1; in wm8994_component_probe()
4055 wm8994->hubs.dcs_readback_mode = 1; in wm8994_component_probe()
4056 wm8994->hubs.series_startup = 1; in wm8994_component_probe()
4059 wm8994->hubs.dcs_readback_mode = 2; in wm8994_component_probe()
4062 wm8994->hubs.micd_scthr = true; in wm8994_component_probe()
4066 wm8994->hubs.dcs_readback_mode = 1; in wm8994_component_probe()
4067 wm8994->hubs.hp_startup_mode = 1; in wm8994_component_probe()
4068 wm8994->hubs.micd_scthr = true; in wm8994_component_probe()
4074 wm8994->fll_byp = true; in wm8994_component_probe()
4080 wm8994->hubs.dcs_readback_mode = 2; in wm8994_component_probe()
4081 wm8994->hubs.no_series_update = 1; in wm8994_component_probe()
4082 wm8994->hubs.hp_startup_mode = 1; in wm8994_component_probe()
4083 wm8994->hubs.no_cache_dac_hp_direct = true; in wm8994_component_probe()
4084 wm8994->fll_byp = true; in wm8994_component_probe()
4086 wm8994->hubs.dcs_codes_l = -9; in wm8994_component_probe()
4087 wm8994->hubs.dcs_codes_r = -7; in wm8994_component_probe()
4097 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, in wm8994_component_probe()
4099 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, in wm8994_component_probe()
4101 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, in wm8994_component_probe()
4105 case WM8994: in wm8994_component_probe()
4106 if (wm8994->micdet_irq) in wm8994_component_probe()
4107 ret = request_threaded_irq(wm8994->micdet_irq, NULL, in wm8994_component_probe()
4112 wm8994); in wm8994_component_probe()
4114 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4117 wm8994); in wm8994_component_probe()
4125 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4128 wm8994); in wm8994_component_probe()
4134 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4137 wm8994); in wm8994_component_probe()
4143 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4146 wm8994); in wm8994_component_probe()
4155 if (wm8994->micdet_irq) { in wm8994_component_probe()
4156 ret = request_threaded_irq(wm8994->micdet_irq, NULL, in wm8994_component_probe()
4161 wm8994); in wm8994_component_probe()
4167 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, in wm8994_component_probe()
4169 wm8994); in wm8994_component_probe()
4176 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4179 wm8994); in wm8994_component_probe()
4181 wm8994->jackdet = true; in wm8994_component_probe()
4188 wm8994->fll_locked_irq = true; in wm8994_component_probe()
4189 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { in wm8994_component_probe()
4190 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4193 &wm8994->fll_locked[i]); in wm8994_component_probe()
4195 wm8994->fll_locked_irq = false; in wm8994_component_probe()
4211 wm8994->lrclk_shared[0] = 1; in wm8994_component_probe()
4214 wm8994->lrclk_shared[0] = 0; in wm8994_component_probe()
4223 wm8994->lrclk_shared[1] = 1; in wm8994_component_probe()
4226 wm8994->lrclk_shared[1] = 0; in wm8994_component_probe()
4252 case WM8994: in wm8994_component_probe()
4274 wm8994->hubs.check_class_w_digital = wm8994_check_class_w_digital; in wm8994_component_probe()
4277 wm8994_handle_pdata(wm8994); in wm8994_component_probe()
4286 case WM8994: in wm8994_component_probe()
4346 ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, in wm8994_component_probe()
4348 &wm8994->hubs); in wm8994_component_probe()
4350 wm8994->hubs.dcs_done_irq = true; in wm8994_component_probe()
4354 case WM8994: in wm8994_component_probe()
4396 if (wm8994->jackdet) in wm8994_component_probe()
4397 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994); in wm8994_component_probe()
4398 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994); in wm8994_component_probe()
4399 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994); in wm8994_component_probe()
4400 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994); in wm8994_component_probe()
4401 if (wm8994->micdet_irq) in wm8994_component_probe()
4402 free_irq(wm8994->micdet_irq, wm8994); in wm8994_component_probe()
4403 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) in wm8994_component_probe()
4404 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, in wm8994_component_probe()
4405 &wm8994->fll_locked[i]); in wm8994_component_probe()
4406 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, in wm8994_component_probe()
4407 &wm8994->hubs); in wm8994_component_probe()
4408 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, component); in wm8994_component_probe()
4409 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, component); in wm8994_component_probe()
4410 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, component); in wm8994_component_probe()
4417 struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component); in wm8994_component_remove() local
4418 struct wm8994 *control = wm8994->wm8994; in wm8994_component_remove()
4421 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) in wm8994_component_remove()
4422 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i, in wm8994_component_remove()
4423 &wm8994->fll_locked[i]); in wm8994_component_remove()
4425 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE, in wm8994_component_remove()
4426 &wm8994->hubs); in wm8994_component_remove()
4427 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, component); in wm8994_component_remove()
4428 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, component); in wm8994_component_remove()
4429 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, component); in wm8994_component_remove()
4431 if (wm8994->jackdet) in wm8994_component_remove()
4432 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994); in wm8994_component_remove()
4435 case WM8994: in wm8994_component_remove()
4436 if (wm8994->micdet_irq) in wm8994_component_remove()
4437 free_irq(wm8994->micdet_irq, wm8994); in wm8994_component_remove()
4438 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, in wm8994_component_remove()
4439 wm8994); in wm8994_component_remove()
4440 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, in wm8994_component_remove()
4441 wm8994); in wm8994_component_remove()
4442 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, in wm8994_component_remove()
4443 wm8994); in wm8994_component_remove()
4448 if (wm8994->micdet_irq) in wm8994_component_remove()
4449 free_irq(wm8994->micdet_irq, wm8994); in wm8994_component_remove()
4452 release_firmware(wm8994->mbc); in wm8994_component_remove()
4453 release_firmware(wm8994->mbc_vss); in wm8994_component_remove()
4454 release_firmware(wm8994->enh_eq); in wm8994_component_remove()
4455 kfree(wm8994->retune_mobile_texts); in wm8994_component_remove()
4472 struct wm8994_priv *wm8994; in wm8994_probe() local
4474 wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv), in wm8994_probe()
4476 if (wm8994 == NULL) in wm8994_probe()
4478 platform_set_drvdata(pdev, wm8994); in wm8994_probe()
4480 mutex_init(&wm8994->fw_lock); in wm8994_probe()
4482 wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); in wm8994_probe()
4501 struct wm8994_priv *wm8994 = dev_get_drvdata(dev); in wm8994_suspend() local
4504 if (wm8994->jackdet && !wm8994->active_refcount) in wm8994_suspend()
4505 regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2, in wm8994_suspend()
4507 wm8994->jackdet_mode); in wm8994_suspend()
4514 struct wm8994_priv *wm8994 = dev_get_drvdata(dev); in wm8994_resume() local
4516 if (wm8994->jackdet && wm8994->jackdet_mode) in wm8994_resume()
4517 regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2, in wm8994_resume()
4531 .name = "wm8994-codec",
4540 MODULE_DESCRIPTION("ASoC WM8994 driver");
4543 MODULE_ALIAS("platform:wm8994-codec");