Skip to content

Commit 3b247ee

Browse files
Tooniisbroonie
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7112550 commit 3b247ee

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

sound/soc/codecs/wcd9335.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ struct wcd9335_codec {
341341
int reset_gpio;
342342
struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY];
343343

344-
unsigned int rx_port_value;
344+
unsigned int rx_port_value[WCD9335_RX_MAX];
345345
unsigned int tx_port_value;
346346
int hph_l_gain;
347347
int hph_r_gain;
@@ -1269,10 +1269,11 @@ static const struct snd_kcontrol_new sb_tx8_mux =
12691269
static int slim_rx_mux_get(struct snd_kcontrol *kc,
12701270
struct snd_ctl_elem_value *ucontrol)
12711271
{
1272-
struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kc);
1273-
struct wcd9335_codec *wcd = dev_get_drvdata(dapm->dev);
1272+
struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kc);
1273+
struct wcd9335_codec *wcd = dev_get_drvdata(w->dapm->dev);
1274+
u32 port_id = w->shift;
12741275

1275-
ucontrol->value.enumerated.item[0] = wcd->rx_port_value;
1276+
ucontrol->value.enumerated.item[0] = wcd->rx_port_value[port_id];
12761277

12771278
return 0;
12781279
}
@@ -1286,9 +1287,9 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
12861287
struct snd_soc_dapm_update *update = NULL;
12871288
u32 port_id = w->shift;
12881289

1289-
wcd->rx_port_value = ucontrol->value.enumerated.item[0];
1290+
wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
12901291

1291-
switch (wcd->rx_port_value) {
1292+
switch (wcd->rx_port_value[port_id]) {
12921293
case 0:
12931294
list_del_init(&wcd->rx_chs[port_id].list);
12941295
break;
@@ -1309,11 +1310,11 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
13091310
&wcd->dai[AIF4_PB].slim_ch_list);
13101311
break;
13111312
default:
1312-
dev_err(wcd->dev, "Unknown AIF %d\n", wcd->rx_port_value);
1313+
dev_err(wcd->dev, "Unknown AIF %d\n", wcd->rx_port_value[port_id]);
13131314
goto err;
13141315
}
13151316

1316-
snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value,
1317+
snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id],
13171318
e, update);
13181319

13191320
return 0;

0 commit comments

Comments
 (0)