arch: arm: ardbeg: add kbc file
Mitch Luban [Fri, 12 Apr 2013 10:09:48 +0000 (03:09 -0700)]
Added kbc file to enable kbc on ardbeg.

Bug 1257423

Change-Id: I0651f6df4f40b4a3b329a368f1ca934a23c5866f
Signed-off-by: Mitch Luban <mluban@nvidia.com>
Reviewed-on: http://git-master/r/218873
Reviewed-by: Chao Xu <cxu@nvidia.com>

arch/arm/mach-tegra/Makefile
arch/arm/mach-tegra/board-ardbeg-kbc.c [new file with mode: 0644]
arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-ardbeg.h

index 8d9f53b..bb396e2 100644 (file)
@@ -261,6 +261,7 @@ obj-${CONFIG_MACH_TEGRA_PLUTO}          += panel-j-720p-4-7.o
 obj-${CONFIG_MACH_TEGRA_PLUTO}          += panel-s-1080p-5.o
 
 obj-${CONFIG_MACH_ARDBEG}               += board-ardbeg.o
+obj-${CONFIG_MACH_ARDBEG}               += board-ardbeg-kbc.o
 obj-${CONFIG_MACH_ARDBEG}               += board-ardbeg-panel.o
 obj-${CONFIG_MACH_ARDBEG}               += board-ardbeg-pinmux.o
 obj-${CONFIG_MACH_ARDBEG}               += panel-a-1080p-11-6.o
diff --git a/arch/arm/mach-tegra/board-ardbeg-kbc.c b/arch/arm/mach-tegra/board-ardbeg-kbc.c
new file mode 100644 (file)
index 0000000..bca7514
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * arch/arm/mach-tegra/board-ardbeg-kbc.c
+ * Keys configuration for Nvidia tegra3 ardbeg platform.
+ *
+ * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/io.h>
+#include <linux/input/tegra_kbc.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/mfd/palmas.h>
+
+#include "tegra-board-id.h"
+#include "board.h"
+#include "board-ardbeg.h"
+#include "devices.h"
+#include "iomap.h"
+#include "wakeups-t11x.h"
+
+/*
+static const u32 kbd_keymap[] = {
+       KEY(0, 0, KEY_POWER),
+       KEY(0, 1, KEY_HOME),
+
+       KEY(1, 0, KEY_RESERVED),
+       KEY(1, 1, KEY_VOLUMEDOWN),
+
+       KEY(2, 0, KEY_CAMERA),
+       KEY(2, 1, KEY_VOLUMEUP),
+       KEY(2, 2, KEY_2),
+};
+
+static const struct matrix_keymap_data keymap_data = {
+       .keymap         = kbd_keymap,
+       .keymap_size    = ARRAY_SIZE(kbd_keymap),
+};
+
+static struct tegra_kbc_wake_key ardbeg_wake_cfg[] = {
+       [0] = {
+               .row = 0,
+               .col = 0,
+       },
+};
+
+static struct tegra_kbc_platform_data ardbeg_kbc_platform_data = {
+       .debounce_cnt = 20 * 32,
+       .repeat_cnt = 1,
+       .scan_count = 30,
+       .wakeup = true,
+       .keymap_data = &keymap_data,
+       .wake_cnt = 1,
+       .wake_cfg = &ardbeg_wake_cfg[0],
+       .wakeup_key = KEY_POWER,
+#ifdef CONFIG_ANDROID
+       .disable_ev_rep = true,
+#endif
+};
+
+#define GPIO_KEY(_id, _gpio, _iswake)           \
+       {                                       \
+               .code = _id,                    \
+               .gpio = TEGRA_GPIO_##_gpio,     \
+               .active_low = 1,                \
+               .desc = #_id,                   \
+               .type = EV_KEY,                 \
+               .wakeup = _iswake,              \
+               .debounce_interval = 10,        \
+       }
+*/
+
+#define GPIO_IKEY(_id, _irq, _iswake, _deb)    \
+       {                                       \
+               .code = _id,                    \
+               .gpio = -1,                     \
+               .irq = _irq,                    \
+               .desc = #_id,                   \
+               .type = EV_KEY,                 \
+               .wakeup = _iswake,              \
+               .debounce_interval = _deb,      \
+       }
+
+static struct gpio_keys_button ardbeg_int_keys[] = {
+       /* FIXME: add ardbeg keys */
+};
+
+static struct gpio_keys_platform_data ardbeg_int_keys_pdata = {
+       .buttons        = ardbeg_int_keys,
+       .nbuttons       = ARRAY_SIZE(ardbeg_int_keys),
+};
+
+static struct platform_device ardbeg_int_keys_device = {
+       .name   = "gpio-keys",
+       .id     = 0,
+       .dev    = {
+               .platform_data  = &ardbeg_int_keys_pdata,
+       },
+};
+
+int __init ardbeg_kbc_init(void)
+{
+       platform_device_register(&ardbeg_int_keys_device);
+
+       return 0;
+}
+
index 10ff6d5..73b10db 100644 (file)
@@ -101,6 +101,7 @@ static void __init tegra_ardbeg_init(void)
        tegra_enable_pinmux();
        ardbeg_pinmux_init();
        tegra_soc_device_init("ardbeg");
+       ardbeg_kbc_init();
        ardbeg_panel_init();
        platform_add_devices(ardbeg_devices, ARRAY_SIZE(ardbeg_devices));
 }
index 9033cc0..a1969c6 100644 (file)
@@ -25,5 +25,6 @@
 
 int ardbeg_pinmux_init(void);
 int ardbeg_panel_init(void);
+int ardbeg_kbc_init(void);
 
 #endif