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@oss.qualcomm.com>
Subject: [PATCH v2 06/24] ASoC: codecs: wsa884x: add VI sense capture DAI
Date: Sun, 22 Nov 2026 16:14:19 +0000 [thread overview]
Message-ID: <20261122161437.5994-7-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 VI sense port carries the voltage and current sense data that DSP
speaker protection needs, but it is described as a sink port next to
the playback ports and has no DAI, so nothing can capture from it.
Make it a source port with its own capture DAI, ops and stream runtime,
and leave it out of the playback port list. sdw_get_slave_dpn_prop()
searches the sink port properties by count, so pack that array densely
now that VI sense is no longer in it.
Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
sound/soc/codecs/wsa884x.c | 95 ++++++++++++++++++++++++++++++++------
1 file changed, 80 insertions(+), 15 deletions(-)
diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c
index f58ce92c46d4..91aa004d7137 100644
--- a/sound/soc/codecs/wsa884x.c
+++ b/sound/soc/codecs/wsa884x.c
@@ -732,8 +732,11 @@ struct wsa884x_priv {
struct regulator_bulk_data supplies[WSA884X_SUPPLIES_NUM];
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[WSA884X_MAX_SWR_PORTS];
+ struct sdw_port_config vi_port_config;
struct gpio_desc *sd_n;
struct reset_control *sd_reset;
bool port_prepared[WSA884X_MAX_SWR_PORTS];
@@ -822,8 +825,8 @@ enum wsa884x_mode {
static const struct soc_enum wsa884x_dev_mode_enum =
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wsa884x_dev_mode_text), wsa884x_dev_mode_text);
-static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
- [WSA884X_PORT_DAC] = {
+static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS - 1] = {
+ {
.num = WSA884X_PORT_DAC + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
@@ -831,7 +834,7 @@ static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
- [WSA884X_PORT_COMP] = {
+ {
.num = WSA884X_PORT_COMP + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
@@ -839,7 +842,7 @@ static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
- [WSA884X_PORT_BOOST] = {
+ {
.num = WSA884X_PORT_BOOST + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
@@ -847,7 +850,7 @@ static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
- [WSA884X_PORT_PBR] = {
+ {
.num = WSA884X_PORT_PBR + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
@@ -855,22 +858,25 @@ static struct sdw_dpn_prop wsa884x_sink_dpn_prop[WSA884X_MAX_SWR_PORTS] = {
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
- [WSA884X_PORT_VISENSE] = {
- .num = WSA884X_PORT_VISENSE + 1,
+ {
+ .num = WSA884X_PORT_CPS + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
- .max_ch = 2,
+ .max_ch = 1,
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
- },
- [WSA884X_PORT_CPS] = {
- .num = WSA884X_PORT_CPS + 1,
+ }
+};
+
+static struct sdw_dpn_prop wsa884x_src_dpn_prop[] = {
+ {
+ .num = WSA884X_PORT_VISENSE + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
- .max_ch = 1,
+ .max_ch = 2,
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
- }
+ },
};
static const struct sdw_port_config wsa884x_pconfig[WSA884X_MAX_SWR_PORTS] = {
@@ -892,6 +898,7 @@ static const struct sdw_port_config wsa884x_pconfig[WSA884X_MAX_SWR_PORTS] = {
},
[WSA884X_PORT_VISENSE] = {
.num = WSA884X_PORT_VISENSE + 1,
+ /* V and I sense pair */
.ch_mask = 0x3,
},
[WSA884X_PORT_CPS] = {
@@ -1767,6 +1774,27 @@ static const struct snd_soc_component_driver wsa884x_component_drv = {
.num_dapm_routes = ARRAY_SIZE(wsa884x_audio_map),
};
+static int wsa884x_vi_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_dai *dai)
+{
+ struct wsa884x_priv *wsa884x = dev_get_drvdata(dai->dev);
+
+ if (!wsa884x->port_enable[WSA884X_PORT_VISENSE])
+ return 0;
+
+ wsa884x->vi_port_config = wsa884x_pconfig[WSA884X_PORT_VISENSE];
+ wsa884x->vi_sconfig.frame_rate = params_rate(params);
+ wsa884x->vi_sconfig.ch_count = 2;
+ wsa884x->vi_sconfig.bps = 1;
+ wsa884x->vi_sconfig.type = SDW_STREAM_PDM;
+ wsa884x->vi_sconfig.direction = SDW_DATA_DIR_TX;
+
+ return sdw_stream_add_slave(wsa884x->slave, &wsa884x->vi_sconfig,
+ &wsa884x->vi_port_config, 1,
+ wsa884x->vi_sruntime);
+}
+
static int wsa884x_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
@@ -1776,6 +1804,9 @@ static int wsa884x_hw_params(struct snd_pcm_substream *substream,
wsa884x->active_ports = 0;
for (i = 0; i < WSA884X_MAX_SWR_PORTS; i++) {
+ /* VISENSE is driven by the separate VI capture DAI */
+ if (i == WSA884X_PORT_VISENSE)
+ continue;
if (!wsa884x->port_enable[i])
continue;
@@ -1800,6 +1831,16 @@ static int wsa884x_hw_free(struct snd_pcm_substream *substream,
return 0;
}
+static int wsa884x_vi_hw_free(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+ struct wsa884x_priv *wsa884x = dev_get_drvdata(dai->dev);
+
+ sdw_stream_remove_slave(wsa884x->slave, wsa884x->vi_sruntime);
+
+ return 0;
+}
+
static int wsa884x_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
{
struct snd_soc_component *component = dai->component;
@@ -1829,11 +1870,20 @@ static int wsa884x_set_stream(struct snd_soc_dai *dai,
{
struct wsa884x_priv *wsa884x = dev_get_drvdata(dai->dev);
- wsa884x->sruntime = stream;
+ if (direction == SNDRV_PCM_STREAM_CAPTURE)
+ wsa884x->vi_sruntime = stream;
+ else
+ wsa884x->sruntime = stream;
return 0;
}
+static const struct snd_soc_dai_ops wsa884x_vi_dai_ops = {
+ .hw_params = wsa884x_vi_hw_params,
+ .hw_free = wsa884x_vi_hw_free,
+ .set_stream = wsa884x_set_stream,
+};
+
static const struct snd_soc_dai_ops wsa884x_dai_ops = {
.hw_params = wsa884x_hw_params,
.hw_free = wsa884x_hw_free,
@@ -1856,6 +1906,19 @@ static struct snd_soc_dai_driver wsa884x_dais[] = {
},
.ops = &wsa884x_dai_ops,
},
+ {
+ .name = "VI",
+ .capture = {
+ .stream_name = "VI Capture",
+ .rates = WSA884X_RATES | WSA884X_FRAC_RATES,
+ .formats = WSA884X_FORMATS,
+ .rate_min = 8000,
+ .rate_max = 384000,
+ .channels_min = 1,
+ .channels_max = 2,
+ },
+ .ops = &wsa884x_vi_dai_ops,
+ },
};
static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp)
@@ -2091,9 +2154,11 @@ static int wsa884x_probe(struct sdw_slave *pdev,
WSA884X_MAX_SWR_PORTS))
dev_dbg(dev, "Static Port mapping not specified\n");
- pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS - 1, 0);
+ pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS - 1, 0) & ~BIT(WSA884X_PORT_VISENSE);
+ pdev->prop.source_ports = BIT(WSA884X_PORT_VISENSE);
pdev->prop.simple_clk_stop_capable = true;
pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop;
+ pdev->prop.src_dpn_prop = wsa884x_src_dpn_prop;
pdev->prop.scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
wsa884x_reset_deassert(wsa884x);
--
2.53.0
next prev parent reply other threads:[~2026-11-22 16:15 UTC|newest]
Thread overview: 75+ 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-23 13:58 ` Pierre-Louis Bossart
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 ` Srinivas Kandagatla [this message]
2026-11-22 16:14 ` [PATCH v2 07/24] ASoC: codecs: wsa883x: add VI sense capture DAI Srinivas Kandagatla
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-23 19:35 ` Abel Vesa
2026-11-22 16:14 ` [PATCH v2 23/24] arm64: dts: qcom: mahua-t14s: " Srinivas Kandagatla
2026-11-23 19:35 ` Abel Vesa
2026-11-22 16:14 ` [PATCH v2 24/24] arm64: dts: qcom: x1e78100-t14s: " Srinivas Kandagatla
2026-11-23 19:36 ` Abel Vesa
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-7-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=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®