Skip to contentSkip to conversation

ASoC: codecs: wsa88xx: add support for static port mapping.

PATCH Applied [email protected] 4 participants 11 messages Jun 27, 2024 – Aug 15, 2024

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

v2 cover ASoC: codecs: wsa88xx: add support for static port mapping.

Existing way of allocating soundwire master ports on Qualcommm platforms is dynamic, and in linear order starting from 1 to MAX_PORTS.
This will work as long as soundwire device ports are 1:1 mapped linearly. However on most Qcom SoCs like SM8550, SM8650, x1e80100, these are NOT mapped in that order.

The result of this is that only one speaker among the pair of speakers is always silent, With recent changes for WSA codec to support codec versions and along with these patches we are able to get all speakers working on these SoCs.

---
Changes in v2:
- used dev_dbg instead of dev_info
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Manikantan R (1):
ASoC: dt-bindings: wsa883x: Document port mapping property

Srinivas Kandagatla (5):
ASoC: codecs: wsa883x: parse port-mapping information
ASoC: dt-bindings: wsa8840: Document port mapping property
ASoC: codecs: wsa884x: parse port-mapping information
arm64: dts: x1e80100-crd: fix wsa soundwire port mapping
arm64: dts: x1e80100-qcp: fix wsa soundwire port mapping

 Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml | 8 ++++++++
 Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml | 8 ++++++++
 arch/arm64/boot/dts/qcom/x1e80100-crd.dts                 | 4 ++++
 arch/arm64/boot/dts/qcom/x1e80100-qcp.dts                 | 2 ++
 sound/soc/codecs/wsa883x.c                                | 8 ++++++++
 sound/soc/codecs/wsa884x.c                                | 8 ++++++++
 6 files changed, 38 insertions(+)

---
base-commit: 9935be184a55dd84fc3275094f2df095491f6ea1
change-id: 20240626-port-map-ef50c3304d4a

Best regards,

Signature · 1 line
Srinivas Kandagatla <[email protected]>
#1 lore raw

PATCH v2 1/6 ASoC: dt-bindings: wsa883x: Document port mapping property

From: Manikantan R <[email protected]>

Document port mapping property for wsa883x. Port mapping is required to be able map correct master ports for VI feedback.

All the device ports are not mapped in same order as master ports, so there is a need for having static port mapping for WSA codecs.

---
 Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml +8 -0
index 8e462cdf0018..14d312f9c345 100644
@@ -32,6 +32,14 @@ properties:
   vdd-supply:
     description: VDD Supply for the Codec
 
+  qcom,port-mapping:
+    description: |
+      Specifies static port mapping between slave and master ports.
+      In the order of slave port index.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 4
+    maxItems: 4
+
   '#thermal-sensor-cells':
     const: 0
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/6 ASoC: codecs: wsa883x: parse port-mapping information

In reply to [email protected]

Add support to parse static master port map information from device tree.

---
 sound/soc/codecs/wsa883x.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/codecs/wsa883x.c +8 -0
index a2e86ef7d18f..5443a5c4100c 100644
@@ -1399,6 +1399,14 @@ static int wsa883x_probe(struct sdw_slave *pdev,
 	wsa883x->sconfig.direction = SDW_DATA_DIR_RX;
 	wsa883x->sconfig.type = SDW_STREAM_PDM;
 
+	/**
+	 * Port map index starts with 0, however the data port for this codec
+	 * are from index 1
+	 */
+	if (of_property_read_u32_array(dev->of_node, "qcom,port-mapping", &pdev->m_port_map[1],
+					WSA883X_MAX_SWR_PORTS))
+		dev_dbg(dev, "Static Port mapping not specified\n");
+
 	pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS, 0);
 	pdev->prop.simple_clk_stop_capable = true;
 	pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
Signature · 1 line
2.25.1
Reviewed-by on v2 2/6
#3 lore raw

Re: [PATCH v2 2/6] ASoC: codecs: wsa883x: parse port-mapping information

Quoted 16 lines · Srinivas Kandagatla

Add support to parse static master port map information from device tree.

---
 sound/soc/codecs/wsa883x.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/codecs/wsa883x.c +0 -0
index a2e86ef7d18f..5443a5c4100c 100644
@@ -1399,6 +1399,14 @@ static int wsa883x_probe(struct sdw_slave *pdev,
 	wsa883x->sconfig.direction = SDW_DATA_DIR_RX;

sound/soc/codecs/wsa883x.c static int wsa883x_probe(struct sdw_slave *pdev, · line 1409

Quoted 10 lines
sound/soc/codecs/wsa883x.c +8 -0
 	wsa883x->sconfig.type = SDW_STREAM_PDM;
 
+	/**
+	 * Port map index starts with 0, however the data port for this codec
+	 * are from index 1
+	 */
+	if (of_property_read_u32_array(dev->of_node, "qcom,port-mapping", &pdev->m_port_map[1],
+					WSA883X_MAX_SWR_PORTS))
+		dev_dbg(dev, "Static Port mapping not specified\n");
+
Quoted 7 lines
sound/soc/codecs/wsa883x.c +0 -0
 	pdev->prop.sink_ports = GENMASK(WSA883X_MAX_SWR_PORTS, 0);
 	pdev->prop.simple_clk_stop_capable = true;
 	pdev->prop.sink_dpn_prop = wsa_sink_dpn_prop;
Signature · 2 lines
-- 
2.25.1
Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

PATCH v2 3/6 ASoC: dt-bindings: wsa8840: Document port mapping property

In reply to [email protected]

Document port mapping property for wsa884x. Port mapping is required to be able map correct master ports.

All the device ports are not mapped in same order as master ports, so there is a need for having static port mapping for WSA codecs.

---
 Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml | 8 ++++++++
 1 file changed, 8 insertions(+)
Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml +8 -0
index 22798d22d981..83e0360301e1 100644
@@ -32,6 +32,14 @@ properties:
     description: Powerdown/Shutdown line to use (pin SD_N)
     maxItems: 1
 
+  qcom,port-mapping:
+    description: |
+      Specifies static port mapping between slave and master ports.
+      In the order of slave port index.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 6
+    maxItems: 6
+
   '#sound-dai-cells':
     const: 0
 
Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 4/6 ASoC: codecs: wsa884x: parse port-mapping information

In reply to [email protected]

Add support to parse static master port map information from device tree. This is required for correct port mapping between soundwire device and master ports.

---
 sound/soc/codecs/wsa884x.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/codecs/wsa884x.c +8 -0
index a9767ef0e39d..a6034547b4f3 100644
@@ -1887,6 +1887,14 @@ static int wsa884x_probe(struct sdw_slave *pdev,
 	wsa884x->sconfig.direction = SDW_DATA_DIR_RX;
 	wsa884x->sconfig.type = SDW_STREAM_PDM;
 
+	/**
+	 * Port map index starts with 0, however the data port for this codec
+	 * are from index 1
+	 */
+	if (of_property_read_u32_array(dev->of_node, "qcom,port-mapping", &pdev->m_port_map[1],
+					WSA884X_MAX_SWR_PORTS))
+		dev_dbg(dev, "Static Port mapping not specified\n");
+
 	pdev->prop.sink_ports = GENMASK(WSA884X_MAX_SWR_PORTS, 0);
 	pdev->prop.simple_clk_stop_capable = true;
 	pdev->prop.sink_dpn_prop = wsa884x_sink_dpn_prop;
Signature · 1 line
2.25.1
Reviewed-by on v2 4/6
#6 lore raw

Re: [PATCH v2 4/6] ASoC: codecs: wsa884x: parse port-mapping information

Quoted 19 lines · Srinivas Kandagatla

Add support to parse static master port map information from device tree. This is required for correct port mapping between soundwire device and master ports.

---
 sound/soc/codecs/wsa884x.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/codecs/wsa884x.c +0 -0
index a9767ef0e39d..a6034547b4f3 100644
@@ -1887,6 +1887,14 @@ static int wsa884x_probe(struct sdw_slave *pdev,
 	wsa884x->sconfig.direction = SDW_DATA_DIR_RX;

sound/soc/codecs/wsa884x.c static int wsa884x_probe(struct sdw_slave *pdev, · line 1897

Quoted 10 lines
sound/soc/codecs/wsa884x.c +8 -0
 	wsa884x->sconfig.type = SDW_STREAM_PDM;
 
+	/**
+	 * Port map index starts with 0, however the data port for this codec
+	 * are from index 1
+	 */
+	if (of_property_read_u32_array(dev->of_node, "qcom,port-mapping", &pdev->m_port_map[1],
+					WSA884X_MAX_SWR_PORTS))
+		dev_dbg(dev, "Static Port mapping not specified\n");
+
Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

PATCH v2 5/6 arm64: dts: x1e80100-crd: fix wsa soundwire port mapping

In reply to [email protected]

Existing way of allocating ports dynamically is linear starting from 1 to MAX_PORTS. This will not work for x1e80100 as the master ports are are not mapped in the same order.

Without this fix only one speaker in a pair of speakers will function.

After this fix along with WSA codec changes both the speakers starts working.

---
 arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/qcom/x1e80100-crd.dts +4 -0
index ce80119d798d..67c5cd89b925 100644
@@ -841,6 +841,7 @@ left_woofer: speaker@0,0 {
 		sound-name-prefix = "WooferLeft";
 		vdd-1p8-supply = <&vreg_l15b_1p8>;
 		vdd-io-supply = <&vreg_l12b_1p2>;
+		qcom,port-mapping = <1 2 3 7 10 13>;
 	};
 
 	/* WSA8845, Left Tweeter */
@@ -852,6 +853,7 @@ left_tweeter: speaker@0,1 {
 		sound-name-prefix = "TwitterLeft";
 		vdd-1p8-supply = <&vreg_l15b_1p8>;
 		vdd-io-supply = <&vreg_l12b_1p2>;
+		qcom,port-mapping = <4 5 6 7 11 13>;
 	};
 };
 
@@ -892,6 +894,7 @@ right_woofer: speaker@0,0 {
 		sound-name-prefix = "WooferRight";
 		vdd-1p8-supply = <&vreg_l15b_1p8>;
 		vdd-io-supply = <&vreg_l12b_1p2>;
+		qcom,port-mapping = <1 2 3 7 10 13>;
 	};
 
 	/* WSA8845, Right Tweeter */
@@ -903,6 +906,7 @@ right_tweeter: speaker@0,1 {
 		sound-name-prefix = "TwitterRight";
 		vdd-1p8-supply = <&vreg_l15b_1p8>;
 		vdd-io-supply = <&vreg_l12b_1p2>;
+		qcom,port-mapping = <4 5 6 7 11 13>;
 	};
 };
 
Signature · 1 line
2.25.1
#8 lore raw

PATCH v2 6/6 arm64: dts: x1e80100-qcp: fix wsa soundwire port mapping

In reply to [email protected]

Existing way of allocating ports dynamically is linear starting from 1 to MAX_PORTS. This will not work for x1e80100 as the master ports are are not mapped in the same order.

Without this fix only one speaker in a pair of speakers will function.

After this fix along with WSA codec changes both the speakers starts working.

---
 arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 2 ++
 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/qcom/x1e80100-qcp.dts +2 -0
index 4edec3212dde..79563ae34890 100644
@@ -749,6 +749,7 @@ left_spkr: speaker@0,0 {
 		sound-name-prefix = "SpkrLeft";
 		vdd-1p8-supply = <&vreg_l15b_1p8>;
 		vdd-io-supply = <&vreg_l12b_1p2>;
+		qcom,port-mapping = <1 2 3 7 10 13>;
 	};
 
 	/* WSA8845, Right Speaker */
@@ -760,6 +761,7 @@ right_spkr: speaker@0,1 {
 		sound-name-prefix = "SpkrRight";
 		vdd-1p8-supply = <&vreg_l15b_1p8>;
 		vdd-io-supply = <&vreg_l12b_1p2>;
+		qcom,port-mapping = <4 5 6 7 11 13>;
 	};
 };
 
Signature · 1 line
2.25.1
maintainer
#9 lore raw

Re: (subset) [PATCH v2 0/6] ASoC: codecs: wsa88xx: add support for static port mapping.

In reply to [email protected]
Quoted 6 lines · On Thu, 27 Jun 2024 15:44:37 +0100, [email protected] wrote:

Existing way of allocating soundwire master ports on Qualcommm platforms is dynamic, and in linear order starting from 1 to MAX_PORTS.
This will work as long as soundwire device ports are 1:1 mapped linearly. However on most Qcom SoCs like SM8550, SM8650, x1e80100, these are NOT mapped in that order.

Quoted 6 lines

The result of this is that only one speaker among the pair of speakers is always silent, With recent changes for WSA codec to support codec versions and along with these patches we are able to get all speakers working on these SoCs.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/6] ASoC: dt-bindings: wsa883x: Document port mapping property

      commit: 49beb4d2e85634ec1e1c82d76461d9552676045d
[2/6] ASoC: codecs: wsa883x: parse port-mapping information
      commit: 1cf3295bd108abbd7f128071ae9775fd18394ca9
[3/6] ASoC: dt-bindings: wsa8840: Document port mapping property
      commit: d47abee9fede21b19d5227061c5a8761ec1659fb
[4/6] ASoC: codecs: wsa884x: parse port-mapping information
      commit: e1bc5c324bcca3acdbe817ccbf9aa7992d89479d

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

maintainer Applied
#10 lore raw

Re: (subset) [PATCH v2 0/6] ASoC: codecs: wsa88xx: add support for static port mapping.

In reply to [email protected]
Quoted 6 lines · On Thu, 27 Jun 2024 15:44:37 +0100, [email protected] wrote:

Existing way of allocating soundwire master ports on Qualcommm platforms is dynamic, and in linear order starting from 1 to MAX_PORTS.
This will work as long as soundwire device ports are 1:1 mapped linearly. However on most Qcom SoCs like SM8550, SM8650, x1e80100, these are NOT mapped in that order.

Quoted 6 lines

The result of this is that only one speaker among the pair of speakers is always silent, With recent changes for WSA codec to support codec versions and along with these patches we are able to get all speakers working on these SoCs.

[...]

Applied, thanks!

[5/6] arm64: dts: x1e80100-crd: fix wsa soundwire port mapping

      commit: d374fafd8972895eba01ebd69c993cc7d80c084b
[6/6] arm64: dts: x1e80100-qcp: fix wsa soundwire port mapping
      commit: 6e229f9118438af09b4ac6a96313c32f33027e5a

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>