Lines Matching +full:codec +full:- +full:aif3
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()
1515 { "AIF3 Capture", NULL, "DBVDD3" },
1516 { "AIF3 Playback", NULL, "DBVDD3" },
1590 { "AIF3 Capture", NULL, "AIF3TX1" },
1591 { "AIF3 Capture", NULL, "AIF3TX2" },
1593 { "AIF3RX1", NULL, "AIF3 Playback" },
1594 { "AIF3RX2", NULL, "AIF3 Playback" },
1620 { "AIF3 Playback", NULL, "SYSCLK" },
1627 { "AIF3 Capture", NULL, "SYSCLK" },
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()
1778 .name = "wm5102-aif1",
1800 .name = "wm5102-aif2",
1822 .name = "wm5102-aif3",
1826 .stream_name = "AIF3 Playback",
1833 .stream_name = "AIF3 Capture",
1844 .name = "wm5102-slim1",
1863 .name = "wm5102-slim2",
1882 .name = "wm5102-slim3",
1901 .name = "wm5102-cpu-trace",
1912 .name = "wm5102-dsp-trace",
1928 return wm_adsp_compr_open(&priv->core.adsp[0], stream); in wm5102_open()
1934 struct arizona *arizona = priv->core.arizona; in wm5102_adsp2_irq()
1937 ret = wm_adsp_compr_handle_irq(&priv->core.adsp[0]); in wm5102_adsp2_irq()
1938 if (ret == -ENODEV) { in wm5102_adsp2_irq()
1939 dev_err(arizona->dev, "Spurious compressed data IRQ\n"); in wm5102_adsp2_irq()
1950 struct arizona *arizona = priv->core.arizona; in wm5102_component_probe()
1953 snd_soc_component_init_regmap(component, arizona->regmap); in wm5102_component_probe()
1955 ret = wm_adsp2_component_probe(&priv->core.adsp[0], component); in wm5102_component_probe()
1972 priv->core.arizona->dapm = dapm; in wm5102_component_probe()
1977 wm_adsp2_component_remove(&priv->core.adsp[0], component); in wm5102_component_probe()
1986 wm_adsp2_component_remove(&priv->core.adsp[0], component); in wm5102_component_remove()
1988 priv->core.arizona->dapm = NULL; in wm5102_component_remove()
2035 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); in wm5102_probe()
2039 wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), in wm5102_probe()
2042 return -ENOMEM; in wm5102_probe()
2046 if (!dev_get_platdata(arizona->dev)) { in wm5102_probe()
2053 mutex_init(&arizona->dac_comp_lock); in wm5102_probe()
2055 wm5102->core.arizona = arizona; in wm5102_probe()
2056 wm5102->core.num_inputs = 6; in wm5102_probe()
2058 arizona_init_dvfs(&wm5102->core); in wm5102_probe()
2060 wm5102->core.adsp[0].part = "wm5102"; in wm5102_probe()
2061 wm5102->core.adsp[0].cs_dsp.num = 1; in wm5102_probe()
2062 wm5102->core.adsp[0].cs_dsp.type = WMFW_ADSP2; in wm5102_probe()
2063 wm5102->core.adsp[0].cs_dsp.base = ARIZONA_DSP1_CONTROL_1; in wm5102_probe()
2064 wm5102->core.adsp[0].cs_dsp.dev = arizona->dev; in wm5102_probe()
2065 wm5102->core.adsp[0].cs_dsp.regmap = arizona->regmap; in wm5102_probe()
2066 wm5102->core.adsp[0].cs_dsp.mem = wm5102_dsp1_regions; in wm5102_probe()
2067 wm5102->core.adsp[0].cs_dsp.num_mems = ARRAY_SIZE(wm5102_dsp1_regions); in wm5102_probe()
2069 ret = wm_adsp2_init(&wm5102->core.adsp[0]); in wm5102_probe()
2073 /* This may return -EPROBE_DEFER, so do this early on */ in wm5102_probe()
2074 ret = arizona_jack_codec_dev_probe(&wm5102->core, &pdev->dev); in wm5102_probe()
2078 for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++) in wm5102_probe()
2079 wm5102->fll[i].vco_mult = 1; in wm5102_probe()
2081 arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1, in wm5102_probe()
2083 &wm5102->fll[0]); in wm5102_probe()
2084 arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1, in wm5102_probe()
2086 &wm5102->fll[1]); in wm5102_probe()
2089 regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2, in wm5102_probe()
2091 regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3, in wm5102_probe()
2095 arizona_init_dai(&wm5102->core, i); in wm5102_probe()
2099 regmap_update_bits(arizona->regmap, wm5102_digital_vu[i], in wm5102_probe()
2102 pm_runtime_enable(&pdev->dev); in wm5102_probe()
2103 pm_runtime_idle(&pdev->dev); in wm5102_probe()
2109 dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret); in wm5102_probe()
2115 dev_warn(&pdev->dev, in wm5102_probe()
2128 ret = devm_snd_soc_register_component(&pdev->dev, in wm5102_probe()
2133 dev_err(&pdev->dev, "Failed to register component: %d\n", ret); in wm5102_probe()
2145 pm_runtime_disable(&pdev->dev); in wm5102_probe()
2146 arizona_jack_codec_dev_remove(&wm5102->core); in wm5102_probe()
2154 struct arizona *arizona = wm5102->core.arizona; in wm5102_remove()
2156 pm_runtime_disable(&pdev->dev); in wm5102_remove()
2158 wm_adsp2_remove(&wm5102->core.adsp[0]); in wm5102_remove()
2165 arizona_jack_codec_dev_remove(&wm5102->core); in wm5102_remove()
2172 .name = "wm5102-codec",
2183 MODULE_ALIAS("platform:wm5102-codec");