Lines Matching +full:boost +full:- +full:bypass

1 // SPDX-License-Identifier: GPL-2.0-only
3 * nau8810.c -- NAU8810 ALSA Soc Audio driver
169 struct soc_bytes_ext *params = (void *)kcontrol->private_value; in nau8810_eq_get()
173 val = (u16 *)ucontrol->value.bytes.data; in nau8810_eq_get()
175 for (i = 0; i < params->max / sizeof(u16); i++) { in nau8810_eq_get()
176 regmap_read(nau8810->regmap, reg + i, &reg_val); in nau8810_eq_get()
177 /* conversion of 16-bit integers between native CPU format in nau8810_eq_get()
189 * cut-off frequency, bandwidth control, and equalizer path.
200 struct soc_bytes_ext *params = (void *)kcontrol->private_value; in nau8810_eq_put()
205 data = kmemdup(ucontrol->value.bytes.data, in nau8810_eq_put()
206 params->max, GFP_KERNEL | GFP_DMA); in nau8810_eq_put()
208 return -ENOMEM; in nau8810_eq_put()
212 for (i = 0; i < params->max / sizeof(u16); i++) { in nau8810_eq_put()
213 /* conversion of 16-bit integers between native CPU format in nau8810_eq_put()
217 ret = regmap_write(nau8810->regmap, reg + i, value); in nau8810_eq_put()
219 dev_err(component->dev, "EQ configuration fail, register: %x ret: %d\n", in nau8810_eq_put()
231 "Off", "NC", "u-law", "A-law" };
260 static const DECLARE_TLV_DB_SCALE(digital_tlv, -12750, 50, 1);
261 static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
262 static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1200, 75, 0);
263 static const DECLARE_TLV_DB_SCALE(spk_tlv, -5700, 100, 0);
268 SOC_ENUM("DAC De-emphasis", nau8810_deemp_enum),
308 SOC_SINGLE("DAC Limiter Boost", NAU8810_REG_DACLIM2,
345 SOC_SINGLE("Capture Boost(+20dB)", NAU8810_REG_ADCBOOST,
358 SOC_DAPM_SINGLE("AUX Bypass Switch", NAU8810_REG_SPKMIX,
360 SOC_DAPM_SINGLE("Line Bypass Switch", NAU8810_REG_SPKMIX,
368 SOC_DAPM_SINGLE("AUX Bypass Switch", NAU8810_REG_MONOMIX,
370 SOC_DAPM_SINGLE("Line Bypass Switch", NAU8810_REG_MONOMIX,
404 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_mclk_select_pll()
408 regmap_read(nau8810->regmap, NAU8810_REG_CLOCK, &value); in check_mclk_select_pll()
416 snd_soc_dapm_to_component(source->dapm); in check_mic_enabled()
420 regmap_read(nau8810->regmap, NAU8810_REG_INPUT_SIGNAL, &value); in check_mic_enabled()
423 regmap_read(nau8810->regmap, NAU8810_REG_ADCBOOST, &value); in check_mic_enabled()
450 SND_SOC_DAPM_MIXER("Input Boost Stage", NAU8810_REG_POWER2,
476 {"Mono Mixer", "AUX Bypass Switch", "AUX Input"},
478 {"Mono Mixer", "Line Bypass Switch", "Input Boost Stage"},
481 {"Speaker Mixer", "AUX Bypass Switch", "AUX Input"},
483 {"Speaker Mixer", "Line Bypass Switch", "Input Boost Stage"},
493 /* Input Boost Stage */
494 {"ADC", NULL, "Input Boost Stage"},
496 {"Input Boost Stage", "AUX PGA Switch", "AUX Input"},
497 {"Input Boost Stage", "PGA Mute Switch", "Input PGA"},
498 {"Input Boost Stage", "PMIC PGA Switch", "MICP"},
515 struct snd_soc_component *component = dai->component; in nau8810_set_sysclk()
518 nau8810->clk_id = clk_id; in nau8810_set_sysclk()
519 nau8810->sysclk = freq; in nau8810_set_sysclk()
520 dev_dbg(nau8810->dev, "master sysclk %dHz, source %s\n", in nau8810_set_sysclk()
533 return -EINVAL; in nau8810_calc_pll()
547 return -EINVAL; in nau8810_calc_pll()
548 pll_param->mclk_scaler = scal_sel; in nau8810_calc_pll()
551 /* Calculate the PLL 4-bit integer input and the PLL 24-bit fractional in nau8810_calc_pll()
555 pll_param->pre_factor = 0; in nau8810_calc_pll()
558 pll_param->pre_factor = 1; in nau8810_calc_pll()
560 pll_param->pll_int = (pll_ratio >> 28) & 0xF; in nau8810_calc_pll()
561 pll_param->pll_frac = ((pll_ratio & 0xFFFFFFF) >> 4); in nau8810_calc_pll()
569 struct snd_soc_component *component = codec_dai->component; in nau8810_set_pll()
571 struct regmap *map = nau8810->regmap; in nau8810_set_pll()
572 struct nau8810_pll *pll_param = &nau8810->pll; in nau8810_set_pll()
578 dev_err(nau8810->dev, "Unsupported input clock %d\n", freq_in); in nau8810_set_pll()
581 dev_info(nau8810->dev, "pll_int=%x pll_frac=%x mclk_scaler=%x pre_factor=%x\n", in nau8810_set_pll()
582 pll_param->pll_int, pll_param->pll_frac, pll_param->mclk_scaler, in nau8810_set_pll()
583 pll_param->pre_factor); in nau8810_set_pll()
587 (pll_param->pre_factor ? NAU8810_PLLMCLK_DIV2 : 0) | in nau8810_set_pll()
588 pll_param->pll_int); in nau8810_set_pll()
590 (pll_param->pll_frac >> NAU8810_PLLK1_SFT) & in nau8810_set_pll()
593 (pll_param->pll_frac >> NAU8810_PLLK2_SFT) & in nau8810_set_pll()
596 pll_param->pll_frac & NAU8810_PLLK3_MASK); in nau8810_set_pll()
598 pll_param->mclk_scaler << NAU8810_MCLKSEL_SFT); in nau8810_set_pll()
608 struct snd_soc_component *component = codec_dai->component; in nau8810_set_dai_fmt()
619 return -EINVAL; in nau8810_set_dai_fmt()
635 return -EINVAL; in nau8810_set_dai_fmt()
651 return -EINVAL; in nau8810_set_dai_fmt()
654 regmap_update_bits(nau8810->regmap, NAU8810_REG_IFACE, in nau8810_set_dai_fmt()
657 regmap_update_bits(nau8810->regmap, NAU8810_REG_CLOCK, in nau8810_set_dai_fmt()
667 if (!nau8810->sysclk) { in nau8810_mclk_clkdiv()
668 dev_err(nau8810->dev, "Make mclk div configuration fail because of invalid system clock\n"); in nau8810_mclk_clkdiv()
669 return -EINVAL; in nau8810_mclk_clkdiv()
677 sclk = (nau8810->sysclk * 10) / in nau8810_mclk_clkdiv()
683 dev_dbg(nau8810->dev, in nau8810_mclk_clkdiv()
687 regmap_update_bits(nau8810->regmap, NAU8810_REG_CLOCK, in nau8810_mclk_clkdiv()
689 regmap_update_bits(nau8810->regmap, NAU8810_REG_CLOCK, in nau8810_mclk_clkdiv()
698 struct snd_soc_component *component = dai->component; in nau8810_pcm_hw_params()
704 regmap_read(nau8810->regmap, NAU8810_REG_CLOCK, &ctrl_val); in nau8810_pcm_hw_params()
715 return -EINVAL; in nau8810_pcm_hw_params()
716 regmap_update_bits(nau8810->regmap, NAU8810_REG_CLOCK, in nau8810_pcm_hw_params()
755 regmap_update_bits(nau8810->regmap, NAU8810_REG_IFACE, in nau8810_pcm_hw_params()
757 regmap_update_bits(nau8810->regmap, NAU8810_REG_SMPLR, in nau8810_pcm_hw_params()
763 if (nau8810->clk_id == NAU8810_SCLK_MCLK) { in nau8810_pcm_hw_params()
766 dev_err(nau8810->dev, "MCLK div configuration fail\n"); in nau8810_pcm_hw_params()
776 struct regmap *map = nau8810->regmap; in nau8810_set_bias_level()
824 .name = "nau8810-hifi",
875 struct device *dev = &i2c->dev; in nau8810_i2c_probe()
881 return -ENOMEM; in nau8810_i2c_probe()
885 nau8810->regmap = devm_regmap_init_i2c(i2c, &nau8810_regmap_config); in nau8810_i2c_probe()
886 if (IS_ERR(nau8810->regmap)) in nau8810_i2c_probe()
887 return PTR_ERR(nau8810->regmap); in nau8810_i2c_probe()
888 nau8810->dev = dev; in nau8810_i2c_probe()
890 regmap_write(nau8810->regmap, NAU8810_REG_RESET, 0x00); in nau8810_i2c_probe()