* [PATCH 1/4] soundwire: qcom: always set master port_params.num
2026-11-25 10:38 [PATCH 0/4] soundwire: qcom: fixes and multi-master follow-ups Srinivas Kandagatla
@ 2026-11-25 10:38 ` Srinivas Kandagatla
2026-11-25 10:53 ` Marek Szyprowski
2026-11-25 10:38 ` [PATCH 2/4] soundwire: qcom: skip offset2 write when unset Srinivas Kandagatla
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Srinivas Kandagatla @ 2026-11-25 10:38 UTC (permalink / raw)
To: Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, Srinivas Kandagatla,
Marek Szyprowski, linux-sound, linux-arm-msm, Srinivas Kandagatla,
stable
qcom_swrm_compute_params() populates p_rt->port_params only when the
DT entry for that master port carries a valid word-length. If the DT
marks word-length as SWR_INVALID_PARAM, port_params is left
zero-initialised and the subsequent dpn_set_port_params() callback
sees port_num == 0, tripping the port_target() sanity check on the
capture path. The callback then also writes bps - 1 = 0xffffffff to
DPn_BLOCK_CTRL_1(offset, 0), which is outside the DPn register range.
Split the per-port assignment: always set num/flow_mode/data_mode so
that the callback receives a semantically correct port identifier,
and only derive bps from the DT when a word length is given. Guard
the callback so no register write is issued when bps is unset, and
bound-check p_rt->num against ctrl->nports before indexing
ctrl->pconfig[].
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Closes: https://lore.kernel.org/all/20261125091150.2145177-1-m.szyprowski@samsung.com/
Fixes: 128eaf937adb ("soundwire: qcom: add support to missing transport params")
Cc: stable@vger.kernel.org
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
drivers/soundwire/qcom.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 65add9a74ffd..95444eee4c0b 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1209,6 +1209,9 @@ static int qcom_swrm_port_params(struct sdw_bus *bus,
struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
u32 offset = ctrl->reg_layout[SWRM_OFFSET_DP_BLOCK_CTRL_1];
+ if (!p_params->bps)
+ return 0;
+
return qcom_swrm_port_reg_write(ctrl, p_params->num,
SWRM_DPn_BLOCK_CTRL_1(offset, p_params->num),
p_params->bps - 1);
@@ -1341,15 +1344,17 @@ static int qcom_swrm_compute_params(struct sdw_bus *bus, struct sdw_stream_runti
list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
+ if (p_rt->num == 0 || p_rt->num > ctrl->nports) {
+ dev_err(ctrl->dev, "master port %d out of range\n", p_rt->num);
+ return -EINVAL;
+ }
pcfg = &ctrl->pconfig[p_rt->num];
p_rt->transport_params.port_num = p_rt->num;
- if (pcfg->word_length != SWR_INVALID_PARAM) {
- sdw_fill_port_params(&p_rt->port_params,
- p_rt->num, pcfg->word_length + 1,
- SDW_PORT_FLOW_MODE_ISOCH,
- SDW_PORT_DATA_MODE_NORMAL);
- }
-
+ p_rt->port_params.num = p_rt->num;
+ p_rt->port_params.flow_mode = SDW_PORT_FLOW_MODE_ISOCH;
+ p_rt->port_params.data_mode = SDW_PORT_DATA_MODE_NORMAL;
+ if (pcfg->word_length != SWR_INVALID_PARAM)
+ p_rt->port_params.bps = pcfg->word_length + 1;
}
list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 1/4] soundwire: qcom: always set master port_params.num
2026-11-25 10:38 ` [PATCH 1/4] soundwire: qcom: always set master port_params.num Srinivas Kandagatla
@ 2026-11-25 10:53 ` Marek Szyprowski
0 siblings, 0 replies; 8+ messages in thread
From: Marek Szyprowski @ 2026-11-25 10:53 UTC (permalink / raw)
To: Srinivas Kandagatla, Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, Srinivas Kandagatla, linux-sound,
linux-arm-msm, stable
On 25.11.2026 11:38, Srinivas Kandagatla wrote:
> qcom_swrm_compute_params() populates p_rt->port_params only when the
> DT entry for that master port carries a valid word-length. If the DT
> marks word-length as SWR_INVALID_PARAM, port_params is left
> zero-initialised and the subsequent dpn_set_port_params() callback
> sees port_num == 0, tripping the port_target() sanity check on the
> capture path. The callback then also writes bps - 1 = 0xffffffff to
> DPn_BLOCK_CTRL_1(offset, 0), which is outside the DPn register range.
>
> Split the per-port assignment: always set num/flow_mode/data_mode so
> that the callback receives a semantically correct port identifier,
> and only derive bps from the DT when a word length is given. Guard
> the callback so no register write is issued when bps is unset, and
> bound-check p_rt->num against ctrl->nports before indexing
> ctrl->pconfig[].
>
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Closes: https://lore.kernel.org/all/20261125091150.2145177-1-m.szyprowski@samsung.com/
> Fixes: 128eaf937adb ("soundwire: qcom: add support to missing transport params")
> Cc: stable@vger.kernel.org
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
This fixes the issue I've observed.
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> drivers/soundwire/qcom.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 65add9a74ffd..95444eee4c0b 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -1209,6 +1209,9 @@ static int qcom_swrm_port_params(struct sdw_bus *bus,
> struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
> u32 offset = ctrl->reg_layout[SWRM_OFFSET_DP_BLOCK_CTRL_1];
>
> + if (!p_params->bps)
> + return 0;
> +
> return qcom_swrm_port_reg_write(ctrl, p_params->num,
> SWRM_DPn_BLOCK_CTRL_1(offset, p_params->num),
> p_params->bps - 1);
> @@ -1341,15 +1344,17 @@ static int qcom_swrm_compute_params(struct sdw_bus *bus, struct sdw_stream_runti
>
> list_for_each_entry(m_rt, &bus->m_rt_list, bus_node) {
> list_for_each_entry(p_rt, &m_rt->port_list, port_node) {
> + if (p_rt->num == 0 || p_rt->num > ctrl->nports) {
> + dev_err(ctrl->dev, "master port %d out of range\n", p_rt->num);
> + return -EINVAL;
> + }
> pcfg = &ctrl->pconfig[p_rt->num];
> p_rt->transport_params.port_num = p_rt->num;
> - if (pcfg->word_length != SWR_INVALID_PARAM) {
> - sdw_fill_port_params(&p_rt->port_params,
> - p_rt->num, pcfg->word_length + 1,
> - SDW_PORT_FLOW_MODE_ISOCH,
> - SDW_PORT_DATA_MODE_NORMAL);
> - }
> -
> + p_rt->port_params.num = p_rt->num;
> + p_rt->port_params.flow_mode = SDW_PORT_FLOW_MODE_ISOCH;
> + p_rt->port_params.data_mode = SDW_PORT_DATA_MODE_NORMAL;
> + if (pcfg->word_length != SWR_INVALID_PARAM)
> + p_rt->port_params.bps = pcfg->word_length + 1;
> }
>
> list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) {
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/4] soundwire: qcom: skip offset2 write when unset
2026-11-25 10:38 [PATCH 0/4] soundwire: qcom: fixes and multi-master follow-ups Srinivas Kandagatla
2026-11-25 10:38 ` [PATCH 1/4] soundwire: qcom: always set master port_params.num Srinivas Kandagatla
@ 2026-11-25 10:38 ` Srinivas Kandagatla
2026-11-25 11:01 ` sashiko-bot
2026-11-25 10:38 ` [PATCH 3/4] soundwire: qcom: fan out broadcasts on multi-master primary Srinivas Kandagatla
2026-11-25 10:38 ` [PATCH 4/4] soundwire: qcom: program SSP period " Srinivas Kandagatla
3 siblings, 1 reply; 8+ messages in thread
From: Srinivas Kandagatla @ 2026-11-25 10:38 UTC (permalink / raw)
To: Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, Srinivas Kandagatla,
Marek Szyprowski, linux-sound, linux-arm-msm, Ravi Hothi, stable,
Srinivas Kandagatla
From: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
qcom_swrm_transport_params() writes offset2 into the port control
register even when the port does not use it. Many DTs mark such ports
with 0xff (SWR_INVALID_PARAM) in qcom,ports-offset2, which is then
programmed as an offset of 255.
Skip the field when it is unset, like the other optional fields.
Fixes: 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller")
Cc: stable@vger.kernel.org
Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
(cherry picked from commit 65aca3ef0d1fb2f6b20892f0d1a3a1ef391ccf7f)
---
drivers/soundwire/qcom.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 95444eee4c0b..b29e2aec4ae3 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1232,7 +1232,10 @@ static int qcom_swrm_transport_params(struct sdw_bus *bus,
pcfg = &ctrl->pconfig[params->port_num];
value = pcfg->off1 << SWRM_DP_PORT_CTRL_OFFSET1_SHFT;
- value |= pcfg->off2 << SWRM_DP_PORT_CTRL_OFFSET2_SHFT;
+
+ if (pcfg->off2 != SWR_INVALID_PARAM)
+ value |= pcfg->off2 << SWRM_DP_PORT_CTRL_OFFSET2_SHFT;
+
value |= pcfg->si & 0xff;
ret = qcom_swrm_port_reg_write(ctrl, params->port_num, reg, value);
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/4] soundwire: qcom: skip offset2 write when unset
2026-11-25 10:38 ` [PATCH 2/4] soundwire: qcom: skip offset2 write when unset Srinivas Kandagatla
@ 2026-11-25 11:01 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-25 11:01 UTC (permalink / raw)
To: Srinivas Kandagatla; +Cc: linux-sound
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] soundwire: qcom: inaccurate Fixes tag and stray cherry-pick line
--
commit a8809d3702c2245266df6ea0d292d958482e7c89
Author: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
> soundwire: qcom: skip offset2 write when unset
>
> qcom_swrm_transport_params() writes offset2 into the port control
> register even when the port does not use it. Many DTs mark such ports
> with 0xff (SWR_INVALID_PARAM) in qcom,ports-offset2, which is then
> programmed as an offset of 255.
>
> Skip the field when it is unset, like the other optional fields.
>
> Fixes: 02efb49aa805 ("soundwire: qcom: add support for SoundWire controller")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
> (cherry picked from commit 65aca3ef0d1fb2f6b20892f0d1a3a1ef391ccf7f)
[Severity: Low]
SWR_INVALID_PARAM (0xff) and the checks for optional transport parameters
were added in 128eaf937adb ("soundwire: qcom: add support to missing
transport params"), which left pcfg->off2 unguarded. Should the Fixes:
tag reference that commit instead:
Fixes: 128eaf937adb ("soundwire: qcom: add support to missing transport params")
The "(cherry picked from commit ...)" line at the end also references a
commit SHA that is not in the upstream tree and should be dropped.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125103825.936939-1-srinivas.kandagatla@oss.qualcomm.com?part=2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/4] soundwire: qcom: fan out broadcasts on multi-master primary
2026-11-25 10:38 [PATCH 0/4] soundwire: qcom: fixes and multi-master follow-ups Srinivas Kandagatla
2026-11-25 10:38 ` [PATCH 1/4] soundwire: qcom: always set master port_params.num Srinivas Kandagatla
2026-11-25 10:38 ` [PATCH 2/4] soundwire: qcom: skip offset2 write when unset Srinivas Kandagatla
@ 2026-11-25 10:38 ` Srinivas Kandagatla
2026-11-25 10:38 ` [PATCH 4/4] soundwire: qcom: program SSP period " Srinivas Kandagatla
3 siblings, 0 replies; 8+ messages in thread
From: Srinivas Kandagatla @ 2026-11-25 10:38 UTC (permalink / raw)
To: Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, Srinivas Kandagatla,
Marek Szyprowski, linux-sound, linux-arm-msm, Srinivas Kandagatla
The primary's HW does not signal SPECIAL_CMD_ID_FINISHED for
broadcasts on the shared frame. Any SCP_FrameCtrl update sent that
way is lost, and following unicast reads to the slave time out.
Fan broadcasts out to per-slave unicasts on the primary. This is
spec-equivalent to a SoundWire broadcast (which writes every attached
slave) and avoids the broken path.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
drivers/soundwire/qcom.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index b29e2aec4ae3..e0392f3cda34 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1102,6 +1102,34 @@ static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus,
struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus);
int ret, i, len;
+ /*
+ * HW never asserts SPECIAL_CMD_ID_FINISHED for broadcasts here;
+ * fan out to a unicast per enumerated slave.
+ */
+ if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY && msg->dev_num == SDW_BROADCAST_DEV_NUM &&
+ (msg->addr == SDW_SCP_FRAMECTRL_B0 ||
+ msg->addr == SDW_SCP_FRAMECTRL_B1)) {
+ struct sdw_slave *slave;
+ enum sdw_command_response resp;
+ u16 orig_dev_num = msg->dev_num;
+
+ list_for_each_entry(slave, &bus->slaves, node) {
+ if (slave->dev_num == SDW_ENUM_DEV_NUM ||
+ slave->dev_num >= SDW_BROADCAST_DEV_NUM)
+ continue;
+
+ msg->dev_num = slave->dev_num;
+ resp = qcom_swrm_xfer_msg(bus, msg);
+ if (resp != SDW_CMD_OK) {
+ msg->dev_num = orig_dev_num;
+ return resp;
+ }
+ }
+
+ msg->dev_num = orig_dev_num;
+ return SDW_CMD_OK;
+ }
+
if (msg->page) {
if (ctrl->page1_cache[msg->dev_num] != msg->addr_page1) {
ret = qcom_swrm_cmd_fifo_wr_cmd(ctrl, msg->addr_page1,
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/4] soundwire: qcom: program SSP period on multi-master primary
2026-11-25 10:38 [PATCH 0/4] soundwire: qcom: fixes and multi-master follow-ups Srinivas Kandagatla
` (2 preceding siblings ...)
2026-11-25 10:38 ` [PATCH 3/4] soundwire: qcom: fan out broadcasts on multi-master primary Srinivas Kandagatla
@ 2026-11-25 10:38 ` Srinivas Kandagatla
2026-11-25 10:55 ` sashiko-bot
3 siblings, 1 reply; 8+ messages in thread
From: Srinivas Kandagatla @ 2026-11-25 10:38 UTC (permalink / raw)
To: Vinod Koul
Cc: Bard Liao, Pierre-Louis Bossart, Srinivas Kandagatla,
Marek Szyprowski, linux-sound, linux-arm-msm, Srinivas Kandagatla
v3.1.0+ frame generators derive the superframe boundary from the
current row/col geometry via SSP_PERIOD in FRAME_CTRL_BANK. Program
it at init and each bank switch, and zero CLK_DIV in the same write
so a stale divider does not survive.
The primary owns the clock; the dependent mirrors its frame.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
drivers/soundwire/qcom.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index e0392f3cda34..3476edd7c423 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -108,6 +108,12 @@
#define SWRM_MCP_FRAME_CTRL_BANK_ADDR(m) (0x101C + 0x40 * (m))
#define SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK GENMASK(2, 0)
#define SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK GENMASK(7, 3)
+#define SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_BMSK GENMASK(10, 8)
+#define SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK GENMASK(23, 16)
+#define SWRM_INPUT_CLK_HZ 19200000
+#define SWRM_SSP_RATE_HZ 4000
+#define SWRM_SSP_PERIOD(rows, cols) \
+ (SWRM_INPUT_CLK_HZ / ((rows) * (cols) * SWRM_SSP_RATE_HZ) - 1)
#define SWRM_MCP_BUS_CTRL 0x1044
#define SWRM_MCP_BUS_CLK_START BIT(1)
#define SWRM_MCP_CFG_ADDR 0x1048
@@ -1005,10 +1011,16 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
/* Clear Rows and Cols */
val = FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK, ctrl->rows_index);
val |= FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK, ctrl->cols_index);
+ if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY)
+ val |= FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK,
+ SWRM_SSP_PERIOD(ctrl->bus.params.row,
+ ctrl->bus.params.col));
reset_control_reset(ctrl->audio_cgcr);
ctrl->reg_write(ctrl, SWRM_MCP_FRAME_CTRL_BANK_ADDR(0), val);
+ if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY)
+ ctrl->reg_write(ctrl, SWRM_MCP_FRAME_CTRL_BANK_ADDR(1), val);
/* Enable Auto enumeration */
ctrl->reg_write(ctrl, SWRM_ENUMERATOR_CFG_ADDR, 1);
@@ -1191,6 +1203,14 @@ static int qcom_swrm_pre_bank_switch(struct sdw_bus *bus)
if (ctrl->peer_ctrl)
ctrl->peer_ctrl->reg_write(ctrl->peer_ctrl, reg, val);
+ if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY) {
+ u32p_replace_bits(&val, 0,
+ SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_BMSK);
+ u32p_replace_bits(&val,
+ SWRM_SSP_PERIOD(bus->params.row, bus->params.col),
+ SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK);
+ }
+
return ctrl->reg_write(ctrl, reg, val);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 4/4] soundwire: qcom: program SSP period on multi-master primary
2026-11-25 10:38 ` [PATCH 4/4] soundwire: qcom: program SSP period " Srinivas Kandagatla
@ 2026-11-25 10:55 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-25 10:55 UTC (permalink / raw)
To: Srinivas Kandagatla; +Cc: linux-sound
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] soundwire: qcom: qcom_swrm_pre_bank_switch() writes
SSP_PERIOD to peer
--
commit ea2417312b39017aa66bb591f5dc0c79d434de58
Author: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
soundwire: qcom: program SSP period on multi-master primary
This commit programs SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK (and zeroes
SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_BMSK on bank switch) in
SWRM_MCP_FRAME_CTRL_BANK_ADDR on the multi-master primary controller at
initialization and before each bank switch.
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index e0392f3cda34e..3476edd7c4236 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
[ ... ]
> @@ -1005,10 +1011,16 @@ static int qcom_swrm_init(struct qcom_swrm_ctrl *ctrl)
> /* Clear Rows and Cols */
> val = FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_ROW_CTRL_BMSK, ctrl->rows_index);
> val |= FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_COL_CTRL_BMSK, ctrl->cols_index);
> + if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY)
> + val |= FIELD_PREP(SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK,
> + SWRM_SSP_PERIOD(ctrl->bus.params.row,
> + ctrl->bus.params.col));
>
> reset_control_reset(ctrl->audio_cgcr);
>
> ctrl->reg_write(ctrl, SWRM_MCP_FRAME_CTRL_BANK_ADDR(0), val);
> + if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY)
> + ctrl->reg_write(ctrl, SWRM_MCP_FRAME_CTRL_BANK_ADDR(1), val);
>
> /* Enable Auto enumeration */
> ctrl->reg_write(ctrl, SWRM_ENUMERATOR_CFG_ADDR, 1);
> @@ -1191,6 +1203,14 @@ static int qcom_swrm_pre_bank_switch(struct sdw_bus *bus)
> if (ctrl->peer_ctrl)
> ctrl->peer_ctrl->reg_write(ctrl->peer_ctrl, reg, val);
>
> + if (ctrl->mm_role == QCOM_SWRM_MM_PRIMARY) {
> + u32p_replace_bits(&val, 0,
> + SWRM_MCP_FRAME_CTRL_BANK_CLK_DIV_BMSK);
> + u32p_replace_bits(&val,
> + SWRM_SSP_PERIOD(bus->params.row, bus->params.col),
> + SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK);
> + }
> +
> return ctrl->reg_write(ctrl, reg, val);
> }
[Severity: Medium]
Does qcom_swrm_pre_bank_switch() write the primary controller's
SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK value into ctrl->peer_ctrl?
qcom_swrm_pre_bank_switch() reads val from the primary controller ctrl,
where both banks already have SWRM_MCP_FRAME_CTRL_BANK_SSP_PERIOD_BMSK
populated from qcom_swrm_init(), updates only the row and column fields,
and writes that val directly to ctrl->peer_ctrl. As a result, every bank
switch copies the primary's previous SSP_PERIOD (and any un-cleared
CLK_DIV bits) into the dependent controller's FRAME_CTRL_BANK register
instead of leaving SSP_PERIOD at 0 on the dependent.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125103825.936939-1-srinivas.kandagatla@oss.qualcomm.com?part=4
^ permalink raw reply [flat|nested] 8+ messages in thread