Lines Matching +full:codec +full:- +full:aif2

1 // SPDX-License-Identifier: GPL-2.0-only
3 // ALSA SoC Audio driver for CS47L15 codec
5 // Copyright (C) 2016-2019 Cirrus Logic, Inc. and
23 #include <linux/irqchip/irq-madera.h>
33 /* Mid-mode registers */
39 #define DRV_NAME "cs47l15-codec"
72 snd_soc_dapm_to_component(w->dapm); in cs47l15_adsp_power_ev()
74 struct madera_priv *priv = &cs47l15->core; in cs47l15_adsp_power_ev()
75 struct madera *madera = priv->madera; in cs47l15_adsp_power_ev()
79 ret = regmap_read(madera->regmap, MADERA_DSP_CLOCK_2, &freq); in cs47l15_adsp_power_ev()
81 dev_err(madera->dev, in cs47l15_adsp_power_ev()
88 ret = madera_set_adsp_clk(&cs47l15->core, w->shift, freq); in cs47l15_adsp_power_ev()
113 ucontrol->value.integer.value[0] = !!cs47l15->in1_lp_mode; in cs47l15_in1_adc_get()
125 if (!!ucontrol->value.integer.value[0] == cs47l15->in1_lp_mode) in cs47l15_in1_adc_put()
128 switch (ucontrol->value.integer.value[0]) { in cs47l15_in1_adc_put()
139 cs47l15->in1_lp_mode = false; in cs47l15_in1_adc_put()
152 cs47l15->in1_lp_mode = true; in cs47l15_in1_adc_put()
964 { "AIF2 Capture", NULL, "AIF2TX1" },
965 { "AIF2 Capture", NULL, "AIF2TX2" },
966 { "AIF2 Capture", NULL, "AIF2TX3" },
967 { "AIF2 Capture", NULL, "AIF2TX4" },
969 { "AIF2RX1", NULL, "AIF2 Playback" },
970 { "AIF2RX2", NULL, "AIF2 Playback" },
971 { "AIF2RX3", NULL, "AIF2 Playback" },
972 { "AIF2RX4", NULL, "AIF2 Playback" },
981 { "AIF2 Playback", NULL, "SYSCLK" },
985 { "AIF2 Capture", NULL, "SYSCLK" },
1133 return madera_set_fll_refclk(&cs47l15->fll[0], source, fref, in cs47l15_set_fll()
1136 return madera_set_fll_ao_refclk(&cs47l15->fll[1], source, fref, in cs47l15_set_fll()
1139 return madera_set_fll_syncclk(&cs47l15->fll[0], source, fref, in cs47l15_set_fll()
1142 return -EINVAL; in cs47l15_set_fll()
1152 .name = "cs47l15-aif1",
1174 .name = "cs47l15-aif2",
1178 .stream_name = "AIF2 Playback",
1185 .stream_name = "AIF2 Capture",
1196 .name = "cs47l15-aif3",
1218 .name = "cs47l15-cpu-trace",
1229 .name = "cs47l15-dsp-trace",
1243 struct snd_soc_pcm_runtime *rtd = stream->private_data; in cs47l15_open()
1245 struct madera_priv *priv = &cs47l15->core; in cs47l15_open()
1246 struct madera *madera = priv->madera; in cs47l15_open()
1249 if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l15-dsp-trace") == 0) { in cs47l15_open()
1252 dev_err(madera->dev, in cs47l15_open()
1254 snd_soc_rtd_to_codec(rtd, 0)->name); in cs47l15_open()
1255 return -EINVAL; in cs47l15_open()
1258 return wm_adsp_compr_open(&priv->adsp[n_adsp], stream); in cs47l15_open()
1264 struct madera_priv *priv = &cs47l15->core; in cs47l15_adsp2_irq()
1265 struct madera *madera = priv->madera; in cs47l15_adsp2_irq()
1268 ret = wm_adsp_compr_handle_irq(&priv->adsp[0]); in cs47l15_adsp2_irq()
1269 if (ret == -ENODEV) { in cs47l15_adsp2_irq()
1270 dev_err(madera->dev, "Spurious compressed data IRQ\n"); in cs47l15_adsp2_irq()
1284 struct madera *madera = cs47l15->core.madera; in cs47l15_component_probe()
1287 snd_soc_component_init_regmap(component, madera->regmap); in cs47l15_component_probe()
1289 mutex_lock(&madera->dapm_ptr_lock); in cs47l15_component_probe()
1290 madera->dapm = snd_soc_component_get_dapm(component); in cs47l15_component_probe()
1291 mutex_unlock(&madera->dapm_ptr_lock); in cs47l15_component_probe()
1311 wm_adsp2_component_probe(&cs47l15->core.adsp[0], component); in cs47l15_component_probe()
1319 struct madera *madera = cs47l15->core.madera; in cs47l15_component_remove()
1321 mutex_lock(&madera->dapm_ptr_lock); in cs47l15_component_remove()
1322 madera->dapm = NULL; in cs47l15_component_remove()
1323 mutex_unlock(&madera->dapm_ptr_lock); in cs47l15_component_remove()
1325 wm_adsp2_component_remove(&cs47l15->core.adsp[0], component); in cs47l15_component_remove()
1367 struct madera *madera = dev_get_drvdata(pdev->dev.parent); in cs47l15_probe()
1374 if (!madera->irq_dev) { in cs47l15_probe()
1375 dev_dbg(&pdev->dev, "irqchip driver not ready\n"); in cs47l15_probe()
1376 return -EPROBE_DEFER; in cs47l15_probe()
1379 cs47l15 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l15), in cs47l15_probe()
1382 return -ENOMEM; in cs47l15_probe()
1386 cs47l15->core.madera = madera; in cs47l15_probe()
1387 cs47l15->core.dev = &pdev->dev; in cs47l15_probe()
1388 cs47l15->core.num_inputs = 4; in cs47l15_probe()
1390 ret = madera_core_init(&cs47l15->core); in cs47l15_probe()
1394 ret = madera_init_overheat(&cs47l15->core); in cs47l15_probe()
1402 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret); in cs47l15_probe()
1408 dev_warn(&pdev->dev, "Failed to set DSP IRQ wake: %d\n", ret); in cs47l15_probe()
1410 cs47l15->core.adsp[0].part = "cs47l15"; in cs47l15_probe()
1411 cs47l15->core.adsp[0].cs_dsp.num = 1; in cs47l15_probe()
1412 cs47l15->core.adsp[0].cs_dsp.type = WMFW_ADSP2; in cs47l15_probe()
1413 cs47l15->core.adsp[0].cs_dsp.rev = 2; in cs47l15_probe()
1414 cs47l15->core.adsp[0].cs_dsp.dev = madera->dev; in cs47l15_probe()
1415 cs47l15->core.adsp[0].cs_dsp.regmap = madera->regmap_32bit; in cs47l15_probe()
1417 cs47l15->core.adsp[0].cs_dsp.base = MADERA_DSP1_CONFIG_1; in cs47l15_probe()
1418 cs47l15->core.adsp[0].cs_dsp.mem = cs47l15_dsp1_regions; in cs47l15_probe()
1419 cs47l15->core.adsp[0].cs_dsp.num_mems = ARRAY_SIZE(cs47l15_dsp1_regions); in cs47l15_probe()
1421 cs47l15->core.adsp[0].cs_dsp.lock_regions = in cs47l15_probe()
1424 ret = wm_adsp2_init(&cs47l15->core.adsp[0]); in cs47l15_probe()
1428 ret = madera_init_bus_error_irq(&cs47l15->core, 0, wm_adsp2_bus_error); in cs47l15_probe()
1432 madera_init_fll(madera, 1, MADERA_FLL1_CONTROL_1 - 1, in cs47l15_probe()
1433 &cs47l15->fll[0]); in cs47l15_probe()
1434 madera_init_fll(madera, 4, MADERA_FLLAO_CONTROL_1 - 1, in cs47l15_probe()
1435 &cs47l15->fll[1]); in cs47l15_probe()
1438 madera_init_dai(&cs47l15->core, i); in cs47l15_probe()
1442 regmap_update_bits(madera->regmap, cs47l15_digital_vu[i], in cs47l15_probe()
1445 pm_runtime_enable(&pdev->dev); in cs47l15_probe()
1446 pm_runtime_idle(&pdev->dev); in cs47l15_probe()
1448 ret = devm_snd_soc_register_component(&pdev->dev, in cs47l15_probe()
1453 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in cs47l15_probe()
1460 pm_runtime_disable(&pdev->dev); in cs47l15_probe()
1461 madera_free_bus_error_irq(&cs47l15->core, 0); in cs47l15_probe()
1463 wm_adsp2_remove(&cs47l15->core.adsp[0]); in cs47l15_probe()
1468 madera_free_overheat(&cs47l15->core); in cs47l15_probe()
1470 madera_core_free(&cs47l15->core); in cs47l15_probe()
1479 pm_runtime_disable(&pdev->dev); in cs47l15_remove()
1481 madera_free_bus_error_irq(&cs47l15->core, 0); in cs47l15_remove()
1483 wm_adsp2_remove(&cs47l15->core.adsp[0]); in cs47l15_remove()
1485 madera_set_irq_wake(cs47l15->core.madera, MADERA_IRQ_DSP_IRQ1, 0); in cs47l15_remove()
1486 madera_free_irq(cs47l15->core.madera, MADERA_IRQ_DSP_IRQ1, cs47l15); in cs47l15_remove()
1487 madera_free_overheat(&cs47l15->core); in cs47l15_remove()
1488 madera_core_free(&cs47l15->core); in cs47l15_remove()
1493 .name = "cs47l15-codec",
1501 MODULE_SOFTDEP("pre: madera irq-madera arizona-micsupp");
1506 MODULE_ALIAS("platform:cs47l15-codec");