Lines Matching +full:adc +full:- +full:startup +full:- +full:time

1 // SPDX-License-Identifier: GPL-2.0-only
3 // es8323.c -- es8323 ALSA SoC audio driver
10 // Jianqun Xu <jay.xu@rock-chips.com>
11 // Nickey Yang <nickey.yang@rock-chips.com>
25 #include <sound/soc-dapm.h>
98 static const char *const es8323_ng_type_texts[] = { "Constant PGA Gain", "Mute ADC Output" };
110 static const DECLARE_TLV_DB_SCALE(es8323_adc_tlv, -9600, 50, 1);
111 static const DECLARE_TLV_DB_SCALE(es8323_dac_tlv, -9600, 50, 1);
112 static const DECLARE_TLV_DB_SCALE(es8323_out_tlv, -4500, 150, 0);
114 static const DECLARE_TLV_DB_SCALE(es8323_bypass_tlv2, -15, 300, 0);
120 SOC_ENUM("Playback De-emphasis", es8323_playback_deemphasis_enum),
123 SOC_SINGLE("ALC Capture Decay Time", ES8323_ADCCONTROL12, 4, 15, 0),
124 SOC_SINGLE("ALC Capture Attack Time", ES8323_ADCCONTROL12, 0, 15, 0),
177 /* Mono ADC Mux */
207 SND_SOC_DAPM_MUX("Left ADC Mux", SND_SOC_NOPM, 0, 0, &es8323_mono_adc_mux_controls),
208 SND_SOC_DAPM_MUX("Right ADC Mux", SND_SOC_NOPM, 0, 0, &es8323_mono_adc_mux_controls),
212 SND_SOC_DAPM_ADC("Right ADC", "Right Capture", SND_SOC_NOPM, 4, 1),
213 SND_SOC_DAPM_ADC("Left ADC", "Left Capture", SND_SOC_NOPM, 5, 1),
224 SND_SOC_DAPM_PGA("Right ADC Power", SND_SOC_NOPM, 6, 1, NULL, 0),
225 SND_SOC_DAPM_PGA("Left ADC Power", SND_SOC_NOPM, 7, 1, NULL, 0),
255 {"Left ADC Mux", "Stereo", "Right PGA Mux"},
256 {"Left ADC Mux", "Stereo", "Left PGA Mux"},
257 {"Left ADC Mux", "Mono (Left)", "Left PGA Mux"},
259 {"Right ADC Mux", "Stereo", "Left PGA Mux"},
260 {"Right ADC Mux", "Stereo", "Right PGA Mux"},
261 {"Right ADC Mux", "Mono (Right)", "Right PGA Mux"},
263 {"Left ADC Power", NULL, "Left ADC Mux"},
264 {"Right ADC Power", NULL, "Right ADC Mux"},
265 {"Left ADC", NULL, "Left ADC Power"},
266 {"Right ADC", NULL, "Right ADC Power"},
389 return -EINVAL; in get_coeff()
395 struct snd_soc_component *component = codec_dai->component; in es8323_set_dai_sysclk()
403 es8323->sysclk_constraints = &constraints_112896; in es8323_set_dai_sysclk()
409 es8323->sysclk_constraints = &constraints_12288; in es8323_set_dai_sysclk()
413 es8323->sysclk_constraints = &constraints_12; in es8323_set_dai_sysclk()
416 return -EINVAL; in es8323_set_dai_sysclk()
419 es8323->sysclk = freq; in es8323_set_dai_sysclk()
425 struct snd_soc_component *component = codec_dai->component; in es8323_set_dai_fmt()
438 return -EINVAL; in es8323_set_dai_fmt()
461 return -EINVAL; in es8323_set_dai_fmt()
487 return -EINVAL; in es8323_set_dai_fmt()
500 struct snd_soc_component *component = dai->component; in es8323_pcm_startup()
503 if (es8323->sysclk) { in es8323_pcm_startup()
504 snd_pcm_hw_constraint_list(substream->runtime, 0, in es8323_pcm_startup()
506 es8323->sysclk_constraints); in es8323_pcm_startup()
516 struct snd_soc_component *component = dai->component; in es8323_pcm_hw_params()
523 coeff = get_coeff(es8323->sysclk, params_rate(params)); in es8323_pcm_hw_params()
525 coeff = get_coeff(es8323->sysclk / 2, params_rate(params)); in es8323_pcm_hw_params()
530 dev_err(component->dev, in es8323_pcm_hw_params()
532 params_rate(params), es8323->sysclk); in es8323_pcm_hw_params()
572 struct snd_soc_component *component = dai->component; in es8323_mute_stream()
581 .startup = es8323_pcm_startup,
616 es8323->component = component; in es8323_probe()
618 es8323->mclk = devm_clk_get_optional(component->dev, "mclk"); in es8323_probe()
619 if (IS_ERR(es8323->mclk)) { in es8323_probe()
620 dev_err(component->dev, "unable to get mclk\n"); in es8323_probe()
621 return PTR_ERR(es8323->mclk); in es8323_probe()
624 if (!es8323->mclk) in es8323_probe()
625 dev_warn(component->dev, "assuming static mclk\n"); in es8323_probe()
627 ret = clk_prepare_enable(es8323->mclk); in es8323_probe()
629 dev_err(component->dev, "unable to enable mclk\n"); in es8323_probe()
648 ret = clk_prepare_enable(es8323->mclk); in es8323_set_bias_level()
672 clk_disable_unprepare(es8323->mclk); in es8323_set_bias_level()
689 clk_disable_unprepare(es8323->mclk); in es8323_remove()
697 regcache_cache_only(es8323->regmap, true); in es8323_suspend()
698 regcache_mark_dirty(es8323->regmap); in es8323_suspend()
707 regcache_cache_only(es8323->regmap, false); in es8323_resume()
708 regcache_sync(es8323->regmap); in es8323_resume()
743 struct device *dev = &i2c_client->dev; in es8323_i2c_probe()
747 return -ENOMEM; in es8323_i2c_probe()
751 es8323->regmap = devm_regmap_init_i2c(i2c_client, &es8323_regmap); in es8323_i2c_probe()
752 if (IS_ERR(es8323->regmap)) in es8323_i2c_probe()
753 return PTR_ERR(es8323->regmap); in es8323_i2c_probe()