ARM: tegra: cardhu: Keypad Support
vikasr [Fri, 27 May 2011 20:57:27 +0000 (13:57 -0700)]
Made changes in the code to include PM269's Keypad Functionality

Bug 833265

Change-Id: Iec996d9c0f8fe03a8f28278b0dfc80c699d14d26
Reviewed-on: http://git-master/r/34364
Reviewed-by: Niket Sirsi <nsirsi@nvidia.com>
Tested-by: Niket Sirsi <nsirsi@nvidia.com>

Rebase-Id: Rcc57d10bd56e131c46e996c7fc68aa6ee38a4a20

arch/arm/mach-tegra/board-cardhu-kbc.c

index d5b5fbb..52fe71e 100644 (file)
@@ -40,6 +40,9 @@
 
 #define CARDHU_ROW_COUNT       4
 #define CARDHU_COL_COUNT       2
+#define CARDHU_PM269_ROW_COUNT 2
+#define CARDHU_PM269_COL_COUNT 4
+
 static int plain_kbd_keycode[] = {
        KEY_POWER,      KEY_RESERVED,
        KEY_HOME,       KEY_BACK,
@@ -47,6 +50,13 @@ static int plain_kbd_keycode[] = {
        KEY_VOLUMEDOWN, KEY_VOLUMEUP
 };
 
+static int plain_kbd_keycode_pm269[] = {
+       KEY_POWER,      KEY_RESERVED,
+       KEY_VOLUMEUP,   KEY_VOLUMEDOWN,
+       KEY_HOME,       KEY_MENU,
+       KEY_BACK,       KEY_SEARCH
+};
+
 static struct tegra_kbc_wake_key cardhu_wake_cfg[] = {
        [0] = {
                .row = 0,
@@ -79,7 +89,6 @@ static struct resource cardhu_kbc_resources[] = {
        },
 };
 
-
 struct platform_device cardhu_kbc_device = {
        .name = "tegra-kbc",
        .id = -1,
@@ -95,28 +104,37 @@ int __init cardhu_kbc_init(void)
        struct tegra_kbc_platform_data *data = &cardhu_kbc_platform_data;
        int i;
        struct board_info board_info;
+       int row_count = CARDHU_ROW_COUNT, col_count = CARDHU_COL_COUNT;
 
        tegra_get_board_info(&board_info);
+
        if ((board_info.board_id == BOARD_E1198) ||
                        (board_info.board_id == BOARD_E1291))
                return 0;
 
+       if (board_info.board_id == BOARD_PM269) {
+               cardhu_kbc_platform_data.plain_keycode = plain_kbd_keycode_pm269;
+               row_count = CARDHU_PM269_ROW_COUNT;
+               col_count = CARDHU_PM269_COL_COUNT;
+       }
+
        pr_info("Registering tegra-kbc\n");
         /* Setup the pin configuration information. */
        for (i = 0; i < KBC_MAX_GPIO; i++) {
                data->pin_cfg[i].num = 0;
                data->pin_cfg[i].pin_type = kbc_pin_unused;
        }
-       for (i = 0; i < CARDHU_ROW_COUNT; i++) {
+       for (i = 0; i < row_count; i++) {
                data->pin_cfg[i].num = i;
                data->pin_cfg[i].pin_type = kbc_pin_row;
        }
-
-       for (i = 0; i < CARDHU_COL_COUNT; i++) {
-               data->pin_cfg[i + CARDHU_ROW_COUNT].num = i;
-               data->pin_cfg[i + CARDHU_ROW_COUNT].pin_type = kbc_pin_col;
+       for (i = 0; i < col_count; i++) {
+               data->pin_cfg[i + row_count].num = i;
+               data->pin_cfg[i + row_count].pin_type = kbc_pin_col;
        }
+
        platform_device_register(&cardhu_kbc_device);
+
        return 0;
 }