• Home
  • Raw
  • Download

Lines Matching +full:dsp +full:- +full:aif2 +full:- +full:lrclk

2  * wm8995.c  --  WM8995 ALSA SoC Audio driver
29 #include <sound/soc-dapm.h>
403 regcache_mark_dirty(wm8995->regmap); \
417 static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1);
418 static const DECLARE_TLV_DB_SCALE(in1lr_pga_tlv, -1650, 150, 0);
420 static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 150, 0);
423 "Differential", "Single-ended IN1LN", "Single-ended IN1LP"
430 "Differential", "Single-ended IN1RN", "Single-ended IN1RP"
498 dev_dbg(component->dev, "Class W source AIF2DAC\n"); in wm8995_update_class_w()
502 dev_dbg(component->dev, "Class W source AIF1DAC2\n"); in wm8995_update_class_w()
506 dev_dbg(component->dev, "Class W source AIF1DAC1\n"); in wm8995_update_class_w()
510 dev_dbg(component->dev, "DAC mixer setting: %x\n", reg); in wm8995_update_class_w()
517 dev_dbg(component->dev, "Left and right DAC mixers different\n"); in wm8995_update_class_w()
522 dev_dbg(component->dev, "Class W enabled\n"); in wm8995_update_class_w()
528 dev_dbg(component->dev, "Class W disabled\n"); in wm8995_update_class_w()
537 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_clk_sys()
547 return !strcmp(source->name, clk); in check_clk_sys()
564 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in hp_supply_event()
596 dev_dbg(component->dev, "%s: reg = %#x, val = %#x, mask = %#x\n", in dc_servo_cmd()
600 while (timeout--) { in dc_servo_cmd()
607 dev_err(component->dev, "Timed out waiting for DC Servo\n"); in dc_servo_cmd()
613 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in hp_event()
686 switch (wm8995->sysclk[aif]) { in configure_aif_clock()
688 rate = wm8995->mclk[0]; in configure_aif_clock()
692 rate = wm8995->mclk[1]; in configure_aif_clock()
696 rate = wm8995->fll[0].out; in configure_aif_clock()
700 rate = wm8995->fll[1].out; in configure_aif_clock()
703 return -EINVAL; in configure_aif_clock()
710 dev_dbg(component->dev, "Dividing AIF%d clock to %dHz\n", in configure_aif_clock()
714 wm8995->aifclk[aif] = rate; in configure_aif_clock()
742 if (wm8995->aifclk[0] == wm8995->aifclk[1]) in configure_clock()
745 if (wm8995->aifclk[0] < wm8995->aifclk[1]) in configure_clock()
763 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in clk_sys_event()
794 SOC_DAPM_SINGLE("AIF2 Switch", WM8995_AIF1_ADC1_LEFT_MIXER_ROUTING,
801 SOC_DAPM_SINGLE("AIF2 Switch", WM8995_AIF1_ADC1_RIGHT_MIXER_ROUTING,
808 SOC_DAPM_SINGLE("AIF2 Switch", WM8995_AIF1_ADC2_LEFT_MIXER_ROUTING,
815 SOC_DAPM_SINGLE("AIF2 Switch", WM8995_AIF1_ADC2_RIGHT_MIXER_ROUTING,
824 WM8995_CLASS_W_SWITCH("AIF2 Switch", WM8995_DAC1_LEFT_MIXER_ROUTING,
837 WM8995_CLASS_W_SWITCH("AIF2 Switch", WM8995_DAC1_RIGHT_MIXER_ROUTING,
850 SOC_DAPM_SINGLE("AIF2 Switch", WM8995_DAC2_LEFT_MIXER_ROUTING,
863 SOC_DAPM_SINGLE("AIF2 Switch", WM8995_DAC2_RIGHT_MIXER_ROUTING,
1130 /* DAC2/AIF2 outputs */
1425 struct snd_soc_component *component = dai->component; in wm8995_aif_mute()
1428 switch (dai->id) { in wm8995_aif_mute()
1436 return -EINVAL; in wm8995_aif_mute()
1450 component = dai->component; in wm8995_set_dai_fmt()
1460 dev_err(dai->dev, "Unknown master/slave configuration\n"); in wm8995_set_dai_fmt()
1461 return -EINVAL; in wm8995_set_dai_fmt()
1481 dev_err(dai->dev, "Unknown dai format\n"); in wm8995_set_dai_fmt()
1482 return -EINVAL; in wm8995_set_dai_fmt()
1488 /* frame inversion not valid for DSP modes */ in wm8995_set_dai_fmt()
1496 return -EINVAL; in wm8995_set_dai_fmt()
1516 return -EINVAL; in wm8995_set_dai_fmt()
1520 return -EINVAL; in wm8995_set_dai_fmt()
1538 -1 /* reserved */,
1558 int lrclk, bclk; in wm8995_hw_params() local
1561 component = dai->component; in wm8995_hw_params()
1564 switch (dai->id) { in wm8995_hw_params()
1569 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK /* || in wm8995_hw_params()
1570 wm8995->lrclk_shared[0] */) { in wm8995_hw_params()
1574 dev_dbg(component->dev, "AIF1 using split LRCLK\n"); in wm8995_hw_params()
1581 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK /* || in wm8995_hw_params()
1582 wm8995->lrclk_shared[1] */) { in wm8995_hw_params()
1586 dev_dbg(component->dev, "AIF2 using split LRCLK\n"); in wm8995_hw_params()
1590 return -EINVAL; in wm8995_hw_params()
1611 dev_err(dai->dev, "Unsupported word length %u\n", in wm8995_hw_params()
1613 return -EINVAL; in wm8995_hw_params()
1621 dev_err(dai->dev, "Sample rate %d is not supported\n", in wm8995_hw_params()
1623 return -EINVAL; in wm8995_hw_params()
1627 dev_dbg(dai->dev, "Sample rate is %dHz\n", srs[i]); in wm8995_hw_params()
1628 dev_dbg(dai->dev, "AIF%dCLK is %dHz, target BCLK %dHz\n", in wm8995_hw_params()
1629 dai->id + 1, wm8995->aifclk[dai->id], bclk_rate); in wm8995_hw_params()
1634 - wm8995->aifclk[dai->id]); in wm8995_hw_params()
1637 - wm8995->aifclk[dai->id]); in wm8995_hw_params()
1645 dev_dbg(dai->dev, "Selected AIF%dCLK/fs = %d\n", in wm8995_hw_params()
1646 dai->id + 1, fs_ratios[best]); in wm8995_hw_params()
1657 cur_val = (wm8995->aifclk[dai->id] * 10 / bclk_divs[i]) - bclk_rate; in wm8995_hw_params()
1664 bclk_rate = wm8995->aifclk[dai->id] * 10 / bclk_divs[best]; in wm8995_hw_params()
1665 dev_dbg(dai->dev, "Using BCLK_DIV %d for actual BCLK %dHz\n", in wm8995_hw_params()
1668 lrclk = bclk_rate / params_rate(params); in wm8995_hw_params()
1669 dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", in wm8995_hw_params()
1670 lrclk, bclk_rate / lrclk); in wm8995_hw_params()
1677 WM8995_AIF1DAC_RATE_MASK, lrclk); in wm8995_hw_params()
1686 struct snd_soc_component *component = codec_dai->component; in wm8995_set_tristate()
1689 switch (codec_dai->id) { in wm8995_set_tristate()
1703 return -EINVAL; in wm8995_set_tristate()
1735 fll->clk_ref_div = 0; in wm8995_get_fll_config()
1737 fll->clk_ref_div++; in wm8995_get_fll_config()
1740 if (fll->clk_ref_div > 3) in wm8995_get_fll_config()
1741 return -EINVAL; in wm8995_get_fll_config()
1743 pr_debug("CLK_REF_DIV=%d, Fref=%dHz\n", fll->clk_ref_div, freq_in); in wm8995_get_fll_config()
1746 fll->outdiv = 3; in wm8995_get_fll_config()
1747 while (freq_out * (fll->outdiv + 1) < 90000000) { in wm8995_get_fll_config()
1748 fll->outdiv++; in wm8995_get_fll_config()
1749 if (fll->outdiv > 63) in wm8995_get_fll_config()
1750 return -EINVAL; in wm8995_get_fll_config()
1752 freq_out *= fll->outdiv + 1; in wm8995_get_fll_config()
1753 pr_debug("OUTDIV=%d, Fvco=%dHz\n", fll->outdiv, freq_out); in wm8995_get_fll_config()
1756 fll->fll_fratio = 0; in wm8995_get_fll_config()
1758 fll->fll_fratio = 1; in wm8995_get_fll_config()
1761 fll->fll_fratio = 2; in wm8995_get_fll_config()
1764 fll->fll_fratio = 3; in wm8995_get_fll_config()
1767 fll->fll_fratio = 4; in wm8995_get_fll_config()
1770 pr_debug("FLL_FRATIO=%d, Fref=%dHz\n", fll->fll_fratio, freq_in); in wm8995_get_fll_config()
1775 fll->n = Ndiv; in wm8995_get_fll_config()
1779 /* Calculate fractional part - scale up so we can round. */ in wm8995_get_fll_config()
1790 fll->k = K / 10; in wm8995_get_fll_config()
1792 pr_debug("N=%x K=%x\n", fll->n, fll->k); in wm8995_get_fll_config()
1805 u16 reg, aif1, aif2; in wm8995_set_fll() local
1807 component = dai->component; in wm8995_set_fll()
1813 aif2 = snd_soc_component_read32(component, WM8995_AIF2_CLOCKING_1) in wm8995_set_fll()
1826 return -EINVAL; in wm8995_set_fll()
1833 return -EINVAL; in wm8995_set_fll()
1841 return -EINVAL; in wm8995_set_fll()
1845 if (wm8995->fll[id].src == src && in wm8995_set_fll()
1846 wm8995->fll[id].in == freq_in && wm8995->fll[id].out == freq_out) in wm8995_set_fll()
1849 /* If we're stopping the FLL redo the old config - no in wm8995_set_fll()
1856 ret = wm8995_get_fll_config(&fll, wm8995->fll[id].in, in wm8995_set_fll()
1857 wm8995->fll[id].out); in wm8995_set_fll()
1887 (src - 1)); in wm8995_set_fll()
1893 wm8995->fll[id].in = freq_in; in wm8995_set_fll()
1894 wm8995->fll[id].out = freq_out; in wm8995_set_fll()
1895 wm8995->fll[id].src = src; in wm8995_set_fll()
1901 WM8995_AIF2CLK_ENA_MASK, aif2); in wm8995_set_fll()
1914 component = dai->component; in wm8995_set_dai_sysclk()
1917 switch (dai->id) { in wm8995_set_dai_sysclk()
1923 return -EINVAL; in wm8995_set_dai_sysclk()
1928 wm8995->sysclk[dai->id] = WM8995_SYSCLK_MCLK1; in wm8995_set_dai_sysclk()
1929 wm8995->mclk[0] = freq; in wm8995_set_dai_sysclk()
1930 dev_dbg(dai->dev, "AIF%d using MCLK1 at %uHz\n", in wm8995_set_dai_sysclk()
1931 dai->id + 1, freq); in wm8995_set_dai_sysclk()
1934 wm8995->sysclk[dai->id] = WM8995_SYSCLK_MCLK2; in wm8995_set_dai_sysclk()
1935 wm8995->mclk[1] = freq; in wm8995_set_dai_sysclk()
1936 dev_dbg(dai->dev, "AIF%d using MCLK2 at %uHz\n", in wm8995_set_dai_sysclk()
1937 dai->id + 1, freq); in wm8995_set_dai_sysclk()
1940 wm8995->sysclk[dai->id] = WM8995_SYSCLK_FLL1; in wm8995_set_dai_sysclk()
1941 dev_dbg(dai->dev, "AIF%d using FLL1\n", dai->id + 1); in wm8995_set_dai_sysclk()
1944 wm8995->sysclk[dai->id] = WM8995_SYSCLK_FLL2; in wm8995_set_dai_sysclk()
1945 dev_dbg(dai->dev, "AIF%d using FLL2\n", dai->id + 1); in wm8995_set_dai_sysclk()
1949 dev_err(dai->dev, "Unknown clock source %d\n", clk_id); in wm8995_set_dai_sysclk()
1950 return -EINVAL; in wm8995_set_dai_sysclk()
1971 ret = regulator_bulk_enable(ARRAY_SIZE(wm8995->supplies), in wm8995_set_bias_level()
1972 wm8995->supplies); in wm8995_set_bias_level()
1976 ret = regcache_sync(wm8995->regmap); in wm8995_set_bias_level()
1978 dev_err(component->dev, in wm8995_set_bias_level()
1990 regulator_bulk_disable(ARRAY_SIZE(wm8995->supplies), in wm8995_set_bias_level()
1991 wm8995->supplies); in wm8995_set_bias_level()
2005 for (i = 0; i < ARRAY_SIZE(wm8995->supplies); ++i) in wm8995_remove()
2006 regulator_unregister_notifier(wm8995->supplies[i].consumer, in wm8995_remove()
2007 &wm8995->disable_nb[i]); in wm8995_remove()
2009 regulator_bulk_free(ARRAY_SIZE(wm8995->supplies), wm8995->supplies); in wm8995_remove()
2019 wm8995->component = component; in wm8995_probe()
2021 for (i = 0; i < ARRAY_SIZE(wm8995->supplies); i++) in wm8995_probe()
2022 wm8995->supplies[i].supply = wm8995_supply_names[i]; in wm8995_probe()
2024 ret = regulator_bulk_get(component->dev, ARRAY_SIZE(wm8995->supplies), in wm8995_probe()
2025 wm8995->supplies); in wm8995_probe()
2027 dev_err(component->dev, "Failed to request supplies: %d\n", ret); in wm8995_probe()
2031 wm8995->disable_nb[0].notifier_call = wm8995_regulator_event_0; in wm8995_probe()
2032 wm8995->disable_nb[1].notifier_call = wm8995_regulator_event_1; in wm8995_probe()
2033 wm8995->disable_nb[2].notifier_call = wm8995_regulator_event_2; in wm8995_probe()
2034 wm8995->disable_nb[3].notifier_call = wm8995_regulator_event_3; in wm8995_probe()
2035 wm8995->disable_nb[4].notifier_call = wm8995_regulator_event_4; in wm8995_probe()
2036 wm8995->disable_nb[5].notifier_call = wm8995_regulator_event_5; in wm8995_probe()
2037 wm8995->disable_nb[6].notifier_call = wm8995_regulator_event_6; in wm8995_probe()
2038 wm8995->disable_nb[7].notifier_call = wm8995_regulator_event_7; in wm8995_probe()
2041 for (i = 0; i < ARRAY_SIZE(wm8995->supplies); i++) { in wm8995_probe()
2042 ret = regulator_register_notifier(wm8995->supplies[i].consumer, in wm8995_probe()
2043 &wm8995->disable_nb[i]); in wm8995_probe()
2045 dev_err(component->dev, in wm8995_probe()
2051 ret = regulator_bulk_enable(ARRAY_SIZE(wm8995->supplies), in wm8995_probe()
2052 wm8995->supplies); in wm8995_probe()
2054 dev_err(component->dev, "Failed to enable supplies: %d\n", ret); in wm8995_probe()
2060 dev_err(component->dev, "Failed to read device ID: %d\n", ret); in wm8995_probe()
2065 dev_err(component->dev, "Invalid device ID: %#x\n", ret); in wm8995_probe()
2066 ret = -EINVAL; in wm8995_probe()
2072 dev_err(component->dev, "Failed to issue reset: %d\n", ret); in wm8995_probe()
2101 regulator_bulk_disable(ARRAY_SIZE(wm8995->supplies), wm8995->supplies); in wm8995_probe()
2103 regulator_bulk_free(ARRAY_SIZE(wm8995->supplies), wm8995->supplies); in wm8995_probe()
2134 .name = "wm8995-aif1",
2152 .name = "wm8995-aif2",
2154 .stream_name = "AIF2 Playback",
2161 .stream_name = "AIF2 Capture",
2170 .name = "wm8995-aif3",
2222 wm8995 = devm_kzalloc(&spi->dev, sizeof(*wm8995), GFP_KERNEL); in wm8995_spi_probe()
2224 return -ENOMEM; in wm8995_spi_probe()
2228 wm8995->regmap = devm_regmap_init_spi(spi, &wm8995_regmap); in wm8995_spi_probe()
2229 if (IS_ERR(wm8995->regmap)) { in wm8995_spi_probe()
2230 ret = PTR_ERR(wm8995->regmap); in wm8995_spi_probe()
2231 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret); in wm8995_spi_probe()
2235 ret = devm_snd_soc_register_component(&spi->dev, in wm8995_spi_probe()
2256 wm8995 = devm_kzalloc(&i2c->dev, sizeof(*wm8995), GFP_KERNEL); in wm8995_i2c_probe()
2258 return -ENOMEM; in wm8995_i2c_probe()
2262 wm8995->regmap = devm_regmap_init_i2c(i2c, &wm8995_regmap); in wm8995_i2c_probe()
2263 if (IS_ERR(wm8995->regmap)) { in wm8995_i2c_probe()
2264 ret = PTR_ERR(wm8995->regmap); in wm8995_i2c_probe()
2265 dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret); in wm8995_i2c_probe()
2269 ret = devm_snd_soc_register_component(&i2c->dev, in wm8995_i2c_probe()
2273 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); in wm8995_i2c_probe()