diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2012-02-14 07:46:49 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-02-15 09:35:27 +0100 |
commit | 6a68a80e23d03e3da031ea93cfab44d73053f349 (patch) | |
tree | 02c3dc107dc80f5c37a68b41de93dcb79baad776 | |
parent | 0f1eec91f8edb3d516f3449018e0aa145a3fe7c1 (diff) |
input: gpio-keys: Disable hw on suspend
Disable hw if active when suspending if the hw can't wake
the system from suspend.
ST-Ericsson Linux next: -
ST-Ericsson ID: -
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: Ieaf2a2022b23782bc19afa152dc5e3fa5a0024ad
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32721
Reviewed-by: Bengt JONSSON <bengt.g.jonsson@stericsson.com>
-rw-r--r-- | drivers/input/keyboard/gpio_keys.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index ed1ed469d08..523ef6cd03c 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -42,6 +42,8 @@ struct gpio_keys_drvdata { struct input_dev *input; struct mutex disable_lock; unsigned int n_buttons; + bool enabled; + bool enable_after_suspend; int (*enable)(struct device *dev); void (*disable)(struct device *dev); struct gpio_button_data data[0]; @@ -437,6 +439,7 @@ static int gpio_keys_open(struct input_dev *input) { struct gpio_keys_drvdata *ddata = input_get_drvdata(input); + ddata->enabled = true; return ddata->enable ? ddata->enable(input->dev.parent) : 0; } @@ -446,6 +449,7 @@ static void gpio_keys_close(struct input_dev *input) if (ddata->disable) ddata->disable(input->dev.parent); + ddata->enabled = false; } /* @@ -578,6 +582,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) ddata->n_buttons = pdata->nbuttons; ddata->enable = pdata->enable; ddata->disable = pdata->disable; + ddata->enabled = false; mutex_init(&ddata->disable_lock); platform_set_drvdata(pdev, ddata); @@ -709,6 +714,10 @@ static int gpio_keys_suspend(struct device *dev) enable_irq_wake(irq); } } + } else { + ddata->enable_after_suspend = ddata->enabled; + if (ddata->enabled) + gpio_keys_close(ddata->input); } return 0; @@ -729,6 +738,10 @@ static int gpio_keys_resume(struct device *dev) gpio_keys_report_event(&ddata->data[i]); } + + if (!device_may_wakeup(dev) && ddata->enable_after_suspend) + gpio_keys_open(ddata->input); + input_sync(ddata->input); return 0; |