mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
audio: fix codecs kcontrol bugs
PD#145715: kernel 4.9 use components to wrapper the codec instance. When poring form early versions, we have no idea about this change. And this commit fixes this issue. Change-Id: I56357b45c1bf93844f77fe89a828911fa9779406 Signed-off-by: Shuai Li <shuai.li@amlogic.com>
This commit is contained in:
@@ -66,7 +66,8 @@ static int aml_DAC_Gain_get_enum(
|
||||
struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
u32 add, val, val1, val2;
|
||||
|
||||
/*TODO: return 0 for tmp, this wolud modified later */
|
||||
@@ -89,7 +90,8 @@ static int aml_DAC_Gain_set_enum(
|
||||
struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
u32 add = ADC_VOL_CTR_PGA_IN_CONFIG;
|
||||
u32 val = snd_soc_read(codec, add);
|
||||
|
||||
|
||||
@@ -67,7 +67,8 @@ static int aml_DAC_Gain_get_enum(
|
||||
struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
u32 add = ADC_VOL_CTR_PGA_IN_CONFIG;
|
||||
u32 val = snd_soc_read(codec, add);
|
||||
u32 val1 = (val & (0x1 << DAC_GAIN_SEL_L)) >> DAC_GAIN_SEL_L;
|
||||
@@ -82,7 +83,8 @@ static int aml_DAC_Gain_set_enum(
|
||||
struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
u32 add = ADC_VOL_CTR_PGA_IN_CONFIG;
|
||||
u32 val = snd_soc_read(codec, add);
|
||||
|
||||
|
||||
@@ -149,7 +149,8 @@ static int pcm186x_dsp_access_enable(struct device *dev, struct regmap *map)
|
||||
static int pcm186x_dsp_coefficients_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct device *dev = codec->dev;
|
||||
struct pcm186x_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct regmap *map = priv->regmap;
|
||||
@@ -222,7 +223,8 @@ static int pcm186x_dsp_coefficients_get(struct snd_kcontrol *kcontrol,
|
||||
static int pcm186x_dsp_coefficients_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct device *dev = codec->dev;
|
||||
struct pcm186x_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct regmap *map = priv->regmap;
|
||||
|
||||
@@ -145,6 +145,8 @@ struct tas5707_priv {
|
||||
unsigned char Ch2_vol;
|
||||
unsigned char master_vol;
|
||||
unsigned int mclk;
|
||||
unsigned int EQ_enum_value;
|
||||
unsigned int DRC_enum_value;
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct early_suspend early_suspend;
|
||||
#endif
|
||||
@@ -413,17 +415,17 @@ static int tas5707_set_eq(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool EQ_enum_value = 1;
|
||||
static int tas5707_set_EQ_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct tas5707_priv *tas5707 = snd_soc_codec_get_drvdata(codec);
|
||||
u8 tas5707_eq_ctl_table[] = { 0x00, 0x00, 0x00, 0x80 };
|
||||
|
||||
EQ_enum_value = ucontrol->value.integer.value[0];
|
||||
tas5707->EQ_enum_value = ucontrol->value.integer.value[0];
|
||||
|
||||
if (EQ_enum_value == 1)
|
||||
if (tas5707->EQ_enum_value == 1)
|
||||
tas5707_set_eq(codec);
|
||||
else
|
||||
regmap_raw_write(tas5707->regmap,
|
||||
@@ -435,22 +437,26 @@ static int tas5707_set_EQ_enum(struct snd_kcontrol *kcontrol,
|
||||
static int tas5707_get_EQ_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
ucontrol->value.integer.value[0] = EQ_enum_value;
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct tas5707_priv *tas5707 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = tas5707->EQ_enum_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool DRC_enum_value = 1;
|
||||
static int tas5707_set_DRC_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct tas5707_priv *tas5707 = snd_soc_codec_get_drvdata(codec);
|
||||
u8 tas5707_drc_ctl_table[] = { 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
DRC_enum_value = ucontrol->value.integer.value[0];
|
||||
tas5707->DRC_enum_value = ucontrol->value.integer.value[0];
|
||||
|
||||
if (DRC_enum_value == 1)
|
||||
if (tas5707->DRC_enum_value == 1)
|
||||
tas5707_set_drc(codec);
|
||||
else
|
||||
regmap_raw_write(tas5707->regmap, DDX_DRC_CTL,
|
||||
@@ -461,7 +467,11 @@ static int tas5707_set_DRC_enum(struct snd_kcontrol *kcontrol,
|
||||
static int tas5707_get_DRC_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
ucontrol->value.integer.value[0] = DRC_enum_value;
|
||||
struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
|
||||
struct tas5707_priv *tas5707 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = tas5707->DRC_enum_value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -514,9 +524,9 @@ static int tas5707_init(struct snd_soc_codec *codec)
|
||||
regmap_raw_write(tas5707->regmap, DDX_PWM_MUX, burst_data[2], 4);
|
||||
|
||||
/*drc */
|
||||
tas5707_set_drc(codec);
|
||||
//tas5707_set_drc(codec);
|
||||
/*eq */
|
||||
tas5707_set_eq(codec);
|
||||
//tas5707_set_eq(codec);
|
||||
|
||||
snd_soc_write(codec, DDX_VOLUME_CONFIG, 0xD1);
|
||||
snd_soc_write(codec, DDX_SYS_CTL_2, 0x84);
|
||||
|
||||
Reference in New Issue
Block a user