[Touch Cruise Android Development] Michel82:
I believe this is the latest working version of that file. Hope your able to fix it.

See the git history: http://git.linuxtogo.org/?p=groups/...0ae0674ac5da32c45788f961d85d1c62;hb=htc-vogue

/* linux/arch/arm/mach-msm/board-polaris-keypad.c
*
* Copyright (C) 2007 Google, Inc.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <asm/gpio.h>
#include <asm/hardware.h>
#include <asm/arch/board.h>
#include <asm/arch/msm_iomap.h>
#include <asm/io.h>
#include <asm/delay.h>
#include <linux/gpio_event.h>
#include <asm/mach-types.h>

/* MATRIX */

static unsigned int polaris_matrix_col_gpios[] = {39, 40, 41};
static unsigned int polaris_matrix_row_gpios[] = {33, 34, 35};

#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(polaris_matrix_col_gpios) + (col))

static const unsigned short polaris_keymap_matrix[ARRAY_SIZE(polaris_matrix_col_gpios) * ARRAY_SIZE(polaris_matrix_row_gpios)] = {
[KEYMAP_INDEX(0, 0)] = KEY_VOLUMEDOWN, //volume down
[KEYMAP_INDEX(0, 1)] = 0x9e, //nothing on this row
[KEYMAP_INDEX(0, 2)] = 0xe5, //nothing on this row

[KEYMAP_INDEX(1, 0)] = KEY_VOLUMEUP, //volume up
[KEYMAP_INDEX(1, 1)] = 0x9e, //hangup
[KEYMAP_INDEX(1, 2)] = 0xe5, //ie

[KEYMAP_INDEX(2, 0)] = KEY_HOME, //voice recorder
[KEYMAP_INDEX(2, 1)] = 0xe7, //call
[KEYMAP_INDEX(2, 2)] = KEY_HOME, //nav
};

static struct gpio_event_matrix_info polaris_matrix_info = {
.info.func = gpio_event_matrix_func,
.keymap = polaris_keymap_matrix,
.output_gpios = polaris_matrix_row_gpios,
.input_gpios = polaris_matrix_col_gpios,
.noutputs = ARRAY_SIZE(polaris_matrix_row_gpios),
.ninputs = ARRAY_SIZE(polaris_matrix_col_gpios),
.settle_time.tv.nsec = 0,
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
.flags = GPIOKPF_LEVEL_TRIGGERED_IRQ | GPIOKPF_DRIVE_INACTIVE | GPIOKPF_PRINT_UNMAPPED_KEYS /*| GPIOKPF_PRINT_MAPPED_KEYS*/
};

/* DIRECT INFO */

static struct gpio_event_direct_entry polaris_keymap[] = {
{.gpio=19,.code=0x69}, //left
{.gpio=20,.code=0x6b}, //power buttons
{.gpio=37,.code=0x6c}, //down
{.gpio=38,.code=0x67}, //up
{.gpio=91,.code=0x6a}, //right
{.gpio=90,.code=0xe8}, //ok
//{.gpio=39,.code=0xe8}, //camera half | not sending ok, but needs a code
//{.gpio=76,.code=0xe8}, //camera full | not sending ok, but needs a code
};

static struct gpio_event_input_info polaris_event_info = {
.info.func = gpio_event_input_func,
.keymap = polaris_keymap,
.keymap_size = ARRAY_SIZE(polaris_keymap),
.debounce_time.tv.nsec = 1 * NSEC_PER_MSEC,
.poll_time.tv.nsec = 20 * NSEC_PER_MSEC,
.flags = 0,
.type=EV_KEY,
};

struct gpio_event_info *polaris_keypad_info[] = {
&polaris_matrix_info.info,
&polaris_event_info.info
};

static struct gpio_event_platform_data polaris_keypad_data = {
.name = "polaris_keypad",
.info = polaris_keypad_info,
.info_count = ARRAY_SIZE(polaris_keypad_info)
};

static struct platform_device polaris_keypad_device = {
.name = GPIO_EVENT_DEV_NAME,
.id = -1,
.dev = {
.platform_data = &polaris_keypad_data,
},
};

static int __init polaris_kbd_init (void)
{
int ret;

if(!machine_is_htcpolaris())
return 0;

ret = platform_device_register(&polaris_keypad_device);

if (ret)
{
printk("Could not register matrix device");
return ret;
}

return ret;
}

module_init (polaris_kbd_init);

MODULE_AUTHOR ("Brian Swetland - modified by Rob Groenendijk for Polaris");
MODULE_DESCRIPTION ("Support for HTC Polaris keypad");
MODULE_LICENSE ("GPL");