From a225a2529487125aa260667db2cee241a2e75fa2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 18 Oct 2021 03:56:14 +0200
Subject: [PATCH 088/463] input: touchscreen: goodix: Respect IRQ flags from DT
 when asked to

Sometimes the IRQ flags determined from toucschreen config don't
work well.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/input/touchscreen/goodix.c | 7 ++++++-
 drivers/input/touchscreen/goodix.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 585dd64347807..3729f80374b2c 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -521,9 +521,13 @@ static void goodix_free_irq(struct goodix_ts_data *ts)
 
 static int goodix_request_irq(struct goodix_ts_data *ts)
 {
+	unsigned long irq_flags = ts->irq_flags;
+	if (ts->use_dt_irqflags)
+		irq_flags = IRQF_ONESHOT;
+
 	return devm_request_threaded_irq(&ts->client->dev, ts->client->irq,
 					 NULL, goodix_ts_irq_handler,
-					 ts->irq_flags, ts->client->name, ts);
+					 irq_flags, ts->client->name, ts);
 }
 
 static int goodix_check_cfg_8(struct goodix_ts_data *ts, const u8 *cfg, int len)
@@ -1325,6 +1329,7 @@ static int goodix_ts_probe(struct i2c_client *client)
 	if (!ts)
 		return -ENOMEM;
 
+	ts->use_dt_irqflags = of_property_read_bool(np, "use-dt-irq-flags");
 	ts->client = client;
 	i2c_set_clientdata(client, ts);
 	init_completion(&ts->firmware_loading_complete);
diff --git a/drivers/input/touchscreen/goodix.h b/drivers/input/touchscreen/goodix.h
index db9f03149b111..62999908c9fd1 100644
--- a/drivers/input/touchscreen/goodix.h
+++ b/drivers/input/touchscreen/goodix.h
@@ -81,6 +81,7 @@ struct goodix_ts_data {
 	const char *firmware_name;
 	struct touchscreen_properties prop;
 	unsigned int max_touch_num;
+	bool use_dt_irqflags;
 	unsigned int int_trigger_type;
 	struct regulator *avdd28;
 	struct regulator *vddio;
-- 
2.46.0

