input: touchscreen: nova_0flash_mmi: Disable dt-gesture sensor when using dt2w control

Use KEY_WAKEUP when CONFIG_BOARD_USES_DOUBLE_TAP_CTRL is set and send
it through the touchscreen input device instead of the sensor so the
event actually reaches userspace.

Change-Id: I52884a2ec82f33ef3029419f24b07141e5756c70
This commit is contained in:
Michael Bestas 2025-04-08 05:13:23 +03:00
commit fa47f0433e
No known key found for this signature in database
2 changed files with 21 additions and 27 deletions

View file

@ -82,7 +82,7 @@ enum touch_state {
extern int nvt_mmi_init(struct nvt_ts_data *ts_data, bool enable);
#endif
#if defined (NVT_SENSOR_EN) || defined (CONFIG_INPUT_TOUCHSCREEN_MMI)
#if (defined(NVT_SENSOR_EN) || defined(CONFIG_INPUT_TOUCHSCREEN_MMI)) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
#ifdef CONFIG_HAS_WAKELOCK
static struct wake_lock gesture_wakelock;
#else
@ -90,7 +90,7 @@ static struct wakeup_source *gesture_wakelock;
#endif
#endif
#if defined (NVT_SENSOR_EN)
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
static struct sensors_classdev __maybe_unused sensors_touch_cdev = {
.name = "dt-gesture",
@ -267,7 +267,7 @@ const uint16_t gesture_key_array[] = {
KEY_POWER, //GESTURE_WORD_C
KEY_POWER, //GESTURE_WORD_W
KEY_POWER, //GESTURE_WORD_V
BTN_TRIGGER_HAPPY6, //GESTURE_DOUBLE_CLICK
KEY_WAKEUP, //GESTURE_DOUBLE_CLICK
KEY_POWER, //GESTURE_WORD_Z
KEY_POWER, //GESTURE_WORD_M
KEY_POWER, //GESTURE_WORD_O
@ -1154,7 +1154,7 @@ void nvt_ts_wakeup_gesture_report(uint8_t gesture_id, uint8_t *data)
uint32_t keycode = 0;
uint8_t func_type = data[2];
uint8_t func_id = data[3];
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
static int report_cnt = 0;
#endif
@ -1262,23 +1262,24 @@ void nvt_ts_wakeup_gesture_report(uint8_t gesture_id, uint8_t *data)
if (!ret)
PM_WAKEUP_EVENT(gesture_wakelock, 5000);
}
#elif NVT_SENSOR_EN
#elif defined(NVT_SENSOR_EN)
if (!(ts->wakeable && ts->should_enable_gesture)) {
NVT_LOG("Gesture got but wakeable not set. Skip this gesture.");
return;
}
if (ts->report_gesture_key) {
#ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL
input_report_key(ts->sensor_pdata->input_sensor_dev, keycode, 1);
input_sync(ts->sensor_pdata->input_sensor_dev);
input_report_key(ts->sensor_pdata->input_sensor_dev, keycode, 0);
input_sync(ts->sensor_pdata->input_sensor_dev);
if (ts->report_gesture_key) {
input_report_key(ts->input_dev, keycode, 1);
input_sync(ts->input_dev);
input_report_key(ts->input_dev, keycode, 0);
input_sync(ts->input_dev);
}
#else
if (ts->report_gesture_key) {
input_report_key(ts->sensor_pdata->input_sensor_dev, KEY_F1, 1);
input_sync(ts->sensor_pdata->input_sensor_dev);
input_report_key(ts->sensor_pdata->input_sensor_dev, KEY_F1, 0);
input_sync(ts->sensor_pdata->input_sensor_dev);
#endif
++report_cnt;
} else {
input_report_abs(ts->sensor_pdata->input_sensor_dev,
@ -1295,6 +1296,7 @@ void nvt_ts_wakeup_gesture_report(uint8_t gesture_id, uint8_t *data)
#else
PM_WAKEUP_EVENT(gesture_wakelock, 5000);
#endif
#endif
#else
input_report_key(ts->input_dev, keycode, 1);
input_sync(ts->input_dev);
@ -2211,13 +2213,10 @@ out:
return ret;
}
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
static int nvt_sensor_set_enable(struct sensors_classdev *sensors_cdev,
unsigned int enable)
{
#ifdef NVT_WAKEUP_GESTURE_CTRL
NVT_LOG("wakeup gesture ctrl, do nothing");
#else
NVT_LOG("Gesture set enable %d!", enable);
if (enable == 1) {
ts->should_enable_gesture = true;
@ -2226,7 +2225,6 @@ static int nvt_sensor_set_enable(struct sensors_classdev *sensors_cdev,
} else {
NVT_LOG("unknown enable symbol\n");
}
#endif
return 0;
}
@ -2251,11 +2249,6 @@ static int nvt_sensor_init(struct nvt_ts_data *data)
}
data->sensor_pdata = sensor_pdata;
#ifdef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL
__set_bit(EV_KEY, sensor_input_dev->evbit);
__set_bit(BTN_TRIGGER_HAPPY3, sensor_input_dev->keybit);
__set_bit(BTN_TRIGGER_HAPPY6, sensor_input_dev->keybit);
#else
if (data->report_gesture_key) {
__set_bit(EV_KEY, sensor_input_dev->evbit);
__set_bit(KEY_F1, sensor_input_dev->keybit);
@ -2264,7 +2257,6 @@ static int nvt_sensor_init(struct nvt_ts_data *data)
input_set_abs_params(sensor_input_dev, ABS_DISTANCE,
0, REPORT_MAX_COUNT, 0, 0);
}
#endif
__set_bit(EV_SYN, sensor_input_dev->evbit);
sensor_input_dev->name = "double-tap";
@ -2995,7 +2987,7 @@ static int32_t nvt_ts_probe(struct spi_device *client)
#if ((TOUCH_KEY_NUM > 0) || WAKEUP_GESTURE)
int32_t retry = 0;
#endif
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
static bool initialized_sensor;
#endif
#ifndef CONFIG_INPUT_TOUCHSCREEN_MMI
@ -3234,7 +3226,7 @@ static int32_t nvt_ts_probe(struct spi_device *client)
#if WAKEUP_GESTURE
device_init_wakeup(&ts->input_dev->dev, 1);
#endif
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
if (!initialized_sensor) {
#ifdef CONFIG_HAS_WAKELOCK
wake_lock_init(&gesture_wakelock, WAKE_LOCK_SUSPEND, "dt-wake-lock");
@ -3532,7 +3524,7 @@ err_register_charger_notify_failed:
err_charger_detection_alloc_failed:
err_charger_notify_wq_failed:
free_irq(client->irq, ts);
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
#ifndef CONFIG_HAS_WAKELOCK
err_wakeup_source_register_failed:
#endif

View file

@ -29,7 +29,7 @@
#include <linux/ktime.h>
#endif
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
#include <linux/sensors.h>
#endif
@ -162,7 +162,7 @@ extern const uint16_t gesture_key_array[];
extern struct delayed_work nvt_esd_check_work;
#endif
#ifdef NVT_SENSOR_EN
#if defined(NVT_SENSOR_EN) && !defined(CONFIG_BOARD_USES_DOUBLE_TAP_CTRL)
struct nvt_sensor_platform_data {
struct input_dev *input_sensor_dev;
struct sensors_classdev ps_cdev;
@ -245,8 +245,10 @@ struct nvt_ts_data {
#endif
#ifdef NVT_SENSOR_EN
bool should_enable_gesture;
#ifndef CONFIG_BOARD_USES_DOUBLE_TAP_CTRL
struct nvt_sensor_platform_data *sensor_pdata;
#endif
#endif
#ifdef PALM_GESTURE
bool palm_enabled;
#endif