From f71e9ce352e121a75f9a66e45a87f6ced695ce08 Mon Sep 17 00:00:00 2001 From: Yao Zhengming Date: Mon, 14 Jan 2019 22:28:54 -0500 Subject: [PATCH] ASOC:Pick Patch from ODM's Base (CR):[Kane][audio]kernel:get the enum by read hard status sometimes the enum show wrong Change-Id: I1eea4a01c05e9d9e49508f54d3e5ac6281dbda3f Signed-off-by: zhangjiaquan Signed-off-by: yaozm1 Reviewed-on: https://gerrit.mot.com/1295695 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- sound/soc/codecs/cs47l35.c | 2 +- sound/soc/codecs/madera.c | 12 ++++++++++++ sound/soc/codecs/madera.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs47l35.c b/sound/soc/codecs/cs47l35.c index 9a773ed606b0..19df5ece275b 100755 --- a/sound/soc/codecs/cs47l35.c +++ b/sound/soc/codecs/cs47l35.c @@ -142,7 +142,7 @@ static SOC_ENUM_SINGLE_DECL(cs47l35_outdemux_enum, SND_SOC_NOPM, 0, static const struct snd_kcontrol_new cs47l35_outdemux = SOC_DAPM_ENUM_EXT("HPOUT1 Demux", cs47l35_outdemux_enum, - snd_soc_dapm_get_enum_double, madera_out1_demux_put); + madera_out1_demux_get, madera_out1_demux_put); static int cs47l35_get_sources(unsigned int reg, const unsigned int **cur_sources, int *lim) { diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c index 7aed44a87676..59a4bf329ce5 100755 --- a/sound/soc/codecs/madera.c +++ b/sound/soc/codecs/madera.c @@ -601,6 +601,18 @@ end: } EXPORT_SYMBOL_GPL(madera_out1_demux_put); +int madera_out1_demux_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); + unsigned int val; + val = snd_soc_read(codec, MADERA_OUTPUT_ENABLES_1); + val &= MADERA_EP_SEL_MASK; + val >>= MADERA_EP_SEL_SHIFT; + ucontrol->value.enumerated.item[0] = val; + return 0; +} +EXPORT_SYMBOL_GPL(madera_out1_demux_get); static int madera_inmux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) diff --git a/sound/soc/codecs/madera.h b/sound/soc/codecs/madera.h index 6f5f23177aaf..662c48ea8830 100755 --- a/sound/soc/codecs/madera.h +++ b/sound/soc/codecs/madera.h @@ -442,6 +442,8 @@ int madera_in_rate_put(struct snd_kcontrol *kcontrol, int madera_out1_demux_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int madera_out1_demux_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol); int madera_dre_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); -- 2.20.1