Lines Matching +full:bias +full:- +full:ctrl +full:- +full:value
2 * wm8985.c -- WM8985 / WM8758 ALSA SoC Audio driver
52 { 1, 0x0000 }, /* R1 - Power management 1 */
53 { 2, 0x0000 }, /* R2 - Power management 2 */
54 { 3, 0x0000 }, /* R3 - Power management 3 */
55 { 4, 0x0050 }, /* R4 - Audio Interface */
56 { 5, 0x0000 }, /* R5 - Companding control */
57 { 6, 0x0140 }, /* R6 - Clock Gen control */
58 { 7, 0x0000 }, /* R7 - Additional control */
59 { 8, 0x0000 }, /* R8 - GPIO Control */
60 { 9, 0x0000 }, /* R9 - Jack Detect Control 1 */
61 { 10, 0x0000 }, /* R10 - DAC Control */
62 { 11, 0x00FF }, /* R11 - Left DAC digital Vol */
63 { 12, 0x00FF }, /* R12 - Right DAC digital vol */
64 { 13, 0x0000 }, /* R13 - Jack Detect Control 2 */
65 { 14, 0x0100 }, /* R14 - ADC Control */
66 { 15, 0x00FF }, /* R15 - Left ADC Digital Vol */
67 { 16, 0x00FF }, /* R16 - Right ADC Digital Vol */
68 { 18, 0x012C }, /* R18 - EQ1 - low shelf */
69 { 19, 0x002C }, /* R19 - EQ2 - peak 1 */
70 { 20, 0x002C }, /* R20 - EQ3 - peak 2 */
71 { 21, 0x002C }, /* R21 - EQ4 - peak 3 */
72 { 22, 0x002C }, /* R22 - EQ5 - high shelf */
73 { 24, 0x0032 }, /* R24 - DAC Limiter 1 */
74 { 25, 0x0000 }, /* R25 - DAC Limiter 2 */
75 { 27, 0x0000 }, /* R27 - Notch Filter 1 */
76 { 28, 0x0000 }, /* R28 - Notch Filter 2 */
77 { 29, 0x0000 }, /* R29 - Notch Filter 3 */
78 { 30, 0x0000 }, /* R30 - Notch Filter 4 */
79 { 32, 0x0038 }, /* R32 - ALC control 1 */
80 { 33, 0x000B }, /* R33 - ALC control 2 */
81 { 34, 0x0032 }, /* R34 - ALC control 3 */
82 { 35, 0x0000 }, /* R35 - Noise Gate */
83 { 36, 0x0008 }, /* R36 - PLL N */
84 { 37, 0x000C }, /* R37 - PLL K 1 */
85 { 38, 0x0093 }, /* R38 - PLL K 2 */
86 { 39, 0x00E9 }, /* R39 - PLL K 3 */
87 { 41, 0x0000 }, /* R41 - 3D control */
88 { 42, 0x0000 }, /* R42 - OUT4 to ADC */
89 { 43, 0x0000 }, /* R43 - Beep control */
90 { 44, 0x0033 }, /* R44 - Input ctrl */
91 { 45, 0x0010 }, /* R45 - Left INP PGA gain ctrl */
92 { 46, 0x0010 }, /* R46 - Right INP PGA gain ctrl */
93 { 47, 0x0100 }, /* R47 - Left ADC BOOST ctrl */
94 { 48, 0x0100 }, /* R48 - Right ADC BOOST ctrl */
95 { 49, 0x0002 }, /* R49 - Output ctrl */
96 { 50, 0x0001 }, /* R50 - Left mixer ctrl */
97 { 51, 0x0001 }, /* R51 - Right mixer ctrl */
98 { 52, 0x0039 }, /* R52 - LOUT1 (HP) volume ctrl */
99 { 53, 0x0039 }, /* R53 - ROUT1 (HP) volume ctrl */
100 { 54, 0x0039 }, /* R54 - LOUT2 (SPK) volume ctrl */
101 { 55, 0x0039 }, /* R55 - ROUT2 (SPK) volume ctrl */
102 { 56, 0x0001 }, /* R56 - OUT3 mixer ctrl */
103 { 57, 0x0001 }, /* R57 - OUT4 (MONO) mix ctrl */
104 { 60, 0x0004 }, /* R60 - OUTPUT ctrl */
105 { 61, 0x0000 }, /* R61 - BIAS CTRL */
222 static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1);
223 static const DECLARE_TLV_DB_SCALE(adc_tlv, -12700, 50, 1);
224 static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0);
225 static const DECLARE_TLV_DB_SCALE(lim_thresh_tlv, -600, 100, 0);
227 static const DECLARE_TLV_DB_SCALE(alc_min_tlv, -1200, 600, 0);
228 static const DECLARE_TLV_DB_SCALE(alc_max_tlv, -675, 600, 0);
229 static const DECLARE_TLV_DB_SCALE(alc_tar_tlv, -2250, 150, 0);
230 static const DECLARE_TLV_DB_SCALE(pga_vol_tlv, -1200, 75, 0);
231 static const DECLARE_TLV_DB_SCALE(boost_tlv, -1200, 300, 1);
232 static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
233 static const DECLARE_TLV_DB_SCALE(aux_tlv, -1500, 300, 0);
234 static const DECLARE_TLV_DB_SCALE(bypass_tlv, -1500, 300, 0);
401 /* --- WM8985 only --- */
409 /* --- WM8985 only --- */
429 /* --- WM8985 only --- */
438 /* --- WM8985 only --- */
473 SND_SOC_DAPM_SUPPLY("Mic Bias", WM8985_POWER_MANAGEMENT_1, 4, 0,
506 ARRAY_SIZE(left_out_mixer) - 1),
509 ARRAY_SIZE(right_out_mixer) - 1),
513 ARRAY_SIZE(left_boost_mixer) - 1),
516 ARRAY_SIZE(right_boost_mixer) - 1),
572 switch (wm8985->dev_type) { in wm8985_add_widgets()
600 ucontrol->value.enumerated.item[0] = 1; in eqmode_get()
602 ucontrol->value.enumerated.item[0] = 0; in eqmode_get()
614 if (ucontrol->value.enumerated.item[0] != 0 in eqmode_put()
615 && ucontrol->value.enumerated.item[0] != 1) in eqmode_put()
616 return -EINVAL; in eqmode_put()
621 if (!ucontrol->value.enumerated.item[0]) in eqmode_put()
625 if (ucontrol->value.enumerated.item[0]) in eqmode_put()
642 ucontrol->value.enumerated.item[0] in eqmode_put()
657 struct snd_soc_component *component = dai->component; in wm8985_dac_mute()
669 component = dai->component; in wm8985_set_fmt()
686 dev_err(dai->dev, "Unknown dai format\n"); in wm8985_set_fmt()
687 return -EINVAL; in wm8985_set_fmt()
701 dev_err(dai->dev, "Unknown master/slave configuration\n"); in wm8985_set_fmt()
702 return -EINVAL; in wm8985_set_fmt()
715 return -EINVAL; in wm8985_set_fmt()
738 dev_err(dai->dev, "Unknown polarity configuration\n"); in wm8985_set_fmt()
739 return -EINVAL; in wm8985_set_fmt()
760 component = dai->component; in wm8985_hw_params()
763 wm8985->bclk = snd_soc_params_to_bclk(params); in wm8985_hw_params()
764 if ((int)wm8985->bclk < 0) in wm8985_hw_params()
765 return wm8985->bclk; in wm8985_hw_params()
781 dev_err(dai->dev, "Unsupported word length %u\n", in wm8985_hw_params()
783 return -EINVAL; in wm8985_hw_params()
794 srate_best = abs(srates[0] - params_rate(params)); in wm8985_hw_params()
796 if (abs(srates[i] - params_rate(params)) >= srate_best) in wm8985_hw_params()
799 srate_best = abs(srates[i] - params_rate(params)); in wm8985_hw_params()
802 dev_dbg(dai->dev, "Selected SRATE = %d\n", srates[srate_idx]); in wm8985_hw_params()
806 dev_dbg(dai->dev, "Target BCLK = %uHz\n", wm8985->bclk); in wm8985_hw_params()
807 dev_dbg(dai->dev, "SYSCLK = %uHz\n", wm8985->sysclk); in wm8985_hw_params()
810 if (wm8985->sysclk / params_rate(params) in wm8985_hw_params()
816 dev_err(dai->dev, "Unable to configure MCLK ratio %u/%u\n", in wm8985_hw_params()
817 wm8985->sysclk, params_rate(params)); in wm8985_hw_params()
818 return -EINVAL; in wm8985_hw_params()
821 dev_dbg(dai->dev, "MCLK ratio = %dfs\n", fs_ratios[i].ratio); in wm8985_hw_params()
826 tmp = (wm8985->sysclk / fs_ratios[i].div) * 10; in wm8985_hw_params()
828 if (wm8985->bclk == tmp / bclk_divs[i]) in wm8985_hw_params()
833 dev_err(dai->dev, "No matching BCLK divider found\n"); in wm8985_hw_params()
834 return -EINVAL; in wm8985_hw_params()
837 dev_dbg(dai->dev, "BCLK div = %d\n", i); in wm8985_hw_params()
856 pll_div->div2 = 0; in pll_factors()
860 pll_div->div2 = 1; in pll_factors()
865 printk(KERN_ERR "%s: WM8985 N value is not within" in pll_factors()
867 return -EINVAL; in pll_factors()
869 pll_div->n = Ndiv; in pll_factors()
880 pll_div->k = K; in pll_factors()
893 component = dai->component; in wm8985_set_pll()
927 component = dai->component; in wm8985_set_sysclk()
942 dev_err(dai->dev, "Unknown clock source %d\n", clk_id); in wm8985_set_sysclk()
943 return -EINVAL; in wm8985_set_sysclk()
946 wm8985->sysclk = freq; in wm8985_set_sysclk()
967 ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies), in wm8985_set_bias_level()
968 wm8985->supplies); in wm8985_set_bias_level()
970 dev_err(component->dev, in wm8985_set_bias_level()
976 regcache_sync(wm8985->regmap); in wm8985_set_bias_level()
978 /* enable anti-pop features */ in wm8985_set_bias_level()
996 /* disable anti-pop features */ in wm8985_set_bias_level()
1019 regcache_mark_dirty(wm8985->regmap); in wm8985_set_bias_level()
1021 regulator_bulk_disable(ARRAY_SIZE(wm8985->supplies), in wm8985_set_bias_level()
1022 wm8985->supplies); in wm8985_set_bias_level()
1037 for (i = 0; i < ARRAY_SIZE(wm8985->supplies); i++) in wm8985_probe()
1038 wm8985->supplies[i].supply = wm8985_supply_names[i]; in wm8985_probe()
1040 ret = devm_regulator_bulk_get(component->dev, ARRAY_SIZE(wm8985->supplies), in wm8985_probe()
1041 wm8985->supplies); in wm8985_probe()
1043 dev_err(component->dev, "Failed to request supplies: %d\n", ret); in wm8985_probe()
1047 ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies), in wm8985_probe()
1048 wm8985->supplies); in wm8985_probe()
1050 dev_err(component->dev, "Failed to enable supplies: %d\n", ret); in wm8985_probe()
1056 dev_err(component->dev, "Failed to issue reset: %d\n", ret); in wm8985_probe()
1073 regulator_bulk_disable(ARRAY_SIZE(wm8985->supplies), wm8985->supplies); in wm8985_probe()
1089 .name = "wm8985-hifi",
1142 wm8985 = devm_kzalloc(&spi->dev, sizeof *wm8985, GFP_KERNEL); in wm8985_spi_probe()
1144 return -ENOMEM; in wm8985_spi_probe()
1148 wm8985->dev_type = WM8985; in wm8985_spi_probe()
1150 wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap); in wm8985_spi_probe()
1151 if (IS_ERR(wm8985->regmap)) { in wm8985_spi_probe()
1152 ret = PTR_ERR(wm8985->regmap); in wm8985_spi_probe()
1153 dev_err(&spi->dev, "Failed to allocate register map: %d\n", in wm8985_spi_probe()
1158 ret = devm_snd_soc_register_component(&spi->dev, in wm8985_spi_probe()
1178 wm8985 = devm_kzalloc(&i2c->dev, sizeof *wm8985, GFP_KERNEL); in wm8985_i2c_probe()
1180 return -ENOMEM; in wm8985_i2c_probe()
1184 wm8985->dev_type = id->driver_data; in wm8985_i2c_probe()
1186 wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap); in wm8985_i2c_probe()
1187 if (IS_ERR(wm8985->regmap)) { in wm8985_i2c_probe()
1188 ret = PTR_ERR(wm8985->regmap); in wm8985_i2c_probe()
1189 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", in wm8985_i2c_probe()
1194 ret = devm_snd_soc_register_component(&i2c->dev, in wm8985_i2c_probe()