Lines Matching +full:dsp +full:- +full:aif1
1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm5102.c -- WM5102 ALSA SoC Audio driver
34 #define DRV_NAME "wm5102-codec"
42 static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
43 static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
44 static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
45 static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
583 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wm5102_sysclk_ev()
584 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in wm5102_sysclk_ev()
585 struct regmap *regmap = arizona->regmap; in wm5102_sysclk_ev()
589 switch (arizona->rev) { in wm5102_sysclk_ev()
622 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wm5102_adsp_power_ev()
623 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in wm5102_adsp_power_ev()
629 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); in wm5102_adsp_power_ev()
631 dev_err(component->dev, in wm5102_adsp_power_ev()
633 return -EIO; in wm5102_adsp_power_ev()
641 dev_err(component->dev, in wm5102_adsp_power_ev()
653 dev_warn(component->dev, in wm5102_adsp_power_ev()
668 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in wm5102_out_comp_coeff_get()
670 mutex_lock(&arizona->dac_comp_lock); in wm5102_out_comp_coeff_get()
671 put_unaligned_be16(arizona->dac_comp_coeff, in wm5102_out_comp_coeff_get()
672 ucontrol->value.bytes.data); in wm5102_out_comp_coeff_get()
673 mutex_unlock(&arizona->dac_comp_lock); in wm5102_out_comp_coeff_get()
682 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in wm5102_out_comp_coeff_put()
683 uint16_t dac_comp_coeff = get_unaligned_be16(ucontrol->value.bytes.data); in wm5102_out_comp_coeff_put()
686 mutex_lock(&arizona->dac_comp_lock); in wm5102_out_comp_coeff_put()
687 if (arizona->dac_comp_coeff != dac_comp_coeff) { in wm5102_out_comp_coeff_put()
688 arizona->dac_comp_coeff = dac_comp_coeff; in wm5102_out_comp_coeff_put()
691 mutex_unlock(&arizona->dac_comp_lock); in wm5102_out_comp_coeff_put()
700 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in wm5102_out_comp_switch_get()
702 mutex_lock(&arizona->dac_comp_lock); in wm5102_out_comp_switch_get()
703 ucontrol->value.integer.value[0] = arizona->dac_comp_enabled; in wm5102_out_comp_switch_get()
704 mutex_unlock(&arizona->dac_comp_lock); in wm5102_out_comp_switch_get()
713 struct arizona *arizona = dev_get_drvdata(component->dev->parent); in wm5102_out_comp_switch_put()
714 struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; in wm5102_out_comp_switch_put()
717 if (ucontrol->value.integer.value[0] > mc->max) in wm5102_out_comp_switch_put()
718 return -EINVAL; in wm5102_out_comp_switch_put()
720 mutex_lock(&arizona->dac_comp_lock); in wm5102_out_comp_switch_put()
721 if (arizona->dac_comp_enabled != ucontrol->value.integer.value[0]) { in wm5102_out_comp_switch_put()
722 arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; in wm5102_out_comp_switch_put()
725 mutex_unlock(&arizona->dac_comp_lock); in wm5102_out_comp_switch_put()
1566 { "AIF1 Capture", NULL, "AIF1TX1" },
1567 { "AIF1 Capture", NULL, "AIF1TX2" },
1568 { "AIF1 Capture", NULL, "AIF1TX3" },
1569 { "AIF1 Capture", NULL, "AIF1TX4" },
1570 { "AIF1 Capture", NULL, "AIF1TX5" },
1571 { "AIF1 Capture", NULL, "AIF1TX6" },
1572 { "AIF1 Capture", NULL, "AIF1TX7" },
1573 { "AIF1 Capture", NULL, "AIF1TX8" },
1575 { "AIF1RX1", NULL, "AIF1 Playback" },
1576 { "AIF1RX2", NULL, "AIF1 Playback" },
1577 { "AIF1RX3", NULL, "AIF1 Playback" },
1578 { "AIF1RX4", NULL, "AIF1 Playback" },
1579 { "AIF1RX5", NULL, "AIF1 Playback" },
1580 { "AIF1RX6", NULL, "AIF1 Playback" },
1581 { "AIF1RX7", NULL, "AIF1 Playback" },
1582 { "AIF1RX8", NULL, "AIF1 Playback" },
1618 { "AIF1 Playback", NULL, "SYSCLK" },
1625 { "AIF1 Capture", NULL, "SYSCLK" },
1632 { "Audio Trace DSP", NULL, "DSP1" },
1757 return arizona_set_fll(&wm5102->fll[0], source, Fref, Fout); in wm5102_set_fll()
1759 return arizona_set_fll(&wm5102->fll[1], source, Fref, Fout); in wm5102_set_fll()
1761 return arizona_set_fll_refclk(&wm5102->fll[0], source, Fref, in wm5102_set_fll()
1764 return arizona_set_fll_refclk(&wm5102->fll[1], source, Fref, in wm5102_set_fll()
1767 return -EINVAL; in wm5102_set_fll()
1782 .name = "wm5102-aif1",
1786 .stream_name = "AIF1 Playback",
1793 .stream_name = "AIF1 Capture",
1804 .name = "wm5102-aif2",
1826 .name = "wm5102-aif3",
1848 .name = "wm5102-slim1",
1867 .name = "wm5102-slim2",
1886 .name = "wm5102-slim3",
1905 .name = "wm5102-cpu-trace",
1916 .name = "wm5102-dsp-trace",
1918 .stream_name = "Audio Trace DSP",
1932 return wm_adsp_compr_open(&priv->core.adsp[0], stream); in wm5102_open()
1938 struct arizona *arizona = priv->core.arizona; in wm5102_adsp2_irq()
1941 ret = wm_adsp_compr_handle_irq(&priv->core.adsp[0]); in wm5102_adsp2_irq()
1942 if (ret == -ENODEV) { in wm5102_adsp2_irq()
1943 dev_err(arizona->dev, "Spurious compressed data IRQ\n"); in wm5102_adsp2_irq()
1954 struct arizona *arizona = priv->core.arizona; in wm5102_component_probe()
1957 snd_soc_component_init_regmap(component, arizona->regmap); in wm5102_component_probe()
1959 ret = wm_adsp2_component_probe(&priv->core.adsp[0], component); in wm5102_component_probe()
1976 priv->core.arizona->dapm = dapm; in wm5102_component_probe()
1981 wm_adsp2_component_remove(&priv->core.adsp[0], component); in wm5102_component_probe()
1990 wm_adsp2_component_remove(&priv->core.adsp[0], component); in wm5102_component_remove()
1992 priv->core.arizona->dapm = NULL; in wm5102_component_remove()
2039 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); in wm5102_probe()
2043 wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), in wm5102_probe()
2046 return -ENOMEM; in wm5102_probe()
2050 if (!dev_get_platdata(arizona->dev)) { in wm5102_probe()
2057 mutex_init(&arizona->dac_comp_lock); in wm5102_probe()
2059 wm5102->core.arizona = arizona; in wm5102_probe()
2060 wm5102->core.num_inputs = 6; in wm5102_probe()
2062 arizona_init_dvfs(&wm5102->core); in wm5102_probe()
2064 wm5102->core.adsp[0].part = "wm5102"; in wm5102_probe()
2065 wm5102->core.adsp[0].cs_dsp.num = 1; in wm5102_probe()
2066 wm5102->core.adsp[0].cs_dsp.type = WMFW_ADSP2; in wm5102_probe()
2067 wm5102->core.adsp[0].cs_dsp.base = ARIZONA_DSP1_CONTROL_1; in wm5102_probe()
2068 wm5102->core.adsp[0].cs_dsp.dev = arizona->dev; in wm5102_probe()
2069 wm5102->core.adsp[0].cs_dsp.regmap = arizona->regmap; in wm5102_probe()
2070 wm5102->core.adsp[0].cs_dsp.mem = wm5102_dsp1_regions; in wm5102_probe()
2071 wm5102->core.adsp[0].cs_dsp.num_mems = ARRAY_SIZE(wm5102_dsp1_regions); in wm5102_probe()
2073 ret = wm_adsp2_init(&wm5102->core.adsp[0]); in wm5102_probe()
2077 /* This may return -EPROBE_DEFER, so do this early on */ in wm5102_probe()
2078 ret = arizona_jack_codec_dev_probe(&wm5102->core, &pdev->dev); in wm5102_probe()
2082 for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++) in wm5102_probe()
2083 wm5102->fll[i].vco_mult = 1; in wm5102_probe()
2085 arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1, in wm5102_probe()
2087 &wm5102->fll[0]); in wm5102_probe()
2088 arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1, in wm5102_probe()
2090 &wm5102->fll[1]); in wm5102_probe()
2093 regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2, in wm5102_probe()
2095 regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3, in wm5102_probe()
2099 arizona_init_dai(&wm5102->core, i); in wm5102_probe()
2103 regmap_update_bits(arizona->regmap, wm5102_digital_vu[i], in wm5102_probe()
2106 pm_runtime_enable(&pdev->dev); in wm5102_probe()
2107 pm_runtime_idle(&pdev->dev); in wm5102_probe()
2113 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret); in wm5102_probe()
2119 dev_warn(&pdev->dev, in wm5102_probe()
2132 ret = devm_snd_soc_register_component(&pdev->dev, in wm5102_probe()
2137 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in wm5102_probe()
2149 pm_runtime_disable(&pdev->dev); in wm5102_probe()
2150 arizona_jack_codec_dev_remove(&wm5102->core); in wm5102_probe()
2158 struct arizona *arizona = wm5102->core.arizona; in wm5102_remove()
2160 pm_runtime_disable(&pdev->dev); in wm5102_remove()
2162 wm_adsp2_remove(&wm5102->core.adsp[0]); in wm5102_remove()
2169 arizona_jack_codec_dev_remove(&wm5102->core); in wm5102_remove()
2174 .name = "wm5102-codec",
2185 MODULE_ALIAS("platform:wm5102-codec");