From: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
To: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>
Cc: Srinivas Kandagatla <srini@kernel.org>,
Abel Vesa <abelvesa@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Ravi Hothi <ravi.hothi@oss.qualcomm.com>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH v2 07/24] ASoC: codecs: wsa883x: add VI sense capture DAI
Date: Sun, 22 Nov 2026 16:14:20 +0000 [thread overview]
Message-ID: <20261122161437.5994-8-srinivas.kandagatla@oss.qualcomm.com> (raw)
In-Reply-To: <20261023171433.820092-1-srinivas.kandagatla@oss.qualcomm.com>
From: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
The speaker's VISENSE port carries the voltage and current sense data
the ADSP speaker protection VI module needs, but it was described as
a sink port alongside the playback ports and had no DAI, so nothing
could capture from it.
Move VISENSE into the source port mask with its own dpn property,
give it a capture DAI with its own ops and stream runtime, and skip
it when wsa883x_hw_params() builds the playback port list so the two
streams are configured independently.
Each VISENSE frame word carries the voltage sense in its low half
and the current sense in its high half, so this is a two channel
port; a single channel mask would deliver only half the pair to the
DSP. Matches what Qualcomm's own driver uses for both wsa883x and
wsa884x.
Also install a bus_config handler that programs SCP_HOST_CLK_DIV2 on
the next-bank slot: wsa883x needs this to agree with the controller
on the bus clock divider once a VI stream is enabled.
Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/codecs/wsa883x.c | 77 +++++++++++++++++++++++++++++++++++---
1 file changed, 71 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index 64391d654a08..6de669288d6a 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -437,6 +437,8 @@
#define WSA883X_VERSION_1_0 0
#define WSA883X_VERSION_1_1 1
+#define SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(m) (0xE0 + 0x10 * (m))
+
#define WSA883X_MAX_SWR_PORTS 4
#define WSA883X_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
@@ -468,8 +470,11 @@ struct wsa883x_priv {
struct regulator *vdd;
struct sdw_slave *slave;
struct sdw_stream_config sconfig;
+ struct sdw_stream_config vi_sconfig;
struct sdw_stream_runtime *sruntime;
+ struct sdw_stream_runtime *vi_sruntime;
struct sdw_port_config port_config[WSA883X_MAX_SWR_PORTS];
+ struct sdw_port_config vi_port_config;
struct gpio_desc *sd_n;
struct reset_control *sd_reset;
bool port_prepared[WSA883X_MAX_SWR_PORTS];
@@ -522,7 +527,7 @@ enum {
static const struct soc_enum wsa_dev_mode_enum =
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wsa_dev_mode_text), wsa_dev_mode_text);
-/* 4 ports */
+/* 3 sink ports, VISENSE is a source port */
static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = {
[WSA883X_PORT_DAC] = {
.num = WSA883X_PORT_DAC + 1,
@@ -548,14 +553,17 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = {
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
- [WSA883X_PORT_VISENSE] = {
+};
+
+static struct sdw_dpn_prop wsa_src_dpn_prop[] = {
+ {
.num = WSA883X_PORT_VISENSE + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
.max_ch = 2,
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
- }
+ },
};
static const struct sdw_port_config wsa883x_pconfig[WSA883X_MAX_SWR_PORTS] = {
@@ -1125,8 +1133,16 @@ static int wsa883x_port_prep(struct sdw_slave *slave,
return 0;
}
+static int wsa883x_bus_config(struct sdw_slave *slave,
+ struct sdw_bus_params *params)
+{
+ sdw_write(slave, SWRS_SCP_HOST_CLK_DIV2_CTL_BANK(params->next_bank), 0x01);
+ return 0;
+}
+
static const struct sdw_slave_ops wsa883x_slave_ops = {
.update_status = wsa883x_update_status,
+ .bus_config = wsa883x_bus_config,
.port_prep = wsa883x_port_prep,
};
@@ -1335,6 +1351,25 @@ static const struct snd_soc_component_driver wsa883x_component_drv = {
.num_dapm_routes = ARRAY_SIZE(wsa883x_audio_map),
};
+static int wsa883x_vi_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct wsa883x_priv *wsa883x = dev_get_drvdata(dai->dev);
+
+ wsa883x->vi_port_config = wsa883x_pconfig[WSA883X_PORT_VISENSE];
+ wsa883x->vi_sconfig.frame_rate = params_rate(params);
+ /* VISENSE carries the V and I sense pair */
+ wsa883x->vi_sconfig.ch_count = 2;
+ wsa883x->vi_sconfig.bps = 1;
+ wsa883x->vi_sconfig.type = SDW_STREAM_PDM;
+ wsa883x->vi_sconfig.direction = SDW_DATA_DIR_TX;
+
+ return sdw_stream_add_slave(wsa883x->slave, &wsa883x->vi_sconfig,
+ &wsa883x->vi_port_config, 1,
+ wsa883x->vi_sruntime);
+}
+
static int wsa883x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -1344,6 +1379,9 @@ static int wsa883x_hw_params(struct snd_pcm_substream *substream,
wsa883x->active_ports = 0;
for (i = 0; i < WSA883X_MAX_SWR_PORTS; i++) {
+ /* VISENSE is driven by the separate VI capture DAI */
+ if (i == WSA883X_PORT_VISENSE)
+ continue;
if (!wsa883x->port_enable[i])
continue;
@@ -1363,7 +1401,10 @@ static int wsa883x_hw_free(struct snd_pcm_substream *substream,
{
struct wsa883x_priv *wsa883x = dev_get_drvdata(dai->dev);
- sdw_stream_remove_slave(wsa883x->slave, wsa883x->sruntime);
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
+ sdw_stream_remove_slave(wsa883x->slave, wsa883x->vi_sruntime);
+ else
+ sdw_stream_remove_slave(wsa883x->slave, wsa883x->sruntime);
return 0;
}
@@ -1373,7 +1414,10 @@ static int wsa883x_set_sdw_stream(struct snd_soc_dai *dai,
{
struct wsa883x_priv *wsa883x = dev_get_drvdata(dai->dev);
- wsa883x->sruntime = stream;
+ if (direction == SNDRV_PCM_STREAM_CAPTURE)
+ wsa883x->vi_sruntime = stream;
+ else
+ wsa883x->sruntime = stream;
return 0;
}
@@ -1401,6 +1445,12 @@ static int wsa883x_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
return 0;
}
+static const struct snd_soc_dai_ops wsa883x_vi_dai_ops = {
+ .hw_params = wsa883x_vi_hw_params,
+ .hw_free = wsa883x_hw_free,
+ .set_stream = wsa883x_set_sdw_stream,
+};
+
static const struct snd_soc_dai_ops wsa883x_dai_ops = {
.hw_params = wsa883x_hw_params,
.hw_free = wsa883x_hw_free,
@@ -1423,6 +1473,19 @@ static struct snd_soc_dai_driver wsa883x_dais[] = {
},
.ops = &wsa883x_dai_ops,
},
+ {
+ .name = "VI",
+ .capture = {
+ .stream_name = "VI Capture",
+ .rates = WSA883X_RATES | WSA883X_FRAC_RATES,
+ .formats = WSA883X_FORMATS,
+ .rate_min = 8000,
+ .rate_max = 352800,
+ .channels_min = 1,
+ .channels_max = 2,
+ },
+ .ops = &wsa883x_vi_dai_ops,
+ },
};
static int wsa883x_get_temp(struct wsa883x_priv *wsa883x, long *temp)
@@ -1636,9 +1699,11 @@ static int wsa883x_probe(struct sdw_slave *pdev,
WSA883X_MAX_SWR_PORTS))
dev_dbg(dev, "Static Port mapping not specified\n");
- pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS - 1, 0);
+ pdev->prop.sink_ports = GENMASK(WSA883X_PORT_BOOST, 0);
+ pdev->prop.source_ports = BIT(WSA883X_PORT_VISENSE);
pdev->prop.simple_clk_stop_capable = true;
pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
+ pdev->prop.src_dpn_prop = wsa_src_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
wsa883x_reset_deassert(wsa883x);
--
2.53.0
next prev parent reply other threads:[~2026-11-22 16:15 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 17:14 [RFC PATCH 00/23] ASoC: qcom: AudioReach Active speaker protection for WSA884x Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 01/23] ASoC: soc-core: allow default ch_maps on links with more than 8 DAIs Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 02/23] ASoC: soc-pcm: add multi_direction_codecs link flag Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 03/23] ASoC: qcom: sdw: add per-direction stream runtimes for multi_direction links Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 04/23] ASoC: dt-bindings: qcom,wsa8840: allow one sound DAI cell Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 05/23] ASoC: codecs: wsa884x: add VI sense capture DAI Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:03 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 06/23] ASoC: codecs: wsa884x: register the die temperature as a thermal zone Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 07/23] ASoC: qcom: audioreach: add control link support to graphs Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 08/23] ASoC: qcom: audioreach: run VI module in calibration mode with per-speaker events Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:04 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 09/23] ASoC: qcom: q6apm-dai: add S32_LE format support Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 10/23] ASoC: qcom: audioreach: support up to four speakers in VI feedback Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 11/23] ASoC: qcom: audioreach: cache VI calibration results per speaker Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 12/23] ASoC: qcom: audioreach: make the speaker protection operation mode configurable Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 13/23] ASoC: qcom: audioreach: send cached R0/T0 to the VI module in normal mode Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 14/23] ASoC: qcom: audioreach: send static cfg blobs to speaker protection modules Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 15/23] ASoC: qcom: audioreach: add speaker protection mixer controls Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 16/23] ASoC: qcom: audioreach: pin SPEAKER_PROTECTION_VI media format Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 17/23] ASoC: qcom: audioreach: add live speaker temperature (T0) readback Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 18/23] ASoC: qcom: audioreach: add speaker protection calibration state control Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 19/23] ASoC: qcom: audioreach: keep the last VI calibration result until the DSP reports Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 20/23] ASoC: qcom: x1e80100: carry WSA VI feedback on the WSA Playback BE link Srinivas Kandagatla
2026-11-15 17:36 ` Mark Brown
2026-11-15 21:03 ` Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 21/23] ASoC: qcom: x1e80100: register WSA speaker thermal zones for speaker protection Srinivas Kandagatla
2026-10-23 17:14 ` [RFC PATCH 22/23] arm64: dts: qcom: glymur-crd: add WSA speaker protection VI feedback Srinivas Kandagatla
2026-10-28 13:38 ` Konrad Dybcio
2026-10-28 21:59 ` Srinivas Kandagatla
2026-10-29 8:17 ` Konrad Dybcio
2026-10-23 17:14 ` [RFC PATCH 23/23] arm64: dts: qcom: mahua-t14s: " Srinivas Kandagatla
2026-10-28 12:39 ` [RFC PATCH 00/23] ASoC: qcom: AudioReach Active speaker protection for WSA884x Mark Brown
2026-10-28 16:31 ` Fabian Renn-Giles
2026-10-28 21:56 ` Srinivas Kandagatla
2026-11-15 22:07 ` Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 00/24] ASoC: qcom: AudioReach Active speaker protection for WSA88xx Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 01/24] ASoC: soc-core: always allocate default ch_maps Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 02/24] ASoC: soc-pcm: add multi_direction_codecs link flag Srinivas Kandagatla
2026-11-23 9:39 ` Pierre-Louis Bossart
2026-11-23 11:00 ` Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 03/24] ASoC: soc-dai: export snd_soc_dai_stream_valid Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 04/24] ASoC: qcom: sdw: add per-direction stream runtimes for multi_direction links Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 05/24] ASoC: dt-bindings: qcom,wsa8840: allow one sound DAI cell Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 06/24] ASoC: codecs: wsa884x: add VI sense capture DAI Srinivas Kandagatla
2026-11-22 16:14 ` Srinivas Kandagatla [this message]
2026-11-22 16:14 ` [PATCH v2 08/24] ASoC: codecs: wsa884x: register the die temperature as a thermal zone Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 09/24] ASoC: qcom: audioreach: add control link support to graphs Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 10/24] ASoC: qcom: audioreach: run VI module in calibration mode with per-speaker events Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 11/24] ASoC: qcom: q6apm-dai: add S32_LE format support Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 12/24] ASoC: qcom: audioreach: cache VI calibration results per speaker Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 13/24] ASoC: qcom: audioreach: add speaker protection calibration trigger infrastructure Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 14/24] ASoC: qcom: audioreach: send cached R0/T0 to the VI module in normal mode Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 15/24] ASoC: qcom: audioreach: send static cfg blobs to speaker protection modules Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 16/24] ASoC: qcom: audioreach: add speaker protection mixer controls Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 17/24] ASoC: qcom: audioreach: pin SPEAKER_PROTECTION_VI media format Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 18/24] ASoC: qcom: audioreach: add live speaker temperature (T0) readback Srinivas Kandagatla
2026-11-23 11:57 ` kernel test robot
2026-11-22 16:14 ` [PATCH v2 19/24] ASoC: qcom: audioreach: add speaker protection calibration state control Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 20/24] ASoC: qcom: x1e80100: carry WSA VI feedback on the WSA Playback BE link Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 21/24] ASoC: qcom: x1e80100: register WSA speaker thermal zones for speaker protection Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 22/24] arm64: dts: qcom: glymur-crd: add WSA speaker protection VI feedback Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 23/24] arm64: dts: qcom: mahua-t14s: " Srinivas Kandagatla
2026-11-22 16:14 ` [PATCH v2 24/24] arm64: dts: qcom: x1e78100-t14s: " Srinivas Kandagatla
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=20261122161437.5994-8-srinivas.kandagatla@oss.qualcomm.com \
--to=srinivas.kandagatla@oss.qualcomm.com \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=ravi.hothi@oss.qualcomm.com \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=srini@kernel.org \
--cc=srinivas.kandagatla@linaro.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
all inboxes | Powered by JetHome®