Lines Matching +full:dmic +full:- +full:freq
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()
271 /* DMIC */
272 SOC_SINGLE_EXT("DMIC Switch", 0, 0, 1, 0,
274 SOC_DOUBLE("DMIC Capture Switch", RT5631_DIG_MIC_CTRL,
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()
878 SND_SOC_DAPM_INPUT("DMIC"),
916 /* DMIC */
917 SND_SOC_DAPM_SUPPLY("DMIC Supply", RT5631_DIG_MIC_CTRL,
1090 {"DMIC", NULL, "DMIC Supply", check_dmic_used},
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()
1457 int clk_id, unsigned int freq, int dir) in rt5631_hifi_codec_set_dai_sysclk() argument
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()
1464 if ((freq >= (256 * 8000)) && (freq <= (512 * 96000))) { 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()
1602 /* DMIC */ 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()