diff options
author | Sachin Nikam <snikam@nvidia.com> | 2010-12-21 13:10:31 +0530 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2010-12-28 23:09:04 -0800 |
commit | 2c61fdf6ff291d8ae8893a295d7835da0e3ee63d (patch) | |
tree | dec77f9ce546e24861a7eeb792be3479c9b380d7 | |
parent | bb9b07750cc166d0d7e19df2e0411043a8bebfdb (diff) |
[ARM] tegra: whistler: register scrollwheel
Registering GPIOs for scrollwheel device.
Change-Id: I236d122c5c374ebe09a6dea7242be49b4a773e18
Reviewed-on: http://git-master/r/13965
Tested-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/board-whistler.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/board-whistler.c b/arch/arm/mach-tegra/board-whistler.c index 6e220cad52f1..57b33921eaad 100644 --- a/arch/arm/mach-tegra/board-whistler.c +++ b/arch/arm/mach-tegra/board-whistler.c @@ -31,7 +31,7 @@ #include <linux/delay.h> #include <linux/i2c-tegra.h> #include <linux/gpio.h> -#include <linux/gpio_keys.h> +#include <linux/gpio_scrollwheel.h> #include <linux/input.h> #include <linux/usb/android_composite.h> #include <linux/memblock.h> @@ -158,6 +158,35 @@ static void whistler_i2c_init(void) platform_device_register(&tegra_i2c_device1); } +#define GPIO_SCROLL(_pinaction, _gpio, _desc) \ +{ \ + .pinaction = GPIO_SCROLLWHEEL_PIN_##_pinaction, \ + .gpio = TEGRA_GPIO_##_gpio, \ + .desc = _desc, \ + .active_low = 1, \ + .debounce_interval = 2, \ +} + +static struct gpio_scrollwheel_button scroll_keys[] = { + [0] = GPIO_SCROLL(ONOFF, PR3, "sw_onoff"), + [1] = GPIO_SCROLL(PRESS, PQ5, "sw_press"), + [2] = GPIO_SCROLL(ROT1, PQ3, "sw_rot1"), + [3] = GPIO_SCROLL(ROT2, PQ4, "sw_rot2"), +}; + +static struct gpio_scrollwheel_platform_data whistler_scroll_platform_data = { + .buttons = scroll_keys, + .nbuttons = ARRAY_SIZE(scroll_keys), +}; + +static struct platform_device whistler_scroll_device = { + .name = "alps-gpio-scrollwheel", + .id = 0, + .dev = { + .platform_data = &whistler_scroll_platform_data, + }, +}; + static struct platform_device *whistler_devices[] __initdata = { &tegra_otg_device, &androidusb_device, @@ -167,6 +196,7 @@ static struct platform_device *whistler_devices[] __initdata = { &tegra_gart_device, &tegra_wdt_device, &tegra_avp_device, + &whistler_scroll_device, }; static struct synaptics_i2c_rmi_platform_data synaptics_pdata= { @@ -189,6 +219,15 @@ static int __init whistler_touch_init(void) return 0; } +static int __init whistler_scroll_init(void) +{ + int i; + for (i = 0; i < ARRAY_SIZE(scroll_keys); i++) + tegra_gpio_enable(scroll_keys[i].gpio); + + return 0; +} + static void __init tegra_whistler_init(void) { char serial[20]; @@ -208,6 +247,7 @@ static void __init tegra_whistler_init(void) whistler_panel_init(); whistler_touch_init(); whistler_kbc_init(); + whistler_scroll_init(); } int __init tegra_whistler_protected_aperture_init(void) |