Lines Matching +full:spk +full:- +full:mono
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()
214 /* MONO Input Type */
218 /* SPK Ratio Gain Control */
233 /* MONO IN */
257 /* SPK */
262 /* MONO OUT */
263 SOC_SINGLE("MONO Playback Switch", RT5631_MONO_AXO_1_2_VOL,
278 /* SPK Ratio Gain Control */
279 SOC_ENUM("SPK Ratio Control", rt5631_spk_ratio_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.
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()
762 /* Left SPK Volume Input */
807 /* Right SPK Volume Input */
836 /* MONO Input */
843 SOC_DAPM_ENUM("MONO SRC", rt5631_mono_src_enum);
900 /* MONO In */
944 SND_SOC_DAPM_DAC("Voice DAC", "Voice DAC Mono Playback",
953 /* Left SPK Mixer */
968 /* Right SPK Mixer */
1011 /* MONO Mixer */
1031 SND_SOC_DAPM_MUX("MONO Mux", SND_SOC_NOPM, 0, 0,
1039 SND_SOC_DAPM_SUPPLY("MONO Depop", RT5631_PWR_MANAG_ADD3,
1051 SND_SOC_DAPM_OUTPUT("MONO"),
1179 {"MONO Mux", "MONOMIX", "MONOMIX Mixer"},
1180 {"MONO Mux", "MONOIN_RX", "MONO_IN"},
1181 {"MONO Mux", "VDAC", "Voice DAC Boost"},
1205 {"MONO", NULL, "MONO Depop"},
1206 {"MONO", NULL, "MONO Mux"},
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()
1514 dev_info(component->dev, 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()