static void rk28_matrix_scan(struct work_struct *work) { tcc_gpiokey_poll_callback(); if(!GPIOGetPinLevel(PLAY_ON_IOPIN)) { pwrScanTimes ++; if(pwrScanTimes == (NUMSEC*ONESEC)) {//surpport long press down input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,1); input_sync(gMatrixKey->input_dev); printk_d("keycode[%d] down\n",KEY_WAKEUP); endCallTimes = 100; } if(pwrScanTimes == ((NUMSEC+1)*ONESEC)) {//idendify 1s as long press input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,0); input_sync(gMatrixKey->input_dev); printk_d("keycode[%d] up\n",KEY_WAKEUP); endCallTimes = 100; pwrScanTimes = 0; } return ; } else { if(endCallTimes > 0) endCallTimes--;//delay for decrease jitter } if( pwrScanTimes > SLEEPTIME ) { pwrScanTimes = 0; if(rk2818_get_suspend_flags() != PM_AWAKE) { if(rk2818_get_suspend_flags() == PM_TWOLEVEL_SLEEP) { printk_d("Wake Up\n"); return; } if(endCallTimes == 0) { input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,1); input_sync(gMatrixKey->input_dev); input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,0); input_sync(gMatrixKey->input_dev); printk_d("system to be awake\n"); } } else { if(endCallTimes == 0) { input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,1); input_sync(gMatrixKey->input_dev); input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,0); input_sync(gMatrixKey->input_dev); printk_d("system to be sleep\n"); } } } }
static irqreturn_t rk28_playon_handler(s32 irq, void *dev_id) { if(rk2818_get_suspend_flags() == PM_TWOLEVEL_SLEEP) { rk28_send_wakeup_key(); } return IRQ_HANDLED; }
void rk28_send_rtc_wakeup_key( void ) { if(rk2818_get_suspend_flags() != PM_AWAKE ){ printk_d("\n"); rk2818_set_suspend_flags(PM_AWAKE); input_report_key(gMatrixKey->input_dev,KEY_RTC_WAKEUP,1); input_sync(gMatrixKey->input_dev); input_report_key(gMatrixKey->input_dev,KEY_RTC_WAKEUP,0); input_sync(gMatrixKey->input_dev); } }
void rk28_send_wakeup_key( void ) { if(rk2818_get_suspend_flags() != PM_AWAKE ){ rk2818_set_suspend_flags(PM_AWAKE); input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,1); input_sync(gMatrixKey->input_dev); printk_d("keycode[%d] down\n",KEY_WAKEUP); input_report_key(gMatrixKey->input_dev,KEY_WAKEUP,0); input_sync(gMatrixKey->input_dev); printk_d("keycode[%d] up\n",KEY_WAKEUP); } }
static enum hrtimer_restart xpt2046_dostimer(struct hrtimer *handle) { struct XPT2046_TS_EVENT *ts_dev = container_of(handle, struct XPT2046_TS_EVENT, timer); struct input_dev *xpt2046_ts_dev; int ts_io_pin_status; rk28printk("************>%s.....%s.....\n",__FILE__,__FUNCTION__); rk28printk("************>%s.....%s.....\n",__FILE__,__FUNCTION__); spin_lock_irq(&ts_dev->lock); ts_io_pin_status = GPIOGetPinLevel(PT2046_PENIRQ); rk28printk("************>%s....PE7status=%d\n",__FUNCTION__,ts_io_pin_status); rk28printk("--------<%s>--- ts_dev->pendown = %d, PE7status = %d \n", __FUNCTION__, ts_dev->pendown, ts_io_pin_status); if(unlikely(ts_dev->pendown && ts_io_pin_status)) { xpt2046_ts_dev = ts_dev->input; rk28printk("The touchscreen up!!\n"); //printk("-------------------------------------------The touchscreen up!!\n"); input_report_key(xpt2046_ts_dev,BTN_TOUCH,0); input_sync(xpt2046_ts_dev); ts_dev->pendown = 0; gpio_irq_enable(PT2046_PENIRQ); ClearBuff(); gLastZvalue[0] = 4095; gLastZvalue[1] = 4095; } else { /*still down ,continue with the measurement*/ xpt2046_read_values(ts_dev); xpt2046_send_values(ts_dev); } spin_unlock_irq(&ts_dev->lock); #ifdef CONFIG_ANDROID_POWER if(rk2818_get_suspend_flags() != PM_AWAKE) { rk28_send_wakeup_key(); printk("touch screen wake up\n"); } #endif return HRTIMER_NORESTART; }