diff options
| -rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index c7764ca17b88..79435de0caa8 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
| @@ -803,6 +803,7 @@ static int gpio_keys_remove(struct platform_device *pdev) | |||
| 803 | static int gpio_keys_suspend(struct device *dev) | 803 | static int gpio_keys_suspend(struct device *dev) |
| 804 | { | 804 | { |
| 805 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); | 805 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); |
| 806 | struct input_dev *input = ddata->input; | ||
| 806 | int i; | 807 | int i; |
| 807 | 808 | ||
| 808 | if (device_may_wakeup(dev)) { | 809 | if (device_may_wakeup(dev)) { |
| @@ -811,6 +812,11 @@ static int gpio_keys_suspend(struct device *dev) | |||
| 811 | if (bdata->button->wakeup) | 812 | if (bdata->button->wakeup) |
| 812 | enable_irq_wake(bdata->irq); | 813 | enable_irq_wake(bdata->irq); |
| 813 | } | 814 | } |
| 815 | } else { | ||
| 816 | mutex_lock(&input->mutex); | ||
| 817 | if (input->users) | ||
| 818 | gpio_keys_close(input); | ||
| 819 | mutex_unlock(&input->mutex); | ||
| 814 | } | 820 | } |
| 815 | 821 | ||
| 816 | return 0; | 822 | return 0; |
| @@ -819,16 +825,27 @@ static int gpio_keys_suspend(struct device *dev) | |||
| 819 | static int gpio_keys_resume(struct device *dev) | 825 | static int gpio_keys_resume(struct device *dev) |
| 820 | { | 826 | { |
| 821 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); | 827 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); |
| 828 | struct input_dev *input = ddata->input; | ||
| 829 | int error = 0; | ||
| 822 | int i; | 830 | int i; |
| 823 | 831 | ||
| 824 | for (i = 0; i < ddata->pdata->nbuttons; i++) { | 832 | if (device_may_wakeup(dev)) { |
| 825 | struct gpio_button_data *bdata = &ddata->data[i]; | 833 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
| 826 | if (bdata->button->wakeup && device_may_wakeup(dev)) | 834 | struct gpio_button_data *bdata = &ddata->data[i]; |
| 827 | disable_irq_wake(bdata->irq); | 835 | if (bdata->button->wakeup) |
| 836 | disable_irq_wake(bdata->irq); | ||
| 837 | } | ||
| 838 | } else { | ||
| 839 | mutex_lock(&input->mutex); | ||
| 840 | if (input->users) | ||
| 841 | error = gpio_keys_open(input); | ||
| 842 | mutex_unlock(&input->mutex); | ||
| 828 | } | 843 | } |
| 829 | 844 | ||
| 830 | gpio_keys_report_state(ddata); | 845 | if (error) |
| 846 | return error; | ||
| 831 | 847 | ||
| 848 | gpio_keys_report_state(ddata); | ||
| 832 | return 0; | 849 | return 0; |
| 833 | } | 850 | } |
| 834 | #endif | 851 | #endif |
