Lines Matching +full:warn +full:- +full:soc +full:- +full:level
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.
29 #include <sound/soc.h>
224 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
279 WARN(1, "Invalid event %d\n", 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"
353 SOC_ENUM("Mic Bias Level", mic_bias_level),
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,
629 struct snd_soc_component *component = dai->component;
647 return -EINVAL;
652 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
687 return -EINVAL;
689 /* The FLL must run at 90-100MHz which is then scaled down to
705 return -EINVAL;
708 fll_div->fllclk_div = div >> 2;
711 fll_div->fll_slow_lock_ref = 1;
713 fll_div->fll_slow_lock_ref = 0;
718 fll_div->fll_ratio = 8;
720 fll_div->fll_ratio = 1;
722 fll_div->n = Ndiv / fll_div->fll_ratio;
723 Nmod = (target / fll_div->fll_ratio) % Fref;
725 /* Calculate fractional part - scale up so we can round. */
736 fll_div->k = K / 10;
738 if (WARN_ON(target != Fout * (fll_div->fllclk_div << 2)) ||
739 WARN_ON(!K && target != Fref * fll_div->fll_ratio * fll_div->n))
740 return -EINVAL;
751 if (wm8900->fll_in == freq_in && wm8900->fll_out == freq_out)
764 wm8900->fll_in = freq_in;
765 wm8900->fll_out = freq_out;
773 wm8900->fll_in = freq_in;
774 wm8900->fll_out = freq_out;
812 return wm8900_set_fll(codec_dai->component, pll_id, freq_in, freq_out);
818 struct snd_soc_component *component = codec_dai->component;
850 return -EINVAL;
860 struct snd_soc_component *component = codec_dai->component;
891 return -EINVAL;
915 return -EINVAL;
931 return -EINVAL;
955 return -EINVAL;
959 return -EINVAL;
972 struct snd_soc_component *component = codec_dai->component;
1005 .name = "wm8900-hifi",
1024 enum snd_soc_bias_level level)
1028 switch (level) {
1118 int fll_out = wm8900->fll_out;
1119 int fll_in = wm8900->fll_in;
1125 dev_err(component->dev, "Failed to stop FLL\n");
1129 wm8900->fll_out = fll_out;
1130 wm8900->fll_in = fll_in;
1144 ret = regcache_sync(wm8900->regmap);
1146 dev_err(component->dev, "Failed to restore cache: %d\n", ret);
1153 if (wm8900->fll_out) {
1154 int fll_out = wm8900->fll_out;
1155 int fll_in = wm8900->fll_in;
1157 wm8900->fll_in = 0;
1158 wm8900->fll_out = 0;
1162 dev_err(component->dev, "Failed to restart FLL\n");
1176 dev_err(component->dev, "Device is not a WM8900 - ID %x\n", reg);
1177 return -ENODEV;
1237 wm8900 = devm_kzalloc(&spi->dev, sizeof(struct wm8900_priv),
1240 return -ENOMEM;
1242 wm8900->regmap = devm_regmap_init_spi(spi, &wm8900_regmap);
1243 if (IS_ERR(wm8900->regmap))
1244 return PTR_ERR(wm8900->regmap);
1248 ret = devm_snd_soc_register_component(&spi->dev,
1268 wm8900 = devm_kzalloc(&i2c->dev, sizeof(struct wm8900_priv),
1271 return -ENOMEM;
1273 wm8900->regmap = devm_regmap_init_i2c(i2c, &wm8900_regmap);
1274 if (IS_ERR(wm8900->regmap))
1275 return PTR_ERR(wm8900->regmap);
1279 ret = devm_snd_soc_register_component(&i2c->dev,