arm64: dts: qcom: msm8916-huawei-g7: Add sound card
authorStephan Gerhold <stephan@gerhold.net>
Sun, 10 Apr 2022 19:51:13 +0000 (21:51 +0200)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 12 Apr 2022 19:28:22 +0000 (14:28 -0500)
The huawei-g7 uses the msm8916-wcd-digital/analog audio codecs similar
to apq8016-sbc, so we can mostly copy paste it from there to make audio
work correctly. The main difference is the hphl-jack-type-normally-open
property, which is needed to avoid inverted audio jack detection.

Note that at least on my device the jack detection is not fully
reliable: sometimes headphones are detected as headsets (with
microphone). However, this is not a big problem for typical usage.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220410195113.13646-3-stephan@gerhold.net
arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts

index 8ad9eb4..00488af 100644 (file)
@@ -8,6 +8,7 @@
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/sound/apq8016-lpass.h>
 
 /*
  * Note: The original firmware from Huawei can only boot 32-bit kernels.
        status = "okay";
 };
 
+&lpass {
+       status = "okay";
+};
+
 &pm8916_resin {
        status = "okay";
        linux,code = <KEY_VOLUMEDOWN>;
        cd-gpios = <&msmgpio 56 GPIO_ACTIVE_LOW>;
 };
 
+&sound {
+       status = "okay";
+
+       model = "msm8916";
+       audio-routing =
+               "AMIC1", "MIC BIAS External1",
+               "AMIC2", "MIC BIAS External2",
+               "AMIC3", "MIC BIAS External1";
+
+       pinctrl-names = "default", "sleep";
+       pinctrl-0 = <&cdc_pdm_lines_act>;
+       pinctrl-1 = <&cdc_pdm_lines_sus>;
+
+       primary-dai-link {
+               link-name = "WCD";
+               cpu {
+                       sound-dai = <&lpass MI2S_PRIMARY>;
+               };
+               codec {
+                       sound-dai = <&lpass_codec 0>, <&wcd_codec 0>;
+               };
+       };
+
+       tertiary-dai-link {
+               link-name = "WCD-Capture";
+               cpu {
+                       sound-dai = <&lpass MI2S_TERTIARY>;
+               };
+               codec {
+                       sound-dai = <&lpass_codec 1>, <&wcd_codec 1>;
+               };
+       };
+};
+
 &usb {
        status = "okay";
        extcon = <&usb_id>, <&usb_id>;
        extcon = <&usb_id>;
 };
 
+&wcd_codec {
+       qcom,micbias-lvl = <2800>;
+       qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
+       qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
+       qcom,hphl-jack-type-normally-open;
+};
+
 &smd_rpm_regulators {
        vdd_l1_l2_l3-supply = <&pm8916_s3>;
        vdd_l4_l5_l6-supply = <&pm8916_s4>;