Lines Matching +full:codec +full:- +full:aif3

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),
1724 { "AIF3 Capture", NULL, "DBVDD3" },
1725 { "AIF3 Playback", NULL, "DBVDD3" },
1849 { "AIF3 Capture", NULL, "AIF3TX1" },
1850 { "AIF3 Capture", NULL, "AIF3TX2" },
1852 { "AIF3RX1", NULL, "AIF3 Playback" },
1853 { "AIF3RX2", NULL, "AIF3 Playback" },
1885 { "AIF3 Playback", NULL, "SYSCLK" },
1893 { "AIF3 Capture", NULL, "SYSCLK" },
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()
2173 .name = "cs47l90-aif1",
2195 .name = "cs47l90-aif2",
2217 .name = "cs47l90-aif3",
2221 .stream_name = "AIF3 Playback",
2228 .stream_name = "AIF3 Capture",
2239 .name = "cs47l90-aif4",
2261 .name = "cs47l90-slim1",
2280 .name = "cs47l90-slim2",
2299 .name = "cs47l90-slim3",
2318 .name = "cs47l90-cpu-voicectrl",
2329 .name = "cs47l90-dsp-voicectrl",
2339 .name = "cs47l90-cpu-trace",
2350 .name = "cs47l90-dsp-trace",
2364 struct snd_soc_pcm_runtime *rtd = stream->private_data; in cs47l90_open()
2366 struct madera_priv *priv = &cs47l90->core; in cs47l90_open()
2367 struct madera *madera = priv->madera; in cs47l90_open()
2370 if (strcmp(asoc_rtd_to_codec(rtd, 0)->name, "cs47l90-dsp-voicectrl") == 0) { in cs47l90_open()
2372 } else if (strcmp(asoc_rtd_to_codec(rtd, 0)->name, "cs47l90-dsp-trace") == 0) { in cs47l90_open()
2375 dev_err(madera->dev, in cs47l90_open()
2377 asoc_rtd_to_codec(rtd, 0)->name); in cs47l90_open()
2378 return -EINVAL; in cs47l90_open()
2381 return wm_adsp_compr_open(&priv->adsp[n_adsp], stream); in cs47l90_open()
2387 struct madera_priv *priv = &cs47l90->core; in cs47l90_adsp2_irq()
2388 struct madera *madera = priv->madera; in cs47l90_adsp2_irq()
2394 ret = wm_adsp_compr_handle_irq(&priv->adsp[i]); in cs47l90_adsp2_irq()
2395 if (ret != -ENODEV) in cs47l90_adsp2_irq()
2399 blocking_notifier_call_chain(&madera->notifier, in cs47l90_adsp2_irq()
2406 dev_err(madera->dev, "Spurious compressed data IRQ\n"); in cs47l90_adsp2_irq()
2416 struct madera *madera = cs47l90->core.madera; in cs47l90_component_probe()
2419 snd_soc_component_init_regmap(component, madera->regmap); in cs47l90_component_probe()
2421 mutex_lock(&madera->dapm_ptr_lock); in cs47l90_component_probe()
2422 madera->dapm = snd_soc_component_get_dapm(component); in cs47l90_component_probe()
2423 mutex_unlock(&madera->dapm_ptr_lock); in cs47l90_component_probe()
2443 wm_adsp2_component_probe(&cs47l90->core.adsp[i], component); in cs47l90_component_probe()
2451 struct madera *madera = cs47l90->core.madera; in cs47l90_component_remove()
2454 mutex_lock(&madera->dapm_ptr_lock); in cs47l90_component_remove()
2455 madera->dapm = NULL; in cs47l90_component_remove()
2456 mutex_unlock(&madera->dapm_ptr_lock); in cs47l90_component_remove()
2459 wm_adsp2_component_remove(&cs47l90->core.adsp[i], component); in cs47l90_component_remove()
2504 struct madera *madera = dev_get_drvdata(pdev->dev.parent); in cs47l90_probe()
2511 if (!madera->irq_dev) { in cs47l90_probe()
2512 dev_dbg(&pdev->dev, "irqchip driver not ready\n"); in cs47l90_probe()
2513 return -EPROBE_DEFER; in cs47l90_probe()
2516 cs47l90 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l90), in cs47l90_probe()
2519 return -ENOMEM; in cs47l90_probe()
2523 cs47l90->core.madera = madera; in cs47l90_probe()
2524 cs47l90->core.dev = &pdev->dev; in cs47l90_probe()
2525 cs47l90->core.num_inputs = 10; in cs47l90_probe()
2527 ret = madera_core_init(&cs47l90->core); in cs47l90_probe()
2535 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret); in cs47l90_probe()
2541 dev_warn(&pdev->dev, "Failed to set DSP IRQ wake: %d\n", ret); in cs47l90_probe()
2544 cs47l90->core.adsp[i].part = "cs47l90"; in cs47l90_probe()
2545 cs47l90->core.adsp[i].cs_dsp.num = i + 1; in cs47l90_probe()
2546 cs47l90->core.adsp[i].cs_dsp.type = WMFW_ADSP2; in cs47l90_probe()
2547 cs47l90->core.adsp[i].cs_dsp.rev = 2; in cs47l90_probe()
2548 cs47l90->core.adsp[i].cs_dsp.dev = madera->dev; in cs47l90_probe()
2549 cs47l90->core.adsp[i].cs_dsp.regmap = madera->regmap_32bit; in cs47l90_probe()
2551 cs47l90->core.adsp[i].cs_dsp.base = cs47l90_dsp_control_bases[i]; in cs47l90_probe()
2552 cs47l90->core.adsp[i].cs_dsp.mem = cs47l90_dsp_regions[i]; in cs47l90_probe()
2553 cs47l90->core.adsp[i].cs_dsp.num_mems = in cs47l90_probe()
2556 cs47l90->core.adsp[i].cs_dsp.lock_regions = CS_ADSP2_REGION_1_9; in cs47l90_probe()
2558 ret = wm_adsp2_init(&cs47l90->core.adsp[i]); in cs47l90_probe()
2561 ret = madera_init_bus_error_irq(&cs47l90->core, i, in cs47l90_probe()
2564 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_probe()
2568 for (--i; i >= 0; --i) { in cs47l90_probe()
2569 madera_free_bus_error_irq(&cs47l90->core, i); in cs47l90_probe()
2570 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_probe()
2576 madera_init_fll(madera, 1, MADERA_FLL1_CONTROL_1 - 1, in cs47l90_probe()
2577 &cs47l90->fll[0]); in cs47l90_probe()
2578 madera_init_fll(madera, 2, MADERA_FLL2_CONTROL_1 - 1, in cs47l90_probe()
2579 &cs47l90->fll[1]); in cs47l90_probe()
2580 madera_init_fll(madera, 4, MADERA_FLLAO_CONTROL_1 - 1, in cs47l90_probe()
2581 &cs47l90->fll[2]); in cs47l90_probe()
2584 madera_init_dai(&cs47l90->core, i); in cs47l90_probe()
2588 regmap_update_bits(madera->regmap, cs47l90_digital_vu[i], in cs47l90_probe()
2591 pm_runtime_enable(&pdev->dev); in cs47l90_probe()
2592 pm_runtime_idle(&pdev->dev); in cs47l90_probe()
2594 ret = devm_snd_soc_register_component(&pdev->dev, in cs47l90_probe()
2599 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in cs47l90_probe()
2606 pm_runtime_disable(&pdev->dev); in cs47l90_probe()
2609 madera_free_bus_error_irq(&cs47l90->core, i); in cs47l90_probe()
2610 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_probe()
2616 madera_core_free(&cs47l90->core); in cs47l90_probe()
2626 pm_runtime_disable(&pdev->dev); in cs47l90_remove()
2629 madera_free_bus_error_irq(&cs47l90->core, i); in cs47l90_remove()
2630 wm_adsp2_remove(&cs47l90->core.adsp[i]); in cs47l90_remove()
2633 madera_set_irq_wake(cs47l90->core.madera, MADERA_IRQ_DSP_IRQ1, 0); in cs47l90_remove()
2634 madera_free_irq(cs47l90->core.madera, MADERA_IRQ_DSP_IRQ1, cs47l90); in cs47l90_remove()
2635 madera_core_free(&cs47l90->core); in cs47l90_remove()
2642 .name = "cs47l90-codec",
2650 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
2654 MODULE_ALIAS("platform:cs47l90-codec");