tizen 2.3.1 release
[kernel/linux-3.0.git] / drivers / input / keyboard / gpio_keys.c
index 0e61019..9fd464a 100644 (file)
@@ -51,6 +51,9 @@ struct gpio_keys_drvdata {
        /* WARNING: this area can be expanded. Do NOT add any member! */
 };
 
+#if defined(CONFIG_MACH_GRANDE) || defined(CONFIG_MACH_IRON)
+extern int Is_folder_state(void);
+#endif
 /*
  * SYSFS interface for enabling/disabling keys and switches:
  *
@@ -270,6 +273,9 @@ ATTR_SHOW_FN(switches, EV_SW, false);
 ATTR_SHOW_FN(disabled_keys, EV_KEY, true);
 ATTR_SHOW_FN(disabled_switches, EV_SW, true);
 
+#ifdef CONFIG_SLP_WAKEUP_COUNT
+static int gpio_key_wakeup_irq;
+#endif
 /*
  * ATTRIBUTES:
  *
@@ -462,6 +468,15 @@ static void gpio_keys_report_event(struct gpio_button_data *bdata)
                if (state)
                        input_event(input, type, button->code, button->value);
        } else {
+
+#if defined(CONFIG_MACH_GRANDE) || defined(CONFIG_MACH_IRON)
+               if(Is_folder_state() && (button->code == KEY_END))
+               {
+                       printk(KERN_DEBUG"[keys] not report PWR %d : Folder is closed\n", !state);
+                       return;
+               }
+#endif
+
                if (bdata->wakeup && !state) {
                        input_event(input, type, button->code, !state);
                        if (button->code == KEY_POWER)
@@ -577,6 +592,9 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev,
        }
 
        irq = gpio_to_irq(button->gpio);
+#ifdef CONFIG_SLP_WAKEUP_COUNT
+       gpio_key_wakeup_irq = irq;
+#endif
        if (irq < 0) {
                error = irq;
                dev_err(dev, "Unable to get irq number for GPIO %d, error %d\n",
@@ -716,8 +734,11 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
        for (i = 0; i < pdata->nbuttons; i++)
                gpio_keys_report_event(&ddata->data[i]);
        input_sync(input);
-
+#ifdef CONFIG_SLP_WAKEUP_COUNT
+       device_init_wakeup_setirq(&pdev->dev, gpio_key_wakeup_irq);
+#else
        device_init_wakeup(&pdev->dev, wakeup);
+#endif
 
        return 0;