Lines Matching +full:boost +full:- +full:bypass
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),
382 SOC_SINGLE_TLV("DAC Input Boost Volume", WM8900_REG_AUDIO2, 10, 4, 0,
396 SOC_SINGLE_TLV("LINPUT3 Bypass Volume", WM8900_REG_LOUTMIXCTL1, 4, 7, 0,
398 SOC_SINGLE_TLV("RINPUT3 Bypass Volume", WM8900_REG_ROUTMIXCTL1, 4, 7, 0,
400 SOC_SINGLE_TLV("Left AUX Bypass Volume", WM8900_REG_AUXOUT_CTL, 4, 7, 0,
402 SOC_SINGLE_TLV("Right AUX Bypass Volume", WM8900_REG_AUXOUT_CTL, 0, 7, 0,
414 SOC_SINGLE_TLV("IN2L Boost Volume", WM8900_REG_INBOOSTMIX1, 0, 3, 0,
416 SOC_SINGLE_TLV("IN3L Boost Volume", WM8900_REG_INBOOSTMIX1, 4, 3, 0,
418 SOC_SINGLE_TLV("IN2R Boost Volume", WM8900_REG_INBOOSTMIX2, 0, 3, 0,
420 SOC_SINGLE_TLV("IN3R Boost Volume", WM8900_REG_INBOOSTMIX2, 4, 3, 0,
422 SOC_SINGLE_TLV("Left AUX Boost Volume", WM8900_REG_AUXBOOST, 4, 3, 0,
424 SOC_SINGLE_TLV("Right AUX Boost Volume", WM8900_REG_AUXBOOST, 0, 3, 0,
441 SOC_SINGLE("LINEOUT2 LP -12dB", WM8900_REG_LOUTMIXCTL1,
447 SOC_DAPM_SINGLE("LINPUT3 Bypass Switch", WM8900_REG_LOUTMIXCTL1, 7, 1, 0),
448 SOC_DAPM_SINGLE("AUX Bypass Switch", WM8900_REG_AUXOUT_CTL, 7, 1, 0),
455 SOC_DAPM_SINGLE("RINPUT3 Bypass Switch", WM8900_REG_ROUTMIXCTL1, 7, 1, 0),
456 SOC_DAPM_SINGLE("AUX Bypass Switch", WM8900_REG_AUXOUT_CTL, 3, 1, 0),
600 {"Left Output Mixer", "LINPUT3 Bypass Switch", "LINPUT3"},
601 {"Left Output Mixer", "AUX Bypass Switch", "AUX"},
606 {"Right Output Mixer", "RINPUT3 Bypass Switch", "RINPUT3"},
607 {"Right Output Mixer", "AUX Bypass Switch", "AUX"},
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()
891 return -EINVAL; in wm8900_set_dai_fmt()
915 return -EINVAL; in wm8900_set_dai_fmt()
931 return -EINVAL; in wm8900_set_dai_fmt()
955 return -EINVAL; in wm8900_set_dai_fmt()
959 return -EINVAL; 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()
1238 wm8900 = devm_kzalloc(&spi->dev, sizeof(struct wm8900_priv), in wm8900_spi_probe()
1241 return -ENOMEM; in wm8900_spi_probe()
1243 wm8900->regmap = devm_regmap_init_spi(spi, &wm8900_regmap); in wm8900_spi_probe()
1244 if (IS_ERR(wm8900->regmap)) in wm8900_spi_probe()
1245 return PTR_ERR(wm8900->regmap); in wm8900_spi_probe()
1249 ret = devm_snd_soc_register_component(&spi->dev, in wm8900_spi_probe()
1276 wm8900 = devm_kzalloc(&i2c->dev, sizeof(struct wm8900_priv), in wm8900_i2c_probe()
1279 return -ENOMEM; in wm8900_i2c_probe()
1281 wm8900->regmap = devm_regmap_init_i2c(i2c, &wm8900_regmap); in wm8900_i2c_probe()
1282 if (IS_ERR(wm8900->regmap)) in wm8900_i2c_probe()
1283 return PTR_ERR(wm8900->regmap); in wm8900_i2c_probe()
1287 ret = devm_snd_soc_register_component(&i2c->dev, in wm8900_i2c_probe()