2 * arch/arm/mach-tegra/board-pluto-kbc.c
3 * Keys configuration for Nvidia tegra3 pluto 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/input/tegra_kbc.h>
26 #include <linux/gpio.h>
27 #include <linux/gpio_keys.h>
30 #include "board-pluto.h"
33 #define PLUTO_ROW_COUNT 3
34 #define PLUTO_COL_COUNT 3
36 static const u32 kbd_keymap[] = {
38 KEY(0, 1, KEY_VOLUMEUP),
39 KEY(0, 2, KEY_VOLUMEDOWN),
41 KEY(1, 0, KEY_SEARCH),
42 KEY(1, 1, KEY_CAMERA),
43 KEY(1, 2, KEY_CAMERA_FOCUS),
50 static const struct matrix_keymap_data keymap_data = {
52 .keymap_size = ARRAY_SIZE(kbd_keymap),
55 static struct tegra_kbc_wake_key pluto_wake_cfg[] = {
70 static struct tegra_kbc_platform_data pluto_kbc_platform_data = {
71 .debounce_cnt = 20 * 32, /* 20 ms debaunce time */
75 .keymap_data = &keymap_data,
77 .wake_cfg = &pluto_wake_cfg[0],
78 .wakeup_key = KEY_POWER,
80 .disable_ev_rep = true,
84 static struct gpio_keys_button pluto_keys[] = {
87 .gpio = TEGRA_GPIO_PI5,
93 .debounce_interval = 100,
97 static struct gpio_keys_platform_data pluto_keys_pdata = {
98 .buttons = pluto_keys,
99 .nbuttons = ARRAY_SIZE(pluto_keys),
102 static struct platform_device pluto_keys_device = {
106 .platform_data = &pluto_keys_pdata,
110 int __init pluto_kbc_init(void)
112 struct tegra_kbc_platform_data *data = &pluto_kbc_platform_data;
115 tegra_kbc_device.dev.platform_data = &pluto_kbc_platform_data;
116 pr_info("Registering tegra-kbc\n");
118 BUG_ON((KBC_MAX_ROW + KBC_MAX_COL) > KBC_MAX_GPIO);
119 for (i = 0; i < PLUTO_ROW_COUNT; i++) {
120 data->pin_cfg[i].num = i;
121 data->pin_cfg[i].type = PIN_CFG_ROW;
123 for (i = 0; i < PLUTO_COL_COUNT; i++) {
124 data->pin_cfg[i + KBC_PIN_GPIO_11].num = i;
125 data->pin_cfg[i + KBC_PIN_GPIO_11].type = PIN_CFG_COL;
128 platform_device_register(&tegra_kbc_device);
129 pr_info("Registering successful tegra-kbc\n");
131 platform_device_register(&pluto_keys_device);
132 pr_info("Registering successful gpio-keys\n");