mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
To: Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
	Luca Weiss <luca.weiss@fairphone.com>,
	Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>,
	Ravi Hothi <ravi.hothi@oss.qualcomm.com>
Subject: [PATCH v3 1/2] ASoC: dt-bindings: qcom,wcd9378-sdw: add non-SDCA (mobile) mode
Date: Fri, 27 Nov 2026 19:21:47 +0530	[thread overview]
Message-ID: <20261127-b4-wcd9378-v3-v3-1-397e5ba2da55@oss.qualcomm.com> (raw)
In-Reply-To: <20261127-b4-wcd9378-v3-v3-0-397e5ba2da55@oss.qualcomm.com>

The WCD9378 silicon is fused either SDCA-compliant, which is what this
binding describes today, or not SDCA-compliant - the "mobile mode"
fusing. The two fusings put a different number of devices on the
SoundWire bus: an SDCA-compliant part is a single device aggregating the
playback and the capture path, while a part that is not SDCA-compliant
splits into an RX device for playback and a TX device for capture, one
sitting on the playback SoundWire link and one on the capture link.

Both fusings carry the same SoundWire class ID and therefore the same
compatible, so they cannot be told apart by a separate binding file.
Describe them both here instead, keyed off the existing
qcom,sdca-compliant property.

Only the capture device reaches the codec control register space, so on
the split fusing the TX device is the one that drives the codec, and it
references its playback peer through the new qcom,rx-device phandle.
Either way the device that reaches the control register space owns the
codec-wide resources - the reset GPIO, the supplies and the new mic-bias
level properties - and exposes the codec's DAIs, while its peer
describes nothing beyond its own data path.

qcom,port-mapping is shared between both fusings, so its minItems drops
from 8 to 5: the split devices map five device data ports each where an
SDCA-compliant device maps eight.

Co-developed-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
Signed-off-by: Jorijn van der Graaf <jorijnvdgraaf@catcrafts.net>
Signed-off-by: Ravi Hothi <ravi.hothi@oss.qualcomm.com>
---
 .../bindings/sound/qcom,wcd9378-sdw.yaml           | 172 ++++++++++++++++++---
 1 file changed, 149 insertions(+), 23 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,wcd9378-sdw.yaml b/Documentation/devicetree/bindings/sound/qcom,wcd9378-sdw.yaml
index 62d85b1dca7f..03ee4a4deea6 100644
--- a/Documentation/devicetree/bindings/sound/qcom,wcd9378-sdw.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,wcd9378-sdw.yaml
@@ -4,19 +4,21 @@
 $id: http://devicetree.org/schemas/sound/qcom,wcd9378-sdw.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Qualcomm WCD9378 (Tambora) SoundWire codec
+title: Qualcomm WCD9378 (Tambora) SoundWire devices
 
 maintainers:
   - Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
 
-description:
-  Qualcomm WCD9378 (Tambora) SoundWire codec. The same silicon can be
+description: |
+  Qualcomm WCD9378 (Tambora) SoundWire devices. The same silicon can be
   fused for a mobile (non-SDCA) mode or an SDCA-compliant mode; the
-  qcom,sdca-compliant property selects the latter and is required by
-  this driver.
+  qcom,sdca-compliant property selects the latter.
 
-allOf:
-  - $ref: dai-common.yaml#
+  An SDCA-compliant part is a single device aggregating both data paths.
+  A part that is not SDCA-compliant splits into an RX device and a TX
+  device; only the TX device reaches the codec control register space, so
+  it owns the codec-wide resources and references its peer through
+  qcom,rx-device.
 
 properties:
   compatible:
@@ -27,19 +29,28 @@ properties:
 
   qcom,sdca-compliant:
     description:
-      Present when the codec is fused as SDCA-compliant. The mobile
-      (non-SDCA) variant carries the same class-ID compatible and is
-      handled by a different driver.
+      Present when the codec is fused as SDCA-compliant.
     type: boolean
 
+  qcom,rx-device:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Reference to the playback (RX) SoundWire device of the same codec.
+      Present on the capture (TX) device, which reaches the control
+      register space and therefore drives the codec on its behalf.
+
   qcom,port-mapping:
     description:
-      Each entry maps a slave data port to a master data port.
-      Entries are in order starting from slave port 1; slave port 0
-      is reserved and not represented. SDCA-compliant mode uses 8
-      entries covering DP1..DP8.
+      Each entry maps a device data port to a master data port. Entries
+      are in order starting from device port 1; device port 0 is
+      reserved and not represented. An SDCA-compliant device uses 8
+      entries covering DP1..DP8, the split devices 5 entries covering
+      DP1..DP5.
+
+      Several device ports may map to the same master port, in which
+      case they are distinguished by their channel within that port.
     $ref: /schemas/types.yaml#/definitions/uint32-array
-    minItems: 8
+    minItems: 5
     maxItems: 8
 
   reset-gpios:
@@ -58,24 +69,93 @@ properties:
   vdd-mic-bias-supply:
     description: Mic bias supply.
 
+  qcom,micbias1-microvolt:
+    description: micbias1 voltage
+    minimum: 1800000
+    maximum: 2850000
+
+  qcom,micbias2-microvolt:
+    description: micbias2 voltage
+    minimum: 1800000
+    maximum: 2850000
+
+  qcom,micbias3-microvolt:
+    description: micbias3 voltage
+    minimum: 1800000
+    maximum: 2850000
+
   '#sound-dai-cells':
     const: 1
 
 required:
   - compatible
   - reg
-  - qcom,sdca-compliant
-  - qcom,port-mapping
-  - reset-gpios
-  - vdd-buck-supply
-  - vdd-rxtx-supply
-  - vdd-io-supply
-  - vdd-mic-bias-supply
-  - '#sound-dai-cells'
+
+allOf:
+  - $ref: dai-common.yaml#
+
+  # The device reaching the control register space owns the codec-wide
+  # resources and exposes the DAIs. A data-only device describes nothing
+  # but its own data path.
+  - if:
+      anyOf:
+        - required:
+            - qcom,sdca-compliant
+        - required:
+            - qcom,rx-device
+    then:
+      required:
+        - qcom,port-mapping
+        - reset-gpios
+        - vdd-buck-supply
+        - vdd-rxtx-supply
+        - vdd-io-supply
+        - vdd-mic-bias-supply
+        - '#sound-dai-cells'
+    else:
+      properties:
+        reset-gpios: false
+        vdd-buck-supply: false
+        vdd-rxtx-supply: false
+        vdd-io-supply: false
+        vdd-mic-bias-supply: false
+        '#sound-dai-cells': false
+
+  # An SDCA-compliant part is one device carrying both data paths, so it
+  # has no peer to reference.
+  - if:
+      required:
+        - qcom,sdca-compliant
+    then:
+      properties:
+        qcom,port-mapping:
+          minItems: 8
+        qcom,rx-device: false
+    else:
+      properties:
+        qcom,port-mapping:
+          maxItems: 5
+
+  # An SDCA-compliant part takes its mic-bias levels from the function
+  # topology instead.
+  - if:
+      required:
+        - qcom,rx-device
+    then:
+      required:
+        - qcom,micbias1-microvolt
+        - qcom,micbias2-microvolt
+        - qcom,micbias3-microvolt
+    else:
+      properties:
+        qcom,micbias1-microvolt: false
+        qcom,micbias2-microvolt: false
+        qcom,micbias3-microvolt: false
 
 unevaluatedProperties: false
 
 examples:
+  # An SDCA-compliant part: one aggregated device.
   - |
     #include <dt-bindings/gpio/gpio.h>
 
@@ -99,6 +179,52 @@ examples:
             vdd-io-supply = <&vreg_l18b_1p2>;
             vdd-mic-bias-supply = <&vreg_bob1>;
 
+            #sound-dai-cells = <1>;
+        };
+    };
+
+  # A part that is not SDCA-compliant: an RX device and a TX device on
+  # two masters, the TX device owning the codec resources.
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    soundwire@6ad0000 {
+        reg = <0x06ad0000 0x10000>;
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        wcd9378_rx: audio-codec@0,4 {
+            compatible = "sdw20217011000";
+            reg = <0 4>;
+
+            qcom,port-mapping = <1 2 3 4 5>;
+        };
+    };
+
+    soundwire@7630000 {
+        reg = <0x07630000 0x10000>;
+        #address-cells = <2>;
+        #size-cells = <0>;
+
+        audio-codec@0,3 {
+            compatible = "sdw20217011000";
+            reg = <0 3>;
+
+            qcom,rx-device = <&wcd9378_rx>;
+
+            qcom,port-mapping = <2 2 2 3 4>;
+
+            reset-gpios = <&tlmm 162 GPIO_ACTIVE_LOW>;
+
+            vdd-buck-supply = <&vreg_l8b>;
+            vdd-rxtx-supply = <&vreg_l7b>;
+            vdd-io-supply = <&vreg_l7b>;
+            vdd-mic-bias-supply = <&vreg_bob>;
+
+            qcom,micbias1-microvolt = <1800000>;
+            qcom,micbias2-microvolt = <1800000>;
+            qcom,micbias3-microvolt = <1800000>;
+
             #sound-dai-cells = <1>;
         };
     };

-- 
2.34.1


  reply	other threads:[~2026-11-27 13:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 13:51 [PATCH v3 0/2] ASoC: codecs: wcd9378: add non-SDCA (mobile) mode support Ravi Hothi
2026-11-27 13:51 ` Ravi Hothi [this message]
2026-11-27 13:51 ` [PATCH v3 2/2] " Ravi Hothi

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=20261127-b4-wcd9378-v3-v3-1-397e5ba2da55@oss.qualcomm.com \
    --to=ravi.hothi@oss.qualcomm.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jorijnvdgraaf@catcrafts.net \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=luca.weiss@fairphone.com \
    --cc=mohammad.rafi.shaik@oss.qualcomm.com \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=robh@kernel.org \
    --cc=srini@kernel.org \
    --cc=srinivas.kandagatla@oss.qualcomm.com \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®