예제 #1
0
static void msm_gpio_irq_ack(unsigned int irq)
{
	gpio_clear_detect_status(irq - NR_MSM_IRQS);
}
예제 #2
0
int Q7x27_kybd_hookswitch_irqsetup(bool activate_irq)
{
	int rc = 0;
    bool  hook_sw_val;

	suspend_state_t SuspendState = PM_SUSPEND_ON;//FIH, KarenLiao, @20090731: [F0X.FC-41]: The action of Inserting headset is the wake up action.

	
    //printk(KERN_INFO "Q7x27_kybd_hookswitch_irqsetup \n"); 
    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Q7x27_kybd_hookswitch_irqsetup\n");

//+++ FIH, KarenLiao, @20090731: [F0X.FC-41]: The action of Inserting headset is the wake up action.
	SuspendState = get_suspend_state();
	if(SuspendState == PM_SUSPEND_MEM)//3
	{
		if(kpdev)
		{
			input_report_key(kpdev, KEY_RINGSWITCH, KBD_IN_KEYPRESS);
			//printk(KERN_INFO "FIH: keypress KEY_RINGSWITCH = %d\n", KEY_LEFTSHIFT);
			fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"FIH: keypress KEY_RINGSWITCH = %d\n",KEY_LEFTSHIFT);
			
			input_report_key(kpdev, KEY_RINGSWITCH, KBD_IN_KEYRELEASE);
			//printk(KERN_INFO "FIH: keyrelease KEY_RINGSWITCH = %d\n", KEY_LEFTSHIFT);
			fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"FIH: keyrelease KEY_RINGSWITCH = %d\n",KEY_LEFTSHIFT);
			input_sync(kpdev);
		}
	}
//--- FIH, KarenLiao, @20090731: [F0X.FC-41]: The action of Inserting headset is the wake up action.

	if (activate_irq && (gpio_get_value(rd->hook_sw_pin) == 1)) {

/* FIH, PeterKCTseng, @20090603 { */
/* clear pending interrupt        */
        gpio_clear_detect_status(rd->hook_sw_pin);
   	    hook_sw_val = (bool)gpio_get_value(rd->hook_sw_pin);
  	    //printk(KERN_INFO "Read back hook switch eky <%d>\n", hook_sw_val);
  	    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Read back hook switch key <%d>\n", hook_sw_val);
        mdelay(250);
/* } FIH, PeterKCTseng, @20090603 */

    	rc = request_irq(MSM_GPIO_TO_INT(rd->hook_sw_pin), &Q7x27_kybd_irqhandler,
			        (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING), 
			        Q7x27_kybd_name, rd);
	    if (rc < 0) {
    		//printk(KERN_ERR
		    //    "Could not register for  %s interrupt "
		    //    "(rc = %d)\n", Q7x27_kybd_name, rc);
		    fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Could not register for  %s interrupt(rc = %d) \n",Q7x27_kybd_name, rc);
		    rc = -EIO;
	    }
        fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Hook Switch IRQ Enable!\n");
        //printk(KERN_INFO "Hook Switch IRQ Enable! \n");
		rd->bHookSWIRQEnabled = true;
	} else {
		if (rd->bHookSWIRQEnabled)  {
			//printk(KERN_INFO "Free IRQ\n");
    		free_irq(MSM_GPIO_TO_INT(rd->hook_sw_pin), rd);
             fih_printk(Q7x27_kybd_debug_mask, FIH_DEBUG_ZONE_G0,"Hook Switch IRQ disable\n");
            //printk(KERN_INFO "Hook Switch IRQ disable! \n");
			rd->bHookSWIRQEnabled = false;
		}
	}
	
	return rc;

}