Lines Matching +full:spk +full:- +full:fmt

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()
218 /* SPK Ratio Gain Control */
257 /* SPK */
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 */
953 /* Left SPK Mixer */
968 /* Right SPK Mixer */
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()
1405 unsigned int fmt) in rt5631_hifi_codec_set_dai_fmt() argument
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()
1413 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 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()
1425 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in rt5631_hifi_codec_set_dai_fmt()
1438 return -EINVAL; in rt5631_hifi_codec_set_dai_fmt()
1441 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 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()