2 * arch/arm/mach-tegra/board-roth-kbc.c
3 * Keys configuration for Nvidia tegra3 roth platform.
5 * Copyright (C) 2012 NVIDIA, Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #include <linux/kernel.h>
23 #include <linux/platform_device.h>
24 #include <linux/input.h>
25 #include <linux/gpio.h>
26 #include <linux/gpio_keys.h>
27 #include <linux/mfd/palmas.h>
29 #include "tegra-board-id.h"
31 #include "board-roth.h"
34 #define GPIO_KEY(_id, _gpio, _iswake) \
37 .gpio = TEGRA_GPIO_##_gpio, \
42 .debounce_interval = 10, \
45 #define GPIO_IKEY(_id, _irq, _iswake, _deb) \
53 .debounce_interval = _deb, \
56 /* Make KEY_POWER to index 0 only */
57 static struct gpio_keys_button roth_p2454_keys[] = {
58 [0] = GPIO_KEY(KEY_POWER, PR0, 0),
59 [1] = GPIO_KEY(KEY_VOLUMEUP, PR2, 0),
60 [2] = GPIO_KEY(KEY_VOLUMEDOWN, PR1, 0),
63 .gpio = TEGRA_GPIO_HALL,
66 .desc = "Hall Effect Sensor",
69 .debounce_interval = 100,
71 [4] = GPIO_IKEY(KEY_POWER, PALMAS_TEGRA_IRQ_BASE +
72 PALMAS_PWRON_IRQ, 1, 100),
76 static struct gpio_keys_platform_data roth_p2454_keys_pdata = {
77 .buttons = roth_p2454_keys,
78 .nbuttons = ARRAY_SIZE(roth_p2454_keys),
81 static struct platform_device roth_p2454_keys_device = {
85 .platform_data = &roth_p2454_keys_pdata,
89 int __init roth_kbc_init(void)
91 struct board_info board_info;
93 tegra_get_board_info(&board_info);
94 /* Rev A01 and onward have the POWER key in the KBC-COL0 */
95 if (board_info.major_revision > BOARD_FAB_A00)
96 roth_p2454_keys[0].gpio = TEGRA_GPIO_PQ0;
98 if (board_info.major_revision >= BOARD_FAB_A02) {
99 roth_p2454_keys[1].code = KEY_BACK;
100 roth_p2454_keys[2].code = KEY_HOME;
103 platform_device_register(&roth_p2454_keys_device);