summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWendly Li <wendlyli@google.com>2023-01-12 10:23:55 +0000
committerWendly Li <wendlyli@google.com>2023-02-07 11:46:48 +0000
commit01bc79a67eafe0013dbbb9843301e6e1ba8b97ac (patch)
tree2c050505ef711f40bdfa24f2508efd09f052db5a
parentbef3cc4215fd8f5074eb3a021995a17b6c559666 (diff)
downloadgoodix_touch-01bc79a67eafe0013dbbb9843301e6e1ba8b97ac.tar.gz
touch/goodix: Move heatmap read protection to GTI
Bug: 262053705 Bug: 267991839 Test: check heatmap works properly Change-Id: I1a0dd4dc746037ad4f05e2734e73bce225af5ddd Signed-off-by: Wendly Li <wendlyli@google.com>
-rw-r--r--goodix_brl_hw.c12
-rw-r--r--goodix_ts_core.c8
-rw-r--r--goodix_ts_core.h1
3 files changed, 15 insertions, 6 deletions
diff --git a/goodix_brl_hw.c b/goodix_brl_hw.c
index 1e3bc1a..5e282ad 100644
--- a/goodix_brl_hw.c
+++ b/goodix_brl_hw.c
@@ -344,7 +344,7 @@ static int brl_irq_enable(struct goodix_ts_core *cd, bool enable)
}
if (!enable && atomic_cmpxchg(&cd->irq_enabled, 1, 0)) {
- disable_irq_nosync(cd->irq);
+ disable_irq(cd->irq);
ts_debug("Irq disabled");
return 0;
}
@@ -352,6 +352,15 @@ static int brl_irq_enable(struct goodix_ts_core *cd, bool enable)
return 0;
}
+static int brl_disable_irq_nosync(struct goodix_ts_core *cd)
+{
+ if (atomic_cmpxchg(&cd->irq_enabled, 1, 0)) {
+ disable_irq_nosync(cd->irq);
+ ts_debug("Irq disabled");
+ }
+ return 0;
+}
+
static int brl_read(struct goodix_ts_core *cd, unsigned int addr,
unsigned char *data, unsigned int len)
{
@@ -1830,6 +1839,7 @@ static struct goodix_ts_hw_ops brl_hw_ops = {
.gesture = brl_gesture,
.reset = brl_reset,
.irq_enable = brl_irq_enable,
+ .disable_irq_nosync = brl_disable_irq_nosync,
.read = brl_read,
.read_fast = brl_read_fast,
.write = brl_write,
diff --git a/goodix_ts_core.c b/goodix_ts_core.c
index 3ad3b1a..7294aab 100644
--- a/goodix_ts_core.c
+++ b/goodix_ts_core.c
@@ -969,8 +969,7 @@ static int get_mutual_sensor_data(
cmd->buffer = (u8 *)cd->mutual_data;
cmd->size = tx * rx * sizeof(uint16_t);
} else {
- /* disable irq & close esd */
- cd->hw_ops->irq_enable(cd, false);
+ /* close esd */
goodix_ts_blocking_notify(NOTIFY_ESD_OFF, NULL);
ret = -EINVAL;
@@ -987,8 +986,7 @@ static int get_mutual_sensor_data(
cmd->size = tx * rx * sizeof(uint16_t);
}
- /* enable irq & esd */
- cd->hw_ops->irq_enable(cd, true);
+ /* enable esd */
goodix_ts_blocking_notify(NOTIFY_ESD_ON, NULL);
}
return ret;
@@ -2467,7 +2465,7 @@ static int goodix_ts_suspend(struct goodix_ts_core *core_data)
ts_info("Suspend start");
atomic_set(&core_data->suspended, 1);
/* disable irq */
- hw_ops->irq_enable(core_data, false);
+ hw_ops->disable_irq_nosync(core_data);
/*
* notify suspend event, inform the esd protector
diff --git a/goodix_ts_core.h b/goodix_ts_core.h
index 4cbadef..06e089e 100644
--- a/goodix_ts_core.h
+++ b/goodix_ts_core.h
@@ -633,6 +633,7 @@ struct goodix_ts_hw_ops {
int (*gesture)(struct goodix_ts_core *cd, int gesture_type);
int (*reset)(struct goodix_ts_core *cd, int delay_ms);
int (*irq_enable)(struct goodix_ts_core *cd, bool enable);
+ int (*disable_irq_nosync)(struct goodix_ts_core *cd);
int (*read)(struct goodix_ts_core *cd, unsigned int addr,
unsigned char *data, unsigned int len);
int (*read_fast)(struct goodix_ts_core *cd, unsigned int addr,