Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Srinivas Kandagatla" <srinivas.kandagatla@oss.qualcomm.com>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 06/24] ASoC: codecs: wsa884x: add VI sense capture DAI
Date: Fri, 04 Dec 2026 12:38:45 +0000	[thread overview]
Message-ID: <sashiko-outbox-249817@kernel.org> (raw)
In-Reply-To: <20261204113101.1141644-7-srinivas.kandagatla@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] ASoC: wsa884x: wsa884x_vi_hw_params() early return restored in
  later patch
- [Medium] ASoC: wsa884x: 0-based SoundWire port bitmasks in
  wsa884x_probe()
- [Medium] ASoC: wsa884x: wsa884x_vi_hw_params() retains stale VI slave
  on ON->OFF
--

commit 6c4b9dc62cf97c2e651c0b64607fa0cb3c6ee792
Author: Ravi Hothi <ravi.hothi@oss.qualcomm.com>

ASoC: codecs: wsa884x: add VI sense capture DAI

This commit moves the WSA884x VI sense port from the sink port list to
the source port list and adds a separate VI capture DAI with its own
SoundWire stream runtime and DAI ops.

> diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c
> index f58ce92c46d40..abf9d88ec7a8a 100644
> --- a/sound/soc/codecs/wsa884x.c
> +++ b/sound/soc/codecs/wsa884x.c

[ ... ]

> @@ -1767,6 +1774,29 @@ 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);
> +	unsigned int num_ports = 0;
> +
> +	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;
> +
> +	if (wsa884x->port_enable[WSA884X_PORT_VISENSE]) {
> +		wsa884x->vi_port_config = wsa884x_pconfig[WSA884X_PORT_VISENSE];
> +		num_ports = 1;
> +	}
> +
> +	return sdw_stream_add_slave(wsa884x->slave, &wsa884x->vi_sconfig,
> +				    &wsa884x->vi_port_config, num_ports,
> +				    wsa884x->vi_sruntime);
> +}

[Severity: High]
Does commit "ASoC: codecs: wsa884x: register the die temperature as a
thermal zone" later in this series accidentally revert this block back to
returning 0 early when port_enable[WSA884X_PORT_VISENSE] is false?

With that early return restored, vi_sruntime is never configured when
VISENSE Switch is off (its default state after probe).  After hw_free()
on an open substream, qcom_swrm_hw_free() calls sdw_stream_remove_master()
and transitions vi_sruntime->state to SDW_STREAM_RELEASED.

On the next hw_params() and prepare(), qcom_snd_sdw_prepare() only skips
SDW_STREAM_ALLOCATED and calls sdw_prepare_stream(vi_sruntime), which
rejects SDW_STREAM_RELEASED with -EINVAL and breaks speaker playback.

If empty VI streams should be skipped instead of adding a zero-port slave,
qcom_snd_sdw_prepare() and qcom_snd_sdw_hw_free() in commit "ASoC: qcom:
sdw: add per-direction stream runtimes for multi_direction links" should
skip both SDW_STREAM_ALLOCATED and SDW_STREAM_RELEASED.

[Severity: Medium]
Can repeated hw_params() calls without an intervening hw_free() leave the
WSA884x slave runtime and DP5 port attached to vi_sruntime after VISENSE
Switch is turned off?

ALSA core (hw_params_state_check()) and ASoC DPCM (dpcm_be_dai_hw_params())
allow consecutive hw_params() calls without hw_free().  If VISENSE Switch
is enabled on the first call and disabled before the second,
wsa884x_vi_hw_params() never calls sdw_stream_remove_slave().

In this patch, sdw_stream_add_slave() sees sdw_slave_port_allocated(s_rt)
is already true, keeps and reconfigures DP5 from the stale vi_port_config,
and double-counts ch_count in sdw_config_stream().  Even with the early
return later in the series, DP5 stays attached and enabled on prepare().

Calling sdw_stream_remove_slave(wsa884x->slave, wsa884x->vi_sruntime) when
port_enable[WSA884X_PORT_VISENSE] is false detaches any stale port cleanly.

[ ... ]

> @@ -2091,9 +2156,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;

[Severity: Medium]
Should sink_ports and source_ports use 1-based SoundWire Data Port bit
positions instead of 0-based enum wsa884x_port_ids values?

SoundWire core defines source_ports and sink_ports as 1-based bitmasks
covering Data Ports 1..14, matching dpn_prop[].num (where VISENSE is
WSA884X_PORT_VISENSE + 1, or DP5).  sdw_slave_sysfs_dpn_init() creates
dpN_src and dpN_sink sysfs groups directly from each set bit.

As written, source_ports sets bit 4 (dp4_src) instead of bit 5 (dp5_src),
and sink_ports exposes an invalid dp0_sink and a misnumbered dp5_sink.

Using GENMASK(WSA884X_MAX_SWR_PORTS, 1) & ~BIT(WSA884X_PORT_VISENSE + 1)
and BIT(WSA884X_PORT_VISENSE + 1) matches the 1-based dpn_prop numbers.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204113101.1141644-1-srinivas.kandagatla@oss.qualcomm.com?part=6

  reply	other threads:[~2026-12-04 12:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:30 [PATCH v5 00/24] ASoC: qcom: AudioReach Active speaker protection for WSA88xx Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 01/24] ASoC: soc-core: bump MAX_DEFAULT_CH_MAP_SIZE to 18 Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 02/24] ASoC: soc-pcm: add multi_direction_codecs link flag Srinivas Kandagatla
2026-12-04 12:01   ` sashiko-bot
2026-12-04 11:30 ` [PATCH v5 03/24] ASoC: soc-dai: export snd_soc_dai_stream_valid Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 04/24] ASoC: qcom: sdw: add per-direction stream runtimes for multi_direction links Srinivas Kandagatla
2026-12-04 12:12   ` sashiko-bot
2026-12-04 11:30 ` [PATCH v5 05/24] ASoC: dt-bindings: qcom,wsa8840: allow one sound DAI cell Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 06/24] ASoC: codecs: wsa884x: add VI sense capture DAI Srinivas Kandagatla
2026-12-04 12:38   ` sashiko-bot [this message]
2026-12-04 11:30 ` [PATCH v5 07/24] ASoC: codecs: wsa883x: " Srinivas Kandagatla
2026-12-04 12:33   ` sashiko-bot
2026-12-04 11:30 ` [PATCH v5 08/24] ASoC: codecs: wsa884x: register the die temperature as a thermal zone Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 09/24] ASoC: qcom: audioreach: add control link support to graphs Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 10/24] ASoC: qcom: audioreach: run VI module in calibration mode with per-speaker events Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 11/24] ASoC: qcom: q6apm-dai: add S32_LE format support Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 12/24] ASoC: qcom: audioreach: cache VI calibration results per speaker Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 13/24] ASoC: qcom: audioreach: add speaker protection calibration trigger infrastructure Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 14/24] ASoC: qcom: audioreach: send cached R0/T0 to the VI module in normal mode Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 15/24] ASoC: qcom: audioreach: send static cfg blobs to speaker protection modules Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 16/24] ASoC: qcom: audioreach: add speaker protection mixer controls Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 17/24] ASoC: qcom: audioreach: pin SPEAKER_PROTECTION_VI media format Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 18/24] ASoC: qcom: audioreach: add live speaker temperature (T0) readback Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 19/24] ASoC: qcom: audioreach: add speaker protection calibration state control Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 20/24] ASoC: qcom: x1e80100: carry WSA VI feedback on the WSA Playback BE link Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 21/24] ASoC: qcom: x1e80100: register WSA speaker thermal zones for speaker protection Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 22/24] arm64: dts: qcom: glymur-crd: add WSA speaker protection VI feedback Srinivas Kandagatla
2026-12-04 11:30 ` [PATCH v5 23/24] arm64: dts: qcom: mahua-t14s: " Srinivas Kandagatla
2026-12-04 11:31 ` [PATCH v5 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=sashiko-outbox-249817@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=srinivas.kandagatla@oss.qualcomm.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