Skip to contentSkip to conversation

soundwire: qcom: skip DPn_BLOCK_CTRL_1 for ports without a word length

PATCH In review Riccardo Mereu 2 participants 3 messages Dec 1

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soundwire: qcom: skip DPn_BLOCK_CTRL_1 for ports without a word length

From: Riccardo Mereu <[email protected]>

qcom_swrm_compute_params() fills a port's port_params only when the DT gives that port a word length (qcom,ports-word-length != 0xff). For the other ports port_params stays zeroed, yet qcom_swrm_port_params() still writes bps - 1 = 0xffffffff to SWRM_DPn_BLOCK_CTRL_1(offset, 0), which is not a data port register.

Since commit 55207a5b6959 ("soundwire: qcom: add multi-master support") the port lookup warns on port 0, so on QCM2290 (agatti.dtsi leaves some RX ports and all TX ports at 0xff) every boot now shows:

  WARNING: drivers/soundwire/qcom.c:1174 at qcom_swrm_port_target+0x68/0x78 [soundwire_qcom]
  ...
   qcom_swrm_port_target+0x68/0x78 [soundwire_qcom] (P)
   sdw_program_params+0x334/0x804 [soundwire_bus]
   sdw_prepare_stream+0x128/0x304 [soundwire_bus]

Skip the write when the port params were not filled in. Such ports keep the block control value they reset with, as they effectively did before.

Fixes 128eaf937adb ("soundwire: qcom: add support to missing transport params")
---
 drivers/soundwire/qcom.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/soundwire/qcom.c +4 -0
index ad28a0fa345d..aacbd9e86fd0 100644
@@ -1209,6 +1209,10 @@ 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];
 
+	/* Not filled in by qcom_swrm_compute_params(): no word length in DT */
+	if (!p_params->num)
+		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);
Signature · 16 lines
2.56.1


-- 





Privacy and Confidentiality Notice: This email and all attachments are 
confidential and for the designated recipient(s) only. They may also be 
privileged. If you are not the intended recipient or among the intended 
recipients, you may not use, read, retransmit, disseminate, store/copy the 
information in any medium or take any action in reliance upon it. Please 
notify the sender that you have received it in error and immediately delete 
the entire communication, including any attachments.
#1 lore raw
Quoted 18 lines · Riccardo Mereu

From: Riccardo Mereu <[email protected]>

qcom_swrm_compute_params() fills a port's port_params only when the DT gives that port a word length (qcom,ports-word-length != 0xff). For the other ports port_params stays zeroed, yet qcom_swrm_port_params() still writes bps - 1 = 0xffffffff to SWRM_DPn_BLOCK_CTRL_1(offset, 0), which is not a data port register.

Since commit 55207a5b6959 ("soundwire: qcom: add multi-master support") the port lookup warns on port 0, so on QCM2290 (agatti.dtsi leaves some RX ports and all TX ports at 0xff) every boot now shows:

  WARNING: drivers/soundwire/qcom.c:1174 at qcom_swrm_port_target+0x68/0x78 [soundwire_qcom]
  ...
   qcom_swrm_port_target+0x68/0x78 [soundwire_qcom] (P)
   sdw_program_params+0x334/0x804 [soundwire_bus]
   sdw_prepare_stream+0x128/0x304 [soundwire_bus]
Quoted 6 lines

Skip the write when the port params were not filled in. Such ports keep the block control value they reset with, as they effectively did before.

Fixes 128eaf937adb ("soundwire: qcom: add support to missing transport params")

---

Hi Riccardo, thanks for the patch,

can you try these
https://lore.kernel.org/all/[email protected]/
it should fix this issue.

--srini

Quoted 18 lines
 drivers/soundwire/qcom.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/soundwire/qcom.c +4 -0
index ad28a0fa345d..aacbd9e86fd0 100644
@@ -1209,6 +1209,10 @@ 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];
 
+	/* Not filled in by qcom_swrm_compute_params(): no word length in DT */
+	if (!p_params->num)
+		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);
#2 lore raw
In reply to Riccardo Mereu
Quoted 2 lines · Riccardo Mereu

qcom_swrm_compute_params() fills a port's port_params only when the DT gives that port a word length (qcom,ports-word-length != 0xff).

Please drop this one. Srinivas already posted a more complete fix for the same problem:

https://lore.kernel.org/all/[email protected]/

Sorry for the noise, I had missed it.

Thanks,
Riccardo

Signature · 7 lines
Privacy and Confidentiality Notice: This email and all attachments are 
confidential and for the designated recipient(s) only. They may also be 
privileged. If you are not the intended recipient or among the intended 
recipients, you may not use, read, retransmit, disseminate, store/copy the 
information in any medium or take any action in reliance upon it. Please 
notify the sender that you have received it in error and immediately delete 
the entire communication, including any attachments.