2005-09-13 08:25:35 +00:00
|
|
|
/*
|
|
|
|
* Keyboard driver for Sharp Spitz, Borzoi and Akita (SL-Cxx00 series)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2005 Richard Purdie
|
|
|
|
*
|
|
|
|
* Based on corgikbd.c
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/delay.h>
|
2005-10-29 18:07:23 +00:00
|
|
|
#include <linux/platform_device.h>
|
2005-09-13 08:25:35 +00:00
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/jiffies.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
|
2008-08-05 15:14:15 +00:00
|
|
|
#include <mach/spitz.h>
|
|
|
|
#include <mach/hardware.h>
|
|
|
|
#include <mach/pxa-regs.h>
|
|
|
|
#include <mach/pxa2xx-gpio.h>
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
#define KB_ROWS 7
|
|
|
|
#define KB_COLS 11
|
|
|
|
#define KB_ROWMASK(r) (1 << (r))
|
|
|
|
#define SCANCODE(r,c) (((r)<<4) + (c) + 1)
|
|
|
|
#define NR_SCANCODES ((KB_ROWS<<4) + 1)
|
|
|
|
|
2006-03-14 05:12:32 +00:00
|
|
|
#define SCAN_INTERVAL (50) /* ms */
|
2005-09-13 08:25:35 +00:00
|
|
|
#define HINGE_SCAN_INTERVAL (150) /* ms */
|
|
|
|
|
|
|
|
#define SPITZ_KEY_CALENDER KEY_F1
|
|
|
|
#define SPITZ_KEY_ADDRESS KEY_F2
|
|
|
|
#define SPITZ_KEY_FN KEY_F3
|
|
|
|
#define SPITZ_KEY_CANCEL KEY_F4
|
|
|
|
#define SPITZ_KEY_EXOK KEY_F5
|
|
|
|
#define SPITZ_KEY_EXCANCEL KEY_F6
|
|
|
|
#define SPITZ_KEY_EXJOGDOWN KEY_F7
|
|
|
|
#define SPITZ_KEY_EXJOGUP KEY_F8
|
|
|
|
#define SPITZ_KEY_JAP1 KEY_LEFTALT
|
|
|
|
#define SPITZ_KEY_JAP2 KEY_RIGHTCTRL
|
|
|
|
#define SPITZ_KEY_SYNC KEY_F9
|
|
|
|
#define SPITZ_KEY_MAIL KEY_F10
|
|
|
|
#define SPITZ_KEY_OK KEY_F11
|
|
|
|
#define SPITZ_KEY_MENU KEY_F12
|
|
|
|
|
|
|
|
static unsigned char spitzkbd_keycode[NR_SCANCODES] = {
|
|
|
|
0, /* 0 */
|
|
|
|
KEY_LEFTCTRL, KEY_1, KEY_3, KEY_5, KEY_6, KEY_7, KEY_9, KEY_0, KEY_BACKSPACE, SPITZ_KEY_EXOK, SPITZ_KEY_EXCANCEL, 0, 0, 0, 0, 0, /* 1-16 */
|
|
|
|
0, KEY_2, KEY_4, KEY_R, KEY_Y, KEY_8, KEY_I, KEY_O, KEY_P, SPITZ_KEY_EXJOGDOWN, SPITZ_KEY_EXJOGUP, 0, 0, 0, 0, 0, /* 17-32 */
|
|
|
|
KEY_TAB, KEY_Q, KEY_E, KEY_T, KEY_G, KEY_U, KEY_J, KEY_K, 0, 0, 0, 0, 0, 0, 0, 0, /* 33-48 */
|
2006-04-26 04:13:42 +00:00
|
|
|
SPITZ_KEY_ADDRESS, KEY_W, KEY_S, KEY_F, KEY_V, KEY_H, KEY_M, KEY_L, 0, KEY_RIGHTSHIFT, 0, 0, 0, 0, 0, 0, /* 49-64 */
|
|
|
|
SPITZ_KEY_CALENDER, KEY_A, KEY_D, KEY_C, KEY_B, KEY_N, KEY_DOT, 0, KEY_ENTER, KEY_LEFTSHIFT, 0, 0, 0, 0, 0, 0, /* 65-80 */
|
2005-09-13 08:25:35 +00:00
|
|
|
SPITZ_KEY_MAIL, KEY_Z, KEY_X, KEY_MINUS, KEY_SPACE, KEY_COMMA, 0, KEY_UP, 0, 0, SPITZ_KEY_FN, 0, 0, 0, 0, 0, /* 81-96 */
|
|
|
|
KEY_SYSRQ, SPITZ_KEY_JAP1, SPITZ_KEY_JAP2, SPITZ_KEY_CANCEL, SPITZ_KEY_OK, SPITZ_KEY_MENU, KEY_LEFT, KEY_DOWN, KEY_RIGHT, 0, 0, 0, 0, 0, 0, 0 /* 97-112 */
|
|
|
|
};
|
|
|
|
|
|
|
|
static int spitz_strobes[] = {
|
|
|
|
SPITZ_GPIO_KEY_STROBE0,
|
|
|
|
SPITZ_GPIO_KEY_STROBE1,
|
|
|
|
SPITZ_GPIO_KEY_STROBE2,
|
|
|
|
SPITZ_GPIO_KEY_STROBE3,
|
|
|
|
SPITZ_GPIO_KEY_STROBE4,
|
|
|
|
SPITZ_GPIO_KEY_STROBE5,
|
|
|
|
SPITZ_GPIO_KEY_STROBE6,
|
|
|
|
SPITZ_GPIO_KEY_STROBE7,
|
|
|
|
SPITZ_GPIO_KEY_STROBE8,
|
|
|
|
SPITZ_GPIO_KEY_STROBE9,
|
|
|
|
SPITZ_GPIO_KEY_STROBE10,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int spitz_senses[] = {
|
|
|
|
SPITZ_GPIO_KEY_SENSE0,
|
|
|
|
SPITZ_GPIO_KEY_SENSE1,
|
|
|
|
SPITZ_GPIO_KEY_SENSE2,
|
|
|
|
SPITZ_GPIO_KEY_SENSE3,
|
|
|
|
SPITZ_GPIO_KEY_SENSE4,
|
|
|
|
SPITZ_GPIO_KEY_SENSE5,
|
|
|
|
SPITZ_GPIO_KEY_SENSE6,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct spitzkbd {
|
|
|
|
unsigned char keycode[ARRAY_SIZE(spitzkbd_keycode)];
|
2005-09-15 07:01:45 +00:00
|
|
|
struct input_dev *input;
|
2005-09-13 08:25:35 +00:00
|
|
|
char phys[32];
|
|
|
|
|
|
|
|
spinlock_t lock;
|
|
|
|
struct timer_list timer;
|
|
|
|
struct timer_list htimer;
|
|
|
|
|
|
|
|
unsigned int suspended;
|
|
|
|
unsigned long suspend_jiffies;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define KB_DISCHARGE_DELAY 10
|
|
|
|
#define KB_ACTIVATE_DELAY 10
|
|
|
|
|
|
|
|
/* Helper functions for reading the keyboard matrix
|
|
|
|
* Note: We should really be using pxa_gpio_mode to alter GPDR but it
|
|
|
|
* requires a function call per GPIO bit which is excessive
|
|
|
|
* when we need to access 11 bits at once, multiple times.
|
|
|
|
* These functions must be called within local_irq_save()/local_irq_restore()
|
|
|
|
* or similar.
|
|
|
|
*/
|
|
|
|
static inline void spitzkbd_discharge_all(void)
|
|
|
|
{
|
|
|
|
/* STROBE All HiZ */
|
|
|
|
GPCR0 = SPITZ_GPIO_G0_STROBE_BIT;
|
|
|
|
GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
|
|
|
|
GPCR1 = SPITZ_GPIO_G1_STROBE_BIT;
|
|
|
|
GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
|
|
|
|
GPCR2 = SPITZ_GPIO_G2_STROBE_BIT;
|
|
|
|
GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
|
|
|
|
GPCR3 = SPITZ_GPIO_G3_STROBE_BIT;
|
|
|
|
GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void spitzkbd_activate_all(void)
|
|
|
|
{
|
|
|
|
/* STROBE ALL -> High */
|
|
|
|
GPSR0 = SPITZ_GPIO_G0_STROBE_BIT;
|
|
|
|
GPDR0 |= SPITZ_GPIO_G0_STROBE_BIT;
|
|
|
|
GPSR1 = SPITZ_GPIO_G1_STROBE_BIT;
|
|
|
|
GPDR1 |= SPITZ_GPIO_G1_STROBE_BIT;
|
|
|
|
GPSR2 = SPITZ_GPIO_G2_STROBE_BIT;
|
|
|
|
GPDR2 |= SPITZ_GPIO_G2_STROBE_BIT;
|
|
|
|
GPSR3 = SPITZ_GPIO_G3_STROBE_BIT;
|
|
|
|
GPDR3 |= SPITZ_GPIO_G3_STROBE_BIT;
|
|
|
|
|
|
|
|
udelay(KB_DISCHARGE_DELAY);
|
|
|
|
|
|
|
|
/* Clear any interrupts we may have triggered when altering the GPIO lines */
|
|
|
|
GEDR0 = SPITZ_GPIO_G0_SENSE_BIT;
|
|
|
|
GEDR1 = SPITZ_GPIO_G1_SENSE_BIT;
|
|
|
|
GEDR2 = SPITZ_GPIO_G2_SENSE_BIT;
|
|
|
|
GEDR3 = SPITZ_GPIO_G3_SENSE_BIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void spitzkbd_activate_col(int col)
|
|
|
|
{
|
|
|
|
int gpio = spitz_strobes[col];
|
|
|
|
GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
|
|
|
|
GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
|
|
|
|
GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
|
|
|
|
GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
|
|
|
|
GPSR(gpio) = GPIO_bit(gpio);
|
|
|
|
GPDR(gpio) |= GPIO_bit(gpio);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void spitzkbd_reset_col(int col)
|
|
|
|
{
|
|
|
|
int gpio = spitz_strobes[col];
|
|
|
|
GPDR0 &= ~SPITZ_GPIO_G0_STROBE_BIT;
|
|
|
|
GPDR1 &= ~SPITZ_GPIO_G1_STROBE_BIT;
|
|
|
|
GPDR2 &= ~SPITZ_GPIO_G2_STROBE_BIT;
|
|
|
|
GPDR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
|
|
|
|
GPCR(gpio) = GPIO_bit(gpio);
|
|
|
|
GPDR(gpio) |= GPIO_bit(gpio);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int spitzkbd_get_row_status(int col)
|
|
|
|
{
|
|
|
|
return ((GPLR0 >> 12) & 0x01) | ((GPLR0 >> 16) & 0x02)
|
|
|
|
| ((GPLR2 >> 25) & 0x04) | ((GPLR1 << 1) & 0x08)
|
|
|
|
| ((GPLR1 >> 0) & 0x10) | ((GPLR1 >> 1) & 0x60);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The spitz keyboard only generates interrupts when a key is pressed.
|
|
|
|
* When a key is pressed, we enable a timer which then scans the
|
|
|
|
* keyboard to detect when the key is released.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Scan the hardware keyboard and push any changes up through the input layer */
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 13:55:46 +00:00
|
|
|
static void spitzkbd_scankeyboard(struct spitzkbd *spitzkbd_data)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
|
|
|
unsigned int row, col, rowd;
|
|
|
|
unsigned long flags;
|
|
|
|
unsigned int num_pressed, pwrkey = ((GPLR(SPITZ_GPIO_ON_KEY) & GPIO_bit(SPITZ_GPIO_ON_KEY)) != 0);
|
|
|
|
|
|
|
|
if (spitzkbd_data->suspended)
|
|
|
|
return;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&spitzkbd_data->lock, flags);
|
|
|
|
|
|
|
|
num_pressed = 0;
|
|
|
|
for (col = 0; col < KB_COLS; col++) {
|
|
|
|
/*
|
|
|
|
* Discharge the output driver capacitatance
|
|
|
|
* in the keyboard matrix. (Yes it is significant..)
|
|
|
|
*/
|
|
|
|
|
|
|
|
spitzkbd_discharge_all();
|
|
|
|
udelay(KB_DISCHARGE_DELAY);
|
|
|
|
|
|
|
|
spitzkbd_activate_col(col);
|
|
|
|
udelay(KB_ACTIVATE_DELAY);
|
|
|
|
|
|
|
|
rowd = spitzkbd_get_row_status(col);
|
|
|
|
for (row = 0; row < KB_ROWS; row++) {
|
|
|
|
unsigned int scancode, pressed;
|
|
|
|
|
|
|
|
scancode = SCANCODE(row, col);
|
|
|
|
pressed = rowd & KB_ROWMASK(row);
|
|
|
|
|
2005-09-15 07:01:45 +00:00
|
|
|
input_report_key(spitzkbd_data->input, spitzkbd_data->keycode[scancode], pressed);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
if (pressed)
|
|
|
|
num_pressed++;
|
|
|
|
}
|
|
|
|
spitzkbd_reset_col(col);
|
|
|
|
}
|
|
|
|
|
|
|
|
spitzkbd_activate_all();
|
|
|
|
|
2005-09-15 07:01:45 +00:00
|
|
|
input_report_key(spitzkbd_data->input, SPITZ_KEY_SYNC, (GPLR(SPITZ_GPIO_SYNC) & GPIO_bit(SPITZ_GPIO_SYNC)) != 0 );
|
|
|
|
input_report_key(spitzkbd_data->input, KEY_SUSPEND, pwrkey);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
if (pwrkey && time_after(jiffies, spitzkbd_data->suspend_jiffies + msecs_to_jiffies(1000))) {
|
2005-09-15 07:01:45 +00:00
|
|
|
input_event(spitzkbd_data->input, EV_PWR, KEY_SUSPEND, 1);
|
2005-09-13 08:25:35 +00:00
|
|
|
spitzkbd_data->suspend_jiffies = jiffies;
|
|
|
|
}
|
|
|
|
|
2005-09-15 07:01:45 +00:00
|
|
|
input_sync(spitzkbd_data->input);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
/* if any keys are pressed, enable the timer */
|
|
|
|
if (num_pressed)
|
2006-03-14 05:12:32 +00:00
|
|
|
mod_timer(&spitzkbd_data->timer, jiffies + msecs_to_jiffies(SCAN_INTERVAL));
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
spin_unlock_irqrestore(&spitzkbd_data->lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* spitz keyboard interrupt handler.
|
|
|
|
*/
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 13:55:46 +00:00
|
|
|
static irqreturn_t spitzkbd_interrupt(int irq, void *dev_id)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
|
|
|
struct spitzkbd *spitzkbd_data = dev_id;
|
|
|
|
|
|
|
|
if (!timer_pending(&spitzkbd_data->timer)) {
|
|
|
|
/** wait chattering delay **/
|
|
|
|
udelay(20);
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 13:55:46 +00:00
|
|
|
spitzkbd_scankeyboard(spitzkbd_data);
|
2005-09-13 08:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* spitz timer checking for released keys
|
|
|
|
*/
|
|
|
|
static void spitzkbd_timer_callback(unsigned long data)
|
|
|
|
{
|
|
|
|
struct spitzkbd *spitzkbd_data = (struct spitzkbd *) data;
|
2005-09-15 07:01:45 +00:00
|
|
|
|
2006-10-15 12:50:02 +00:00
|
|
|
spitzkbd_scankeyboard(spitzkbd_data);
|
2005-09-13 08:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The hinge switches generate an interrupt.
|
|
|
|
* We debounce the switches and pass them to the input system.
|
|
|
|
*/
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 13:55:46 +00:00
|
|
|
static irqreturn_t spitzkbd_hinge_isr(int irq, void *dev_id)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
|
|
|
struct spitzkbd *spitzkbd_data = dev_id;
|
|
|
|
|
|
|
|
if (!timer_pending(&spitzkbd_data->htimer))
|
|
|
|
mod_timer(&spitzkbd_data->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define HINGE_STABLE_COUNT 2
|
|
|
|
static int sharpsl_hinge_state;
|
|
|
|
static int hinge_count;
|
|
|
|
|
|
|
|
static void spitzkbd_hinge_timer(unsigned long data)
|
|
|
|
{
|
|
|
|
struct spitzkbd *spitzkbd_data = (struct spitzkbd *) data;
|
|
|
|
unsigned long state;
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
state = GPLR(SPITZ_GPIO_SWA) & (GPIO_bit(SPITZ_GPIO_SWA)|GPIO_bit(SPITZ_GPIO_SWB));
|
2006-03-14 05:12:32 +00:00
|
|
|
state |= (GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT));
|
2005-09-13 08:25:35 +00:00
|
|
|
if (state != sharpsl_hinge_state) {
|
|
|
|
hinge_count = 0;
|
|
|
|
sharpsl_hinge_state = state;
|
|
|
|
} else if (hinge_count < HINGE_STABLE_COUNT) {
|
|
|
|
hinge_count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hinge_count >= HINGE_STABLE_COUNT) {
|
|
|
|
spin_lock_irqsave(&spitzkbd_data->lock, flags);
|
|
|
|
|
2006-05-30 03:31:03 +00:00
|
|
|
input_report_switch(spitzkbd_data->input, SW_LID, ((GPLR(SPITZ_GPIO_SWA) & GPIO_bit(SPITZ_GPIO_SWA)) != 0));
|
|
|
|
input_report_switch(spitzkbd_data->input, SW_TABLET_MODE, ((GPLR(SPITZ_GPIO_SWB) & GPIO_bit(SPITZ_GPIO_SWB)) != 0));
|
|
|
|
input_report_switch(spitzkbd_data->input, SW_HEADPHONE_INSERT, ((GPLR(SPITZ_GPIO_AK_INT) & GPIO_bit(SPITZ_GPIO_AK_INT)) != 0));
|
2005-09-15 07:01:45 +00:00
|
|
|
input_sync(spitzkbd_data->input);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
spin_unlock_irqrestore(&spitzkbd_data->lock, flags);
|
|
|
|
} else {
|
|
|
|
mod_timer(&spitzkbd_data->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
2005-11-09 22:32:44 +00:00
|
|
|
static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
2005-10-28 16:52:56 +00:00
|
|
|
int i;
|
2005-11-09 22:32:44 +00:00
|
|
|
struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
|
2005-10-28 16:52:56 +00:00
|
|
|
spitzkbd->suspended = 1;
|
|
|
|
|
|
|
|
/* Set Strobe lines as inputs - *except* strobe line 0 leave this
|
|
|
|
enabled so we can detect a power button press for resume */
|
|
|
|
for (i = 1; i < SPITZ_KEY_STROBE_NUM; i++)
|
|
|
|
pxa_gpio_mode(spitz_strobes[i] | GPIO_IN);
|
|
|
|
|
2005-09-13 08:25:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-11-09 22:32:44 +00:00
|
|
|
static int spitzkbd_resume(struct platform_device *dev)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
2005-10-28 16:52:56 +00:00
|
|
|
int i;
|
2005-11-09 22:32:44 +00:00
|
|
|
struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
2005-10-28 16:52:56 +00:00
|
|
|
for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
|
|
|
|
pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
|
|
|
|
|
|
|
|
/* Upon resume, ignore the suspend key for a short while */
|
|
|
|
spitzkbd->suspend_jiffies = jiffies;
|
|
|
|
spitzkbd->suspended = 0;
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define spitzkbd_suspend NULL
|
|
|
|
#define spitzkbd_resume NULL
|
|
|
|
#endif
|
|
|
|
|
2005-11-09 22:32:44 +00:00
|
|
|
static int __init spitzkbd_probe(struct platform_device *dev)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
|
|
|
struct spitzkbd *spitzkbd;
|
2005-09-15 07:01:45 +00:00
|
|
|
struct input_dev *input_dev;
|
2006-11-06 03:39:56 +00:00
|
|
|
int i, err = -ENOMEM;
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
spitzkbd = kzalloc(sizeof(struct spitzkbd), GFP_KERNEL);
|
2005-09-15 07:01:45 +00:00
|
|
|
input_dev = input_allocate_device();
|
2006-11-06 03:39:56 +00:00
|
|
|
if (!spitzkbd || !input_dev)
|
|
|
|
goto fail;
|
2005-09-15 07:01:45 +00:00
|
|
|
|
2005-11-09 22:32:44 +00:00
|
|
|
platform_set_drvdata(dev, spitzkbd);
|
2005-09-13 08:25:35 +00:00
|
|
|
strcpy(spitzkbd->phys, "spitzkbd/input0");
|
|
|
|
|
|
|
|
spin_lock_init(&spitzkbd->lock);
|
|
|
|
|
|
|
|
/* Init Keyboard rescan timer */
|
|
|
|
init_timer(&spitzkbd->timer);
|
|
|
|
spitzkbd->timer.function = spitzkbd_timer_callback;
|
|
|
|
spitzkbd->timer.data = (unsigned long) spitzkbd;
|
|
|
|
|
|
|
|
/* Init Hinge Timer */
|
|
|
|
init_timer(&spitzkbd->htimer);
|
|
|
|
spitzkbd->htimer.function = spitzkbd_hinge_timer;
|
|
|
|
spitzkbd->htimer.data = (unsigned long) spitzkbd;
|
|
|
|
|
2005-09-15 07:01:45 +00:00
|
|
|
spitzkbd->suspend_jiffies = jiffies;
|
|
|
|
|
|
|
|
spitzkbd->input = input_dev;
|
|
|
|
|
|
|
|
input_dev->name = "Spitz Keyboard";
|
|
|
|
input_dev->phys = spitzkbd->phys;
|
2007-04-12 05:34:58 +00:00
|
|
|
input_dev->dev.parent = &dev->dev;
|
2005-09-15 07:01:45 +00:00
|
|
|
|
|
|
|
input_dev->id.bustype = BUS_HOST;
|
|
|
|
input_dev->id.vendor = 0x0001;
|
|
|
|
input_dev->id.product = 0x0001;
|
|
|
|
input_dev->id.version = 0x0100;
|
|
|
|
|
2007-10-19 06:40:32 +00:00
|
|
|
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
|
|
|
|
BIT_MASK(EV_PWR) | BIT_MASK(EV_SW);
|
2005-09-15 07:01:45 +00:00
|
|
|
input_dev->keycode = spitzkbd->keycode;
|
|
|
|
input_dev->keycodesize = sizeof(unsigned char);
|
|
|
|
input_dev->keycodemax = ARRAY_SIZE(spitzkbd_keycode);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
memcpy(spitzkbd->keycode, spitzkbd_keycode, sizeof(spitzkbd->keycode));
|
|
|
|
for (i = 0; i < ARRAY_SIZE(spitzkbd_keycode); i++)
|
2005-09-15 07:01:45 +00:00
|
|
|
set_bit(spitzkbd->keycode[i], input_dev->keybit);
|
|
|
|
clear_bit(0, input_dev->keybit);
|
2008-01-03 15:46:13 +00:00
|
|
|
set_bit(KEY_SUSPEND, input_dev->keybit);
|
2006-05-30 03:31:03 +00:00
|
|
|
set_bit(SW_LID, input_dev->swbit);
|
|
|
|
set_bit(SW_TABLET_MODE, input_dev->swbit);
|
|
|
|
set_bit(SW_HEADPHONE_INSERT, input_dev->swbit);
|
2005-09-15 07:01:45 +00:00
|
|
|
|
2006-11-06 03:39:56 +00:00
|
|
|
err = input_register_device(input_dev);
|
|
|
|
if (err)
|
|
|
|
goto fail;
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
mod_timer(&spitzkbd->htimer, jiffies + msecs_to_jiffies(HINGE_SCAN_INTERVAL));
|
|
|
|
|
|
|
|
/* Setup sense interrupts - RisingEdge Detect, sense lines as inputs */
|
|
|
|
for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) {
|
|
|
|
pxa_gpio_mode(spitz_senses[i] | GPIO_IN);
|
|
|
|
if (request_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd_interrupt,
|
2006-07-02 02:29:38 +00:00
|
|
|
IRQF_DISABLED|IRQF_TRIGGER_RISING,
|
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 09:02:07 +00:00
|
|
|
"Spitzkbd Sense", spitzkbd))
|
2005-09-13 08:25:35 +00:00
|
|
|
printk(KERN_WARNING "spitzkbd: Can't get Sense IRQ: %d!\n", i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set Strobe lines as outputs - set high */
|
|
|
|
for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
|
|
|
|
pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
|
|
|
|
|
|
|
|
pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
|
|
|
|
pxa_gpio_mode(SPITZ_GPIO_ON_KEY | GPIO_IN);
|
|
|
|
pxa_gpio_mode(SPITZ_GPIO_SWA | GPIO_IN);
|
|
|
|
pxa_gpio_mode(SPITZ_GPIO_SWB | GPIO_IN);
|
|
|
|
|
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 09:02:07 +00:00
|
|
|
request_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd_interrupt,
|
2006-07-02 02:29:38 +00:00
|
|
|
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 09:02:07 +00:00
|
|
|
"Spitzkbd Sync", spitzkbd);
|
|
|
|
request_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd_interrupt,
|
2006-07-02 02:29:38 +00:00
|
|
|
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 09:02:07 +00:00
|
|
|
"Spitzkbd PwrOn", spitzkbd);
|
|
|
|
request_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd_hinge_isr,
|
2006-07-02 02:29:38 +00:00
|
|
|
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 09:02:07 +00:00
|
|
|
"Spitzkbd SWA", spitzkbd);
|
|
|
|
request_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd_hinge_isr,
|
2006-07-02 02:29:38 +00:00
|
|
|
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
[PATCH] IRQ type flags
Some ARM platforms have the ability to program the interrupt controller to
detect various interrupt edges and/or levels. For some platforms, this is
critical to setup correctly, particularly those which the setting is dependent
on the device.
Currently, ARM drivers do (eg) the following:
err = request_irq(irq, ...);
set_irq_type(irq, IRQT_RISING);
However, if the interrupt has previously been programmed to be level sensitive
(for whatever reason) then this will cause an interrupt storm.
Hence, if we combine set_irq_type() with request_irq(), we can then safely set
the type prior to unmasking the interrupt. The unfortunate problem is that in
order to support this, these flags need to be visible outside of the ARM
architecture - drivers such as smc91x need these flags and they're
cross-architecture.
Finally, the SA_TRIGGER_* flag passed to request_irq() should reflect the
property that the device would like. The IRQ controller code should do its
best to select the most appropriate supported mode.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 09:02:07 +00:00
|
|
|
"Spitzkbd SWB", spitzkbd);
|
2006-11-06 03:39:56 +00:00
|
|
|
request_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd_hinge_isr,
|
2006-07-02 02:29:38 +00:00
|
|
|
IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
2006-03-14 05:12:32 +00:00
|
|
|
"Spitzkbd HP", spitzkbd);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-11-06 03:39:56 +00:00
|
|
|
|
|
|
|
fail: input_free_device(input_dev);
|
|
|
|
kfree(spitzkbd);
|
|
|
|
return err;
|
2005-09-13 08:25:35 +00:00
|
|
|
}
|
|
|
|
|
2005-11-09 22:32:44 +00:00
|
|
|
static int spitzkbd_remove(struct platform_device *dev)
|
2005-09-13 08:25:35 +00:00
|
|
|
{
|
|
|
|
int i;
|
2005-11-09 22:32:44 +00:00
|
|
|
struct spitzkbd *spitzkbd = platform_get_drvdata(dev);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++)
|
|
|
|
free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd);
|
|
|
|
|
|
|
|
free_irq(SPITZ_IRQ_GPIO_SYNC, spitzkbd);
|
|
|
|
free_irq(SPITZ_IRQ_GPIO_ON_KEY, spitzkbd);
|
|
|
|
free_irq(SPITZ_IRQ_GPIO_SWA, spitzkbd);
|
|
|
|
free_irq(SPITZ_IRQ_GPIO_SWB, spitzkbd);
|
2006-03-14 05:12:32 +00:00
|
|
|
free_irq(SPITZ_IRQ_GPIO_AK_INT, spitzkbd);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
del_timer_sync(&spitzkbd->htimer);
|
|
|
|
del_timer_sync(&spitzkbd->timer);
|
|
|
|
|
2005-09-15 07:01:45 +00:00
|
|
|
input_unregister_device(spitzkbd->input);
|
2005-09-13 08:25:35 +00:00
|
|
|
|
|
|
|
kfree(spitzkbd);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-11-09 22:32:44 +00:00
|
|
|
static struct platform_driver spitzkbd_driver = {
|
2005-09-13 08:25:35 +00:00
|
|
|
.probe = spitzkbd_probe,
|
|
|
|
.remove = spitzkbd_remove,
|
|
|
|
.suspend = spitzkbd_suspend,
|
|
|
|
.resume = spitzkbd_resume,
|
2005-11-09 22:32:44 +00:00
|
|
|
.driver = {
|
|
|
|
.name = "spitz-keyboard",
|
2006-11-06 03:39:56 +00:00
|
|
|
.owner = THIS_MODULE,
|
2005-11-09 22:32:44 +00:00
|
|
|
},
|
2005-09-13 08:25:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __devinit spitzkbd_init(void)
|
|
|
|
{
|
2005-11-09 22:32:44 +00:00
|
|
|
return platform_driver_register(&spitzkbd_driver);
|
2005-09-13 08:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit spitzkbd_exit(void)
|
|
|
|
{
|
2005-11-09 22:32:44 +00:00
|
|
|
platform_driver_unregister(&spitzkbd_driver);
|
2005-09-13 08:25:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(spitzkbd_init);
|
|
|
|
module_exit(spitzkbd_exit);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Richard Purdie <rpurdie@rpsys.net>");
|
|
|
|
MODULE_DESCRIPTION("Spitz Keyboard Driver");
|
2008-05-21 05:32:11 +00:00
|
|
|
MODULE_LICENSE("GPL v2");
|
2008-04-18 04:24:42 +00:00
|
|
|
MODULE_ALIAS("platform:spitz-keyboard");
|