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 * wm8991.c -- WM8991 ALSA Soc Audio driver
5 * Copyright 2007-2010 Wolfson Microelectronics PLC.
23 #include <sound/soc-dapm.h>
36 { 1, 0x0000 }, /* R1 - Power Management (1) */
37 { 2, 0x6000 }, /* R2 - Power Management (2) */
38 { 3, 0x0000 }, /* R3 - Power Management (3) */
39 { 4, 0x4050 }, /* R4 - Audio Interface (1) */
40 { 5, 0x4000 }, /* R5 - Audio Interface (2) */
41 { 6, 0x01C8 }, /* R6 - Clocking (1) */
42 { 7, 0x0000 }, /* R7 - Clocking (2) */
43 { 8, 0x0040 }, /* R8 - Audio Interface (3) */
44 { 9, 0x0040 }, /* R9 - Audio Interface (4) */
45 { 10, 0x0004 }, /* R10 - DAC CTRL */
46 { 11, 0x00C0 }, /* R11 - Left DAC Digital Volume */
47 { 12, 0x00C0 }, /* R12 - Right DAC Digital Volume */
48 { 13, 0x0000 }, /* R13 - Digital Side Tone */
49 { 14, 0x0100 }, /* R14 - ADC CTRL */
50 { 15, 0x00C0 }, /* R15 - Left ADC Digital Volume */
51 { 16, 0x00C0 }, /* R16 - Right ADC Digital Volume */
53 { 18, 0x0000 }, /* R18 - GPIO CTRL 1 */
54 { 19, 0x1000 }, /* R19 - GPIO1 & GPIO2 */
55 { 20, 0x1010 }, /* R20 - GPIO3 & GPIO4 */
56 { 21, 0x1010 }, /* R21 - GPIO5 & GPIO6 */
57 { 22, 0x8000 }, /* R22 - GPIOCTRL 2 */
58 { 23, 0x0800 }, /* R23 - GPIO_POL */
59 { 24, 0x008B }, /* R24 - Left Line Input 1&2 Volume */
60 { 25, 0x008B }, /* R25 - Left Line Input 3&4 Volume */
61 { 26, 0x008B }, /* R26 - Right Line Input 1&2 Volume */
62 { 27, 0x008B }, /* R27 - Right Line Input 3&4 Volume */
63 { 28, 0x0000 }, /* R28 - Left Output Volume */
64 { 29, 0x0000 }, /* R29 - Right Output Volume */
65 { 30, 0x0066 }, /* R30 - Line Outputs Volume */
66 { 31, 0x0022 }, /* R31 - Out3/4 Volume */
67 { 32, 0x0079 }, /* R32 - Left OPGA Volume */
68 { 33, 0x0079 }, /* R33 - Right OPGA Volume */
69 { 34, 0x0003 }, /* R34 - Speaker Volume */
70 { 35, 0x0003 }, /* R35 - ClassD1 */
72 { 37, 0x0100 }, /* R37 - ClassD3 */
74 { 39, 0x0000 }, /* R39 - Input Mixer1 */
75 { 40, 0x0000 }, /* R40 - Input Mixer2 */
76 { 41, 0x0000 }, /* R41 - Input Mixer3 */
77 { 42, 0x0000 }, /* R42 - Input Mixer4 */
78 { 43, 0x0000 }, /* R43 - Input Mixer5 */
79 { 44, 0x0000 }, /* R44 - Input Mixer6 */
80 { 45, 0x0000 }, /* R45 - Output Mixer1 */
81 { 46, 0x0000 }, /* R46 - Output Mixer2 */
82 { 47, 0x0000 }, /* R47 - Output Mixer3 */
83 { 48, 0x0000 }, /* R48 - Output Mixer4 */
84 { 49, 0x0000 }, /* R49 - Output Mixer5 */
85 { 50, 0x0000 }, /* R50 - Output Mixer6 */
86 { 51, 0x0180 }, /* R51 - Out3/4 Mixer */
87 { 52, 0x0000 }, /* R52 - Line Mixer1 */
88 { 53, 0x0000 }, /* R53 - Line Mixer2 */
89 { 54, 0x0000 }, /* R54 - Speaker Mixer */
90 { 55, 0x0000 }, /* R55 - Additional Control */
91 { 56, 0x0000 }, /* R56 - AntiPOP1 */
92 { 57, 0x0000 }, /* R57 - AntiPOP2 */
93 { 58, 0x0000 }, /* R58 - MICBIAS */
95 { 60, 0x0008 }, /* R60 - PLL1 */
96 { 61, 0x0031 }, /* R61 - PLL2 */
97 { 62, 0x0026 }, /* R62 - PLL3 */
110 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(in_pga_tlv, -1650, 150, 0);
111 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(out_mix_tlv, -2100, 300, 0);
114 0x30, 0x7f, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-7300, 100, 0),
117 0x00, 0xbf, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-71625, 375, 1),
121 0x00, 0xef, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-71625, 375, 1),
125 0x00, 0x0c, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-3600, 300, 0),
133 int reg = kcontrol->private_value & 0xff;
160 {"Hi-fi mode", "Voice mode 1", "Voice mode 2", "Voice mode 3"};
258 SOC_WM899X_OUTPGA_SINGLE_R_TLV("Left DAC Digital Volume",
265 SOC_WM899X_OUTPGA_SINGLE_R_TLV("Right DAC Digital Volume",
272 SOC_ENUM("Left Digital Sidetone", wm8991_left_digital_sidetone_enum),
273 SOC_ENUM("Right Digital Sidetone", wm8991_right_digital_sidetone_enum),
275 SOC_SINGLE_TLV("Left Digital Sidetone Volume", WM8991_DIGITAL_SIDE_TONE,
278 SOC_SINGLE_TLV("Right Digital Sidetone Volume", WM8991_DIGITAL_SIDE_TONE,
282 SOC_SINGLE("ADC Digital High Pass Filter Switch", WM8991_ADC_CTRL,
287 SOC_WM899X_OUTPGA_SINGLE_R_TLV("Left ADC Digital Volume",
294 SOC_WM899X_OUTPGA_SINGLE_R_TLV("Right ADC Digital Volume",
360 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
361 u32 reg_shift = kcontrol->private_value & 0xfff;
371 ret = -1;
380 ret = -1;
389 ret = -1;
398 ret = -1;
407 static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(in_mix_tlv, -1200, 300, 1);
592 /* Input Side */
593 /* Input Lines */
615 /* Input PGAs */
734 SND_SOC_DAPM_OUTPUT("Internal DAC Sink"),
739 {"Internal DAC Sink", NULL, "Left DAC"},
740 {"Internal DAC Sink", NULL, "Right DAC"},
746 /* Input Side */
887 pll_div->div2 = 1;
890 pll_div->div2 = 0;
894 "WM8991 N value outwith recommended range! N = %d\n", Ndiv);
896 pll_div->n = Ndiv;
908 /* Move down to proper range now rounding is done */
911 pll_div->k = K;
918 struct snd_soc_component *component = codec_dai->component;
933 /* set up N , fractional mode and pre-divisor if necessary */
953 struct snd_soc_component *component = codec_dai->component;
968 return -EINVAL;
995 return -EINVAL;
1006 struct snd_soc_component *component = codec_dai->component;
1031 return -EINVAL;
1044 struct snd_soc_component *component = dai->component;
1069 struct snd_soc_component *component = dai->component;
1099 regcache_sync(wm8991->regmap);
1187 regcache_mark_dirty(wm8991->regmap);
1265 wm8991 = devm_kzalloc(&i2c->dev, sizeof(*wm8991), GFP_KERNEL);
1267 return -ENOMEM;
1269 wm8991->regmap = devm_regmap_init_i2c(i2c, &wm8991_regmap);
1270 if (IS_ERR(wm8991->regmap))
1271 return PTR_ERR(wm8991->regmap);
1275 ret = regmap_read(wm8991->regmap, WM8991_RESET, &val);
1277 dev_err(&i2c->dev, "Failed to read device ID: %d\n", ret);
1281 dev_err(&i2c->dev, "Device with ID %x is not a WM8991\n", val);
1282 return -EINVAL;
1285 ret = regmap_write(wm8991->regmap, WM8991_RESET, 0);
1287 dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret);
1291 regmap_update_bits(wm8991->regmap, WM8991_AUDIO_INTERFACE_4,
1294 regmap_update_bits(wm8991->regmap, WM8991_GPIO1_GPIO2,
1297 regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_1,
1301 regmap_update_bits(wm8991->regmap, WM8991_POWER_MANAGEMENT_2,
1304 regmap_write(wm8991->regmap, WM8991_DAC_CTRL, 0);
1305 regmap_write(wm8991->regmap, WM8991_LEFT_OUTPUT_VOLUME,
1307 regmap_write(wm8991->regmap, WM8991_RIGHT_OUTPUT_VOLUME,
1310 ret = devm_snd_soc_register_component(&i2c->dev,