Lines Matching +full:digital +full:- +full:input +full:- +full:sink +full:- +full:range +full:- +full:high
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);
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;
88 int reg = mc->reg;
120 {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"};
222 WM8400_OUTPGA_SINGLE_R_TLV("Left DAC Digital Volume",
226 WM8400_OUTPGA_SINGLE_R_TLV("Right DAC Digital Volume",
230 SOC_ENUM("Left Digital Sidetone", wm8400_left_digital_sidetone_enum),
231 SOC_ENUM("Right Digital Sidetone", wm8400_right_digital_sidetone_enum),
233 SOC_SINGLE_TLV("Left Digital Sidetone Volume", WM8400_DIGITAL_SIDE_TONE,
235 SOC_SINGLE_TLV("Right Digital Sidetone Volume", WM8400_DIGITAL_SIDE_TONE,
238 SOC_SINGLE("ADC Digital High Pass Filter Switch", WM8400_ADC_CTRL,
243 WM8400_OUTPGA_SINGLE_R_TLV("Left ADC Digital Volume",
250 WM8400_OUTPGA_SINGLE_R_TLV("Right ADC Digital Volume",
318 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
320 (struct soc_mixer_control *)kcontrol->private_value;
321 u32 reg_shift = mc->shift;
331 ret = -1;
339 ret = -1;
347 ret = -1;
355 ret = -1;
364 static const DECLARE_TLV_DB_SCALE(in_mix_tlv, -1200, 600, 0);
551 /* Input Side */
552 /* Input Lines */
569 /* Input PGAs */
696 SND_SOC_DAPM_OUTPUT("Internal DAC Sink"),
701 {"Internal DAC Sink", NULL, "Left DAC"},
702 {"Internal DAC Sink", NULL, "Right DAC"},
709 /* Input Side */
835 struct snd_soc_component *component = codec_dai->component;
838 wm8400->sysclk = freq;
858 factors->outdiv = 2;
859 while (Fout * factors->outdiv < 90000000 ||
860 Fout * factors->outdiv > 100000000) {
861 factors->outdiv *= 2;
862 if (factors->outdiv > 32) {
863 dev_err(wm8400->wm8400->dev,
866 return -EINVAL;
869 target = Fout * factors->outdiv;
870 factors->outdiv = factors->outdiv >> 2;
873 factors->freq_ref = 1;
875 factors->freq_ref = 0;
878 factors->fratio = 9;
880 factors->fratio = 0;
885 factors->fratio--;
887 factors->fratio++;
889 if (factors->fratio < 1 || factors->fratio > 8) {
890 dev_err(wm8400->wm8400->dev,
892 return -EINVAL;
895 factors->n = target / (Fref * factors->fratio);
896 Nmod = target % (Fref * factors->fratio);
899 /* Calculate fractional part - scale up so we can round. */
902 do_div(Kpart, (Fref * factors->fratio));
909 /* Move down to proper range now rounding is done */
910 factors->k = K / 10;
912 dev_dbg(wm8400->wm8400->dev,
915 factors->n, factors->k, factors->fratio, factors->outdiv);
924 struct snd_soc_component *component = codec_dai->component;
930 if (freq_in == wm8400->fll_in && freq_out == wm8400->fll_out)
938 /* Bodge GCC 4.4.0 uninitialised variable warning - it
944 wm8400->fll_out = freq_out;
945 wm8400->fll_in = freq_in;
981 struct snd_soc_component *component = codec_dai->component;
996 return -EINVAL;
1023 return -EINVAL;
1034 struct snd_soc_component *component = codec_dai->component;
1059 return -EINVAL;
1072 struct snd_soc_component *component = dai->component;
1097 struct snd_soc_component *component = dai->component;
1132 dev_err(wm8400->wm8400->dev,
1242 .name = "wm8400-hifi",
1262 struct wm8400 *wm8400 = dev_get_platdata(component->dev);
1267 priv = devm_kzalloc(component->dev, sizeof(struct wm8400_priv),
1270 return -ENOMEM;
1272 snd_soc_component_init_regmap(component, wm8400->regmap);
1274 priv->wm8400 = wm8400;
1276 ret = devm_regulator_bulk_get(wm8400->dev,
1279 dev_err(component->dev, "Failed to get regulators: %d\n", ret);
1329 return devm_snd_soc_register_component(&pdev->dev,
1336 .name = "wm8400-codec",
1346 MODULE_ALIAS("platform:wm8400-codec");