Lines Matching +full:bypass +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm8400.c -- WM8400 ALSA Soc Audio driver
5 * Copyright 2008-11 Wolfson Microelectronics PLC.
18 #include <linux/mfd/wm8400-audio.h>
19 #include <linux/mfd/wm8400-private.h>
67 wm8400_reset_codec_reg_cache(wm8400->wm8400); in wm8400_component_reset()
70 static const DECLARE_TLV_DB_SCALE(in_pga_tlv, -1650, 3000, 0);
72 static const DECLARE_TLV_DB_SCALE(out_mix_tlv, -2100, 0, 0);
74 static const DECLARE_TLV_DB_SCALE(out_pga_tlv, -7300, 600, 0);
76 static const DECLARE_TLV_DB_SCALE(out_dac_tlv, -7163, 0, 0);
78 static const DECLARE_TLV_DB_SCALE(in_adc_tlv, -7163, 1763, 0);
80 static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
87 (struct soc_mixer_control *)kcontrol->private_value; in wm8400_outpga_put_volsw_vu()
88 int reg = mc->reg; in wm8400_outpga_put_volsw_vu()
120 {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"};
140 SOC_SINGLE_TLV("LOMIX LIN3 Bypass Volume", WM8400_OUTPUT_MIXER3,
142 SOC_SINGLE_TLV("LOMIX RIN12 PGA Bypass Volume", WM8400_OUTPUT_MIXER3,
144 SOC_SINGLE_TLV("LOMIX LIN12 PGA Bypass Volume", WM8400_OUTPUT_MIXER3,
146 SOC_SINGLE_TLV("LOMIX RIN3 Bypass Volume", WM8400_OUTPUT_MIXER5,
148 SOC_SINGLE_TLV("LOMIX AINRMUX Bypass Volume", WM8400_OUTPUT_MIXER5,
150 SOC_SINGLE_TLV("LOMIX AINLMUX Bypass Volume", WM8400_OUTPUT_MIXER5,
154 SOC_SINGLE_TLV("ROMIX RIN3 Bypass Volume", WM8400_OUTPUT_MIXER4,
156 SOC_SINGLE_TLV("ROMIX LIN12 PGA Bypass Volume", WM8400_OUTPUT_MIXER4,
158 SOC_SINGLE_TLV("ROMIX RIN12 PGA Bypass Volume", WM8400_OUTPUT_MIXER4,
160 SOC_SINGLE_TLV("ROMIX LIN3 Bypass Volume", WM8400_OUTPUT_MIXER6,
162 SOC_SINGLE_TLV("ROMIX AINLMUX Bypass Volume", WM8400_OUTPUT_MIXER6,
164 SOC_SINGLE_TLV("ROMIX AINRMUX Bypass Volume", WM8400_OUTPUT_MIXER6,
318 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in outmixer_event()
320 (struct soc_mixer_control *)kcontrol->private_value; in outmixer_event()
321 u32 reg_shift = mc->shift; in outmixer_event()
331 ret = -1; in outmixer_event()
339 ret = -1; in outmixer_event()
347 ret = -1; in outmixer_event()
355 ret = -1; in outmixer_event()
364 static const DECLARE_TLV_DB_SCALE(in_mix_tlv, -1200, 600, 0);
440 SOC_DAPM_SINGLE("LOMIX Right ADC Bypass Switch", WM8400_OUTPUT_MIXER1,
442 SOC_DAPM_SINGLE("LOMIX Left ADC Bypass Switch", WM8400_OUTPUT_MIXER1,
444 SOC_DAPM_SINGLE("LOMIX RIN3 Bypass Switch", WM8400_OUTPUT_MIXER1,
446 SOC_DAPM_SINGLE("LOMIX LIN3 Bypass Switch", WM8400_OUTPUT_MIXER1,
448 SOC_DAPM_SINGLE("LOMIX RIN12 PGA Bypass Switch", WM8400_OUTPUT_MIXER1,
450 SOC_DAPM_SINGLE("LOMIX LIN12 PGA Bypass Switch", WM8400_OUTPUT_MIXER1,
458 SOC_DAPM_SINGLE("ROMIX Left ADC Bypass Switch", WM8400_OUTPUT_MIXER2,
460 SOC_DAPM_SINGLE("ROMIX Right ADC Bypass Switch", WM8400_OUTPUT_MIXER2,
462 SOC_DAPM_SINGLE("ROMIX LIN3 Bypass Switch", WM8400_OUTPUT_MIXER2,
464 SOC_DAPM_SINGLE("ROMIX RIN3 Bypass Switch", WM8400_OUTPUT_MIXER2,
466 SOC_DAPM_SINGLE("ROMIX LIN12 PGA Bypass Switch", WM8400_OUTPUT_MIXER2,
468 SOC_DAPM_SINGLE("ROMIX RIN12 PGA Bypass Switch", WM8400_OUTPUT_MIXER2,
486 SOC_DAPM_SINGLE("LOPMIX Right Mic Bypass Switch", WM8400_LINE_MIXER1,
488 SOC_DAPM_SINGLE("LOPMIX Left Mic Bypass Switch", WM8400_LINE_MIXER1,
506 SOC_DAPM_SINGLE("ROPMIX Left Mic Bypass Switch", WM8400_LINE_MIXER2,
508 SOC_DAPM_SINGLE("ROPMIX Right Mic Bypass Switch", WM8400_LINE_MIXER2,
516 SOC_DAPM_SINGLE("OUT3MIX LIN4/RXP Bypass Switch", WM8400_OUT3_4_MIXER,
526 SOC_DAPM_SINGLE("OUT4MIX RIN4/RXP Bypass Switch", WM8400_OUT3_4_MIXER,
532 SOC_DAPM_SINGLE("SPKMIX LIN2 Bypass Switch", WM8400_SPEAKER_MIXER,
534 SOC_DAPM_SINGLE("SPKMIX LADC Bypass Switch", WM8400_SPEAKER_MIXER,
544 SOC_DAPM_SINGLE("SPKMIX RADC Bypass Switch", WM8400_SPEAKER_MIXER,
546 SOC_DAPM_SINGLE("SPKMIX RIN2 Bypass Switch", WM8400_SPEAKER_MIXER,
755 {"LOMIX", "LOMIX RIN3 Bypass Switch", "RIN3"},
756 {"LOMIX", "LOMIX LIN3 Bypass Switch", "LIN3"},
757 {"LOMIX", "LOMIX LIN12 PGA Bypass Switch", "LIN12 PGA"},
758 {"LOMIX", "LOMIX RIN12 PGA Bypass Switch", "RIN12 PGA"},
759 {"LOMIX", "LOMIX Right ADC Bypass Switch", "AIRNMUX"},
760 {"LOMIX", "LOMIX Left ADC Bypass Switch", "AILNMUX"},
764 {"ROMIX", "ROMIX RIN3 Bypass Switch", "RIN3"},
765 {"ROMIX", "ROMIX LIN3 Bypass Switch", "LIN3"},
766 {"ROMIX", "ROMIX LIN12 PGA Bypass Switch", "LIN12 PGA"},
767 {"ROMIX", "ROMIX RIN12 PGA Bypass Switch", "RIN12 PGA"},
768 {"ROMIX", "ROMIX Right ADC Bypass Switch", "AIRNMUX"},
769 {"ROMIX", "ROMIX Left ADC Bypass Switch", "AILNMUX"},
773 {"SPKMIX", "SPKMIX LIN2 Bypass Switch", "LIN2"},
774 {"SPKMIX", "SPKMIX RIN2 Bypass Switch", "RIN2"},
775 {"SPKMIX", "SPKMIX LADC Bypass Switch", "AILNMUX"},
776 {"SPKMIX", "SPKMIX RADC Bypass Switch", "AIRNMUX"},
788 {"LOPMIX", "LOPMIX Right Mic Bypass Switch", "RIN12 PGA"},
789 {"LOPMIX", "LOPMIX Left Mic Bypass Switch", "LIN12 PGA"},
793 {"OUT3MIX", "OUT3MIX LIN4/RXP Bypass Switch", "LIN4/RXN"},
798 {"OUT4MIX", "OUT4MIX RIN4/RXP Bypass Switch", "RIN4/RXP"},
806 {"ROPMIX", "ROPMIX Left Mic Bypass Switch", "LIN12 PGA"},
807 {"ROPMIX", "ROPMIX Right Mic Bypass Switch", "RIN12 PGA"},
835 struct snd_soc_component *component = codec_dai->component; in wm8400_set_dai_sysclk()
838 wm8400->sysclk = freq; in wm8400_set_dai_sysclk()
858 factors->outdiv = 2; in fll_factors()
859 while (Fout * factors->outdiv < 90000000 || in fll_factors()
860 Fout * factors->outdiv > 100000000) { in fll_factors()
861 factors->outdiv *= 2; in fll_factors()
862 if (factors->outdiv > 32) { in fll_factors()
863 dev_err(wm8400->wm8400->dev, in fll_factors()
866 return -EINVAL; in fll_factors()
869 target = Fout * factors->outdiv; in fll_factors()
870 factors->outdiv = factors->outdiv >> 2; in fll_factors()
873 factors->freq_ref = 1; in fll_factors()
875 factors->freq_ref = 0; in fll_factors()
878 factors->fratio = 9; in fll_factors()
880 factors->fratio = 0; in fll_factors()
885 factors->fratio--; in fll_factors()
887 factors->fratio++; in fll_factors()
889 if (factors->fratio < 1 || factors->fratio > 8) { in fll_factors()
890 dev_err(wm8400->wm8400->dev, in fll_factors()
892 return -EINVAL; in fll_factors()
895 factors->n = target / (Fref * factors->fratio); in fll_factors()
896 Nmod = target % (Fref * factors->fratio); in fll_factors()
899 /* Calculate fractional part - scale up so we can round. */ in fll_factors()
902 do_div(Kpart, (Fref * factors->fratio)); in fll_factors()
910 factors->k = K / 10; in fll_factors()
912 dev_dbg(wm8400->wm8400->dev, in fll_factors()
915 factors->n, factors->k, factors->fratio, factors->outdiv); in fll_factors()
924 struct snd_soc_component *component = codec_dai->component; in wm8400_set_dai_pll()
930 if (freq_in == wm8400->fll_in && freq_out == wm8400->fll_out) in wm8400_set_dai_pll()
938 /* Bodge GCC 4.4.0 uninitialised variable warning - it in wm8400_set_dai_pll()
944 wm8400->fll_out = freq_out; in wm8400_set_dai_pll()
945 wm8400->fll_in = freq_in; in wm8400_set_dai_pll()
981 struct snd_soc_component *component = codec_dai->component; in wm8400_set_dai_fmt()
996 return -EINVAL; in wm8400_set_dai_fmt()
1023 return -EINVAL; in wm8400_set_dai_fmt()
1034 struct snd_soc_component *component = codec_dai->component; in wm8400_set_dai_clkdiv()
1059 return -EINVAL; in wm8400_set_dai_clkdiv()
1072 struct snd_soc_component *component = dai->component; in wm8400_hw_params()
1097 struct snd_soc_component *component = dai->component; in wm8400_mute()
1132 dev_err(wm8400->wm8400->dev, in wm8400_set_bias_level()
1133 "Failed to enable regulators: %d\n", in wm8400_set_bias_level()
1141 /* Enable POBCTRL, SOFT_ST, VMIDTOG and BUFDCOPEN */ in wm8400_set_bias_level()
1147 /* Enable VREF & VMID at 2x50k */ in wm8400_set_bias_level()
1152 /* Enable BUFIOEN */ in wm8400_set_bias_level()
1168 /* Enable POBCTRL and SOFT_ST */ in wm8400_set_bias_level()
1172 /* Enable POBCTRL, SOFT_ST and BUFDCOPEN */ in wm8400_set_bias_level()
1181 /* Enable any disabled outputs */ in wm8400_set_bias_level()
1194 /* Enable all output discharge bits */ in wm8400_set_bias_level()
1242 .name = "wm8400-hifi",
1262 struct wm8400 *wm8400 = dev_get_platdata(component->dev); in wm8400_component_probe()
1267 priv = devm_kzalloc(component->dev, sizeof(struct wm8400_priv), in wm8400_component_probe()
1270 return -ENOMEM; in wm8400_component_probe()
1272 snd_soc_component_init_regmap(component, wm8400->regmap); in wm8400_component_probe()
1274 priv->wm8400 = wm8400; in wm8400_component_probe()
1276 ret = devm_regulator_bulk_get(wm8400->dev, in wm8400_component_probe()
1279 dev_err(component->dev, "Failed to get regulators: %d\n", ret); in wm8400_component_probe()
1329 return devm_snd_soc_register_component(&pdev->dev, in wm8400_probe()
1336 .name = "wm8400-codec",
1346 MODULE_ALIAS("platform:wm8400-codec");