#define LEVEL_TRIGGER_HIGH 0x3\r
#define EGIS_NAVI_INPUT 1 /* 1:open ; 0:close */\r
struct wake_lock et320_wake_lock;\r
-\r
+/*\r
+ * spinlock for protecting interrupt flag\r
+ */\r
+static DEFINE_SPINLOCK(interrupt_lock);\r
/*\r
* FPS interrupt table\r
*/\r
static irqreturn_t fp_eint_func_ll(int irq , void *dev_id)\r
{\r
pr_debug("etspi: fp_eint_func_ll\n");\r
+ spin_lock(&interrupt_lock);\r
fps_ints.finger_on = 1;\r
- /* fps_ints.int_count = 0; */\r
- disable_irq_nosync(gpio_irq);\r
- fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE;\r
+ if(fps_ints.drdy_irq_flag == DRDY_IRQ_DISABLE) {\r
+ DEBUG_PRINT("irq_flag is disabled\n");\r
+ } else {\r
+ /* fps_ints.int_count = 0; */\r
+ fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE;\r
+ disable_irq_nosync(gpio_irq);\r
+ }\r
+ spin_unlock(&interrupt_lock);\r
wake_up_interruptible(&interrupt_waitq);\r
/* printk_ratelimited(KERN_WARNING "----------- zq fp fp_eint_func ,fps_ints.int_count=%d",fps_ints.int_count);*/\r
wake_lock_timeout(&et320_wake_lock, msecs_to_jiffies(1500));\r
+\r
return IRQ_RETVAL(IRQ_HANDLED);\r
}\r
\r
int err = 0;\r
int status = 0;\r
static unsigned long jt;\r
+ unsigned long flags;\r
\r
pr_debug("etspi: -- %s mode = %d period = %d threshold = %d\n",\\r
__func__, int_mode, detect_period, detect_threshold);\r
fps_ints.detect_period = detect_period;\r
fps_ints.detect_threshold = detect_threshold;\r
fps_ints.int_count = 0;\r
- fps_ints.finger_on = 0;\r
+\r
\r
\r
if (request_irq_done == 0) {\r
DEBUG_PRINT("etspi:Interrupt_Init:gpio_to_irq return: %d\n", gpio_irq);\r
DEBUG_PRINT("etspi:Interrupt_Init:request_irq return: %d\n", err);\r
/* disable_irq_nosync(gpio_irq); */\r
+ spin_lock_irqsave(&interrupt_lock, flags);\r
fps_ints.drdy_irq_flag = DRDY_IRQ_ENABLE;\r
enable_irq_wake(gpio_irq);\r
request_irq_done = 1;\r
+ spin_unlock_irqrestore(&interrupt_lock, flags);\r
}\r
\r
\r
+ spin_lock_irqsave(&interrupt_lock, flags);\r
+ fps_ints.finger_on = 0;\r
if (fps_ints.drdy_irq_flag == DRDY_IRQ_DISABLE) {\r
fps_ints.drdy_irq_flag = DRDY_IRQ_ENABLE;\r
- enable_irq_wake(gpio_irq);\r
enable_irq(gpio_irq);\r
if (printk_timed_ratelimit(&jt, 500))\r
DEBUG_PRINT("etspi: Interrupt_Init: %s irq/done:%d %d mode:%d\\r
period:%d \threshold:%d \n", __func__, gpio_irq, request_irq_done,\\r
int_mode, detect_period, detect_threshold);\r
}\r
+ spin_unlock_irqrestore(&interrupt_lock, flags);\r
done:\r
return 0;\r
}\r
\r
int Interrupt_Free(struct etspi_data *etspi)\r
{\r
+ unsigned long flags;\r
pr_debug("etspi: %s\n", __func__);\r
+ spin_lock_irqsave(&interrupt_lock, flags);\r
fps_ints.finger_on = 0;\r
-\r
if (fps_ints.drdy_irq_flag == DRDY_IRQ_ENABLE) {\r
DEBUG_PRINT("etspi: %s (DISABLE IRQ)\n", __func__);\r
disable_irq_nosync(gpio_irq);\r
+ fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE;\r
+ spin_unlock_irqrestore(&interrupt_lock, flags);\r
/* disable_irq(gpio_irq); */\r
del_timer_sync(&fps_ints.timer);\r
- fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE;\r
+ } else {\r
+ spin_unlock_irqrestore(&interrupt_lock, flags);\r
}\r
return 0;\r
}\r
pr_err("%s platforminit failed\n", __func__);\r
goto etspi_probe_platformInit_failed;\r
}\r
-\r
+ //intialize irq flag to disable during probe\r
fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE;\r
\r
#ifdef ETSPI_NORMAL_MODE\r
}\r
etspi_reset(etspi);\r
\r
- fps_ints.drdy_irq_flag = DRDY_IRQ_DISABLE;\r
-\r
/* the timer is for ET310 */\r
setup_timer(&fps_ints.timer, interrupt_timer_routine, (unsigned long)&fps_ints);\r
add_timer(&fps_ints.timer);\r