Lines Matching +full:mic +full:- +full:max +full:- +full:freq

1 // SPDX-License-Identifier: GPL-2.0-only
3 * wm8737.c -- WM8737 ALSA SoC Audio driver
25 #include <sound/soc-dapm.h>
47 { 0, 0x00C3 }, /* R0 - Left PGA volume */
48 { 1, 0x00C3 }, /* R1 - Right PGA volume */
49 { 2, 0x0007 }, /* R2 - AUDIO path L */
50 { 3, 0x0007 }, /* R3 - AUDIO path R */
51 { 4, 0x0000 }, /* R4 - 3D Enhance */
52 { 5, 0x0000 }, /* R5 - ADC Control */
53 { 6, 0x0000 }, /* R6 - Power Management */
54 { 7, 0x000A }, /* R7 - Audio Format */
55 { 8, 0x0000 }, /* R8 - Clocking */
56 { 9, 0x000F }, /* R9 - MIC Preamp Control */
57 { 10, 0x0003 }, /* R10 - Misc Bias Control */
58 { 11, 0x0000 }, /* R11 - Noise Gate */
59 { 12, 0x007C }, /* R12 - ALC1 */
60 { 13, 0x0000 }, /* R13 - ALC2 */
61 { 14, 0x0032 }, /* R14 - ALC3 */
85 static const DECLARE_TLV_DB_SCALE(pga_tlv, -9750, 50, 1);
86 static const DECLARE_TLV_DB_SCALE(adc_tlv, -600, 600, 0);
87 static const DECLARE_TLV_DB_SCALE(ng_tlv, -7800, 600, 0);
88 static const DECLARE_TLV_DB_SCALE(alc_max_tlv, -1200, 600, 0);
89 static const DECLARE_TLV_DB_SCALE(alc_target_tlv, -1800, 100, 0);
148 SOC_DOUBLE_R_TLV("Mic Boost Volume", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
150 SOC_DOUBLE_R("Mic Boost Switch", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
152 SOC_DOUBLE("Mic ZC Switch", WM8737_AUDIO_PATH_L, WM8737_AUDIO_PATH_R,
162 SOC_ENUM("Mic PGA Bias", micbias_enum),
169 SOC_ENUM("3D Low Cut-off", low_3d),
170 SOC_ENUM("3D High Cut-off", high_3d),
178 SOC_SINGLE_TLV("ALC Max Gain Volume", WM8737_ALC1, 4, 7, 0, alc_max_tlv),
328 struct snd_soc_component *component = dai->component; in wm8737_hw_params()
338 if (coeff_div[i].mclk == wm8737->mclk) in wm8737_hw_params()
341 if (coeff_div[i].mclk == wm8737->mclk * 2) { in wm8737_hw_params()
348 dev_err(component->dev, "%dHz MCLK can't support %dHz\n", in wm8737_hw_params()
349 wm8737->mclk, params_rate(params)); in wm8737_hw_params()
350 return -EINVAL; in wm8737_hw_params()
368 return -EINVAL; in wm8737_hw_params()
380 int clk_id, unsigned int freq, int dir) in wm8737_set_dai_sysclk() argument
382 struct snd_soc_component *component = codec_dai->component; in wm8737_set_dai_sysclk()
387 if (freq == coeff_div[i].mclk || in wm8737_set_dai_sysclk()
388 freq == coeff_div[i].mclk * 2) { in wm8737_set_dai_sysclk()
389 wm8737->mclk = freq; in wm8737_set_dai_sysclk()
394 dev_err(component->dev, "MCLK rate %dHz not supported\n", freq); in wm8737_set_dai_sysclk()
396 return -EINVAL; in wm8737_set_dai_sysclk()
403 struct snd_soc_component *component = codec_dai->component; in wm8737_set_dai_fmt()
413 return -EINVAL; in wm8737_set_dai_fmt()
432 return -EINVAL; in wm8737_set_dai_fmt()
442 return -EINVAL; in wm8737_set_dai_fmt()
469 ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), in wm8737_set_bias_level()
470 wm8737->supplies); in wm8737_set_bias_level()
472 dev_err(component->dev, in wm8737_set_bias_level()
478 regcache_sync(wm8737->regmap); in wm8737_set_bias_level()
506 regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), in wm8737_set_bias_level()
507 wm8737->supplies); in wm8737_set_bias_level()
542 ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), in wm8737_probe()
543 wm8737->supplies); in wm8737_probe()
545 dev_err(component->dev, "Failed to enable supplies: %d\n", ret); in wm8737_probe()
551 dev_err(component->dev, "Failed to issue reset\n"); in wm8737_probe()
563 regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); in wm8737_probe()
568 regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); in wm8737_probe()
613 wm8737 = devm_kzalloc(&i2c->dev, sizeof(struct wm8737_priv), in wm8737_i2c_probe()
616 return -ENOMEM; in wm8737_i2c_probe()
618 for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++) in wm8737_i2c_probe()
619 wm8737->supplies[i].supply = wm8737_supply_names[i]; in wm8737_i2c_probe()
621 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8737->supplies), in wm8737_i2c_probe()
622 wm8737->supplies); in wm8737_i2c_probe()
624 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); in wm8737_i2c_probe()
628 wm8737->regmap = devm_regmap_init_i2c(i2c, &wm8737_regmap); in wm8737_i2c_probe()
629 if (IS_ERR(wm8737->regmap)) in wm8737_i2c_probe()
630 return PTR_ERR(wm8737->regmap); in wm8737_i2c_probe()
634 ret = devm_snd_soc_register_component(&i2c->dev, in wm8737_i2c_probe()
663 wm8737 = devm_kzalloc(&spi->dev, sizeof(struct wm8737_priv), in wm8737_spi_probe()
666 return -ENOMEM; in wm8737_spi_probe()
668 for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++) in wm8737_spi_probe()
669 wm8737->supplies[i].supply = wm8737_supply_names[i]; in wm8737_spi_probe()
671 ret = devm_regulator_bulk_get(&spi->dev, ARRAY_SIZE(wm8737->supplies), in wm8737_spi_probe()
672 wm8737->supplies); in wm8737_spi_probe()
674 dev_err(&spi->dev, "Failed to request supplies: %d\n", ret); in wm8737_spi_probe()
678 wm8737->regmap = devm_regmap_init_spi(spi, &wm8737_regmap); in wm8737_spi_probe()
679 if (IS_ERR(wm8737->regmap)) in wm8737_spi_probe()
680 return PTR_ERR(wm8737->regmap); in wm8737_spi_probe()
684 ret = devm_snd_soc_register_component(&spi->dev, in wm8737_spi_probe()