Lines Matching +full:codec +full:- +full:dmicdat4
1 // SPDX-License-Identifier: GPL-2.0-only
3 // ALSA SoC Audio driver for CS47L90 codec
5 // Copyright (C) 2015-2019 Cirrus Logic, Inc. and
23 #include <linux/irqchip/irq-madera.h>
30 #define DRV_NAME "cs47l90-codec"
114 snd_soc_dapm_to_component(w->dapm); in cs47l90_adsp_power_ev()
116 struct madera_priv *priv = &cs47l90->core; in cs47l90_adsp_power_ev()
117 struct madera *madera = priv->madera; in cs47l90_adsp_power_ev()
121 ret = regmap_read(madera->regmap, MADERA_DSP_CLOCK_2, &freq); in cs47l90_adsp_power_ev()
123 dev_err(madera->dev, in cs47l90_adsp_power_ev()
130 ret = madera_set_adsp_clk(&cs47l90->core, w->shift, freq); in cs47l90_adsp_power_ev()
257 MADERA_ANC_COEFF_END - MADERA_ANC_COEFF_START + 1),
260 MADERA_FCL_COEFF_END - MADERA_FCL_COEFF_START + 1),
263 MADERA_FCR_COEFF_END - MADERA_FCR_COEFF_START + 1),
903 SND_SOC_DAPM_INPUT("DMICDAT4"),
1946 { "IN4L", NULL, "DMICDAT4" },
1948 { "IN4R", NULL, "DMICDAT4" },
2152 return madera_set_fll_refclk(&cs47l90->fll[0], source, fref, in cs47l90_set_fll()
2155 return madera_set_fll_refclk(&cs47l90->fll[1], source, fref, in cs47l90_set_fll()
2158 return madera_set_fll_ao_refclk(&cs47l90->fll[2], source, fref, in cs47l90_set_fll()
2161 return madera_set_fll_syncclk(&cs47l90->fll[0], source, fref, in cs47l90_set_fll()
2164 return madera_set_fll_syncclk(&cs47l90->fll[1], source, fref, in cs47l90_set_fll()
2167 return -EINVAL; in cs47l90_set_fll()
2177 .name = "cs47l90-aif1",
2199 .name = "cs47l90-aif2",
2221 .name = "cs47l90-aif3",
2243 .name = "cs47l90-aif4",
2265 .name = "cs47l90-slim1",
2284 .name = "cs47l90-slim2",
2303 .name = "cs47l90-slim3",
2322 .name = "cs47l90-cpu-voicectrl",
2333 .name = "cs47l90-dsp-voicectrl",
2343 .name = "cs47l90-cpu-trace",
2354 .name = "cs47l90-dsp-trace",
2368 struct snd_soc_pcm_runtime *rtd = stream->private_data; in cs47l90_open()
2370 struct madera_priv *priv = &cs47l90->core; in cs47l90_open()
2371 struct madera *madera = priv->madera; in cs47l90_open()
2374 if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l90-dsp-voicectrl") == 0) { in cs47l90_open()
2376 } else if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l90-dsp-trace") == 0) { in cs47l90_open()
2379 dev_err(madera->dev, in cs47l90_open()
2381 snd_soc_rtd_to_codec(rtd, 0)->name); in cs47l90_open()
2382 return -EINVAL; in cs47l90_open()
2385 return wm_adsp_compr_open(&priv->adsp[n_adsp], stream); in cs47l90_open()
2391 struct madera_priv *priv = &cs47l90->core; in cs47l90_adsp2_irq()
2392 struct madera *madera = priv->madera; in cs47l90_adsp2_irq()
2398 ret = wm_adsp_compr_handle_irq(&priv->adsp[i]); in cs47l90_adsp2_irq()
2399 if (ret != -ENODEV) in cs47l90_adsp2_irq()
2403 blocking_notifier_call_chain(&madera->notifier, in cs47l90_adsp2_irq()
2410 dev_err(madera->dev, "Spurious compressed data IRQ\n"); in cs47l90_adsp2_irq()
2420 struct madera *madera = cs47l90->core.madera; in cs47l90_component_probe()
2423 snd_soc_component_init_regmap(component, madera->regmap); in cs47l90_component_probe()
2425 mutex_lock(&madera->dapm_ptr_lock); in cs47l90_component_probe()
2426 madera->dapm = snd_soc_component_get_dapm(component); in cs47l90_component_probe()
2427 mutex_unlock(&madera->dapm_ptr_lock); in cs47l90_component_probe()
2447 wm_adsp2_component_probe(&cs47l90->core.adsp[i], component); in cs47l90_component_probe()
2455 struct madera *madera = cs47l90->core.madera; in cs47l90_component_remove()
2458 mutex_lock(&madera->dapm_ptr_lock); in cs47l90_component_remove()
2459 madera->dapm = NULL; in cs47l90_component_remove()
2460 mutex_unlock(&madera->dapm_ptr_lock); in cs47l90_component_remove()
2463 wm_adsp2_component_remove(&cs47l90->core.adsp[i], component); in cs47l90_component_remove()
2508 struct madera *madera = dev_get_drvdata(pdev->dev.parent); in cs47l90_probe()
2515 if (!madera->irq_dev) { in cs47l90_probe()
2516 dev_dbg(&pdev->dev, "irqchip driver not ready\n"); in cs47l90_probe()
2517 return -EPROBE_DEFER; in cs47l90_probe()
2520 cs47l90 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l90), in cs47l90_probe()
2523 return -ENOMEM; in cs47l90_probe()
2527 cs47l90->core.madera = madera; in cs47l90_probe()
2528 cs47l90->core.dev = &pdev->dev; in cs47l90_probe()
2529 cs47l90->core.num_inputs = 10; in cs47l90_probe()
2531 ret = madera_core_init(&cs47l90->core); in cs47l90_probe()
2539 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret); in cs47l90_probe()
2545 dev_warn(&pdev->dev, "Failed to set DSP IRQ wake: %d\n", ret); in cs47l90_probe()
2548 cs47l90->core.adsp[i].part = "cs47l90"; in cs47l90_probe()
2549 cs47l90->core.adsp[i].cs_dsp.num = i + 1; in cs47l90_probe()
2550 cs47l90->core.adsp[i].cs_dsp.type = WMFW_ADSP2; in cs47l90_probe()
2551 cs47l90->core.adsp[i].cs_dsp.rev = 2; in cs47l90_probe()
2552 cs47l90->core.adsp[i].cs_dsp.dev = madera->dev; in cs47l90_probe()
2553 cs47l90->core.adsp[i].cs_dsp.regmap = madera->regmap_32bit; in cs47l90_probe()
2555 cs47l90->core.adsp[i].cs_dsp.base = cs47l90_dsp_control_bases[i]; in cs47l90_probe()
2556 cs47l90->core.adsp[i].cs_dsp.mem = cs47l90_dsp_regions[i]; in cs47l90_probe()
2557 cs47l90->core.adsp[i].cs_dsp.num_mems = in cs47l90_probe()
2560 cs47l90->core.adsp[i].cs_dsp.lock_regions = CS_ADSP2_REGION_1_9; in cs47l90_probe()
2562 ret = wm_adsp2_init(&cs47l90->core.adsp[i]); in cs47l90_probe()
2565 ret = madera_init_bus_error_irq(&cs47l90->core, i, in cs47l90_probe()
2568 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_probe()
2572 for (--i; i >= 0; --i) { in cs47l90_probe()
2573 madera_free_bus_error_irq(&cs47l90->core, i); in cs47l90_probe()
2574 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_probe()
2580 madera_init_fll(madera, 1, MADERA_FLL1_CONTROL_1 - 1, in cs47l90_probe()
2581 &cs47l90->fll[0]); in cs47l90_probe()
2582 madera_init_fll(madera, 2, MADERA_FLL2_CONTROL_1 - 1, in cs47l90_probe()
2583 &cs47l90->fll[1]); in cs47l90_probe()
2584 madera_init_fll(madera, 4, MADERA_FLLAO_CONTROL_1 - 1, in cs47l90_probe()
2585 &cs47l90->fll[2]); in cs47l90_probe()
2588 madera_init_dai(&cs47l90->core, i); in cs47l90_probe()
2592 regmap_update_bits(madera->regmap, cs47l90_digital_vu[i], in cs47l90_probe()
2595 pm_runtime_enable(&pdev->dev); in cs47l90_probe()
2596 pm_runtime_idle(&pdev->dev); in cs47l90_probe()
2598 ret = devm_snd_soc_register_component(&pdev->dev, in cs47l90_probe()
2603 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in cs47l90_probe()
2610 pm_runtime_disable(&pdev->dev); in cs47l90_probe()
2613 madera_free_bus_error_irq(&cs47l90->core, i); in cs47l90_probe()
2614 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_probe()
2620 madera_core_free(&cs47l90->core); in cs47l90_probe()
2630 pm_runtime_disable(&pdev->dev); in cs47l90_remove()
2633 madera_free_bus_error_irq(&cs47l90->core, i); in cs47l90_remove()
2634 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_remove()
2637 madera_set_irq_wake(cs47l90->core.madera, MADERA_IRQ_DSP_IRQ1, 0); in cs47l90_remove()
2638 madera_free_irq(cs47l90->core.madera, MADERA_IRQ_DSP_IRQ1, cs47l90); in cs47l90_remove()
2639 madera_core_free(&cs47l90->core); in cs47l90_remove()
2644 .name = "cs47l90-codec",
2652 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
2656 MODULE_ALIAS("platform:cs47l90-codec");