mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
ASoC: rt5651: add alc5651 ASRC switch for HDMIIn
Change-Id: I447228656d5ee56b2c4b04c515ad71f34e107ba0 Signed-off-by: LuoXiaoTan <lxt@rock-chips.com>
This commit is contained in:
@@ -284,6 +284,40 @@ static bool rt5651_readable_register(struct device *dev, unsigned int reg)
|
||||
}
|
||||
}
|
||||
|
||||
static int rt5651_asrc_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = rt5651->asrc_en;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rt5651_asrc_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
rt5651->asrc_en = ucontrol->value.integer.value[0];
|
||||
if (rt5651->asrc_en) {
|
||||
regmap_write(rt5651->regmap, 0x80, 0x4000);
|
||||
regmap_write(rt5651->regmap, 0x81, 0x0302);
|
||||
regmap_write(rt5651->regmap, 0x82, 0x0800);
|
||||
regmap_write(rt5651->regmap, 0x73, 0x1004);
|
||||
regmap_write(rt5651->regmap, 0x83, 0x1000);
|
||||
regmap_write(rt5651->regmap, 0x84, 0x7000);
|
||||
snd_soc_component_update_bits(component, 0x64, 0x0200, 0x0200);
|
||||
snd_soc_component_update_bits(component, RT5651_D_MISC, 0xc00, 0xc00);
|
||||
} else {
|
||||
regmap_write(rt5651->regmap, 0x83, 0x0);
|
||||
regmap_write(rt5651->regmap, 0x84, 0x0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
|
||||
static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0);
|
||||
static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
|
||||
@@ -311,6 +345,10 @@ static SOC_ENUM_SINGLE_DECL(rt5651_if2_dac_enum, RT5651_DIG_INF_DATA,
|
||||
static SOC_ENUM_SINGLE_DECL(rt5651_if2_adc_enum, RT5651_DIG_INF_DATA,
|
||||
RT5651_IF2_ADC_SEL_SFT, rt5651_data_select);
|
||||
|
||||
static const char * const rt5651_asrc_mode[] = {"Disable", "Enable"};
|
||||
|
||||
static SOC_ENUM_SINGLE_DECL(rt5651_asrc_enum, 0, 0, rt5651_asrc_mode);
|
||||
|
||||
static const struct snd_kcontrol_new rt5651_snd_controls[] = {
|
||||
/* Headphone Output Volume */
|
||||
SOC_DOUBLE_TLV("HP Playback Volume", RT5651_HP_VOL,
|
||||
@@ -353,6 +391,9 @@ static const struct snd_kcontrol_new rt5651_snd_controls[] = {
|
||||
RT5651_ADC_L_BST_SFT, RT5651_ADC_R_BST_SFT,
|
||||
3, 0, adc_bst_tlv),
|
||||
|
||||
/* RT5651 ASRC Switch */
|
||||
SOC_ENUM_EXT("RT5651 ASRC Switch", rt5651_asrc_enum,
|
||||
rt5651_asrc_get, rt5651_asrc_put),
|
||||
/* ASRC */
|
||||
SOC_SINGLE("IF1 ASRC Switch", RT5651_PLL_MODE_1,
|
||||
RT5651_STO1_T_SFT, 1, 0),
|
||||
|
||||
@@ -2096,6 +2096,7 @@ struct rt5651_priv {
|
||||
int pll_out;
|
||||
|
||||
int dmic_en;
|
||||
int asrc_en;
|
||||
bool hp_mute;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user