Merge pull request #1777 from loki666/pocket-ace-touchscreen

Pocket ACE: add touchscreen
This commit is contained in:
Philippe Simons
2025-08-23 19:38:08 +02:00
committed by GitHub
3 changed files with 171 additions and 9 deletions

View File

@@ -0,0 +1,101 @@
From cdcd4a5981e9aca951601d8e254fc0904fc1ae97 Mon Sep 17 00:00:00 2001
From: Philippe Simons <simons.philippe@gmail.com>
Date: Thu, 21 Aug 2025 22:29:26 +0200
Subject: [PATCH] input: rmi4: add reset-gpio
---
drivers/input/rmi4/rmi_driver.c | 1 -
drivers/input/rmi4/rmi_driver.h | 2 ++
drivers/input/rmi4/rmi_i2c.c | 22 ++++++++++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
index 2168b6cd7167..ff6aed6a11c1 100644
--- a/drivers/input/rmi4/rmi_driver.c
+++ b/drivers/input/rmi4/rmi_driver.c
@@ -30,7 +30,6 @@
#define RMI4_PAGE_MASK 0xFF00
#define RMI_DEVICE_RESET_CMD 0x01
-#define DEFAULT_RESET_DELAY_MS 100
void rmi_free_function_list(struct rmi_device *rmi_dev)
{
diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_driver.h
index 3bfe9013043e..e01453bd680f 100644
--- a/drivers/input/rmi4/rmi_driver.h
+++ b/drivers/input/rmi4/rmi_driver.h
@@ -16,6 +16,8 @@
#define SYNAPTICS_INPUT_DEVICE_NAME "Synaptics RMI4 Touch Sensor"
#define SYNAPTICS_VENDOR_ID 0x06cb
+#define DEFAULT_RESET_DELAY_MS 100
+
#define GROUP(_attrs) { \
.attrs = _attrs, \
}
diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index 3c0c5fd44702..b901168183ea 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -4,6 +4,7 @@
* Copyright (c) 2011 Unixphere
*/
+#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/rmi.h>
#include <linux/of.h>
@@ -26,6 +27,7 @@
* @tx_buf_size: Size of the buffer
*
* @supplies: Array of voltage regulators
+ * @reset_gpio: Reference to the reset GPIO
* @startup_delay: Milliseconds to pause after powering up the regulators
*/
struct rmi_i2c_xport {
@@ -39,7 +41,9 @@ struct rmi_i2c_xport {
size_t tx_buf_size;
struct regulator_bulk_data supplies[2];
+ struct gpio_desc *reset_gpio;
u32 startup_delay;
+ u32 reset_delay;
};
#define RMI_PAGE_SELECT_REGISTER 0xff
@@ -227,6 +231,15 @@ static int rmi_i2c_probe(struct i2c_client *client)
return -ENODEV;
}
+ rmi_i2c->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(rmi_i2c->reset_gpio)) {
+ error = PTR_ERR(rmi_i2c->reset_gpio);
+ dev_err(&client->dev, "failed to get reset GPIO: %d\n", error);
+ return error;
+ }
+ gpiod_set_consumer_name(rmi_i2c->reset_gpio, "rmi4 reset");
+
rmi_i2c->supplies[0].supply = "vdd";
rmi_i2c->supplies[1].supply = "vio";
error = devm_regulator_bulk_get(&client->dev,
@@ -251,6 +264,15 @@ static int rmi_i2c_probe(struct i2c_client *client)
msleep(rmi_i2c->startup_delay);
+ if (rmi_i2c->reset_gpio) {
+ of_property_read_u32(client->dev.of_node, "syna,reset-delay-ms",
+ &rmi_i2c->reset_delay);
+ gpiod_set_value_cansleep(rmi_i2c->reset_gpio, 0);
+ usleep_range(10000, 20000);
+ gpiod_set_value_cansleep(rmi_i2c->reset_gpio, 1);
+ msleep(rmi_i2c->reset_delay ?: DEFAULT_RESET_DELAY_MS);
+ }
+
rmi_i2c->client = client;
mutex_init(&rmi_i2c->page_mutex);
--
2.50.1

View File

@@ -3,7 +3,7 @@ new file mode 100644
index 000000000000..58d9ab342fe9
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocket-common.dtsi
@@ -0,0 +1,1919 @@
@@ -0,0 +1,1912 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) 2025, Teguh Sobirin.
@@ -1849,13 +1849,6 @@ index 000000000000..58d9ab342fe9
+ status = "okay";
+};
+
+&pcie0_phy {
+ vdda-phy-supply = <&vreg_l1e_0p88>;
+ vdda-pll-supply = <&vreg_l3e_1p2>;
+
+ status = "okay";
+};
+
+&pcie1 {
+ wake-gpios = <&tlmm 99 GPIO_ACTIVE_HIGH>;
+ perst-gpios = <&tlmm 97 GPIO_ACTIVE_LOW>;

View File

@@ -1,7 +1,7 @@
diff -rupbN linux.orig/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketace.dts linux/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketace.dts
--- linux.orig/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketace.dts 1970-01-01 00:00:00.000000000 +0000
+++ linux/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketace.dts 2025-02-26 13:52:56.398992835 +0000
@@ -0,0 +1,63 @@
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) 2025, Teguh Sobirin.
@@ -27,6 +27,34 @@ diff -rupbN linux.orig/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketace.dts lin
+ bias-disable;
+ output-high;
+ };
+
+ ts_reset_active: ts-reset-active-state {
+ pins = "gpio24";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+
+ ts_reset_suspend: ts-reset-suspend-state {
+ pins = "gpio24";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-pull-down;
+ };
+
+ ts_int_active: ts-int-default-state {
+ pins = "gpio25";
+ function = "gpio";
+ bias-pull-up;
+ drive-strength = <8>;
+ };
+
+ ts_int_suspend: ts-int-sleep-state {
+ pins = "gpio25";
+ function = "gpio";
+ bias-pull-down;
+ drive-strength = <2>;
+ };
+};
+
+&i2c0 {
@@ -53,6 +81,46 @@ diff -rupbN linux.orig/arch/arm64/boot/dts/qcom/qcs8550-ayaneo-pocketace.dts lin
+ };
+};
+
+&i2c4 {
+ clock-frequency = <400000>;
+ status = "okay";
+
+ touchscreen@70 {
+ compatible = "syna,rmi4-i2c";
+ reg = <0x70>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ interrupts-extended = <&tlmm 25 0x2008>;
+
+ pinctrl-names = "ts_active","ts_suspend";
+ pinctrl-0 = <&ts_int_active &ts_reset_active>;
+ pinctrl-1 = <&ts_int_suspend &ts_reset_suspend>;
+
+ reset-gpios = <&tlmm 24 0x01>;
+
+ vio-supply = <&vreg_l12b_1p8>;
+ vdd-supply = <&vreg_l14b_3p2>;
+
+ syna,startup-delay-ms = <200>;
+ syna,reset-delay-ms = <200>;
+
+ rmi4-f01@1 {
+ syna,nosleep-mode = <0x1>;
+ reg = <0x1>;
+ };
+
+ rmi4-f12@12 {
+ reg = <0x12>;
+ syna,rezero-wait-ms = <20>;
+ syna,clip-x-low = <0>;
+ syna,clip-y-low = <0>;
+ syna,clip-x-high = <1080>;
+ syna,clip-y-high = <1620>;
+ syna,sensor-type = <1>;
+ };
+ };
+};
+
+&display_panel {
+ compatible = "ayaneo,pocket-ace";
+