[PATCH 11/11] arm64: dts: mediatek: cherry: Add I2C-HID touchscreen on I2C4

AngeloGioacchino Del Regno posted 11 patches 2 years, 4 months ago
There is a newer version of this series
[PATCH 11/11] arm64: dts: mediatek: cherry: Add I2C-HID touchscreen on I2C4
Posted by AngeloGioacchino Del Regno 2 years, 4 months ago
This platform carries a HID compatible I2C touchscreen on the i2c4 bus,
but it may either be at 0x10, or at 0x15, depending on the board model:
declare both as disabled in the common Cherry device-tree and enable
the required touchscreen node on a per-board basis.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../dts/mediatek/mt8195-cherry-tomato-r1.dts  |  4 ++
 .../dts/mediatek/mt8195-cherry-tomato-r2.dts  |  4 ++
 .../dts/mediatek/mt8195-cherry-tomato-r3.dts  |  4 ++
 .../boot/dts/mediatek/mt8195-cherry.dtsi      | 41 +++++++++++++++++++
 4 files changed, 53 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
index 17e9e4d6f6ab..2837fb24c84c 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
@@ -9,3 +9,7 @@ / {
 	model = "MediaTek Tomato (rev1) board";
 	compatible = "google,tomato-rev1", "google,tomato", "mediatek,mt8195";
 };
+
+&ts_10 {
+	status = "okay";
+};
diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts
index ee5fd07ad573..4e1d1a1887c7 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts
@@ -29,3 +29,7 @@ pins-low-power-pcie0-disable {
 		bias-pull-down;
 	};
 };
+
+&ts_10 {
+	status = "okay";
+};
diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts
index 792f6c83e88b..4a45884203ea 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts
@@ -30,3 +30,7 @@ pins-low-power-pcie0-disable {
 		bias-pull-down;
 	};
 };
+
+&ts_10 {
+	status = "okay";
+};
diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
index 2687c6d40ac1..7a32c7006a5a 100644
--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
@@ -143,6 +143,31 @@ &i2c4 {
 	clock-frequency = <400000>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&i2c4_pin>;
+
+	/* Depending on the machine, the TS may be at 0x10 or at 0x15 */
+	ts_10: touchscreen@10 {
+		compatible = "hid-over-i2c";
+		reg = <0x10>;
+		hid-descr-addr = <0x0001>;
+		interrupts-extended = <&pio 92 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&touchscreen_pins>;
+		post-power-on-delay-ms = <10>;
+		vdd-supply = <&pp3300_s3>;
+		status = "disabled";
+	};
+
+	ts_15: touchscreen@15 {
+		compatible = "hid-over-i2c";
+		reg = <0x15>;
+		hid-descr-addr = <0x0001>;
+		interrupts-extended = <&pio 92 IRQ_TYPE_LEVEL_LOW>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&touchscreen_pins>;
+		post-power-on-delay-ms = <10>;
+		vdd-supply = <&pp3300_s3>;
+		status = "disabled";
+	};
 };
 
 &i2c5 {
@@ -609,6 +634,22 @@ subpmic_pin_irq: pins-subpmic-int-n {
 			bias-pull-up;
 		};
 	};
+
+	touchscreen_pins: touchscreen-default-pins {
+		pins-int-n {
+			pinmux = <PINMUX_GPIO92__FUNC_GPIO92>;
+			input-enable;
+			bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
+		};
+		pins-rst {
+			pinmux = <PINMUX_GPIO56__FUNC_GPIO56>;
+			output-high;
+		};
+		pins-report-sw {
+			pinmux = <PINMUX_GPIO57__FUNC_GPIO57>;
+			output-low;
+		};
+	};
 };
 
 &pmic {
-- 
2.35.1
Re: [PATCH 11/11] arm64: dts: mediatek: cherry: Add I2C-HID touchscreen on I2C4
Posted by Nícolas F. R. A. Prado 2 years, 4 months ago
On Thu, Jun 30, 2022 at 05:33:16PM +0200, AngeloGioacchino Del Regno wrote:
> This platform carries a HID compatible I2C touchscreen on the i2c4 bus,
> but it may either be at 0x10, or at 0x15, depending on the board model:
> declare both as disabled in the common Cherry device-tree and enable
> the required touchscreen node on a per-board basis.
> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../dts/mediatek/mt8195-cherry-tomato-r1.dts  |  4 ++
>  .../dts/mediatek/mt8195-cherry-tomato-r2.dts  |  4 ++
>  .../dts/mediatek/mt8195-cherry-tomato-r3.dts  |  4 ++
>  .../boot/dts/mediatek/mt8195-cherry.dtsi      | 41 +++++++++++++++++++
>  4 files changed, 53 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> index 17e9e4d6f6ab..2837fb24c84c 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r1.dts
> @@ -9,3 +9,7 @@ / {
>  	model = "MediaTek Tomato (rev1) board";
>  	compatible = "google,tomato-rev1", "google,tomato", "mediatek,mt8195";
>  };
> +
> +&ts_10 {
> +	status = "okay";
> +};
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts
> index ee5fd07ad573..4e1d1a1887c7 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dts
> @@ -29,3 +29,7 @@ pins-low-power-pcie0-disable {
>  		bias-pull-down;
>  	};
>  };
> +
> +&ts_10 {
> +	status = "okay";
> +};
> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts
> index 792f6c83e88b..4a45884203ea 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r3.dts
> @@ -30,3 +30,7 @@ pins-low-power-pcie0-disable {
>  		bias-pull-down;
>  	};
>  };
> +
> +&ts_10 {
> +	status = "okay";
> +};

But no board currently uses the one on 0x15?

Thanks,
Nícolas

> diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> index 2687c6d40ac1..7a32c7006a5a 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi
> @@ -143,6 +143,31 @@ &i2c4 {
>  	clock-frequency = <400000>;
>  	pinctrl-names = "default";
>  	pinctrl-0 = <&i2c4_pin>;
> +
> +	/* Depending on the machine, the TS may be at 0x10 or at 0x15 */
> +	ts_10: touchscreen@10 {
> +		compatible = "hid-over-i2c";
> +		reg = <0x10>;
> +		hid-descr-addr = <0x0001>;
> +		interrupts-extended = <&pio 92 IRQ_TYPE_LEVEL_LOW>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&touchscreen_pins>;
> +		post-power-on-delay-ms = <10>;
> +		vdd-supply = <&pp3300_s3>;
> +		status = "disabled";
> +	};
> +
> +	ts_15: touchscreen@15 {
> +		compatible = "hid-over-i2c";
> +		reg = <0x15>;
> +		hid-descr-addr = <0x0001>;
> +		interrupts-extended = <&pio 92 IRQ_TYPE_LEVEL_LOW>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&touchscreen_pins>;
> +		post-power-on-delay-ms = <10>;
> +		vdd-supply = <&pp3300_s3>;
> +		status = "disabled";
> +	};
>  };
>  
>  &i2c5 {
> @@ -609,6 +634,22 @@ subpmic_pin_irq: pins-subpmic-int-n {
>  			bias-pull-up;
>  		};
>  	};
> +
> +	touchscreen_pins: touchscreen-default-pins {
> +		pins-int-n {
> +			pinmux = <PINMUX_GPIO92__FUNC_GPIO92>;
> +			input-enable;
> +			bias-pull-up = <MTK_PUPD_SET_R1R0_01>;
> +		};
> +		pins-rst {
> +			pinmux = <PINMUX_GPIO56__FUNC_GPIO56>;
> +			output-high;
> +		};
> +		pins-report-sw {
> +			pinmux = <PINMUX_GPIO57__FUNC_GPIO57>;
> +			output-low;
> +		};
> +	};
>  };
>  
>  &pmic {
> -- 
> 2.35.1
>