Commit a3d52136 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input

* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input: (65 commits)
  Input: gpio_keys - add support for switches (EV_SW)
  Input: cobalt_btns - convert to use polldev library
  Input: add skeleton for simple polled devices
  Input: update some documentation
  Input: wistron - fix typo in keymap for Acer TM610
  Input: add input_set_capability() helper
  Input: i8042 - add Fujitsu touchscreen/touchpad PNP IDs
  Input: i8042 - add Panasonic CF-29 to nomux list
  Input: lifebook - split into 2 devices
  Input: lifebook - add signature of Panasonic CF-29
  Input: lifebook - activate 6-byte protocol on select models
  Input: lifebook - work properly on Panasonic CF-18
  Input: cobalt buttons - separate device and driver registration
  Input: ati_remote - make button repeat sensitivity configurable
  Input: pxa27x - do not use deprecated SA_INTERRUPT flag
  Input: ucb1400 - make delays configurable
  Input: misc devices - switch to using input_dev->dev.parent
  Input: joysticks - switch to using input_dev->dev.parent
  Input: touchscreens - switch to using input_dev->dev.parent
  Input: mice - switch to using input_dev->dev.parent
  ...

Fixed up conflicts with core device model removal of "struct subsystem" manually.
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parents 5b339915 84767d00
$Id: input-programming.txt,v 1.4 2001/05/04 09:47:14 vojtech Exp $
Programming input drivers Programming input drivers
~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
...@@ -20,28 +18,51 @@ pressed or released a BUTTON_IRQ happens. The driver could look like: ...@@ -20,28 +18,51 @@ pressed or released a BUTTON_IRQ happens. The driver could look like:
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/io.h> #include <asm/io.h>
static struct input_dev *button_dev;
static void button_interrupt(int irq, void *dummy, struct pt_regs *fp) static void button_interrupt(int irq, void *dummy, struct pt_regs *fp)
{ {
input_report_key(&button_dev, BTN_1, inb(BUTTON_PORT) & 1); input_report_key(button_dev, BTN_1, inb(BUTTON_PORT) & 1);
input_sync(&button_dev); input_sync(button_dev);
} }
static int __init button_init(void) static int __init button_init(void)
{ {
int error;
if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {
printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq); printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);
return -EBUSY; return -EBUSY;
} }
button_dev.evbit[0] = BIT(EV_KEY); button_dev = input_allocate_device();
button_dev.keybit[LONG(BTN_0)] = BIT(BTN_0); if (!button_dev) {
printk(KERN_ERR "button.c: Not enough memory\n");
error = -ENOMEM;
goto err_free_irq;
}
input_register_device(&button_dev); button_dev->evbit[0] = BIT(EV_KEY);
button_dev->keybit[LONG(BTN_0)] = BIT(BTN_0);
error = input_register_device(button_dev);
if (error) {
printk(KERN_ERR "button.c: Failed to register device\n");
goto err_free_dev;
}
return 0;
err_free_dev:
input_free_device(button_dev);
err_free_irq:
free_irq(BUTTON_IRQ, button_interrupt);
return error;
} }
static void __exit button_exit(void) static void __exit button_exit(void)
{ {
input_unregister_device(&button_dev); input_unregister_device(button_dev);
free_irq(BUTTON_IRQ, button_interrupt); free_irq(BUTTON_IRQ, button_interrupt);
} }
...@@ -58,11 +79,12 @@ In the _init function, which is called either upon module load or when ...@@ -58,11 +79,12 @@ In the _init function, which is called either upon module load or when
booting the kernel, it grabs the required resources (it should also check booting the kernel, it grabs the required resources (it should also check
for the presence of the device). for the presence of the device).
Then it sets the input bitfields. This way the device driver tells the other Then it allocates a new input device structure with input_aloocate_device()
and sets up input bitfields. This way the device driver tells the other
parts of the input systems what it is - what events can be generated or parts of the input systems what it is - what events can be generated or
accepted by this input device. Our example device can only generate EV_KEY type accepted by this input device. Our example device can only generate EV_KEY
events, and from those only BTN_0 event code. Thus we only set these two type events, and from those only BTN_0 event code. Thus we only set these
bits. We could have used two bits. We could have used
set_bit(EV_KEY, button_dev.evbit); set_bit(EV_KEY, button_dev.evbit);
set_bit(BTN_0, button_dev.keybit); set_bit(BTN_0, button_dev.keybit);
...@@ -76,9 +98,8 @@ Then the example driver registers the input device structure by calling ...@@ -76,9 +98,8 @@ Then the example driver registers the input device structure by calling
This adds the button_dev structure to linked lists of the input driver and This adds the button_dev structure to linked lists of the input driver and
calls device handler modules _connect functions to tell them a new input calls device handler modules _connect functions to tell them a new input
device has appeared. Because the _connect functions may call kmalloc(, device has appeared. input_register_device() may sleep and therefore must
GFP_KERNEL), which can sleep, input_register_device() must not be called not be called from an interrupt or with a spinlock held.
from an interrupt or with a spinlock held.
While in use, the only used function of the driver is While in use, the only used function of the driver is
...@@ -113,16 +134,10 @@ can use the open and close callback to know when it can stop polling or ...@@ -113,16 +134,10 @@ can use the open and close callback to know when it can stop polling or
release the interrupt and when it must resume polling or grab the interrupt release the interrupt and when it must resume polling or grab the interrupt
again. To do that, we would add this to our example driver: again. To do that, we would add this to our example driver:
int button_used = 0;
static int button_open(struct input_dev *dev) static int button_open(struct input_dev *dev)
{ {
if (button_used++)
return 0;
if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) { if (request_irq(BUTTON_IRQ, button_interrupt, 0, "button", NULL)) {
printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq); printk(KERN_ERR "button.c: Can't allocate irq %d\n", button_irq);
button_used--;
return -EBUSY; return -EBUSY;
} }
...@@ -131,20 +146,21 @@ static int button_open(struct input_dev *dev) ...@@ -131,20 +146,21 @@ static int button_open(struct input_dev *dev)
static void button_close(struct input_dev *dev) static void button_close(struct input_dev *dev)
{ {
if (!--button_used)
free_irq(IRQ_AMIGA_VERTB, button_interrupt); free_irq(IRQ_AMIGA_VERTB, button_interrupt);
} }
static int __init button_init(void) static int __init button_init(void)
{ {
... ...
button_dev.open = button_open; button_dev->open = button_open;
button_dev.close = button_close; button_dev->close = button_close;
... ...
} }
Note the button_used variable - we have to track how many times the open Note that input core keeps track of number of users for the device and
function was called to know when exactly our device stops being used. makes sure that dev->open() is called only when the first user connects
to the device and that dev->close() is called when the very last user
disconnects. Calls to both callbacks are serialized.
The open() callback should return a 0 in case of success or any nonzero value The open() callback should return a 0 in case of success or any nonzero value
in case of failure. The close() callback (which is void) must always succeed. in case of failure. The close() callback (which is void) must always succeed.
...@@ -187,6 +203,10 @@ the ABS_X axis: ...@@ -187,6 +203,10 @@ the ABS_X axis:
button_dev.absfuzz[ABS_X] = 4; button_dev.absfuzz[ABS_X] = 4;
button_dev.absflat[ABS_X] = 8; button_dev.absflat[ABS_X] = 8;
Or, you can just say:
input_set_abs_params(button_dev, ABS_X, 0, 255, 4, 8);
This setting would be appropriate for a joystick X axis, with the minimum of This setting would be appropriate for a joystick X axis, with the minimum of
0, maximum of 255 (which the joystick *must* be able to reach, no problem if 0, maximum of 255 (which the joystick *must* be able to reach, no problem if
it sometimes reports more, but it must be able to always reach the min and it sometimes reports more, but it must be able to always reach the min and
...@@ -197,14 +217,7 @@ If you don't need absfuzz and absflat, you can set them to zero, which mean ...@@ -197,14 +217,7 @@ If you don't need absfuzz and absflat, you can set them to zero, which mean
that the thing is precise and always returns to exactly the center position that the thing is precise and always returns to exactly the center position
(if it has any). (if it has any).
1.4 The void *private field 1.4 NBITS(), LONG(), BIT()
~~~~~~~~~~~~~~~~~~~~~~~~~~~
This field in the input structure can be used to point to any private data
structures in the input device driver, in case the driver handles more than
one device. You'll need it in the open and close callbacks.
1.5 NBITS(), LONG(), BIT()
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
These three macros from input.h help some bitfield computations: These three macros from input.h help some bitfield computations:
...@@ -213,13 +226,9 @@ These three macros from input.h help some bitfield computations: ...@@ -213,13 +226,9 @@ These three macros from input.h help some bitfield computations:
LONG(x) - returns the index in the array in longs for bit x LONG(x) - returns the index in the array in longs for bit x
BIT(x) - returns the index in a long for bit x BIT(x) - returns the index in a long for bit x
1.6 The number, id* and name fields 1.5 The id* and name fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The dev->number is assigned by the input system to the input device when it
is registered. It has no use except for identifying the device to the user
in system messages.
The dev->name should be set before registering the input device by the input The dev->name should be set before registering the input device by the input
device driver. It's a string like 'Generic button device' containing a device driver. It's a string like 'Generic button device' containing a
user friendly name of the device. user friendly name of the device.
...@@ -234,15 +243,25 @@ driver. ...@@ -234,15 +243,25 @@ driver.
The id and name fields can be passed to userland via the evdev interface. The id and name fields can be passed to userland via the evdev interface.
1.7 The keycode, keycodemax, keycodesize fields 1.6 The keycode, keycodemax, keycodesize fields
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These two fields will be used for any input devices that report their data These three fields should be used by input devices that have dense keymaps.
as scancodes. If not all scancodes can be known by autodetection, they may The keycode is an array used to map from scancodes to input system keycodes.
need to be set by userland utilities. The keycode array then is an array The keycode max should contain the size of the array and keycodesize the
used to map from scancodes to input system keycodes. The keycode max will size of each entry in it (in bytes).
contain the size of the array and keycodesize the size of each entry in it
(in bytes). Userspace can query and alter current scancode to keycode mappings using
EVIOCGKEYCODE and EVIOCSKEYCODE ioctls on corresponding evdev interface.
When a device has all 3 aforementioned fields filled in, the driver may
rely on kernel's default implementation of setting and querying keycode
mappings.
1.7 dev->getkeycode() and dev->setkeycode()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
getkeycode() and setkeycode() callbacks allow drivers to override default
keycode/keycodesize/keycodemax mapping mechanism provided by input core
and implement sparse keycode maps.
1.8 Key autorepeat 1.8 Key autorepeat
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
...@@ -266,7 +285,7 @@ direction - from the system to the input device driver. If your input device ...@@ -266,7 +285,7 @@ direction - from the system to the input device driver. If your input device
driver can handle these events, it has to set the respective bits in evbit, driver can handle these events, it has to set the respective bits in evbit,
*and* also the callback routine: *and* also the callback routine:
button_dev.event = button_event; button_dev->event = button_event;
int button_event(struct input_dev *dev, unsigned int type, unsigned int code, int value); int button_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for the Cobalt micro systems family specific parts of the kernel # Makefile for the Cobalt micro systems family specific parts of the kernel
# #
obj-y := irq.o reset.o setup.o obj-y := irq.o reset.o setup.o buttons.o
obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_EARLY_PRINTK) += console.o obj-$(CONFIG_EARLY_PRINTK) += console.o
......
/*
* Cobalt buttons platform device.
*
* Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/platform_device.h>
#include <linux/errno.h>
#include <linux/init.h>
static struct resource cobalt_buttons_resource __initdata = {
.start = 0x1d000000,
.end = 0x1d000003,
.flags = IORESOURCE_MEM,
};
static __init int cobalt_add_buttons(void)
{
struct platform_device *pd;
int error;
pd = platform_device_alloc("Cobalt buttons", -1);
if (!pd)
return -ENOMEM;
error = platform_device_add_resources(pd, &cobalt_buttons_resource, 1);
if (error)
goto err_free_device;
error = platform_device_add(pd);
if (error)
goto err_free_device;
return 0;
err_free_device:
platform_device_put(pd);
return error;
}
device_initcall(cobalt_add_buttons);
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/reboot.h> #include <linux/reboot.h>
static void kbd_disconnect(struct input_handle *handle);
extern void ctrl_alt_del(void); extern void ctrl_alt_del(void);
/* /*
...@@ -159,65 +158,41 @@ static int sysrq_alt_use; ...@@ -159,65 +158,41 @@ static int sysrq_alt_use;
static int sysrq_alt; static int sysrq_alt;
/* /*
* Translation of scancodes to keycodes. We set them on only the first attached * Translation of scancodes to keycodes. We set them on only the first
* keyboard - for per-keyboard setting, /dev/input/event is more useful. * keyboard in the list that accepts the scancode and keycode.
* Explanation for not choosing the first attached keyboard anymore:
* USB keyboards for example have two event devices: one for all "normal"
* keys and one for extra function keys (like "volume up", "make coffee",
* etc.). So this means that scancodes for the extra function keys won't
* be valid for the first event device, but will be for the second.
*/ */
int getkeycode(unsigned int scancode) int getkeycode(unsigned int scancode)
{ {
struct list_head *node; struct input_handle *handle;
struct input_dev *dev = NULL; int keycode;
int error = -ENODEV;
list_for_each(node, &kbd_handler.h_list) { list_for_each_entry(handle, &kbd_handler.h_list, h_node) {
struct input_handle *handle = to_handle_h(node); error = handle->dev->getkeycode(handle->dev, scancode, &keycode);
if (handle->dev->keycodesize) { if (!error)
dev = handle->dev; return keycode;
break;
} }
}
if (!dev)
return -ENODEV;
if (scancode >= dev->keycodemax)
return -EINVAL;
return INPUT_KEYCODE(dev, scancode); return error;
} }
int setkeycode(unsigned int scancode, unsigned int keycode) int setkeycode(unsigned int scancode, unsigned int keycode)
{ {
struct list_head *node; struct input_handle *handle;
struct input_dev *dev = NULL; int error = -ENODEV;
unsigned int i, oldkey;
list_for_each(node, &kbd_handler.h_list) { list_for_each_entry(handle, &kbd_handler.h_list, h_node) {
struct input_handle *handle = to_handle_h(node); error = handle->dev->setkeycode(handle->dev, scancode, keycode);
if (handle->dev->keycodesize) { if (!error)
dev = handle->dev;
break; break;
} }
}
if (!dev)
return -ENODEV;
if (scancode >= dev->keycodemax)
return -EINVAL;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
return -EINVAL;
oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); return error;
clear_bit(oldkey, dev->keybit);
set_bit(keycode, dev->keybit);
for (i = 0; i < dev->keycodemax; i++)
if (INPUT_KEYCODE(dev,i) == oldkey)
set_bit(oldkey, dev->keybit);
return 0;
} }
/* /*
...@@ -225,10 +200,9 @@ int setkeycode(unsigned int scancode, unsigned int keycode) ...@@ -225,10 +200,9 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
*/ */
static void kd_nosound(unsigned long ignored) static void kd_nosound(unsigned long ignored)
{ {
struct list_head *node; struct input_handle *handle;
list_for_each(node, &kbd_handler.h_list) { list_for_each_entry(handle, &kbd_handler.h_list, h_node) {
struct input_handle *handle = to_handle_h(node);
if (test_bit(EV_SND, handle->dev->evbit)) { if (test_bit(EV_SND, handle->dev->evbit)) {
if (test_bit(SND_TONE, handle->dev->sndbit)) if (test_bit(SND_TONE, handle->dev->sndbit))
input_inject_event(handle, EV_SND, SND_TONE, 0); input_inject_event(handle, EV_SND, SND_TONE, 0);
...@@ -1161,7 +1135,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw) ...@@ -1161,7 +1135,7 @@ static void kbd_keycode(unsigned int keycode, int down, int hw_raw)
if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw) if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw)
if (emulate_raw(vc, keycode, !down << 7)) if (emulate_raw(vc, keycode, !down << 7))
if (keycode < BTN_MISC) if (keycode < BTN_MISC && printk_ratelimit())
printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode); printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
#ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */ #ifdef CONFIG_MAGIC_SYSRQ /* Handle the SysRq Hack */
...@@ -1285,11 +1259,11 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type, ...@@ -1285,11 +1259,11 @@ static void kbd_event(struct input_handle *handle, unsigned int event_type,
* likes it, it can open it and get events from it. In this (kbd_connect) * likes it, it can open it and get events from it. In this (kbd_connect)
* function, we should decide which VT to bind that keyboard to initially. * function, we should decide which VT to bind that keyboard to initially.
*/ */
static struct input_handle *kbd_connect(struct input_handler *handler, static int kbd_connect(struct input_handler *handler, struct input_dev *dev,
struct input_dev *dev,
const struct input_device_id *id) const struct input_device_id *id)
{ {
struct input_handle *handle; struct input_handle *handle;
int error;
int i; int i;
for (i = KEY_RESERVED; i < BTN_MISC; i++) for (i = KEY_RESERVED; i < BTN_MISC; i++)
...@@ -1297,24 +1271,37 @@ static struct input_handle *kbd_connect(struct input_handler *handler, ...@@ -1297,24 +1271,37 @@ static struct input_handle *kbd_connect(struct input_handler *handler,
break; break;
if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit)) if (i == BTN_MISC && !test_bit(EV_SND, dev->evbit))
return NULL; return -ENODEV;
handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL); handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
if (!handle) if (!handle)
return NULL; return -ENOMEM;
handle->dev = dev; handle->dev = dev;
handle->handler = handler; handle->handler = handler;
handle->name = "kbd"; handle->name = "kbd";
input_open_device(handle); error = input_register_handle(handle);
if (error)
goto err_free_handle;
error = input_open_device(handle);
if (error)
goto err_unregister_handle;
return handle; return 0;
err_unregister_handle:
input_unregister_handle(handle);
err_free_handle:
kfree(handle);
return error;
} }
static void kbd_disconnect(struct input_handle *handle) static void kbd_disconnect(struct input_handle *handle)
{ {
input_close_device(handle); input_close_device(handle);
input_unregister_handle(handle);
kfree(handle); kfree(handle);
} }
......
...@@ -13,7 +13,6 @@ obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o ...@@ -13,7 +13,6 @@ obj-$(CONFIG_INPUT_MOUSEDEV) += mousedev.o
obj-$(CONFIG_INPUT_JOYDEV) += joydev.o obj-$(CONFIG_INPUT_JOYDEV) += joydev.o
obj-$(CONFIG_INPUT_EVDEV) += evdev.o obj-$(CONFIG_INPUT_EVDEV) += evdev.o
obj-$(CONFIG_INPUT_TSDEV) += tsdev.o obj-$(CONFIG_INPUT_TSDEV) += tsdev.o
obj-$(CONFIG_INPUT_POWER) += power.o
obj-$(CONFIG_INPUT_EVBUG) += evbug.o obj-$(CONFIG_INPUT_EVBUG) += evbug.o
obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/ obj-$(CONFIG_INPUT_KEYBOARD) += keyboard/
......
...@@ -38,31 +38,43 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); ...@@ -38,31 +38,43 @@ MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Input driver event debug module"); MODULE_DESCRIPTION("Input driver event debug module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static char evbug_name[] = "evbug";
static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{ {
printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n", printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n",
handle->dev->phys, type, code, value); handle->dev->phys, type, code, value);
} }
static struct input_handle *evbug_connect(struct input_handler *handler, struct input_dev *dev, static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
const struct input_device_id *id) const struct input_device_id *id)
{ {
struct input_handle *handle; struct input_handle *handle;
int error;
if (!(handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL))) handle = kzalloc(sizeof(struct input_handle), GFP_KERNEL);
return NULL; if (!handle)
return -ENOMEM;
handle->dev = dev; handle->dev = dev;
handle->handler = handler; handle->handler = handler;
handle->name = evbug_name; handle->name = "evbug";
error = input_register_handle(handle);
if (error)
goto err_free_handle;
input_open_device(handle); error = input_open_device(handle);
if (error)
goto err_unregister_handle;
printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys); printk(KERN_DEBUG "evbug.c: Connected device: \"%s\", %s\n", dev->name, dev->phys);
return handle; return 0;
err_unregister_handle:
input_unregister_handle(handle);
err_free_handle:
kfree(handle);
return error;
} }
static void evbug_disconnect(struct input_handle *handle) static void evbug_disconnect(struct input_handle *handle)
...@@ -70,7 +82,7 @@ static void evbug_disconnect(struct input_handle *handle) ...@@ -70,7 +82,7 @@ static void evbug_disconnect(struct input_handle *handle)
printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys); printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n", handle->dev->phys);
input_close_device(handle); input_close_device(handle);
input_unregister_handle(handle);
kfree(handle); kfree(handle);
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -241,7 +241,7 @@ static void a3d_adc_close(struct gameport *gameport) ...@@ -241,7 +241,7 @@ static void a3d_adc_close(struct gameport *gameport)
static int a3d_open(struct input_dev *dev) static int a3d_open(struct input_dev *dev)
{ {
struct a3d *a3d = dev->private; struct a3d *a3d = input_get_drvdata(dev);
gameport_start_polling(a3d->gameport); gameport_start_polling(a3d->gameport);
return 0; return 0;
...@@ -253,7 +253,7 @@ static int a3d_open(struct input_dev *dev) ...@@ -253,7 +253,7 @@ static int a3d_open(struct input_dev *dev)
static void a3d_close(struct input_dev *dev) static void a3d_close(struct input_dev *dev)
{ {
struct a3d *a3d = dev->private; struct a3d *a3d = input_get_drvdata(dev);
gameport_stop_polling(a3d->gameport); gameport_stop_polling(a3d->gameport);
} }
...@@ -314,11 +314,12 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv) ...@@ -314,11 +314,12 @@ static int a3d_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_MADCATZ; input_dev->id.vendor = GAMEPORT_ID_VENDOR_MADCATZ;
input_dev->id.product = a3d->mode; input_dev->id.product = a3d->mode;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev; input_dev->dev.parent = &gameport->dev;
input_dev->private = a3d;
input_dev->open = a3d_open; input_dev->open = a3d_open;
input_dev->close = a3d_close; input_dev->close = a3d_close;
input_set_drvdata(input_dev, a3d);
if (a3d->mode == A3D_MODE_PXL) { if (a3d->mode == A3D_MODE_PXL) {
int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER }; int axes[] = { ABS_X, ABS_Y, ABS_THROTTLE, ABS_RUDDER };
......
...@@ -290,7 +290,7 @@ static void adi_poll(struct gameport *gameport) ...@@ -290,7 +290,7 @@ static void adi_poll(struct gameport *gameport)
static int adi_open(struct input_dev *dev) static int adi_open(struct input_dev *dev)
{ {
struct adi_port *port = dev->private; struct adi_port *port = input_get_drvdata(dev);
gameport_start_polling(port->gameport); gameport_start_polling(port->gameport);
return 0; return 0;
...@@ -302,7 +302,7 @@ static int adi_open(struct input_dev *dev) ...@@ -302,7 +302,7 @@ static int adi_open(struct input_dev *dev)
static void adi_close(struct input_dev *dev) static void adi_close(struct input_dev *dev)
{ {
struct adi_port *port = dev->private; struct adi_port *port = input_get_drvdata(dev);
gameport_stop_polling(port->gameport); gameport_stop_polling(port->gameport);
} }
...@@ -424,8 +424,9 @@ static int adi_init_input(struct adi *adi, struct adi_port *port, int half) ...@@ -424,8 +424,9 @@ static int adi_init_input(struct adi *adi, struct adi_port *port, int half)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_LOGITECH; input_dev->id.vendor = GAMEPORT_ID_VENDOR_LOGITECH;
input_dev->id.product = adi->id; input_dev->id.product = adi->id;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &port->gameport->dev; input_dev->dev.parent = &port->gameport->dev;
input_dev->private = port;
input_set_drvdata(input_dev, port);
input_dev->open = adi_open; input_dev->open = adi_open;
input_dev->close = adi_close; input_dev->close = adi_close;
......
...@@ -343,7 +343,7 @@ static void analog_poll(struct gameport *gameport) ...@@ -343,7 +343,7 @@ static void analog_poll(struct gameport *gameport)
static int analog_open(struct input_dev *dev) static int analog_open(struct input_dev *dev)
{ {
struct analog_port *port = dev->private; struct analog_port *port = input_get_drvdata(dev);
gameport_start_polling(port->gameport); gameport_start_polling(port->gameport);
return 0; return 0;
...@@ -355,7 +355,7 @@ static int analog_open(struct input_dev *dev) ...@@ -355,7 +355,7 @@ static int analog_open(struct input_dev *dev)
static void analog_close(struct input_dev *dev) static void analog_close(struct input_dev *dev)
{ {
struct analog_port *port = dev->private; struct analog_port *port = input_get_drvdata(dev);
gameport_stop_polling(port->gameport); gameport_stop_polling(port->gameport);
} }
...@@ -449,10 +449,13 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i ...@@ -449,10 +449,13 @@ static int analog_init_device(struct analog_port *port, struct analog *analog, i
input_dev->id.vendor = GAMEPORT_ID_VENDOR_ANALOG; input_dev->id.vendor = GAMEPORT_ID_VENDOR_ANALOG;
input_dev->id.product = analog->mask >> 4; input_dev->id.product = analog->mask >> 4;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->dev.parent = &port->gameport->dev;
input_set_drvdata(input_dev, port);
input_dev->open = analog_open; input_dev->open = analog_open;
input_dev->close = analog_close; input_dev->close = analog_close;
input_dev->private = port;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = j = 0; i < 4; i++) for (i = j = 0; i < 4; i++)
......
...@@ -142,7 +142,7 @@ static void cobra_poll(struct gameport *gameport) ...@@ -142,7 +142,7 @@ static void cobra_poll(struct gameport *gameport)
static int cobra_open(struct input_dev *dev) static int cobra_open(struct input_dev *dev)
{ {
struct cobra *cobra = dev->private; struct cobra *cobra = input_get_drvdata(dev);
gameport_start_polling(cobra->gameport); gameport_start_polling(cobra->gameport);
return 0; return 0;
...@@ -150,7 +150,7 @@ static int cobra_open(struct input_dev *dev) ...@@ -150,7 +150,7 @@ static int cobra_open(struct input_dev *dev)
static void cobra_close(struct input_dev *dev) static void cobra_close(struct input_dev *dev)
{ {
struct cobra *cobra = dev->private; struct cobra *cobra = input_get_drvdata(dev);
gameport_stop_polling(cobra->gameport); gameport_stop_polling(cobra->gameport);
} }
...@@ -211,8 +211,9 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv) ...@@ -211,8 +211,9 @@ static int cobra_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_CREATIVE; input_dev->id.vendor = GAMEPORT_ID_VENDOR_CREATIVE;
input_dev->id.product = 0x0008; input_dev->id.product = 0x0008;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev; input_dev->dev.parent = &gameport->dev;
input_dev->private = cobra;
input_set_drvdata(input_dev, cobra);
input_dev->open = cobra_open; input_dev->open = cobra_open;
input_dev->close = cobra_close; input_dev->close = cobra_close;
......
...@@ -518,7 +518,7 @@ static void db9_timer(unsigned long private) ...@@ -518,7 +518,7 @@ static void db9_timer(unsigned long private)
static int db9_open(struct input_dev *dev) static int db9_open(struct input_dev *dev)
{ {
struct db9 *db9 = dev->private; struct db9 *db9 = input_get_drvdata(dev);
struct parport *port = db9->pd->port; struct parport *port = db9->pd->port;
int err; int err;
...@@ -542,7 +542,7 @@ static int db9_open(struct input_dev *dev) ...@@ -542,7 +542,7 @@ static int db9_open(struct input_dev *dev)
static void db9_close(struct input_dev *dev) static void db9_close(struct input_dev *dev)
{ {
struct db9 *db9 = dev->private; struct db9 *db9 = input_get_drvdata(dev);
struct parport *port = db9->pd->port; struct parport *port = db9->pd->port;
mutex_lock(&db9->mutex); mutex_lock(&db9->mutex);
...@@ -625,7 +625,8 @@ static struct db9 __init *db9_probe(int parport, int mode) ...@@ -625,7 +625,8 @@ static struct db9 __init *db9_probe(int parport, int mode)
input_dev->id.vendor = 0x0002; input_dev->id.vendor = 0x0002;
input_dev->id.product = mode; input_dev->id.product = mode;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->private = db9;
input_set_drvdata(input_dev, db9);
input_dev->open = db9_open; input_dev->open = db9_open;
input_dev->close = db9_close; input_dev->close = db9_close;
......
...@@ -591,7 +591,7 @@ static void gc_timer(unsigned long private) ...@@ -591,7 +591,7 @@ static void gc_timer(unsigned long private)
static int gc_open(struct input_dev *dev) static int gc_open(struct input_dev *dev)
{ {
struct gc *gc = dev->private; struct gc *gc = input_get_drvdata(dev);
int err; int err;
err = mutex_lock_interruptible(&gc->mutex); err = mutex_lock_interruptible(&gc->mutex);
...@@ -610,7 +610,7 @@ static int gc_open(struct input_dev *dev) ...@@ -610,7 +610,7 @@ static int gc_open(struct input_dev *dev)
static void gc_close(struct input_dev *dev) static void gc_close(struct input_dev *dev)
{ {
struct gc *gc = dev->private; struct gc *gc = input_get_drvdata(dev);
mutex_lock(&gc->mutex); mutex_lock(&gc->mutex);
if (!--gc->used) { if (!--gc->used) {
...@@ -646,7 +646,8 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type) ...@@ -646,7 +646,8 @@ static int __init gc_setup_pad(struct gc *gc, int idx, int pad_type)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = pad_type; input_dev->id.product = pad_type;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->private = gc;
input_set_drvdata(input_dev, gc);
input_dev->open = gc_open; input_dev->open = gc_open;
input_dev->close = gc_close; input_dev->close = gc_close;
......
...@@ -220,7 +220,7 @@ static void gf2k_poll(struct gameport *gameport) ...@@ -220,7 +220,7 @@ static void gf2k_poll(struct gameport *gameport)
static int gf2k_open(struct input_dev *dev) static int gf2k_open(struct input_dev *dev)
{ {
struct gf2k *gf2k = dev->private; struct gf2k *gf2k = input_get_drvdata(dev);
gameport_start_polling(gf2k->gameport); gameport_start_polling(gf2k->gameport);
return 0; return 0;
...@@ -228,7 +228,7 @@ static int gf2k_open(struct input_dev *dev) ...@@ -228,7 +228,7 @@ static int gf2k_open(struct input_dev *dev)
static void gf2k_close(struct input_dev *dev) static void gf2k_close(struct input_dev *dev)
{ {
struct gf2k *gf2k = dev->private; struct gf2k *gf2k = input_get_drvdata(dev);
gameport_stop_polling(gf2k->gameport); gameport_stop_polling(gf2k->gameport);
} }
...@@ -308,11 +308,13 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv) ...@@ -308,11 +308,13 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_GENIUS; input_dev->id.vendor = GAMEPORT_ID_VENDOR_GENIUS;
input_dev->id.product = gf2k->id; input_dev->id.product = gf2k->id;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev; input_dev->dev.parent = &gameport->dev;
input_dev->private = gf2k;
input_set_drvdata(input_dev, gf2k);
input_dev->open = gf2k_open; input_dev->open = gf2k_open;
input_dev->close = gf2k_close; input_dev->close = gf2k_close;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; i < gf2k_axes[gf2k->id]; i++) for (i = 0; i < gf2k_axes[gf2k->id]; i++)
......
...@@ -285,7 +285,7 @@ static void grip_poll(struct gameport *gameport) ...@@ -285,7 +285,7 @@ static void grip_poll(struct gameport *gameport)
static int grip_open(struct input_dev *dev) static int grip_open(struct input_dev *dev)
{ {
struct grip *grip = dev->private; struct grip *grip = input_get_drvdata(dev);
gameport_start_polling(grip->gameport); gameport_start_polling(grip->gameport);
return 0; return 0;
...@@ -293,7 +293,7 @@ static int grip_open(struct input_dev *dev) ...@@ -293,7 +293,7 @@ static int grip_open(struct input_dev *dev)
static void grip_close(struct input_dev *dev) static void grip_close(struct input_dev *dev)
{ {
struct grip *grip = dev->private; struct grip *grip = input_get_drvdata(dev);
gameport_stop_polling(grip->gameport); gameport_stop_polling(grip->gameport);
} }
...@@ -363,8 +363,9 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv) ...@@ -363,8 +363,9 @@ static int grip_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS;
input_dev->id.product = grip->mode[i]; input_dev->id.product = grip->mode[i];
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev; input_dev->dev.parent = &gameport->dev;
input_dev->private = grip;
input_set_drvdata(input_dev, grip);
input_dev->open = grip_open; input_dev->open = grip_open;
input_dev->close = grip_close; input_dev->close = grip_close;
......
...@@ -562,7 +562,7 @@ static void grip_poll(struct gameport *gameport) ...@@ -562,7 +562,7 @@ static void grip_poll(struct gameport *gameport)
static int grip_open(struct input_dev *dev) static int grip_open(struct input_dev *dev)
{ {
struct grip_mp *grip = dev->private; struct grip_mp *grip = input_get_drvdata(dev);
gameport_start_polling(grip->gameport); gameport_start_polling(grip->gameport);
return 0; return 0;
...@@ -574,9 +574,9 @@ static int grip_open(struct input_dev *dev) ...@@ -574,9 +574,9 @@ static int grip_open(struct input_dev *dev)
static void grip_close(struct input_dev *dev) static void grip_close(struct input_dev *dev)
{ {
struct grip_mp *grip = dev->private; struct grip_mp *grip = input_get_drvdata(dev);
gameport_start_polling(grip->gameport); gameport_stop_polling(grip->gameport);
} }
/* /*
...@@ -599,8 +599,9 @@ static int register_slot(int slot, struct grip_mp *grip) ...@@ -599,8 +599,9 @@ static int register_slot(int slot, struct grip_mp *grip)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS; input_dev->id.vendor = GAMEPORT_ID_VENDOR_GRAVIS;
input_dev->id.product = 0x0100 + port->mode; input_dev->id.product = 0x0100 + port->mode;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &grip->gameport->dev; input_dev->dev.parent = &grip->gameport->dev;
input_dev->private = grip;
input_set_drvdata(input_dev, grip);
input_dev->open = grip_open; input_dev->open = grip_open;
input_dev->close = grip_close; input_dev->close = grip_close;
......
...@@ -156,7 +156,7 @@ static void guillemot_poll(struct gameport *gameport) ...@@ -156,7 +156,7 @@ static void guillemot_poll(struct gameport *gameport)
static int guillemot_open(struct input_dev *dev) static int guillemot_open(struct input_dev *dev)
{ {
struct guillemot *guillemot = dev->private; struct guillemot *guillemot = input_get_drvdata(dev);
gameport_start_polling(guillemot->gameport); gameport_start_polling(guillemot->gameport);
return 0; return 0;
...@@ -168,7 +168,7 @@ static int guillemot_open(struct input_dev *dev) ...@@ -168,7 +168,7 @@ static int guillemot_open(struct input_dev *dev)
static void guillemot_close(struct input_dev *dev) static void guillemot_close(struct input_dev *dev)
{ {
struct guillemot *guillemot = dev->private; struct guillemot *guillemot = input_get_drvdata(dev);
gameport_stop_polling(guillemot->gameport); gameport_stop_polling(guillemot->gameport);
} }
...@@ -231,8 +231,9 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver * ...@@ -231,8 +231,9 @@ static int guillemot_connect(struct gameport *gameport, struct gameport_driver *
input_dev->id.vendor = GAMEPORT_ID_VENDOR_GUILLEMOT; input_dev->id.vendor = GAMEPORT_ID_VENDOR_GUILLEMOT;
input_dev->id.product = guillemot_type[i].id; input_dev->id.product = guillemot_type[i].id;
input_dev->id.version = (int)data[14] << 8 | data[15]; input_dev->id.version = (int)data[14] << 8 | data[15];
input_dev->cdev.dev = &gameport->dev; input_dev->dev.parent = &gameport->dev;
input_dev->private = guillemot;
input_set_drvdata(input_dev, guillemot);
input_dev->open = guillemot_open; input_dev->open = guillemot_open;
input_dev->close = guillemot_close; input_dev->close = guillemot_close;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $ * $Id: iforce-ff.c,v 1.9 2002/02/02 19:28:35 jdeneux Exp $
* *
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
* *
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
...@@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) ...@@ -205,7 +205,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
int i; int i;
if (new->type != FF_SPRING && new->type != FF_FRICTION) { if (new->type != FF_SPRING && new->type != FF_FRICTION) {
printk(KERN_WARNING "iforce.c: bad effect type in need_condition_modifier\n"); warn("bad effect type in need_condition_modifier");
return 0; return 0;
} }
...@@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new) ...@@ -227,7 +227,7 @@ static int need_condition_modifier(struct ff_effect *old, struct ff_effect *new)
static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect) static int need_magnitude_modifier(struct ff_effect *old, struct ff_effect *effect)
{ {
if (effect->type != FF_CONSTANT) { if (effect->type != FF_CONSTANT) {
printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); warn("bad effect type in need_envelope_modifier");
return 0; return 0;
} }
...@@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec ...@@ -258,7 +258,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
break; break;
default: default:
printk(KERN_WARNING "iforce.c: bad effect type in need_envelope_modifier\n"); warn("bad effect type in need_envelope_modifier");
} }
return 0; return 0;
...@@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec ...@@ -271,7 +271,7 @@ static int need_envelope_modifier(struct ff_effect *old, struct ff_effect *effec
static int need_period_modifier(struct ff_effect *old, struct ff_effect *new) static int need_period_modifier(struct ff_effect *old, struct ff_effect *new)
{ {
if (new->type != FF_PERIODIC) { if (new->type != FF_PERIODIC) {
printk(KERN_WARNING "iforce.c: bad effect type in need_period_modifier\n"); warn("bad effect type in need_period_modifier");
return 0; return 0;
} }
return (old->u.periodic.period != new->u.periodic.period return (old->u.periodic.period != new->u.periodic.period
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $ * $Id: iforce-main.c,v 1.19 2002/07/07 10:22:50 jdeneux Exp $
* *
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
* *
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "iforce.h" #include "iforce.h"
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <deneux@ifrance.com>"); MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>, Johann Deneux <johann.deneux@gmail.com>");
MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver"); MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev) ...@@ -220,7 +220,7 @@ static void iforce_release(struct input_dev *dev)
/* Check: no effects should be present in memory */ /* Check: no effects should be present in memory */
for (i = 0; i < dev->ff->max_effects; i++) { for (i = 0; i < dev->ff->max_effects; i++) {
if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) { if (test_bit(FF_CORE_IS_USED, iforce->core_effects[i].flags)) {
printk(KERN_WARNING "iforce_release: Device still owns effects\n"); warn("iforce_release: Device still owns effects");
break; break;
} }
} }
...@@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev) ...@@ -232,7 +232,7 @@ static void iforce_release(struct input_dev *dev)
switch (iforce->bus) { switch (iforce->bus) {
#ifdef CONFIG_JOYSTICK_IFORCE_USB #ifdef CONFIG_JOYSTICK_IFORCE_USB
case IFORCE_USB: case IFORCE_USB:
usb_unlink_urb(iforce->irq); usb_kill_urb(iforce->irq);
/* The device was unplugged before the file /* The device was unplugged before the file
* was released */ * was released */
...@@ -287,13 +287,13 @@ int iforce_init_device(struct iforce *iforce) ...@@ -287,13 +287,13 @@ int iforce_init_device(struct iforce *iforce)
#ifdef CONFIG_JOYSTICK_IFORCE_USB #ifdef CONFIG_JOYSTICK_IFORCE_USB
case IFORCE_USB: case IFORCE_USB:
input_dev->id.bustype = BUS_USB; input_dev->id.bustype = BUS_USB;
input_dev->cdev.dev = &iforce->usbdev->dev; input_dev->dev.parent = &iforce->usbdev->dev;
break; break;
#endif #endif
#ifdef CONFIG_JOYSTICK_IFORCE_232 #ifdef CONFIG_JOYSTICK_IFORCE_232
case IFORCE_232: case IFORCE_232:
input_dev->id.bustype = BUS_RS232; input_dev->id.bustype = BUS_RS232;
input_dev->cdev.dev = &iforce->serio->dev; input_dev->dev.parent = &iforce->serio->dev;
break; break;
#endif #endif
} }
...@@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce) ...@@ -324,7 +324,7 @@ int iforce_init_device(struct iforce *iforce)
break; break;
if (i == 20) { /* 5 seconds */ if (i == 20) { /* 5 seconds */
printk(KERN_ERR "iforce-main.c: Timeout waiting for response from device.\n"); err("Timeout waiting for response from device.");
error = -ENODEV; error = -ENODEV;
goto fail; goto fail;
} }
...@@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce) ...@@ -336,26 +336,26 @@ int iforce_init_device(struct iforce *iforce)
if (!iforce_get_id_packet(iforce, "M")) if (!iforce_get_id_packet(iforce, "M"))
input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1]; input_dev->id.vendor = (iforce->edata[2] << 8) | iforce->edata[1];
else else
printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet M\n"); warn("Device does not respond to id packet M");
if (!iforce_get_id_packet(iforce, "P")) if (!iforce_get_id_packet(iforce, "P"))
input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1]; input_dev->id.product = (iforce->edata[2] << 8) | iforce->edata[1];
else else
printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet P\n"); warn("Device does not respond to id packet P");
if (!iforce_get_id_packet(iforce, "B")) if (!iforce_get_id_packet(iforce, "B"))
iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1]; iforce->device_memory.end = (iforce->edata[2] << 8) | iforce->edata[1];
else else
printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet B\n"); warn("Device does not respond to id packet B");
if (!iforce_get_id_packet(iforce, "N")) if (!iforce_get_id_packet(iforce, "N"))
ff_effects = iforce->edata[1]; ff_effects = iforce->edata[1];
else else
printk(KERN_WARNING "iforce-main.c: Device does not respond to id packet N\n"); warn("Device does not respond to id packet N");
/* Check if the device can store more effects than the driver can really handle */ /* Check if the device can store more effects than the driver can really handle */
if (ff_effects > IFORCE_EFFECTS_MAX) { if (ff_effects > IFORCE_EFFECTS_MAX) {
printk(KERN_WARNING "iforce: Limiting number of effects to %d (device reports %d)\n", warn("Limiting number of effects to %d (device reports %d)",
IFORCE_EFFECTS_MAX, ff_effects); IFORCE_EFFECTS_MAX, ff_effects);
ff_effects = IFORCE_EFFECTS_MAX; ff_effects = IFORCE_EFFECTS_MAX;
} }
...@@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce) ...@@ -457,8 +457,6 @@ int iforce_init_device(struct iforce *iforce)
if (error) if (error)
goto fail; goto fail;
printk(KERN_DEBUG "iforce->dev->open = %p\n", iforce->dev->open);
return 0; return 0;
fail: input_free_device(input_dev); fail: input_free_device(input_dev);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $ * $Id: iforce-packets.c,v 1.16 2002/07/07 10:22:50 jdeneux Exp $
* *
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
* *
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
...@@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data) ...@@ -39,10 +39,10 @@ void iforce_dump_packet(char *msg, u16 cmd, unsigned char *data)
{ {
int i; int i;
printk(KERN_DEBUG "iforce.c: %s ( cmd = %04x, data = ", msg, cmd); printk(KERN_DEBUG __FILE__ ": %s cmd = %04x, data = ", msg, cmd);
for (i = 0; i < LO(cmd); i++) for (i = 0; i < LO(cmd); i++)
printk("%02x ", data[i]); printk("%02x ", data[i]);
printk(")\n"); printk("\n");
} }
/* /*
...@@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data) ...@@ -65,8 +65,9 @@ int iforce_send_packet(struct iforce *iforce, u16 cmd, unsigned char* data)
head = iforce->xmit.head; head = iforce->xmit.head;
tail = iforce->xmit.tail; tail = iforce->xmit.tail;
if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) { if (CIRC_SPACE(head, tail, XMIT_SIZE) < n+2) {
printk(KERN_WARNING "iforce.c: not enough space in xmit buffer to send new packet\n"); warn("not enough space in xmit buffer to send new packet");
spin_unlock_irqrestore(&iforce->xmit_lock, flags); spin_unlock_irqrestore(&iforce->xmit_lock, flags);
return -1; return -1;
} }
...@@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value) ...@@ -126,8 +127,6 @@ int iforce_control_playback(struct iforce* iforce, u16 id, unsigned int value)
{ {
unsigned char data[3]; unsigned char data[3];
printk(KERN_DEBUG "iforce-packets.c: control_playback %d %d\n", id, value);
data[0] = LO(id); data[0] = LO(id);
data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0; data[1] = (value > 0) ? ((value > 1) ? 0x41 : 0x01) : 0;
data[2] = LO(value); data[2] = LO(value);
...@@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr) ...@@ -151,7 +150,7 @@ static int mark_core_as_ready(struct iforce *iforce, unsigned short addr)
return 0; return 0;
} }
} }
printk(KERN_WARNING "iforce-packets.c: unused effect %04x updated !!!\n", addr); warn("unused effect %04x updated !!!", addr);
return -1; return -1;
} }
...@@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data) ...@@ -162,7 +161,7 @@ void iforce_process_packet(struct iforce *iforce, u16 cmd, unsigned char *data)
static int being_used = 0; static int being_used = 0;
if (being_used) if (being_used)
printk(KERN_WARNING "iforce-packets.c: re-entrant call to iforce_process %d\n", being_used); warn("re-entrant call to iforce_process %d", being_used);
being_used++; being_used++;
#ifdef CONFIG_JOYSTICK_IFORCE_232 #ifdef CONFIG_JOYSTICK_IFORCE_232
...@@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) ...@@ -266,7 +265,7 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
return -1; return -1;
} }
#else #else
printk(KERN_ERR "iforce_get_id_packet: iforce->bus = USB!\n"); err("iforce_get_id_packet: iforce->bus = USB!");
#endif #endif
break; break;
...@@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet) ...@@ -284,13 +283,12 @@ int iforce_get_id_packet(struct iforce *iforce, char *packet)
return -1; return -1;
} }
#else #else
printk(KERN_ERR "iforce_get_id_packet: iforce->bus = SERIO!\n"); err("iforce_get_id_packet: iforce->bus = SERIO!");
#endif #endif
break; break;
default: default:
printk(KERN_ERR "iforce_get_id_packet: iforce->bus = %d\n", err("iforce_get_id_packet: iforce->bus = %d", iforce->bus);
iforce->bus);
break; break;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $ * $Id: iforce-serio.c,v 1.4 2002/01/28 22:45:00 jdeneux Exp $
* *
* Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz> * Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001 Johann Deneux <deneux@ifrance.com> * Copyright (c) 2001, 2007 Johann Deneux <johann.deneux@gmail.com>
* *
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $ * $Id: iforce-usb.c,v 1.16 2002/06/09 11:08:04 jdeneux Exp $
* *
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
* *
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
...@@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce) ...@@ -65,7 +65,7 @@ void iforce_usb_xmit(struct iforce *iforce)
XMIT_INC(iforce->xmit.tail, n); XMIT_INC(iforce->xmit.tail, n);
if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) { if ( (n=usb_submit_urb(iforce->out, GFP_ATOMIC)) ) {
printk(KERN_WARNING "iforce-usb.c: iforce_usb_xmit: usb_submit_urb failed %d\n", n); warn("usb_submit_urb failed %d\n", n);
} }
/* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended. /* The IFORCE_XMIT_RUNNING bit is not cleared here. That's intended.
...@@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb) ...@@ -110,7 +110,7 @@ static void iforce_usb_out(struct urb *urb)
struct iforce *iforce = urb->context; struct iforce *iforce = urb->context;
if (urb->status) { if (urb->status) {
printk(KERN_DEBUG "iforce_usb_out: urb->status %d, exiting", urb->status); dbg("urb->status %d, exiting", urb->status);
return; return;
} }
...@@ -190,10 +190,9 @@ static int iforce_usb_probe(struct usb_interface *intf, ...@@ -190,10 +190,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
/* Called by iforce_delete() */ /* Called by iforce_delete() */
void iforce_usb_delete(struct iforce* iforce) void iforce_usb_delete(struct iforce* iforce)
{ {
usb_unlink_urb(iforce->irq); usb_kill_urb(iforce->irq);
/* Is it ok to unlink those ? */ usb_kill_urb(iforce->out);
usb_unlink_urb(iforce->out); usb_kill_urb(iforce->ctrl);
usb_unlink_urb(iforce->ctrl);
usb_free_urb(iforce->irq); usb_free_urb(iforce->irq);
usb_free_urb(iforce->out); usb_free_urb(iforce->out);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $ * $Id: iforce.h,v 1.13 2002/07/07 10:22:50 jdeneux Exp $
* *
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz> * Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2001-2002 Johann Deneux <deneux@ifrance.com> * Copyright (c) 2001-2002, 2007 Johann Deneux <johann.deneux@gmail.com>
* *
* USB/RS232 I-Force joysticks and wheels. * USB/RS232 I-Force joysticks and wheels.
*/ */
......
...@@ -185,7 +185,7 @@ static void interact_poll(struct gameport *gameport) ...@@ -185,7 +185,7 @@ static void interact_poll(struct gameport *gameport)
static int interact_open(struct input_dev *dev) static int interact_open(struct input_dev *dev)
{ {
struct interact *interact = dev->private; struct interact *interact = input_get_drvdata(dev);
gameport_start_polling(interact->gameport); gameport_start_polling(interact->gameport);
return 0; return 0;
...@@ -197,7 +197,7 @@ static int interact_open(struct input_dev *dev) ...@@ -197,7 +197,7 @@ static int interact_open(struct input_dev *dev)
static void interact_close(struct input_dev *dev) static void interact_close(struct input_dev *dev)
{ {
struct interact *interact = dev->private; struct interact *interact = input_get_drvdata(dev);
gameport_stop_polling(interact->gameport); gameport_stop_polling(interact->gameport);
} }
...@@ -262,7 +262,9 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d ...@@ -262,7 +262,9 @@ static int interact_connect(struct gameport *gameport, struct gameport_driver *d
input_dev->id.vendor = GAMEPORT_ID_VENDOR_INTERACT; input_dev->id.vendor = GAMEPORT_ID_VENDOR_INTERACT;
input_dev->id.product = interact_type[i].id; input_dev->id.product = interact_type[i].id;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->private = interact; input_dev->dev.parent = &gameport->dev;
input_set_drvdata(input_dev, interact);
input_dev->open = interact_open; input_dev->open = interact_open;
input_dev->close = interact_close; input_dev->close = interact_close;
......
...@@ -168,8 +168,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv) ...@@ -168,8 +168,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_MAGELLAN; input_dev->id.vendor = SERIO_MAGELLAN;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = magellan;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
......
...@@ -509,7 +509,7 @@ static void sw_poll(struct gameport *gameport) ...@@ -509,7 +509,7 @@ static void sw_poll(struct gameport *gameport)
static int sw_open(struct input_dev *dev) static int sw_open(struct input_dev *dev)
{ {
struct sw *sw = dev->private; struct sw *sw = input_get_drvdata(dev);
gameport_start_polling(sw->gameport); gameport_start_polling(sw->gameport);
return 0; return 0;
...@@ -517,7 +517,7 @@ static int sw_open(struct input_dev *dev) ...@@ -517,7 +517,7 @@ static int sw_open(struct input_dev *dev)
static void sw_close(struct input_dev *dev) static void sw_close(struct input_dev *dev)
{ {
struct sw *sw = dev->private; struct sw *sw = input_get_drvdata(dev);
gameport_stop_polling(sw->gameport); gameport_stop_polling(sw->gameport);
} }
...@@ -751,8 +751,9 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv) ...@@ -751,8 +751,9 @@ static int sw_connect(struct gameport *gameport, struct gameport_driver *drv)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_MICROSOFT; input_dev->id.vendor = GAMEPORT_ID_VENDOR_MICROSOFT;
input_dev->id.product = sw->type; input_dev->id.product = sw->type;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &gameport->dev; input_dev->dev.parent = &gameport->dev;
input_dev->private = sw;
input_set_drvdata(input_dev, sw);
input_dev->open = sw_open; input_dev->open = sw_open;
input_dev->close = sw_close; input_dev->close = sw_close;
......
...@@ -226,8 +226,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv) ...@@ -226,8 +226,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_SPACEBALL; input_dev->id.vendor = SERIO_SPACEBALL;
input_dev->id.product = id; input_dev->id.product = id;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = spaceball;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
......
...@@ -183,8 +183,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv) ...@@ -183,8 +183,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_SPACEORB; input_dev->id.vendor = SERIO_SPACEORB;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = spaceorb;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
......
...@@ -154,8 +154,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv) ...@@ -154,8 +154,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_STINGER; input_dev->id.vendor = SERIO_STINGER;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = stinger;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) | input_dev->keybit[LONG(BTN_A)] = BIT(BTN_A) | BIT(BTN_B) | BIT(BTN_C) | BIT(BTN_X) |
......
...@@ -265,7 +265,7 @@ static void tmdc_poll(struct gameport *gameport) ...@@ -265,7 +265,7 @@ static void tmdc_poll(struct gameport *gameport)
static int tmdc_open(struct input_dev *dev) static int tmdc_open(struct input_dev *dev)
{ {
struct tmdc *tmdc = dev->private; struct tmdc *tmdc = input_get_drvdata(dev);
gameport_start_polling(tmdc->gameport); gameport_start_polling(tmdc->gameport);
return 0; return 0;
...@@ -273,7 +273,7 @@ static int tmdc_open(struct input_dev *dev) ...@@ -273,7 +273,7 @@ static int tmdc_open(struct input_dev *dev)
static void tmdc_close(struct input_dev *dev) static void tmdc_close(struct input_dev *dev)
{ {
struct tmdc *tmdc = dev->private; struct tmdc *tmdc = input_get_drvdata(dev);
gameport_stop_polling(tmdc->gameport); gameport_stop_polling(tmdc->gameport);
} }
...@@ -326,8 +326,9 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data) ...@@ -326,8 +326,9 @@ static int tmdc_setup_port(struct tmdc *tmdc, int idx, unsigned char *data)
input_dev->id.vendor = GAMEPORT_ID_VENDOR_THRUSTMASTER; input_dev->id.vendor = GAMEPORT_ID_VENDOR_THRUSTMASTER;
input_dev->id.product = model->id; input_dev->id.product = model->id;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &tmdc->gameport->dev; input_dev->dev.parent = &tmdc->gameport->dev;
input_dev->private = tmdc;
input_set_drvdata(input_dev, tmdc);
input_dev->open = tmdc_open; input_dev->open = tmdc_open;
input_dev->close = tmdc_close; input_dev->close = tmdc_close;
......
...@@ -122,7 +122,7 @@ static void tgfx_timer(unsigned long private) ...@@ -122,7 +122,7 @@ static void tgfx_timer(unsigned long private)
static int tgfx_open(struct input_dev *dev) static int tgfx_open(struct input_dev *dev)
{ {
struct tgfx *tgfx = dev->private; struct tgfx *tgfx = input_get_drvdata(dev);
int err; int err;
err = mutex_lock_interruptible(&tgfx->sem); err = mutex_lock_interruptible(&tgfx->sem);
...@@ -141,7 +141,7 @@ static int tgfx_open(struct input_dev *dev) ...@@ -141,7 +141,7 @@ static int tgfx_open(struct input_dev *dev)
static void tgfx_close(struct input_dev *dev) static void tgfx_close(struct input_dev *dev)
{ {
struct tgfx *tgfx = dev->private; struct tgfx *tgfx = input_get_drvdata(dev);
mutex_lock(&tgfx->sem); mutex_lock(&tgfx->sem);
if (!--tgfx->used) { if (!--tgfx->used) {
...@@ -224,7 +224,8 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs) ...@@ -224,7 +224,8 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
input_dev->id.product = n_buttons[i]; input_dev->id.product = n_buttons[i];
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->private = tgfx; input_set_drvdata(input_dev, tgfx);
input_dev->open = tgfx_open; input_dev->open = tgfx_open;
input_dev->close = tgfx_close; input_dev->close = tgfx_close;
......
...@@ -205,11 +205,9 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv) ...@@ -205,11 +205,9 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_TWIDJOY; input_dev->id.vendor = SERIO_TWIDJOY;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = twidjoy;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
input_dev->absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
input_set_abs_params(input_dev, ABS_X, -50, 50, 4, 4); input_set_abs_params(input_dev, ABS_X, -50, 50, 4, 4);
input_set_abs_params(input_dev, ABS_Y, -50, 50, 4, 4); input_set_abs_params(input_dev, ABS_Y, -50, 50, 4, 4);
......
...@@ -160,8 +160,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv) ...@@ -160,8 +160,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_WARRIOR; input_dev->id.vendor = SERIO_WARRIOR;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = warrior;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL) | BIT(EV_ABS);
input_dev->keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2); input_dev->keybit[LONG(BTN_TRIGGER)] = BIT(BTN_TRIGGER) | BIT(BTN_THUMB) | BIT(BTN_TOP) | BIT(BTN_TOP2);
......
...@@ -214,6 +214,15 @@ config KEYBOARD_OMAP ...@@ -214,6 +214,15 @@ config KEYBOARD_OMAP
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called omap-keypad. module will be called omap-keypad.
config KEYBOARD_PXA27x
tristate "PXA27x keyboard support"
depends on PXA27x
help
Enable support for PXA27x matrix keyboard controller
To compile this driver as a module, choose M here: the
module will be called pxa27x_keyboard.
config KEYBOARD_AAED2000 config KEYBOARD_AAED2000
tristate "AAED-2000 keyboard" tristate "AAED-2000 keyboard"
depends on MACH_AAED2000 depends on MACH_AAED2000
......
...@@ -18,6 +18,7 @@ obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o ...@@ -18,6 +18,7 @@ obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o
obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o
obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
...@@ -97,7 +97,7 @@ static void aaedkbd_work(void *data) ...@@ -97,7 +97,7 @@ static void aaedkbd_work(void *data)
static int aaedkbd_open(struct input_dev *indev) static int aaedkbd_open(struct input_dev *indev)
{ {
struct aaedkbd *aaedkbd = indev->private; struct aaedkbd *aaedkbd = input_get_drvdata(indev);
schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL)); schedule_delayed_work(&aaedkbd->workq, msecs_to_jiffies(SCAN_INTERVAL));
...@@ -106,7 +106,7 @@ static int aaedkbd_open(struct input_dev *indev) ...@@ -106,7 +106,7 @@ static int aaedkbd_open(struct input_dev *indev)
static void aaedkbd_close(struct input_dev *indev) static void aaedkbd_close(struct input_dev *indev)
{ {
struct aaedkbd *aaedkbd = indev->private; struct aaedkbd *aaedkbd = input_get_drvdata(indev);
cancel_delayed_work(&aaedkbd->workq); cancel_delayed_work(&aaedkbd->workq);
flush_scheduled_work(); flush_scheduled_work();
...@@ -141,8 +141,9 @@ static int __devinit aaedkbd_probe(struct platform_device *pdev) ...@@ -141,8 +141,9 @@ static int __devinit aaedkbd_probe(struct platform_device *pdev)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &pdev->dev; input_dev->dev.parent = &pdev->dev;
input_dev->private = aaedkbd;
input_set_drvdata(input_dev, aaedkbd);
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = aaedkbd->keycode; input_dev->keycode = aaedkbd->keycode;
......
...@@ -586,7 +586,7 @@ static void atkbd_event_work(struct work_struct *work) ...@@ -586,7 +586,7 @@ static void atkbd_event_work(struct work_struct *work)
static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{ {
struct atkbd *atkbd = dev->private; struct atkbd *atkbd = input_get_drvdata(dev);
if (!atkbd->write) if (!atkbd->write)
return -1; return -1;
...@@ -883,8 +883,9 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd) ...@@ -883,8 +883,9 @@ static void atkbd_set_device_attrs(struct atkbd *atkbd)
input_dev->id.product = atkbd->translated ? 1 : atkbd->set; input_dev->id.product = atkbd->translated ? 1 : atkbd->set;
input_dev->id.version = atkbd->id; input_dev->id.version = atkbd->id;
input_dev->event = atkbd_event; input_dev->event = atkbd_event;
input_dev->private = atkbd; input_dev->dev.parent = &atkbd->ps2dev.serio->dev;
input_dev->cdev.dev = &atkbd->ps2dev.serio->dev;
input_set_drvdata(input_dev, atkbd);
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_MSC);
......
...@@ -323,8 +323,7 @@ static int __init corgikbd_probe(struct platform_device *pdev) ...@@ -323,8 +323,7 @@ static int __init corgikbd_probe(struct platform_device *pdev)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &pdev->dev; input_dev->dev.parent = &pdev->dev;
input_dev->private = corgikbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW);
input_dev->keycode = corgikbd->keycode; input_dev->keycode = corgikbd->keycode;
......
...@@ -35,11 +35,14 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id) ...@@ -35,11 +35,14 @@ static irqreturn_t gpio_keys_isr(int irq, void *dev_id)
struct input_dev *input = platform_get_drvdata(pdev); struct input_dev *input = platform_get_drvdata(pdev);
for (i = 0; i < pdata->nbuttons; i++) { for (i = 0; i < pdata->nbuttons; i++) {
int gpio = pdata->buttons[i].gpio; struct gpio_keys_button *button = &pdata->buttons[i];
int gpio = button->gpio;
if (irq == gpio_to_irq(gpio)) { if (irq == gpio_to_irq(gpio)) {
int state = (gpio_get_value(gpio) ? 1 : 0) ^ (pdata->buttons[i].active_low); unsigned int type = button->type ?: EV_KEY;
int state = (gpio_get_value(gpio) ? 1 : 0) ^ button->active_low;
input_report_key(input, pdata->buttons[i].keycode, state); input_event(input, type, button->code, !!state);
input_sync(input); input_sync(input);
} }
} }
...@@ -63,8 +66,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) ...@@ -63,8 +66,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
input->name = pdev->name; input->name = pdev->name;
input->phys = "gpio-keys/input0"; input->phys = "gpio-keys/input0";
input->cdev.dev = &pdev->dev; input->dev.parent = &pdev->dev;
input->private = pdata;
input->id.bustype = BUS_HOST; input->id.bustype = BUS_HOST;
input->id.vendor = 0x0001; input->id.vendor = 0x0001;
...@@ -72,19 +74,21 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) ...@@ -72,19 +74,21 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
input->id.version = 0x0100; input->id.version = 0x0100;
for (i = 0; i < pdata->nbuttons; i++) { for (i = 0; i < pdata->nbuttons; i++) {
int code = pdata->buttons[i].keycode; struct gpio_keys_button *button = &pdata->buttons[i];
int irq = gpio_to_irq(pdata->buttons[i].gpio); int irq = gpio_to_irq(button->gpio);
unsigned int type = button->type ?: EV_KEY;
set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM, error = request_irq(irq, gpio_keys_isr, IRQF_SAMPLE_RANDOM,
pdata->buttons[i].desc ? pdata->buttons[i].desc : "gpio_keys", button->desc ? button->desc : "gpio_keys",
pdev); pdev);
if (error) { if (error) {
printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n", printk(KERN_ERR "gpio-keys: unable to claim irq %d; error %d\n",
irq, error); irq, error);
goto fail; goto fail;
} }
set_bit(code, input->keybit);
input_set_capability(input, type, button->code);
} }
error = input_register_device(input); error = input_register_device(input);
......
...@@ -51,7 +51,7 @@ MODULE_LICENSE("Dual BSD/GPL"); ...@@ -51,7 +51,7 @@ MODULE_LICENSE("Dual BSD/GPL");
#define HIL_KBD_SET1_UPBIT 0x01 #define HIL_KBD_SET1_UPBIT 0x01
#define HIL_KBD_SET1_SHIFT 1 #define HIL_KBD_SET1_SHIFT 1
static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] = static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly =
{ HIL_KEYCODES_SET1 }; { HIL_KEYCODES_SET1 };
#define HIL_KBD_SET2_UPBIT 0x01 #define HIL_KBD_SET2_UPBIT 0x01
...@@ -60,10 +60,10 @@ static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] = ...@@ -60,10 +60,10 @@ static unsigned int hil_kbd_set1[HIL_KEYCODES_SET1_TBLSIZE] =
#define HIL_KBD_SET3_UPBIT 0x80 #define HIL_KBD_SET3_UPBIT 0x80
#define HIL_KBD_SET3_SHIFT 0 #define HIL_KBD_SET3_SHIFT 0
static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] = static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] __read_mostly =
{ HIL_KEYCODES_SET3 }; { HIL_KEYCODES_SET3 };
static char hil_language[][16] = { HIL_LOCALE_MAP }; static const char hil_language[][16] = { HIL_LOCALE_MAP };
struct hil_kbd { struct hil_kbd {
struct input_dev *dev; struct input_dev *dev;
...@@ -95,9 +95,11 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) ...@@ -95,9 +95,11 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
p = data[idx - 1]; p = data[idx - 1];
if ((p & ~HIL_CMDCT_POL) == if ((p & ~HIL_CMDCT_POL) ==
(HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) goto report; (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL))
goto report;
if ((p & ~HIL_CMDCT_RPL) == if ((p & ~HIL_CMDCT_RPL) ==
(HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL)) goto report; (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL))
goto report;
/* Not a poll response. See if we are loading config records. */ /* Not a poll response. See if we are loading config records. */
switch (p & HIL_PKT_DATA_MASK) { switch (p & HIL_PKT_DATA_MASK) {
...@@ -107,27 +109,32 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) ...@@ -107,27 +109,32 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
for (; i < HIL_KBD_MAX_LENGTH; i++) for (; i < HIL_KBD_MAX_LENGTH; i++)
kbd->idd[i] = 0; kbd->idd[i] = 0;
break; break;
case HIL_CMD_RSC: case HIL_CMD_RSC:
for (i = 0; i < idx; i++) for (i = 0; i < idx; i++)
kbd->rsc[i] = kbd->data[i] & HIL_PKT_DATA_MASK; kbd->rsc[i] = kbd->data[i] & HIL_PKT_DATA_MASK;
for (; i < HIL_KBD_MAX_LENGTH; i++) for (; i < HIL_KBD_MAX_LENGTH; i++)
kbd->rsc[i] = 0; kbd->rsc[i] = 0;
break; break;
case HIL_CMD_EXD: case HIL_CMD_EXD:
for (i = 0; i < idx; i++) for (i = 0; i < idx; i++)
kbd->exd[i] = kbd->data[i] & HIL_PKT_DATA_MASK; kbd->exd[i] = kbd->data[i] & HIL_PKT_DATA_MASK;
for (; i < HIL_KBD_MAX_LENGTH; i++) for (; i < HIL_KBD_MAX_LENGTH; i++)
kbd->exd[i] = 0; kbd->exd[i] = 0;
break; break;
case HIL_CMD_RNM: case HIL_CMD_RNM:
for (i = 0; i < idx; i++) for (i = 0; i < idx; i++)
kbd->rnm[i] = kbd->data[i] & HIL_PKT_DATA_MASK; kbd->rnm[i] = kbd->data[i] & HIL_PKT_DATA_MASK;
for (; i < HIL_KBD_MAX_LENGTH + 1; i++) for (; i < HIL_KBD_MAX_LENGTH + 1; i++)
kbd->rnm[i] = '\0'; kbd->rnm[i] = '\0';
break; break;
default: default:
/* These occur when device isn't present */ /* These occur when device isn't present */
if (p == (HIL_ERR_INT | HIL_PKT_CMD)) break; if (p == (HIL_ERR_INT | HIL_PKT_CMD))
break;
/* Anything else we'd like to know about. */ /* Anything else we'd like to know about. */
printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p); printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p);
break; break;
...@@ -139,16 +146,19 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) ...@@ -139,16 +146,19 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
switch (kbd->data[0] & HIL_POL_CHARTYPE_MASK) { switch (kbd->data[0] & HIL_POL_CHARTYPE_MASK) {
case HIL_POL_CHARTYPE_NONE: case HIL_POL_CHARTYPE_NONE:
break; break;
case HIL_POL_CHARTYPE_ASCII: case HIL_POL_CHARTYPE_ASCII:
while (cnt < idx - 1) while (cnt < idx - 1)
input_report_key(dev, kbd->data[cnt++] & 0x7f, 1); input_report_key(dev, kbd->data[cnt++] & 0x7f, 1);
break; break;
case HIL_POL_CHARTYPE_RSVD1: case HIL_POL_CHARTYPE_RSVD1:
case HIL_POL_CHARTYPE_RSVD2: case HIL_POL_CHARTYPE_RSVD2:
case HIL_POL_CHARTYPE_BINARY: case HIL_POL_CHARTYPE_BINARY:
while (cnt < idx - 1) while (cnt < idx - 1)
input_report_key(dev, kbd->data[cnt++], 1); input_report_key(dev, kbd->data[cnt++], 1);
break; break;
case HIL_POL_CHARTYPE_SET1: case HIL_POL_CHARTYPE_SET1:
while (cnt < idx - 1) { while (cnt < idx - 1) {
unsigned int key; unsigned int key;
...@@ -161,6 +171,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) ...@@ -161,6 +171,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
input_report_key(dev, key, !up); input_report_key(dev, key, !up);
} }
break; break;
case HIL_POL_CHARTYPE_SET2: case HIL_POL_CHARTYPE_SET2:
while (cnt < idx - 1) { while (cnt < idx - 1) {
unsigned int key; unsigned int key;
...@@ -173,6 +184,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) ...@@ -173,6 +184,7 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
input_report_key(dev, key, !up); input_report_key(dev, key, !up);
} }
break; break;
case HIL_POL_CHARTYPE_SET3: case HIL_POL_CHARTYPE_SET3:
while (cnt < idx - 1) { while (cnt < idx - 1) {
unsigned int key; unsigned int key;
...@@ -191,7 +203,8 @@ static void hil_kbd_process_record(struct hil_kbd *kbd) ...@@ -191,7 +203,8 @@ static void hil_kbd_process_record(struct hil_kbd *kbd)
up(&kbd->sem); up(&kbd->sem);
} }
static void hil_kbd_process_err(struct hil_kbd *kbd) { static void hil_kbd_process_err(struct hil_kbd *kbd)
{
printk(KERN_WARNING PREFIX "errored HIL packet\n"); printk(KERN_WARNING PREFIX "errored HIL packet\n");
kbd->idx4 = 0; kbd->idx4 = 0;
up(&kbd->sem); up(&kbd->sem);
...@@ -205,28 +218,28 @@ static irqreturn_t hil_kbd_interrupt(struct serio *serio, ...@@ -205,28 +218,28 @@ static irqreturn_t hil_kbd_interrupt(struct serio *serio,
int idx; int idx;
kbd = serio_get_drvdata(serio); kbd = serio_get_drvdata(serio);
if (kbd == NULL) { BUG_ON(kbd == NULL);
BUG();
return IRQ_HANDLED;
}
if (kbd->idx4 >= (HIL_KBD_MAX_LENGTH * sizeof(hil_packet))) { if (kbd->idx4 >= (HIL_KBD_MAX_LENGTH * sizeof(hil_packet))) {
hil_kbd_process_err(kbd); hil_kbd_process_err(kbd);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
idx = kbd->idx4/4; idx = kbd->idx4/4;
if (!(kbd->idx4 % 4)) kbd->data[idx] = 0; if (!(kbd->idx4 % 4))
kbd->data[idx] = 0;
packet = kbd->data[idx]; packet = kbd->data[idx];
packet |= ((hil_packet)data) << ((3 - (kbd->idx4 % 4)) * 8); packet |= ((hil_packet)data) << ((3 - (kbd->idx4 % 4)) * 8);
kbd->data[idx] = packet; kbd->data[idx] = packet;
/* Records of N 4-byte hil_packets must terminate with a command. */ /* Records of N 4-byte hil_packets must terminate with a command. */
if ((++(kbd->idx4)) % 4) return IRQ_HANDLED; if ((++(kbd->idx4)) % 4)
return IRQ_HANDLED;
if ((packet & 0xffff0000) != HIL_ERR_INT) { if ((packet & 0xffff0000) != HIL_ERR_INT) {
hil_kbd_process_err(kbd); hil_kbd_process_err(kbd);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
if (packet & HIL_PKT_CMD) hil_kbd_process_record(kbd); if (packet & HIL_PKT_CMD)
hil_kbd_process_record(kbd);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -235,10 +248,7 @@ static void hil_kbd_disconnect(struct serio *serio) ...@@ -235,10 +248,7 @@ static void hil_kbd_disconnect(struct serio *serio)
struct hil_kbd *kbd; struct hil_kbd *kbd;
kbd = serio_get_drvdata(serio); kbd = serio_get_drvdata(serio);
if (kbd == NULL) { BUG_ON(kbd == NULL);
BUG();
return;
}
serio_close(serio); serio_close(serio);
input_unregister_device(kbd->dev); input_unregister_device(kbd->dev);
...@@ -259,42 +269,40 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -259,42 +269,40 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
if (!kbd->dev) if (!kbd->dev)
goto bail0; goto bail0;
kbd->dev->private = kbd;
if (serio_open(serio, drv)) if (serio_open(serio, drv))
goto bail1; goto bail1;
serio_set_drvdata(serio, kbd); serio_set_drvdata(serio, kbd);
kbd->serio = serio; kbd->serio = serio;
init_MUTEX_LOCKED(&(kbd->sem)); init_MUTEX_LOCKED(&kbd->sem);
/* Get device info. MLC driver supplies devid/status/etc. */ /* Get device info. MLC driver supplies devid/status/etc. */
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_IDD); serio->write(serio, HIL_CMD_IDD);
down(&(kbd->sem)); down(&kbd->sem);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_RSC); serio->write(serio, HIL_CMD_RSC);
down(&(kbd->sem)); down(&kbd->sem);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_RNM); serio->write(serio, HIL_CMD_RNM);
down(&(kbd->sem)); down(&kbd->sem);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_EXD); serio->write(serio, HIL_CMD_EXD);
down(&(kbd->sem)); down(&kbd->sem);
up(&(kbd->sem)); up(&kbd->sem);
did = kbd->idd[0]; did = kbd->idd[0];
idd = kbd->idd + 1; idd = kbd->idd + 1;
...@@ -310,12 +318,11 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -310,12 +318,11 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
goto bail2; goto bail2;
} }
if(HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) { if (HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) {
printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n"); printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n");
goto bail2; goto bail2;
} }
kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); kbd->dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL); kbd->dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL);
kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE; kbd->dev->keycodemax = HIL_KEYCODES_SET1_TBLSIZE;
...@@ -328,7 +335,7 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -328,7 +335,7 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
kbd->dev->id.vendor = PCI_VENDOR_ID_HP; kbd->dev->id.vendor = PCI_VENDOR_ID_HP;
kbd->dev->id.product = 0x0001; /* TODO: get from kbd->rsc */ kbd->dev->id.product = 0x0001; /* TODO: get from kbd->rsc */
kbd->dev->id.version = 0x0100; /* TODO: get from kbd->rsc */ kbd->dev->id.version = 0x0100; /* TODO: get from kbd->rsc */
kbd->dev->cdev.dev = &serio->dev; kbd->dev->dev.parent = &serio->dev;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
set_bit(hil_kbd_set1[i], kbd->dev->keybit); set_bit(hil_kbd_set1[i], kbd->dev->keybit);
...@@ -344,8 +351,8 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -344,8 +351,8 @@ static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */ serio->write(serio, HIL_CMD_EK1); /* Enable Keyswitch Autorepeat 1 */
down(&(kbd->sem)); down(&kbd->sem);
up(&(kbd->sem)); up(&kbd->sem);
return 0; return 0;
bail2: bail2:
...@@ -368,7 +375,7 @@ static struct serio_device_id hil_kbd_ids[] = { ...@@ -368,7 +375,7 @@ static struct serio_device_id hil_kbd_ids[] = {
{ 0 } { 0 }
}; };
struct serio_driver hil_kbd_serio_drv = { static struct serio_driver hil_kbd_serio_drv = {
.driver = { .driver = {
.name = "hil_kbd", .name = "hil_kbd",
}, },
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) 1998 Philip Blundell <philb@gnu.org> * Copyright (C) 1998 Philip Blundell <philb@gnu.org>
* Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai> * Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai>
* Copyright (C) 1999-2006 Helge Deller <deller@gmx.de> * Copyright (C) 1999-2007 Helge Deller <deller@gmx.de>
* *
* Very basic HP Human Interface Loop (HIL) driver. * Very basic HP Human Interface Loop (HIL) driver.
* This driver handles the keyboard on HP300 (m68k) and on some * This driver handles the keyboard on HP300 (m68k) and on some
...@@ -89,7 +89,7 @@ MODULE_LICENSE("GPL v2"); ...@@ -89,7 +89,7 @@ MODULE_LICENSE("GPL v2");
#define HIL_READKBDSADR 0xF9 #define HIL_READKBDSADR 0xF9
#define HIL_WRITEKBDSADR 0xE9 #define HIL_WRITEKBDSADR 0xE9
static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] = static unsigned int hphilkeyb_keycode[HIL_KEYCODES_SET1_TBLSIZE] __read_mostly =
{ HIL_KEYCODES_SET1 }; { HIL_KEYCODES_SET1 };
/* HIL structure */ /* HIL structure */
...@@ -211,10 +211,10 @@ hil_keyb_init(void) ...@@ -211,10 +211,10 @@ hil_keyb_init(void)
return -ENODEV; /* already initialized */ return -ENODEV; /* already initialized */
} }
spin_lock_init(&hil_dev.lock);
hil_dev.dev = input_allocate_device(); hil_dev.dev = input_allocate_device();
if (!hil_dev.dev) if (!hil_dev.dev)
return -ENOMEM; return -ENOMEM;
hil_dev.dev->private = &hil_dev;
#if defined(CONFIG_HP300) #if defined(CONFIG_HP300)
if (!hwreg_present((void *)(HILBASE + HIL_DATA))) { if (!hwreg_present((void *)(HILBASE + HIL_DATA))) {
......
...@@ -515,7 +515,7 @@ static int ...@@ -515,7 +515,7 @@ static int
lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code, lkkbd_event (struct input_dev *dev, unsigned int type, unsigned int code,
int value) int value)
{ {
struct lkkbd *lk = dev->private; struct lkkbd *lk = input_get_drvdata (dev);
unsigned char leds_on = 0; unsigned char leds_on = 0;
unsigned char leds_off = 0; unsigned char leds_off = 0;
...@@ -666,9 +666,10 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv) ...@@ -666,9 +666,10 @@ lkkbd_connect (struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_LKKBD; input_dev->id.vendor = SERIO_LKKBD;
input_dev->id.product = 0; input_dev->id.product = 0;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->event = lkkbd_event; input_dev->event = lkkbd_event;
input_dev->private = lk;
input_set_drvdata (input_dev, lk);
set_bit (EV_KEY, input_dev->evbit); set_bit (EV_KEY, input_dev->evbit);
set_bit (EV_LED, input_dev->evbit); set_bit (EV_LED, input_dev->evbit);
......
...@@ -231,7 +231,7 @@ static int locomokbd_probe(struct locomo_dev *dev) ...@@ -231,7 +231,7 @@ static int locomokbd_probe(struct locomo_dev *dev)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->private = locomokbd; input_dev->dev.parent = &dev->dev;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = locomokbd->keycode; input_dev->keycode = locomokbd->keycode;
......
...@@ -104,8 +104,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -104,8 +104,7 @@ static int nkbd_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_NEWTON; input_dev->id.vendor = SERIO_NEWTON;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = nkbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = nkbd->keycode; input_dev->keycode = nkbd->keycode;
......
...@@ -370,8 +370,7 @@ static int __init omap_kp_probe(struct platform_device *pdev) ...@@ -370,8 +370,7 @@ static int __init omap_kp_probe(struct platform_device *pdev)
set_bit(keymap[i] & KEY_MAX, input_dev->keybit); set_bit(keymap[i] & KEY_MAX, input_dev->keybit);
input_dev->name = "omap-keypad"; input_dev->name = "omap-keypad";
input_dev->phys = "omap-keypad/input0"; input_dev->phys = "omap-keypad/input0";
input_dev->cdev.dev = &pdev->dev; input_dev->dev.parent = &pdev->dev;
input_dev->private = omap_kp;
input_dev->id.bustype = BUS_HOST; input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
......
/*
* linux/drivers/input/keyboard/pxa27x_keyboard.c
*
* Driver for the pxa27x matrix keyboard controller.
*
* Created: Feb 22, 2007
* Author: Rodolfo Giometti <giometti@linux.it>
*
* Based on a previous implementations by Kevin O'Connor
* <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and
* on some suggestions by Nicolas Pitre <nico@cam.org>.
*
* 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/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/pxa27x_keyboard.h>
#define DRIVER_NAME "pxa27x-keyboard"
#define KPASMKP(col) (col/2 == 0 ? KPASMKP0 : \
col/2 == 1 ? KPASMKP1 : \
col/2 == 2 ? KPASMKP2 : KPASMKP3)
#define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2)))
static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id)
{
struct platform_device *pdev = dev_id;
struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
struct input_dev *input_dev = platform_get_drvdata(pdev);
unsigned long kpc = KPC;
int p, row, col, rel;
if (kpc & KPC_DI) {
unsigned long kpdk = KPDK;
if (!(kpdk & KPDK_DKP)) {
/* better luck next time */
} else if (kpc & KPC_REE0) {
unsigned long kprec = KPREC;
KPREC = 0x7f;
if (kprec & KPREC_OF0)
rel = (kprec & 0xff) + 0x7f;
else if (kprec & KPREC_UF0)
rel = (kprec & 0xff) - 0x7f - 0xff;
else
rel = (kprec & 0xff) - 0x7f;
if (rel) {
input_report_rel(input_dev, REL_WHEEL, rel);
input_sync(input_dev);
}
}
}
if (kpc & KPC_MI) {
/* report the status of every button */
for (row = 0; row < pdata->nr_rows; row++) {
for (col = 0; col < pdata->nr_cols; col++) {
p = KPASMKP(col) & KPASMKPx_MKC(row, col) ?
1 : 0;
pr_debug("keycode %x - pressed %x\n",
pdata->keycodes[row][col], p);
input_report_key(input_dev,
pdata->keycodes[row][col], p);
}
}
input_sync(input_dev);
}
return IRQ_HANDLED;
}
static int pxakbd_open(struct input_dev *dev)
{
/* Set keypad control register */
KPC |= (KPC_ASACT |
KPC_MS_ALL |
(2 << 6) | KPC_REE0 | KPC_DK_DEB_SEL |
KPC_ME | KPC_MIE | KPC_DE | KPC_DIE);
KPC &= ~KPC_AS; /* disable automatic scan */
KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */
/* Set rotary count to mid-point value */
KPREC = 0x7F;
/* Enable unit clock */
pxa_set_cken(CKEN19_KEYPAD, 1);
return 0;
}
static void pxakbd_close(struct input_dev *dev)
{
/* Disable clock unit */
pxa_set_cken(CKEN19_KEYPAD, 0);
}
#ifdef CONFIG_PM
static int pxakbd_suspend(struct platform_device *pdev, pm_message_t state)
{
struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
/* Save controller status */
pdata->reg_kpc = KPC;
pdata->reg_kprec = KPREC;
return 0;
}
static int pxakbd_resume(struct platform_device *pdev)
{
struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
struct input_dev *input_dev = platform_get_drvdata(pdev);
mutex_lock(&input_dev->mutex);
if (input_dev->users) {
/* Restore controller status */
KPC = pdata->reg_kpc;
KPREC = pdata->reg_kprec;
/* Enable unit clock */
pxa_set_cken(CKEN19_KEYPAD, 1);
}
mutex_unlock(&input_dev->mutex);
return 0;
}
#else
#define pxakbd_suspend NULL
#define pxakbd_resume NULL
#endif
static int __devinit pxakbd_probe(struct platform_device *pdev)
{
struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
struct input_dev *input_dev;
int i, row, col, error;
/* Create and register the input driver. */
input_dev = input_allocate_device();
if (!input_dev) {
printk(KERN_ERR "Cannot request keypad device\n");
return -ENOMEM;
}
input_dev->name = DRIVER_NAME;
input_dev->id.bustype = BUS_HOST;
input_dev->open = pxakbd_open;
input_dev->close = pxakbd_close;
input_dev->dev.parent = &pdev->dev;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL);
input_dev->relbit[LONG(REL_WHEEL)] = BIT(REL_WHEEL);
for (row = 0; row < pdata->nr_rows; row++) {
for (col = 0; col < pdata->nr_cols; col++) {
int code = pdata->keycodes[row][col];
if (code > 0)
set_bit(code, input_dev->keybit);
}
}
error = request_irq(IRQ_KEYPAD, pxakbd_irq_handler, IRQF_DISABLED,
DRIVER_NAME, pdev);
if (error) {
printk(KERN_ERR "Cannot request keypad IRQ\n");
pxa_set_cken(CKEN19_KEYPAD, 0);
goto err_free_dev;
}
platform_set_drvdata(pdev, input_dev);
/* Register the input device */
error = input_register_device(input_dev);
if (error)
goto err_free_irq;
/* Setup GPIOs. */
for (i = 0; i < pdata->nr_rows + pdata->nr_cols; i++)
pxa_gpio_mode(pdata->gpio_modes[i]);
/*
* Store rows/cols info into keyboard registers.
*/
KPC |= (pdata->nr_rows - 1) << 26;
KPC |= (pdata->nr_cols - 1) << 23;
for (col = 0; col < pdata->nr_cols; col++)
KPC |= KPC_MS0 << col;
return 0;
err_free_irq:
platform_set_drvdata(pdev, NULL);
free_irq(IRQ_KEYPAD, pdev);
err_free_dev:
input_free_device(input_dev);
return error;
}
static int __devexit pxakbd_remove(struct platform_device *pdev)
{
struct input_dev *input_dev = platform_get_drvdata(pdev);
input_unregister_device(input_dev);
free_irq(IRQ_KEYPAD, pdev);
platform_set_drvdata(pdev, NULL);
return 0;
}
static struct platform_driver pxakbd_driver = {
.probe = pxakbd_probe,
.remove = __devexit_p(pxakbd_remove),
.suspend = pxakbd_suspend,
.resume = pxakbd_resume,
.driver = {
.name = DRIVER_NAME,
},
};
static int __init pxakbd_init(void)
{
return platform_driver_register(&pxakbd_driver);
}
static void __exit pxakbd_exit(void)
{
platform_driver_unregister(&pxakbd_driver);
}
module_init(pxakbd_init);
module_exit(pxakbd_exit);
MODULE_DESCRIPTION("PXA27x Matrix Keyboard Driver");
MODULE_LICENSE("GPL");
...@@ -372,10 +372,9 @@ static int __init spitzkbd_probe(struct platform_device *dev) ...@@ -372,10 +372,9 @@ static int __init spitzkbd_probe(struct platform_device *dev)
spitzkbd->input = input_dev; spitzkbd->input = input_dev;
input_dev->private = spitzkbd;
input_dev->name = "Spitz Keyboard"; input_dev->name = "Spitz Keyboard";
input_dev->phys = spitzkbd->phys; input_dev->phys = spitzkbd->phys;
input_dev->cdev.dev = &dev->dev; input_dev->dev.parent = &dev->dev;
input_dev->id.bustype = BUS_HOST; input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
......
...@@ -108,8 +108,7 @@ static int skbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -108,8 +108,7 @@ static int skbd_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_STOWAWAY; input_dev->id.vendor = SERIO_STOWAWAY;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = skbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = skbd->keycode; input_dev->keycode = skbd->keycode;
......
...@@ -146,7 +146,7 @@ static irqreturn_t sunkbd_interrupt(struct serio *serio, ...@@ -146,7 +146,7 @@ static irqreturn_t sunkbd_interrupt(struct serio *serio,
static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) static int sunkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{ {
struct sunkbd *sunkbd = dev->private; struct sunkbd *sunkbd = input_get_drvdata(dev);
switch (type) { switch (type) {
...@@ -271,8 +271,10 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -271,8 +271,10 @@ static int sunkbd_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = SERIO_SUNKBD; input_dev->id.vendor = SERIO_SUNKBD;
input_dev->id.product = sunkbd->type; input_dev->id.product = sunkbd->type;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = sunkbd;
input_set_drvdata(input_dev, sunkbd);
input_dev->event = sunkbd_event; input_dev->event = sunkbd_event;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP);
......
...@@ -108,8 +108,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv) ...@@ -108,8 +108,7 @@ static int xtkbd_connect(struct serio *serio, struct serio_driver *drv)
input_dev->id.vendor = 0x0001; input_dev->id.vendor = 0x0001;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &serio->dev; input_dev->dev.parent = &serio->dev;
input_dev->private = xtkbd;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
input_dev->keycode = xtkbd->keycode; input_dev->keycode = xtkbd->keycode;
......
...@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP ...@@ -40,6 +40,16 @@ config INPUT_M68K_BEEP
tristate "M68k Beeper support" tristate "M68k Beeper support"
depends on M68K depends on M68K
config INPUT_COBALT_BTNS
tristate "Cobalt button interface"
depends on MIPS_COBALT
select INPUT_POLLDEV
help
Say Y here if you want to support MIPS Cobalt button interface.
To compile this driver as a module, choose M here: the
module will be called cobalt_btns.
config INPUT_WISTRON_BTNS config INPUT_WISTRON_BTNS
tristate "x86 Wistron laptop button interface" tristate "x86 Wistron laptop button interface"
depends on X86 && !X86_64 depends on X86 && !X86_64
...@@ -81,6 +91,17 @@ config INPUT_UINPUT ...@@ -81,6 +91,17 @@ config INPUT_UINPUT
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called uinput. module will be called uinput.
config INPUT_POLLDEV
tristate "Polled input device skeleton"
help
Say Y here if you are using a driver for an input
device that periodically polls hardware state. This
option is only useful for out-of-tree drivers since
in-tree drivers select it automatically.
To compile this driver as a module, choose M here: the
module will be called input-polldev.
config HP_SDC_RTC config HP_SDC_RTC
tristate "HP SDC Real Time Clock" tristate "HP SDC Real Time Clock"
depends on GSC || HP300 depends on GSC || HP300
......
...@@ -4,10 +4,12 @@ ...@@ -4,10 +4,12 @@
# Each configuration option enables a list of files. # Each configuration option enables a list of files.
obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o obj-$(CONFIG_INPUT_UINPUT) += uinput.o
obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o
obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
......
/*
* Cobalt button interface driver.
*
* Copyright (C) 2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/init.h>
#include <linux/input-polldev.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#define BUTTONS_POLL_INTERVAL 30 /* msec */
#define BUTTONS_COUNT_THRESHOLD 3
#define BUTTONS_STATUS_MASK 0xfe000000
struct buttons_dev {
struct input_polled_dev *poll_dev;
void __iomem *reg;
};
struct buttons_map {
uint32_t mask;
int keycode;
int count;
};
static struct buttons_map buttons_map[] = {
{ 0x02000000, KEY_RESTART, },
{ 0x04000000, KEY_LEFT, },
{ 0x08000000, KEY_UP, },
{ 0x10000000, KEY_DOWN, },
{ 0x20000000, KEY_RIGHT, },
{ 0x40000000, KEY_ENTER, },
{ 0x80000000, KEY_SELECT, },
};
static void handle_buttons(struct input_polled_dev *dev)
{
struct buttons_map *button = buttons_map;
struct buttons_dev *bdev = dev->private;
struct input_dev *input = dev->input;
uint32_t status;
int i;
status = readl(bdev->reg);
status = ~status & BUTTONS_STATUS_MASK;
for (i = 0; i < ARRAY_SIZE(buttons_map); i++) {
if (status & button->mask) {
button->count++;
} else {
if (button->count >= BUTTONS_COUNT_THRESHOLD) {
input_report_key(input, button->keycode, 0);
input_sync(input);
}
button->count = 0;
}
if (button->count == BUTTONS_COUNT_THRESHOLD) {
input_report_key(input, button->keycode, 1);
input_sync(input);
}
button++;
}
}
static int __devinit cobalt_buttons_probe(struct platform_device *pdev)
{
struct buttons_dev *bdev;
struct input_polled_dev *poll_dev;
struct input_dev *input;
struct resource *res;
int error, i;
bdev = kzalloc(sizeof(struct buttons_dev), GFP_KERNEL);
poll_dev = input_allocate_polled_device();
if (!bdev || !poll_dev) {
error = -ENOMEM;
goto err_free_mem;
}
poll_dev->private = bdev;
poll_dev->poll = handle_buttons;
poll_dev->poll_interval = BUTTONS_POLL_INTERVAL;
input = poll_dev->input;
input->name = "Cobalt buttons";
input->phys = "cobalt/input0";
input->id.bustype = BUS_HOST;
input->cdev.dev = &pdev->dev;
input->evbit[0] = BIT(EV_KEY);
for (i = 0; i < ARRAY_SIZE(buttons_map); i++) {
set_bit(buttons_map[i].keycode, input->keybit);
buttons_map[i].count = 0;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
error = -EBUSY;
goto err_free_mem;
}
bdev->poll_dev = poll_dev;
bdev->reg = ioremap(res->start, res->end - res->start + 1);
dev_set_drvdata(&pdev->dev, bdev);
error = input_register_polled_device(poll_dev);
if (error)
goto err_iounmap;
return 0;
err_iounmap:
iounmap(bdev->reg);
err_free_mem:
input_free_polled_device(poll_dev);
kfree(bdev);
dev_set_drvdata(&pdev->dev, NULL);
return error;
}
static int __devexit cobalt_buttons_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct buttons_dev *bdev = dev_get_drvdata(dev);
input_unregister_polled_device(bdev->poll_dev);
input_free_polled_device(bdev->poll_dev);
iounmap(bdev->reg);
kfree(bdev);
dev_set_drvdata(dev, NULL);
return 0;
}
static struct platform_driver cobalt_buttons_driver = {
.probe = cobalt_buttons_probe,
.remove = __devexit_p(cobalt_buttons_remove),
.driver = {
.name = "Cobalt buttons",
.owner = THIS_MODULE,
},
};
static int __init cobalt_buttons_init(void)
{
return platform_driver_register(&cobalt_buttons_driver);
}
static void __exit cobalt_buttons_exit(void)
{
platform_driver_unregister(&cobalt_buttons_driver);
}
module_init(cobalt_buttons_init);
module_exit(cobalt_buttons_exit);
/*
* Generic implementation of a polled input device
* Copyright (c) 2007 Dmitry Torokhov
*
* 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/jiffies.h>
#include <linux/mutex.h>
#include <linux/input-polldev.h>
static DEFINE_MUTEX(polldev_mutex);
static int polldev_users;
static struct workqueue_struct *polldev_wq;
static int input_polldev_start_workqueue(void)
{
int retval;
retval = mutex_lock_interruptible(&polldev_mutex);
if (retval)
return retval;
if (!polldev_users) {
polldev_wq = create_singlethread_workqueue("ipolldevd");
if (!polldev_wq) {
printk(KERN_ERR "input-polldev: failed to create "
"ipolldevd workqueue\n");
retval = -ENOMEM;
goto out;
}
}
polldev_users++;
out:
mutex_unlock(&polldev_mutex);
return retval;
}
static void input_polldev_stop_workqueue(void)
{
mutex_lock(&polldev_mutex);
if (!--polldev_users)
destroy_workqueue(polldev_wq);
mutex_unlock(&polldev_mutex);
}
static void input_polled_device_work(struct work_struct *work)
{
struct input_polled_dev *dev =
container_of(work, struct input_polled_dev, work.work);
dev->poll(dev);
queue_delayed_work(polldev_wq, &dev->work,
msecs_to_jiffies(dev->poll_interval));
}
static int input_open_polled_device(struct input_dev *input)
{
struct input_polled_dev *dev = input->private;
int error;
error = input_polldev_start_workqueue();
if (error)
return error;
if (dev->flush)
dev->flush(dev);
queue_delayed_work(polldev_wq, &dev->work,
msecs_to_jiffies(dev->poll_interval));
return 0;
}
static void input_close_polled_device(struct input_dev *input)
{
struct input_polled_dev *dev = input->private;
cancel_rearming_delayed_workqueue(polldev_wq, &dev->work);
input_polldev_stop_workqueue();
}
/**
* input_allocate_polled_device - allocated memory polled device
*
* The function allocates memory for a polled device and also
* for an input device associated with this polled device.
*/
struct input_polled_dev *input_allocate_polled_device(void)
{
struct input_polled_dev *dev;
dev = kzalloc(sizeof(struct input_polled_dev), GFP_KERNEL);
if (!dev)
return NULL;
dev->input = input_allocate_device();
if (!dev->input) {
kfree(dev);
return NULL;
}
return dev;
}
EXPORT_SYMBOL(input_allocate_polled_device);
/**
* input_free_polled_device - free memory allocated for polled device
* @dev: device to free
*
* The function frees memory allocated for polling device and drops
* reference to the associated input device (if present).
*/
void input_free_polled_device(struct input_polled_dev *dev)
{
if (dev) {
input_free_device(dev->input);
kfree(dev);
}
}
EXPORT_SYMBOL(input_free_polled_device);
/**
* input_register_polled_device - register polled device
* @dev: device to register
*
* The function registers previously initialized polled input device
* with input layer. The device should be allocated with call to
* input_allocate_polled_device(). Callers should also set up poll()
* method and set up capabilities (id, name, phys, bits) of the
* corresponing input_dev structure.
*/
int input_register_polled_device(struct input_polled_dev *dev)
{
struct input_dev *input = dev->input;
INIT_DELAYED_WORK(&dev->work, input_polled_device_work);
if (!dev->poll_interval)
dev->poll_interval = 500;
input->private = dev;
input->open = input_open_polled_device;
input->close = input_close_polled_device;
return input_register_device(input);
}
EXPORT_SYMBOL(input_register_polled_device);
/**
* input_unregister_polled_device - unregister polled device
* @dev: device to unregister
*
* The function unregisters previously registered polled input
* device from input layer. Polling is stopped and device is
* ready to be freed with call to input_free_polled_device().
* Callers should not attempt to access dev->input pointer
* after calling this function.
*/
void input_unregister_polled_device(struct input_polled_dev *dev)
{
input_unregister_device(dev->input);
dev->input = NULL;
}
EXPORT_SYMBOL(input_unregister_polled_device);
...@@ -51,7 +51,7 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count) ...@@ -51,7 +51,7 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{ {
unsigned int pin = (unsigned int) dev->private; unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
unsigned int count = 0; unsigned int count = 0;
if (type != EV_SND) if (type != EV_SND)
...@@ -99,14 +99,15 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev) ...@@ -99,14 +99,15 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
if (!input_dev) if (!input_dev)
return -ENOMEM; return -ENOMEM;
input_dev->private = (void *) dev->id; input_set_drvdata(input_dev, (void *) dev->id);
input_dev->name = "ixp4xx beeper", input_dev->name = "ixp4xx beeper",
input_dev->phys = "ixp4xx/gpio"; input_dev->phys = "ixp4xx/gpio";
input_dev->id.bustype = BUS_HOST; input_dev->id.bustype = BUS_HOST;
input_dev->id.vendor = 0x001f; input_dev->id.vendor = 0x001f;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &dev->dev; input_dev->dev.parent = &dev->dev;
input_dev->evbit[0] = BIT(EV_SND); input_dev->evbit[0] = BIT(EV_SND);
input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
...@@ -136,7 +137,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev) ...@@ -136,7 +137,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev)
static int __devexit ixp4xx_spkr_remove(struct platform_device *dev) static int __devexit ixp4xx_spkr_remove(struct platform_device *dev)
{ {
struct input_dev *input_dev = platform_get_drvdata(dev); struct input_dev *input_dev = platform_get_drvdata(dev);
unsigned int pin = (unsigned int) input_dev->private; unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
input_unregister_device(input_dev); input_unregister_device(input_dev);
platform_set_drvdata(dev, NULL); platform_set_drvdata(dev, NULL);
...@@ -153,7 +154,7 @@ static int __devexit ixp4xx_spkr_remove(struct platform_device *dev) ...@@ -153,7 +154,7 @@ static int __devexit ixp4xx_spkr_remove(struct platform_device *dev)
static void ixp4xx_spkr_shutdown(struct platform_device *dev) static void ixp4xx_spkr_shutdown(struct platform_device *dev)
{ {
struct input_dev *input_dev = platform_get_drvdata(dev); struct input_dev *input_dev = platform_get_drvdata(dev);
unsigned int pin = (unsigned int) input_dev->private; unsigned int pin = (unsigned int) input_get_drvdata(input_dev);
/* turn off the speaker */ /* turn off the speaker */
disable_irq(IRQ_IXP4XX_TIMER2); disable_irq(IRQ_IXP4XX_TIMER2);
......
...@@ -63,7 +63,7 @@ static int __devinit m68kspkr_probe(struct platform_device *dev) ...@@ -63,7 +63,7 @@ static int __devinit m68kspkr_probe(struct platform_device *dev)
input_dev->id.vendor = 0x001f; input_dev->id.vendor = 0x001f;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = &dev->dev; input_dev->dev.parent = &dev->dev;
input_dev->evbit[0] = BIT(EV_SND); input_dev->evbit[0] = BIT(EV_SND);
input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
......
...@@ -78,7 +78,7 @@ static int __devinit pcspkr_probe(struct platform_device *dev) ...@@ -78,7 +78,7 @@ static int __devinit pcspkr_probe(struct platform_device *dev)
pcspkr_dev->id.vendor = 0x001f; pcspkr_dev->id.vendor = 0x001f;
pcspkr_dev->id.product = 0x0001; pcspkr_dev->id.product = 0x0001;
pcspkr_dev->id.version = 0x0100; pcspkr_dev->id.version = 0x0100;
pcspkr_dev->cdev.dev = &dev->dev; pcspkr_dev->dev.parent = &dev->dev;
pcspkr_dev->evbit[0] = BIT(EV_SND); pcspkr_dev->evbit[0] = BIT(EV_SND);
pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); pcspkr_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
......
...@@ -28,7 +28,7 @@ struct sparcspkr_state { ...@@ -28,7 +28,7 @@ struct sparcspkr_state {
static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{ {
struct sparcspkr_state *state = dev_get_drvdata(dev->cdev.dev); struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent);
unsigned int count = 0; unsigned int count = 0;
unsigned long flags; unsigned long flags;
...@@ -61,7 +61,7 @@ static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned in ...@@ -61,7 +61,7 @@ static int ebus_spkr_event(struct input_dev *dev, unsigned int type, unsigned in
static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) static int isa_spkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{ {
struct sparcspkr_state *state = dev_get_drvdata(dev->cdev.dev); struct sparcspkr_state *state = dev_get_drvdata(dev->dev.parent);
unsigned int count = 0; unsigned int count = 0;
unsigned long flags; unsigned long flags;
...@@ -113,7 +113,7 @@ static int __devinit sparcspkr_probe(struct device *dev) ...@@ -113,7 +113,7 @@ static int __devinit sparcspkr_probe(struct device *dev)
input_dev->id.vendor = 0x001f; input_dev->id.vendor = 0x001f;
input_dev->id.product = 0x0001; input_dev->id.product = 0x0001;
input_dev->id.version = 0x0100; input_dev->id.version = 0x0100;
input_dev->cdev.dev = dev; input_dev->dev.parent = dev;
input_dev->evbit[0] = BIT(EV_SND); input_dev->evbit[0] = BIT(EV_SND);
input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE); input_dev->sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
......
...@@ -41,9 +41,7 @@ ...@@ -41,9 +41,7 @@
static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{ {
struct uinput_device *udev; struct uinput_device *udev = input_get_drvdata(dev);
udev = dev->private;
udev->buff[udev->head].type = type; udev->buff[udev->head].type = type;
udev->buff[udev->head].code = code; udev->buff[udev->head].code = code;
...@@ -136,7 +134,7 @@ static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *eff ...@@ -136,7 +134,7 @@ static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *eff
request.u.upload.effect = effect; request.u.upload.effect = effect;
request.u.upload.old = old; request.u.upload.old = old;
retval = uinput_request_reserve_slot(dev->private, &request); retval = uinput_request_reserve_slot(input_get_drvdata(dev), &request);
if (!retval) if (!retval)
retval = uinput_request_submit(dev, &request); retval = uinput_request_submit(dev, &request);
...@@ -156,7 +154,7 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) ...@@ -156,7 +154,7 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id)
request.code = UI_FF_ERASE; request.code = UI_FF_ERASE;
request.u.effect_id = effect_id; request.u.effect_id = effect_id;
retval = uinput_request_reserve_slot(dev->private, &request); retval = uinput_request_reserve_slot(input_get_drvdata(dev), &request);
if (!retval) if (!retval)
retval = uinput_request_submit(dev, &request); retval = uinput_request_submit(dev, &request);
...@@ -274,7 +272,7 @@ static int uinput_allocate_device(struct uinput_device *udev) ...@@ -274,7 +272,7 @@ static int uinput_allocate_device(struct uinput_device *udev)
return -ENOMEM; return -ENOMEM;
udev->dev->event = uinput_dev_event; udev->dev->event = uinput_dev_event;
udev->dev->private = udev; input_set_drvdata(udev->dev, udev);
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -37,6 +37,65 @@ config MOUSE_PS2 ...@@ -37,6 +37,65 @@ config MOUSE_PS2
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called psmouse. module will be called psmouse.
config MOUSE_PS2_ALPS
bool "ALPS PS/2 mouse protocol extension" if EMBEDDED
default y
depends on MOUSE_PS2
---help---
Say Y here if you have an ALPS PS/2 touchpad connected to
your system.
If unsure, say Y.
config MOUSE_PS2_LOGIPS2PP
bool "Logictech PS/2++ mouse protocol extension" if EMBEDDED
default y
depends on MOUSE_PS2
---help---
Say Y here if you have a Logictech PS/2++ mouse connected to
your system.
If unsure, say Y.
config MOUSE_PS2_SYNAPTICS
bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED
default y
depends on MOUSE_PS2
---help---
Say Y here if you have a Synaptics PS/2 TouchPad connected to
your system.
If unsure, say Y.
config MOUSE_PS2_LIFEBOOK
bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
default y
depends on MOUSE_PS2
---help---
Say Y here if you have a Fujitsu B-series Lifebook PS/2
TouchScreen connected to your system.
If unsure, say Y.
config MOUSE_PS2_TRACKPOINT
bool "IBM Trackpoint PS/2 mouse protocol extension" if EMBEDDED
default y
depends on MOUSE_PS2
---help---
Say Y here if you have an IBM Trackpoint PS/2 mouse connected
to your system.
If unsure, say Y.
config MOUSE_PS2_TOUCHKIT
bool "eGalax TouchKit PS/2 protocol extension"
depends on MOUSE_PS2
---help---
Say Y here if you have an eGalax TouchKit PS/2 touchscreen
connected to your system.
If unsure, say N.
config MOUSE_SERIAL config MOUSE_SERIAL
tristate "Serial mouse" tristate "Serial mouse"
select SERIO select SERIO
......
...@@ -15,4 +15,10 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o ...@@ -15,4 +15,10 @@ obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o
obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o obj-$(CONFIG_MOUSE_HIL) += hil_ptr.o
obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o
psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o lifebook.o trackpoint.o psmouse-objs := psmouse-base.o synaptics.o
psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o
psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o
psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o
psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o
psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o
...@@ -424,14 +424,15 @@ int alps_init(struct psmouse *psmouse) ...@@ -424,14 +424,15 @@ int alps_init(struct psmouse *psmouse)
struct input_dev *dev1 = psmouse->dev, *dev2; struct input_dev *dev1 = psmouse->dev, *dev2;
int version; int version;
psmouse->private = priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL); priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
dev2 = input_allocate_device(); dev2 = input_allocate_device();
if (!priv || !dev2) if (!priv || !dev2)
goto init_fail; goto init_fail;
priv->dev2 = dev2; priv->dev2 = dev2;
if (!(priv->i = alps_get_model(psmouse, &version))) priv->i = alps_get_model(psmouse, &version);
if (!priv->i)
goto init_fail; goto init_fail;
if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1))
...@@ -480,7 +481,8 @@ int alps_init(struct psmouse *psmouse) ...@@ -480,7 +481,8 @@ int alps_init(struct psmouse *psmouse)
dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y); dev2->relbit[LONG(REL_X)] |= BIT(REL_X) | BIT(REL_Y);
dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); dev2->keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
input_register_device(priv->dev2); if (input_register_device(priv->dev2))
goto init_fail;
psmouse->protocol_handler = alps_process_byte; psmouse->protocol_handler = alps_process_byte;
psmouse->poll = alps_poll; psmouse->poll = alps_poll;
...@@ -491,9 +493,11 @@ int alps_init(struct psmouse *psmouse) ...@@ -491,9 +493,11 @@ int alps_init(struct psmouse *psmouse)
/* We are having trouble resyncing ALPS touchpads so disable it for now */ /* We are having trouble resyncing ALPS touchpads so disable it for now */
psmouse->resync_time = 0; psmouse->resync_time = 0;
psmouse->private = priv;
return 0; return 0;
init_fail: init_fail:
psmouse_reset(psmouse);
input_free_device(dev2); input_free_device(dev2);
kfree(priv); kfree(priv);
return -1; return -1;
...@@ -504,7 +508,8 @@ int alps_detect(struct psmouse *psmouse, int set_properties) ...@@ -504,7 +508,8 @@ int alps_detect(struct psmouse *psmouse, int set_properties)
int version; int version;
const struct alps_model_info *model; const struct alps_model_info *model;
if (!(model = alps_get_model(psmouse, &version))) model = alps_get_model(psmouse, &version);
if (!model)
return -1; return -1;
if (set_properties) { if (set_properties) {
......
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
#ifndef _ALPS_H #ifndef _ALPS_H
#define _ALPS_H #define _ALPS_H
int alps_detect(struct psmouse *psmouse, int set_properties);
int alps_init(struct psmouse *psmouse);
struct alps_model_info { struct alps_model_info {
unsigned char signature[3]; unsigned char signature[3];
unsigned char byte0, mask0; unsigned char byte0, mask0;
...@@ -23,10 +20,23 @@ struct alps_model_info { ...@@ -23,10 +20,23 @@ struct alps_model_info {
struct alps_data { struct alps_data {
struct input_dev *dev2; /* Relative device */ struct input_dev *dev2; /* Relative device */
char name[32]; /* Name */
char phys[32]; /* Phys */ char phys[32]; /* Phys */
const struct alps_model_info *i;/* Info */ const struct alps_model_info *i;/* Info */
int prev_fin; /* Finger bit from previous packet */ int prev_fin; /* Finger bit from previous packet */
}; };
#ifdef CONFIG_MOUSE_PS2_ALPS
int alps_detect(struct psmouse *psmouse, int set_properties);
int alps_init(struct psmouse *psmouse);
#else
inline int alps_detect(struct psmouse *psmouse, int set_properties)
{
return -ENOSYS;
}
inline int alps_init(struct psmouse *psmouse)
{
return -ENOSYS;
}
#endif /* CONFIG_MOUSE_PS2_ALPS */
#endif #endif
...@@ -89,9 +89,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr) ...@@ -89,9 +89,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
p = data[idx - 1]; p = data[idx - 1];
if ((p & ~HIL_CMDCT_POL) == if ((p & ~HIL_CMDCT_POL) ==
(HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL)) goto report; (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_POL))
goto report;
if ((p & ~HIL_CMDCT_RPL) == if ((p & ~HIL_CMDCT_RPL) ==
(HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL)) goto report; (HIL_ERR_INT | HIL_PKT_CMD | HIL_CMD_RPL))
goto report;
/* Not a poll response. See if we are loading config records. */ /* Not a poll response. See if we are loading config records. */
switch (p & HIL_PKT_DATA_MASK) { switch (p & HIL_PKT_DATA_MASK) {
...@@ -101,27 +103,32 @@ static void hil_ptr_process_record(struct hil_ptr *ptr) ...@@ -101,27 +103,32 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
for (; i < HIL_PTR_MAX_LENGTH; i++) for (; i < HIL_PTR_MAX_LENGTH; i++)
ptr->idd[i] = 0; ptr->idd[i] = 0;
break; break;
case HIL_CMD_RSC: case HIL_CMD_RSC:
for (i = 0; i < idx; i++) for (i = 0; i < idx; i++)
ptr->rsc[i] = ptr->data[i] & HIL_PKT_DATA_MASK; ptr->rsc[i] = ptr->data[i] & HIL_PKT_DATA_MASK;
for (; i < HIL_PTR_MAX_LENGTH; i++) for (; i < HIL_PTR_MAX_LENGTH; i++)
ptr->rsc[i] = 0; ptr->rsc[i] = 0;
break; break;
case HIL_CMD_EXD: case HIL_CMD_EXD:
for (i = 0; i < idx; i++) for (i = 0; i < idx; i++)
ptr->exd[i] = ptr->data[i] & HIL_PKT_DATA_MASK; ptr->exd[i] = ptr->data[i] & HIL_PKT_DATA_MASK;
for (; i < HIL_PTR_MAX_LENGTH; i++) for (; i < HIL_PTR_MAX_LENGTH; i++)
ptr->exd[i] = 0; ptr->exd[i] = 0;
break; break;
case HIL_CMD_RNM: case HIL_CMD_RNM:
for (i = 0; i < idx; i++) for (i = 0; i < idx; i++)
ptr->rnm[i] = ptr->data[i] & HIL_PKT_DATA_MASK; ptr->rnm[i] = ptr->data[i] & HIL_PKT_DATA_MASK;
for (; i < HIL_PTR_MAX_LENGTH + 1; i++) for (; i < HIL_PTR_MAX_LENGTH + 1; i++)
ptr->rnm[i] = '\0'; ptr->rnm[i] = 0;
break; break;
default: default:
/* These occur when device isn't present */ /* These occur when device isn't present */
if (p == (HIL_ERR_INT | HIL_PKT_CMD)) break; if (p == (HIL_ERR_INT | HIL_PKT_CMD))
break;
/* Anything else we'd like to know about. */ /* Anything else we'd like to know about. */
printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p); printk(KERN_WARNING PREFIX "Device sent unknown record %x\n", p);
break; break;
...@@ -130,7 +137,8 @@ static void hil_ptr_process_record(struct hil_ptr *ptr) ...@@ -130,7 +137,8 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
report: report:
if ((p & HIL_CMDCT_POL) != idx - 1) { if ((p & HIL_CMDCT_POL) != idx - 1) {
printk(KERN_WARNING PREFIX "Malformed poll packet %x (idx = %i)\n", p, idx); printk(KERN_WARNING PREFIX
"Malformed poll packet %x (idx = %i)\n", p, idx);
goto out; goto out;
} }
...@@ -157,7 +165,8 @@ static void hil_ptr_process_record(struct hil_ptr *ptr) ...@@ -157,7 +165,8 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
input_report_abs(dev, ABS_X + i, val); input_report_abs(dev, ABS_X + i, val);
} else { } else {
val = (int) (((int8_t)lo) | ((int8_t)hi<<8)); val = (int) (((int8_t)lo) | ((int8_t)hi<<8));
if (i%3) val *= -1; if (i%3)
val *= -1;
input_report_rel(dev, REL_X + i, val); input_report_rel(dev, REL_X + i, val);
} }
} }
...@@ -168,10 +177,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr) ...@@ -168,10 +177,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
btn = ptr->data[cnt++]; btn = ptr->data[cnt++];
up = btn & 1; up = btn & 1;
btn &= 0xfe; btn &= 0xfe;
if (btn == 0x8e) { if (btn == 0x8e)
continue; /* TODO: proximity == touch? */ continue; /* TODO: proximity == touch? */
} else
else if ((btn > 0x8c) || (btn < 0x80)) continue; if ((btn > 0x8c) || (btn < 0x80))
continue;
btn = (btn - 0x80) >> 1; btn = (btn - 0x80) >> 1;
btn = ptr->btnmap[btn]; btn = ptr->btnmap[btn];
input_report_key(dev, btn, !up); input_report_key(dev, btn, !up);
...@@ -182,11 +192,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr) ...@@ -182,11 +192,11 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
up(&ptr->sem); up(&ptr->sem);
} }
static void hil_ptr_process_err(struct hil_ptr *ptr) { static void hil_ptr_process_err(struct hil_ptr *ptr)
{
printk(KERN_WARNING PREFIX "errored HIL packet\n"); printk(KERN_WARNING PREFIX "errored HIL packet\n");
ptr->idx4 = 0; ptr->idx4 = 0;
up(&ptr->sem); up(&ptr->sem);
return;
} }
static irqreturn_t hil_ptr_interrupt(struct serio *serio, static irqreturn_t hil_ptr_interrupt(struct serio *serio,
...@@ -197,29 +207,29 @@ static irqreturn_t hil_ptr_interrupt(struct serio *serio, ...@@ -197,29 +207,29 @@ static irqreturn_t hil_ptr_interrupt(struct serio *serio,
int idx; int idx;
ptr = serio_get_drvdata(serio); ptr = serio_get_drvdata(serio);
if (ptr == NULL) { BUG_ON(ptr == NULL);
BUG();
return IRQ_HANDLED;
}
if (ptr->idx4 >= (HIL_PTR_MAX_LENGTH * sizeof(hil_packet))) { if (ptr->idx4 >= (HIL_PTR_MAX_LENGTH * sizeof(hil_packet))) {
hil_ptr_process_err(ptr); hil_ptr_process_err(ptr);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
idx = ptr->idx4/4; idx = ptr->idx4/4;
if (!(ptr->idx4 % 4)) ptr->data[idx] = 0; if (!(ptr->idx4 % 4))
ptr->data[idx] = 0;
packet = ptr->data[idx]; packet = ptr->data[idx];
packet |= ((hil_packet)data) << ((3 - (ptr->idx4 % 4)) * 8); packet |= ((hil_packet)data) << ((3 - (ptr->idx4 % 4)) * 8);
ptr->data[idx] = packet; ptr->data[idx] = packet;
/* Records of N 4-byte hil_packets must terminate with a command. */ /* Records of N 4-byte hil_packets must terminate with a command. */
if ((++(ptr->idx4)) % 4) return IRQ_HANDLED; if ((++(ptr->idx4)) % 4)
return IRQ_HANDLED;
if ((packet & 0xffff0000) != HIL_ERR_INT) { if ((packet & 0xffff0000) != HIL_ERR_INT) {
hil_ptr_process_err(ptr); hil_ptr_process_err(ptr);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
if (packet & HIL_PKT_CMD) if (packet & HIL_PKT_CMD)
hil_ptr_process_record(ptr); hil_ptr_process_record(ptr);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -228,10 +238,7 @@ static void hil_ptr_disconnect(struct serio *serio) ...@@ -228,10 +238,7 @@ static void hil_ptr_disconnect(struct serio *serio)
struct hil_ptr *ptr; struct hil_ptr *ptr;
ptr = serio_get_drvdata(serio); ptr = serio_get_drvdata(serio);
if (ptr == NULL) { BUG_ON(ptr == NULL);
BUG();
return;
}
serio_close(serio); serio_close(serio);
input_unregister_device(ptr->dev); input_unregister_device(ptr->dev);
...@@ -241,7 +248,7 @@ static void hil_ptr_disconnect(struct serio *serio) ...@@ -241,7 +248,7 @@ static void hil_ptr_disconnect(struct serio *serio)
static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
{ {
struct hil_ptr *ptr; struct hil_ptr *ptr;
char *txt; const char *txt;
unsigned int i, naxsets, btntype; unsigned int i, naxsets, btntype;
uint8_t did, *idd; uint8_t did, *idd;
...@@ -252,42 +259,40 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) ...@@ -252,42 +259,40 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
if (!ptr->dev) if (!ptr->dev)
goto bail0; goto bail0;
ptr->dev->private = ptr;
if (serio_open(serio, driver)) if (serio_open(serio, driver))
goto bail1; goto bail1;
serio_set_drvdata(serio, ptr); serio_set_drvdata(serio, ptr);
ptr->serio = serio; ptr->serio = serio;
init_MUTEX_LOCKED(&(ptr->sem)); init_MUTEX_LOCKED(&ptr->sem);
/* Get device info. MLC driver supplies devid/status/etc. */ /* Get device info. MLC driver supplies devid/status/etc. */
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_IDD); serio->write(serio, HIL_CMD_IDD);
down(&(ptr->sem)); down(&ptr->sem);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_RSC); serio->write(serio, HIL_CMD_RSC);
down(&(ptr->sem)); down(&ptr->sem);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_RNM); serio->write(serio, HIL_CMD_RNM);
down(&(ptr->sem)); down(&ptr->sem);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, 0); serio->write(serio, 0);
serio->write(serio, HIL_PKT_CMD >> 8); serio->write(serio, HIL_PKT_CMD >> 8);
serio->write(serio, HIL_CMD_EXD); serio->write(serio, HIL_CMD_EXD);
down(&(ptr->sem)); down(&ptr->sem);
up(&(ptr->sem)); up(&ptr->sem);
did = ptr->idd[0]; did = ptr->idd[0];
idd = ptr->idd + 1; idd = ptr->idd + 1;
...@@ -301,12 +306,12 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) ...@@ -301,12 +306,12 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
ptr->dev->evbit[0] = BIT(EV_ABS); ptr->dev->evbit[0] = BIT(EV_ABS);
txt = "absolute"; txt = "absolute";
} }
if (!ptr->dev->evbit[0]) { if (!ptr->dev->evbit[0])
goto bail2; goto bail2;
}
ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd); ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);
if (ptr->nbtn) ptr->dev->evbit[0] |= BIT(EV_KEY); if (ptr->nbtn)
ptr->dev->evbit[0] |= BIT(EV_KEY);
naxsets = HIL_IDD_NUM_AXSETS(*idd); naxsets = HIL_IDD_NUM_AXSETS(*idd);
ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd); ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd);
...@@ -341,12 +346,10 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) ...@@ -341,12 +346,10 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
} }
if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) { if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
for (i = 0; i < ptr->naxes; i++) { for (i = 0; i < ptr->naxes; i++)
set_bit(REL_X + i, ptr->dev->relbit); set_bit(REL_X + i, ptr->dev->relbit);
} for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++)
for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++) {
set_bit(REL_X + i, ptr->dev->relbit); set_bit(REL_X + i, ptr->dev->relbit);
}
} else { } else {
for (i = 0; i < ptr->naxes; i++) { for (i = 0; i < ptr->naxes; i++) {
set_bit(ABS_X + i, ptr->dev->absbit); set_bit(ABS_X + i, ptr->dev->absbit);
...@@ -375,7 +378,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver) ...@@ -375,7 +378,7 @@ static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
ptr->dev->id.vendor = PCI_VENDOR_ID_HP; ptr->dev->id.vendor = PCI_VENDOR_ID_HP;
ptr->dev->id.product = 0x0001; /* TODO: get from ptr->rsc */ ptr->dev->id.product = 0x0001; /* TODO: get from ptr->rsc */
ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */ ptr->dev->id.version = 0x0100; /* TODO: get from ptr->rsc */
ptr->dev->cdev.dev = &serio->dev; ptr->dev->dev.parent = &serio->dev;
input_register_device(ptr->dev); input_register_device(ptr->dev);
printk(KERN_INFO "input: %s (%s), ID: %d\n", printk(KERN_INFO "input: %s (%s), ID: %d\n",
......
This diff is collapsed.
...@@ -11,7 +11,18 @@ ...@@ -11,7 +11,18 @@
#ifndef _LIFEBOOK_H #ifndef _LIFEBOOK_H
#define _LIFEBOOK_H #define _LIFEBOOK_H
#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
int lifebook_detect(struct psmouse *psmouse, int set_properties); int lifebook_detect(struct psmouse *psmouse, int set_properties);
int lifebook_init(struct psmouse *psmouse); int lifebook_init(struct psmouse *psmouse);
#else
inline int lifebook_detect(struct psmouse *psmouse, int set_properties)
{
return -ENOSYS;
}
inline int lifebook_init(struct psmouse *psmouse)
{
return -ENOSYS;
}
#endif
#endif #endif
...@@ -200,6 +200,7 @@ static void ps2pp_disconnect(struct psmouse *psmouse) ...@@ -200,6 +200,7 @@ static void ps2pp_disconnect(struct psmouse *psmouse)
static const struct ps2pp_info *get_model_info(unsigned char model) static const struct ps2pp_info *get_model_info(unsigned char model)
{ {
static const struct ps2pp_info ps2pp_list[] = { static const struct ps2pp_info ps2pp_list[] = {
{ 1, 0, 0 }, /* Simple 2-button mouse */
{ 12, 0, PS2PP_SIDE_BTN}, { 12, 0, PS2PP_SIDE_BTN},
{ 13, 0, 0 }, { 13, 0, 0 },
{ 15, PS2PP_KIND_MX, /* MX1000 */ { 15, PS2PP_KIND_MX, /* MX1000 */
...@@ -338,12 +339,12 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties) ...@@ -338,12 +339,12 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
param[1] = 0; param[1] = 0;
ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO); ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
if (!param[1])
return -1;
model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78); model = ((param[0] >> 4) & 0x07) | ((param[0] << 3) & 0x78);
buttons = param[1]; buttons = param[1];
if (!model || !buttons)
return -1;
if ((model_info = get_model_info(model)) != NULL) { if ((model_info = get_model_info(model)) != NULL) {
/* /*
......
...@@ -11,6 +11,13 @@ ...@@ -11,6 +11,13 @@
#ifndef _LOGIPS2PP_H #ifndef _LOGIPS2PP_H
#define _LOGIPS2PP_H #define _LOGIPS2PP_H
#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
int ps2pp_init(struct psmouse *psmouse, int set_properties); int ps2pp_init(struct psmouse *psmouse, int set_properties);
#else
inline int ps2pp_init(struct psmouse *psmouse, int set_properties)
{
return -ENOSYS;
}
#endif /* CONFIG_MOUSE_PS2_LOGIPS2PP */
#endif #endif
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "alps.h" #include "alps.h"
#include "lifebook.h" #include "lifebook.h"
#include "trackpoint.h" #include "trackpoint.h"
#include "touchkit_ps2.h"
#define DRIVER_DESC "PS/2 mouse driver" #define DRIVER_DESC "PS/2 mouse driver"
...@@ -569,7 +570,9 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -569,7 +570,9 @@ static int psmouse_extensions(struct psmouse *psmouse,
return PSMOUSE_THINKPS; return PSMOUSE_THINKPS;
/* /*
* Try Synaptics TouchPad * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol
* support is disabled in config - we need to know if it is synaptics so we
* can reset it properly after probing for intellimouse.
*/ */
if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) { if (max_proto > PSMOUSE_PS2 && synaptics_detect(psmouse, set_properties) == 0) {
synaptics_hardware = 1; synaptics_hardware = 1;
...@@ -605,15 +608,21 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -605,15 +608,21 @@ static int psmouse_extensions(struct psmouse *psmouse,
} }
} }
if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse, set_properties) == 0) if (max_proto > PSMOUSE_IMEX) {
if (genius_detect(psmouse, set_properties) == 0)
return PSMOUSE_GENPS; return PSMOUSE_GENPS;
if (max_proto > PSMOUSE_IMEX && ps2pp_init(psmouse, set_properties) == 0) if (ps2pp_init(psmouse, set_properties) == 0)
return PSMOUSE_PS2PP; return PSMOUSE_PS2PP;
if (max_proto > PSMOUSE_IMEX && trackpoint_detect(psmouse, set_properties) == 0) if (trackpoint_detect(psmouse, set_properties) == 0)
return PSMOUSE_TRACKPOINT; return PSMOUSE_TRACKPOINT;
if (touchkit_ps2_detect(psmouse, set_properties) == 0)
return PSMOUSE_TOUCHKIT_PS2;
}
/* /*
* Reset to defaults in case the device got confused by extended * Reset to defaults in case the device got confused by extended
* protocol probes. Note that we do full reset becuase some mice * protocol probes. Note that we do full reset becuase some mice
...@@ -654,12 +663,14 @@ static const struct psmouse_protocol psmouse_protocols[] = { ...@@ -654,12 +663,14 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.maxproto = 1, .maxproto = 1,
.detect = ps2bare_detect, .detect = ps2bare_detect,
}, },
#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
{ {
.type = PSMOUSE_PS2PP, .type = PSMOUSE_PS2PP,
.name = "PS2++", .name = "PS2++",
.alias = "logitech", .alias = "logitech",
.detect = ps2pp_init, .detect = ps2pp_init,
}, },
#endif
{ {
.type = PSMOUSE_THINKPS, .type = PSMOUSE_THINKPS,
.name = "ThinkPS/2", .name = "ThinkPS/2",
...@@ -686,6 +697,7 @@ static const struct psmouse_protocol psmouse_protocols[] = { ...@@ -686,6 +697,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.maxproto = 1, .maxproto = 1,
.detect = im_explorer_detect, .detect = im_explorer_detect,
}, },
#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
{ {
.type = PSMOUSE_SYNAPTICS, .type = PSMOUSE_SYNAPTICS,
.name = "SynPS/2", .name = "SynPS/2",
...@@ -693,6 +705,8 @@ static const struct psmouse_protocol psmouse_protocols[] = { ...@@ -693,6 +705,8 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.detect = synaptics_detect, .detect = synaptics_detect,
.init = synaptics_init, .init = synaptics_init,
}, },
#endif
#ifdef CONFIG_MOUSE_PS2_ALPS
{ {
.type = PSMOUSE_ALPS, .type = PSMOUSE_ALPS,
.name = "AlpsPS/2", .name = "AlpsPS/2",
...@@ -700,18 +714,31 @@ static const struct psmouse_protocol psmouse_protocols[] = { ...@@ -700,18 +714,31 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.detect = alps_detect, .detect = alps_detect,
.init = alps_init, .init = alps_init,
}, },
#endif
#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
{ {
.type = PSMOUSE_LIFEBOOK, .type = PSMOUSE_LIFEBOOK,
.name = "LBPS/2", .name = "LBPS/2",
.alias = "lifebook", .alias = "lifebook",
.init = lifebook_init, .init = lifebook_init,
}, },
#endif
#ifdef CONFIG_MOUSE_PS2_TRACKPOINT
{ {
.type = PSMOUSE_TRACKPOINT, .type = PSMOUSE_TRACKPOINT,
.name = "TPPS/2", .name = "TPPS/2",
.alias = "trackpoint", .alias = "trackpoint",
.detect = trackpoint_detect, .detect = trackpoint_detect,
}, },
#endif
#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
{
.type = PSMOUSE_TOUCHKIT_PS2,
.name = "touchkitPS/2",
.alias = "touchkit",
.detect = touchkit_ps2_detect,
},
#endif
{ {
.type = PSMOUSE_AUTO, .type = PSMOUSE_AUTO,
.name = "auto", .name = "auto",
...@@ -822,12 +849,6 @@ static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate) ...@@ -822,12 +849,6 @@ static void psmouse_set_rate(struct psmouse *psmouse, unsigned int rate)
static void psmouse_initialize(struct psmouse *psmouse) static void psmouse_initialize(struct psmouse *psmouse)
{ {
/*
* We set the mouse into streaming mode.
*/
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSTREAM);
/* /*
* We set the mouse report rate, resolution and scaling. * We set the mouse report rate, resolution and scaling.
*/ */
...@@ -1062,8 +1083,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse ...@@ -1062,8 +1083,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse
{ {
struct input_dev *input_dev = psmouse->dev; struct input_dev *input_dev = psmouse->dev;
input_dev->private = psmouse; input_dev->dev.parent = &psmouse->ps2dev.serio->dev;
input_dev->cdev.dev = &psmouse->ps2dev.serio->dev;
input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL); input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT); input_dev->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
......
...@@ -87,6 +87,7 @@ enum psmouse_type { ...@@ -87,6 +87,7 @@ enum psmouse_type {
PSMOUSE_ALPS, PSMOUSE_ALPS,
PSMOUSE_LIFEBOOK, PSMOUSE_LIFEBOOK,
PSMOUSE_TRACKPOINT, PSMOUSE_TRACKPOINT,
PSMOUSE_TOUCHKIT_PS2,
PSMOUSE_AUTO /* This one should always be last */ PSMOUSE_AUTO /* This one should always be last */
}; };
......
This diff is collapsed.
This diff is collapsed.
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
#ifndef _SYNAPTICS_H #ifndef _SYNAPTICS_H
#define _SYNAPTICS_H #define _SYNAPTICS_H
extern int synaptics_detect(struct psmouse *psmouse, int set_properties);
extern int synaptics_init(struct psmouse *psmouse);
extern void synaptics_reset(struct psmouse *psmouse);
/* synaptics queries */ /* synaptics queries */
#define SYN_QUE_IDENTIFY 0x00 #define SYN_QUE_IDENTIFY 0x00
#define SYN_QUE_MODES 0x01 #define SYN_QUE_MODES 0x01
...@@ -107,4 +103,8 @@ struct synaptics_data { ...@@ -107,4 +103,8 @@ struct synaptics_data {
int scroll; int scroll;
}; };
int synaptics_detect(struct psmouse *psmouse, int set_properties);
int synaptics_init(struct psmouse *psmouse);
void synaptics_reset(struct psmouse *psmouse);
#endif /* _SYNAPTICS_H */ #endif /* _SYNAPTICS_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment