瀏覽代碼

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>
Rakesh Iyer 13 年之前
父節點
當前提交
b6834b02e4
共有 1 個文件被更改,包括 17 次插入0 次删除
  1. 17 0
      drivers/input/keyboard/tegra-kbc.c

+ 17 - 0
drivers/input/keyboard/tegra-kbc.c

@@ -48,6 +48,7 @@
 #define KBC_FIFO_TH_CNT_SHIFT(cnt)	(cnt << 14)
 #define KBC_FIFO_TH_CNT_SHIFT(cnt)	(cnt << 14)
 #define KBC_DEBOUNCE_CNT_SHIFT(cnt)	(cnt << 4)
 #define KBC_DEBOUNCE_CNT_SHIFT(cnt)	(cnt << 4)
 #define KBC_CONTROL_FIFO_CNT_INT_EN	(1 << 3)
 #define KBC_CONTROL_FIFO_CNT_INT_EN	(1 << 3)
+#define KBC_CONTROL_KEYPRESS_INT_EN	(1 << 1)
 #define KBC_CONTROL_KBC_EN		(1 << 0)
 #define KBC_CONTROL_KBC_EN		(1 << 0)
 
 
 /* KBC Interrupt Register */
 /* KBC Interrupt Register */
@@ -356,6 +357,18 @@ static void tegra_kbc_set_fifo_interrupt(struct tegra_kbc *kbc, bool enable)
 	writel(val, kbc->mmio + KBC_CONTROL_0);
 	writel(val, kbc->mmio + KBC_CONTROL_0);
 }
 }
 
 
+static void tegra_kbc_set_keypress_interrupt(struct tegra_kbc *kbc, bool enable)
+{
+	u32 val;
+
+	val = readl(kbc->mmio + KBC_CONTROL_0);
+	if (enable)
+		val |= KBC_CONTROL_KEYPRESS_INT_EN;
+	else
+		val &= ~KBC_CONTROL_KEYPRESS_INT_EN;
+	writel(val, kbc->mmio + KBC_CONTROL_0);
+}
+
 static void tegra_kbc_keypress_timer(unsigned long data)
 static void tegra_kbc_keypress_timer(unsigned long data)
 {
 {
 	struct tegra_kbc *kbc = (struct tegra_kbc *)data;
 	struct tegra_kbc *kbc = (struct tegra_kbc *)data;
@@ -831,6 +844,8 @@ static int tegra_kbc_suspend(struct device *dev)
 		msleep(30);
 		msleep(30);
 
 
 		kbc->keypress_caused_wake = false;
 		kbc->keypress_caused_wake = false;
+		/* Enable keypress interrupt before going into suspend. */
+		tegra_kbc_set_keypress_interrupt(kbc, true);
 		enable_irq(kbc->irq);
 		enable_irq(kbc->irq);
 		enable_irq_wake(kbc->irq);
 		enable_irq_wake(kbc->irq);
 	} else {
 	} else {
@@ -852,6 +867,8 @@ static int tegra_kbc_resume(struct device *dev)
 	if (device_may_wakeup(&pdev->dev)) {
 	if (device_may_wakeup(&pdev->dev)) {
 		disable_irq_wake(kbc->irq);
 		disable_irq_wake(kbc->irq);
 		tegra_kbc_setup_wakekeys(kbc, false);
 		tegra_kbc_setup_wakekeys(kbc, false);
+		/* We will use fifo interrupts for key detection. */
+		tegra_kbc_set_keypress_interrupt(kbc, false);
 
 
 		/* Restore the resident time of continuous polling mode. */
 		/* Restore the resident time of continuous polling mode. */
 		writel(kbc->cp_to_wkup_dly, kbc->mmio + KBC_TO_CNT_0);
 		writel(kbc->cp_to_wkup_dly, kbc->mmio + KBC_TO_CNT_0);