Skip to content

Commit

Permalink
ASoC: wl1273: Fix enum ctl accesses in a wrong type
Browse files Browse the repository at this point in the history
"Codec Mode" and "Audio Switch" ctls in wl1273 codec driver are enum,
while the current driver accesses wrongly via value.integer.value[].
They have to be via value.enumerated.item[] instead.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
tiwai authored and broonie committed Mar 1, 2016
1 parent 92e963f commit 154a0fd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions sound/soc/codecs/wl1273.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol,
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);

ucontrol->value.integer.value[0] = wl1273->mode;
ucontrol->value.enumerated.item[0] = wl1273->mode;

return 0;
}
Expand All @@ -193,18 +193,17 @@ static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol,
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);

if (wl1273->mode == ucontrol->value.integer.value[0])
if (wl1273->mode == ucontrol->value.enumerated.item[0])
return 0;

/* Do not allow changes while stream is running */
if (snd_soc_codec_is_active(codec))
return -EPERM;

if (ucontrol->value.integer.value[0] < 0 ||
ucontrol->value.integer.value[0] >= ARRAY_SIZE(wl1273_audio_route))
if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route))
return -EINVAL;

wl1273->mode = ucontrol->value.integer.value[0];
wl1273->mode = ucontrol->value.enumerated.item[0];

return 1;
}
Expand All @@ -219,7 +218,7 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,

dev_dbg(codec->dev, "%s: enter.\n", __func__);

ucontrol->value.integer.value[0] = wl1273->core->audio_mode;
ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode;

return 0;
}
Expand All @@ -233,7 +232,7 @@ static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol,

dev_dbg(codec->dev, "%s: enter.\n", __func__);

val = ucontrol->value.integer.value[0];
val = ucontrol->value.enumerated.item[0];
if (wl1273->core->audio_mode == val)
return 0;

Expand Down

0 comments on commit 154a0fd

Please sign in to comment.