Lines Matching +full:boost +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * rt5631.c -- RT5631 ALSA Soc Audio driver
22 #include <sound/soc-dapm.h>
68 * rt5631_write_index - write index register of 2nd layer
78 * rt5631_read_index - read index register of 2nd layer
169 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
170 static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -95625, 375, 0);
171 static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
189 ucontrol->value.integer.value[0] = rt5631->dmic_used_flag; in rt5631_dmic_get()
200 rt5631->dmic_used_flag = ucontrol->value.integer.value[0]; in rt5631_dmic_put()
227 SOC_ENUM("MIC1 Mode Control", rt5631_mic1_mode_enum),
228 SOC_SINGLE_TLV("MIC1 Boost Volume", RT5631_MIC_CTRL_2,
230 SOC_ENUM("MIC2 Mode Control", rt5631_mic2_mode_enum),
231 SOC_SINGLE_TLV("MIC2 Boost Volume", RT5631_MIC_CTRL_2,
234 SOC_ENUM("MONOIN Mode Control", rt5631_monoin_mode_enum),
285 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_sysclk1_source()
295 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_dmic_used()
297 return rt5631->dmic_used_flag; in check_dmic_used()
303 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_dacl_to_outmixl()
313 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_dacr_to_outmixr()
323 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_dacl_to_spkmixl()
333 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_dacr_to_spkmixr()
343 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_adcl_select()
353 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm); in check_adcr_select()
361 * onebit_depop_power_stage - auto depop in power stage.
371 /* enable one-bit depop function */ in onebit_depop_power_stage()
381 /* config one-bit depop parameter */ in onebit_depop_power_stage()
400 * onebit_depop_mute_stage - auto depop in mute stage.
410 /* enable one-bit depop function */ in onebit_depop_mute_stage()
421 /* config one-bit depop parameter */ in onebit_depop_mute_stage()
439 * depop_seq_power_stage - step by step depop sequence in power stage.
474 /* stop depop mode */ in depop_seq_power_stage()
488 /* start depop mode */ in depop_seq_power_stage()
512 * depop_seq_mute_stage - step by step depop sequence in mute stage.
566 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in hp_event()
571 if (rt5631->codec_version) { in hp_event()
581 if (rt5631->codec_version) { in hp_event()
600 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in set_dmic_params()
603 switch (rt5631->rx_rate) { in set_dmic_params()
627 return -EINVAL; in set_dmic_params()
886 /* Boost */
887 SND_SOC_DAPM_PGA("MIC1 Boost", RT5631_PWR_MANAG_ADD2,
889 SND_SOC_DAPM_PGA("MIC2 Boost", RT5631_PWR_MANAG_ADD2,
891 SND_SOC_DAPM_PGA("MONOIN_RXP Boost", RT5631_PWR_MANAG_ADD4,
893 SND_SOC_DAPM_PGA("MONOIN_RXN Boost", RT5631_PWR_MANAG_ADD4,
895 SND_SOC_DAPM_PGA("AXIL Boost", RT5631_PWR_MANAG_ADD4,
897 SND_SOC_DAPM_PGA("AXIR Boost", RT5631_PWR_MANAG_ADD4,
946 SND_SOC_DAPM_PGA("Voice DAC Boost", SND_SOC_NOPM, 0, 0, NULL, 0),
1055 {"MIC1 Boost", NULL, "MIC1"},
1056 {"MIC2 Boost", NULL, "MIC2"},
1057 {"MONOIN_RXP Boost", NULL, "MONOIN_RXP"},
1058 {"MONOIN_RXN Boost", NULL, "MONOIN_RXN"},
1059 {"AXIL Boost", NULL, "AXIL"},
1060 {"AXIR Boost", NULL, "AXIR"},
1062 {"MONO_IN", NULL, "MONOIN_RXP Boost"},
1063 {"MONO_IN", NULL, "MONOIN_RXN Boost"},
1066 {"RECMIXL Mixer", "MIC1_BST1 Capture Switch", "MIC1 Boost"},
1067 {"RECMIXL Mixer", "AXILVOL Capture Switch", "AXIL Boost"},
1071 {"RECMIXR Mixer", "MIC2_BST2 Capture Switch", "MIC2 Boost"},
1072 {"RECMIXR Mixer", "AXIRVOL Capture Switch", "AXIR Boost"},
1101 {"Voice DAC Boost", NULL, "Voice DAC"},
1119 {"OUTMIXL Mixer", "MIC1_BST1 Playback Switch", "MIC1 Boost"},
1120 {"OUTMIXL Mixer", "MIC2_BST2 Playback Switch", "MIC2 Boost"},
1121 {"OUTMIXL Mixer", "MONOIN_RXP Playback Switch", "MONOIN_RXP Boost"},
1122 {"OUTMIXL Mixer", "AXILVOL Playback Switch", "AXIL Boost"},
1123 {"OUTMIXL Mixer", "AXIRVOL Playback Switch", "AXIR Boost"},
1124 {"OUTMIXL Mixer", "VDAC Playback Switch", "Voice DAC Boost"},
1130 {"OUTMIXR Mixer", "MIC1_BST1 Playback Switch", "MIC1 Boost"},
1131 {"OUTMIXR Mixer", "MIC2_BST2 Playback Switch", "MIC2 Boost"},
1132 {"OUTMIXR Mixer", "MONOIN_RXN Playback Switch", "MONOIN_RXN Boost"},
1133 {"OUTMIXR Mixer", "AXILVOL Playback Switch", "AXIL Boost"},
1134 {"OUTMIXR Mixer", "AXIRVOL Playback Switch", "AXIR Boost"},
1135 {"OUTMIXR Mixer", "VDAC Playback Switch", "Voice DAC Boost"},
1150 {"AXO1MIX Mixer", "MIC1_BST1 Playback Switch", "MIC1 Boost"},
1153 {"AXO1MIX Mixer", "MIC2_BST2 Playback Switch", "MIC2 Boost"},
1155 {"AXO2MIX Mixer", "MIC1_BST1 Playback Switch", "MIC1 Boost"},
1158 {"AXO2MIX Mixer", "MIC2_BST2 Playback Switch", "MIC2 Boost"},
1171 {"SPOL Mux", "VDAC", "Voice DAC Boost"},
1176 {"SPOR Mux", "VDAC", "Voice DAC Boost"},
1181 {"MONO Mux", "VDAC", "Voice DAC Boost"},
1349 return -EINVAL; in get_coeff()
1355 struct snd_soc_component *component = dai->component; in rt5631_hifi_pcm_params()
1360 dev_dbg(component->dev, "enter %s\n", __func__); in rt5631_hifi_pcm_params()
1362 rt5631->bclk_rate = snd_soc_params_to_bclk(params); in rt5631_hifi_pcm_params()
1363 if (rt5631->bclk_rate < 0) { in rt5631_hifi_pcm_params()
1364 dev_err(component->dev, "Fail to get BCLK rate\n"); in rt5631_hifi_pcm_params()
1365 return rt5631->bclk_rate; in rt5631_hifi_pcm_params()
1367 rt5631->rx_rate = params_rate(params); in rt5631_hifi_pcm_params()
1369 if (rt5631->master) in rt5631_hifi_pcm_params()
1370 coeff = get_coeff(rt5631->sysclk, rt5631->rx_rate, in rt5631_hifi_pcm_params()
1371 rt5631->bclk_rate / rt5631->rx_rate); in rt5631_hifi_pcm_params()
1373 coeff = get_coeff(rt5631->sysclk, rt5631->rx_rate, in rt5631_hifi_pcm_params()
1376 dev_err(component->dev, "Fail to get coeff\n"); in rt5631_hifi_pcm_params()
1393 return -EINVAL; in rt5631_hifi_pcm_params()
1407 struct snd_soc_component *component = codec_dai->component; in rt5631_hifi_codec_set_dai_fmt()
1411 dev_dbg(component->dev, "enter %s\n", __func__); in rt5631_hifi_codec_set_dai_fmt()
1415 rt5631->master = 1; in rt5631_hifi_codec_set_dai_fmt()
1419 rt5631->master = 0; in rt5631_hifi_codec_set_dai_fmt()
1422 return -EINVAL; in rt5631_hifi_codec_set_dai_fmt()
1438 return -EINVAL; in rt5631_hifi_codec_set_dai_fmt()
1448 return -EINVAL; in rt5631_hifi_codec_set_dai_fmt()
1459 struct snd_soc_component *component = codec_dai->component; in rt5631_hifi_codec_set_dai_sysclk()
1462 dev_dbg(component->dev, "enter %s, syclk=%d\n", __func__, freq); in rt5631_hifi_codec_set_dai_sysclk()
1465 rt5631->sysclk = freq; in rt5631_hifi_codec_set_dai_sysclk()
1469 return -EINVAL; in rt5631_hifi_codec_set_dai_sysclk()
1475 struct snd_soc_component *component = codec_dai->component; in rt5631_codec_set_dai_pll()
1477 int i, ret = -EINVAL; in rt5631_codec_set_dai_pll()
1479 dev_dbg(component->dev, "enter %s\n", __func__); in rt5631_codec_set_dai_pll()
1482 dev_dbg(component->dev, "PLL disabled\n"); in rt5631_codec_set_dai_pll()
1491 if (rt5631->master) { in rt5631_codec_set_dai_pll()
1495 dev_info(component->dev, in rt5631_codec_set_dai_pll()
1496 "change PLL in master mode\n"); in rt5631_codec_set_dai_pll()
1514 dev_info(component->dev, in rt5631_codec_set_dai_pll()
1515 "change PLL in slave mode\n"); in rt5631_codec_set_dai_pll()
1556 regcache_cache_only(rt5631->regmap, false); in rt5631_set_bias_level()
1557 regcache_sync(rt5631->regmap); in rt5631_set_bias_level()
1582 rt5631->codec_version = 1; in rt5631_probe()
1584 rt5631->codec_version = 0; in rt5631_probe()
1596 if (rt5631->codec_version) in rt5631_probe()
1603 if (rt5631->dmic_used_flag) { in rt5631_probe()
1636 .name = "rt5631-hifi",
1706 rt5631 = devm_kzalloc(&i2c->dev, sizeof(struct rt5631_priv), in rt5631_i2c_probe()
1709 return -ENOMEM; in rt5631_i2c_probe()
1713 rt5631->regmap = devm_regmap_init_i2c(i2c, &rt5631_regmap_config); in rt5631_i2c_probe()
1714 if (IS_ERR(rt5631->regmap)) in rt5631_i2c_probe()
1715 return PTR_ERR(rt5631->regmap); in rt5631_i2c_probe()
1717 ret = devm_snd_soc_register_component(&i2c->dev, in rt5631_i2c_probe()