From: Yao Zhengming Date: Tue, 15 Jan 2019 03:28:54 +0000 (-0500) Subject: ASOC:Pick Patch from ODM's Base X-Git-Tag: MMI-RSA31.Q1-48-36-11~283 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa3d0af765f00d1fbfec85e1176a439528b3d443;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 --- 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);