Commit 372c1c3d authored by Stephan Gerhold's avatar Stephan Gerhold Committed by Bjorn Andersson
Browse files

arm64: dts: qcom: msm8916-huawei-g7: Add sound card



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: default avatarStephan Gerhold <stephan@gerhold.net>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220410195113.13646-3-stephan@gerhold.net
parent d317344d
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -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.
@@ -211,6 +212,10 @@
	status = "okay";
};

&lpass {
	status = "okay";
};

&pm8916_resin {
	status = "okay";
	linux,code = <KEY_VOLUMEDOWN>;
@@ -255,6 +260,40 @@
	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>;
@@ -264,6 +303,13 @@
	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>;