mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
ASoC: rk3308_codec: Add controls for main MICBIAS switch
Change-Id: I8a2a113df7fd427634e1a1f81632725d7d4ecdc0 Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
This commit is contained in:
@@ -245,6 +245,10 @@ static const DECLARE_TLV_DB_RANGE(rk3308_codec_adc_mic_gain_tlv_b,
|
||||
|
||||
static bool handle_loopback(struct rk3308_codec_priv *rk3308);
|
||||
|
||||
static int rk3308_codec_micbias_enable(struct rk3308_codec_priv *rk3308,
|
||||
int micbias);
|
||||
static int rk3308_codec_micbias_disable(struct rk3308_codec_priv *rk3308);
|
||||
|
||||
static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol,
|
||||
@@ -273,6 +277,10 @@ static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol);
|
||||
|
||||
static const char *offon_text[2] = {
|
||||
[0] = "Off",
|
||||
@@ -284,6 +292,11 @@ static const char *mute_text[2] = {
|
||||
[1] = "Mute",
|
||||
};
|
||||
|
||||
/* ADC MICBIAS1 and MICBIAS2 Main Switch */
|
||||
static const struct soc_enum rk3308_main_micbias_enum_array[] = {
|
||||
SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text),
|
||||
};
|
||||
|
||||
static const struct soc_enum rk3308_hpf_enum_array[] = {
|
||||
SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(offon_text), offon_text),
|
||||
SOC_ENUM_SINGLE(1, 0, ARRAY_SIZE(offon_text), offon_text),
|
||||
@@ -681,6 +694,10 @@ static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = {
|
||||
SOC_ENUM_EXT("AGC Group 3 Right Approximate Sample Rate", rk3308_agc_asr_enum_array[7],
|
||||
rk3308_codec_agc_asr_get, rk3308_codec_agc_asr_put),
|
||||
|
||||
/* ADC Main MICBIAS Switch */
|
||||
SOC_ENUM_EXT("ADC Main MICBIAS", rk3308_main_micbias_enum_array[0],
|
||||
rk3308_codec_main_micbias_get, rk3308_codec_main_micbias_put),
|
||||
|
||||
/* ADC MICBIAS1 and MICBIAS2 Switch */
|
||||
SOC_SINGLE("ADC MICBIAS1", RK3308_ADC_ANA_CON07(1),
|
||||
RK3308_ADC_MIC_BIAS_BUF_SFT, 1, 0),
|
||||
@@ -1025,6 +1042,35 @@ static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = rk3308->enable_micbias;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int on = ucontrol->value.integer.value[0];
|
||||
|
||||
if (on) {
|
||||
if (!rk3308->enable_micbias)
|
||||
rk3308_codec_micbias_enable(rk3308, RK3308_ADC_MICBIAS_VOLT_0_85);
|
||||
} else {
|
||||
if (rk3308->enable_micbias)
|
||||
rk3308_codec_micbias_disable(rk3308);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user