Lines Matching +full:micd +full:- +full:force +full:- +full:micbias
2 * wm8994.c -- WM8994 ALSA SoC Audio driver
4 * Copyright 2009-12 Wolfson Microelectronics plc
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()
126 if (control->pdata.micd_rates) { in wm8958_micd_set_rate()
127 rates = control->pdata.micd_rates; in wm8958_micd_set_rate()
128 num_rates = control->pdata.num_micd_rates; in wm8958_micd_set_rate()
129 } else if (wm8994->jackdet) { in wm8958_micd_set_rate()
141 if (abs(rates[i].sysclk - sysclk) < in wm8958_micd_set_rate()
142 abs(rates[best].sysclk - sysclk)) in wm8958_micd_set_rate()
151 dev_dbg(component->dev, "MICD rate %d,%d for %dHz %s\n", in wm8958_micd_set_rate()
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()
193 return -EINVAL; in configure_aif_clock()
200 dev_dbg(component->dev, "Dividing AIF%d clock to %dHz\n", in configure_aif_clock()
204 wm8994->aifclk[aif] = rate; in configure_aif_clock()
230 if (wm8994->aifclk[0] == wm8994->aifclk[1]) { in configure_clock()
235 if (wm8994->aifclk[0] < wm8994->aifclk[1]) in configure_clock()
253 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_clk_sys()
263 return strcmp(source->name, clk) == 0; in check_clk_sys()
287 static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
288 static const DECLARE_TLV_DB_SCALE(st_tlv, -3600, 300, 0);
289 static const DECLARE_TLV_DB_SCALE(wm8994_3d_tlv, -1600, 183, 0);
290 static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
291 static const DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
302 (struct soc_mixer_control *)kcontrol->private_value; in wm8994_put_drc_sw()
307 if (mc->shift == WM8994_AIF1DAC1_DRC_ENA_SHIFT) in wm8994_put_drc_sw()
313 ret = snd_soc_component_read32(component, mc->reg); in wm8994_put_drc_sw()
317 return -EINVAL; in wm8994_put_drc_sw()
325 struct wm8994 *control = wm8994->wm8994; in wm8994_set_drc()
326 struct wm8994_pdata *pdata = &control->pdata; in wm8994_set_drc()
328 int cfg = wm8994->drc_cfg[drc]; in wm8994_set_drc()
338 pdata->drc_cfgs[cfg].regs[i]); in wm8994_set_drc()
354 return -EINVAL; in wm8994_get_drc()
362 struct wm8994 *control = wm8994->wm8994; in wm8994_put_drc_enum()
363 struct wm8994_pdata *pdata = &control->pdata; in wm8994_put_drc_enum()
364 int drc = wm8994_get_drc(kcontrol->id.name); in wm8994_put_drc_enum()
365 int value = ucontrol->value.enumerated.item[0]; in wm8994_put_drc_enum()
370 if (value >= pdata->num_drc_cfgs) in wm8994_put_drc_enum()
371 return -EINVAL; in wm8994_put_drc_enum()
373 wm8994->drc_cfg[drc] = value; in wm8994_put_drc_enum()
385 int drc = wm8994_get_drc(kcontrol->id.name); in wm8994_get_drc_enum()
389 ucontrol->value.enumerated.item[0] = wm8994->drc_cfg[drc]; in wm8994_get_drc_enum()
397 struct wm8994 *control = wm8994->wm8994; in wm8994_set_retune_mobile()
398 struct wm8994_pdata *pdata = &control->pdata; 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()
422 for (i = 0; i < pdata->num_retune_mobile_cfgs; i++) { in wm8994_set_retune_mobile()
423 if (strcmp(pdata->retune_mobile_cfgs[i].name, in wm8994_set_retune_mobile()
424 wm8994->retune_mobile_texts[cfg]) == 0 && in wm8994_set_retune_mobile()
425 abs(pdata->retune_mobile_cfgs[i].rate in wm8994_set_retune_mobile()
426 - wm8994->dac_rates[iface]) < best_val) { in wm8994_set_retune_mobile()
428 best_val = abs(pdata->retune_mobile_cfgs[i].rate in wm8994_set_retune_mobile()
429 - wm8994->dac_rates[iface]); in wm8994_set_retune_mobile()
433 dev_dbg(component->dev, "ReTune Mobile %d %s/%dHz for %dHz sample rate\n", in wm8994_set_retune_mobile()
435 pdata->retune_mobile_cfgs[best].name, in wm8994_set_retune_mobile()
436 pdata->retune_mobile_cfgs[best].rate, in wm8994_set_retune_mobile()
437 wm8994->dac_rates[iface]); in wm8994_set_retune_mobile()
447 pdata->retune_mobile_cfgs[best].regs[i]); in wm8994_set_retune_mobile()
461 return -EINVAL; in wm8994_get_retune_mobile_block()
469 struct wm8994 *control = wm8994->wm8994; in wm8994_put_retune_mobile_enum()
470 struct wm8994_pdata *pdata = &control->pdata; in wm8994_put_retune_mobile_enum()
471 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); in wm8994_put_retune_mobile_enum()
472 int value = ucontrol->value.enumerated.item[0]; in wm8994_put_retune_mobile_enum()
477 if (value >= pdata->num_retune_mobile_cfgs) in wm8994_put_retune_mobile_enum()
478 return -EINVAL; in wm8994_put_retune_mobile_enum()
480 wm8994->retune_mobile_cfg[block] = value; in wm8994_put_retune_mobile_enum()
492 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); in wm8994_get_retune_mobile_enum()
497 ucontrol->value.enumerated.item[0] = wm8994->retune_mobile_cfg[block]; in wm8994_get_retune_mobile_enum()
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()
775 mutex_lock(&wm8994->accdet_lock); in active_reference()
777 wm8994->active_refcount++; in active_reference()
779 dev_dbg(component->dev, "Active refcount incremented, now %d\n", in active_reference()
780 wm8994->active_refcount); in active_reference()
785 mutex_unlock(&wm8994->accdet_lock); in active_reference()
793 mutex_lock(&wm8994->accdet_lock); in active_dereference()
795 wm8994->active_refcount--; in active_dereference()
797 dev_dbg(component->dev, "Active refcount decremented, now %d\n", 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()
816 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in clk_sys_event()
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()
851 pm_runtime_get_sync(component->dev); in vmid_reference()
853 wm8994->vmid_refcount++; in vmid_reference()
855 dev_dbg(component->dev, "Referencing VMID, refcount is now %d\n", 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()
930 wm8994->vmid_refcount--; in vmid_dereference()
932 dev_dbg(component->dev, "Dereferencing VMID, refcount is now %d\n", 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()
986 pm_runtime_put(component->dev); in vmid_dereference()
992 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in vmid_event()
1016 dev_vdbg(component->dev, "Class W source AIF2DAC\n"); in wm8994_check_class_w_digital()
1020 dev_vdbg(component->dev, "Class W source AIF1DAC2\n"); in wm8994_check_class_w_digital()
1024 dev_vdbg(component->dev, "Class W source AIF1DAC1\n"); in wm8994_check_class_w_digital()
1028 dev_vdbg(component->dev, "DAC mixer setting: %x\n", reg); in wm8994_check_class_w_digital()
1034 dev_vdbg(component->dev, "Left and right DAC mixers different\n"); in wm8994_check_class_w_digital()
1048 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif1clk_ev()
1050 struct wm8994 *control = wm8994->wm8994; in aif1clk_ev()
1057 switch (control->type) { in aif1clk_ev()
1069 if (wm8994->channels[0] <= 2) in aif1clk_ev()
1146 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif2clk_ev()
1231 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif1clk_late_ev()
1236 wm8994->aif1clk_enable = 1; in aif1clk_late_ev()
1239 wm8994->aif1clk_disable = 1; in aif1clk_late_ev()
1249 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif2clk_late_ev()
1254 wm8994->aif2clk_enable = 1; in aif2clk_late_ev()
1257 wm8994->aif2clk_disable = 1; in aif2clk_late_ev()
1267 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in late_enable_ev()
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()
1300 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in late_disable_ev()
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()
1342 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in dac_ev()
1343 unsigned int mask = 1 << w->shift; in dac_ev()
1383 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in post_ev()
1384 dev_dbg(component->dev, "SRC status: %x\n", in post_ev()
1678 SND_SOC_DAPM_SUPPLY_S("MICBIAS Supply", 1, SND_SOC_NOPM, 0, 0, micbias_ev,
2012 { "MICBIAS1", NULL, "MICBIAS Supply" },
2014 { "MICBIAS2", NULL, "MICBIAS Supply" },
2064 fll->clk_ref_div = 0; in wm8994_get_fll_config()
2066 fll->clk_ref_div++; in wm8994_get_fll_config()
2069 if (fll->clk_ref_div > 3) in wm8994_get_fll_config()
2070 return -EINVAL; in wm8994_get_fll_config()
2072 pr_debug("CLK_REF_DIV=%d, Fref=%dHz\n", fll->clk_ref_div, freq_in); in wm8994_get_fll_config()
2075 fll->outdiv = 3; in wm8994_get_fll_config()
2076 while (freq_out * (fll->outdiv + 1) < 90000000) { in wm8994_get_fll_config()
2077 fll->outdiv++; in wm8994_get_fll_config()
2078 if (fll->outdiv > 63) in wm8994_get_fll_config()
2079 return -EINVAL; in wm8994_get_fll_config()
2081 freq_out *= fll->outdiv + 1; in wm8994_get_fll_config()
2082 pr_debug("OUTDIV=%d, Fvco=%dHz\n", fll->outdiv, freq_out); in wm8994_get_fll_config()
2085 fll->fll_fratio = 0; in wm8994_get_fll_config()
2087 fll->fll_fratio = 1; in wm8994_get_fll_config()
2090 fll->fll_fratio = 2; in wm8994_get_fll_config()
2093 fll->fll_fratio = 3; in wm8994_get_fll_config()
2096 fll->fll_fratio = 4; in wm8994_get_fll_config()
2099 pr_debug("FLL_FRATIO=%d, Fref=%dHz\n", fll->fll_fratio, freq_in); in wm8994_get_fll_config()
2104 fll->n = Ndiv; in wm8994_get_fll_config()
2108 switch (control->type) { in wm8994_get_fll_config()
2110 /* Calculate fractional part - scale up so we can round. */ in wm8994_get_fll_config()
2121 fll->k = K / 10; in wm8994_get_fll_config()
2122 fll->lambda = 0; in wm8994_get_fll_config()
2124 pr_debug("N=%x K=%x\n", fll->n, fll->k); in wm8994_get_fll_config()
2130 fll->k = (freq_out - (freq_in * fll->n)) / gcd_fll; in wm8994_get_fll_config()
2131 fll->lambda = freq_in / gcd_fll; in wm8994_get_fll_config()
2142 struct wm8994 *control = wm8994->wm8994; in _wm8994_set_fll()
2161 return -EINVAL; in _wm8994_set_fll()
2171 return -EINVAL; in _wm8994_set_fll()
2172 src = wm8994->fll[id].src; in _wm8994_set_fll()
2184 return -EINVAL; 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()
2192 /* If we're stopping the FLL redo the old config - no 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()
2214 dev_err(component->dev, "FLL%d is currently providing SYSCLK\n", in _wm8994_set_fll()
2216 return -EBUSY; in _wm8994_set_fll()
2223 if (wm8994->fll_byp && src == WM8994_FLL_SRC_BCLK && in _wm8994_set_fll()
2225 dev_dbg(component->dev, "Bypassing FLL%d\n", id + 1); in _wm8994_set_fll()
2262 (src - 1)); in _wm8994_set_fll()
2265 try_wait_for_completion(&wm8994->fll_locked[id]); in _wm8994_set_fll()
2273 switch (control->type) { in _wm8994_set_fll()
2278 if (control->revision < 1) 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()
2301 dev_warn(component->dev, in _wm8994_set_fll()
2308 switch (control->type) { in _wm8994_set_fll()
2313 if (control->revision < 1) 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()
2336 dev_dbg(component->dev, "Configuring AIFs for 128fs\n"); 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()
2376 return _wm8994_set_fll(dai->component, id, src, freq_in, freq_out); in wm8994_set_fll()
2382 struct snd_soc_component *component = dai->component; in wm8994_set_dai_sysclk()
2386 switch (dai->id) { in wm8994_set_dai_sysclk()
2393 return -EINVAL; in wm8994_set_dai_sysclk()
2398 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_MCLK1; in wm8994_set_dai_sysclk()
2399 wm8994->mclk[0] = freq; in wm8994_set_dai_sysclk()
2400 dev_dbg(dai->dev, "AIF%d using MCLK1 at %uHz\n", in wm8994_set_dai_sysclk()
2401 dai->id, 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()
2408 dev_dbg(dai->dev, "AIF%d using MCLK2 at %uHz\n", in wm8994_set_dai_sysclk()
2409 dai->id, freq); in wm8994_set_dai_sysclk()
2413 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_FLL1; in wm8994_set_dai_sysclk()
2414 dev_dbg(dai->dev, "AIF%d using FLL1\n", dai->id); in wm8994_set_dai_sysclk()
2418 wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_FLL2; in wm8994_set_dai_sysclk()
2419 dev_dbg(dai->dev, "AIF%d using FLL2\n", dai->id); in wm8994_set_dai_sysclk()
2423 /* Special case - a division (times 10) is given and in wm8994_set_dai_sysclk()
2431 return -EINVAL; in wm8994_set_dai_sysclk()
2443 return -EINVAL; in wm8994_set_dai_sysclk()
2452 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) { in wm8994_set_dai_sysclk()
2453 dev_dbg(component->dev, "Configuring AIFs for 128fs\n"); 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()
2483 struct wm8994 *control = wm8994->wm8994; in wm8994_set_bias_level()
2492 /* MICBIAS into regulating mode */ in wm8994_set_bias_level()
2493 switch (control->type) { in wm8994_set_bias_level()
2511 switch (control->type) { in wm8994_set_bias_level()
2513 if (control->revision == 0) { in wm8994_set_bias_level()
2537 /* MICBIAS into bypass mode on newer devices */ in wm8994_set_bias_level()
2538 switch (control->type) { in wm8994_set_bias_level()
2555 wm8994->cur_fw = NULL; in wm8994_set_bias_level()
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()
2614 return -EINVAL; in wm8994_vmid_mode()
2622 struct snd_soc_component *component = dai->component; in wm8994_set_dai_fmt()
2624 struct wm8994 *control = wm8994->wm8994; in wm8994_set_dai_fmt()
2633 switch (dai->id) { in wm8994_set_dai_fmt()
2647 return -EINVAL; in wm8994_set_dai_fmt()
2657 return -EINVAL; in wm8994_set_dai_fmt()
2677 return -EINVAL; in wm8994_set_dai_fmt()
2691 return -EINVAL; in wm8994_set_dai_fmt()
2713 return -EINVAL; in wm8994_set_dai_fmt()
2717 return -EINVAL; in wm8994_set_dai_fmt()
2722 switch (control->type) { in wm8994_set_dai_fmt()
2725 if (dai->id == 2) in wm8994_set_dai_fmt()
2778 struct snd_soc_component *component = dai->component; in wm8994_hw_params()
2780 struct wm8994 *control = wm8994->wm8994; in wm8994_hw_params()
2781 struct wm8994_pdata *pdata = &control->pdata; in wm8994_hw_params()
2792 int id = dai->id - 1; in wm8994_hw_params()
2796 switch (dai->id) { in wm8994_hw_params()
2802 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || in wm8994_hw_params()
2803 wm8994->lrclk_shared[0]) { in wm8994_hw_params()
2807 dev_dbg(component->dev, "AIF1 using split LRCLK\n"); in wm8994_hw_params()
2815 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK || in wm8994_hw_params()
2816 wm8994->lrclk_shared[1]) { in wm8994_hw_params()
2820 dev_dbg(component->dev, "AIF2 using split LRCLK\n"); in wm8994_hw_params()
2824 return -EINVAL; in wm8994_hw_params()
2845 return -EINVAL; in wm8994_hw_params()
2848 wm8994->channels[id] = params_channels(params); in wm8994_hw_params()
2849 if (pdata->max_channels_clocked[id] && in wm8994_hw_params()
2850 wm8994->channels[id] > pdata->max_channels_clocked[id]) { in wm8994_hw_params()
2851 dev_dbg(dai->dev, "Constraining channels to %d from %d\n", 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()
2871 return -EINVAL; in wm8994_hw_params()
2874 dev_dbg(dai->dev, "Sample rate is %dHz\n", srs[i].rate); in wm8994_hw_params()
2875 dev_dbg(dai->dev, "AIF%dCLK is %dHz, target BCLK %dHz\n", 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()
2883 dev_err(dai->dev, "AIF%dCLK not configured\n", dai->id); in wm8994_hw_params()
2884 return -EINVAL; in wm8994_hw_params()
2890 - wm8994->aifclk[id]); in wm8994_hw_params()
2893 - wm8994->aifclk[id]); in wm8994_hw_params()
2899 dev_dbg(dai->dev, "Selected AIF%dCLK/fs = %d\n", in wm8994_hw_params()
2900 dai->id, fs_ratios[best]); 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()
2916 dev_dbg(dai->dev, "Using BCLK_DIV %d for actual BCLK %dHz\n", in wm8994_hw_params()
2922 dev_err(dai->dev, "Unable to generate LRCLK from %dHz BCLK\n", in wm8994_hw_params()
2924 return -EINVAL; in wm8994_hw_params()
2926 dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", in wm8994_hw_params()
2937 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in wm8994_hw_params()
2938 switch (dai->id) { 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()
2958 struct snd_soc_component *component = dai->component; in wm8994_aif3_hw_params()
2960 struct wm8994 *control = wm8994->wm8994; in wm8994_aif3_hw_params()
2964 switch (dai->id) { in wm8994_aif3_hw_params()
2966 switch (control->type) { in wm8994_aif3_hw_params()
2992 return -EINVAL; in wm8994_aif3_hw_params()
3000 struct snd_soc_component *component = codec_dai->component; in wm8994_aif_mute()
3004 switch (codec_dai->id) { in wm8994_aif_mute()
3012 return -EINVAL; in wm8994_aif_mute()
3027 struct snd_soc_component *component = codec_dai->component; in wm8994_set_tristate()
3030 switch (codec_dai->id) { in wm8994_set_tristate()
3040 return -EINVAL; in wm8994_set_tristate()
3053 struct snd_soc_component *component = dai->component; in wm8994_aif2_probe()
3095 .name = "wm8994-aif1",
3116 .name = "wm8994-aif2",
3138 .name = "wm8994-aif3",
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()
3171 dev_warn(component->dev, "Failed to stop FLL%d: %d\n", in wm8994_component_suspend()
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()
3194 dev_warn(component->dev, "Failed to restore FLL%d: %d\n", in wm8994_component_resume()
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()
3209 struct wm8994_pdata *pdata = &control->pdata; 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()
3233 for (i = 0; i < pdata->num_retune_mobile_cfgs; i++) { in wm8994_handle_retune_mobile_pdata()
3234 for (j = 0; j < wm8994->num_retune_mobile_texts; j++) { in wm8994_handle_retune_mobile_pdata()
3235 if (strcmp(pdata->retune_mobile_cfgs[i].name, 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()
3253 pdata->retune_mobile_cfgs[i].name; 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()
3260 dev_dbg(component->dev, "Allocated %d unique ReTune Mobile names\n", 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()
3275 struct snd_soc_component *component = wm8994->hubs.component; in wm8994_handle_pdata()
3276 struct wm8994 *control = wm8994->wm8994; in wm8994_handle_pdata()
3277 struct wm8994_pdata *pdata = &control->pdata; in wm8994_handle_pdata()
3283 wm_hubs_handle_analogue_pdata(component, pdata->lineout1_diff, in wm8994_handle_pdata()
3284 pdata->lineout2_diff, in wm8994_handle_pdata()
3285 pdata->lineout1fb, in wm8994_handle_pdata()
3286 pdata->lineout2fb, in wm8994_handle_pdata()
3287 pdata->jd_scthr, in wm8994_handle_pdata()
3288 pdata->jd_thr, in wm8994_handle_pdata()
3289 pdata->micb1_delay, in wm8994_handle_pdata()
3290 pdata->micb2_delay, in wm8994_handle_pdata()
3291 pdata->micbias1_lvl, in wm8994_handle_pdata()
3292 pdata->micbias2_lvl); in wm8994_handle_pdata()
3294 dev_dbg(component->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); in wm8994_handle_pdata()
3296 if (pdata->num_drc_cfgs) { 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()
3308 pdata->num_drc_cfgs, sizeof(char *), GFP_KERNEL); in wm8994_handle_pdata()
3309 if (!wm8994->drc_texts) in wm8994_handle_pdata()
3312 for (i = 0; i < pdata->num_drc_cfgs; i++) 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()
3333 dev_dbg(component->dev, "%d ReTune Mobile configurations\n", in wm8994_handle_pdata()
3334 pdata->num_retune_mobile_cfgs); in wm8994_handle_pdata()
3336 if (pdata->num_retune_mobile_cfgs) in wm8994_handle_pdata()
3339 snd_soc_add_component_controls(wm8994->hubs.component, wm8994_eq_controls, in wm8994_handle_pdata()
3342 for (i = 0; i < ARRAY_SIZE(pdata->micbias); i++) { in wm8994_handle_pdata()
3343 if (pdata->micbias[i]) { in wm8994_handle_pdata()
3345 pdata->micbias[i] & 0xffff); in wm8994_handle_pdata()
3351 * wm8994_mic_detect - Enable microphone detection via the WM8994 IRQ
3355 * @micbias: microphone bias to detect on
3366 int micbias) in wm8994_mic_detect() argument
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()
3376 return -EINVAL; in wm8994_mic_detect()
3379 pm_runtime_get_sync(component->dev); in wm8994_mic_detect()
3381 switch (micbias) { in wm8994_mic_detect()
3383 micdet = &wm8994->micdet[0]; in wm8994_mic_detect()
3390 micdet = &wm8994->micdet[1]; in wm8994_mic_detect()
3397 dev_warn(component->dev, "Invalid MICBIAS %d\n", micbias); in wm8994_mic_detect()
3398 return -EINVAL; in wm8994_mic_detect()
3402 dev_warn(component->dev, "Failed to configure MICBIAS%d: %d\n", in wm8994_mic_detect()
3403 micbias, ret); in wm8994_mic_detect()
3405 dev_dbg(component->dev, "Configuring microphone detection on %d %p\n", in wm8994_mic_detect()
3406 micbias, jack); in wm8994_mic_detect()
3409 micdet->jack = jack; in wm8994_mic_detect()
3410 micdet->detecting = true; in wm8994_mic_detect()
3413 if (wm8994->micdet[0].jack || wm8994->micdet[1].jack) in wm8994_mic_detect()
3428 pm_runtime_put(component->dev); 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()
3459 if (priv->micdet[0].detecting) in wm8994_mic_work()
3463 if (priv->micdet[0].detecting) in wm8994_mic_work()
3469 priv->micdet[0].detecting = false; in wm8994_mic_work()
3471 priv->micdet[0].detecting = true; in wm8994_mic_work()
3473 snd_soc_jack_report(priv->micdet[0].jack, report, in wm8994_mic_work()
3478 if (priv->micdet[1].detecting) in wm8994_mic_work()
3482 if (priv->micdet[1].detecting) in wm8994_mic_work()
3488 priv->micdet[1].detecting = false; in wm8994_mic_work()
3490 priv->micdet[1].detecting = true; in wm8994_mic_work()
3492 snd_soc_jack_report(priv->micdet[1].jack, report, in wm8994_mic_work()
3501 struct snd_soc_component *component = priv->hubs.component; in wm8994_mic_irq()
3504 trace_snd_soc_jack_irq(dev_name(component->dev)); in wm8994_mic_irq()
3507 pm_wakeup_event(component->dev, 300); in wm8994_mic_irq()
3510 &priv->mic_work, msecs_to_jiffies(250)); in wm8994_mic_irq()
3521 if (!wm8994->jackdet) in wm1811_micd_stop()
3528 if (wm8994->wm8994->pdata.jd_ext_cap) in wm1811_micd_stop()
3556 snd_soc_jack_report(wm8994->micdet[0].jack, report, in wm8958_button_det()
3557 wm8994->btn_mask); in wm8958_button_det()
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()
3593 dev_dbg(component->dev, "Detected open circuit\n"); in wm8958_mic_id()
3596 &wm8994->open_circuit_work, in wm8958_mic_id()
3605 dev_dbg(component->dev, "Detected microphone\n"); 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()
3618 dev_dbg(component->dev, "Detected headphone\n"); 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()
3636 struct wm8994 *control = wm8994->wm8994; in wm1811_mic_work()
3637 struct snd_soc_component *component = wm8994->hubs.component; in wm1811_mic_work()
3640 pm_runtime_get_sync(component->dev); in wm1811_mic_work()
3642 /* If required for an external cap force MICBIAS on */ in wm1811_mic_work()
3643 if (control->pdata.jd_ext_cap) { in wm1811_mic_work()
3648 mutex_lock(&wm8994->accdet_lock); in wm1811_mic_work()
3650 dev_dbg(component->dev, "Starting mic detection\n"); in wm1811_mic_work()
3652 /* Use a user-supplied callback if we have one */ 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()
3669 pm_runtime_put(component->dev); in wm1811_mic_work()
3675 struct wm8994 *control = wm8994->wm8994; in wm1811_jackdet_irq()
3676 struct snd_soc_component *component = wm8994->hubs.component; in wm1811_jackdet_irq()
3681 pm_runtime_get_sync(component->dev); 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()
3689 dev_err(component->dev, "Failed to read jack status: %d\n", reg); in wm1811_jackdet_irq()
3690 mutex_unlock(&wm8994->accdet_lock); in wm1811_jackdet_irq()
3691 pm_runtime_put(component->dev); in wm1811_jackdet_irq()
3695 dev_dbg(component->dev, "JACKDET %x\n", reg); in wm1811_jackdet_irq()
3700 dev_dbg(component->dev, "Jack detected\n"); in wm1811_jackdet_irq()
3711 delay = control->pdata.micdet_delay; in wm1811_jackdet_irq()
3713 &wm8994->mic_work, in wm1811_jackdet_irq()
3716 dev_dbg(component->dev, "Jack not detected\n"); 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()
3736 /* Turn off MICBIAS if it was on for an external cap */ in wm1811_jackdet_irq()
3737 if (control->pdata.jd_ext_cap && !present) 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()
3748 /* Since we only report deltas force an update, ensures we in wm1811_jackdet_irq()
3750 snd_soc_jack_report(wm8994->micdet[0].jack, 0, 0); in wm1811_jackdet_irq()
3752 pm_runtime_put(component->dev); in wm1811_jackdet_irq()
3765 * wm8958_mic_detect - Enable microphone detection via the WM8958 IRQ
3786 struct wm8994 *control = wm8994->wm8994; in wm8958_mic_detect()
3789 switch (control->type) { in wm8958_mic_detect()
3794 return -EINVAL; in wm8958_mic_detect()
3797 pm_runtime_get_sync(component->dev); 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()
3824 if (control->pdata.micd_lvl_sel) in wm8958_mic_detect()
3825 micd_lvl_sel = control->pdata.micd_lvl_sel; 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()
3867 pm_runtime_put(component->dev); in wm8958_mic_detect()
3878 struct snd_soc_component *component = wm8994->hubs.component; in wm8958_mic_work()
3880 pm_runtime_get_sync(component->dev); 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()
3888 pm_runtime_put(component->dev); in wm8958_mic_work()
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()
3908 pm_runtime_get_sync(component->dev); in wm8958_mic_irq()
3911 * range being provided - if that happens loop again. in wm8958_mic_irq()
3917 dev_err(component->dev, in wm8958_mic_irq()
3920 pm_runtime_put(component->dev); in wm8958_mic_irq()
3925 dev_dbg(component->dev, "Mic detect data not valid\n"); in wm8958_mic_irq()
3933 } while (count--); in wm8958_mic_irq()
3936 dev_warn(component->dev, "No impedance range reported for jack\n"); in wm8958_mic_irq()
3939 trace_snd_soc_jack_irq(dev_name(component->dev)); in wm8958_mic_irq()
3943 if (wm8994->jackdet) { in wm8958_mic_irq()
3946 dev_err(component->dev, "Failed to read jack status: %d\n", in wm8958_mic_irq()
3949 dev_dbg(component->dev, "Ignoring removed jack\n"); 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()
3971 pm_runtime_put(component->dev); in wm8958_mic_irq()
3979 dev_err(component->dev, "FIFO error\n"); in wm8994_fifo_error()
3988 dev_err(component->dev, "Thermal warning\n"); in wm8994_temp_warn()
3997 dev_crit(component->dev, "Thermal shutdown\n"); in wm8994_temp_shut()
4005 struct wm8994 *control = dev_get_drvdata(component->dev->parent); in wm8994_component_probe()
4010 snd_soc_component_init_regmap(component, control->regmap); in wm8994_component_probe()
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()
4020 switch (control->type) { 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()
4039 dapm->idle_bias_off = 1; in wm8994_component_probe()
4041 /* Set revision-specific configuration */ in wm8994_component_probe()
4042 switch (control->type) { in wm8994_component_probe()
4045 if (!control->pdata.lineout1_diff || in wm8994_component_probe()
4046 !control->pdata.lineout2_diff) in wm8994_component_probe()
4047 dapm->idle_bias_off = 0; in wm8994_component_probe()
4049 switch (control->revision) { 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()
4070 switch (control->revision) { 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()
4104 switch (control->type) { 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()
4114 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4120 dev_warn(component->dev, in wm8994_component_probe()
4125 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4130 dev_warn(component->dev, in wm8994_component_probe()
4134 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4139 dev_warn(component->dev, in wm8994_component_probe()
4143 ret = wm8994_request_irq(wm8994->wm8994, in wm8994_component_probe()
4148 dev_warn(component->dev, 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()
4163 dev_warn(component->dev, in wm8994_component_probe()
4167 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, in wm8994_component_probe()
4173 switch (control->type) { in wm8994_component_probe()
4175 if (control->cust_id > 1 || control->revision > 1) { in wm8994_component_probe()
4176 ret = wm8994_request_irq(wm8994->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()
4199 pm_runtime_get_sync(component->dev); in wm8994_component_probe()
4202 * configured on init - if a system wants to do this dynamically in wm8994_component_probe()
4205 ret = regmap_read(control->regmap, WM8994_GPIO_1, ®); in wm8994_component_probe()
4207 dev_err(component->dev, "Failed to read GPIO1 state: %d\n", ret); in wm8994_component_probe()
4211 wm8994->lrclk_shared[0] = 1; in wm8994_component_probe()
4214 wm8994->lrclk_shared[0] = 0; in wm8994_component_probe()
4217 ret = regmap_read(control->regmap, WM8994_GPIO_6, ®); in wm8994_component_probe()
4219 dev_err(component->dev, "Failed to read GPIO6 state: %d\n", ret); in wm8994_component_probe()
4223 wm8994->lrclk_shared[1] = 1; in wm8994_component_probe()
4226 wm8994->lrclk_shared[1] = 0; in wm8994_component_probe()
4229 pm_runtime_put(component->dev); in wm8994_component_probe()
4251 switch (control->type) { in wm8994_component_probe()
4261 /* Put MICBIAS into bypass mode by default on newer devices */ in wm8994_component_probe()
4262 switch (control->type) { in wm8994_component_probe()
4274 wm8994->hubs.check_class_w_digital = wm8994_check_class_w_digital; in wm8994_component_probe()
4285 switch (control->type) { in wm8994_component_probe()
4291 if (control->revision < 4) { in wm8994_component_probe()
4314 if (control->revision < 1) { 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()
4353 switch (control->type) { in wm8994_component_probe()
4358 if (control->revision < 4) { in wm8994_component_probe()
4369 if (control->revision < 1) { 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()
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()
4434 switch (control->type) { 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()
4440 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, in wm8994_component_remove()
4442 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET, 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()
4474 wm8994 = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_priv), in wm8994_probe()
4477 return -ENOMEM; in wm8994_probe()
4480 mutex_init(&wm8994->fw_lock); in wm8994_probe()
4482 wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); in wm8994_probe()
4484 pm_runtime_enable(&pdev->dev); in wm8994_probe()
4485 pm_runtime_idle(&pdev->dev); in wm8994_probe()
4487 return devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_wm8994, in wm8994_probe()
4493 pm_runtime_disable(&pdev->dev); in wm8994_remove()
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()
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",
4543 MODULE_ALIAS("platform:wm8994-codec");