Lines Matching +full:codec +full:- +full:dmicdat4
1 // SPDX-License-Identifier: GPL-2.0-only
3 // ALSA SoC Audio driver for CS47L85 codec
5 // Copyright (C) 2015-2019 Cirrus Logic, Inc. and
23 #include <linux/irqchip/irq-madera.h>
30 #define DRV_NAME "cs47l85-codec"
114 snd_soc_dapm_to_component(w->dapm); in cs47l85_adsp_power_ev()
116 struct madera_priv *priv = &cs47l85->core; in cs47l85_adsp_power_ev()
117 struct madera *madera = priv->madera; in cs47l85_adsp_power_ev()
121 ret = regmap_read(madera->regmap, MADERA_DSP_CLOCK_1, &freq); in cs47l85_adsp_power_ev()
123 dev_err(madera->dev, in cs47l85_adsp_power_ev()
133 ret = madera_set_adsp_clk(&cs47l85->core, w->shift, freq); in cs47l85_adsp_power_ev()
192 snd_soc_dapm_to_component(w->dapm); in cs47l85_hp_post_enable()
195 switch (w->shift) { in cs47l85_hp_post_enable()
216 snd_soc_dapm_to_component(w->dapm); in cs47l85_hp_post_disable()
218 switch (w->shift) { in cs47l85_hp_post_disable()
258 return -EINVAL; in cs47l85_hp_ev()
339 MADERA_ANC_COEFF_END - MADERA_ANC_COEFF_START + 1),
342 MADERA_FCL_COEFF_END - MADERA_FCL_COEFF_START + 1),
345 MADERA_FCR_COEFF_END - MADERA_FCR_COEFF_START + 1),
935 SND_SOC_DAPM_INPUT("DMICDAT4"),
2003 { "IN4L", NULL, "DMICDAT4" },
2005 { "IN4R", NULL, "DMICDAT4" },
2230 return madera_set_fll_refclk(&cs47l85->fll[0], source, fref, in cs47l85_set_fll()
2233 return madera_set_fll_refclk(&cs47l85->fll[1], source, fref, in cs47l85_set_fll()
2236 return madera_set_fll_refclk(&cs47l85->fll[2], source, fref, in cs47l85_set_fll()
2239 return madera_set_fll_syncclk(&cs47l85->fll[0], source, fref, in cs47l85_set_fll()
2242 return madera_set_fll_syncclk(&cs47l85->fll[1], source, fref, in cs47l85_set_fll()
2245 return madera_set_fll_syncclk(&cs47l85->fll[2], source, fref, in cs47l85_set_fll()
2248 return -EINVAL; in cs47l85_set_fll()
2258 .name = "cs47l85-aif1",
2280 .name = "cs47l85-aif2",
2302 .name = "cs47l85-aif3",
2324 .name = "cs47l85-aif4",
2346 .name = "cs47l85-slim1",
2365 .name = "cs47l85-slim2",
2384 .name = "cs47l85-slim3",
2403 .name = "cs47l85-cpu-voicectrl",
2414 .name = "cs47l85-dsp-voicectrl",
2424 .name = "cs47l85-cpu-trace",
2435 .name = "cs47l85-dsp-trace",
2449 struct snd_soc_pcm_runtime *rtd = stream->private_data; in cs47l85_open()
2451 struct madera_priv *priv = &cs47l85->core; in cs47l85_open()
2452 struct madera *madera = priv->madera; in cs47l85_open()
2455 if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l85-dsp-voicectrl") == 0) { in cs47l85_open()
2457 } else if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l85-dsp-trace") == 0) { in cs47l85_open()
2460 dev_err(madera->dev, in cs47l85_open()
2462 snd_soc_rtd_to_codec(rtd, 0)->name); in cs47l85_open()
2463 return -EINVAL; in cs47l85_open()
2466 return wm_adsp_compr_open(&priv->adsp[n_adsp], stream); in cs47l85_open()
2472 struct madera_priv *priv = &cs47l85->core; in cs47l85_adsp2_irq()
2473 struct madera *madera = priv->madera; in cs47l85_adsp2_irq()
2479 ret = wm_adsp_compr_handle_irq(&priv->adsp[i]); in cs47l85_adsp2_irq()
2480 if (ret != -ENODEV) in cs47l85_adsp2_irq()
2484 blocking_notifier_call_chain(&madera->notifier, in cs47l85_adsp2_irq()
2491 dev_err(madera->dev, "Spurious compressed data IRQ\n"); in cs47l85_adsp2_irq()
2501 struct madera *madera = cs47l85->core.madera; in cs47l85_component_probe()
2504 snd_soc_component_init_regmap(component, madera->regmap); in cs47l85_component_probe()
2506 mutex_lock(&madera->dapm_ptr_lock); in cs47l85_component_probe()
2507 madera->dapm = snd_soc_component_get_dapm(component); in cs47l85_component_probe()
2508 mutex_unlock(&madera->dapm_ptr_lock); in cs47l85_component_probe()
2528 wm_adsp2_component_probe(&cs47l85->core.adsp[i], component); in cs47l85_component_probe()
2536 struct madera *madera = cs47l85->core.madera; in cs47l85_component_remove()
2539 mutex_lock(&madera->dapm_ptr_lock); in cs47l85_component_remove()
2540 madera->dapm = NULL; in cs47l85_component_remove()
2541 mutex_unlock(&madera->dapm_ptr_lock); in cs47l85_component_remove()
2544 wm_adsp2_component_remove(&cs47l85->core.adsp[i], component); in cs47l85_component_remove()
2593 struct madera *madera = dev_get_drvdata(pdev->dev.parent); in cs47l85_probe()
2600 if (!madera->irq_dev) { in cs47l85_probe()
2601 dev_dbg(&pdev->dev, "irqchip driver not ready\n"); in cs47l85_probe()
2602 return -EPROBE_DEFER; in cs47l85_probe()
2605 cs47l85 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l85), in cs47l85_probe()
2608 return -ENOMEM; in cs47l85_probe()
2612 cs47l85->core.madera = madera; in cs47l85_probe()
2613 cs47l85->core.dev = &pdev->dev; in cs47l85_probe()
2614 cs47l85->core.num_inputs = 12; in cs47l85_probe()
2616 ret = madera_core_init(&cs47l85->core); in cs47l85_probe()
2620 ret = madera_init_overheat(&cs47l85->core); in cs47l85_probe()
2628 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret); in cs47l85_probe()
2634 dev_warn(&pdev->dev, "Failed to set DSP IRQ wake: %d\n", ret); in cs47l85_probe()
2637 cs47l85->core.adsp[i].part = "cs47l85"; in cs47l85_probe()
2638 cs47l85->core.adsp[i].cs_dsp.num = i + 1; in cs47l85_probe()
2639 cs47l85->core.adsp[i].cs_dsp.type = WMFW_ADSP2; in cs47l85_probe()
2640 cs47l85->core.adsp[i].cs_dsp.rev = 1; in cs47l85_probe()
2641 cs47l85->core.adsp[i].cs_dsp.dev = madera->dev; in cs47l85_probe()
2642 cs47l85->core.adsp[i].cs_dsp.regmap = madera->regmap_32bit; in cs47l85_probe()
2644 cs47l85->core.adsp[i].cs_dsp.base = wm_adsp2_control_bases[i]; in cs47l85_probe()
2645 cs47l85->core.adsp[i].cs_dsp.mem = cs47l85_dsp_regions[i]; in cs47l85_probe()
2646 cs47l85->core.adsp[i].cs_dsp.num_mems = in cs47l85_probe()
2649 ret = wm_adsp2_init(&cs47l85->core.adsp[i]); in cs47l85_probe()
2651 for (--i; i >= 0; --i) in cs47l85_probe()
2652 wm_adsp2_remove(&cs47l85->core.adsp[i]); in cs47l85_probe()
2657 madera_init_fll(madera, 1, MADERA_FLL1_CONTROL_1 - 1, in cs47l85_probe()
2658 &cs47l85->fll[0]); in cs47l85_probe()
2659 madera_init_fll(madera, 2, MADERA_FLL2_CONTROL_1 - 1, in cs47l85_probe()
2660 &cs47l85->fll[1]); in cs47l85_probe()
2661 madera_init_fll(madera, 3, MADERA_FLL3_CONTROL_1 - 1, in cs47l85_probe()
2662 &cs47l85->fll[2]); in cs47l85_probe()
2665 madera_init_dai(&cs47l85->core, i); in cs47l85_probe()
2669 regmap_update_bits(madera->regmap, cs47l85_digital_vu[i], in cs47l85_probe()
2672 pm_runtime_enable(&pdev->dev); in cs47l85_probe()
2673 pm_runtime_idle(&pdev->dev); in cs47l85_probe()
2675 ret = devm_snd_soc_register_component(&pdev->dev, in cs47l85_probe()
2680 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in cs47l85_probe()
2687 pm_runtime_disable(&pdev->dev); in cs47l85_probe()
2690 wm_adsp2_remove(&cs47l85->core.adsp[i]); in cs47l85_probe()
2695 madera_free_overheat(&cs47l85->core); in cs47l85_probe()
2697 madera_core_free(&cs47l85->core); in cs47l85_probe()
2707 pm_runtime_disable(&pdev->dev); in cs47l85_remove()
2710 wm_adsp2_remove(&cs47l85->core.adsp[i]); in cs47l85_remove()
2712 madera_set_irq_wake(cs47l85->core.madera, MADERA_IRQ_DSP_IRQ1, 0); in cs47l85_remove()
2713 madera_free_irq(cs47l85->core.madera, MADERA_IRQ_DSP_IRQ1, cs47l85); in cs47l85_remove()
2714 madera_free_overheat(&cs47l85->core); in cs47l85_remove()
2715 madera_core_free(&cs47l85->core); in cs47l85_remove()
2720 .name = "cs47l85-codec",
2728 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
2732 MODULE_ALIAS("platform:cs47l85-codec");