2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* linux/drivers/hil/hilkbd.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 1998 Philip Blundell <philb@gnu.org>
|
|
|
|
* Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai>
|
2007-02-28 21:51:19 -07:00
|
|
|
* Copyright (C) 1999-2007 Helge Deller <deller@gmx.de>
|
2005-04-16 16:20:36 -06:00
|
|
|
*
|
|
|
|
* Very basic HP Human Interface Loop (HIL) driver.
|
2007-02-09 23:29:19 -07:00
|
|
|
* This driver handles the keyboard on HP300 (m68k) and on some
|
2005-04-16 16:20:36 -06:00
|
|
|
* HP700 (parisc) series machines.
|
|
|
|
*
|
2007-02-09 23:29:19 -07:00
|
|
|
*
|
2005-04-16 16:20:36 -06:00
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License version 2. See the file COPYING in the main directory of this
|
|
|
|
* archive for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/pci_ids.h>
|
|
|
|
#include <linux/ioport.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/input.h>
|
|
|
|
#include <linux/init.h>
|
2005-10-21 20:58:51 -06:00
|
|
|
#include <linux/interrupt.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
#include <linux/hil.h>
|
2006-12-13 01:35:01 -07:00
|
|
|
#include <linux/io.h>
|
2009-10-07 07:09:06 -06:00
|
|
|
#include <linux/sched.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
#include <linux/spinlock.h>
|
2006-12-13 01:35:01 -07:00
|
|
|
#include <asm/irq.h>
|
|
|
|
#ifdef CONFIG_HP300
|
|
|
|
#include <asm/hwtest.h>
|
|
|
|
#endif
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Philip Blundell, Matthew Wilcox, Helge Deller");
|
|
|
|
MODULE_DESCRIPTION("HIL keyboard driver (basic functionality)");
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(CONFIG_PARISC)
|
|
|
|
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/hardware.h>
|
|
|
|
#include <asm/parisc-device.h>
|
|
|
|
static unsigned long hil_base; /* HPA for the HIL device */
|
|
|
|
static unsigned int hil_irq;
|
|
|
|
#define HILBASE hil_base /* HPPA (parisc) port address */
|
|
|
|
#define HIL_DATA 0x800
|
|
|
|
#define HIL_CMD 0x801
|
|
|
|
#define HIL_IRQ hil_irq
|
|
|
|
#define hil_readb(p) gsc_readb(p)
|
|
|
|
#define hil_writeb(v,p) gsc_writeb((v),(p))
|
|
|
|
|
|
|
|
#elif defined(CONFIG_HP300)
|
|
|
|
|
2007-05-01 14:32:44 -06:00
|
|
|
#define HILBASE 0xf0428000UL /* HP300 (m68k) port address */
|
2005-04-16 16:20:36 -06:00
|
|
|
#define HIL_DATA 0x1
|
|
|
|
#define HIL_CMD 0x3
|
|
|
|
#define HIL_IRQ 2
|
|
|
|
#define hil_readb(p) readb(p)
|
|
|
|
#define hil_writeb(v,p) writeb((v),(p))
|
|
|
|
|
|
|
|
#else
|
|
|
|
#error "HIL is not supported on this platform"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/* HIL helper functions */
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#define hil_busy() (hil_readb(HILBASE + HIL_CMD) & HIL_BUSY)
|
|
|
|
#define hil_data_available() (hil_readb(HILBASE + HIL_CMD) & HIL_DATA_RDY)
|
|
|
|
#define hil_status() (hil_readb(HILBASE + HIL_CMD))
|
|
|
|
#define hil_command(x) do { hil_writeb((x), HILBASE + HIL_CMD); } while (0)
|
|
|
|
#define hil_read_data() (hil_readb(HILBASE + HIL_DATA))
|
|
|
|
#define hil_write_data(x) do { hil_writeb((x), HILBASE + HIL_DATA); } while (0)
|
|
|
|
|
|
|
|
/* HIL constants */
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#define HIL_BUSY 0x02
|
|
|
|
#define HIL_DATA_RDY 0x01
|
|
|
|
|
|
|
|
#define HIL_SETARD 0xA0 /* set auto-repeat delay */
|
|
|
|
#define HIL_SETARR 0xA2 /* set auto-repeat rate */
|
|
|
|
#define HIL_SETTONE 0xA3 /* set tone generator */
|
|
|
|
#define HIL_CNMT 0xB2 /* clear nmi */
|
|
|
|
#define HIL_INTON 0x5C /* Turn on interrupts. */
|
|
|
|
#define HIL_INTOFF 0x5D /* Turn off interrupts. */
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
#define HIL_READKBDSADR 0xF9
|
|
|
|
#define HIL_WRITEKBDSADR 0xE9
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2007-02-28 21:51:19 -07:00
|
|
|
static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly =
|
2005-04-16 16:20:36 -06:00
|
|
|
{ HIL_KEYCODES_SET1 };
|
|
|
|
|
|
|
|
/* HIL structure */
|
|
|
|
static struct {
|
2006-03-26 07:41:55 -07:00
|
|
|
struct input_dev *dev;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
unsigned int curdev;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
unsigned char s;
|
|
|
|
unsigned char c;
|
|
|
|
int valid;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
unsigned char data[16];
|
|
|
|
unsigned int ptr;
|
|
|
|
spinlock_t lock;
|
|
|
|
|
|
|
|
void *dev_id; /* native bus device */
|
|
|
|
} hil_dev;
|
|
|
|
|
|
|
|
|
|
|
|
static void poll_finished(void)
|
|
|
|
{
|
|
|
|
int down;
|
|
|
|
int key;
|
|
|
|
unsigned char scode;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
switch (hil_dev.data[0]) {
|
|
|
|
case 0x40:
|
|
|
|
down = (hil_dev.data[1] & 1) == 0;
|
|
|
|
scode = hil_dev.data[1] >> 1;
|
|
|
|
key = hphilkeyb_keycode[scode];
|
2006-03-26 07:41:55 -07:00
|
|
|
input_report_key(hil_dev.dev, key, down);
|
2005-04-16 16:20:36 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
hil_dev.curdev = 0;
|
|
|
|
}
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
static inline void handle_status(unsigned char s, unsigned char c)
|
|
|
|
{
|
|
|
|
if (c & 0x8) {
|
|
|
|
/* End of block */
|
|
|
|
if (c & 0x10)
|
|
|
|
poll_finished();
|
|
|
|
} else {
|
|
|
|
if (c & 0x10) {
|
|
|
|
if (hil_dev.curdev)
|
|
|
|
poll_finished(); /* just in case */
|
|
|
|
hil_dev.curdev = c & 7;
|
|
|
|
hil_dev.ptr = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
static inline void handle_data(unsigned char s, unsigned char c)
|
|
|
|
{
|
|
|
|
if (hil_dev.curdev) {
|
|
|
|
hil_dev.data[hil_dev.ptr++] = c;
|
|
|
|
hil_dev.ptr &= 15;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
/* handle HIL interrupts */
|
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 07:55:46 -06:00
|
|
|
static irqreturn_t hil_interrupt(int irq, void *handle)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
unsigned char s, c;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
s = hil_status();
|
|
|
|
c = hil_read_data();
|
|
|
|
|
|
|
|
switch (s >> 4) {
|
|
|
|
case 0x5:
|
|
|
|
handle_status(s, c);
|
|
|
|
break;
|
|
|
|
case 0x6:
|
|
|
|
handle_data(s, c);
|
|
|
|
break;
|
|
|
|
case 0x4:
|
|
|
|
hil_dev.s = s;
|
|
|
|
hil_dev.c = c;
|
|
|
|
mb();
|
|
|
|
hil_dev.valid = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
/* send a command to the HIL */
|
2005-04-16 16:20:36 -06:00
|
|
|
static void hil_do(unsigned char cmd, unsigned char *data, unsigned int len)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&hil_dev.lock, flags);
|
|
|
|
while (hil_busy())
|
|
|
|
/* wait */;
|
|
|
|
hil_command(cmd);
|
|
|
|
while (len--) {
|
|
|
|
while (hil_busy())
|
|
|
|
/* wait */;
|
|
|
|
hil_write_data(*(data++));
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&hil_dev.lock, flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
/* initialize HIL */
|
2012-11-23 22:38:25 -07:00
|
|
|
static int hil_keyb_init(void)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
unsigned char c;
|
|
|
|
unsigned int i, kbid;
|
|
|
|
wait_queue_head_t hil_wait;
|
2007-02-09 23:29:19 -07:00
|
|
|
int err;
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
if (hil_dev.dev)
|
2005-04-16 16:20:36 -06:00
|
|
|
return -ENODEV; /* already initialized */
|
2006-03-26 07:41:55 -07:00
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
init_waitqueue_head(&hil_wait);
|
2007-02-28 21:51:19 -07:00
|
|
|
spin_lock_init(&hil_dev.lock);
|
2009-03-05 00:27:15 -07:00
|
|
|
|
2006-03-26 07:41:55 -07:00
|
|
|
hil_dev.dev = input_allocate_device();
|
|
|
|
if (!hil_dev.dev)
|
|
|
|
return -ENOMEM;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
|
|
|
err = request_irq(HIL_IRQ, hil_interrupt, 0, "hil", hil_dev.dev_id);
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "HIL: Can't get IRQ\n");
|
2009-03-05 00:27:15 -07:00
|
|
|
goto err1;
|
2007-02-09 23:29:19 -07:00
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
/* Turn on interrupts */
|
|
|
|
hil_do(HIL_INTON, NULL, 0);
|
|
|
|
|
|
|
|
/* Look for keyboards */
|
|
|
|
hil_dev.valid = 0; /* clear any pending data */
|
|
|
|
hil_do(HIL_READKBDSADR, NULL, 0);
|
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
wait_event_interruptible_timeout(hil_wait, hil_dev.valid, 3 * HZ);
|
|
|
|
if (!hil_dev.valid)
|
2007-02-09 23:29:19 -07:00
|
|
|
printk(KERN_WARNING "HIL: timed out, assuming no keyboard present\n");
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
c = hil_dev.c;
|
2005-04-16 16:20:36 -06:00
|
|
|
hil_dev.valid = 0;
|
|
|
|
if (c == 0) {
|
|
|
|
kbid = -1;
|
2007-02-09 23:29:19 -07:00
|
|
|
printk(KERN_WARNING "HIL: no keyboard present\n");
|
2005-04-16 16:20:36 -06:00
|
|
|
} else {
|
|
|
|
kbid = ffz(~c);
|
2007-02-09 23:29:19 -07:00
|
|
|
printk(KERN_INFO "HIL: keyboard found at id %d\n", kbid);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set it to raw mode */
|
|
|
|
c = 0;
|
|
|
|
hil_do(HIL_WRITEKBDSADR, &c, 1);
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
for (i = 0; i < HIL_KEYCODES_SET1_TBLSIZE; i++)
|
|
|
|
if (hphilkeyb_keycode[i] != KEY_RESERVED)
|
2009-03-05 00:27:15 -07:00
|
|
|
__set_bit(hphilkeyb_keycode[i], hil_dev.dev->keybit);
|
2006-03-26 07:41:55 -07:00
|
|
|
|
2007-10-19 00:40:32 -06:00
|
|
|
hil_dev.dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
|
|
|
|
hil_dev.dev->ledbit[0] = BIT_MASK(LED_NUML) | BIT_MASK(LED_CAPSL) |
|
|
|
|
BIT_MASK(LED_SCROLLL);
|
2007-02-09 23:29:19 -07:00
|
|
|
hil_dev.dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE;
|
|
|
|
hil_dev.dev->keycodesize= sizeof(hphilkeyb_keycode[0]);
|
|
|
|
hil_dev.dev->keycode = hphilkeyb_keycode;
|
|
|
|
hil_dev.dev->name = "HIL keyboard";
|
|
|
|
hil_dev.dev->phys = "hpkbd/input0";
|
2006-03-26 07:41:55 -07:00
|
|
|
|
|
|
|
hil_dev.dev->id.bustype = BUS_HIL;
|
|
|
|
hil_dev.dev->id.vendor = PCI_VENDOR_ID_HP;
|
|
|
|
hil_dev.dev->id.product = 0x0001;
|
|
|
|
hil_dev.dev->id.version = 0x0010;
|
|
|
|
|
2007-02-09 23:29:19 -07:00
|
|
|
err = input_register_device(hil_dev.dev);
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "HIL: Can't register device\n");
|
2009-03-05 00:27:15 -07:00
|
|
|
goto err2;
|
2007-02-09 23:29:19 -07:00
|
|
|
}
|
2009-03-05 00:27:15 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
printk(KERN_INFO "input: %s, ID %d at 0x%08lx (irq %d) found and attached\n",
|
2007-02-09 23:29:19 -07:00
|
|
|
hil_dev.dev->name, kbid, HILBASE, HIL_IRQ);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
return 0;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
err2:
|
2007-02-09 23:29:19 -07:00
|
|
|
hil_do(HIL_INTOFF, NULL, 0);
|
|
|
|
free_irq(HIL_IRQ, hil_dev.dev_id);
|
|
|
|
err1:
|
|
|
|
input_free_device(hil_dev.dev);
|
|
|
|
hil_dev.dev = NULL;
|
|
|
|
return err;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2012-11-23 22:50:47 -07:00
|
|
|
static void hil_keyb_exit(void)
|
2009-03-05 00:27:15 -07:00
|
|
|
{
|
|
|
|
if (HIL_IRQ)
|
|
|
|
free_irq(HIL_IRQ, hil_dev.dev_id);
|
|
|
|
|
|
|
|
/* Turn off interrupts */
|
|
|
|
hil_do(HIL_INTOFF, NULL, 0);
|
|
|
|
|
|
|
|
input_unregister_device(hil_dev.dev);
|
|
|
|
hil_dev.dev = NULL;
|
|
|
|
}
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#if defined(CONFIG_PARISC)
|
2012-11-23 22:38:25 -07:00
|
|
|
static int hil_probe_chip(struct parisc_device *dev)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2009-03-05 00:27:15 -07:00
|
|
|
/* Only allow one HIL keyboard */
|
|
|
|
if (hil_dev.dev)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
if (!dev->irq) {
|
2009-03-05 00:27:15 -07:00
|
|
|
printk(KERN_WARNING "HIL: IRQ not found for HIL bus at 0x%p\n",
|
|
|
|
(void *)dev->hpa.start);
|
2005-04-16 16:20:36 -06:00
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2005-10-21 20:36:40 -06:00
|
|
|
hil_base = dev->hpa.start;
|
2005-04-16 16:20:36 -06:00
|
|
|
hil_irq = dev->irq;
|
|
|
|
hil_dev.dev_id = dev;
|
2007-02-09 23:29:19 -07:00
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
printk(KERN_INFO "Found HIL bus at 0x%08lx, IRQ %d\n", hil_base, hil_irq);
|
|
|
|
|
|
|
|
return hil_keyb_init();
|
|
|
|
}
|
|
|
|
|
2012-11-23 22:50:47 -07:00
|
|
|
static int hil_remove_chip(struct parisc_device *dev)
|
2009-03-05 00:27:15 -07:00
|
|
|
{
|
|
|
|
hil_keyb_exit();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
static struct parisc_device_id hil_tbl[] = {
|
|
|
|
{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00073 },
|
|
|
|
{ 0, }
|
|
|
|
};
|
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
#if 0
|
|
|
|
/* Disabled to avoid conflicts with the HP SDC HIL drivers */
|
2005-04-16 16:20:36 -06:00
|
|
|
MODULE_DEVICE_TABLE(parisc, hil_tbl);
|
2009-03-05 00:27:15 -07:00
|
|
|
#endif
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
static struct parisc_driver hil_driver = {
|
2009-03-05 00:27:15 -07:00
|
|
|
.name = "hil",
|
|
|
|
.id_table = hil_tbl,
|
|
|
|
.probe = hil_probe_chip,
|
2012-11-23 22:27:39 -07:00
|
|
|
.remove = hil_remove_chip,
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init hil_init(void)
|
|
|
|
{
|
|
|
|
return register_parisc_driver(&hil_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit hil_exit(void)
|
|
|
|
{
|
2009-03-05 00:27:15 -07:00
|
|
|
unregister_parisc_driver(&hil_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* !CONFIG_PARISC */
|
|
|
|
|
|
|
|
static int __init hil_init(void)
|
|
|
|
{
|
|
|
|
int error;
|
|
|
|
|
|
|
|
/* Only allow one HIL keyboard */
|
|
|
|
if (hil_dev.dev)
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
if (!MACH_IS_HP300)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
if (!hwreg_present((void *)(HILBASE + HIL_DATA))) {
|
|
|
|
printk(KERN_ERR "HIL: hardware register was not found\n");
|
|
|
|
return -ENODEV;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
if (!request_region(HILBASE + HIL_DATA, 2, "hil")) {
|
|
|
|
printk(KERN_ERR "HIL: IOPORT region already used\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
error = hil_keyb_init();
|
|
|
|
if (error) {
|
|
|
|
release_region(HILBASE + HIL_DATA, 2);
|
|
|
|
return error;
|
|
|
|
}
|
2006-03-26 07:41:55 -07:00
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
return 0;
|
|
|
|
}
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
static void __exit hil_exit(void)
|
|
|
|
{
|
|
|
|
hil_keyb_exit();
|
|
|
|
release_region(HILBASE + HIL_DATA, 2);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2009-03-05 00:27:15 -07:00
|
|
|
#endif /* CONFIG_PARISC */
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
module_init(hil_init);
|
|
|
|
module_exit(hil_exit);
|