All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] arm64: dts: qcom: Add device tree for Xiaomi Redmi 2 (wingtech-wt88047)
@ 2021-07-12 13:37 Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 2/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add touchscreen Stephan Gerhold
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stephan Gerhold @ 2021-07-12 13:37 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, devicetree, phone-devel,
	~postmarketos/upstreaming, Stephan Gerhold

The Xiaomi Redmi 2 is a MSM8916 smartphone that was made by Wingtech
(codename: wt88047). It's fairly similar to the other MSM8916 devices.

The device tree contains initial support for the Xiaomi Redmi 2 with:
  - UART (untested, probably available via some test points)
  - eMMC/SD card
  - Buttons
  - Vibrator
  - WiFi/Bluetooth (WCNSS)
  - USB

Note that the Xiaomi Redmi 2 is available in variants with different
names (e.g. Redmi 2 Prime, Redmi 2 Pro, ...). As far as I know the main
difference between those is the amount of RAM and supported LTE bands.
This difference is automatically handled by bootloader/modem firmware
so there is no need for separate device trees.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
The reason this is GPL-2.0-only instead of BSD is the same as for
huawei-g7, see https://lore.kernel.org/linux-arm-msm/YMIznk4scPv1qOzP@gerhold.net/
---
 arch/arm64/boot/dts/qcom/Makefile             |   1 +
 .../dts/qcom/msm8916-wingtech-wt88047.dts     | 208 ++++++++++++++++++
 2 files changed, 209 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts

diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
index 4f0597091976..a571bfdddd61 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -15,6 +15,7 @@ dtb-$(CONFIG_ARCH_QCOM)	+= msm8916-longcheer-l8910.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8916-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8916-samsung-a3u-eur.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8916-samsung-a5u-eur.dtb
+dtb-$(CONFIG_ARCH_QCOM)	+= msm8916-wingtech-wt88047.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8992-bullhead-rev-101.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8992-msft-lumia-octagon-talkman.dtb
 dtb-$(CONFIG_ARCH_QCOM)	+= msm8992-xiaomi-libra.dtb
diff --git a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
new file mode 100644
index 000000000000..5ee35a9b7dc6
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
@@ -0,0 +1,208 @@
+// SPDX-License-Identifier: GPL-2.0-only
+// Copyright (C) 2020 Stephan Gerhold
+
+/dts-v1/;
+
+#include "msm8916-pm8916.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	model = "Xiaomi Redmi 2 (Wingtech WT88047)";
+	compatible = "wingtech,wt88047", "qcom,msm8916";
+
+	aliases {
+		serial0 = &blsp1_uart2;
+	};
+
+	chosen {
+		stdout-path = "serial0";
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&gpio_keys_default>;
+
+		label = "GPIO Buttons";
+
+		volume-up {
+			label = "Volume Up";
+			gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEUP>;
+		};
+	};
+
+	usb_id: usb-id {
+		compatible = "linux,extcon-usb-gpio";
+		id-gpio = <&msmgpio 110 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_id_default>;
+	};
+};
+
+&blsp1_uart2 {
+	status = "okay";
+};
+
+&pm8916_resin {
+	status = "okay";
+	linux,code = <KEY_VOLUMEDOWN>;
+};
+
+&pm8916_vib {
+	status = "okay";
+};
+
+&pronto {
+	status = "okay";
+};
+
+&sdhc_1 {
+	status = "okay";
+
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
+	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
+};
+
+&sdhc_2 {
+	status = "okay";
+
+	pinctrl-names = "default", "sleep";
+	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>;
+	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>;
+
+	non-removable;
+};
+
+&usb {
+	status = "okay";
+	extcon = <&usb_id>, <&usb_id>;
+};
+
+&usb_hs_phy {
+	extcon = <&usb_id>;
+};
+
+&smd_rpm_regulators {
+	vdd_l1_l2_l3-supply = <&pm8916_s3>;
+	vdd_l4_l5_l6-supply = <&pm8916_s4>;
+	vdd_l7-supply = <&pm8916_s4>;
+
+	s3 {
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <1300000>;
+	};
+
+	s4 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <2100000>;
+	};
+
+	l1 {
+		regulator-min-microvolt = <1225000>;
+		regulator-max-microvolt = <1225000>;
+	};
+
+	l2 {
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <1200000>;
+	};
+
+	l4 {
+		regulator-min-microvolt = <2050000>;
+		regulator-max-microvolt = <2050000>;
+	};
+
+	l5 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
+	l6 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
+	l7 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+
+	l8 {
+		regulator-min-microvolt = <2850000>;
+		regulator-max-microvolt = <2900000>;
+	};
+
+	l9 {
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	l10 {
+		regulator-min-microvolt = <2700000>;
+		regulator-max-microvolt = <2800000>;
+	};
+
+	l11 {
+		regulator-min-microvolt = <2950000>;
+		regulator-max-microvolt = <2950000>;
+		regulator-allow-set-load;
+		regulator-system-load = <200000>;
+	};
+
+	l12 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <2950000>;
+	};
+
+	l13 {
+		regulator-min-microvolt = <3075000>;
+		regulator-max-microvolt = <3075000>;
+	};
+
+	l14 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	l15 {
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	l16 {
+		regulator-min-microvolt = <2800000>;
+		regulator-max-microvolt = <3300000>;
+	};
+
+	l17 {
+		regulator-min-microvolt = <2850000>;
+		regulator-max-microvolt = <2850000>;
+	};
+
+	l18 {
+		regulator-min-microvolt = <2700000>;
+		regulator-max-microvolt = <2700000>;
+	};
+};
+
+&msmgpio {
+	gpio_keys_default: gpio-keys-default {
+		pins = "gpio107";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-pull-up;
+	};
+
+	usb_id_default: usb-id-default {
+		pins = "gpio110";
+		function = "gpio";
+
+		drive-strength = <8>;
+		bias-pull-up;
+	};
+};
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add touchscreen
  2021-07-12 13:37 [PATCH 1/4] arm64: dts: qcom: Add device tree for Xiaomi Redmi 2 (wingtech-wt88047) Stephan Gerhold
@ 2021-07-12 13:37 ` Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 3/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add notification LED Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 4/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add IMU Stephan Gerhold
  2 siblings, 0 replies; 4+ messages in thread
From: Stephan Gerhold @ 2021-07-12 13:37 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, devicetree, phone-devel,
	~postmarketos/upstreaming, Stephan Gerhold

The Xiaomi Redmi 2 has a FocalTech touchscreen. The exact model is
not mentioned anywhere, but it works just fine with the mainline
edt-ft5x06 driver when using the "edt,edt-ft5506" compatible.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../dts/qcom/msm8916-wingtech-wt88047.dts     | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
index 5ee35a9b7dc6..a4d8d6ff2289 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
@@ -42,6 +42,30 @@ usb_id: usb-id {
 	};
 };
 
+&blsp_i2c5 {
+	status = "okay";
+
+	touchscreen@38 {
+		/* Likely some other model but works just fine with this one */
+		compatible = "edt,edt-ft5506";
+		reg = <0x38>;
+
+		interrupt-parent = <&msmgpio>;
+		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
+
+		reset-gpios = <&msmgpio 12 GPIO_ACTIVE_LOW>;
+
+		vcc-supply = <&pm8916_l17>;
+		iovcc-supply = <&pm8916_l6>;
+
+		touchscreen-size-x = <720>;
+		touchscreen-size-y = <1280>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&touchscreen_default>;
+	};
+};
+
 &blsp1_uart2 {
 	status = "okay";
 };
@@ -198,6 +222,22 @@ gpio_keys_default: gpio-keys-default {
 		bias-pull-up;
 	};
 
+	touchscreen_default: touchscreen-default {
+		pins = "gpio13";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-pull-up;
+
+		reset {
+			pins = "gpio12";
+			function = "gpio";
+
+			drive-strength = <2>;
+			bias-disable;
+		};
+	};
+
 	usb_id_default: usb-id-default {
 		pins = "gpio110";
 		function = "gpio";
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add notification LED
  2021-07-12 13:37 [PATCH 1/4] arm64: dts: qcom: Add device tree for Xiaomi Redmi 2 (wingtech-wt88047) Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 2/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add touchscreen Stephan Gerhold
@ 2021-07-12 13:37 ` Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 4/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add IMU Stephan Gerhold
  2 siblings, 0 replies; 4+ messages in thread
From: Stephan Gerhold @ 2021-07-12 13:37 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, devicetree, phone-devel,
	~postmarketos/upstreaming, Stephan Gerhold

The Xiaomi Redmi 2 has a notification LED connected to an Awinic
AW2013 controller, add it to the device tree.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../dts/qcom/msm8916-wingtech-wt88047.dts     | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
index a4d8d6ff2289..9d9e85e75411 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
@@ -6,6 +6,7 @@
 #include "msm8916-pm8916.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "Xiaomi Redmi 2 (Wingtech WT88047)";
@@ -66,6 +67,40 @@ touchscreen@38 {
 	};
 };
 
+&blsp_i2c6 {
+	status = "okay";
+
+	led-controller@45 {
+		compatible = "awinic,aw2013";
+		reg = <0x45>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		vcc-supply = <&pm8916_l16>;
+
+		led@0 {
+			reg = <0>;
+			led-max-microamp = <15000>;
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_RED>;
+		};
+
+		led@1 {
+			reg = <1>;
+			led-max-microamp = <15000>;
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_GREEN>;
+		};
+
+		led@2 {
+			reg = <2>;
+			led-max-microamp = <15000>;
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_BLUE>;
+		};
+	};
+};
+
 &blsp1_uart2 {
 	status = "okay";
 };
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add IMU
  2021-07-12 13:37 [PATCH 1/4] arm64: dts: qcom: Add device tree for Xiaomi Redmi 2 (wingtech-wt88047) Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 2/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add touchscreen Stephan Gerhold
  2021-07-12 13:37 ` [PATCH 3/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add notification LED Stephan Gerhold
@ 2021-07-12 13:37 ` Stephan Gerhold
  2 siblings, 0 replies; 4+ messages in thread
From: Stephan Gerhold @ 2021-07-12 13:37 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, linux-arm-msm, devicetree, phone-devel,
	~postmarketos/upstreaming, Stephan Gerhold

The Xiaomi Redmi 2 has an InvenSense MPU-6880 supported by the
inv_mpu6050 driver in Linux. Add it to the device tree.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
 .../dts/qcom/msm8916-wingtech-wt88047.dts     | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
index 9d9e85e75411..4e20cc0008f7 100644
--- a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
+++ b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
@@ -43,6 +43,28 @@ usb_id: usb-id {
 	};
 };
 
+&blsp_i2c2 {
+	status = "okay";
+
+	imu@68 {
+		compatible = "invensense,mpu6880";
+		reg = <0x68>;
+
+		interrupt-parent = <&msmgpio>;
+		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
+
+		vdd-supply = <&pm8916_l17>;
+		vddio-supply = <&pm8916_l6>;
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&imu_default>;
+
+		mount-matrix = "1",  "0", "0",
+			       "0", "-1", "0",
+			       "0",  "0", "1";
+	};
+};
+
 &blsp_i2c5 {
 	status = "okay";
 
@@ -257,6 +279,14 @@ gpio_keys_default: gpio-keys-default {
 		bias-pull-up;
 	};
 
+	imu_default: imu-default {
+		pins = "gpio115";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	touchscreen_default: touchscreen-default {
 		pins = "gpio13";
 		function = "gpio";
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-12 13:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 13:37 [PATCH 1/4] arm64: dts: qcom: Add device tree for Xiaomi Redmi 2 (wingtech-wt88047) Stephan Gerhold
2021-07-12 13:37 ` [PATCH 2/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add touchscreen Stephan Gerhold
2021-07-12 13:37 ` [PATCH 3/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add notification LED Stephan Gerhold
2021-07-12 13:37 ` [PATCH 4/4] arm64: dts: qcom: msm8916-wingtech-wt88047: Add IMU Stephan Gerhold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.