From e636c8d336489bf3eed5878299e6cc045bbad077 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Tue, 20 Feb 2024 01:17:29 +0000
Subject: [PATCH] debug lk
---
kernel/drivers/input/touchscreen/gt1x/gt1x.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/kernel/drivers/input/touchscreen/gt1x/gt1x.c b/kernel/drivers/input/touchscreen/gt1x/gt1x.c
index f65ca3b..8c8e06d 100644
--- a/kernel/drivers/input/touchscreen/gt1x/gt1x.c
+++ b/kernel/drivers/input/touchscreen/gt1x/gt1x.c
@@ -33,6 +33,7 @@
bool gt1x_gt5688;
int gt1x_rst_gpio;
int gt1x_int_gpio;
+static bool power_invert;
#endif
static int gt1x_register_powermanger(void);
@@ -323,9 +324,15 @@
gt1x_int_gpio = of_get_named_gpio(np, "goodix,irq-gpio", 0);
gt1x_rst_gpio = of_get_named_gpio(np, "goodix,rst-gpio", 0);
- if (!gpio_is_valid(gt1x_int_gpio) || !gpio_is_valid(gt1x_rst_gpio)) {
+ if (!gpio_is_valid(gt1x_int_gpio) && !gpio_is_valid(gt1x_rst_gpio)) {
GTP_ERROR("Invalid GPIO, irq-gpio:%d, rst-gpio:%d",
gt1x_int_gpio, gt1x_rst_gpio);
+ return -EINVAL;
+ }
+
+ if (!gpio_is_valid(gt1x_int_gpio)) {
+ GTP_ERROR("Invalid GPIO, irq-gpio:%d",
+ gt1x_int_gpio);
return -EINVAL;
}
@@ -336,6 +343,9 @@
if (PTR_ERR(vdd_ana) == -ENODEV) {
GTP_ERROR("power not specified, ignore power ctrl");
vdd_ana = NULL;
+ } else {
+ power_invert = of_property_read_bool(np, "power-invert");
+ GTP_INFO("Power Invert,%s ", power_invert ? "yes" : "no");
}
}
if (IS_ERR(vdd_ana)) {
@@ -364,7 +374,7 @@
*/
int gt1x_power_switch(int on)
{
- int ret;
+ int ret = 0;
struct i2c_client *client = gt1x_i2c_client;
if (!client || !vdd_ana)
@@ -372,10 +382,20 @@
if (on) {
GTP_DEBUG("GTP power on.");
- ret = regulator_enable(vdd_ana);
+ if (power_invert) {
+ if (regulator_is_enabled(vdd_ana) > 0)
+ ret = regulator_disable(vdd_ana);
+ } else {
+ ret = regulator_enable(vdd_ana);
+ }
} else {
GTP_DEBUG("GTP power off.");
- ret = regulator_disable(vdd_ana);
+ if (power_invert) {
+ if (!regulator_is_enabled(vdd_ana))
+ ret = regulator_enable(vdd_ana);
+ } else {
+ ret = regulator_disable(vdd_ana);
+ }
}
return ret;
}
@@ -411,14 +431,17 @@
GTP_GPIO_AS_INT(GTP_INT_PORT);
gt1x_i2c_client->irq = GTP_INT_IRQ;
- ret = gpio_request(GTP_RST_PORT, "GTP_RST_PORT");
- if (ret < 0) {
- GTP_ERROR("Failed to request GPIO:%d, ERRNO:%d", (s32) GTP_RST_PORT, ret);
- gpio_free(GTP_INT_PORT);
- return ret;
- }
+ if (gpio_is_valid(gt1x_rst_gpio)) {
+ ret = gpio_request(GTP_RST_PORT, "GTP_RST_PORT");
+ if (ret < 0) {
+ GTP_ERROR("Failed to request GPIO:%d, ERRNO:%d", (s32) GTP_RST_PORT, ret);
+ gpio_free(GTP_INT_PORT);
+ return ret;
+ }
GTP_GPIO_AS_INPUT(GTP_RST_PORT);
+ }
+
return 0;
}
@@ -633,6 +656,18 @@
}
#if defined(CONFIG_FB)
+#include <linux/async.h>
+
+static void gt1x_resume_async(void *data, async_cookie_t cookie)
+{
+ gt1x_resume();
+}
+
+static void gt1x_suspend_async(void *data, async_cookie_t cookie)
+{
+ gt1x_suspend();
+}
+
/* frame buffer notifier block control the suspend/resume procedure */
static struct notifier_block gt1x_fb_notifier;
static int tp_status;
@@ -663,7 +698,7 @@
if (*blank == FB_BLANK_UNBLANK) {
tp_status = *blank;
GTP_DEBUG("Resume by fb notifier.");
- gt1x_resume();
+ async_schedule(gt1x_resume_async, NULL);
}
}
#endif
@@ -674,7 +709,7 @@
if (*blank == FB_BLANK_POWERDOWN) {
tp_status = *blank;
GTP_DEBUG("Suspend by fb notifier.");
- gt1x_suspend();
+ async_schedule(gt1x_suspend_async, NULL);
}
}
@@ -807,3 +842,4 @@
MODULE_DESCRIPTION("GTP Series Driver");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);
--
Gitblit v1.6.2