linux/arch/arm64/boot/dts/qcom/msm8939-longcheer-l9100.dts

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

/dts-v1/;

#include "msm8939-pm8916.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>

/ {
	model = "BQ Aquaris M5 (Longcheer L9100)";
	compatible = "longcheer,l9100", "qcom,msm8939";
	chassis-type = "handset";

	aliases {
		mmc0 = &sdhc_1; /* eMMC */
		mmc1 = &sdhc_2; /* SD card */
		serial0 = &blsp_uart2;
	};

	chosen {
		stdout-path = "serial0";
	};

	gpio-hall-sensor {
		compatible = "gpio-keys";

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

		label = "GPIO Hall Effect Sensor";

		event-hall-sensor {
			label = "Hall Effect Sensor";
			gpios = <&tlmm 20 GPIO_ACTIVE_LOW>;
			linux,input-type = <EV_SW>;
			linux,code = <SW_LID>;
			linux,can-disable;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

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

		label = "GPIO Buttons";

		button-volume-up {
			label = "Volume Up";
			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_VOLUMEUP>;
		};
	};

	leds {
		compatible = "gpio-leds";

		led-0 {
			gpios = <&tlmm 17 GPIO_ACTIVE_HIGH>;
			color = <LED_COLOR_ID_WHITE>;
			default-state = "off";
			function = LED_FUNCTION_KBD_BACKLIGHT;

			pinctrl-0 = <&button_backlight_default>;
			pinctrl-names = "default";
		};
	};

	reg_ts_vdd: regulator-vdd-ts {
		compatible = "regulator-fixed";
		regulator-name = "regulator-vdd-ts";
		regulator-min-microvolt = <2850000>;
		regulator-max-microvolt = <2850000>;

		gpio = <&tlmm 78 GPIO_ACTIVE_HIGH>;
		enable-active-high;

		pinctrl-0 = <&ts_vdd_default>;
		pinctrl-names = "default";
	};

	backlight {
		compatible = "pwm-backlight";
		pwms = <&pm8916_pwm 0 100000>;
		brightness-levels = <0 255>;
		num-interpolated-steps = <255>;
		default-brightness-level = <128>;
		enable-gpios = <&tlmm 98 GPIO_ACTIVE_HIGH>;

		pinctrl-0 = <&lcd_bl_en_default>;
		pinctrl-names = "default";
	};

	flash-led-controller {
		compatible = "ocs,ocp8110";
		flash-gpios = <&tlmm 8 GPIO_ACTIVE_HIGH>;
		enable-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;

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

		led {
			function = LED_FUNCTION_FLASH;
			color = <LED_COLOR_ID_WHITE>;
			flash-max-timeout-us = <250000>;
		};
	};

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

};

&blsp_i2c2 {
	status = "okay";

	led-controller@30 {
		compatible = "kinetic,ktd2026";
		reg = <0x30>;
		#address-cells = <1>;
		#size-cells = <0>;

		vin-supply = <&pm8916_l17>;
		vio-supply = <&pm8916_l6>;

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

		multi-led {
			color = <LED_COLOR_ID_RGB>;
			function = LED_FUNCTION_STATUS;

			#address-cells = <1>;
			#size-cells = <0>;

			led@0 {
				reg = <0>;
				color = <LED_COLOR_ID_RED>;
			};

			led@1 {
				reg = <1>;
				color = <LED_COLOR_ID_GREEN>;
			};

			led@2 {
				reg = <2>;
				color = <LED_COLOR_ID_BLUE>;
			};
		};
	};
};

&blsp_i2c3 {
	status = "okay";

	magnetometer@d {
		compatible = "asahi-kasei,ak09911";
		reg = <0x0d>;

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

		reset-gpios = <&tlmm 68 GPIO_ACTIVE_HIGH>;

		pinctrl-0 = <&mag_reset_default>;
		pinctrl-names = "default";
	};

	light-sensor@23 {
		compatible = "liteon,ltr559";
		reg = <0x23>;
		proximity-near-level = <75>;

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

		interrupts-extended = <&tlmm 113 IRQ_TYPE_EDGE_FALLING>;

		pinctrl-0 = <&light_int_default>;
		pinctrl-names = "default";
	};

	imu@68 {
		compatible = "bosch,bmi160";
		reg = <0x68>;

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

&blsp_i2c5 {
	status = "okay";

	touchscreen@4a {
		compatible = "atmel,maxtouch";
		reg = <0x4a>;

		interrupts-extended = <&tlmm 13 IRQ_TYPE_LEVEL_LOW>;

		reset-gpios = <&tlmm 12 GPIO_ACTIVE_LOW>;

		vdda-supply = <&pm8916_l6>;
		vdd-supply = <&reg_ts_vdd>;

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

		/* Keys listed from right to left */
		linux,keycodes = <KEY_APPSELECT KEY_HOMEPAGE KEY_BACK>;
	};
};

&blsp_uart2 {
	status = "okay";
};

&pm8916_gpios {
	status_led_default: status-led-default-state {
		pins = "gpio3";
		function = PMIC_GPIO_FUNC_NORMAL;
		power-source = <PM8916_GPIO_VPH>;
		bias-disable;
		output-high;
	};
};

&pm8916_mpps {
	pwm_out: mpp4-state {
		pins = "mpp4";
		function = "digital";
		power-source = <PM8916_MPP_VPH>;
		output-low;
		qcom,dtest = <1>;
	};
};

&pm8916_pwm {
	pinctrl-0 = <&pwm_out>;
	pinctrl-names = "default";
	status = "okay";
};

&pm8916_resin {
	linux,code = <KEY_VOLUMEDOWN>;
	status = "okay";
};

&pm8916_rpm_regulators {
	pm8916_l17: l17 {
		regulator-min-microvolt = <2850000>;
		regulator-max-microvolt = <2850000>;
	};
};

&pm8916_vib {
	status = "okay";
};

&sdhc_1 {
	status = "okay";
};

&sdhc_2 {
	pinctrl-0 = <&sdc2_default &sdc2_cd_default>;
	pinctrl-1 = <&sdc2_sleep &sdc2_cd_default>;
	pinctrl-names = "default", "sleep";

	cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;

	status = "okay";
};

&usb {
	extcon = <&usb_id>, <&usb_id>;
	status = "okay";
};

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

&wcnss {
	status = "okay";
};

&wcnss_iris {
	compatible = "qcom,wcn3620";
};

&wcnss_mem {
	status = "okay";
};

&tlmm {
	button_backlight_default: button-backlight-default-state {
		pins = "gpio17";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	camera_front_flash_default: camera-front-flash-default-state {
		pins = "gpio8", "gpio49";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
		pins = "gpio20";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	gpio_keys_default: gpio-keys-default-state {
		pins = "gpio107";
		function = "gpio";
		drive-strength = <2>;
		bias-pull-up;
	};

	lcd_bl_en_default: lcd-bl-en-default-state {
		pins = "gpio98";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	light_int_default: light-int-default-state {
		pins = "gpio113";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	mag_reset_default: mag-reset-default-state {
		pins = "gpio68";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	sdc2_cd_default: sdc2-cd-default-state {
		pins = "gpio38";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	ts_int_reset_default: ts-int-reset-default-state {
		pins = "gpio12", "gpio13";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

	ts_vdd_default: ts-vdd-default-state {
		pins = "gpio78";
		function = "gpio";
		drive-strength = <2>;
		bias-disable;
	};

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

	usb_id_switch_default: usb-id-switch-default-state {
		pins = "gpio121";
		function = "gpio";
		drive-strength = <2>;
		output-high;
	};
};