#define PMC_WAKE_STATUS 0x14
#define TEGRA_WAKE_PWR_INT (1UL << 18)
+#define PMC_WAKE2_STATUS 0x168
static int loki_wakeup_key(void);
static struct gpio_keys_button loki_int_keys[] = {
[0] = GPIO_IKEY(KEY_POWER, 0, 1, 10),
+ [1] = {
+ .code = SW_LID,
+ .gpio = TEGRA_GPIO_HALL,
+ .irq = -1,
+ .type = EV_SW,
+ .desc = "Hall Effect Sensor",
+ .active_low = 1,
+ .wakeup = 1,
+ .debounce_interval = 0,
+ },
};
static struct gpio_keys_platform_data loki_int_keys_pdata = {
static int loki_wakeup_key(void)
{
+ int wakeup_key;
u32 status;
- status = __raw_readl(IO_ADDRESS(TEGRA_PMC_BASE) + PMC_WAKE_STATUS);
-
- pr_info("%s: Power key pressed\n", __func__);
-
- return (status & TEGRA_WAKE_PWR_INT) ? KEY_POWER : KEY_RESERVED;
+ status = readl(IO_ADDRESS(TEGRA_PMC_BASE) + PMC_WAKE_STATUS)
+ | (u64)readl(IO_ADDRESS(TEGRA_PMC_BASE)
+ + PMC_WAKE2_STATUS) << 32;
+
+ if (status & TEGRA_WAKE_PWR_INT)
+ wakeup_key = KEY_POWER;
+ else if (status & (1UL << TEGRA_WAKE_GPIO_PS0))
+ wakeup_key = SW_LID;
+ else
+ wakeup_key = -1;
+
+ return wakeup_key;
}
int __init loki_kbc_init(void)
GPIO_INIT_PIN_MODE(TEGRA_GPIO_PR5, false, 1),
GPIO_INIT_PIN_MODE(TEGRA_GPIO_PR6, true, 0),
GPIO_INIT_PIN_MODE(TEGRA_GPIO_PR7, true, 0),
- GPIO_INIT_PIN_MODE(TEGRA_GPIO_PS0, true, 0),
GPIO_INIT_PIN_MODE(TEGRA_GPIO_PEE1, false, 0),
GPIO_INIT_PIN_MODE(TEGRA_GPIO_PU0, true, 0),
GPIO_INIT_PIN_MODE(TEGRA_GPIO_PU1, false, 0),