Commit 251d6047 authored by Takashi Iwai's avatar Takashi Iwai Committed by Mark Brown

ASoC: wm8985: Fix enum ctl accesses in a wrong type

"Equalizer Function" ctl in wm8985 codec driver is enum, while the
current driver accesses wrongly via value.integer.value[].  They have
to be via value.enumerated.item[] instead.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 92e963f5
...@@ -531,9 +531,9 @@ static int eqmode_get(struct snd_kcontrol *kcontrol, ...@@ -531,9 +531,9 @@ static int eqmode_get(struct snd_kcontrol *kcontrol,
reg = snd_soc_read(codec, WM8985_EQ1_LOW_SHELF); reg = snd_soc_read(codec, WM8985_EQ1_LOW_SHELF);
if (reg & WM8985_EQ3DMODE) if (reg & WM8985_EQ3DMODE)
ucontrol->value.integer.value[0] = 1; ucontrol->value.enumerated.item[0] = 1;
else else
ucontrol->value.integer.value[0] = 0; ucontrol->value.enumerated.item[0] = 0;
return 0; return 0;
} }
...@@ -545,18 +545,18 @@ static int eqmode_put(struct snd_kcontrol *kcontrol, ...@@ -545,18 +545,18 @@ static int eqmode_put(struct snd_kcontrol *kcontrol,
unsigned int regpwr2, regpwr3; unsigned int regpwr2, regpwr3;
unsigned int reg_eq; unsigned int reg_eq;
if (ucontrol->value.integer.value[0] != 0 if (ucontrol->value.enumerated.item[0] != 0
&& ucontrol->value.integer.value[0] != 1) && ucontrol->value.enumerated.item[0] != 1)
return -EINVAL; return -EINVAL;
reg_eq = snd_soc_read(codec, WM8985_EQ1_LOW_SHELF); reg_eq = snd_soc_read(codec, WM8985_EQ1_LOW_SHELF);
switch ((reg_eq & WM8985_EQ3DMODE) >> WM8985_EQ3DMODE_SHIFT) { switch ((reg_eq & WM8985_EQ3DMODE) >> WM8985_EQ3DMODE_SHIFT) {
case 0: case 0:
if (!ucontrol->value.integer.value[0]) if (!ucontrol->value.enumerated.item[0])
return 0; return 0;
break; break;
case 1: case 1:
if (ucontrol->value.integer.value[0]) if (ucontrol->value.enumerated.item[0])
return 0; return 0;
break; break;
} }
...@@ -573,7 +573,7 @@ static int eqmode_put(struct snd_kcontrol *kcontrol, ...@@ -573,7 +573,7 @@ static int eqmode_put(struct snd_kcontrol *kcontrol,
/* set the desired eqmode */ /* set the desired eqmode */
snd_soc_update_bits(codec, WM8985_EQ1_LOW_SHELF, snd_soc_update_bits(codec, WM8985_EQ1_LOW_SHELF,
WM8985_EQ3DMODE_MASK, WM8985_EQ3DMODE_MASK,
ucontrol->value.integer.value[0] ucontrol->value.enumerated.item[0]
<< WM8985_EQ3DMODE_SHIFT); << WM8985_EQ3DMODE_SHIFT);
/* restore DAC/ADC configuration */ /* restore DAC/ADC configuration */
snd_soc_write(codec, WM8985_POWER_MANAGEMENT_2, regpwr2); snd_soc_write(codec, WM8985_POWER_MANAGEMENT_2, regpwr2);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment