コード例 #1
0
static int s3c_keypad_resume(struct platform_device *pdev)
{
	struct s3c_keypad *s3c_keypad = platform_get_drvdata(pdev);
	struct s3c_keypad_extra *extra = s3c_keypad->extra;
	struct s3c_keypad_slide *slide = extra->slide;
	struct s3c_keypad_gpio_key *gpio_key = extra->gpio_key;
	struct input_dev *dev = s3c_keypad->dev;

	clk_enable(keypad_clock);

	if (is_timer_on)
		del_timer (&keypad_timer);
	is_timer_on = TRUE;
	prevmask_low = 0;
	prevmask_high = 0;
	s3c_keypad_isr (0, NULL);
	
	enable_irq(IRQ_KEYPAD);

	if (slide)
	{
		enable_irq(slide->eint);
		slide_int_handler (slide->eint, (void *) s3c_keypad);
	}
	printk("%s, extra_eint0pend: 0x%08x\n", __func__, extra_eint0pend);

    if(gpio_key) {
		enable_irq(gpio_key->eint);

		if(extra_eint0pend == 0x00000020) 
		{
			input_report_key(dev, gpio_key->keycode, 1);
	   	 	DPRINTK(": Pressed (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
        	dprintk(KPD_PRS, ": Pressed with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
//        	printk("[KPD_DBG] Pressed with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
	
//			printk("%s, gpio_key->gpio level: %d\n", __func__, gpio_get_value(gpio_key->gpio));
 			if(gpio_get_value(gpio_key->gpio)) 
			{
	   			input_report_key(dev, gpio_key->keycode, 0);
   				DPRINTK(": Released (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
   				dprintk(KPD_RLS, ": Released with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
//				printk("[KPD_DBG] Released with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
			}
		}
	}

#if 0
	if (gpio_key)
	{
		int i;
		for (i=0; i<extra->gpio_key_num; i++, gpio_key+=1)
		{
       		enable_irq(gpio_key->eint);
			gpio_int_handler (gpio_key->eint, (void *) s3c_keypad);
		}

	}
#endif


	writel(KEYIFCON_INIT, key_base+S3C_KEYIFCON);
	writel(KEYIFFC_DIV, key_base+S3C_KEYIFFC);

	s3c6410_pm_do_restore(s3c_keypad_save, ARRAY_SIZE(s3c_keypad_save));

	writel(KEYIFCOL_CLEAR, key_base+S3C_KEYIFCOL);

	return 0;
}
コード例 #2
0
static int s3c_keypad_resume(struct platform_device *pdev)
{
	struct s3c_keypad *s3c_keypad = platform_get_drvdata(pdev);
	struct s3c_keypad_extra *extra = s3c_keypad->extra;
	struct s3c_keypad_slide *slide = extra->slide;
	struct s3c_keypad_gpio_key *gpio_key = extra->gpio_key;
	struct input_dev *dev = s3c_keypad->dev;

	clk_enable(keypad_clock);

	prevmask_low = 0;
	prevmask_high = 0;
	s3c_keypad_isr (0, NULL);

	enable_irq(IRQ_KEYPAD);

#if defined (CONFIG_MACH_MAX)
       if(extra_eint0pend == 0x200000) // Headset wakeup event
       {
		input_report_key(dev, 249, 1); // Power Key press
   	 	DPRINTK(": Force Power Key press for headset\n");

		input_report_key(dev, 249, 0); // Power Key release
		DPRINTK(": Force Power Key release for headset\n");
       }

       if(keypad_wakeup)
       {
           printk("%s, extra_wakeup_stat: 0x%08x\n", __FUNCTION__, extra_wakeup_stat);

           // exception for H/W Key pressing bug
           if(extra_wakeup_stat == 0x00000010) // Keypad wakeup event
           {
    		input_report_key(dev, 249, 1); // Power Key press
       	 	DPRINTK(": Force Power Key press\n");

    		input_report_key(dev, 249, 0); // Power Key release
    		DPRINTK(": Force Power Key release\n");
           }
       }
#endif

#if !defined (CONFIG_MACH_MAX)
	printk("%s, slide (%u) (%d)\n", __func__, extra->slide, slide->eint);
#endif

	if (slide)
	{
		enable_irq(slide->eint);
		slide_int_handler (slide->eint, (void *) s3c_keypad);
	}
	printk("%s, extra_eint0pend: 0x%08x\n", __func__, extra_eint0pend);

    if(gpio_key) {
		enable_irq(gpio_key->eint);

		if(extra_eint0pend & 0x00000020)
		{
			input_report_key(dev, gpio_key->keycode, 1);
	   	 	DPRINTK(": Pressed (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
        	DPRINTK(": Pressed with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
//        	printk("[KPD_DBG] Pressed with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);

//			printk("%s, gpio_key->gpio level: %d\n", __func__, gpio_get_value(gpio_key->gpio));
 			if(gpio_get_value(gpio_key->gpio))
			{
	   			input_report_key(dev, gpio_key->keycode, 0);
   				DPRINTK(": Released (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
   				DPRINTK(": Released with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
//				printk("[KPD_DBG] Released with Resume (Keycode: %d, GPIO KEY)\n", gpio_key->keycode);
			}
		}
	}

#if 0
	if (gpio_key)
	{
		int i;
		for (i=0; i<extra->gpio_key_num; i++, gpio_key+=1)
		{
       		enable_irq(gpio_key->eint);
			gpio_int_handler (gpio_key->eint, (void *) s3c_keypad);
		}

	}
#endif


	writel(KEYIFCON_INIT, key_base+S3C_KEYIFCON);
	writel(KEYIFFC_DIV, key_base+S3C_KEYIFFC);

	s3c6410_pm_do_restore(s3c_keypad_save, ARRAY_SIZE(s3c_keypad_save));

	writel(KEYIFCOL_CLEAR, key_base+S3C_KEYIFCOL);

	return 0;
}