Lines Matching +full:micbias +full:- +full:input
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * rk730.c -- RK730 ALSA SoC Audio driver
45 static const DECLARE_TLV_DB_SCALE(adc_dig_tlv, -95625, 375, 0);
47 static const DECLARE_TLV_DB_SCALE(dac_dig_tlv, -95625, 375, 0);
49 static const DECLARE_TLV_DB_SCALE(d2s_tlv, -1800, 300, 0);
51 static const DECLARE_TLV_DB_SCALE(adc_tlv, -1200, 300, 0);
53 static const DECLARE_TLV_DB_SCALE(mux_tlv, -600, 600, 0);
55 static const DECLARE_TLV_DB_SCALE(mix_buf_tlv, -1800, 300, 0);
65 8, 8, TLV_DB_SCALE_ITEM(-300, 0, 0),
66 16, 16, TLV_DB_SCALE_ITEM(-600, 0, 0),
67 24, 24, TLV_DB_SCALE_ITEM(-900, 0, 0)
87 SOC_DAPM_ENUM("Left Input Mux", mux_input_l_enum);
89 SOC_DAPM_ENUM("Right Input Mux", mux_input_r_enum);
144 (struct soc_mixer_control *)kcontrol->private_value; in rk730_adc_vol_get()
145 unsigned int val = snd_soc_component_read(component, mc->reg); in rk730_adc_vol_get()
147 unsigned int mask = (1 << fls(mc->max)) - 1; in rk730_adc_vol_get()
148 unsigned int shift = mc->shift; in rk730_adc_vol_get()
149 int mid = mc->max / 2; in rk730_adc_vol_get()
157 uv = mid - uv; in rk730_adc_vol_get()
159 ucontrol->value.integer.value[0] = uv; in rk730_adc_vol_get()
160 ucontrol->value.integer.value[1] = uv; in rk730_adc_vol_get()
170 (struct soc_mixer_control *)kcontrol->private_value; in rk730_adc_vol_put()
171 unsigned int reg = mc->reg; in rk730_adc_vol_put()
172 unsigned int rreg = mc->rreg; in rk730_adc_vol_put()
173 unsigned int shift = mc->shift; in rk730_adc_vol_put()
174 unsigned int mask = (1 << fls(mc->max)) - 1; in rk730_adc_vol_put()
176 int uv = ucontrol->value.integer.value[0]; in rk730_adc_vol_put()
177 int min = mc->min; in rk730_adc_vol_put()
178 int mid = mc->max / 2; in rk730_adc_vol_put()
184 uv = uv - mid; in rk730_adc_vol_put()
187 uv = mid - uv; in rk730_adc_vol_put()
206 (struct soc_mixer_control *)kcontrol->private_value; in rk730_dac_vol_get()
207 unsigned int val = snd_soc_component_read(component, mc->reg); in rk730_dac_vol_get()
209 unsigned int mask = (1 << fls(mc->max)) - 1; in rk730_dac_vol_get()
210 unsigned int shift = mc->shift; in rk730_dac_vol_get()
211 int mid = mc->max / 2; in rk730_dac_vol_get()
219 uv = mid - uv; in rk730_dac_vol_get()
221 ucontrol->value.integer.value[0] = uv; in rk730_dac_vol_get()
222 ucontrol->value.integer.value[1] = uv; in rk730_dac_vol_get()
232 (struct soc_mixer_control *)kcontrol->private_value; in rk730_dac_vol_put()
233 unsigned int reg = mc->reg; in rk730_dac_vol_put()
234 unsigned int rreg = mc->rreg; in rk730_dac_vol_put()
235 unsigned int shift = mc->shift; in rk730_dac_vol_put()
236 unsigned int mask = (1 << fls(mc->max)) - 1; in rk730_dac_vol_put()
238 int uv = ucontrol->value.integer.value[0]; in rk730_dac_vol_put()
239 int min = mc->min; in rk730_dac_vol_put()
240 int mid = mc->max / 2; in rk730_dac_vol_put()
246 uv = uv - mid; in rk730_dac_vol_put()
249 uv = mid - uv; in rk730_dac_vol_put()
275 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rk730_pll_event()
288 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rk730_adc_event()
331 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rk730_dac_event()
367 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in rk730_mux_out_event()
372 val = atomic_inc_return(&rk730->mix_mode); in rk730_mux_out_event()
374 val = atomic_dec_return(&rk730->mix_mode); in rk730_mux_out_event()
397 SOC_SINGLE_TLV("Left Out Mux -> Left Out Mixer Volume",
399 SOC_SINGLE_TLV("Left Out Mux -> Right Out Mixer Volume",
401 SOC_SINGLE_TLV("Right Out Mux -> Left Out Mixer Volume",
403 SOC_SINGLE_TLV("Right Out Mux -> Right Out Mixer Volume",
449 SND_SOC_DAPM_SUPPLY_S("MICBIAS", 1, RK730_MIC_BIAS, 0, 1, NULL, 0),
498 SND_SOC_DAPM_MUX("Left Input Mux", SND_SOC_NOPM, 0, 0, &mux_input_l),
499 SND_SOC_DAPM_MUX("Right Input Mux", SND_SOC_NOPM, 0, 0, &mux_input_r),
582 { "ADCL PGA", NULL, "Left Input Mux" },
583 { "ADCR PGA", NULL, "Right Input Mux" },
585 { "Left Input Mux", "DIFF", "DIFFL" },
586 { "Left Input Mux", "VINP1", "MIC1P" },
587 { "Left Input Mux", "VINN1", "MIC1N" },
588 { "Right Input Mux", "DIFF", "DIFFR" },
589 { "Right Input Mux", "VINP2", "MIC2P" },
590 { "Right Input Mux", "VINN2", "MIC2N" },
602 { "MIC1", NULL, "MICBIAS" },
603 { "MIC2", NULL, "MICBIAS" },
638 struct snd_soc_component *component = dai->component; in rk730_dai_hw_params()
644 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in rk730_dai_hw_params()
665 struct snd_soc_component *component = codec_dai->component; in rk730_dai_set_fmt()
679 return -EINVAL; in rk730_dai_set_fmt()
687 struct snd_soc_component *component = codec_dai->component; in rk730_dai_mute()
718 if (!IS_ERR(rk730->mclk)) { in rk730_set_bias_level()
721 clk_disable_unprepare(rk730->mclk); in rk730_set_bias_level()
723 clk_prepare_enable(rk730->mclk); in rk730_set_bias_level()
729 regcache_sync(rk730->regmap); in rk730_set_bias_level()
733 regcache_mark_dirty(rk730->regmap); in rk730_set_bias_level()
773 clk_prepare_enable(rk730->mclk); in rk730_reset()
776 /* WA: Initial micbias default, ADC stopped with micbias(>2.5v) */ in rk730_reset()
794 clk_disable_unprepare(rk730->mclk); in rk730_reset()
804 regcache_mark_dirty(rk730->regmap); in rk730_probe()
807 atomic_set(&rk730->mix_mode, RK730_MIX_MODE_1_PATH); in rk730_probe()
811 dev_err(component->dev, "Failed to read register: %d\n", ret); in rk730_probe()
925 rk730 = devm_kzalloc(&i2c->dev, sizeof(struct rk730_priv), GFP_KERNEL); in rk730_i2c_probe()
927 return -ENOMEM; in rk730_i2c_probe()
929 rk730->regmap = devm_regmap_init_i2c(i2c, &rk730_regmap); in rk730_i2c_probe()
930 if (IS_ERR(rk730->regmap)) in rk730_i2c_probe()
931 return PTR_ERR(rk730->regmap); in rk730_i2c_probe()
933 rk730->mclk = devm_clk_get(&i2c->dev, "mclk"); in rk730_i2c_probe()
934 if (IS_ERR(rk730->mclk)) in rk730_i2c_probe()
935 return PTR_ERR(rk730->mclk); in rk730_i2c_probe()
939 ret = devm_snd_soc_register_component(&i2c->dev, in rk730_i2c_probe()
970 MODULE_AUTHOR("Sugar Zhang <sugar.zhang@rock-chips.com>");