Lines Matching +full:aif1 +full:- +full:pins

1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8900.c -- WM8900 ALSA Soc Audio driver
10 * - Tristating.
11 * - TDM.
12 * - Jack detect.
13 * - FLL source configuration, currently only MCLK is supported.
224 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in wm8900_hp_event()
286 static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -5700, 100, 0);
288 static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -1500, 300, 0);
290 static const DECLARE_TLV_DB_SCALE(in_boost_tlv, -1200, 600, 0);
292 static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1200, 100, 0);
296 static const DECLARE_TLV_DB_SCALE(dac_tlv, -7200, 75, 1);
298 static const DECLARE_TLV_DB_SCALE(adc_svol_tlv, -3600, 300, 0);
300 static const DECLARE_TLV_DB_SCALE(adc_tlv, -7200, 75, 1);
320 "Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"
369 SOC_SINGLE("DAC Sigma-Delta Modulator Clock Switch", WM8900_REG_DACCTRL,
373 SOC_ENUM("ADC HPF Cut-Off", adc_hpf_cut),
441 SOC_SINGLE("LINEOUT2 LP -12dB", WM8900_REG_LOUTMIXCTL1,
498 /* Externally visible pins */
629 struct snd_soc_component *component = dai->component; in wm8900_hw_params()
647 return -EINVAL; in wm8900_hw_params()
652 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in wm8900_hw_params()
687 return -EINVAL; in fll_factors()
689 /* The FLL must run at 90-100MHz which is then scaled down to in fll_factors()
705 return -EINVAL; in fll_factors()
708 fll_div->fllclk_div = div >> 2; in fll_factors()
711 fll_div->fll_slow_lock_ref = 1; in fll_factors()
713 fll_div->fll_slow_lock_ref = 0; in fll_factors()
718 fll_div->fll_ratio = 8; in fll_factors()
720 fll_div->fll_ratio = 1; in fll_factors()
722 fll_div->n = Ndiv / fll_div->fll_ratio; in fll_factors()
723 Nmod = (target / fll_div->fll_ratio) % Fref; in fll_factors()
725 /* Calculate fractional part - scale up so we can round. */ in fll_factors()
736 fll_div->k = K / 10; in fll_factors()
738 if (WARN_ON(target != Fout * (fll_div->fllclk_div << 2)) || in fll_factors()
739 WARN_ON(!K && target != Fref * fll_div->fll_ratio * fll_div->n)) in fll_factors()
740 return -EINVAL; in fll_factors()
751 if (wm8900->fll_in == freq_in && wm8900->fll_out == freq_out) in wm8900_set_fll()
764 wm8900->fll_in = freq_in; in wm8900_set_fll()
765 wm8900->fll_out = freq_out; in wm8900_set_fll()
773 wm8900->fll_in = freq_in; in wm8900_set_fll()
774 wm8900->fll_out = freq_out; in wm8900_set_fll()
812 return wm8900_set_fll(codec_dai->component, pll_id, freq_in, freq_out); in wm8900_set_dai_pll()
818 struct snd_soc_component *component = codec_dai->component; in wm8900_set_dai_clkdiv()
850 return -EINVAL; in wm8900_set_dai_clkdiv()
860 struct snd_soc_component *component = codec_dai->component; in wm8900_set_dai_fmt()
861 unsigned int clocking1, aif1, aif3, aif4; in wm8900_set_dai_fmt() local
864 aif1 = snd_soc_component_read(component, WM8900_REG_AUDIO1); in wm8900_set_dai_fmt()
891 return -EINVAL; in wm8900_set_dai_fmt()
896 aif1 |= WM8900_REG_AUDIO1_AIF_FMT_MASK; in wm8900_set_dai_fmt()
897 aif1 &= ~WM8900_REG_AUDIO1_LRCLK_INV; in wm8900_set_dai_fmt()
900 aif1 |= WM8900_REG_AUDIO1_AIF_FMT_MASK; in wm8900_set_dai_fmt()
901 aif1 |= WM8900_REG_AUDIO1_LRCLK_INV; in wm8900_set_dai_fmt()
904 aif1 &= ~WM8900_REG_AUDIO1_AIF_FMT_MASK; in wm8900_set_dai_fmt()
905 aif1 |= 0x10; in wm8900_set_dai_fmt()
908 aif1 &= ~WM8900_REG_AUDIO1_AIF_FMT_MASK; in wm8900_set_dai_fmt()
911 aif1 &= ~WM8900_REG_AUDIO1_AIF_FMT_MASK; in wm8900_set_dai_fmt()
912 aif1 |= 0x8; in wm8900_set_dai_fmt()
915 return -EINVAL; in wm8900_set_dai_fmt()
925 aif1 &= ~WM8900_REG_AUDIO1_BCLK_INV; in wm8900_set_dai_fmt()
928 aif1 |= WM8900_REG_AUDIO1_BCLK_INV; in wm8900_set_dai_fmt()
931 return -EINVAL; in wm8900_set_dai_fmt()
939 aif1 &= ~WM8900_REG_AUDIO1_BCLK_INV; in wm8900_set_dai_fmt()
940 aif1 &= ~WM8900_REG_AUDIO1_LRCLK_INV; in wm8900_set_dai_fmt()
943 aif1 |= WM8900_REG_AUDIO1_BCLK_INV; in wm8900_set_dai_fmt()
944 aif1 |= WM8900_REG_AUDIO1_LRCLK_INV; in wm8900_set_dai_fmt()
947 aif1 |= WM8900_REG_AUDIO1_BCLK_INV; in wm8900_set_dai_fmt()
948 aif1 &= ~WM8900_REG_AUDIO1_LRCLK_INV; in wm8900_set_dai_fmt()
951 aif1 &= ~WM8900_REG_AUDIO1_BCLK_INV; in wm8900_set_dai_fmt()
952 aif1 |= WM8900_REG_AUDIO1_LRCLK_INV; in wm8900_set_dai_fmt()
955 return -EINVAL; in wm8900_set_dai_fmt()
959 return -EINVAL; in wm8900_set_dai_fmt()
963 snd_soc_component_write(component, WM8900_REG_AUDIO1, aif1); in wm8900_set_dai_fmt()
972 struct snd_soc_component *component = codec_dai->component; in wm8900_mute()
1005 .name = "wm8900-hifi",
1118 int fll_out = wm8900->fll_out; in wm8900_suspend()
1119 int fll_in = wm8900->fll_in; in wm8900_suspend()
1125 dev_err(component->dev, "Failed to stop FLL\n"); in wm8900_suspend()
1129 wm8900->fll_out = fll_out; in wm8900_suspend()
1130 wm8900->fll_in = fll_in; in wm8900_suspend()
1144 ret = regcache_sync(wm8900->regmap); in wm8900_resume()
1146 dev_err(component->dev, "Failed to restore cache: %d\n", ret); in wm8900_resume()
1153 if (wm8900->fll_out) { in wm8900_resume()
1154 int fll_out = wm8900->fll_out; in wm8900_resume()
1155 int fll_in = wm8900->fll_in; in wm8900_resume()
1157 wm8900->fll_in = 0; in wm8900_resume()
1158 wm8900->fll_out = 0; in wm8900_resume()
1162 dev_err(component->dev, "Failed to restart FLL\n"); in wm8900_resume()
1176 dev_err(component->dev, "Device is not a WM8900 - ID %x\n", reg); in wm8900_probe()
1177 return -ENODEV; in wm8900_probe()
1237 wm8900 = devm_kzalloc(&spi->dev, sizeof(struct wm8900_priv), in wm8900_spi_probe()
1240 return -ENOMEM; in wm8900_spi_probe()
1242 wm8900->regmap = devm_regmap_init_spi(spi, &wm8900_regmap); in wm8900_spi_probe()
1243 if (IS_ERR(wm8900->regmap)) in wm8900_spi_probe()
1244 return PTR_ERR(wm8900->regmap); in wm8900_spi_probe()
1248 ret = devm_snd_soc_register_component(&spi->dev, in wm8900_spi_probe()
1268 wm8900 = devm_kzalloc(&i2c->dev, sizeof(struct wm8900_priv), in wm8900_i2c_probe()
1271 return -ENOMEM; in wm8900_i2c_probe()
1273 wm8900->regmap = devm_regmap_init_i2c(i2c, &wm8900_regmap); in wm8900_i2c_probe()
1274 if (IS_ERR(wm8900->regmap)) in wm8900_i2c_probe()
1275 return PTR_ERR(wm8900->regmap); in wm8900_i2c_probe()
1279 ret = devm_snd_soc_register_component(&i2c->dev, in wm8900_i2c_probe()