From: Jonathan Marek <jonathan@marek.ca>
To: linux-arm-msm@vger.kernel.org
Cc: Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org (open list:QCOM AUDIO (ASoC) DRIVERS),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 6/6] ASoC: codecs: wcd938x: fix get_swr_port behavior
Date: Mon, 24 Nov 2025 01:45:59 -0500 [thread overview]
Message-ID: <20251124064850.15419-7-jonathan@marek.ca> (raw)
In-Reply-To: <20251124064850.15419-1-jonathan@marek.ca>
For example trying to do this:
amixer sset HPHL on
amixer sset HPHR on
Both HPHL and HPHR share the same "portidx" value. After HPHL is enabled,
wcd939x_get_swr_port returns an 'on' state for HPHR as well, and nothing
happens when trying to set HPHR on because it looks like it is already on.
The result is audio plays only on the left side.
To fix this, drop the port_enable array and use ch_mask in port_config to
determine if the switch was enabled.
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
---
sound/soc/codecs/wcd938x.c | 9 +++++----
sound/soc/codecs/wcd938x.h | 1 -
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
index cf15190dd61a4..1768209e35ea0 100644
--- a/sound/soc/codecs/wcd938x.c
+++ b/sound/soc/codecs/wcd938x.c
@@ -1839,14 +1839,17 @@ static int wcd938x_get_swr_port(struct snd_kcontrol *kcontrol,
struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(comp);
struct wcd938x_sdw_priv *wcd;
struct soc_mixer_control *mixer = (struct soc_mixer_control *)kcontrol->private_value;
+ struct sdw_port_config *port_config;
int dai_id = mixer->shift;
- int portidx, ch_idx = mixer->reg;
+ int portidx, ch_idx = mixer->reg, ch_mask;
wcd = wcd938x->sdw_priv[dai_id];
portidx = wcd->ch_info[ch_idx].port_num;
+ ch_mask = wcd->ch_info[ch_idx].ch_mask;
+ port_config = &wcd->port_config[portidx - 1];
- ucontrol->value.integer.value[0] = wcd->port_enable[portidx];
+ ucontrol->value.integer.value[0] = !!(port_config->ch_mask & ch_mask);
return 0;
}
@@ -1872,8 +1875,6 @@ static int wcd938x_set_swr_port(struct snd_kcontrol *kcontrol,
else
enable = false;
- wcd->port_enable[portidx] = enable;
-
wcd938x_connect_port(wcd, portidx, ch_idx, enable);
return 1;
diff --git a/sound/soc/codecs/wcd938x.h b/sound/soc/codecs/wcd938x.h
index c18610466d7d8..6650c3788d6e5 100644
--- a/sound/soc/codecs/wcd938x.h
+++ b/sound/soc/codecs/wcd938x.h
@@ -639,7 +639,6 @@ struct wcd938x_sdw_priv {
struct sdw_stream_runtime *sruntime;
struct sdw_port_config port_config[WCD938X_MAX_SWR_PORTS];
const struct wcd_sdw_ch_info *ch_info;
- bool port_enable[WCD938X_MAX_SWR_CH_IDS];
int active_ports;
bool is_tx;
struct wcd938x_priv *wcd938x;
--
2.51.0
prev parent reply other threads:[~2025-11-24 6:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 6:45 [PATCH 0/6] wcd938x/wcd939x fixes Jonathan Marek
2025-11-24 6:45 ` [PATCH 1/6] ASoC: codecs: wsa884x: remove mute_unmute_on_trigger Jonathan Marek
2025-11-24 14:08 ` Srinivas Kandagatla
2025-11-24 14:55 ` Jonathan Marek
2025-11-26 18:44 ` Alexey Klimov
2025-11-27 10:14 ` Srinivas Kandagatla
2025-11-27 13:57 ` Jonathan Marek
2025-11-24 6:45 ` [PATCH 2/6] ASoC: codecs: wsa883x: " Jonathan Marek
2025-11-24 6:45 ` [PATCH 3/6] ASoC: codecs: wcd939x: fix headphone pop/click sound Jonathan Marek
2025-11-24 6:45 ` [PATCH 4/6] ASoC: codecs: wcd938x: " Jonathan Marek
2025-11-24 6:45 ` [PATCH 5/6] ASoC: codecs: wcd939x: fix get_swr_port behavior Jonathan Marek
2025-11-24 6:45 ` Jonathan Marek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251124064850.15419-7-jonathan@marek.ca \
--to=jonathan@marek.ca \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox