Lines Matching +full:axi +full:- +full:adc +full:- +full:10
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()
238 /* AXI */
239 SOC_DOUBLE_TLV("AXI Capture Volume", RT5631_AUX_IN_VOL,
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()
420 schedule_timeout_uninterruptible(msecs_to_jiffies(10)); 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.
532 schedule_timeout_uninterruptible(msecs_to_jiffies(10)); in depop_seq_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()
914 SND_SOC_DAPM_MIXER("ADC Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
920 /* ADC Data Srouce */
921 SND_SOC_DAPM_SUPPLY("Left ADC Select", RT5631_INT_ST_IRQ_CTRL_2,
923 SND_SOC_DAPM_SUPPLY("Right ADC Select", RT5631_INT_ST_IRQ_CTRL_2,
927 SND_SOC_DAPM_ADC("Left ADC", "HIFI Capture",
929 SND_SOC_DAPM_ADC("Right ADC", "HIFI Capture",
932 /* DAC and ADC supply power */
1075 {"ADC Mixer", NULL, "RECMIXL Mixer"},
1076 {"ADC Mixer", NULL, "RECMIXR Mixer"},
1078 {"Left ADC", NULL, "ADC Mixer"},
1079 {"Left ADC", NULL, "Left ADC Select", check_adcl_select},
1080 {"Left ADC", NULL, "PLL1", check_sysclk1_source},
1081 {"Left ADC", NULL, "I2S"},
1082 {"Left ADC", NULL, "DAC REF"},
1084 {"Right ADC", NULL, "ADC Mixer"},
1085 {"Right ADC", NULL, "Right ADC Select", check_adcr_select},
1086 {"Right ADC", NULL, "PLL1", check_sysclk1_source},
1087 {"Right ADC", NULL, "I2S"},
1088 {"Right ADC", NULL, "DAC REF"},
1091 {"Left ADC", NULL, "DMIC"},
1092 {"Right ADC", NULL, "DMIC"},
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()