summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorJordan Nien <jnien@nvidia.com>2014-04-26 00:58:15 +0800
committerMandar Padmawar <mpadmawar@nvidia.com>2014-05-14 07:04:27 -0700
commitde37408eb2d47ff39bba5fc646a7f00902925d88 (patch)
tree5703fd60f22bd020e98f6f835a597d12d53d1b2d /drivers/input
parent73bf8f953fbae9258017c17d88437cc80b55883a (diff)
input: touch: raydium: update to 63.0
63.0 changelist: [1] fix protocol B issue. [2] improve light touch. [3] Improve pinch to zoom. [4] fix resolution problem. Change-Id: Ic88cfdc770beabce806e2a2996f78c8d8c63dfd7 Signed-off-by: Jordan Nien <jnien@nvidia.com> Reviewed-on: http://git-master/r/401600 (cherry picked from commit 32c161795216b0aacfa29b0c9ece4193f6bcf899) Reviewed-on: http://git-master/r/407526 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Alex Chen <alchen@nvidia.com> Tested-by: Alex Chen <alchen@nvidia.com> Reviewed-by: Robert Collins <rcollins@nvidia.com> Reviewed-by: Xiaohui Tao <xtao@nvidia.com> Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/rm31080a_ts.c318
1 files changed, 259 insertions, 59 deletions
diff --git a/drivers/input/touchscreen/rm31080a_ts.c b/drivers/input/touchscreen/rm31080a_ts.c
index c2a2f28f99b5..f3fd5d8fa8d1 100644
--- a/drivers/input/touchscreen/rm31080a_ts.c
+++ b/drivers/input/touchscreen/rm31080a_ts.c
@@ -54,6 +54,10 @@
#define CREATE_TRACE_POINTS
#include <trace/events/touchscreen_raydium.h>
+#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
+#include <linux/input/mt.h>
+#endif
+
/*=============================================================================
DEFINITIONS
=============================================================================*/
@@ -80,16 +84,16 @@
#define TCH_WAKE_LOCK_TIMEOUT (HZ/2)
-#ifdef ENABLE_SLOW_SCAN
-#define RM_SLOW_SCAN_INTERVAL 20
-#define RM_SLOW_SCAN_CMD_COUNT 0x10
-
#if ENABLE_FREQ_HOPPING /*ENABLE_SCAN_DATA_HEADER*/
-#define QUEUE_HEADER_NUM 8
-#define SCAN_TYPE_MT 1
+#define QUEUE_HEADER_NUM (8)
+#define SCAN_TYPE_MT (1)
#else
#define QUEUE_HEADER_NUM 0
#endif
+
+#ifdef ENABLE_SLOW_SCAN
+#define RM_SLOW_SCAN_INTERVAL 20
+#define RM_SLOW_SCAN_CMD_COUNT 0x10
enum RM_SLOW_SCAN_LEVELS {
RM_SLOW_SCAN_LEVEL_NORMAL,
RM_SLOW_SCAN_LEVEL_20,
@@ -109,6 +113,10 @@ enum RM_SLOW_SCAN_LEVELS {
#define TS_TIMER_PERIOD HZ
+#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
+#define MAX_SUPPORT_SLOT_AMOUNT MAX_REPORT_TOUCHED_POINTS
+#endif
+
/*#define CS_SUPPORT*/
#define MASK_USER_SPACE_POINTER 0x00000000FFFFFFFF /* 64-bit support */
@@ -140,6 +148,8 @@ struct rm31080a_ts_para {
u32 u32_slow_scan_level;
#endif
+ u8 u8_touchfile_check;
+
#ifdef ENABLE_SMOOTH_LEVEL
u32 u32_smooth_level;
#endif
@@ -160,7 +170,6 @@ struct rm31080a_ts_para {
struct wake_lock wakelock_initialization;
struct mutex mutex_scan_mode;
- struct mutex mutex_spi_rw;
struct mutex mutex_ns_mode;
struct workqueue_struct *rm_workqueue;
@@ -279,8 +288,6 @@ static int rm_tch_spi_read(u8 u8addr, u8 *rxbuf, size_t len)
return RETURN_OK;
}
- mutex_lock(&g_st_ts.mutex_spi_rw);
-
spi_message_init(&message);
memset(x, 0, sizeof(x));
@@ -296,8 +303,6 @@ static int rm_tch_spi_read(u8 u8addr, u8 *rxbuf, size_t len)
/*It returns zero on succcess,else a negative error code.*/
status = spi_sync(g_spi, &message);
- mutex_unlock(&g_st_ts.mutex_spi_rw);
-
if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER_REGISTER)
if (g_st_ts.b_init_finish == 0)
rm_printk("Raydium - READ: addr=0x%2x, value=0x%2x",
@@ -334,12 +339,8 @@ static int rm_tch_spi_write(u8 *txbuf, size_t len)
return RETURN_OK;
}
- mutex_lock(&g_st_ts.mutex_spi_rw);
-
status = spi_write(g_spi, txbuf, len);
- mutex_unlock(&g_st_ts.mutex_spi_rw);
-
if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER_REGISTER)
if (g_st_ts.b_init_finish == 0)
rm_printk("Raydium - WRITE: addr=0x%2x, value=0x%2x",
@@ -394,20 +395,24 @@ void raydium_change_scan_mode(u8 u8_touch_count)
u16_nt_count_thd = (u16)g_st_ctrl.u8_time2idle * 100;
if (u8_touch_count) {
+
u32_no_touch_count = 0;
return;
}
- mutex_lock(&g_st_ts.mutex_scan_mode);
- if (u32_no_touch_count < u16_nt_count_thd) {
+ if (u32_no_touch_count < u16_nt_count_thd)
u32_no_touch_count++;
- } else if (g_st_ts.u8_scan_mode_state == RM_SCAN_ACTIVE_MODE) {
- g_st_ts.u8_scan_mode_state = RM_SCAN_PRE_IDLE_MODE;
- u32_no_touch_count = 0;
+ else {
+ mutex_lock(&g_st_ts.mutex_scan_mode);
+ if (g_st_ts.u8_scan_mode_state == RM_SCAN_ACTIVE_MODE) {
+ g_st_ts.u8_scan_mode_state = RM_SCAN_PRE_IDLE_MODE;
+ u32_no_touch_count = 0;
+ }
+ mutex_unlock(&g_st_ts.mutex_scan_mode);
}
- mutex_unlock(&g_st_ts.mutex_scan_mode);
}
+#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_A)
void raydium_report_pointer(void *p)
{
static unsigned char u8_last_touch_count; /*= 0; remove by checkpatch*/
@@ -520,6 +525,146 @@ void raydium_report_pointer(void *p)
kfree(sp_tp);
}
+#else /*(INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)*/
+void raydium_report_pointer(void *p)
+{
+ static unsigned char u8_last_touch_count; /*= 0; remove by checkpatch*/
+ unsigned int target_abs_mt_tool = MT_TOOL_FINGER;
+ unsigned int target_key_evt_btn_tool = BTN_TOOL_FINGER;
+ int i;
+ int i_count;
+ int i_max_x, i_max_y;
+ struct rm_touch_event *sp_tp;
+ ssize_t missing;
+ sp_tp = kmalloc(sizeof(struct rm_touch_event), GFP_KERNEL);
+ if (sp_tp == NULL)
+ return;
+
+ missing = copy_from_user(sp_tp, p, sizeof(struct rm_touch_event));
+ if (missing) {
+ dev_err(&g_spi->dev, "Raydium - %s : copy failed - len:%d, miss:%d\n",
+ __func__, sizeof(struct rm_touch_event), missing);
+ kfree(sp_tp);
+ return;
+ }
+
+ if ((g_st_ctrl.u16_resolution_x != 0) &&
+ (g_st_ctrl.u16_resolution_y != 0)) {
+ i_max_x = g_st_ctrl.u16_resolution_x;
+ i_max_y = g_st_ctrl.u16_resolution_y;
+ } else {
+ i_max_x = RM_INPUT_RESOLUTION_X;
+ i_max_y = RM_INPUT_RESOLUTION_Y;
+ }
+
+ i_count = max(u8_last_touch_count, sp_tp->uc_touch_count);
+
+ if (!i_count) {
+ if (g_st_ctrl.u8_power_mode)
+ raydium_change_scan_mode(sp_tp->uc_touch_count);
+ kfree(sp_tp);
+ return;
+ }
+
+ for (i = 0; i < i_count; i++) {
+ if (i < sp_tp->uc_touch_count) {
+ switch (sp_tp->uc_tool_type[i]) {
+ case POINT_TYPE_FINGER:
+ if (i == MAX_SUPPORT_SLOT_AMOUNT)
+ break;
+ target_abs_mt_tool = MT_TOOL_FINGER;
+ break;
+ case POINT_TYPE_STYLUS:
+ if (i == MAX_SUPPORT_SLOT_AMOUNT)
+ break;
+ target_abs_mt_tool = MT_TOOL_PEN;
+ break;
+ case POINT_TYPE_ERASER:
+ if (i == MAX_SUPPORT_SLOT_AMOUNT)
+ break;
+ target_abs_mt_tool = MT_TOOL_PEN;
+ target_key_evt_btn_tool = BTN_TOOL_RUBBER;
+ break;
+ default:
+ dev_err(&g_spi->dev,
+ "Raydium - point %d is invalid input tool type: %d\n",
+ i, sp_tp->uc_tool_type[i]);
+ break;
+ }
+
+ input_mt_slot(g_input_dev,
+ sp_tp->uc_slot[i] & 0x7F);
+
+ if (sp_tp->uc_slot[i] & 0x80) {
+ input_mt_report_slot_state(
+ g_input_dev,
+ target_abs_mt_tool, false);
+
+ if (sp_tp->uc_tool_type[i] ==
+ POINT_TYPE_ERASER)
+ input_report_key(
+ g_input_dev,
+ target_key_evt_btn_tool, false);
+ }
+
+ if (sp_tp->uc_id[i] != 0xFF) {
+
+ input_mt_report_slot_state(
+ g_input_dev,
+ target_abs_mt_tool, true);
+
+ if (sp_tp->us_x[i] >= (i_max_x - 1))
+ input_report_abs(
+ g_input_dev,
+ ABS_MT_POSITION_X,
+ (i_max_x - 1));
+ else
+ input_report_abs(
+ g_input_dev,
+ ABS_MT_POSITION_X,
+ sp_tp->us_x[i]);
+
+ if (sp_tp->us_y[i] >= (i_max_y - 1))
+ input_report_abs(
+ g_input_dev,
+ ABS_MT_POSITION_Y,
+ (i_max_y - 1));
+ else
+ input_report_abs(
+ g_input_dev,
+ ABS_MT_POSITION_Y,
+ sp_tp->us_y[i]);
+
+ input_report_abs(
+ g_input_dev,
+ ABS_MT_PRESSURE,
+ sp_tp->us_z[i]);
+
+ if (sp_tp->uc_tool_type[i] == POINT_TYPE_ERASER)
+ input_report_key(
+ g_input_dev,
+ target_key_evt_btn_tool, true);
+ } else {
+ input_mt_report_slot_state(
+ g_input_dev,
+ target_abs_mt_tool, false);
+
+ if (sp_tp->uc_tool_type[i] == POINT_TYPE_ERASER)
+ input_report_key(
+ g_input_dev,
+ target_key_evt_btn_tool, false);
+ }
+ }
+ }
+ u8_last_touch_count = sp_tp->uc_touch_count;
+ input_sync(g_input_dev);
+
+ if (g_st_ctrl.u8_power_mode)
+ raydium_change_scan_mode(sp_tp->uc_touch_count);
+
+ kfree(sp_tp);
+}
+#endif
/*=============================================================================
Description: Read Sensor Raw Data
@@ -539,10 +684,10 @@ static int rm_tch_read_image_data(unsigned char *p)
g_pu8_burstread_buf[1] = (u8)(g_st_ctrl.u16_data_length >> 8);
g_pu8_burstread_buf[2] = (u8)(g_st_ctrl.u16_data_length);
g_pu8_burstread_buf[3] = g_st_ts.u8_ns_sel;
- /*g_pu8_burstread_buf[4] = 0x00;*/
- /*g_pu8_burstread_buf[5] = 0x00;*/
- /*g_pu8_burstread_buf[6] = 0x00;*/
- /*g_pu8_burstread_buf[7] = 0x00;*/
+ g_pu8_burstread_buf[4] = 0x00;
+ g_pu8_burstread_buf[5] = 0x00;
+ g_pu8_burstread_buf[6] = 0x00;
+ g_pu8_burstread_buf[7] = 0x00;
#endif
ret = rm_tch_cmd_process(0, g_st_rm_readimg_cmd, NULL);
@@ -602,8 +747,11 @@ void rm_tch_ctrl_leave_auto_mode(void)
g_st_ctrl.u8_idle_mode_check |= 0x01;
#if ENABLE_FREQ_HOPPING
- if (g_st_ctrl.u8_ns_func_enable&0x01)
+ if (g_st_ctrl.u8_ns_func_enable&0x01) {
+ mutex_lock(&g_st_ts.mutex_ns_mode);
rm_set_ns_para(0, (u8 *)&g_st_ts.u8_ns_para[0]);
+ mutex_unlock(&g_st_ts.mutex_ns_mode);
+ }
#endif
rm_tch_cmd_process(0, g_st_cmd_set_idle, NULL);
rm_set_repeat_times(g_st_ctrl.u8_active_digital_repeat_times);
@@ -944,7 +1092,8 @@ static int rm_tch_cmd_process(u8 u8_sel_case,
if (g_pu8_burstread_buf != NULL) {
ret = rm_tch_spi_read(p_cmd_tbl[_ADDR],
g_pu8_burstread_buf + QUEUE_HEADER_NUM,
- g_st_ctrl.u16_data_length - QUEUE_HEADER_NUM);
+ g_st_ctrl.u16_data_length
+ /* - QUEUE_HEADER_NUM*/);
}
g_pu8_burstread_buf = NULL;
break;
@@ -1268,7 +1417,9 @@ static void rm_tch_enter_manual_mode(void)
if (g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE) {
rm_tch_ctrl_leave_auto_mode();
g_st_ts.u8_scan_mode_state = RM_SCAN_ACTIVE_MODE;
+ mutex_unlock(&g_st_ts.mutex_scan_mode);
usleep_range(10000, 10050);/*msleep(10);*/
+ return;
}
mutex_unlock(&g_st_ts.mutex_scan_mode);
}
@@ -1332,14 +1483,11 @@ static int rm_tch_ts_send_signal(int pid, int i_info)
struct task_struct *t;
int ret = RETURN_OK;
- static DEFINE_MUTEX(lock);
-
if (!pid) {
dev_err(&g_spi->dev, "Raydium - %s : pid failed\n", __func__);
return RETURN_FAIL;
}
- mutex_lock(&lock);
/* send the signal */
memset(&info, 0, sizeof(struct siginfo));
info.si_signo = RM_TS_SIGNAL;
@@ -1358,7 +1506,6 @@ static int rm_tch_ts_send_signal(int pid, int i_info)
rcu_read_unlock();
if (t == NULL) {
dev_err(&g_spi->dev, "Raydium - %s : no such pid\n", __func__);
- mutex_unlock(&lock);
return RETURN_FAIL;
} else /*send the signal*/
ret = send_sig_info(RM_TS_SIGNAL, &info, t);
@@ -1367,7 +1514,6 @@ static int rm_tch_ts_send_signal(int pid, int i_info)
dev_err(&g_spi->dev, "Raydium - %s : send sig failed err:%d\n",
__func__, ret);
- mutex_unlock(&lock);
return ret;
}
@@ -1530,8 +1676,6 @@ static void rm_work_handler(struct work_struct *work)
|| g_worker_queue_is_flush)
return;
- mutex_lock(&g_st_ts.mutex_scan_mode);
-
i_ret = rm_tch_ctrl_clear_int();
u32_flag = rm_tch_ctrl_configure();
@@ -1547,7 +1691,6 @@ static void rm_work_handler(struct work_struct *work)
rm_tch_enqueue_finish();
}
}
- mutex_unlock(&g_st_ts.mutex_scan_mode);
if (u32_flag & RM_NEED_TO_SEND_SIGNAL) {
if (g_st_ts.b_calc_finish) {
@@ -1568,6 +1711,8 @@ static void rm_tch_init_ts_structure_part(void)
g_st_ts.b_enable_slow_scan = false;
#endif
g_st_ts.u8_scan_mode_state = RM_SCAN_ACTIVE_MODE;
+ g_st_ts.u8_touchfile_check = 0xFF;
+
g_st_ctrl.u8_event_report_mode = EVENT_REPORT_MODE_STYLUS_ERASER_FINGER;
g_pu8_burstread_buf = NULL;
@@ -1633,7 +1778,7 @@ static void rm_watchdog_work_function(unsigned char scan_mode)
if (g_st_ts.u8_watch_dog_flg) {
/*WATCH DOG RESET*/
- rm_printk("Raydium - WatchDog Resume\n");
+ /*rm_printk("Raydium - WatchDog Resume\n");*/
rm_tch_init_ts_structure_part();
g_st_ts.b_is_suspended = true;
rm_tch_cmd_process(0, g_st_rm_watchdog_cmd, NULL);
@@ -1666,14 +1811,14 @@ static void rm_timer_work_handler(struct work_struct *work)
if (g_timer_queue_is_flush == true)
return;
- mutex_lock(&g_st_ts.mutex_scan_mode);
if (rm_timer_trigger_function()) {
+ mutex_lock(&g_st_ts.mutex_scan_mode);
if (g_st_ts.u8_scan_mode_state != RM_SCAN_ACTIVE_MODE)
rm_watchdog_work_function(RM_SCAN_IDLE_MODE);
else
rm_watchdog_work_function(RM_SCAN_ACTIVE_MODE);
+ mutex_unlock(&g_st_ts.mutex_scan_mode);
}
- mutex_unlock(&g_st_ts.mutex_scan_mode);
if (g_st_ts.b_watch_dog_check == 1) {
rm_tch_ts_send_signal(g_st_ts.u32_hal_pid,
@@ -1773,16 +1918,18 @@ static ssize_t rm_tch_slowscan_handler(const char *buf, size_t count)
ret = (ssize_t) count;
- mutex_lock(&g_st_ts.mutex_scan_mode);
-
if (count == 2) {
if (buf[0] == '0') {
+ mutex_lock(&g_st_ts.mutex_scan_mode);
g_st_ts.b_enable_slow_scan = false;
rm_tch_ctrl_slowscan(RM_SLOW_SCAN_LEVEL_MAX);
+ mutex_unlock(&g_st_ts.mutex_scan_mode);
} else if (buf[0] == '1') {
+ mutex_lock(&g_st_ts.mutex_scan_mode);
g_st_ts.b_enable_slow_scan = true;
rm_tch_ctrl_slowscan(RM_SLOW_SCAN_LEVEL_60);
g_st_ts.u32_slow_scan_level = RM_SLOW_SCAN_LEVEL_60;
+ mutex_unlock(&g_st_ts.mutex_scan_mode);
}
} else if ((buf[0] == '2') && (buf[1] == ' ')) {
error = kstrtoul(&buf[2], 10, &val);
@@ -1790,14 +1937,14 @@ static ssize_t rm_tch_slowscan_handler(const char *buf, size_t count)
if (error) {
ret = error;
} else {
+ mutex_lock(&g_st_ts.mutex_scan_mode);
g_st_ts.b_enable_slow_scan = true;
g_st_ts.u32_slow_scan_level =
rm_tch_slowscan_round((u32)val);
rm_tch_ctrl_slowscan(g_st_ts.u32_slow_scan_level);
+ mutex_unlock(&g_st_ts.mutex_scan_mode);
}
}
-
- mutex_unlock(&g_st_ts.mutex_scan_mode);
return ret;
}
#endif
@@ -1826,6 +1973,21 @@ static ssize_t rm_tch_slowscan_store(struct device *dev,
#endif
}
+static ssize_t rm_tch_touchfile_check_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ return sprintf(buf, "Touch calibration file check status: 0x%x\n",
+ g_st_ts.u8_touchfile_check);
+}
+
+static ssize_t rm_tch_touchfile_check_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ return count;
+}
+
static void rm_tch_smooth_level_change(unsigned long val)
{
int i_info;
@@ -2150,6 +2312,11 @@ static DEVICE_ATTR(selftest_spi_burst_write, 0640,
static DEVICE_ATTR(slowscan_enable, 0640,
rm_tch_slowscan_show,
rm_tch_slowscan_store);
+
+static DEVICE_ATTR(touchfile_check, 0640,
+ rm_tch_touchfile_check_show,
+ rm_tch_touchfile_check_store);
+
static DEVICE_ATTR(smooth_level, 0640,
rm_tch_smooth_level_show,
rm_tch_smooth_level_store);
@@ -2169,6 +2336,7 @@ static DEVICE_ATTR(report_mode, 0640,
static struct attribute *rm_ts_attributes[] = {
&dev_attr_get_platform_id_gpio.attr,
&dev_attr_slowscan_enable.attr,
+ &dev_attr_touchfile_check.attr,
&dev_attr_selftest_enable.attr,
&dev_attr_selftest_spi_byte_read.attr,
&dev_attr_selftest_spi_byte_write.attr,
@@ -2208,12 +2376,9 @@ static irqreturn_t rm_tch_irq(int irq, void *handle)
trace_touchscreen_raydium_irq("Raydium_interrupt");
- mutex_lock(&g_st_ts.mutex_scan_mode);
-
if (g_st_ctrl.u8_power_mode &&
(g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE))
input_event(g_input_dev, EV_MSC, MSC_ACTIVITY, 1);
- mutex_unlock(&g_st_ts.mutex_scan_mode);
if (g_st_ts.b_init_finish && g_st_ts.b_is_suspended == false)
queue_work(g_st_ts.rm_workqueue, &g_st_ts.rm_work);
@@ -2276,12 +2441,10 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
/*rm_printk("Raydium - Repeat %d\n", arg);*/
g_st_ts.u8_repeat = (u8) arg;
#if ENABLE_FREQ_HOPPING
- if (g_st_ctrl.u8_ns_func_enable) {
- g_st_ts.u8_ns_rpt = (u8) arg;
- if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER)
- rm_printk("g_st_ctrl.u8_ns_rpt %d\n",
- g_st_ts.u8_ns_rpt);
- }
+ g_st_ts.u8_ns_rpt = (u8) arg;
+ if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER)
+ rm_printk("g_st_ctrl.u8_ns_rpt %d\n",
+ g_st_ts.u8_ns_rpt);
#endif
break;
case RM_VARIABLE_WATCHDOG_FLAG:
@@ -2313,13 +2476,13 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
(((u8 *)arg) + 3), 3);*/
/*missing += copy_from_user(&g_st_ts.bSWC[0],
(((u8 *)arg) + 6), 3);*/
+ mutex_unlock(&g_st_ts.mutex_ns_mode);
if (missing)
dev_err(&g_spi->dev, "Raydium - %s RM_VARIABLE_DPW : copy failed - miss:%d\n",
__func__, missing);
/*memcpy(&g_st_ts.bDP[0], ((u8 *)arg), 3);*/
/*memcpy(&g_st_ts.bSWCPW[0], (((u8 *)arg) + 3), 3);*/
/*memcpy(&g_st_ts.bSWC[0], (((u8 *)arg) + 6), 3);*/
- mutex_unlock(&g_st_ts.mutex_ns_mode);
if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER)
rm_printk("g_st_ctrl.DPW 0x%x:0x%x:0x%x # 0x%x:0x%x:0x%x,# 0x%x:0x%x:0x%x\n",
/*g_st_ts.bDP[0], g_st_ts.bDP[1],
@@ -2342,6 +2505,9 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
g_st_ts.u8_ns_mode);
break;
#endif
+ case RM_VARIABLE_TOUCHFILE_STATUS:
+ g_st_ts.u8_touchfile_check = (u8)(arg);
+ break;
default:
break;
}
@@ -2387,7 +2553,6 @@ static void rm_tch_init_ts_structure(void)
WAKE_LOCK_SUSPEND, "TouchInitialLock");
mutex_init(&g_st_ts.mutex_scan_mode);
- mutex_init(&g_st_ts.mutex_spi_rw);
mutex_init(&g_st_ts.mutex_ns_mode);
g_st_ts.u8_resume_cnt = 0;
@@ -2430,6 +2595,9 @@ static void rm_ctrl_resume(struct rm_tch_ts *ts)
static void rm_ctrl_suspend(struct rm_tch_ts *ts)
{
+#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
+ int i;
+#endif
if (g_st_ts.b_is_suspended == true)
return;
@@ -2442,7 +2610,23 @@ static void rm_ctrl_suspend(struct rm_tch_ts *ts)
rm_tch_ctrl_wait_for_scan_finish(0);
mutex_lock(&g_st_ts.mutex_scan_mode);
-
+#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
+ for (i = 0; i < MAX_SUPPORT_SLOT_AMOUNT; i++) {
+ input_mt_slot(g_input_dev, i);
+
+ input_mt_report_slot_state(
+ g_input_dev,
+ MT_TOOL_PEN, false);
+
+ input_report_key(
+ g_input_dev,
+ BTN_STYLUS2, false);
+ }
+ input_mt_report_pointer_emulation(
+ g_input_dev,
+ false);
+ input_sync(g_input_dev);
+#endif
rm_tch_cmd_process(0, g_st_rm_suspend_cmd, ts);
rm_tch_ctrl_wait_for_scan_finish(0);
@@ -2560,7 +2744,7 @@ void raydium_tlk_ns_touch_suspend(void)
rm_tch_enter_manual_mode();
mutex_lock(&g_st_ts.mutex_scan_mode);
- mutex_lock(&g_st_ts.mutex_spi_rw);
+ mutex_lock(&g_st_ts.mutex_ns_mode);
rm_tch_cmd_process(0, g_st_rm_tlk_cmd, ts);
}
EXPORT_SYMBOL(raydium_tlk_ns_touch_suspend);
@@ -2576,7 +2760,7 @@ void raydium_tlk_ns_touch_resume(void)
rm_tch_cmd_process(1, g_st_rm_tlk_cmd, ts);
mutex_unlock(&g_st_ts.mutex_scan_mode);
- mutex_unlock(&g_st_ts.mutex_spi_rw);
+ mutex_unlock(&g_st_ts.mutex_ns_mode);
}
EXPORT_SYMBOL(raydium_tlk_ns_touch_resume);
/*===========================================================================*/
@@ -2728,12 +2912,28 @@ struct rm_tch_ts *rm_tch_input_init(struct device *dev, unsigned int irq,
input_set_drvdata(input_dev, ts);
input_set_capability(input_dev, EV_MSC, MSC_ACTIVITY);
+#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_A)
__set_bit(EV_ABS, input_dev->evbit);
input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0xFF, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, 32, 0, 0);
__set_bit(EV_KEY, input_dev->evbit);
__set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
+#else
+ __set_bit(EV_ABS, input_dev->evbit);
+ input_set_abs_params(input_dev, ABS_MT_PRESSURE,
+ 0, 0xFF, 0, 0);
+
+ __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
+#ifdef INPUT_MT_DIRECT
+ input_mt_init_slots(input_dev,
+ MAX_SUPPORT_SLOT_AMOUNT,
+ 0);
+#else
+ input_mt_init_slots(input_dev,
+ MAX_SUPPORT_SLOT_AMOUNT);
+#endif
+#endif
input_set_abs_params(input_dev,
ABS_MT_TOOL_TYPE, 0,
MT_TOOL_MAX, 0, 0);
@@ -3012,7 +3212,7 @@ static int rm_tch_spi_remove(struct spi_device *spi)
wake_lock_destroy(&g_st_ts.wakelock_initialization);
mutex_destroy(&g_st_ts.mutex_scan_mode);
- mutex_destroy(&g_st_ts.mutex_spi_rw);
+ mutex_destroy(&g_st_ts.mutex_ns_mode);
sysfs_remove_group(&raydium_ts_miscdev.this_device->kobj,
&rm_ts_attr_group);
@@ -3212,12 +3412,12 @@ err_spi_speed:
if (g_st_ts.rm_workqueue)
destroy_workqueue(g_st_ts.rm_workqueue);
mutex_destroy(&g_st_ts.mutex_scan_mode);
- mutex_destroy(&g_st_ts.mutex_spi_rw);
+ mutex_destroy(&g_st_ts.mutex_ns_mode);
return ret;
}
static const struct of_device_id rm_ts_dt_match[] = {
- { .compatible = "raydium,rm_ts_spidev" },
+ { .compatible = "raydium, rm_ts_spidev" },
{ },
};
MODULE_DEVICE_TABLE(of, rm_ts_dt_match);