summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/rm31080a_ts.c
diff options
context:
space:
mode:
authorAlex Chen <alchen@nvidia.com>2014-07-03 03:32:43 -0400
committerDavid Pu <dpu@nvidia.com>2017-07-27 19:09:19 -0400
commit53926496b903cb4d10145bb6c628827dd3f1a9a5 (patch)
tree9273dee769569acd2cf948d0cf8faa8e3b1db8f6 /drivers/input/touchscreen/rm31080a_ts.c
parentfc9902b754722b12919a66b1fc160b0182f8f7e8 (diff)
input: touch: Raydium: v73.10 code drop
Bug 200004233 1. Raising service priority to avoid "service busy" issue while system fully loading 2. Test_mode function@driver (Change idle escape threshold at runtime) Usage: a. Disable: echo 0 > /sys/devices/virtual/misc/touch/test_mode b. Enable: echo 1 > /sys/devices/virtual/misc/touch/test_mode c. Set: echo 2 2 100 > /sys/devices/virtual/misc/touch/test_mode (take touch threshold 100 as example) d. Check: cat /sys/devices/virtual/misc/touch/test_mode 3. Coding style refine 4. Add mutex_lock/mutex_unlock protection in KRL_CMD_FLUSH_QU command table Change-Id: I0028e5c2f45d7b128b580e8d81d3dbe397ce6411 Signed-off-by: Alex Chen <alchen@nvidia.com> Reviewed-on: http://git-master/r/433991 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Robert Collins <rcollins@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Diffstat (limited to 'drivers/input/touchscreen/rm31080a_ts.c')
-rw-r--r--drivers/input/touchscreen/rm31080a_ts.c579
1 files changed, 501 insertions, 78 deletions
diff --git a/drivers/input/touchscreen/rm31080a_ts.c b/drivers/input/touchscreen/rm31080a_ts.c
index c2a2f28f9..41fc27abc 100644
--- a/drivers/input/touchscreen/rm31080a_ts.c
+++ b/drivers/input/touchscreen/rm31080a_ts.c
@@ -54,6 +54,10 @@
54#define CREATE_TRACE_POINTS 54#define CREATE_TRACE_POINTS
55#include <trace/events/touchscreen_raydium.h> 55#include <trace/events/touchscreen_raydium.h>
56 56
57#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
58#include <linux/input/mt.h>
59#endif
60
57/*============================================================================= 61/*=============================================================================
58 DEFINITIONS 62 DEFINITIONS
59=============================================================================*/ 63=============================================================================*/
@@ -80,16 +84,16 @@
80 84
81#define TCH_WAKE_LOCK_TIMEOUT (HZ/2) 85#define TCH_WAKE_LOCK_TIMEOUT (HZ/2)
82 86
83#ifdef ENABLE_SLOW_SCAN
84#define RM_SLOW_SCAN_INTERVAL 20
85#define RM_SLOW_SCAN_CMD_COUNT 0x10
86
87#if ENABLE_FREQ_HOPPING /*ENABLE_SCAN_DATA_HEADER*/ 87#if ENABLE_FREQ_HOPPING /*ENABLE_SCAN_DATA_HEADER*/
88#define QUEUE_HEADER_NUM 8 88#define QUEUE_HEADER_NUM (8)
89#define SCAN_TYPE_MT 1 89#define SCAN_TYPE_MT (1)
90#else 90#else
91#define QUEUE_HEADER_NUM 0 91#define QUEUE_HEADER_NUM 0
92#endif 92#endif
93
94#ifdef ENABLE_SLOW_SCAN
95#define RM_SLOW_SCAN_INTERVAL 20
96#define RM_SLOW_SCAN_CMD_COUNT 0x10
93enum RM_SLOW_SCAN_LEVELS { 97enum RM_SLOW_SCAN_LEVELS {
94 RM_SLOW_SCAN_LEVEL_NORMAL, 98 RM_SLOW_SCAN_LEVEL_NORMAL,
95 RM_SLOW_SCAN_LEVEL_20, 99 RM_SLOW_SCAN_LEVEL_20,
@@ -102,6 +106,14 @@ enum RM_SLOW_SCAN_LEVELS {
102}; 106};
103#endif 107#endif
104 108
109enum RM_TEST_MODE {
110 RM_TEST_MODE_NULL,
111 RM_TEST_MODE_IDLE_SHOW,
112 RM_TEST_MODE_IDLE_LEVEL,
113 RM_TEST_MODE_CALC_TIME_SHOW,
114 RM_TEST_MODE_MAX
115};
116
105#ifdef ENABLE_SMOOTH_LEVEL 117#ifdef ENABLE_SMOOTH_LEVEL
106#define RM_SMOOTH_LEVEL_NORMAL 0 118#define RM_SMOOTH_LEVEL_NORMAL 0
107#define RM_SMOOTH_LEVEL_MAX 4 119#define RM_SMOOTH_LEVEL_MAX 4
@@ -109,6 +121,10 @@ enum RM_SLOW_SCAN_LEVELS {
109 121
110#define TS_TIMER_PERIOD HZ 122#define TS_TIMER_PERIOD HZ
111 123
124#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
125#define MAX_SUPPORT_SLOT_AMOUNT MAX_REPORT_TOUCHED_POINTS
126#endif
127
112/*#define CS_SUPPORT*/ 128/*#define CS_SUPPORT*/
113#define MASK_USER_SPACE_POINTER 0x00000000FFFFFFFF /* 64-bit support */ 129#define MASK_USER_SPACE_POINTER 0x00000000FFFFFFFF /* 64-bit support */
114 130
@@ -140,6 +156,9 @@ struct rm31080a_ts_para {
140 u32 u32_slow_scan_level; 156 u32 u32_slow_scan_level;
141#endif 157#endif
142 158
159 u8 u8_touchfile_check;
160 u8 u8_stylus_status;
161
143#ifdef ENABLE_SMOOTH_LEVEL 162#ifdef ENABLE_SMOOTH_LEVEL
144 u32 u32_smooth_level; 163 u32 u32_smooth_level;
145#endif 164#endif
@@ -151,6 +170,8 @@ struct rm31080a_ts_para {
151 u8 u8_repeat; 170 u8 u8_repeat;
152 u16 u16_read_para; 171 u16 u16_read_para;
153 u8 u8_spi_locked; 172 u8 u8_spi_locked;
173 u8 u8_test_mode;
174 u8 u8_test_mode_type;
154#if ENABLE_FREQ_HOPPING 175#if ENABLE_FREQ_HOPPING
155 u8 u8_ns_para[9]; 176 u8 u8_ns_para[9];
156 u8 u8_ns_mode; 177 u8 u8_ns_mode;
@@ -160,7 +181,6 @@ struct rm31080a_ts_para {
160 struct wake_lock wakelock_initialization; 181 struct wake_lock wakelock_initialization;
161 182
162 struct mutex mutex_scan_mode; 183 struct mutex mutex_scan_mode;
163 struct mutex mutex_spi_rw;
164 struct mutex mutex_ns_mode; 184 struct mutex mutex_ns_mode;
165 185
166 struct workqueue_struct *rm_workqueue; 186 struct workqueue_struct *rm_workqueue;
@@ -210,6 +230,7 @@ struct rm_tch_queue_info g_st_q;
210 230
211bool g_timer_queue_is_flush; 231bool g_timer_queue_is_flush;
212bool g_worker_queue_is_flush; 232bool g_worker_queue_is_flush;
233
213unsigned char *g_pu8_burstread_buf; 234unsigned char *g_pu8_burstread_buf;
214 235
215unsigned char g_st_cmd_set_idle[KRL_SIZE_SET_IDLE]; 236unsigned char g_st_cmd_set_idle[KRL_SIZE_SET_IDLE];
@@ -227,6 +248,7 @@ unsigned char g_st_rm_set_rep_time_cmd[KRL_SIZE_RM_SETREPTIME];
227unsigned char g_st_rm_ns_para_cmd[KRL_SIZE_RM_NS_PARA]; 248unsigned char g_st_rm_ns_para_cmd[KRL_SIZE_RM_NS_PARA];
228unsigned char g_st_rm_writeimg_cmd[KRL_SIZE_RM_WRITE_IMAGE]; 249unsigned char g_st_rm_writeimg_cmd[KRL_SIZE_RM_WRITE_IMAGE];
229unsigned char g_st_rm_tlk_cmd[KRL_SIZE_RM_TLK]; 250unsigned char g_st_rm_tlk_cmd[KRL_SIZE_RM_TLK];
251unsigned char g_st_rm_kl_testmode_cmd[KRL_SIZE_RM_KL_TESTMODE];
230 252
231int g_service_busy_report_count; 253int g_service_busy_report_count;
232struct timer_list ts_timer_triggle; 254struct timer_list ts_timer_triggle;
@@ -237,6 +259,9 @@ static unsigned char g_spi_addr;
237bool b_bl_updated; 259bool b_bl_updated;
238u8 g_u8_update_baseline[RM_RAW_DATA_LENGTH]; 260u8 g_u8_update_baseline[RM_RAW_DATA_LENGTH];
239 261
262size_t g_u8_test_mode_count;
263char *g_u8_test_mode_buf;
264
240/*============================================================================= 265/*=============================================================================
241 FUNCTION DECLARATION 266 FUNCTION DECLARATION
242=============================================================================*/ 267=============================================================================*/
@@ -272,15 +297,13 @@ static int rm_tch_spi_read(u8 u8addr, u8 *rxbuf, size_t len)
272 297
273 if (g_st_ts.u8_spi_locked) { 298 if (g_st_ts.u8_spi_locked) {
274 memset(rxbuf, 0, len); 299 memset(rxbuf, 0, len);
275 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER_REGISTER) 300 if (g_st_ctrl.u8_kernel_msg & DEBUG_REGISTER)
276 rm_printk("Raydium - SPI Read Locked!! 0x%x:%d\n", 301 rm_printk("Raydium - SPI Read Locked!! 0x%x:%d\n",
277 u8addr, len); 302 u8addr, len);
278 /*return RETURN_FAIL;*/ 303 /*return RETURN_FAIL;*/
279 return RETURN_OK; 304 return RETURN_OK;
280 } 305 }
281 306
282 mutex_lock(&g_st_ts.mutex_spi_rw);
283
284 spi_message_init(&message); 307 spi_message_init(&message);
285 memset(x, 0, sizeof(x)); 308 memset(x, 0, sizeof(x));
286 309
@@ -296,9 +319,7 @@ static int rm_tch_spi_read(u8 u8addr, u8 *rxbuf, size_t len)
296 /*It returns zero on succcess,else a negative error code.*/ 319 /*It returns zero on succcess,else a negative error code.*/
297 status = spi_sync(g_spi, &message); 320 status = spi_sync(g_spi, &message);
298 321
299 mutex_unlock(&g_st_ts.mutex_spi_rw); 322 if (g_st_ctrl.u8_kernel_msg & DEBUG_REGISTER)
300
301 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER_REGISTER)
302 if (g_st_ts.b_init_finish == 0) 323 if (g_st_ts.b_init_finish == 0)
303 rm_printk("Raydium - READ: addr=0x%2x, value=0x%2x", 324 rm_printk("Raydium - READ: addr=0x%2x, value=0x%2x",
304 (u8addr&0x7F), rxbuf[0]); 325 (u8addr&0x7F), rxbuf[0]);
@@ -327,20 +348,16 @@ static int rm_tch_spi_write(u8 *txbuf, size_t len)
327 /*It returns zero on succcess,else a negative error code.*/ 348 /*It returns zero on succcess,else a negative error code.*/
328 349
329 if (g_st_ts.u8_spi_locked) { 350 if (g_st_ts.u8_spi_locked) {
330 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER_REGISTER) 351 if (g_st_ctrl.u8_kernel_msg & DEBUG_REGISTER)
331 rm_printk("Raydium - SPI write Locked!! 0x%x:0x%x\n", 352 rm_printk("Raydium - SPI write Locked!! 0x%x:0x%x\n",
332 txbuf[0], txbuf[1]); 353 txbuf[0], txbuf[1]);
333 /*return RETURN_FAIL;*/ 354 /*return RETURN_FAIL;*/
334 return RETURN_OK; 355 return RETURN_OK;
335 } 356 }
336 357
337 mutex_lock(&g_st_ts.mutex_spi_rw);
338
339 status = spi_write(g_spi, txbuf, len); 358 status = spi_write(g_spi, txbuf, len);
340 359
341 mutex_unlock(&g_st_ts.mutex_spi_rw); 360 if (g_st_ctrl.u8_kernel_msg & DEBUG_REGISTER)
342
343 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER_REGISTER)
344 if (g_st_ts.b_init_finish == 0) 361 if (g_st_ts.b_init_finish == 0)
345 rm_printk("Raydium - WRITE: addr=0x%2x, value=0x%2x", 362 rm_printk("Raydium - WRITE: addr=0x%2x, value=0x%2x",
346 txbuf[0], txbuf[1]); 363 txbuf[0], txbuf[1]);
@@ -398,16 +415,19 @@ void raydium_change_scan_mode(u8 u8_touch_count)
398 return; 415 return;
399 } 416 }
400 417
401 mutex_lock(&g_st_ts.mutex_scan_mode); 418 if (u32_no_touch_count < u16_nt_count_thd)
402 if (u32_no_touch_count < u16_nt_count_thd) {
403 u32_no_touch_count++; 419 u32_no_touch_count++;
404 } else if (g_st_ts.u8_scan_mode_state == RM_SCAN_ACTIVE_MODE) { 420 else {
405 g_st_ts.u8_scan_mode_state = RM_SCAN_PRE_IDLE_MODE; 421 mutex_lock(&g_st_ts.mutex_scan_mode);
406 u32_no_touch_count = 0; 422 if (g_st_ts.u8_scan_mode_state == RM_SCAN_ACTIVE_MODE) {
423 g_st_ts.u8_scan_mode_state = RM_SCAN_PRE_IDLE_MODE;
424 u32_no_touch_count = 0;
425 }
426 mutex_unlock(&g_st_ts.mutex_scan_mode);
407 } 427 }
408 mutex_unlock(&g_st_ts.mutex_scan_mode);
409} 428}
410 429
430#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_A)
411void raydium_report_pointer(void *p) 431void raydium_report_pointer(void *p)
412{ 432{
413 static unsigned char u8_last_touch_count; /*= 0; remove by checkpatch*/ 433 static unsigned char u8_last_touch_count; /*= 0; remove by checkpatch*/
@@ -515,11 +535,173 @@ void raydium_report_pointer(void *p)
515 u8_last_touch_count = sp_tp->uc_touch_count; 535 u8_last_touch_count = sp_tp->uc_touch_count;
516 } 536 }
517 537
518 if (g_st_ctrl.u8_power_mode) 538 /*if (g_st_ctrl.u8_power_mode)
519 raydium_change_scan_mode(sp_tp->uc_touch_count); 539 raydium_change_scan_mode(sp_tp->uc_touch_count); */
520 540
521 kfree(sp_tp); 541 kfree(sp_tp);
522} 542}
543#else /*(INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)*/
544void raydium_report_pointer(void *p)
545{
546 static unsigned char u8_last_touch_count; /*= 0; remove by checkpatch*/
547 unsigned int target_abs_mt_tool = MT_TOOL_FINGER;
548 unsigned int target_key_evt_btn_tool = BTN_TOOL_FINGER;
549 int i;
550 int i_count;
551 int i_max_x, i_max_y;
552 struct rm_touch_event *sp_tp;
553 ssize_t missing;
554 sp_tp = kmalloc(sizeof(struct rm_touch_event), GFP_KERNEL);
555 if (sp_tp == NULL)
556 return;
557
558 missing = copy_from_user(sp_tp, p, sizeof(struct rm_touch_event));
559 if (missing) {
560 dev_err(&g_spi->dev, "Raydium - %s : copy failed - len:%d, miss:%d\n",
561 __func__, sizeof(struct rm_touch_event), missing);
562 kfree(sp_tp);
563 return;
564 }
565
566 if ((g_st_ctrl.u16_resolution_x != 0) &&
567 (g_st_ctrl.u16_resolution_y != 0)) {
568 i_max_x = g_st_ctrl.u16_resolution_x;
569 i_max_y = g_st_ctrl.u16_resolution_y;
570 } else {
571 i_max_x = RM_INPUT_RESOLUTION_X;
572 i_max_y = RM_INPUT_RESOLUTION_Y;
573 }
574
575 i_count = max(u8_last_touch_count, sp_tp->uc_touch_count);
576
577 if (!i_count) {
578 /*if (g_st_ctrl.u8_power_mode)
579 raydium_change_scan_mode(sp_tp->uc_touch_count);*/
580 kfree(sp_tp);
581 return;
582 }
583
584 for (i = 0; i < i_count; i++) {
585 if (i < sp_tp->uc_touch_count) {
586
587 input_mt_slot(g_input_dev,
588 sp_tp->uc_slot[i] & 0x7F);
589
590 if ((sp_tp->uc_slot[i] & 0x80) ||
591 (sp_tp->uc_id[i] == 0xFF)) {
592 switch (sp_tp->uc_pre_tool_type[i]) {
593 case POINT_TYPE_FINGER:
594 if (i == MAX_SUPPORT_SLOT_AMOUNT)
595 break;
596 target_abs_mt_tool = MT_TOOL_FINGER;
597 break;
598 case POINT_TYPE_STYLUS:
599 if (i == MAX_SUPPORT_SLOT_AMOUNT)
600 break;
601 target_abs_mt_tool = MT_TOOL_PEN;
602 break;
603 case POINT_TYPE_ERASER:
604 if (i == MAX_SUPPORT_SLOT_AMOUNT)
605 break;
606 target_abs_mt_tool = MT_TOOL_PEN;
607 target_key_evt_btn_tool =
608 BTN_TOOL_RUBBER;
609 break;
610 default:
611 if (sp_tp->uc_id[i] != 0xFF) {
612 dev_err(&g_spi->dev,
613 "Raydium - point %d release invalid input tool type: %d, id=%d\n",
614 i, sp_tp->uc_pre_tool_type[i],
615 sp_tp->uc_id[i]);
616 }
617 break;
618 }
619
620 input_mt_report_slot_state(
621 g_input_dev,
622 target_abs_mt_tool, false);
623
624 if (sp_tp->uc_pre_tool_type[i] ==
625 POINT_TYPE_ERASER)
626 input_report_key(
627 g_input_dev,
628 target_key_evt_btn_tool, false);
629 }
630
631 if (sp_tp->uc_id[i] != 0xFF) {
632 switch (sp_tp->uc_tool_type[i]) {
633 case POINT_TYPE_FINGER:
634 if (i == MAX_SUPPORT_SLOT_AMOUNT)
635 break;
636 target_abs_mt_tool = MT_TOOL_FINGER;
637 break;
638 case POINT_TYPE_STYLUS:
639 if (i == MAX_SUPPORT_SLOT_AMOUNT)
640 break;
641 target_abs_mt_tool = MT_TOOL_PEN;
642 break;
643 case POINT_TYPE_ERASER:
644 if (i == MAX_SUPPORT_SLOT_AMOUNT)
645 break;
646 target_abs_mt_tool = MT_TOOL_PEN;
647 target_key_evt_btn_tool =
648 BTN_TOOL_RUBBER;
649 break;
650 default:
651 dev_err(&g_spi->dev,
652 "Raydium - point %d has invalid input tool type: %d, id=%d\n",
653 i, sp_tp->uc_tool_type[i],
654 sp_tp->uc_id[i]);
655 break;
656 }
657
658 input_mt_report_slot_state(
659 g_input_dev,
660 target_abs_mt_tool, true);
661
662 if (sp_tp->us_x[i] >= (i_max_x - 1))
663 input_report_abs(
664 g_input_dev,
665 ABS_MT_POSITION_X,
666 (i_max_x - 1));
667 else
668 input_report_abs(
669 g_input_dev,
670 ABS_MT_POSITION_X,
671 sp_tp->us_x[i]);
672
673 if (sp_tp->us_y[i] >= (i_max_y - 1))
674 input_report_abs(
675 g_input_dev,
676 ABS_MT_POSITION_Y,
677 (i_max_y - 1));
678 else
679 input_report_abs(
680 g_input_dev,
681 ABS_MT_POSITION_Y,
682 sp_tp->us_y[i]);
683
684 input_report_abs(
685 g_input_dev,
686 ABS_MT_PRESSURE,
687 sp_tp->us_z[i]);
688
689 if (sp_tp->uc_tool_type[i] == POINT_TYPE_ERASER)
690 input_report_key(
691 g_input_dev,
692 target_key_evt_btn_tool, true);
693 }
694 }
695 }
696 u8_last_touch_count = sp_tp->uc_touch_count;
697 input_sync(g_input_dev);
698
699 /*if (g_st_ctrl.u8_power_mode)
700 raydium_change_scan_mode(sp_tp->uc_touch_count);*/
701
702 kfree(sp_tp);
703}
704#endif
523 705
524/*============================================================================= 706/*=============================================================================
525 Description: Read Sensor Raw Data 707 Description: Read Sensor Raw Data
@@ -532,6 +714,7 @@ void raydium_report_pointer(void *p)
532static int rm_tch_read_image_data(unsigned char *p) 714static int rm_tch_read_image_data(unsigned char *p)
533{ 715{
534 int ret; 716 int ret;
717
535 g_pu8_burstread_buf = p; 718 g_pu8_burstread_buf = p;
536 719
537#if ENABLE_FREQ_HOPPING /*ENABLE_SCAN_DATA_HEADER*/ 720#if ENABLE_FREQ_HOPPING /*ENABLE_SCAN_DATA_HEADER*/
@@ -539,10 +722,10 @@ static int rm_tch_read_image_data(unsigned char *p)
539 g_pu8_burstread_buf[1] = (u8)(g_st_ctrl.u16_data_length >> 8); 722 g_pu8_burstread_buf[1] = (u8)(g_st_ctrl.u16_data_length >> 8);
540 g_pu8_burstread_buf[2] = (u8)(g_st_ctrl.u16_data_length); 723 g_pu8_burstread_buf[2] = (u8)(g_st_ctrl.u16_data_length);
541 g_pu8_burstread_buf[3] = g_st_ts.u8_ns_sel; 724 g_pu8_burstread_buf[3] = g_st_ts.u8_ns_sel;
542 /*g_pu8_burstread_buf[4] = 0x00;*/ 725 g_pu8_burstread_buf[4] = 0x00;
543 /*g_pu8_burstread_buf[5] = 0x00;*/ 726 g_pu8_burstread_buf[5] = 0x00;
544 /*g_pu8_burstread_buf[6] = 0x00;*/ 727 g_pu8_burstread_buf[6] = 0x00;
545 /*g_pu8_burstread_buf[7] = 0x00;*/ 728 g_pu8_burstread_buf[7] = 0x00;
546#endif 729#endif
547 730
548 ret = rm_tch_cmd_process(0, g_st_rm_readimg_cmd, NULL); 731 ret = rm_tch_cmd_process(0, g_st_rm_readimg_cmd, NULL);
@@ -573,6 +756,7 @@ void rm_set_ns_para(u8 u8Idx, u8 *u8Para)
573{ 756{
574 int ii; 757 int ii;
575 struct rm_tch_ts *ts = input_get_drvdata(g_input_dev); 758 struct rm_tch_ts *ts = input_get_drvdata(g_input_dev);
759
576 for (ii = 0; ii < g_st_rm_ns_para_cmd[2]; ii++) { 760 for (ii = 0; ii < g_st_rm_ns_para_cmd[2]; ii++) {
577 ts->u8_repeat_counter = u8Para[ii*3+u8Idx]; 761 ts->u8_repeat_counter = u8Para[ii*3+u8Idx];
578 rm_tch_cmd_process(ii, g_st_rm_ns_para_cmd, ts); 762 rm_tch_cmd_process(ii, g_st_rm_ns_para_cmd, ts);
@@ -599,13 +783,19 @@ void rm_tch_ctrl_enter_auto_mode(void)
599 783
600void rm_tch_ctrl_leave_auto_mode(void) 784void rm_tch_ctrl_leave_auto_mode(void)
601{ 785{
786 struct rm_tch_ts *ts = input_get_drvdata(g_input_dev);
787
602 g_st_ctrl.u8_idle_mode_check |= 0x01; 788 g_st_ctrl.u8_idle_mode_check |= 0x01;
603 789
604#if ENABLE_FREQ_HOPPING 790#if ENABLE_FREQ_HOPPING
605 if (g_st_ctrl.u8_ns_func_enable&0x01) 791 if (g_st_ctrl.u8_ns_func_enable&0x01) {
792 mutex_lock(&g_st_ts.mutex_ns_mode);
606 rm_set_ns_para(0, (u8 *)&g_st_ts.u8_ns_para[0]); 793 rm_set_ns_para(0, (u8 *)&g_st_ts.u8_ns_para[0]);
794 mutex_unlock(&g_st_ts.mutex_ns_mode);
795 }
607#endif 796#endif
608 rm_tch_cmd_process(0, g_st_cmd_set_idle, NULL); 797
798 rm_tch_cmd_process(0, g_st_cmd_set_idle, ts);
609 rm_set_repeat_times(g_st_ctrl.u8_active_digital_repeat_times); 799 rm_set_repeat_times(g_st_ctrl.u8_active_digital_repeat_times);
610 800
611 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER) 801 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER)
@@ -632,7 +822,7 @@ int rm_tch_ctrl_wait_for_scan_finish(u8 u8Idx)
632 822
633 if (g_st_ts.u16_read_para & 0x01) { 823 if (g_st_ts.u16_read_para & 0x01) {
634 if (u8Idx) 824 if (u8Idx)
635 return 1; 825 return 0;
636 else 826 else
637 usleep_range(1000, 2000); /* msleep(1); */ 827 usleep_range(1000, 2000); /* msleep(1); */
638 } else 828 } else
@@ -852,6 +1042,9 @@ void rm_show_kernel_tbl_name(u8 *p_cmd_tbl)
852 else if (p_cmd_tbl == g_st_rm_tlk_cmd) 1042 else if (p_cmd_tbl == g_st_rm_tlk_cmd)
853 snprintf(target_table_name, 1043 snprintf(target_table_name,
854 sizeof(target_table_name), "TLK"); 1044 sizeof(target_table_name), "TLK");
1045 else if (p_cmd_tbl == g_st_rm_kl_testmode_cmd)
1046 snprintf(target_table_name,
1047 sizeof(target_table_name), "Kernel_Test");
855 else { 1048 else {
856 dev_err(&g_spi->dev, "Raydium - %s : no such kernel table - err:%p\n", 1049 dev_err(&g_spi->dev, "Raydium - %s : no such kernel table - err:%p\n",
857 __func__, p_cmd_tbl); 1050 __func__, p_cmd_tbl);
@@ -859,6 +1052,7 @@ void rm_show_kernel_tbl_name(u8 *p_cmd_tbl)
859 dev_err(&g_spi->dev, "Raydium - Table %s cmd failed\n", 1052 dev_err(&g_spi->dev, "Raydium - Table %s cmd failed\n",
860 target_table_name); 1053 target_table_name);
861} 1054}
1055
862static int rm_tch_cmd_process(u8 u8_sel_case, 1056static int rm_tch_cmd_process(u8 u8_sel_case,
863 u8 *p_cmd_tbl, struct rm_tch_ts *ts) 1057 u8 *p_cmd_tbl, struct rm_tch_ts *ts)
864{ 1058{
@@ -944,7 +1138,8 @@ static int rm_tch_cmd_process(u8 u8_sel_case,
944 if (g_pu8_burstread_buf != NULL) { 1138 if (g_pu8_burstread_buf != NULL) {
945 ret = rm_tch_spi_read(p_cmd_tbl[_ADDR], 1139 ret = rm_tch_spi_read(p_cmd_tbl[_ADDR],
946 g_pu8_burstread_buf + QUEUE_HEADER_NUM, 1140 g_pu8_burstread_buf + QUEUE_HEADER_NUM,
947 g_st_ctrl.u16_data_length - QUEUE_HEADER_NUM); 1141 g_st_ctrl.u16_data_length
1142 /* - QUEUE_HEADER_NUM*/);
948 } 1143 }
949 g_pu8_burstread_buf = NULL; 1144 g_pu8_burstread_buf = NULL;
950 break; 1145 break;
@@ -1083,12 +1278,16 @@ static int rm_tch_cmd_process(u8 u8_sel_case,
1083 "- %d\n", p_cmd_tbl[_SUB_CMD]);*/ 1278 "- %d\n", p_cmd_tbl[_SUB_CMD]);*/
1084 ret = RETURN_OK; 1279 ret = RETURN_OK;
1085 if (p_cmd_tbl[_SUB_CMD] == KRL_SUB_CMD_SENSOR_QU) { 1280 if (p_cmd_tbl[_SUB_CMD] == KRL_SUB_CMD_SENSOR_QU) {
1281 mutex_unlock(&lock);
1086 flush_workqueue(g_st_ts.rm_workqueue); 1282 flush_workqueue(g_st_ts.rm_workqueue);
1087 g_worker_queue_is_flush = true; 1283 g_worker_queue_is_flush = true;
1284 mutex_lock(&lock);
1088 } else if (p_cmd_tbl[_SUB_CMD] == 1285 } else if (p_cmd_tbl[_SUB_CMD] ==
1089 KRL_SUB_CMD_TIMER_QU) { 1286 KRL_SUB_CMD_TIMER_QU) {
1287 mutex_unlock(&lock);
1090 flush_workqueue(g_st_ts.rm_timer_workqueue); 1288 flush_workqueue(g_st_ts.rm_timer_workqueue);
1091 g_timer_queue_is_flush = true; 1289 g_timer_queue_is_flush = true;
1290 mutex_lock(&lock);
1092 } else 1291 } else
1093 ret = RETURN_FAIL; 1292 ret = RETURN_FAIL;
1094 break; 1293 break;
@@ -1212,6 +1411,9 @@ int rm_set_kernel_tbl(int i_func_idx, u8 *p_u8_src)
1212 case KRL_INDEX_RM_TLK: 1411 case KRL_INDEX_RM_TLK:
1213 p_u8_dst = g_st_rm_tlk_cmd; 1412 p_u8_dst = g_st_rm_tlk_cmd;
1214 break; 1413 break;
1414 case KRL_INDEX_RM_KL_TESTMODE:
1415 p_u8_dst = g_st_rm_kl_testmode_cmd;
1416 break;
1215 default: 1417 default:
1216 dev_err(&g_spi->dev, "Raydium - %s : no such kernel table - err:%d\n", 1418 dev_err(&g_spi->dev, "Raydium - %s : no such kernel table - err:%d\n",
1217 __func__, i_func_idx); 1419 __func__, i_func_idx);
@@ -1268,8 +1470,11 @@ static void rm_tch_enter_manual_mode(void)
1268 if (g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE) { 1470 if (g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE) {
1269 rm_tch_ctrl_leave_auto_mode(); 1471 rm_tch_ctrl_leave_auto_mode();
1270 g_st_ts.u8_scan_mode_state = RM_SCAN_ACTIVE_MODE; 1472 g_st_ts.u8_scan_mode_state = RM_SCAN_ACTIVE_MODE;
1473 mutex_unlock(&g_st_ts.mutex_scan_mode);
1271 usleep_range(10000, 10050);/*msleep(10);*/ 1474 usleep_range(10000, 10050);/*msleep(10);*/
1475 return;
1272 } 1476 }
1477
1273 mutex_unlock(&g_st_ts.mutex_scan_mode); 1478 mutex_unlock(&g_st_ts.mutex_scan_mode);
1274} 1479}
1275 1480
@@ -1278,6 +1483,7 @@ static u32 rm_tch_get_platform_id(u8 *p)
1278 u32 u32Ret; 1483 u32 u32Ret;
1279 struct rm_spi_ts_platform_data *pdata; 1484 struct rm_spi_ts_platform_data *pdata;
1280 pdata = g_input_dev->dev.parent->platform_data; 1485 pdata = g_input_dev->dev.parent->platform_data;
1486
1281 u32Ret = copy_to_user(p, &pdata->platform_id, 1487 u32Ret = copy_to_user(p, &pdata->platform_id,
1282 sizeof(pdata->platform_id)); 1488 sizeof(pdata->platform_id));
1283 1489
@@ -1289,6 +1495,7 @@ static u32 rm_tch_get_gpio_sensor_select(u8 *p)
1289 u32 u32Ret = 0; 1495 u32 u32Ret = 0;
1290 struct rm_spi_ts_platform_data *pdata; 1496 struct rm_spi_ts_platform_data *pdata;
1291 pdata = g_input_dev->dev.parent->platform_data; 1497 pdata = g_input_dev->dev.parent->platform_data;
1498
1292/* Read from GPIO 1499/* Read from GPIO
1293 u32Ret = gpio_set_value(pdata->gpio_sensor_select0) 1500 u32Ret = gpio_set_value(pdata->gpio_sensor_select0)
1294 | (1 << gpio_set_value(pdata->gpio_sensor_select1)); 1501 | (1 << gpio_set_value(pdata->gpio_sensor_select1));
@@ -1332,14 +1539,11 @@ static int rm_tch_ts_send_signal(int pid, int i_info)
1332 struct task_struct *t; 1539 struct task_struct *t;
1333 int ret = RETURN_OK; 1540 int ret = RETURN_OK;
1334 1541
1335 static DEFINE_MUTEX(lock);
1336
1337 if (!pid) { 1542 if (!pid) {
1338 dev_err(&g_spi->dev, "Raydium - %s : pid failed\n", __func__); 1543 dev_err(&g_spi->dev, "Raydium - %s : pid failed\n", __func__);
1339 return RETURN_FAIL; 1544 return RETURN_FAIL;
1340 } 1545 }
1341 1546
1342 mutex_lock(&lock);
1343 /* send the signal */ 1547 /* send the signal */
1344 memset(&info, 0, sizeof(struct siginfo)); 1548 memset(&info, 0, sizeof(struct siginfo));
1345 info.si_signo = RM_TS_SIGNAL; 1549 info.si_signo = RM_TS_SIGNAL;
@@ -1358,7 +1562,6 @@ static int rm_tch_ts_send_signal(int pid, int i_info)
1358 rcu_read_unlock(); 1562 rcu_read_unlock();
1359 if (t == NULL) { 1563 if (t == NULL) {
1360 dev_err(&g_spi->dev, "Raydium - %s : no such pid\n", __func__); 1564 dev_err(&g_spi->dev, "Raydium - %s : no such pid\n", __func__);
1361 mutex_unlock(&lock);
1362 return RETURN_FAIL; 1565 return RETURN_FAIL;
1363 } else /*send the signal*/ 1566 } else /*send the signal*/
1364 ret = send_sig_info(RM_TS_SIGNAL, &info, t); 1567 ret = send_sig_info(RM_TS_SIGNAL, &info, t);
@@ -1367,7 +1570,6 @@ static int rm_tch_ts_send_signal(int pid, int i_info)
1367 dev_err(&g_spi->dev, "Raydium - %s : send sig failed err:%d\n", 1570 dev_err(&g_spi->dev, "Raydium - %s : send sig failed err:%d\n",
1368 __func__, ret); 1571 __func__, ret);
1369 1572
1370 mutex_unlock(&lock);
1371 return ret; 1573 return ret;
1372} 1574}
1373 1575
@@ -1518,6 +1720,7 @@ static long rm_tch_queue_read_raw_data(u8 *p, u32 u32Len)
1518 rm_tch_dequeue_finish(); 1720 rm_tch_dequeue_finish();
1519 return RETURN_OK; 1721 return RETURN_OK;
1520} 1722}
1723
1521/*===========================================================================*/ 1724/*===========================================================================*/
1522static void rm_work_handler(struct work_struct *work) 1725static void rm_work_handler(struct work_struct *work)
1523{ 1726{
@@ -1530,8 +1733,6 @@ static void rm_work_handler(struct work_struct *work)
1530 || g_worker_queue_is_flush) 1733 || g_worker_queue_is_flush)
1531 return; 1734 return;
1532 1735
1533 mutex_lock(&g_st_ts.mutex_scan_mode);
1534
1535 i_ret = rm_tch_ctrl_clear_int(); 1736 i_ret = rm_tch_ctrl_clear_int();
1536 1737
1537 u32_flag = rm_tch_ctrl_configure(); 1738 u32_flag = rm_tch_ctrl_configure();
@@ -1547,7 +1748,6 @@ static void rm_work_handler(struct work_struct *work)
1547 rm_tch_enqueue_finish(); 1748 rm_tch_enqueue_finish();
1548 } 1749 }
1549 } 1750 }
1550 mutex_unlock(&g_st_ts.mutex_scan_mode);
1551 1751
1552 if (u32_flag & RM_NEED_TO_SEND_SIGNAL) { 1752 if (u32_flag & RM_NEED_TO_SEND_SIGNAL) {
1553 if (g_st_ts.b_calc_finish) { 1753 if (g_st_ts.b_calc_finish) {
@@ -1568,6 +1768,7 @@ static void rm_tch_init_ts_structure_part(void)
1568 g_st_ts.b_enable_slow_scan = false; 1768 g_st_ts.b_enable_slow_scan = false;
1569#endif 1769#endif
1570 g_st_ts.u8_scan_mode_state = RM_SCAN_ACTIVE_MODE; 1770 g_st_ts.u8_scan_mode_state = RM_SCAN_ACTIVE_MODE;
1771
1571 g_st_ctrl.u8_event_report_mode = EVENT_REPORT_MODE_STYLUS_ERASER_FINGER; 1772 g_st_ctrl.u8_event_report_mode = EVENT_REPORT_MODE_STYLUS_ERASER_FINGER;
1572 1773
1573 g_pu8_burstread_buf = NULL; 1774 g_pu8_burstread_buf = NULL;
@@ -1576,7 +1777,9 @@ static void rm_tch_init_ts_structure_part(void)
1576 g_st_ts.u16_read_para = 0; 1777 g_st_ts.u16_read_para = 0;
1577 1778
1578 rm_ctrl_watchdog_func(0); 1779 rm_ctrl_watchdog_func(0);
1579 rm_tch_ctrl_init(); 1780
1781 /*g_st_ts.u8_test_mode = false;*/
1782 g_st_ts.u8_test_mode_type = RM_TEST_MODE_NULL;
1580 1783
1581 b_bl_updated = false; 1784 b_bl_updated = false;
1582} 1785}
@@ -1633,7 +1836,7 @@ static void rm_watchdog_work_function(unsigned char scan_mode)
1633 1836
1634 if (g_st_ts.u8_watch_dog_flg) { 1837 if (g_st_ts.u8_watch_dog_flg) {
1635 /*WATCH DOG RESET*/ 1838 /*WATCH DOG RESET*/
1636 rm_printk("Raydium - WatchDog Resume\n"); 1839 /*rm_printk("Raydium - WatchDog Resume\n");*/
1637 rm_tch_init_ts_structure_part(); 1840 rm_tch_init_ts_structure_part();
1638 g_st_ts.b_is_suspended = true; 1841 g_st_ts.b_is_suspended = true;
1639 rm_tch_cmd_process(0, g_st_rm_watchdog_cmd, NULL); 1842 rm_tch_cmd_process(0, g_st_rm_watchdog_cmd, NULL);
@@ -1666,14 +1869,14 @@ static void rm_timer_work_handler(struct work_struct *work)
1666 if (g_timer_queue_is_flush == true) 1869 if (g_timer_queue_is_flush == true)
1667 return; 1870 return;
1668 1871
1669 mutex_lock(&g_st_ts.mutex_scan_mode);
1670 if (rm_timer_trigger_function()) { 1872 if (rm_timer_trigger_function()) {
1873 mutex_lock(&g_st_ts.mutex_scan_mode);
1671 if (g_st_ts.u8_scan_mode_state != RM_SCAN_ACTIVE_MODE) 1874 if (g_st_ts.u8_scan_mode_state != RM_SCAN_ACTIVE_MODE)
1672 rm_watchdog_work_function(RM_SCAN_IDLE_MODE); 1875 rm_watchdog_work_function(RM_SCAN_IDLE_MODE);
1673 else 1876 else
1674 rm_watchdog_work_function(RM_SCAN_ACTIVE_MODE); 1877 rm_watchdog_work_function(RM_SCAN_ACTIVE_MODE);
1878 mutex_unlock(&g_st_ts.mutex_scan_mode);
1675 } 1879 }
1676 mutex_unlock(&g_st_ts.mutex_scan_mode);
1677 1880
1678 if (g_st_ts.b_watch_dog_check == 1) { 1881 if (g_st_ts.b_watch_dog_check == 1) {
1679 rm_tch_ts_send_signal(g_st_ts.u32_hal_pid, 1882 rm_tch_ts_send_signal(g_st_ts.u32_hal_pid,
@@ -1773,16 +1976,18 @@ static ssize_t rm_tch_slowscan_handler(const char *buf, size_t count)
1773 1976
1774 ret = (ssize_t) count; 1977 ret = (ssize_t) count;
1775 1978
1776 mutex_lock(&g_st_ts.mutex_scan_mode);
1777
1778 if (count == 2) { 1979 if (count == 2) {
1779 if (buf[0] == '0') { 1980 if (buf[0] == '0') {
1981 mutex_lock(&g_st_ts.mutex_scan_mode);
1780 g_st_ts.b_enable_slow_scan = false; 1982 g_st_ts.b_enable_slow_scan = false;
1781 rm_tch_ctrl_slowscan(RM_SLOW_SCAN_LEVEL_MAX); 1983 rm_tch_ctrl_slowscan(RM_SLOW_SCAN_LEVEL_MAX);
1984 mutex_unlock(&g_st_ts.mutex_scan_mode);
1782 } else if (buf[0] == '1') { 1985 } else if (buf[0] == '1') {
1986 mutex_lock(&g_st_ts.mutex_scan_mode);
1783 g_st_ts.b_enable_slow_scan = true; 1987 g_st_ts.b_enable_slow_scan = true;
1784 rm_tch_ctrl_slowscan(RM_SLOW_SCAN_LEVEL_60); 1988 rm_tch_ctrl_slowscan(RM_SLOW_SCAN_LEVEL_60);
1785 g_st_ts.u32_slow_scan_level = RM_SLOW_SCAN_LEVEL_60; 1989 g_st_ts.u32_slow_scan_level = RM_SLOW_SCAN_LEVEL_60;
1990 mutex_unlock(&g_st_ts.mutex_scan_mode);
1786 } 1991 }
1787 } else if ((buf[0] == '2') && (buf[1] == ' ')) { 1992 } else if ((buf[0] == '2') && (buf[1] == ' ')) {
1788 error = kstrtoul(&buf[2], 10, &val); 1993 error = kstrtoul(&buf[2], 10, &val);
@@ -1790,14 +1995,14 @@ static ssize_t rm_tch_slowscan_handler(const char *buf, size_t count)
1790 if (error) { 1995 if (error) {
1791 ret = error; 1996 ret = error;
1792 } else { 1997 } else {
1998 mutex_lock(&g_st_ts.mutex_scan_mode);
1793 g_st_ts.b_enable_slow_scan = true; 1999 g_st_ts.b_enable_slow_scan = true;
1794 g_st_ts.u32_slow_scan_level = 2000 g_st_ts.u32_slow_scan_level =
1795 rm_tch_slowscan_round((u32)val); 2001 rm_tch_slowscan_round((u32)val);
1796 rm_tch_ctrl_slowscan(g_st_ts.u32_slow_scan_level); 2002 rm_tch_ctrl_slowscan(g_st_ts.u32_slow_scan_level);
2003 mutex_unlock(&g_st_ts.mutex_scan_mode);
1797 } 2004 }
1798 } 2005 }
1799
1800 mutex_unlock(&g_st_ts.mutex_scan_mode);
1801 return ret; 2006 return ret;
1802} 2007}
1803#endif 2008#endif
@@ -1826,6 +2031,36 @@ static ssize_t rm_tch_slowscan_store(struct device *dev,
1826#endif 2031#endif
1827} 2032}
1828 2033
2034static ssize_t rm_tch_touchfile_check_show(struct device *dev,
2035 struct device_attribute *attr,
2036 char *buf)
2037{
2038 return sprintf(buf, "Touch calibration file check status: 0x%x\n",
2039 g_st_ts.u8_touchfile_check);
2040}
2041
2042static ssize_t rm_tch_touchfile_check_store(struct device *dev,
2043 struct device_attribute *attr,
2044 const char *buf, size_t count)
2045{
2046 return count;
2047}
2048
2049static ssize_t rm_tch_stylus_status_show(struct device *dev,
2050 struct device_attribute *attr,
2051 char *buf)
2052{
2053 return sprintf(buf, "0x%x\n",
2054 g_st_ts.u8_stylus_status);
2055}
2056
2057static ssize_t rm_tch_stylus_status_store(struct device *dev,
2058 struct device_attribute *attr,
2059 const char *buf, size_t count)
2060{
2061 return count;
2062}
2063
1829static void rm_tch_smooth_level_change(unsigned long val) 2064static void rm_tch_smooth_level_change(unsigned long val)
1830{ 2065{
1831 int i_info; 2066 int i_info;
@@ -1877,6 +2112,122 @@ static ssize_t rm_tch_smooth_level_store(struct device *dev,
1877 return count; 2112 return count;
1878} 2113}
1879 2114
2115void rm_set_kernel_test_para(u8 u8Idx, u8 u8Para)
2116{
2117 struct rm_tch_ts *ts = input_get_drvdata(g_input_dev);
2118
2119 ts->u8_repeat_counter = u8Para;
2120 rm_tch_cmd_process(u8Idx, g_st_rm_kl_testmode_cmd, ts);
2121}
2122
2123static ssize_t rm_tch_testmode_handler(const char *buf, size_t count)
2124{
2125 unsigned long val = 0;
2126 ssize_t error;
2127 ssize_t ret;
2128
2129 if (count < 2)
2130 return -EINVAL;
2131
2132 ret = (ssize_t) count;
2133
2134 if (count == 2) {
2135 if (buf[0] == '0') {
2136 g_st_ts.u8_test_mode = false;
2137 g_st_ts.u8_test_mode_type = RM_TEST_MODE_NULL;
2138 rm_set_kernel_test_para(0, g_st_ctrl.u8_idle_mode_thd);
2139 } else if (buf[0] == '1') {
2140 g_st_ts.u8_test_mode = true;
2141 g_st_ts.u8_test_mode_type = RM_TEST_MODE_IDLE_SHOW;
2142 }
2143 } else if ((buf[0] == '2') && (buf[1] == ' ')) {
2144 error = kstrtoul(&buf[2], 10, &val);
2145
2146 if (error) {
2147 if ((buf[2] == '2') && (buf[3] == ' ')) {
2148 g_st_ts.u8_test_mode = true;
2149 g_st_ts.u8_test_mode_type =
2150 RM_TEST_MODE_IDLE_LEVEL;
2151 error = kstrtoul(&buf[4], 10, &val);
2152 if (error) {
2153 g_st_ts.u8_test_mode = false;
2154 ret = error;
2155 } else {
2156 rm_set_kernel_test_para(0, val);
2157 }
2158 } else {
2159 g_st_ts.u8_test_mode = false;
2160 ret = error;
2161 }
2162 } else {
2163 g_st_ts.u8_test_mode = true;
2164 g_st_ts.u8_test_mode_type = 1 << ((u8)val - 1);
2165 switch (val) {
2166 case RM_TEST_MODE_IDLE_SHOW:
2167 if (g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE)
2168#if (ISR_POST_HANDLER == WORK_QUEUE)
2169 queue_work(g_st_ts.rm_workqueue,
2170 &g_st_ts.rm_work);
2171#elif (ISR_POST_HANDLER == KTHREAD)
2172 {
2173 if (waitqueue_active(&g_st_ts.rm_thread_wait_q)) {
2174 g_st_ts.b_thread_active = true;
2175 wake_up_interruptible(&g_st_ts.rm_thread_wait_q);
2176 } else {
2177 mutex_lock(&g_st_ts.mutex_irq_wait);
2178 g_st_ts.b_irq_is_waited = true;
2179 mutex_unlock(&g_st_ts.mutex_irq_wait);
2180 }
2181 }
2182#endif
2183 break;
2184 case RM_TEST_MODE_IDLE_LEVEL:
2185 if ((buf[2] == '2') && (buf[3] == ' ')) {
2186 error = kstrtoul(&buf[4], 0, &val);
2187 if (error) {
2188 g_st_ts.u8_test_mode = false;
2189 ret = error;
2190 } else {
2191 rm_set_kernel_test_para(0, val);
2192 }
2193 }
2194 break;
2195 case RM_TEST_MODE_CALC_TIME_SHOW:
2196 break;
2197 default:
2198 g_st_ts.u8_test_mode = false;
2199 g_st_ts.u8_test_mode_type = 0;
2200 break;
2201 }
2202 }
2203 }
2204 rm_printk("Raydium - rm_kernel_test_mode:%s,Type:%d,Para:%d",
2205 g_st_ts.u8_test_mode ?
2206 "Enabled" : "Disabled",
2207 g_st_ts.u8_test_mode_type, (u8)val);
2208 return ret;
2209}
2210
2211static ssize_t rm_tch_test_mode_show(struct device *dev,
2212 struct device_attribute *attr,
2213 char *buf)
2214{
2215 return sprintf(buf, "Test Mode:%s\nType:%d\n",
2216 g_st_ts.u8_test_mode ?
2217 "Enabled" : "Disabled",
2218 g_st_ts.u8_test_mode_type);
2219}
2220
2221static ssize_t rm_tch_test_mode_store(struct device *dev,
2222 struct device_attribute *attr,
2223 const char *buf, size_t count)
2224{
2225 g_u8_test_mode_count = count;
2226 memcpy(&g_u8_test_mode_buf, &buf, sizeof(buf));
2227
2228 return rm_tch_testmode_handler(buf, count);
2229}
2230
1880static ssize_t rm_tch_self_test_handler(struct rm_tch_ts *ts, 2231static ssize_t rm_tch_self_test_handler(struct rm_tch_ts *ts,
1881 const char *buf, size_t count) 2232 const char *buf, size_t count)
1882{ 2233{
@@ -1919,6 +2270,7 @@ static ssize_t selftest_platform_id_gpio_set(struct device *dev,
1919{ 2270{
1920 return count; 2271 return count;
1921} 2272}
2273
1922static ssize_t selftest_platform_id_gpio_get(struct device *dev, 2274static ssize_t selftest_platform_id_gpio_get(struct device *dev,
1923 struct device_attribute *attr, 2275 struct device_attribute *attr,
1924 char *buf) 2276 char *buf)
@@ -1926,13 +2278,14 @@ static ssize_t selftest_platform_id_gpio_get(struct device *dev,
1926 struct rm_spi_ts_platform_data *pdata; 2278 struct rm_spi_ts_platform_data *pdata;
1927 2279
1928 pdata = g_input_dev->dev.parent->platform_data; 2280 pdata = g_input_dev->dev.parent->platform_data;
2281
1929 buf[0] = (char)pdata->platform_id; 2282 buf[0] = (char)pdata->platform_id;
1930 2283
1931 /* Read from data struct */ 2284 /* Read from data struct */
1932 if (pdata->gpio_sensor_select0) 2285 if (pdata->gpio_sensor_select0)
1933 buf[1] = 0; 2286 buf[1] |= 0x01;
1934 if (pdata->gpio_sensor_select1) 2287 if (pdata->gpio_sensor_select1)
1935 buf[1] = 1; 2288 buf[1] |= 0x02;
1936 return 2; 2289 return 2;
1937} 2290}
1938 2291
@@ -2150,25 +2503,44 @@ static DEVICE_ATTR(selftest_spi_burst_write, 0640,
2150static DEVICE_ATTR(slowscan_enable, 0640, 2503static DEVICE_ATTR(slowscan_enable, 0640,
2151 rm_tch_slowscan_show, 2504 rm_tch_slowscan_show,
2152 rm_tch_slowscan_store); 2505 rm_tch_slowscan_store);
2506
2507static DEVICE_ATTR(touchfile_check, 0640,
2508 rm_tch_touchfile_check_show,
2509 rm_tch_touchfile_check_store);
2510
2511static DEVICE_ATTR(stylus_status, 0640,
2512 rm_tch_stylus_status_show,
2513 rm_tch_stylus_status_store);
2514
2153static DEVICE_ATTR(smooth_level, 0640, 2515static DEVICE_ATTR(smooth_level, 0640,
2154 rm_tch_smooth_level_show, 2516 rm_tch_smooth_level_show,
2155 rm_tch_smooth_level_store); 2517 rm_tch_smooth_level_store);
2518
2156static DEVICE_ATTR(self_test, 0640, 2519static DEVICE_ATTR(self_test, 0640,
2157 rm_tch_self_test_show, 2520 rm_tch_self_test_show,
2158 rm_tch_self_test_store); 2521 rm_tch_self_test_store);
2522
2159static DEVICE_ATTR(version, 0640, 2523static DEVICE_ATTR(version, 0640,
2160 rm_tch_version_show, 2524 rm_tch_version_show,
2161 rm_tch_version_store); 2525 rm_tch_version_store);
2526
2162static DEVICE_ATTR(module_detect, 0640, 2527static DEVICE_ATTR(module_detect, 0640,
2163 rm_tch_module_detect_show, 2528 rm_tch_module_detect_show,
2164 rm_tch_module_detect_store); 2529 rm_tch_module_detect_store);
2530
2165static DEVICE_ATTR(report_mode, 0640, 2531static DEVICE_ATTR(report_mode, 0640,
2166 rm_tch_report_mode_show, 2532 rm_tch_report_mode_show,
2167 rm_tch_report_mode_store); 2533 rm_tch_report_mode_store);
2168 2534
2535static DEVICE_ATTR(test_mode, 0640,
2536 rm_tch_test_mode_show,
2537 rm_tch_test_mode_store);
2538
2169static struct attribute *rm_ts_attributes[] = { 2539static struct attribute *rm_ts_attributes[] = {
2170 &dev_attr_get_platform_id_gpio.attr, 2540 &dev_attr_get_platform_id_gpio.attr,
2171 &dev_attr_slowscan_enable.attr, 2541 &dev_attr_slowscan_enable.attr,
2542 &dev_attr_touchfile_check.attr,
2543 &dev_attr_stylus_status.attr,
2172 &dev_attr_selftest_enable.attr, 2544 &dev_attr_selftest_enable.attr,
2173 &dev_attr_selftest_spi_byte_read.attr, 2545 &dev_attr_selftest_spi_byte_read.attr,
2174 &dev_attr_selftest_spi_byte_write.attr, 2546 &dev_attr_selftest_spi_byte_write.attr,
@@ -2179,6 +2551,7 @@ static struct attribute *rm_ts_attributes[] = {
2179 &dev_attr_version.attr, 2551 &dev_attr_version.attr,
2180 &dev_attr_module_detect.attr, 2552 &dev_attr_module_detect.attr,
2181 &dev_attr_report_mode.attr, 2553 &dev_attr_report_mode.attr,
2554 &dev_attr_test_mode.attr,
2182 NULL 2555 NULL
2183}; 2556};
2184 2557
@@ -2208,12 +2581,13 @@ static irqreturn_t rm_tch_irq(int irq, void *handle)
2208 2581
2209 trace_touchscreen_raydium_irq("Raydium_interrupt"); 2582 trace_touchscreen_raydium_irq("Raydium_interrupt");
2210 2583
2211 mutex_lock(&g_st_ts.mutex_scan_mode); 2584 if (/*g_st_ctrl.u8_power_mode &&*/
2212 2585 (g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE)) {
2213 if (g_st_ctrl.u8_power_mode &&
2214 (g_st_ts.u8_scan_mode_state == RM_SCAN_IDLE_MODE))
2215 input_event(g_input_dev, EV_MSC, MSC_ACTIVITY, 1); 2586 input_event(g_input_dev, EV_MSC, MSC_ACTIVITY, 1);
2216 mutex_unlock(&g_st_ts.mutex_scan_mode); 2587#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
2588 input_sync(g_input_dev);
2589#endif
2590 }
2217 2591
2218 if (g_st_ts.b_init_finish && g_st_ts.b_is_suspended == false) 2592 if (g_st_ts.b_init_finish && g_st_ts.b_is_suspended == false)
2219 queue_work(g_st_ts.rm_workqueue, &g_st_ts.rm_work); 2593 queue_work(g_st_ts.rm_workqueue, &g_st_ts.rm_work);
@@ -2256,7 +2630,12 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
2256 g_st_ts.b_enable_scriber = (bool) arg; 2630 g_st_ts.b_enable_scriber = (bool) arg;
2257 break; 2631 break;
2258 case RM_VARIABLE_AUTOSCAN_FLAG: 2632 case RM_VARIABLE_AUTOSCAN_FLAG:
2259 g_st_ctrl.u8_power_mode = (bool) arg; 2633 /*g_st_ctrl.u8_power_mode = (bool) arg;*/
2634 if (g_st_ts.u8_scan_mode_state == RM_SCAN_ACTIVE_MODE) {
2635 mutex_lock(&g_st_ts.mutex_scan_mode);
2636 g_st_ts.u8_scan_mode_state = RM_SCAN_PRE_IDLE_MODE;
2637 mutex_unlock(&g_st_ts.mutex_scan_mode);
2638 }
2260 break; 2639 break;
2261 case RM_VARIABLE_TEST_VERSION: 2640 case RM_VARIABLE_TEST_VERSION:
2262 g_st_ts.u8_test_version = (u8) arg; 2641 g_st_ts.u8_test_version = (u8) arg;
@@ -2276,12 +2655,10 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
2276 /*rm_printk("Raydium - Repeat %d\n", arg);*/ 2655 /*rm_printk("Raydium - Repeat %d\n", arg);*/
2277 g_st_ts.u8_repeat = (u8) arg; 2656 g_st_ts.u8_repeat = (u8) arg;
2278#if ENABLE_FREQ_HOPPING 2657#if ENABLE_FREQ_HOPPING
2279 if (g_st_ctrl.u8_ns_func_enable) { 2658 g_st_ts.u8_ns_rpt = (u8) arg;
2280 g_st_ts.u8_ns_rpt = (u8) arg; 2659 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER)
2281 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER) 2660 rm_printk("g_st_ctrl.u8_ns_rpt %d\n",
2282 rm_printk("g_st_ctrl.u8_ns_rpt %d\n", 2661 g_st_ts.u8_ns_rpt);
2283 g_st_ts.u8_ns_rpt);
2284 }
2285#endif 2662#endif
2286 break; 2663 break;
2287 case RM_VARIABLE_WATCHDOG_FLAG: 2664 case RM_VARIABLE_WATCHDOG_FLAG:
@@ -2313,13 +2690,13 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
2313 (((u8 *)arg) + 3), 3);*/ 2690 (((u8 *)arg) + 3), 3);*/
2314 /*missing += copy_from_user(&g_st_ts.bSWC[0], 2691 /*missing += copy_from_user(&g_st_ts.bSWC[0],
2315 (((u8 *)arg) + 6), 3);*/ 2692 (((u8 *)arg) + 6), 3);*/
2693 mutex_unlock(&g_st_ts.mutex_ns_mode);
2316 if (missing) 2694 if (missing)
2317 dev_err(&g_spi->dev, "Raydium - %s RM_VARIABLE_DPW : copy failed - miss:%d\n", 2695 dev_err(&g_spi->dev, "Raydium - %s RM_VARIABLE_DPW : copy failed - miss:%d\n",
2318 __func__, missing); 2696 __func__, missing);
2319 /*memcpy(&g_st_ts.bDP[0], ((u8 *)arg), 3);*/ 2697 /*memcpy(&g_st_ts.bDP[0], ((u8 *)arg), 3);*/
2320 /*memcpy(&g_st_ts.bSWCPW[0], (((u8 *)arg) + 3), 3);*/ 2698 /*memcpy(&g_st_ts.bSWCPW[0], (((u8 *)arg) + 3), 3);*/
2321 /*memcpy(&g_st_ts.bSWC[0], (((u8 *)arg) + 6), 3);*/ 2699 /*memcpy(&g_st_ts.bSWC[0], (((u8 *)arg) + 6), 3);*/
2322 mutex_unlock(&g_st_ts.mutex_ns_mode);
2323 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER) 2700 if (g_st_ctrl.u8_kernel_msg & DEBUG_DRIVER)
2324 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", 2701 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",
2325 /*g_st_ts.bDP[0], g_st_ts.bDP[1], 2702 /*g_st_ts.bDP[0], g_st_ts.bDP[1],
@@ -2342,11 +2719,20 @@ void rm_tch_set_variable(unsigned int index, unsigned int arg)
2342 g_st_ts.u8_ns_mode); 2719 g_st_ts.u8_ns_mode);
2343 break; 2720 break;
2344#endif 2721#endif
2722 case RM_VARIABLE_TOUCHFILE_STATUS:
2723 g_st_ts.u8_touchfile_check = (u8)(arg);
2724 break;
2725
2726 case RM_VARIABLE_STYLUS_STATUS:
2727 g_st_ts.u8_stylus_status = (u8)(arg);
2728 break;
2729
2345 default: 2730 default:
2346 break; 2731 break;
2347 } 2732 }
2348 2733
2349} 2734}
2735
2350static u32 rm_tch_get_variable(unsigned int index, u8 *arg) 2736static u32 rm_tch_get_variable(unsigned int index, u8 *arg)
2351{ 2737{
2352 u32 ret = RETURN_OK; 2738 u32 ret = RETURN_OK;
@@ -2387,10 +2773,13 @@ static void rm_tch_init_ts_structure(void)
2387 WAKE_LOCK_SUSPEND, "TouchInitialLock"); 2773 WAKE_LOCK_SUSPEND, "TouchInitialLock");
2388 2774
2389 mutex_init(&g_st_ts.mutex_scan_mode); 2775 mutex_init(&g_st_ts.mutex_scan_mode);
2390 mutex_init(&g_st_ts.mutex_spi_rw);
2391 mutex_init(&g_st_ts.mutex_ns_mode); 2776 mutex_init(&g_st_ts.mutex_ns_mode);
2392 2777
2393 g_st_ts.u8_resume_cnt = 0; 2778 g_st_ts.u8_resume_cnt = 0;
2779 g_st_ts.u8_touchfile_check = 0xFF;
2780 g_st_ts.u8_stylus_status = 0xFF;
2781 g_st_ts.u8_test_mode = false;
2782 rm_tch_ctrl_init();
2394} 2783}
2395 2784
2396static int rm31080_voltage_notifier_1v8(struct notifier_block *nb, 2785static int rm31080_voltage_notifier_1v8(struct notifier_block *nb,
@@ -2420,16 +2809,21 @@ static void rm_ctrl_resume(struct rm_tch_ts *ts)
2420 return; 2809 return;
2421 2810
2422 mutex_lock(&g_st_ts.mutex_scan_mode); 2811 mutex_lock(&g_st_ts.mutex_scan_mode);
2423
2424 rm_tch_init_ts_structure_part(); 2812 rm_tch_init_ts_structure_part();
2425 2813
2426 rm_tch_cmd_process(0, g_st_rm_resume_cmd, ts); 2814 rm_tch_cmd_process(0, g_st_rm_resume_cmd, ts);
2427
2428 mutex_unlock(&g_st_ts.mutex_scan_mode); 2815 mutex_unlock(&g_st_ts.mutex_scan_mode);
2816
2817 if (g_st_ts.u8_test_mode)
2818 rm_tch_testmode_handler(g_u8_test_mode_buf,
2819 g_u8_test_mode_count);
2429} 2820}
2430 2821
2431static void rm_ctrl_suspend(struct rm_tch_ts *ts) 2822static void rm_ctrl_suspend(struct rm_tch_ts *ts)
2432{ 2823{
2824#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
2825 int i;
2826#endif
2433 if (g_st_ts.b_is_suspended == true) 2827 if (g_st_ts.b_is_suspended == true)
2434 return; 2828 return;
2435 2829
@@ -2441,14 +2835,24 @@ static void rm_ctrl_suspend(struct rm_tch_ts *ts)
2441 2835
2442 rm_tch_ctrl_wait_for_scan_finish(0); 2836 rm_tch_ctrl_wait_for_scan_finish(0);
2443 2837
2444 mutex_lock(&g_st_ts.mutex_scan_mode); 2838#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_B)
2839 for (i = 0; i < MAX_SUPPORT_SLOT_AMOUNT; i++) {
2840 input_mt_slot(g_input_dev, i);
2445 2841
2446 rm_tch_cmd_process(0, g_st_rm_suspend_cmd, ts); 2842 input_mt_report_slot_state(
2843 g_input_dev,
2844 MT_TOOL_PEN, false);
2447 2845
2846 input_report_key(
2847 g_input_dev,
2848 BTN_STYLUS2, false);
2849 }
2850 input_sync(g_input_dev);
2851#endif
2852 mutex_lock(&g_st_ts.mutex_scan_mode);
2853 rm_tch_cmd_process(0, g_st_rm_suspend_cmd, ts);
2448 rm_tch_ctrl_wait_for_scan_finish(0); 2854 rm_tch_ctrl_wait_for_scan_finish(0);
2449
2450 rm_tch_cmd_process(1, g_st_rm_suspend_cmd, ts); 2855 rm_tch_cmd_process(1, g_st_rm_suspend_cmd, ts);
2451
2452 mutex_unlock(&g_st_ts.mutex_scan_mode); 2856 mutex_unlock(&g_st_ts.mutex_scan_mode);
2453} 2857}
2454 2858
@@ -2560,7 +2964,7 @@ void raydium_tlk_ns_touch_suspend(void)
2560 2964
2561 rm_tch_enter_manual_mode(); 2965 rm_tch_enter_manual_mode();
2562 mutex_lock(&g_st_ts.mutex_scan_mode); 2966 mutex_lock(&g_st_ts.mutex_scan_mode);
2563 mutex_lock(&g_st_ts.mutex_spi_rw); 2967 mutex_lock(&g_st_ts.mutex_ns_mode);
2564 rm_tch_cmd_process(0, g_st_rm_tlk_cmd, ts); 2968 rm_tch_cmd_process(0, g_st_rm_tlk_cmd, ts);
2565} 2969}
2566EXPORT_SYMBOL(raydium_tlk_ns_touch_suspend); 2970EXPORT_SYMBOL(raydium_tlk_ns_touch_suspend);
@@ -2576,7 +2980,7 @@ void raydium_tlk_ns_touch_resume(void)
2576 rm_tch_cmd_process(1, g_st_rm_tlk_cmd, ts); 2980 rm_tch_cmd_process(1, g_st_rm_tlk_cmd, ts);
2577 2981
2578 mutex_unlock(&g_st_ts.mutex_scan_mode); 2982 mutex_unlock(&g_st_ts.mutex_scan_mode);
2579 mutex_unlock(&g_st_ts.mutex_spi_rw); 2983 mutex_unlock(&g_st_ts.mutex_ns_mode);
2580} 2984}
2581EXPORT_SYMBOL(raydium_tlk_ns_touch_resume); 2985EXPORT_SYMBOL(raydium_tlk_ns_touch_resume);
2582/*===========================================================================*/ 2986/*===========================================================================*/
@@ -2631,10 +3035,12 @@ static struct rm_spi_ts_platform_data *rm_ts_parse_dt(struct device *dev,
2631 if (ret < 0) 3035 if (ret < 0)
2632 goto exit_release_all_gpio; 3036 goto exit_release_all_gpio;
2633 pdata->config = (unsigned char *)val; 3037 pdata->config = (unsigned char *)val;
3038
2634 ret = of_property_read_u32(np, "platform-id", &val); 3039 ret = of_property_read_u32(np, "platform-id", &val);
2635 if (ret < 0) 3040 if (ret < 0)
2636 goto exit_release_all_gpio; 3041 goto exit_release_all_gpio;
2637 pdata->platform_id = val; 3042 pdata->platform_id = val;
3043
2638 ret = of_property_read_string(np, "name-of-clock", &str); 3044 ret = of_property_read_string(np, "name-of-clock", &str);
2639 if (ret < 0) 3045 if (ret < 0)
2640 goto exit_release_all_gpio; 3046 goto exit_release_all_gpio;
@@ -2728,12 +3134,29 @@ struct rm_tch_ts *rm_tch_input_init(struct device *dev, unsigned int irq,
2728 input_set_drvdata(input_dev, ts); 3134 input_set_drvdata(input_dev, ts);
2729 input_set_capability(input_dev, EV_MSC, MSC_ACTIVITY); 3135 input_set_capability(input_dev, EV_MSC, MSC_ACTIVITY);
2730 3136
3137#if (INPUT_PROTOCOL_CURRENT_SUPPORT == INPUT_PROTOCOL_TYPE_A)
2731 __set_bit(EV_ABS, input_dev->evbit); 3138 __set_bit(EV_ABS, input_dev->evbit);
2732 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0xFF, 0, 0); 3139 input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0xFF, 0, 0);
2733 input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, 32, 0, 0); 3140 input_set_abs_params(input_dev, ABS_MT_TRACKING_ID, 0, 32, 0, 0);
2734 3141
2735 __set_bit(EV_KEY, input_dev->evbit); 3142 __set_bit(EV_KEY, input_dev->evbit);
2736 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); 3143 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
3144#else
3145 __set_bit(EV_KEY, input_dev->evbit);
3146 __set_bit(EV_ABS, input_dev->evbit);
3147 input_set_abs_params(input_dev, ABS_MT_PRESSURE,
3148 0, 0xFF, 0, 0);
3149
3150 __set_bit(BTN_TOOL_RUBBER, input_dev->keybit);
3151#ifdef INPUT_MT_DIRECT
3152 input_mt_init_slots(input_dev,
3153 MAX_SUPPORT_SLOT_AMOUNT,
3154 0);
3155#else
3156 input_mt_init_slots(input_dev,
3157 MAX_SUPPORT_SLOT_AMOUNT);
3158#endif
3159#endif
2737 input_set_abs_params(input_dev, 3160 input_set_abs_params(input_dev,
2738 ABS_MT_TOOL_TYPE, 0, 3161 ABS_MT_TOOL_TYPE, 0,
2739 MT_TOOL_MAX, 0, 0); 3162 MT_TOOL_MAX, 0, 0);
@@ -3012,7 +3435,7 @@ static int rm_tch_spi_remove(struct spi_device *spi)
3012 wake_lock_destroy(&g_st_ts.wakelock_initialization); 3435 wake_lock_destroy(&g_st_ts.wakelock_initialization);
3013 3436
3014 mutex_destroy(&g_st_ts.mutex_scan_mode); 3437 mutex_destroy(&g_st_ts.mutex_scan_mode);
3015 mutex_destroy(&g_st_ts.mutex_spi_rw); 3438 mutex_destroy(&g_st_ts.mutex_ns_mode);
3016 3439
3017 sysfs_remove_group(&raydium_ts_miscdev.this_device->kobj, 3440 sysfs_remove_group(&raydium_ts_miscdev.this_device->kobj,
3018 &rm_ts_attr_group); 3441 &rm_ts_attr_group);
@@ -3212,12 +3635,12 @@ err_spi_speed:
3212 if (g_st_ts.rm_workqueue) 3635 if (g_st_ts.rm_workqueue)
3213 destroy_workqueue(g_st_ts.rm_workqueue); 3636 destroy_workqueue(g_st_ts.rm_workqueue);
3214 mutex_destroy(&g_st_ts.mutex_scan_mode); 3637 mutex_destroy(&g_st_ts.mutex_scan_mode);
3215 mutex_destroy(&g_st_ts.mutex_spi_rw); 3638 mutex_destroy(&g_st_ts.mutex_ns_mode);
3216 return ret; 3639 return ret;
3217} 3640}
3218 3641
3219static const struct of_device_id rm_ts_dt_match[] = { 3642static const struct of_device_id rm_ts_dt_match[] = {
3220 { .compatible = "raydium,rm_ts_spidev" }, 3643 { .compatible = "raydium, rm_ts_spidev" },
3221 { }, 3644 { },
3222}; 3645};
3223MODULE_DEVICE_TABLE(of, rm_ts_dt_match); 3646MODULE_DEVICE_TABLE(of, rm_ts_dt_match);