diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 13:41:39 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 13:41:39 -0700 |
commit | f2e1d89f9b349b3cd914b7c6ec6368632f4ad048 (patch) | |
tree | 5b0042924a9f9c8b3309c0be880f51795916fc28 /drivers | |
parent | 85ffdd28be04c324349dfc7c9de3d4342c885c3f (diff) | |
parent | 82ba56c273911f7eda79849cfa0fc2d2e5a3b75b (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (40 commits)
Input: use full RCU API
Input: remove tsdev interface
Input: add support for Blackfin BF54x Keypad controller
Input: appletouch - another fix for idle reset logic
HWMON: hdaps - switch to using input-polldev
Input: add support for SEGA Dreamcast keyboard
Input: omap-keyboard - don't pretend we support changing keymap
Input: lifebook - fix X and Y axis range
Input: usbtouchscreen - add support for GeneralTouch devices
Input: fix open count handling in input interfaces
Input: keyboard - add CapsShift lock
Input: adbhid - produce all CapsLock key events
Input: ALPS - add signature for ThinkPad R61
Input: jornada720_kbd - send MSC_SCAN events
Input: add support for the HP Jornada 7xx (710/720/728) touchscreen
Input: add support for HP Jornada 7xx onboard keyboard
Input: add support for HP Jornada onboard keyboard (HP6XX)
Input: ucb1400_ts - use schedule_timeout_uninterruptible
Input: xpad - fix dependancy on LEDS class
Input: auto-select INPUT for MAC_EMUMOUSEBTN option
...
Resolved conflicts manually in drivers/hwmon/applesmc.c: converting from
a class device to a device and converting to use input-polldev created a
few apparently trivial clashes..
Diffstat (limited to 'drivers')
35 files changed, 3644 insertions, 2143 deletions
diff --git a/drivers/char/ec3104_keyb.c b/drivers/char/ec3104_keyb.c deleted file mode 100644 index 020011495d9..00000000000 --- a/drivers/char/ec3104_keyb.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * linux/drivers/char/ec3104_keyb.c - * - * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> - * - * based on linux/drivers/char/pc_keyb.c, which had the following comments: - * - * Separation of the PC low-level part by Geert Uytterhoeven, May 1997 - * See keyboard.c for the whole history. - * - * Major cleanup by Martin Mares, May 1997 - * - * Combined the keyboard and PS/2 mouse handling into one file, - * because they share the same hardware. - * Johan Myreen <jem@iki.fi> 1998-10-08. - * - * Code fixes to handle mouse ACKs properly. - * C. Scott Ananian <cananian@alumni.princeton.edu> 1999-01-29. - */ -/* EC3104 note: - * This code was written without any documentation about the EC3104 chip. While - * I hope I got most of the basic functionality right, the register names I use - * are most likely completely different from those in the chip documentation. - * - * If you have any further information about the EC3104, please tell me - * (prumpf@tux.org). - */ - - -#include <linux/spinlock.h> -#include <linux/sched.h> -#include <linux/interrupt.h> -#include <linux/tty.h> -#include <linux/mm.h> -#include <linux/signal.h> -#include <linux/init.h> -#include <linux/kbd_ll.h> -#include <linux/delay.h> -#include <linux/random.h> -#include <linux/poll.h> -#include <linux/miscdevice.h> -#include <linux/slab.h> -#include <linux/kbd_kern.h> -#include <linux/bitops.h> - -#include <asm/keyboard.h> -#include <asm/uaccess.h> -#include <asm/irq.h> -#include <asm/system.h> -#include <asm/ec3104.h> - -#include <asm/io.h> - -/* Some configuration switches are present in the include file... */ - -#include <linux/pc_keyb.h> - -#define MSR_CTS 0x10 -#define MCR_RTS 0x02 -#define LSR_DR 0x01 -#define LSR_BOTH_EMPTY 0x60 - -static struct e5_struct { - u8 packet[8]; - int pos; - int length; - - u8 cached_mcr; - u8 last_msr; -} ec3104_keyb; - -/* Simple translation table for the SysRq keys */ - - -#ifdef CONFIG_MAGIC_SYSRQ -unsigned char ec3104_kbd_sysrq_xlate[128] = - "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */ - "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */ - "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */ - "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */ - "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */ - "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */ - "\r\000/"; /* 0x60 - 0x6f */ -#endif - -static void kbd_write_command_w(int data); -static void kbd_write_output_w(int data); -#ifdef CONFIG_PSMOUSE -static void aux_write_ack(int val); -static void __aux_write_ack(int val); -#endif - -static DEFINE_SPINLOCK(kbd_controller_lock); -static unsigned char handle_kbd_event(void); - -/* used only by send_data - set by keyboard_interrupt */ -static volatile unsigned char reply_expected; -static volatile unsigned char acknowledge; -static volatile unsigned char resend; - - -int ec3104_kbd_setkeycode(unsigned int scancode, unsigned int keycode) -{ - return 0; -} - -int ec3104_kbd_getkeycode(unsigned int scancode) -{ - return 0; -} - - -/* yes, it probably would be faster to use an array. I don't care. */ - -static inline unsigned char ec3104_scan2key(unsigned char scancode) -{ - switch (scancode) { - case 1: /* '`' */ - return 41; - - case 2 ... 27: - return scancode; - - case 28: /* '\\' */ - return 43; - - case 29 ... 39: - return scancode + 1; - - case 40: /* '\r' */ - return 28; - - case 41 ... 50: - return scancode + 3; - - case 51: /* ' ' */ - return 57; - - case 52: /* escape */ - return 1; - - case 54: /* insert/delete (labelled delete) */ - /* this should arguably be 110, but I'd like to have ctrl-alt-del - * working with a standard keymap */ - return 111; - - case 55: /* left */ - return 105; - case 56: /* home */ - return 102; - case 57: /* end */ - return 107; - case 58: /* up */ - return 103; - case 59: /* down */ - return 108; - case 60: /* pgup */ - return 104; - case 61: /* pgdown */ - return 109; - case 62: /* right */ - return 106; - - case 79 ... 88: /* f1 - f10 */ - return scancode - 20; - - case 89 ... 90: /* f11 - f12 */ - return scancode - 2; - - case 91: /* left shift */ - return 42; - - case 92: /* right shift */ - return 54; - - case 93: /* left alt */ - return 56; - case 94: /* right alt */ - return 100; - case 95: /* left ctrl */ - return 29; - case 96: /* right ctrl */ - return 97; - - case 97: /* caps lock */ - return 58; - case 102: /* left windows */ - return 125; - case 103: /* right windows */ - return 126; - - case 106: /* Fn */ - /* this is wrong. */ - return 84; - - default: - return 0; - } -} - -int ec3104_kbd_translate(unsigned char scancode, unsigned char *keycode, - char raw_mode) -{ - scancode &= 0x7f; - - *keycode = ec3104_scan2key(scancode); - - return 1; -} - -char ec3104_kbd_unexpected_up(unsigned char keycode) -{ - return 0200; -} - -static inline void handle_keyboard_event(unsigned char scancode) -{ -#ifdef CONFIG_VT - handle_scancode(scancode, !(scancode & 0x80)); -#endif - tasklet_schedule(&keyboard_tasklet); -} - -void ec3104_kbd_leds(unsigned char leds) -{ -} - -static u8 e5_checksum(u8 *packet, int count) -{ - int i; - u8 sum = 0; - - for (i=0; i<count; i++) - sum ^= packet[i]; - - if (sum & 0x80) - sum ^= 0xc0; - - return sum; -} - -static void e5_wait_for_cts(struct e5_struct *k) -{ - u8 msr; - - do { - msr = ctrl_inb(EC3104_SER4_MSR); - } while (!(msr & MSR_CTS)); -} - - -static void e5_send_byte(u8 byte, struct e5_struct *k) -{ - u8 status; - - do { - status = ctrl_inb(EC3104_SER4_LSR); - } while ((status & LSR_BOTH_EMPTY) != LSR_BOTH_EMPTY); - - printk("<%02x>", byte); - - ctrl_outb(byte, EC3104_SER4_DATA); - - do { - status = ctrl_inb(EC3104_SER4_LSR); - } while ((status & LSR_BOTH_EMPTY) != LSR_BOTH_EMPTY); - -} - -static int e5_send_packet(u8 *packet, int count, struct e5_struct *k) -{ - int i; - - disable_irq(EC3104_IRQ_SER4); - - if (k->cached_mcr & MCR_RTS) { - printk("e5_send_packet: too slow\n"); - enable_irq(EC3104_IRQ_SER4); - return -EAGAIN; - } - - k->cached_mcr |= MCR_RTS; - ctrl_outb(k->cached_mcr, EC3104_SER4_MCR); - - e5_wait_for_cts(k); - - printk("p: "); - - for(i=0; i<count; i++) - e5_send_byte(packet[i], k); - - e5_send_byte(e5_checksum(packet, count), k); - - printk("\n"); - - udelay(1500); - - k->cached_mcr &= ~MCR_RTS; - ctrl_outb(k->cached_mcr, EC3104_SER4_MCR); - - set_current_state(TASK_UNINTERRUPTIBLE); - - - - enable_irq(EC3104_IRQ_SER4); - - - - return 0; -} - -/* - * E5 packets we know about: - * E5->host 0x80 0x05 <checksum> - resend packet - * host->E5 0x83 0x43 <contrast> - set LCD contrast - * host->E5 0x85 0x41 0x02 <brightness> 0x02 - set LCD backlight - * E5->host 0x87 <ps2 packet> 0x00 <checksum> - external PS2 - * E5->host 0x88 <scancode> <checksum> - key press - */ - -static void e5_receive(struct e5_struct *k) -{ - k->packet[k->pos++] = ctrl_inb(EC3104_SER4_DATA); - - if (k->pos == 1) { - switch(k->packet[0]) { - case 0x80: - k->length = 3; - break; - - case 0x87: /* PS2 ext */ - k->length = 6; - break; - - case 0x88: /* keyboard */ - k->length = 3; - break; - - default: - k->length = 1; - printk(KERN_WARNING "unknown E5 packet %02x\n", - k->packet[0]); - } - } - - if (k->pos == k->length) { - int i; - - if (e5_checksum(k->packet, k->length) != 0) - printk(KERN_WARNING "E5: wrong checksum\n"); - -#if 0 - printk("E5 packet ["); - for(i=0; i<k->length; i++) { - printk("%02x ", k->packet[i]); - } - - printk("(%02x)]\n", e5_checksum(k->packet, k->length-1)); -#endif - - switch(k->packet[0]) { - case 0x80: - case 0x88: - handle_keyboard_event(k->packet[1]); - break; - } - - k->pos = k->length = 0; - } -} - -static void ec3104_keyb_interrupt(int irq, void *data) -{ - struct e5_struct *k = &ec3104_keyb; - u8 msr, lsr; - - msr = ctrl_inb(EC3104_SER4_MSR); - - if ((msr & MSR_CTS) && !(k->last_msr & MSR_CTS)) { - if (k->cached_mcr & MCR_RTS) - printk("confused: RTS already high\n"); - /* CTS went high. Send RTS. */ - k->cached_mcr |= MCR_RTS; - - ctrl_outb(k->cached_mcr, EC3104_SER4_MCR); - } else if ((!(msr & MSR_CTS)) && (k->last_msr & MSR_CTS)) { - /* CTS went low. */ - if (!(k->cached_mcr & MCR_RTS)) - printk("confused: RTS already low\n"); - - k->cached_mcr &= ~MCR_RTS; - - ctrl_outb(k->cached_mcr, EC3104_SER4_MCR); - } - - k->last_msr = msr; - - lsr = ctrl_inb(EC3104_SER4_LSR); - - if (lsr & LSR_DR) - e5_receive(k); -} - -static void ec3104_keyb_clear_state(void) -{ - struct e5_struct *k = &ec3104_keyb; - u8 msr, lsr; - - /* we want CTS to be low */ - k->last_msr = 0; - - for (;;) { - msleep(100); - - msr = ctrl_inb(EC3104_SER4_MSR); - - lsr = ctrl_inb(EC3104_SER4_LSR); - - if (lsr & LSR_DR) { - e5_receive(k); - continue; - } - - if ((msr & MSR_CTS) && !(k->last_msr & MSR_CTS)) { - if (k->cached_mcr & MCR_RTS) - printk("confused: RTS already high\n"); - /* CTS went high. Send RTS. */ - k->cached_mcr |= MCR_RTS; - - ctrl_outb(k->cached_mcr, EC3104_SER4_MCR); - } else if ((!(msr & MSR_CTS)) && (k->last_msr & MSR_CTS)) { - /* CTS went low. */ - if (!(k->cached_mcr & MCR_RTS)) - printk("confused: RTS already low\n"); - - k->cached_mcr &= ~MCR_RTS; - - ctrl_outb(k->cached_mcr, EC3104_SER4_MCR); - } else - break; - - k->last_msr = msr; - - continue; - } -} - -void __init ec3104_kbd_init_hw(void) -{ - ec3104_keyb.last_msr = ctrl_inb(EC3104_SER4_MSR); - ec3104_keyb.cached_mcr = ctrl_inb(EC3104_SER4_MCR); - - ec3104_keyb_clear_state(); - - /* Ok, finally allocate the IRQ, and off we go.. */ - request_irq(EC3104_IRQ_SER4, ec3104_keyb_interrupt, 0, "keyboard", NULL); -} diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index e47f8817080..700a1657554 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -158,6 +158,7 @@ config SENSORS_K8TEMP config SENSORS_AMS tristate "Apple Motion Sensor driver" depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL + select INPUT_POLLDEV help Support for the motion sensor included in PowerBooks. Includes implementations for PMU and I2C. @@ -701,6 +702,7 @@ config SENSORS_W83627EHF config SENSORS_HDAPS tristate "IBM Hard Drive Active Protection System (hdaps)" depends on INPUT && X86 + select INPUT_POLLDEV default n help This driver provides support for the IBM Hard Drive Active Protection @@ -722,6 +724,7 @@ config SENSORS_APPLESMC depends on INPUT && X86 select NEW_LEDS select LEDS_CLASS + select INPUT_POLLDEV default n help This driver provides support for the Apple System Management diff --git a/drivers/hwmon/ams/ams-input.c b/drivers/hwmon/ams/ams-input.c index ca7095d96ad..7b81e0c2c2d 100644 --- a/drivers/hwmon/ams/ams-input.c +++ b/drivers/hwmon/ams/ams-input.c @@ -27,47 +27,32 @@ static unsigned int invert; module_param(invert, bool, 0644); MODULE_PARM_DESC(invert, "Invert input data on X and Y axis"); -static int ams_input_kthread(void *data) +static void ams_idev_poll(struct input_polled_dev *dev) { + struct input_dev *idev = dev->input; s8 x, y, z; - while (!kthread_should_stop()) { - mutex_lock(&ams_info.lock); - - ams_sensors(&x, &y, &z); - - x -= ams_info.xcalib; - y -= ams_info.ycalib; - z -= ams_info.zcalib; - - input_report_abs(ams_info.idev, ABS_X, invert ? -x : x); - input_report_abs(ams_info.idev, ABS_Y, invert ? -y : y); - input_report_abs(ams_info.idev, ABS_Z, z); + mutex_lock(&ams_info.lock); - input_sync(ams_info.idev); + ams_sensors(&x, &y, &z); - mutex_unlock(&ams_info.lock); + x -= ams_info.xcalib; + y -= ams_info.ycalib; + z -= ams_info.zcalib; - msleep(25); - } + input_report_abs(idev, ABS_X, invert ? -x : x); + input_report_abs(idev, ABS_Y, invert ? -y : y); + input_report_abs(idev, ABS_Z, z); - return 0; -} + input_sync(idev); -static int ams_input_open(struct input_dev *dev) -{ - ams_info.kthread = kthread_run(ams_input_kthread, NULL, "kams"); - return IS_ERR(ams_info.kthread) ? PTR_ERR(ams_info.kthread) : 0; -} - -static void ams_input_close(struct input_dev *dev) -{ - kthread_stop(ams_info.kthread); + mutex_unlock(&ams_info.lock); } /* Call with ams_info.lock held! */ static void ams_input_enable(void) { + struct input_dev *input; s8 x, y, z; if (ams_info.idev) @@ -78,27 +63,29 @@ static void ams_input_enable(void) ams_info.ycalib = y; ams_info.zcalib = z; - ams_info.idev = input_allocate_device(); + ams_info.idev = input_allocate_polled_device(); if (!ams_info.idev) return; - ams_info.idev->name = "Apple Motion Sensor"; - ams_info.idev->id.bustype = ams_info.bustype; - ams_info.idev->id.vendor = 0; - ams_info.idev->open = ams_input_open; - ams_info.idev->close = ams_input_close; - ams_info.idev->dev.parent = &ams_info.of_dev->dev; + ams_info.idev->poll = ams_idev_poll; + ams_info.idev->poll_interval = 25; + + input = ams_info.idev->input; + input->name = "Apple Motion Sensor"; + input->id.bustype = ams_info.bustype; + input->id.vendor = 0; + input->dev.parent = &ams_info.of_dev->dev; - input_set_abs_params(ams_info.idev, ABS_X, -50, 50, 3, 0); - input_set_abs_params(ams_info.idev, ABS_Y, -50, 50, 3, 0); - input_set_abs_params(ams_info.idev, ABS_Z, -50, 50, 3, 0); + input_set_abs_params(input, ABS_X, -50, 50, 3, 0); + input_set_abs_params(input, ABS_Y, -50, 50, 3, 0); + input_set_abs_params(input, ABS_Z, -50, 50, 3, 0); - set_bit(EV_ABS, ams_info.idev->evbit); - set_bit(EV_KEY, ams_info.idev->evbit); - set_bit(BTN_TOUCH, ams_info.idev->keybit); + set_bit(EV_ABS, input->evbit); + set_bit(EV_KEY, input->evbit); + set_bit(BTN_TOUCH, input->keybit); - if (input_register_device(ams_info.idev)) { - input_free_device(ams_info.idev); + if (input_register_polled_device(ams_info.idev)) { + input_free_polled_device(ams_info.idev); ams_info.idev = NULL; return; } @@ -108,7 +95,8 @@ static void ams_input_enable(void) static void ams_input_disable(void) { if (ams_info.idev) { - input_unregister_device(ams_info.idev); + input_unregister_polled_device(ams_info.idev); + input_free_polled_device(ams_info.idev); ams_info.idev = NULL; } } diff --git a/drivers/hwmon/ams/ams.h b/drivers/hwmon/ams/ams.h index 240730e6bcd..a6221e5dd98 100644 --- a/drivers/hwmon/ams/ams.h +++ b/drivers/hwmon/ams/ams.h @@ -1,5 +1,5 @@ #include <linux/i2c.h> -#include <linux/input.h> +#include <linux/input-polldev.h> #include <linux/kthread.h> #include <linux/mutex.h> #include <linux/spinlock.h> @@ -52,8 +52,7 @@ struct ams { #endif /* Joystick emulation */ - struct task_struct *kthread; - struct input_dev *idev; + struct input_polled_dev *idev; __u16 bustype; /* calibrated null values */ diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c index f37fd7ebf65..4879125b4cd 100644 --- a/drivers/hwmon/applesmc.c +++ b/drivers/hwmon/applesmc.c @@ -28,7 +28,7 @@ #include <linux/delay.h> #include <linux/platform_device.h> -#include <linux/input.h> +#include <linux/input-polldev.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/timer.h> @@ -59,9 +59,9 @@ #define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */ #define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */ -#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */ +#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */ -#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */ +#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */ #define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */ #define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */ @@ -103,7 +103,7 @@ static const char* fan_speed_keys[] = { #define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */ #define INIT_WAIT_MSECS 50 /* ... in 50ms increments */ -#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ +#define APPLESMC_POLL_INTERVAL 50 /* msecs */ #define APPLESMC_INPUT_FUZZ 4 /* input event threshold */ #define APPLESMC_INPUT_FLAT 4 @@ -125,9 +125,8 @@ static const int debug; static struct platform_device *pdev; static s16 rest_x; static s16 rest_y; -static struct timer_list applesmc_timer; -static struct input_dev *applesmc_idev; static struct device *hwmon_dev; +static struct input_polled_dev *applesmc_idev; /* Indicates whether this computer has an accelerometer. */ static unsigned int applesmc_accelerometer; @@ -138,7 +137,7 @@ static unsigned int applesmc_light; /* Indicates which temperature sensors set to use. */ static unsigned int applesmc_temperature_set; -static struct mutex applesmc_lock; +static DEFINE_MUTEX(applesmc_lock); /* * Last index written to key_at_index sysfs file, and value to use for all other @@ -455,27 +454,12 @@ static void applesmc_calibrate(void) rest_x = -rest_x; } -static int applesmc_idev_open(struct input_dev *dev) -{ - add_timer(&applesmc_timer); - - return 0; -} - -static void applesmc_idev_close(struct input_dev *dev) -{ - del_timer_sync(&applesmc_timer); -} - -static void applesmc_idev_poll(unsigned long unused) +static void applesmc_idev_poll(struct input_polled_dev *dev) { + struct input_dev *idev = dev->input; s16 x, y; - /* Cannot sleep. Try nonblockingly. If we fail, try again later. */ - if (!mutex_trylock(&applesmc_lock)) { - mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD); - return; - } + mutex_lock(&applesmc_lock); if (applesmc_read_motion_sensor(SENSOR_X, &x)) goto out; @@ -483,13 +467,11 @@ static void applesmc_idev_poll(unsigned long unused) goto out; x = -x; - input_report_abs(applesmc_idev, ABS_X, x - rest_x); - input_report_abs(applesmc_idev, ABS_Y, y - rest_y); - input_sync(applesmc_idev); + input_report_abs(idev, ABS_X, x - rest_x); + input_report_abs(idev, ABS_Y, y - rest_y); + input_sync(idev); out: - mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD); - mutex_unlock(&applesmc_lock); } @@ -821,8 +803,7 @@ static ssize_t applesmc_key_at_index_read_show(struct device *dev, if (!ret) { return info[0]; - } - else { + } else { return ret; } } @@ -1093,6 +1074,7 @@ static int applesmc_dmi_match(const struct dmi_system_id *id) /* Create accelerometer ressources */ static int applesmc_create_accelerometer(void) { + struct input_dev *idev; int ret; ret = sysfs_create_group(&pdev->dev.kobj, @@ -1100,40 +1082,37 @@ static int applesmc_create_accelerometer(void) if (ret) goto out; - applesmc_idev = input_allocate_device(); + applesmc_idev = input_allocate_polled_device(); if (!applesmc_idev) { ret = -ENOMEM; goto out_sysfs; } + applesmc_idev->poll = applesmc_idev_poll; + applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL; + /* initial calibrate for the input device */ applesmc_calibrate(); - /* initialize the input class */ - applesmc_idev->name = "applesmc"; - applesmc_idev->id.bustype = BUS_HOST; - applesmc_idev->dev.parent = &pdev->dev; - applesmc_idev->evbit[0] = BIT(EV_ABS); - applesmc_idev->open = applesmc_idev_open; - applesmc_idev->close = applesmc_idev_close; - input_set_abs_params(applesmc_idev, ABS_X, + /* initialize the input device */ + idev = applesmc_idev->input; + idev->name = "applesmc"; + idev->id.bustype = BUS_HOST; + idev->dev.parent = &pdev->dev; + idev->evbit[0] = BIT(EV_ABS); + input_set_abs_params(idev, ABS_X, -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT); - input_set_abs_params(applesmc_idev, ABS_Y, + input_set_abs_params(idev, ABS_Y, -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT); - ret = input_register_device(applesmc_idev); + ret = input_register_polled_device(applesmc_idev); if (ret) goto out_idev; - /* start up our timer for the input device */ - init_timer(&applesmc_timer); - applesmc_timer.function = applesmc_idev_poll; - applesmc_timer.expires = jiffies + APPLESMC_POLL_PERIOD; - return 0; out_idev: - input_free_device(applesmc_idev); + input_free_polled_device(applesmc_idev); out_sysfs: sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); @@ -1146,8 +1125,8 @@ out: /* Release all ressources used by the accelerometer */ static void applesmc_release_accelerometer(void) { - del_timer_sync(&applesmc_timer); - input_unregister_device(applesmc_idev); + input_unregister_polled_device(applesmc_idev); + input_free_polled_device(applesmc_idev); sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); } @@ -1184,8 +1163,6 @@ static int __init applesmc_init(void) int count; int i; - mutex_init(&applesmc_lock); - if (!dmi_check_system(applesmc_whitelist)) { printk(KERN_WARNING "applesmc: supported laptop not found!\n"); ret = -ENODEV; diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index a7c6d407572..8a7ae03aeee 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c @@ -28,7 +28,7 @@ #include <linux/delay.h> #include <linux/platform_device.h> -#include <linux/input.h> +#include <linux/input-polldev.h> #include <linux/kernel.h> #include <linux/mutex.h> #include <linux/module.h> @@ -61,13 +61,12 @@ #define INIT_TIMEOUT_MSECS 4000 /* wait up to 4s for device init ... */ #define INIT_WAIT_MSECS 200 /* ... in 200ms increments */ -#define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ +#define HDAPS_POLL_INTERVAL 50 /* poll for input every 1/20s (50 ms)*/ #define HDAPS_INPUT_FUZZ 4 /* input event threshold */ #define HDAPS_INPUT_FLAT 4 -static struct timer_list hdaps_timer; static struct platform_device *pdev; -static struct input_dev *hdaps_idev; +static struct input_polled_dev *hdaps_idev; static unsigned int hdaps_invert; static u8 km_activity; static int rest_x; @@ -323,24 +322,19 @@ static void hdaps_calibrate(void) __hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &rest_x, &rest_y); } -static void hdaps_mousedev_poll(unsigned long unused) +static void hdaps_mousedev_poll(struct input_polled_dev *dev) |