2010-12-08 20:36:24

by Dmitry Artamonow

[permalink] [raw]
Subject: [PATCH] ASoC: fix deemphasis control in wm8904/55/60 codecs

Deemphasis control's .get callback should update control's value instead
of returning it - return value of callback function is used for indicating
error or success of operation.

Signed-off-by: Dmitry Artamonow <[email protected]>
---
I discovered this while trying to adapt this deemphasis code to ak4641 codec.

sound/soc/codecs/wm8904.c | 3 ++-
sound/soc/codecs/wm8955.c | 3 ++-
sound/soc/codecs/wm8960.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index fca60a0..9001cc4 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -818,7 +818,8 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);

- return wm8904->deemph;
+ ucontrol->value.enumerated.item[0] = wm8904->deemph;
+ return 0;
}

static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index f89ad6c..9cbab8e 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -380,7 +380,8 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);

- return wm8955->deemph;
+ ucontrol->value.enumerated.item[0] = wm8955->deemph;
+ return 0;
}

static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 8d5efb3..21986c4 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -138,7 +138,8 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol,
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);

- return wm8960->deemph;
+ ucontrol->value.enumerated.item[0] = wm8960->deemph;
+ return 0;
}

static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
--
1.7.0.4


2010-12-09 10:04:43

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH] ASoC: fix deemphasis control in wm8904/55/60 codecs

On Wed, 2010-12-08 at 23:36 +0300, Dmitry Artamonow wrote:
> Deemphasis control's .get callback should update control's value instead
> of returning it - return value of callback function is used for indicating
> error or success of operation.
>
> Signed-off-by: Dmitry Artamonow <[email protected]>
> ---

Acked-by: Liam Girdwood <[email protected]>
--
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

2010-12-09 10:56:32

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] ASoC: fix deemphasis control in wm8904/55/60 codecs

On Wed, Dec 08, 2010 at 11:36:17PM +0300, Dmitry Artamonow wrote:
> Deemphasis control's .get callback should update control's value instead
> of returning it - return value of callback function is used for indicating
> error or success of operation.
>
> Signed-off-by: Dmitry Artamonow <[email protected]>

Applied, thanks.