From: <hap...@us...> - 2006-10-06 10:05:56
|
Revision: 621 http://svn.sourceforge.net/hackndev/?rev=621&view=rev Author: happy-slapin Date: 2006-10-06 03:05:40 -0700 (Fri, 06 Oct 2006) Log Message: ----------- z72: Finally made keypad work again Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c Removed Paths: ------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2006-10-06 09:27:14 UTC (rev 620) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2006-10-06 10:05:40 UTC (rev 621) @@ -3,12 +3,3 @@ select PXA27x help This enables support for Palm Zire 72 handheld. - -config PALMZ72_BUTTONS - tristate "Palm LifeDrive buttons driver" - depends on MACH_PALMZ72 - default y - help - This driver translates button presses on a Palm - Zire 72 to Linux input subsystem events. - Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2006-10-06 09:27:14 UTC (rev 620) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2006-10-06 10:05:40 UTC (rev 621) @@ -3,4 +3,3 @@ # obj-$(CONFIG_MACH_PALMZ72) += palmz72.o -obj-$(CONFIG_PALMZ72_BUTTONS) += palmz72_buttons.o Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2006-10-06 09:27:14 UTC (rev 620) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2006-10-06 10:05:40 UTC (rev 621) @@ -9,6 +9,7 @@ #include <linux/kernel.h> #include <linux/init.h> +#include <linux/input.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <asm/arch/hardware.h> @@ -114,17 +115,17 @@ }, .gpio_modes = { - GPIO_NR_PALMZ72_KP_MKIN0_MD, - GPIO_NR_PALMZ72_KP_MKIN1_MD, - GPIO_NR_PALMZ72_KP_MKIN2_MD, - GPIO_NR_PALMZ72_KP_MKIN3_MD, - GPIO_NR_PALMZ72_KP_MKOUT0_MD, - GPIO_NR_PALMZ72_KP_MKOUT1_MD, - GPIO_NR_PALMZ72_KP_MKOUT2_MD, + GPIO_NR_ZIRE72_KP_MKIN0_MD, + GPIO_NR_ZIRE72_KP_MKIN1_MD, + GPIO_NR_ZIRE72_KP_MKIN2_MD, + GPIO_NR_ZIRE72_KP_MKIN3_MD, + GPIO_NR_ZIRE72_KP_MKOUT0_MD, + GPIO_NR_ZIRE72_KP_MKOUT1_MD, + GPIO_NR_ZIRE72_KP_MKOUT2_MD, }, }; -static struct platform_device palmld_kbd = { +static struct platform_device palmz72_keypad = { .name = "pxa27x-keyboard", .id = -1, .dev = { Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c 2006-10-06 09:27:14 UTC (rev 620) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c 2006-10-06 10:05:40 UTC (rev 621) @@ -1,201 +0,0 @@ -/* - * linux/arch/arm/mach-pxa/zire72/zire72-buttons.c - * - * Button driver for Palm Zire 72 - * - * Author: Alex Osborne <bob...@gm...> - * Author: Sergey Lapin <sla...@gm...> - */ - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/input.h> -#include <linux/device.h> -#include <linux/platform_device.h> - -#include <asm/mach-types.h> -#include <asm/mach/arch.h> -#include <asm/mach/map.h> - -#include <asm/arch/hardware.h> -#include <asm/arch/pxa-regs.h> -#include <asm/arch/irqs.h> -#include <asm/arch/palmz72-gpio.h> - -#define KPASMKP(col) (col/2==0 ? KPASMKP0 : KPASMKP1) -#define KPASMKPx_MKC(row, col) (1 << (row + 16*(col%2))) - -#define ZIRE72_KM_ROWS 4 -#define ZIRE72_KM_COLS 3 - - -static struct { - int keycode; - char *desc; -} button_matrix[ZIRE72_KM_ROWS][ZIRE72_KM_COLS] = { - { /* row 0 */ - { -1, "(unused)" }, // suspend is here - { KEY_P, "Picture" }, - { KEY_ENTER, "Center" }, - }, { /* row 1 */ - { KEY_T, "Tasks" }, - { KEY_C, "Contacts" }, - { KEY_M, "Music" }, - }, { /* row 2 */ - { KEY_UP, "Up" }, - { -1, "(unused)" }, // not found - { KEY_DOWN, "Down" }, - }, { /* row 3 */ - { KEY_RIGHT, "Right" }, - { KEY_ENTER, "Center" }, - { KEY_LEFT, "Left" }, - } -}; - -static struct input_dev *button_dev; - -static void zire72_buttons_report_event(int row, int col, int pressed) -{ -#if 1 - if(row >= ZIRE72_KM_ROWS || col >= ZIRE72_KM_COLS) { - printk(KERN_ERR "zire72_buttons_report_event: out of bounds " - "key event row=%d col=%d pressed=%d\n", row, col, - pressed); - return; - } - - if( button_matrix[row][col].keycode >= 0 ) { - input_report_key(button_dev, button_matrix[row][col].keycode, pressed); - } -#else -printk(KERN_INFO "palmz72_buttons_report_event: " - "key event row=%d col=%d pressed=%d\n", row, col, - pressed); -#endif -} - -static irqreturn_t zire72_keypad_irq_handler(int irq, void *dev_id, struct pt_regs *regs) -{ - int mi; - int row=-1, col=-1; - - - /* - * notify controller that interrupt was handled, otherwise it'll - * constantly send interrupts and lock up the device. - */ - mi = KPC & KPC_MI; - - /* report the status of every button */ - for(row=0; row < ZIRE72_KM_ROWS; row++) { - for(col=0; col < ZIRE72_KM_COLS; col++) { - zire72_buttons_report_event(row, col, KPASMKP(col) & KPASMKPx_MKC(row, col)); - } - } - - return IRQ_HANDLED; -} - -static int __init zire72_buttons_probe(struct device *dev) -{ - int err; - int row, col; - -/* if(!machine_is_xscale_zire72()) - return -ENODEV; -*/ - button_dev = input_allocate_device(); - button_dev->evbit[0] = BIT(EV_KEY); - for(row=0; row < ZIRE72_KM_ROWS; row++) { - for(col=0; col < ZIRE72_KM_COLS; col++) { - if( button_matrix[row][col].keycode >= 0 ) { - button_dev->keybit[ LONG - (button_matrix[row][col].keycode)] |= - BIT(button_matrix[row][col].keycode); - } - } - } - - button_dev->name = "Palm Zire 72 buttons"; - button_dev->id.bustype = BUS_HOST; - input_register_device(button_dev); - - - /* - * setup GPIOs for the LifeDrive keypad matrix - */ - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN0_MD); - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN1_MD); - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN2_MD); - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN3_MD); - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKOUT0_MD); - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKOUT1_MD); - pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKOUT2_MD); - - - /* - * setup the PXA270 keypad controller for automatic on-activity scanning - */ - KPC |= ZIRE72_KM_ROWS << 26; /* lifedrive keypad matrix has 4 rows */ - KPC |= ZIRE72_KM_COLS << 23; /* and 3 columns */ - - KPC |= KPC_ASACT; /* enable automatic scan on activity */ - KPC &= ~KPC_AS; /* disable automatic scan */ - KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */ - - KPC &= ~KPC_DE; /* disable direct keypad */ - KPC &= ~KPC_DIE; /* disable direct keypad interrupt */ - - err = request_irq(IRQ_KEYPAD, zire72_keypad_irq_handler, SA_INTERRUPT, - "keypad", NULL); - if(err) { - printk(KERN_ERR "zire72_buttons_probe: cannot request keypad IRQ\n"); - return -1; - } - - KPC |= KPC_ME; /* matrix keypad enabled */ - KPC |= KPC_ME; /* matrix keypad interrupt enabled */ - - return 0; -} - -static int zire72_buttons_remove (struct device *dev) -{ - free_irq(IRQ_KEYPAD, NULL); - return 0; -} - -static struct device_driver zire72_buttons_driver = { - .name = "zire72-buttons", - .bus = &platform_bus_type, - .probe = zire72_buttons_probe, - .remove = zire72_buttons_remove, -#ifdef CONFIG_PM - .suspend = NULL, - .resume = NULL, -#endif -}; - -static int __init zire72_buttons_init(void) -{ -/* if(!machine_is_xscale_zire72()) - return -ENODEV; -*/ - return driver_register(&zire72_buttons_driver); -} - -static void __exit zire72_buttons_exit(void) -{ - input_unregister_device(button_dev); - driver_unregister(&zire72_buttons_driver); -} - -module_init(zire72_buttons_init); -module_exit(zire72_buttons_exit); - -MODULE_AUTHOR ("Alex Osborne <bob...@gm...>"); -MODULE_AUTHOR ("Sergey Lapin <sla...@gm...>"); -MODULE_DESCRIPTION ("Button support for Palm Zire 72"); -MODULE_LICENSE ("GPL"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |