aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <[email protected]>2024-07-02 13:02:57 +0100
committerMark Brown <[email protected]>2024-07-02 13:02:57 +0100
commitcc1deba84035abd21d07a468f463fb6eb2186c92 (patch)
tree96a4fd896a6c6ca228ab2b60282ef34480114253
parent765d3a2aa195882e231835f5d9ac4d99affc8c07 (diff)
parente1bc5c324bcca3acdbe817ccbf9aa7992d89479d (diff)
ASoC: codecs: wsa88xx: add support for static port
Merge series from [email protected]: 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.
-rw-r--r--Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml8
-rw-r--r--Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml8
-rw-r--r--sound/soc/codecs/wsa883x.c8
-rw-r--r--sound/soc/codecs/wsa884x.c8
4 files changed, 32 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml b/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml
index 8e462cdf0018..14d312f9c345 100644
--- a/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,wsa883x.yaml
@@ -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
diff --git a/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml b/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml
index 22798d22d981..83e0360301e1 100644
--- a/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,wsa8840.yaml
@@ -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
diff --git a/sound/soc/codecs/wsa883x.c b/sound/soc/codecs/wsa883x.c
index 8abce2160d65..f5a15f0e891e 100644
--- a/sound/soc/codecs/wsa883x.c
+++ b/sound/soc/codecs/wsa883x.c
@@ -1398,6 +1398,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;
diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c
index a9767ef0e39d..a6034547b4f3 100644
--- a/sound/soc/codecs/wsa884x.c
+++ b/sound/soc/codecs/wsa884x.c
@@ -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;