arm64: dts: qcom: sdm845-xiaomi-beryllium: Add audio support
authorJoel Selvaraj <jo@jsfamily.in>
Mon, 3 May 2021 02:17:31 +0000 (07:47 +0530)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Wed, 26 May 2021 03:40:32 +0000 (22:40 -0500)
This patch adds audio support for Xiaomi Poco F1 phone. Phone's primary
Mic and 3.5mm Headphone jack are handled through the SDM845 sound card
and WCD9340 codec.

Tested-by: Amit Pundir <amit.pundir@linaro.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Joel Selvaraj <jo@jsfamily.in>
Link: https://lore.kernel.org/r/BN6PR2001MB17966ED1D787FA3F4B90A1A7D95B9@BN6PR2001MB1796.namprd20.prod.outlook.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts

index 7d02942..c60c8c6 100644 (file)
@@ -5,6 +5,8 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/sound/qcom,q6afe.h>
+#include <dt-bindings/sound/qcom,q6asm.h>
 #include "sdm845.dtsi"
 #include "pm8998.dtsi"
 #include "pmi8998.dtsi"
        };
 };
 
+/* QUAT I2S Uses 1 I2S SD Line for audio on TAS2559/60 amplifiers */
+&q6afedai {
+       qi2s@22 {
+               reg = <22>;
+               qcom,sd-lines = <0>;
+       };
+};
+
+&q6asmdai {
+       dai@0 {
+               reg = <0>;
+       };
+
+       dai@1 {
+               reg = <1>;
+       };
+
+       dai@2 {
+               reg = <2>;
+       };
+};
+
 &qupv3_id_0 {
        status = "okay";
 };
        cd-gpios = <&tlmm 126 GPIO_ACTIVE_HIGH>;
 };
 
+&sound {
+       compatible = "qcom,db845c-sndcard";
+       pinctrl-0 = <&quat_mi2s_active
+                       &quat_mi2s_sd0_active>;
+       pinctrl-names = "default";
+       model = "Xiaomi Poco F1";
+       audio-routing =
+               "RX_BIAS", "MCLK",
+               "AMIC1", "MIC BIAS1",
+               "AMIC2", "MIC BIAS2",
+               "AMIC3", "MIC BIAS3";
+
+       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>;
+               };
+       };
+
+       mm3-dai-link {
+               link-name = "MultiMedia3";
+               cpu {
+                       sound-dai = <&q6asmdai  MSM_FRONTEND_DAI_MULTIMEDIA3>;
+               };
+       };
+
+       slim-dai-link {
+               link-name = "SLIM Playback";
+               cpu {
+                       sound-dai = <&q6afedai SLIMBUS_0_RX>;
+               };
+
+               platform {
+                       sound-dai = <&q6routing>;
+               };
+
+               codec {
+                       sound-dai =  <&wcd9340 0>;
+               };
+       };
+
+       slimcap-dai-link {
+               link-name = "SLIM Capture";
+               cpu {
+                       sound-dai = <&q6afedai SLIMBUS_0_TX>;
+               };
+
+               platform {
+                       sound-dai = <&q6routing>;
+               };
+
+               codec {
+                       sound-dai = <&wcd9340 1>;
+               };
+       };
+};
+
 &tlmm {
        gpio-reserved-ranges = <0 4>, <81 4>;
 
                function = "gpio";
                bias-pull-up;
        };
+
+       wcd_intr_default: wcd_intr_default {
+               pins = <54>;
+               function = "gpio";
+
+               input-enable;
+               bias-pull-down;
+               drive-strength = <2>;
+       };
 };
 
 &uart6 {
        vdda-pll-supply = <&vreg_l1a_0p875>;
 };
 
+&wcd9340{
+       pinctrl-0 = <&wcd_intr_default>;
+       pinctrl-names = "default";
+       clock-names = "extclk";
+       clocks = <&rpmhcc RPMH_LN_BB_CLK2>;
+       reset-gpios = <&tlmm 64 0>;
+       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>;
+       qcom,micbias1-microvolt = <2700000>;
+       qcom,micbias2-microvolt = <1800000>;
+       qcom,micbias3-microvolt = <2700000>;
+       qcom,micbias4-microvolt = <2700000>;
+};
+
 &wifi {
        status = "okay";