linux/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt86528.dts

// SPDX-License-Identifier: GPL-2.0-only

/dts-v1/;

#include "msm8916-wingtech-wt865x8.dtsi"

/ {
	model = "Lenovo A6010 (Wingtech WT86528)";
	compatible = "wingtech,wt86528", "qcom,msm8916";
	chassis-type = "handset";

	/* left AW8736 */
	speaker_amp_left: audio-amplifier-left {
		compatible = "awinic,aw8738";

		pinctrl-0 = <&spk_ext_pa_left_default>;
		pinctrl-names = "default";

		mode-gpios = <&tlmm 119 GPIO_ACTIVE_HIGH>;
		sound-name-prefix = "Speaker Amp L";
		awinic,mode = <3>;
	};

	/* right AW8736 */
	speaker_amp_right: audio-amplifier-right {
		compatible = "awinic,aw8738";

		pinctrl-0 = <&spk_ext_pa_right_default>;
		pinctrl-names = "default";

		mode-gpios = <&tlmm 121 GPIO_ACTIVE_HIGH>;
		sound-name-prefix = "Speaker Amp R";
		awinic,mode = <3>;
	};

	gpio-leds {
		compatible = "gpio-leds";

		pinctrl-0 = <&gpio_leds_default>;
		pinctrl-names = "default";

		led-0 {
			gpios = <&tlmm 16 GPIO_ACTIVE_LOW>;
			label = "red";
			default-state = "off";
			retain-state-suspended;
		};

		led-1 {
			gpios = <&tlmm 17 GPIO_ACTIVE_HIGH>;
			label = "green";
			default-state = "off";
			retain-state-suspended;
		};
	};

	usb_id: usb-id {
		compatible = "linux,extcon-usb-gpio";
		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
		pinctrl-0 = <&usb_id_default>;
		pinctrl-names = "default";
	};
};

&blsp_i2c2 {
	magnetometer@c {
		compatible = "asahi-kasei,ak09911";
		reg = <0x0c>;

		vdd-supply = <&pm8916_l17>;
		vid-supply = <&pm8916_l6>;
	};

	imu@68 {
		compatible = "invensense,mpu6880";
		reg = <0x68>;

		interrupts-extended = <&tlmm 115 IRQ_TYPE_EDGE_RISING>;

		vdd-supply = <&pm8916_l17>;
		vddio-supply = <&pm8916_l6>;

		pinctrl-0 = <&imu_default>;
		pinctrl-names = "default";

		mount-matrix = "1",  "0", "0",
			       "0", "-1", "0",
			       "0",  "0", "1";
	};
};

&pm8916_codec {
	qcom,micbias1-ext-cap;
};

&sound {
	model = "wt86528";
	widgets = "Speaker", "Speaker",
		  "Headphone", "Headphones";
	pin-switches = "Speaker", "Headphones";
	audio-routing = "Speaker", "Speaker Amp L OUT",
			"Speaker", "Speaker Amp R OUT",
			"Speaker Amp L IN", "HPH_L",
			"Speaker Amp R IN", "HPH_R",
			"Headphones", "Headphones Switch OUTL",
			"Headphones", "Headphones Switch OUTR",
			"Headphones Switch INL", "HPH_L",
			"Headphones Switch INR", "HPH_R",
			"AMIC1", "MIC BIAS External1",
			"AMIC2", "MIC BIAS Internal2",
			"AMIC3", "MIC BIAS External1";
	aux-devs = <&speaker_amp_left>, <&speaker_amp_right>, <&headphones_switch>;
};

&usb {
	extcon = <&usb_id>, <&usb_id>;
};

&usb_hs_phy {
	extcon = <&usb_id>;
};

&tlmm {
	gpio_leds_default: gpio-leds-default-state {
		pins = "gpio16", "gpio17";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	imu_default: imu-default-state {
		pins = "gpio115";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	spk_ext_pa_left_default: spk-ext-pa-left-default-state {
		pins = "gpio119";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	spk_ext_pa_right_default: spk-ext-pa-right-default-state {
		pins = "gpio121";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	usb_id_default: usb-id-default-state {
		pins = "gpio110";
		function = "gpio";
		drive-strength = <8>;
		bias-pull-up;
	};
};