summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorYassine Oudjana <y.oudjana@protonmail.com>2022-01-04 03:35:36 +0000
committerMark Brown <broonie@kernel.org>2022-01-06 16:41:58 +0000
commit3b247eeaecfefe35ecca1578b0ed48be65bc6ca3 (patch)
treeca778e7825750a54c5d8fd2d73c5176758dfb379 /sound/soc
parent7112550890d7e415188a3351ec0a140be60f6deb (diff)
downloadlinux-3b247eeaecfefe35ecca1578b0ed48be65bc6ca3.tar.gz
linux-3b247eeaecfefe35ecca1578b0ed48be65bc6ca3.tar.bz2
linux-3b247eeaecfefe35ecca1578b0ed48be65bc6ca3.zip
ASoC: wcd9335: Keep a RX port value for each SLIM RX mux
Currently, rx_port_value is a single unsigned int that gets overwritten when slim_rx_mux_put() is called for any RX mux, then the same value is read when slim_rx_mux_get() is called for any of them. This results in slim_rx_mux_get() reporting the last value set by slim_rx_mux_put() regardless of which SLIM RX mux is in question. Turn rx_port_value into an array and store a separate value for each SLIM RX mux. Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com> Link: https://lore.kernel.org/r/20220104033356.343685-1-y.oudjana@protonmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wcd9335.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c
index bc5d68c53e5a..1e60db4056ad 100644
--- a/sound/soc/codecs/wcd9335.c
+++ b/sound/soc/codecs/wcd9335.c
@@ -341,7 +341,7 @@ struct wcd9335_codec {
int reset_gpio;
struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY];
- unsigned int rx_port_value;
+ unsigned int rx_port_value[WCD9335_RX_MAX];
unsigned int tx_port_value;
int hph_l_gain;
int hph_r_gain;
@@ -1269,10 +1269,11 @@ static const struct snd_kcontrol_new sb_tx8_mux =
static int slim_rx_mux_get(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *ucontrol)
{
- struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc);
- struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev);
+ struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kc);
+ struct wcd9335_codec *wcd = dev_get_drvdata(w->dapm->dev);
+ u32 port_id = w->shift;
- ucontrol->value.enumerated.item[0] = wcd->rx_port_value;
+ ucontrol->value.enumerated.item[0] = wcd->rx_port_value[port_id];
return 0;
}
@@ -1286,9 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
struct snd_soc_dapm_update *update = NULL;
u32 port_id = w->shift;
- wcd->rx_port_value = ucontrol->value.enumerated.item[0];
+ wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
- switch (wcd->rx_port_value) {
+ switch (wcd->rx_port_value[port_id]) {
case 0:
list_del_init(&wcd->rx_chs[port_id].list);
break;
@@ -1309,11 +1310,11 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
&wcd->dai[AIF4_PB].slim_ch_list);
break;
default:
- dev_err(wcd->dev, "Unknown AIF %d\n", wcd->rx_port_value);
+ dev_err(wcd->dev, "Unknown AIF %d\n", wcd->rx_port_value[port_id]);
goto err;
}
- snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value,
+ snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id],
e, update);
return 0;