From: David Heidelberg <[email protected]>

The Pixel 3 sound card so far only drove the two CS35L36 speaker
amplifiers. Wire in the WCD9340 codec , add a SLIMbus capture link
for it and route the three digital microphones

Based on work done by Casey Tunturi.

Assisted-by: LLM
Signed-off-by: David Heidelberg <[email protected]>
---
 arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi | 58 ++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi
index 68d26c1a06d0c..8e303a91bfaa2 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-google-common.dtsi
@@ -4,18 +4,20 @@
 
 #include <dt-bindings/arm/qcom,ids.h>
 #include <dt-bindings/dma/qcom-gpi.h>
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 #include <dt-bindings/sound/qcom,q6afe.h>
 #include <dt-bindings/sound/qcom,q6asm.h>
+#include <dt-bindings/sound/qcom,wcd934x.h>
 
 #include "sdm845.dtsi"
+#include "sdm845-wcd9340.dtsi"
 #include "pm8998.dtsi"
 #include "pmi8998.dtsi"
 
 /delete-node/ &mpss_region;
 /delete-node/ &venus_mem;
 /delete-node/ &cdsp_mem;
 /delete-node/ &mba_region;
 /delete-node/ &slpi_mem;
@@ -512,16 +514,20 @@ dai@72 {
                qcom,tdm-data-align = <0>;
        };
 };
 
 &q6asmdai {
        dai@0 {
                reg = <MSM_FRONTEND_DAI_MULTIMEDIA1>;
        };
+
+       dai@1 {
+               reg = <MSM_FRONTEND_DAI_MULTIMEDIA2>;
+       };
 };
 
 &qupv3_id_0 {
        status = "okay";
 };
 
 &qupv3_id_1 {
        status = "okay";
@@ -539,40 +545,81 @@ &qup_uart9_tx {
 
 &sound {
        compatible = "qcom,sdm845-sndcard";
        model = "Pixel 3";
        pinctrl-0 = <&quat_mi2s_active>, <&quat_mi2s_sd0_active>,
                    <&quat_mi2s_sd1_active>;
        pinctrl-names = "default";
 
+       audio-routing = "DMIC0", "MCLK", /* Top mic */
+                       "DMIC0", "MIC BIAS1",
+                       "DMIC3", "MCLK", /* Top-edge mic */
+                       "DMIC3", "MIC BIAS3",
+                       "DMIC4", "MCLK", /* Bottom mic */
+                       "DMIC4", "MIC BIAS4";
+
        /* mm[0-9]-dai-link nodes must be positioned first regardless of 
sorting */
        mm1-dai-link {
                link-name = "MultiMedia1";
 
                cpu {
                        sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA1>;
                };
        };
 
+       mm2-dai-link {
+               link-name = "MultiMedia2";
+
+               cpu {
+                       sound-dai = <&q6asmdai MSM_FRONTEND_DAI_MULTIMEDIA2>;
+               };
+       };
+
        cs35l36-dai-link {
                link-name = "Speaker Playback";
 
                codec {
                        sound-dai = <&cs35l36_bottom>, <&cs35l36_top>;
                };
 
                cpu {
                        sound-dai = <&q6afedai QUATERNARY_TDM_RX_0>;
                };
 
                platform {
                        sound-dai = <&q6routing>;
                };
        };
+
+       slimcap-dai-link {
+               link-name = "SLIM Capture 1";
+
+               codec {
+                       sound-dai = <&wcd9340 AIF1_CAP>;
+               };
+
+               cpu {
+                       sound-dai = <&q6afedai SLIMBUS_0_TX>;
+               };
+
+               platform {
+                       sound-dai = <&q6routing>;
+               };
+       };
+};
+
+&swm {
+       /*
+        * Nothing hangs off the codec's SoundWire bus on this board: the
+        * speakers are CS35L36 amplifiers on QUAT_TDM. With an empty bus the
+        * controller reports port mismatches and frame-generator timeouts on
+        * every boot.
+        */
+       status = "disabled";
 };
 
 &tlmm {
        gpio-reserved-ranges = < 0 4>, /* SPI (Intel MNH Pixel Visual Core) */
                               <81 4>; /* SPI (most likely Fingerprint Cards 
FPC1075) */
 
        nfc_default: nfc-default-state {
                enable-pins {
@@ -718,16 +765,27 @@ &usb_1_qmpphy {
 };
 
 &venus {
        firmware-name = "qcom/sdm845/Google/blueline/venus.mbn";
 
        status = "okay";
 };
 
+&wcd9340 {
+       /* PM8998 LN_BB_CLK2 feeds the Pixel Visual Core on this board */
+       clocks = <&rpmhcc RPMH_LN_BB_CLK3>;
+       reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
+       vdd-buck-supply = <&vreg_s4a_1p8>;
+       vdd-buck-sido-supply = <&vreg_s4a_1p8>;
+       vdd-tx-supply = <&vreg_s4a_1p8>;
+       vdd-rx-supply = <&vreg_s4a_1p8>;
+       vdd-io-supply = <&vreg_s4a_1p8>;
+};
+
 &wifi {
        vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
        vdd-1.8-xo-supply = <&vreg_pmu_xo>;
        vdd-1.3-rfa-supply = <&vreg_pmu_rf>;
        vdd-3.3-ch0-supply = <&vreg_pmu_ch0>;
 
        qcom,snoc-host-cap-8bit-quirk;
 

-- 
2.55.0



Reply via email to