input: touch: raydium: correct queueing of resumes
David Jung [Thu, 21 Feb 2013 23:46:09 +0000 (15:46 -0800)]
Raydium code drop. Queue a maximum of one resume.

Bug 1225919

Change-Id: I710ae7252bd207c6de53af719646426a9be36405
Signed-off-by: David Jung <djung@nvidia.com>
Reviewed-on: http://git-master/r/203084
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>

drivers/input/touchscreen/rm31080a_ts.c
include/linux/spi/rm31080a_ts.h

index e232c7f..3985d62 100644 (file)
@@ -1,8 +1,8 @@
 /*
  * Raydium RM31080 touchscreen driver
  *
- * Copyright (C) 2012 - 2013, Raydium Semiconductor Corporation.
- * Copyright (C) 2012 - 2013, NVIDIA Corporation, All Rights Reserved.
+ * Copyright (C) 2012-2013, Raydium Semiconductor Corporation.
+ * Copyright (C) 2012-2013, NVIDIA Corporation.  All Rights Reserved.
  *
  * This program is free software; you can redistribute  it and/or modify it
  * under  the terms of  the GNU General  Public License as published by the
@@ -38,6 +38,7 @@
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/touchscreen_raydium.h>
+
 /*=========================================================================*/
 /*DEFINITIONS */
 /*=========================================================================*/
@@ -104,11 +105,16 @@ struct rm31080a_ts_para {
        bool bEnableAutoScan;
        bool bIsSuspended;
 
+       bool bInitStartFlag;
+       bool bInitFailFlag;
+       bool bReissueSignalFlag;
+
        struct mutex mutex_scan_mode;
 #ifdef ENABLE_WORK_QUEUE
        struct workqueue_struct *rm_workqueue;
        struct work_struct rm_work;
 #endif
+
 #ifdef ENABLE_RAW_DATA_QUEUE
        u8 u8ScanModeState;
 #endif
@@ -693,13 +699,14 @@ void rm31080_ctrl_enter_auto_mode(void)
 {
        if (g_stCtrl.bICVersion == T007A6)
                rm31080_ts_send_signal(g_stTs.ulHalPID,
-                                      RM_SIGNAL_ENTER_AUTO_SCAN);
+                                               RM_SIGNAL_ENTER_AUTO_SCAN);
 
        /*Enable auto scan */
        if (g_stCtrl.bfIdleMessage)
                rm_printk("Enter Auto Scan Mode\n");
        /*Set idle*/
        rm_set_idle(1);
+
        if (g_stCtrl.bSTScan)
                rm_set_auto(1);
        else
@@ -715,6 +722,7 @@ void rm31080_ctrl_leave_auto_mode(void)
                rm_printk("Leave Auto Scan Mode\n");
        /*leave idle*/
        rm_set_idle(0);
+
        if (g_stCtrl.bSTScan)
                rm_set_auto(0);
        else
@@ -824,6 +832,9 @@ static int rm31080_ctrl_suspend(struct rm31080_ts *ts)
                        "raydium regulator 1.8V disable failed: %d\n",
                                error);
        }
+       printk(KERN_ALERT "Raydium Sending SUSPEND complete\n");
+       if (g_stTs.bInitStartFlag)
+               g_stTs.bInitFailFlag = 1;
        mutex_unlock(&g_stTs.mutex_scan_mode);
        return 1;
 }
@@ -1620,6 +1631,11 @@ static void rm31080_init_ts_structure(void)
        g_stTs.rm_workqueue = create_singlethread_workqueue("rm_work");
        INIT_WORK(&g_stTs.rm_work, rm_work_handler);
 #endif
+
+       g_stTs.bInitStartFlag = 0;
+       g_stTs.bInitFailFlag = 0;
+       g_stTs.bReissueSignalFlag = 0;
+
        mutex_init(&g_stTs.mutex_scan_mode);
 }
 
@@ -1781,7 +1797,17 @@ static void rm31080_start(struct rm31080_ts *ts)
        /* 7. delay */
        msleep(20);
        rm31080_init_ts_structure_part();
-       rm31080_ts_send_signal(g_stTs.ulHalPID, RM_SIGNAL_RESUME);
+
+       if (g_stTs.bInitStartFlag) {
+               if (!g_stTs.bReissueSignalFlag) {
+                       printk(KERN_ALERT "Raydium Re-Sending RESUME complete\n");
+                       rm31080_ts_send_signal(g_stTs.ulHalPID, RM_SIGNAL_RESUME);
+                       g_stTs.bReissueSignalFlag = 1;
+               }
+       } else {
+               printk(KERN_ALERT "Raydium Sending RESUME complete\n");
+               rm31080_ts_send_signal(g_stTs.ulHalPID, RM_SIGNAL_RESUME);
+       }
 #elif defined(ENABLE_AUTO_SCAN)
        rm31080_ctrl_clear_int();
        rm31080_ctrl_scan_start();
@@ -1899,6 +1925,7 @@ struct rm31080_ts *rm31080_input_init(struct device *dev, unsigned int irq,
        ts->irq = irq;
 
        pdata = dev->platform_data;
+
        if (pdata->name_of_clock || pdata->name_of_clock_con) {
                ts->clk = clk_get_sys(pdata->name_of_clock,
                        pdata->name_of_clock_con);
@@ -2072,11 +2099,19 @@ static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                break;
        case RM_IOCTL_INIT_START:
                g_stTs.bInitFinish = 0;
+               g_stTs.bInitStartFlag = 1;
+               printk(KERN_ALERT "Raydium Received RM_IOCTL_INIT_START.");
+               printk(KERN_ALERT " Touch not ready, ScanModeState = 0x%x\n",
+                       g_stTs.u8ScanModeState);
                rm31080_enter_manual_mode();
                break;
        case RM_IOCTL_INIT_END:
+               printk(KERN_ALERT "Raydium Received RM_IOCTL_INIT_END");
+               printk(KERN_ALERT " Touch ready.\n");
                g_stTs.bInitFinish = 1;
                g_stTs.bCalcFinish = 1;
+               g_stTs.bInitStartFlag = 0;
+               g_stTs.bReissueSignalFlag = 0;
 #ifdef ENABLE_RAW_DATA_QUEUE
                ret = rm31080_ctrl_scan_start();
 #endif
@@ -2123,6 +2158,10 @@ static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        case RM_IOCTL_GET_SACN_MODE:
                rm31080_ctrl_get_idle_mode((u8 *) arg);
                break;
+       case RM_IOCTL_CHECK_INIT_STATUS:
+               ret = g_stTs.bInitFailFlag;
+               g_stTs.bInitFailFlag = 0;
+               break;
 
        default:
                break;
index 42ee659..9a1364e 100644 (file)
@@ -1,3 +1,15 @@
+/*
+ * Raydium RM31080 touchscreen header
+ *
+ * Copyright (C) 2012-2013, Raydium Semiconductor Corporation.
+ * Copyright (C) 2012-2013, NVIDIA Corporation.  All Rights Reserved.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
 #ifndef _RM31080A_TS_H_
 #define _RM31080A_TS_H_
 
@@ -42,6 +54,7 @@
        #define RM_VARIABLE_PLATFORM_ID                 0x01
 #define RM_IOCTL_SET_SLOWSCAN_PARA                     0x1012
 #define RM_IOCTL_GET_SACN_MODE                         0x1013
+#define RM_IOCTL_CHECK_INIT_STATUS                     0x1014
 
 #define RM_INPUT_RESOLUTION_X                                  4096
 #define RM_INPUT_RESOLUTION_Y                                  4096