Commit 3b247eea authored by Yassine Oudjana's avatar Yassine Oudjana Committed by Mark Brown

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: default avatarYassine Oudjana <y.oudjana@protonmail.com>
Link: https://lore.kernel.org/r/20220104033356.343685-1-y.oudjana@protonmail.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 71125508
...@@ -341,7 +341,7 @@ struct wcd9335_codec { ...@@ -341,7 +341,7 @@ struct wcd9335_codec {
int reset_gpio; int reset_gpio;
struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; 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; unsigned int tx_port_value;
int hph_l_gain; int hph_l_gain;
int hph_r_gain; int hph_r_gain;
...@@ -1269,10 +1269,11 @@ static const struct snd_kcontrol_new sb_tx8_mux = ...@@ -1269,10 +1269,11 @@ static const struct snd_kcontrol_new sb_tx8_mux =
static int slim_rx_mux_get(struct snd_kcontrol *kc, static int slim_rx_mux_get(struct snd_kcontrol *kc,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc); struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kc);
struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev); 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; return 0;
} }
...@@ -1286,9 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, ...@@ -1286,9 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
struct snd_soc_dapm_update *update = NULL; struct snd_soc_dapm_update *update = NULL;
u32 port_id = w->shift; 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: case 0:
list_del_init(&wcd->rx_chs[port_id].list); list_del_init(&wcd->rx_chs[port_id].list);
break; break;
...@@ -1309,11 +1310,11 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc, ...@@ -1309,11 +1310,11 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
&wcd->dai[AIF4_PB].slim_ch_list); &wcd->dai[AIF4_PB].slim_ch_list);
break; break;
default: 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; 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); e, update);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment