diff options
author | Rakesh Iyer <riyer@nvidia.com> | 2012-01-23 02:27:54 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-01-23 03:02:46 -0500 |
commit | b6834b02e476ff0e99b6814665839e37affa31f0 (patch) | |
tree | 68dade868915a953f5e8fbb73423c110542ee467 /drivers/input/keyboard/tegra-kbc.c | |
parent | 82f6aba8eacf9dec23459832c1a0c789db28faa3 (diff) |
Input: tegra-kbc - enable key interrupt for wakeup
Enable keypress interrupt to support wakeup from low power state.
Signed-off-by: Rakesh Iyer <riyer@nvidia.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard/tegra-kbc.c')
-rw-r--r-- | drivers/input/keyboard/tegra-kbc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index a136e2e832be..b307a46ecef1 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14) | 48 | #define KBC_FIFO_TH_CNT_SHIFT(cnt) (cnt << 14) |
49 | #define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4) | 49 | #define KBC_DEBOUNCE_CNT_SHIFT(cnt) (cnt << 4) |
50 | #define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3) | 50 | #define KBC_CONTROL_FIFO_CNT_INT_EN (1 << 3) |
51 | #define KBC_CONTROL_KEYPRESS_INT_EN (1 << 1) | ||
51 | #define KBC_CONTROL_KBC_EN (1 << 0) | 52 | #define KBC_CONTROL_KBC_EN (1 << 0) |
52 | 53 | ||
53 | /* KBC Interrupt Register */ | 54 | /* KBC Interrupt Register */ |
@@ -356,6 +357,18 @@ static void tegra_kbc_set_fifo_interrupt(struct tegra_kbc *kbc, bool enable) | |||
356 | writel(val, kbc->mmio + KBC_CONTROL_0); | 357 | writel(val, kbc->mmio + KBC_CONTROL_0); |
357 | } | 358 | } |
358 | 359 | ||
360 | static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool enable) | ||
361 | { | ||
362 | u32 val; | ||
363 | |||
364 | val = readl(kbc->mmio + KBC_CONTROL_0); | ||
365 | if (enable) | ||
366 | val |= KBC_CONTROL_KEYPRESS_INT_EN; | ||
367 | else | ||
368 | val &= ~KBC_CONTROL_KEYPRESS_INT_EN; | ||
369 | writel(val, kbc->mmio + KBC_CONTROL_0); | ||
370 | } | ||
371 | |||
359 | static void tegra_kbc_keypress_timer(unsigned long data) | 372 | static void tegra_kbc_keypress_timer(unsigned long data) |
360 | { | 373 | { |
361 | struct tegra_kbc *kbc = (struct tegra_kbc *)data; | 374 | struct tegra_kbc *kbc = (struct tegra_kbc *)data; |
@@ -831,6 +844,8 @@ static int tegra_kbc_suspend(struct device *dev) | |||
831 | msleep(30); | 844 | msleep(30); |
832 | 845 | ||
833 | kbc->keypress_caused_wake = false; | 846 | kbc->keypress_caused_wake = false; |
847 | /* Enable keypress interrupt before going into suspend. */ | ||
848 | tegra_kbc_set_keypress_interrupt(kbc, true); | ||
834 | enable_irq(kbc->irq); | 849 | enable_irq(kbc->irq); |
835 | enable_irq_wake(kbc->irq); | 850 | enable_irq_wake(kbc->irq); |
836 | } else { | 851 | } else { |
@@ -852,6 +867,8 @@ static int tegra_kbc_resume(struct device *dev) | |||
852 | if (device_may_wakeup(&pdev->dev)) { | 867 | if (device_may_wakeup(&pdev->dev)) { |
853 | disable_irq_wake(kbc->irq); | 868 | disable_irq_wake(kbc->irq); |
854 | tegra_kbc_setup_wakekeys(kbc, false); | 869 | tegra_kbc_setup_wakekeys(kbc, false); |
870 | /* We will use fifo interrupts for key detection. */ | ||
871 | tegra_kbc_set_keypress_interrupt(kbc, false); | ||
855 | 872 | ||
856 | /* Restore the resident time of continuous polling mode. */ | 873 | /* Restore the resident time of continuous polling mode. */ |
857 | writel(kbc->cp_to_wkup_dly, kbc->mmio + KBC_TO_CNT_0); | 874 | writel(kbc->cp_to_wkup_dly, kbc->mmio + KBC_TO_CNT_0); |