mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
input: touchscreen: gt1x: support config gtp_ics_slot_report
Configure gtp_ics_slot_report in dts node will use slot report to report coordinate. QT use linuxfb backend can only receive touch reports in this way. Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com> Change-Id: I080d7752852e07bd8f93c86149af6021e2b0edbf
This commit is contained in:
@@ -19,9 +19,7 @@
|
||||
|
||||
#include <linux/irq.h>
|
||||
#include "gt1x.h"
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
#include <linux/input/mt.h>
|
||||
#endif
|
||||
|
||||
static struct work_struct gt1x_work;
|
||||
static struct input_dev *input_dev;
|
||||
@@ -165,28 +163,30 @@ void gt1x_touch_down(s32 x, s32 y, s32 size, s32 id)
|
||||
GTP_SWAP(x, y);
|
||||
#endif
|
||||
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
input_mt_slot(input_dev, id);
|
||||
input_report_abs(input_dev, ABS_MT_PRESSURE, size);
|
||||
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, size);
|
||||
input_report_abs(input_dev, ABS_MT_TRACKING_ID, id);
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
|
||||
#else
|
||||
input_report_key(input_dev, BTN_TOUCH, 1);
|
||||
if ((!size) && (!id)) {
|
||||
/* for virtual button */
|
||||
input_report_abs(input_dev, ABS_MT_PRESSURE, 100);
|
||||
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, 100);
|
||||
} else {
|
||||
if (gt1x_ics_slot_report) {
|
||||
input_mt_slot(input_dev, id);
|
||||
input_report_abs(input_dev, ABS_MT_PRESSURE, size);
|
||||
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, size);
|
||||
input_report_abs(input_dev, ABS_MT_TRACKING_ID, id);
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
|
||||
} else {
|
||||
input_report_key(input_dev, BTN_TOUCH, 1);
|
||||
|
||||
if ((!size) && (!id)) {
|
||||
/* for virtual button */
|
||||
input_report_abs(input_dev, ABS_MT_PRESSURE, 100);
|
||||
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, 100);
|
||||
} else {
|
||||
input_report_abs(input_dev, ABS_MT_PRESSURE, size);
|
||||
input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, size);
|
||||
input_report_abs(input_dev, ABS_MT_TRACKING_ID, id);
|
||||
}
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
|
||||
input_mt_sync(input_dev);
|
||||
|
||||
}
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
|
||||
input_mt_sync(input_dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,13 +196,13 @@ void gt1x_touch_down(s32 x, s32 y, s32 size, s32 id)
|
||||
*/
|
||||
void gt1x_touch_up(s32 id)
|
||||
{
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
input_mt_slot(input_dev, id);
|
||||
input_report_abs(input_dev, ABS_MT_TRACKING_ID, -1);
|
||||
#else
|
||||
input_report_key(input_dev, BTN_TOUCH, 0);
|
||||
input_mt_sync(input_dev);
|
||||
#endif
|
||||
if (gt1x_ics_slot_report) {
|
||||
input_mt_slot(input_dev, id);
|
||||
input_report_abs(input_dev, ABS_MT_TRACKING_ID, -1);
|
||||
} else {
|
||||
input_report_key(input_dev, BTN_TOUCH, 0);
|
||||
input_mt_sync(input_dev);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -333,6 +333,7 @@ static int gt1x_parse_dt(struct device *dev)
|
||||
return PTR_ERR(vdd_ana);
|
||||
}
|
||||
|
||||
gt1x_ics_slot_report = of_property_read_bool(dev->of_node, "gtp_ics_slot_report");
|
||||
#ifdef CONFIG_PM
|
||||
root = of_find_node_by_path("/");
|
||||
if (root) {
|
||||
@@ -458,15 +459,15 @@ static s8 gt1x_request_input_dev(void)
|
||||
}
|
||||
|
||||
input_dev->evbit[0] = BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
if (gt1x_ics_slot_report) {
|
||||
#if (LINUX_VERSION_CODE > KERNEL_VERSION(3, 7, 0))
|
||||
input_mt_init_slots(input_dev, 16, INPUT_MT_DIRECT);
|
||||
input_mt_init_slots(input_dev, 16, INPUT_MT_DIRECT);
|
||||
#else
|
||||
input_mt_init_slots(input_dev, 16);
|
||||
#endif
|
||||
#else
|
||||
input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
|
||||
input_mt_init_slots(input_dev, 16);
|
||||
#endif
|
||||
} else {
|
||||
input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
|
||||
}
|
||||
set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
|
||||
|
||||
#if GTP_HAVE_TOUCH_KEY
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include <linux/hwmsen_dev.h>
|
||||
#include <linux/sensors_io.h>
|
||||
#endif
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
#include <linux/input/mt.h>
|
||||
#endif
|
||||
|
||||
/*******************GLOBAL VARIABLE*********************/
|
||||
struct i2c_client *gt1x_i2c_client;
|
||||
@@ -73,6 +71,7 @@ u8 gt1x_int_type;
|
||||
u32 gt1x_abs_x_max;
|
||||
u32 gt1x_abs_y_max;
|
||||
int gt1x_halt;
|
||||
bool gt1x_ics_slot_report;
|
||||
|
||||
#if GTP_DEBUG_NODE
|
||||
static ssize_t gt1x_debug_read_proc(struct file *, char __user *, size_t, loff_t *);
|
||||
@@ -1278,23 +1277,22 @@ s32 gt1x_touch_event_handler(u8 *data, struct input_dev *dev, struct input_dev *
|
||||
}
|
||||
pre_index |= 0x01 << i;
|
||||
} else if (pre_index & (0x01 << i)) {
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
gt1x_touch_up(i);
|
||||
#endif
|
||||
if (gt1x_ics_slot_report)
|
||||
gt1x_touch_up(i);
|
||||
pre_index &= ~(0x01 << i);
|
||||
}
|
||||
}
|
||||
} else if (CHK_BIT(pre_event, BIT_TOUCH)) {
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
int cycles = pre_index < 3 ? 3 : GTP_MAX_TOUCH;
|
||||
for (i = 0; i < cycles; i++) {
|
||||
if (pre_index >> i & 0x01) {
|
||||
gt1x_touch_up(i);
|
||||
if (gt1x_ics_slot_report) {
|
||||
int cycles = pre_index < 3 ? 3 : GTP_MAX_TOUCH;
|
||||
|
||||
for (i = 0; i < cycles; i++) {
|
||||
if (pre_index >> i & 0x01)
|
||||
gt1x_touch_up(i);
|
||||
}
|
||||
} else {
|
||||
gt1x_touch_up(0);
|
||||
}
|
||||
#else
|
||||
gt1x_touch_up(0);
|
||||
#endif
|
||||
GTP_DEBUG("Released Touch.");
|
||||
pre_index = 0;
|
||||
}
|
||||
@@ -1367,40 +1365,40 @@ void gt1x_pen_down(s32 x, s32 y, s32 size, s32 id)
|
||||
GTP_SWAP(x, y);
|
||||
#endif
|
||||
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
input_mt_slot(pen_dev, id);
|
||||
input_report_abs(pen_dev, ABS_MT_PRESSURE, size);
|
||||
input_report_abs(pen_dev, ABS_MT_TOUCH_MAJOR, size);
|
||||
input_report_abs(pen_dev, ABS_MT_TRACKING_ID, id);
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_Y, y);
|
||||
#else
|
||||
input_report_key(pen_dev, BTN_TOUCH, 1);
|
||||
if ((!size) && (!id)) {
|
||||
/* for virtual button */
|
||||
input_report_abs(pen_dev, ABS_MT_PRESSURE, 100);
|
||||
input_report_abs(pen_dev, ABS_MT_TOUCH_MAJOR, 100);
|
||||
} else {
|
||||
if (gt1x_ics_slot_report) {
|
||||
input_mt_slot(pen_dev, id);
|
||||
input_report_abs(pen_dev, ABS_MT_PRESSURE, size);
|
||||
input_report_abs(pen_dev, ABS_MT_TOUCH_MAJOR, size);
|
||||
input_report_abs(pen_dev, ABS_MT_TRACKING_ID, id);
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_Y, y);
|
||||
} else {
|
||||
input_report_key(pen_dev, BTN_TOUCH, 1);
|
||||
if ((!size) && (!id)) {
|
||||
/* for virtual button */
|
||||
input_report_abs(pen_dev, ABS_MT_PRESSURE, 100);
|
||||
input_report_abs(pen_dev, ABS_MT_TOUCH_MAJOR, 100);
|
||||
} else {
|
||||
input_report_abs(pen_dev, ABS_MT_PRESSURE, size);
|
||||
input_report_abs(pen_dev, ABS_MT_TOUCH_MAJOR, size);
|
||||
input_report_abs(pen_dev, ABS_MT_TRACKING_ID, id);
|
||||
}
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_Y, y);
|
||||
input_mt_sync(pen_dev);
|
||||
}
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_X, x);
|
||||
input_report_abs(pen_dev, ABS_MT_POSITION_Y, y);
|
||||
input_mt_sync(pen_dev);
|
||||
#endif
|
||||
}
|
||||
|
||||
void gt1x_pen_up(s32 id)
|
||||
{
|
||||
input_report_key(pen_dev, BTN_TOOL_PEN, 0);
|
||||
#if GTP_ICS_SLOT_REPORT
|
||||
input_mt_slot(pen_dev, id);
|
||||
input_report_abs(pen_dev, ABS_MT_TRACKING_ID, -1);
|
||||
#else
|
||||
input_report_key(pen_dev, BTN_TOUCH, 0);
|
||||
input_mt_sync(pen_dev);
|
||||
#endif
|
||||
if (gt1x_ics_slot_report) {
|
||||
input_mt_slot(pen_dev, id);
|
||||
input_report_abs(pen_dev, ABS_MT_TRACKING_ID, -1);
|
||||
} else {
|
||||
input_report_key(pen_dev, BTN_TOUCH, 0);
|
||||
input_mt_sync(pen_dev);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@
|
||||
#define GTP_HAVE_STYLUS_KEY 0
|
||||
|
||||
#define GTP_POWER_CTRL_SLEEP 1 /* turn off power on suspend */
|
||||
#define GTP_ICS_SLOT_REPORT 0
|
||||
#define GTP_CREATE_WR_NODE 0 /* create the interface to support gtp_tools */
|
||||
#define GTP_DEBUG_NODE 0
|
||||
|
||||
@@ -534,6 +533,7 @@ extern s32 gt1x_i2c_write(u16 addr, u8 *buffer, s32 len);
|
||||
extern s32 gt1x_i2c_read(u16 addr, u8 *buffer, s32 len);
|
||||
extern s32 gt1x_i2c_read_dbl_check(u16 addr, u8 *buffer, s32 len);
|
||||
|
||||
extern bool gt1x_ics_slot_report;
|
||||
extern u8 gt1x_config[];
|
||||
extern u32 gt1x_cfg_length;
|
||||
extern u8 gt1x_int_type;
|
||||
|
||||
Reference in New Issue
Block a user