aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/Kconfig3
-rw-r--r--drivers/hwmon/ams/ams-input.c76
-rw-r--r--drivers/hwmon/ams/ams.h5
-rw-r--r--drivers/hwmon/applesmc.c83
-rw-r--r--drivers/hwmon/hdaps.c55
5 files changed, 91 insertions, 131 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index e47f88170806..700a1657554f 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -158,6 +158,7 @@ config SENSORS_K8TEMP
158config SENSORS_AMS 158config SENSORS_AMS
159 tristate "Apple Motion Sensor driver" 159 tristate "Apple Motion Sensor driver"
160 depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL 160 depends on PPC_PMAC && !PPC64 && INPUT && ((ADB_PMU && I2C = y) || (ADB_PMU && !I2C) || I2C) && EXPERIMENTAL
161 select INPUT_POLLDEV
161 help 162 help
162 Support for the motion sensor included in PowerBooks. Includes 163 Support for the motion sensor included in PowerBooks. Includes
163 implementations for PMU and I2C. 164 implementations for PMU and I2C.
@@ -701,6 +702,7 @@ config SENSORS_W83627EHF
701config SENSORS_HDAPS 702config SENSORS_HDAPS
702 tristate "IBM Hard Drive Active Protection System (hdaps)" 703 tristate "IBM Hard Drive Active Protection System (hdaps)"
703 depends on INPUT && X86 704 depends on INPUT && X86
705 select INPUT_POLLDEV
704 default n 706 default n
705 help 707 help
706 This driver provides support for the IBM Hard Drive Active Protection 708 This driver provides support for the IBM Hard Drive Active Protection
@@ -722,6 +724,7 @@ config SENSORS_APPLESMC
722 depends on INPUT && X86 724 depends on INPUT && X86
723 select NEW_LEDS 725 select NEW_LEDS
724 select LEDS_CLASS 726 select LEDS_CLASS
727 select INPUT_POLLDEV
725 default n 728 default n
726 help 729 help
727 This driver provides support for the Apple System Management 730 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 ca7095d96ad0..7b81e0c2c2d9 100644
--- a/drivers/hwmon/ams/ams-input.c
+++ b/drivers/hwmon/ams/ams-input.c
@@ -27,47 +27,32 @@ static unsigned int invert;
27module_param(invert, bool, 0644); 27module_param(invert, bool, 0644);
28MODULE_PARM_DESC(invert, "Invert input data on X and Y axis"); 28MODULE_PARM_DESC(invert, "Invert input data on X and Y axis");
29 29
30static int ams_input_kthread(void *data) 30static void ams_idev_poll(struct input_polled_dev *dev)
31{ 31{
32 struct input_dev *idev = dev->input;
32 s8 x, y, z; 33 s8 x, y, z;
33 34
34 while (!kthread_should_stop()) { 35 mutex_lock(&ams_info.lock);
35 mutex_lock(&ams_info.lock);
36
37 ams_sensors(&x, &y, &z);
38
39 x -= ams_info.xcalib;
40 y -= ams_info.ycalib;
41 z -= ams_info.zcalib;
42
43 input_report_abs(ams_info.idev, ABS_X, invert ? -x : x);
44 input_report_abs(ams_info.idev, ABS_Y, invert ? -y : y);
45 input_report_abs(ams_info.idev, ABS_Z, z);
46 36
47 input_sync(ams_info.idev); 37 ams_sensors(&x, &y, &z);
48 38
49 mutex_unlock(&ams_info.lock); 39 x -= ams_info.xcalib;
40 y -= ams_info.ycalib;
41 z -= ams_info.zcalib;
50 42
51 msleep(25); 43 input_report_abs(idev, ABS_X, invert ? -x : x);
52 } 44 input_report_abs(idev, ABS_Y, invert ? -y : y);
45 input_report_abs(idev, ABS_Z, z);
53 46
54 return 0; 47 input_sync(idev);
55}
56 48
57static int ams_input_open(struct input_dev *dev) 49 mutex_unlock(&ams_info.lock);
58{
59 ams_info.kthread = kthread_run(ams_input_kthread, NULL, "kams");
60 return IS_ERR(ams_info.kthread) ? PTR_ERR(ams_info.kthread) : 0;
61}
62
63static void ams_input_close(struct input_dev *dev)
64{
65 kthread_stop(ams_info.kthread);
66} 50}
67 51
68/* Call with ams_info.lock held! */ 52/* Call with ams_info.lock held! */
69static void ams_input_enable(void) 53static void ams_input_enable(void)
70{ 54{
55 struct input_dev *input;
71 s8 x, y, z; 56 s8 x, y, z;
72 57
73 if (ams_info.idev) 58 if (ams_info.idev)
@@ -78,27 +63,29 @@ static void ams_input_enable(void)
78 ams_info.ycalib = y; 63 ams_info.ycalib = y;
79 ams_info.zcalib = z; 64 ams_info.zcalib = z;
80 65
81 ams_info.idev = input_allocate_device(); 66 ams_info.idev = input_allocate_polled_device();
82 if (!ams_info.idev) 67 if (!ams_info.idev)
83 return; 68 return;
84 69
85 ams_info.idev->name = "Apple Motion Sensor"; 70 ams_info.idev->poll = ams_idev_poll;
86 ams_info.idev->id.bustype = ams_info.bustype; 71 ams_info.idev->poll_interval = 25;
87 ams_info.idev->id.vendor = 0; 72
88 ams_info.idev->open = ams_input_open; 73 input = ams_info.idev->input;
89 ams_info.idev->close = ams_input_close; 74 input->name = "Apple Motion Sensor";
90 ams_info.idev->dev.parent = &ams_info.of_dev->dev; 75 input->id.bustype = ams_info.bustype;
76 input->id.vendor = 0;
77 input->dev.parent = &ams_info.of_dev->dev;
91 78
92 input_set_abs_params(ams_info.idev, ABS_X, -50, 50, 3, 0); 79 input_set_abs_params(input, ABS_X, -50, 50, 3, 0);
93 input_set_abs_params(ams_info.idev, ABS_Y, -50, 50, 3, 0); 80 input_set_abs_params(input, ABS_Y, -50, 50, 3, 0);
94 input_set_abs_params(ams_info.idev, ABS_Z, -50, 50, 3, 0); 81 input_set_abs_params(input, ABS_Z, -50, 50, 3, 0);
95 82
96 set_bit(EV_ABS, ams_info.idev->evbit); 83 set_bit(EV_ABS, input->evbit);
97 set_bit(EV_KEY, ams_info.idev->evbit); 84 set_bit(EV_KEY, input->evbit);
98 set_bit(BTN_TOUCH, ams_info.idev->keybit); 85 set_bit(BTN_TOUCH, input->keybit);
99 86
100 if (input_register_device(ams_info.idev)) { 87 if (input_register_polled_device(ams_info.idev)) {
101 input_free_device(ams_info.idev); 88 input_free_polled_device(ams_info.idev);
102 ams_info.idev = NULL; 89 ams_info.idev = NULL;
103 return; 90 return;
104 } 91 }
@@ -108,7 +95,8 @@ static void ams_input_enable(void)
108static void ams_input_disable(void) 95static void ams_input_disable(void)
109{ 96{
110 if (ams_info.idev) { 97 if (ams_info.idev) {
111 input_unregister_device(ams_info.idev); 98 input_unregister_polled_device(ams_info.idev);
99 input_free_polled_device(ams_info.idev);
112 ams_info.idev = NULL; 100 ams_info.idev = NULL;
113 } 101 }
114} 102}
diff --git a/drivers/hwmon/ams/ams.h b/drivers/hwmon/ams/ams.h
index 240730e6bcde..a6221e5dd984 100644
--- a/drivers/hwmon/ams/ams.h
+++ b/drivers/hwmon/ams/ams.h
@@ -1,5 +1,5 @@
1#include <linux/i2c.h> 1#include <linux/i2c.h>
2#include <linux/input.h> 2#include <linux/input-polldev.h>
3#include <linux/kthread.h> 3#include <linux/kthread.h>
4#include <linux/mutex.h> 4#include <linux/mutex.h>
5#include <linux/spinlock.h> 5#include <linux/spinlock.h>
@@ -52,8 +52,7 @@ struct ams {
52#endif 52#endif
53 53
54 /* Joystick emulation */ 54 /* Joystick emulation */
55 struct task_struct *kthread; 55 struct input_polled_dev *idev;
56 struct input_dev *idev;
57 __u16 bustype; 56 __u16 bustype;
58 57
59 /* calibrated null values */ 58 /* calibrated null values */
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index f37fd7ebf65a..4879125b4cdc 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -28,7 +28,7 @@
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/input.h> 31#include <linux/input-polldev.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/timer.h> 34#include <linux/timer.h>
@@ -59,9 +59,9 @@
59 59
60#define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */ 60#define LIGHT_SENSOR_LEFT_KEY "ALV0" /* r-o {alv (6 bytes) */
61#define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */ 61#define LIGHT_SENSOR_RIGHT_KEY "ALV1" /* r-o {alv (6 bytes) */
62#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */ 62#define BACKLIGHT_KEY "LKSB" /* w-o {lkb (2 bytes) */
63 63
64#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */ 64#define CLAMSHELL_KEY "MSLD" /* r-o ui8 (unused) */
65 65
66#define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */ 66#define MOTION_SENSOR_X_KEY "MO_X" /* r-o sp78 (2 bytes) */
67#define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */ 67#define MOTION_SENSOR_Y_KEY "MO_Y" /* r-o sp78 (2 bytes) */
@@ -103,7 +103,7 @@ static const char* fan_speed_keys[] = {
103#define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */ 103#define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
104#define INIT_WAIT_MSECS 50 /* ... in 50ms increments */ 104#define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
105 105
106#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ 106#define APPLESMC_POLL_INTERVAL 50 /* msecs */
107#define APPLESMC_INPUT_FUZZ 4 /* input event threshold */ 107#define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
108#define APPLESMC_INPUT_FLAT 4 108#define APPLESMC_INPUT_FLAT 4
109 109
@@ -125,9 +125,8 @@ static const int debug;
125static struct platform_device *pdev; 125static struct platform_device *pdev;
126static s16 rest_x; 126static s16 rest_x;
127static s16 rest_y; 127static s16 rest_y;
128static struct timer_list applesmc_timer;
129static struct input_dev *applesmc_idev;
130static struct device *hwmon_dev; 128static struct device *hwmon_dev;
129static struct input_polled_dev *applesmc_idev;
131 130
132/* Indicates whether this computer has an accelerometer. */ 131/* Indicates whether this computer has an accelerometer. */
133static unsigned int applesmc_accelerometer; 132static unsigned int applesmc_accelerometer;
@@ -138,7 +137,7 @@ static unsigned int applesmc_light;
138/* Indicates which temperature sensors set to use. */ 137/* Indicates which temperature sensors set to use. */
139static unsigned int applesmc_temperature_set; 138static unsigned int applesmc_temperature_set;
140 139
141static struct mutex applesmc_lock; 140static DEFINE_MUTEX(applesmc_lock);
142 141
143/* 142/*
144 * Last index written to key_at_index sysfs file, and value to use for all other 143 * 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)
455 rest_x = -rest_x; 454 rest_x = -rest_x;
456} 455}
457 456
458static int applesmc_idev_open(struct input_dev *dev) 457static void applesmc_idev_poll(struct input_polled_dev *dev)
459{
460 add_timer(&applesmc_timer);
461
462 return 0;
463}
464
465static void applesmc_idev_close(struct input_dev *dev)
466{
467 del_timer_sync(&applesmc_timer);
468}
469
470static void applesmc_idev_poll(unsigned long unused)
471{ 458{
459 struct input_dev *idev = dev->input;
472 s16 x, y; 460 s16 x, y;
473 461
474 /* Cannot sleep. Try nonblockingly. If we fail, try again later. */ 462 mutex_lock(&applesmc_lock);
475 if (!mutex_trylock(&applesmc_lock)) {
476 mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
477 return;
478 }
479 463
480 if (applesmc_read_motion_sensor(SENSOR_X, &x)) 464 if (applesmc_read_motion_sensor(SENSOR_X, &x))
481 goto out; 465 goto out;
@@ -483,13 +467,11 @@ static void applesmc_idev_poll(unsigned long unused)
483 goto out; 467 goto out;
484 468
485 x = -x; 469 x = -x;
486 input_report_abs(applesmc_idev, ABS_X, x - rest_x); 470 input_report_abs(idev, ABS_X, x - rest_x);
487 input_report_abs(applesmc_idev, ABS_Y, y - rest_y); 471 input_report_abs(idev, ABS_Y, y - rest_y);
488 input_sync(applesmc_idev); 472 input_sync(idev);
489 473
490out: 474out:
491 mod_timer(&applesmc_timer, jiffies + APPLESMC_POLL_PERIOD);
492
493 mutex_unlock(&applesmc_lock); 475 mutex_unlock(&applesmc_lock);
494} 476}
495 477
@@ -821,8 +803,7 @@ static ssize_t applesmc_key_at_index_read_show(struct device *dev,
821 803
822 if (!ret) { 804 if (!ret) {
823 return info[0]; 805 return info[0];
824 } 806 } else {
825 else {
826 return ret; 807 return ret;
827 } 808 }
828} 809}
@@ -1093,6 +1074,7 @@ static int applesmc_dmi_match(const struct dmi_system_id *id)
1093/* Create accelerometer ressources */ 1074/* Create accelerometer ressources */
1094static int applesmc_create_accelerometer(void) 1075static int applesmc_create_accelerometer(void)
1095{ 1076{
1077 struct input_dev *idev;
1096 int ret; 1078 int ret;
1097 1079
1098 ret = sysfs_create_group(&pdev->dev.kobj, 1080 ret = sysfs_create_group(&pdev->dev.kobj,
@@ -1100,40 +1082,37 @@ static int applesmc_create_accelerometer(void)
1100 if (ret) 1082 if (ret)
1101 goto out; 1083 goto out;
1102 1084
1103 applesmc_idev = input_allocate_device(); 1085 applesmc_idev = input_allocate_polled_device();
1104 if (!applesmc_idev) { 1086 if (!applesmc_idev) {
1105 ret = -ENOMEM; 1087 ret = -ENOMEM;
1106 goto out_sysfs; 1088 goto out_sysfs;
1107 } 1089 }
1108 1090
1091 applesmc_idev->poll = applesmc_idev_poll;
1092 applesmc_idev->poll_interval = APPLESMC_POLL_INTERVAL;
1093
1109 /* initial calibrate for the input device */ 1094 /* initial calibrate for the input device */
1110 applesmc_calibrate(); 1095 applesmc_calibrate();
1111 1096
1112 /* initialize the input class */ 1097 /* initialize the input device */
1113 applesmc_idev->name = "applesmc"; 1098 idev = applesmc_idev->input;
1114 applesmc_idev->id.bustype = BUS_HOST; 1099 idev->name = "applesmc";
1115 applesmc_idev->dev.parent = &pdev->dev; 1100 idev->id.bustype = BUS_HOST;
1116 applesmc_idev->evbit[0] = BIT(EV_ABS); 1101 idev->dev.parent = &pdev->dev;
1117 applesmc_idev->open = applesmc_idev_open; 1102 idev->evbit[0] = BIT(EV_ABS);
1118 applesmc_idev->close = applesmc_idev_close; 1103 input_set_abs_params(idev, ABS_X,
1119 input_set_abs_params(applesmc_idev, ABS_X,
1120 -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT); 1104 -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
1121 input_set_abs_params(applesmc_idev, ABS_Y, 1105 input_set_abs_params(idev, ABS_Y,
1122 -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT); 1106 -256, 256, APPLESMC_INPUT_FUZZ, APPLESMC_INPUT_FLAT);
1123 1107
1124 ret = input_register_device(applesmc_idev); 1108 ret = input_register_polled_device(applesmc_idev);
1125 if (ret) 1109 if (ret)
1126 goto out_idev; 1110 goto out_idev;
1127 1111
1128 /* start up our timer for the input device */
1129 init_timer(&applesmc_timer);
1130 applesmc_timer.function = applesmc_idev_poll;
1131 applesmc_timer.expires = jiffies + APPLESMC_POLL_PERIOD;
1132
1133 return 0; 1112 return 0;
1134 1113
1135out_idev: 1114out_idev:
1136 input_free_device(applesmc_idev); 1115 input_free_polled_device(applesmc_idev);
1137 1116
1138out_sysfs: 1117out_sysfs:
1139 sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); 1118 sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
@@ -1146,8 +1125,8 @@ out:
1146/* Release all ressources used by the accelerometer */ 1125/* Release all ressources used by the accelerometer */
1147static void applesmc_release_accelerometer(void) 1126static void applesmc_release_accelerometer(void)
1148{ 1127{
1149 del_timer_sync(&applesmc_timer); 1128 input_unregister_polled_device(applesmc_idev);
1150 input_unregister_device(applesmc_idev); 1129 input_free_polled_device(applesmc_idev);
1151 sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group); 1130 sysfs_remove_group(&pdev->dev.kobj, &accelerometer_attributes_group);
1152} 1131}
1153 1132
@@ -1184,8 +1163,6 @@ static int __init applesmc_init(void)
1184 int count; 1163 int count;
1185 int i; 1164 int i;
1186 1165
1187 mutex_init(&applesmc_lock);
1188
1189 if (!dmi_check_system(applesmc_whitelist)) { 1166 if (!dmi_check_system(applesmc_whitelist)) {
1190 printk(KERN_WARNING "applesmc: supported laptop not found!\n"); 1167 printk(KERN_WARNING "applesmc: supported laptop not found!\n");
1191 ret = -ENODEV; 1168 ret = -ENODEV;
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c
index a7c6d407572b..8a7ae03aeee4 100644
--- a/drivers/hwmon/hdaps.c
+++ b/drivers/hwmon/hdaps.c
@@ -28,7 +28,7 @@
28 28
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/platform_device.h> 30#include <linux/platform_device.h>
31#include <linux/input.h> 31#include <linux/input-polldev.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/mutex.h> 33#include <linux/mutex.h>
34#include <linux/module.h> 34#include <linux/module.h>
@@ -61,13 +61,12 @@
61#define INIT_TIMEOUT_MSECS 4000 /* wait up to 4s for device init ... */ 61#define INIT_TIMEOUT_MSECS 4000 /* wait up to 4s for device init ... */
62#define INIT_WAIT_MSECS 200 /* ... in 200ms increments */ 62#define INIT_WAIT_MSECS 200 /* ... in 200ms increments */
63 63
64#define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ 64#define HDAPS_POLL_INTERVAL 50 /* poll for input every 1/20s (50 ms)*/
65#define HDAPS_INPUT_FUZZ 4 /* input event threshold */ 65#define HDAPS_INPUT_FUZZ 4 /* input event threshold */
66#define HDAPS_INPUT_FLAT 4 66#define HDAPS_INPUT_FLAT 4
67 67
68static struct timer_list hdaps_timer;
69static struct platform_device *pdev; 68static struct platform_device *pdev;
70static struct input_dev *hdaps_idev; 69static struct input_polled_dev *hdaps_idev;
71static unsigned int hdaps_invert; 70static unsigned int hdaps_invert;
72static u8 km_activity; 71static u8 km_activity;
73static int rest_x; 72static int rest_x;
@@ -323,24 +322,19 @@ static void hdaps_calibrate(void)
323 __hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &rest_x, &rest_y); 322 __hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &rest_x, &rest_y);
324} 323}
325 324
326static void hdaps_mousedev_poll(unsigned long unused) 325static void hdaps_mousedev_poll(struct input_polled_dev *dev)
327{ 326{
327 struct input_dev *input_dev = dev->input;
328 int x, y; 328 int x, y;
329 329
330 /* Cannot sleep. Try nonblockingly. If we fail, try again later. */ 330 mutex_lock(&hdaps_mtx);
331 if (mutex_trylock(&hdaps_mtx)) {
332 mod_timer(&hdaps_timer,jiffies + HDAPS_POLL_PERIOD);
333 return;
334 }
335 331
336 if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) 332 if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y))
337 goto out; 333 goto out;
338 334
339 input_report_abs(hdaps_idev, ABS_X, x - rest_x); 335 input_report_abs(input_dev, ABS_X, x - rest_x);
340 input_report_abs(hdaps_idev, ABS_Y, y - rest_y); 336 input_report_abs(input_dev, ABS_Y, y - rest_y);
341 input_sync(hdaps_idev); 337 input_sync(input_dev);
342
343 mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD);
344 338
345out: 339out:
346 mutex_unlock(&hdaps_mtx); 340 mutex_unlock(&hdaps_mtx);
@@ -536,6 +530,7 @@ static struct dmi_system_id __initdata hdaps_whitelist[] = {
536 530
537static int __init hdaps_init(void) 531static int __init hdaps_init(void)
538{ 532{
533 struct input_dev *idev;
539 int ret; 534 int ret;
540 535
541 if (!dmi_check_system(hdaps_whitelist)) { 536 if (!dmi_check_system(hdaps_whitelist)) {
@@ -563,39 +558,37 @@ static int __init hdaps_init(void)
563 if (ret) 558 if (ret)
564 goto out_device; 559 goto out_device;
565 560
566 hdaps_idev = input_allocate_device(); 561 hdaps_idev = input_allocate_polled_device();
567 if (!hdaps_idev) { 562 if (!hdaps_idev) {
568 ret = -ENOMEM; 563 ret = -ENOMEM;
569 goto out_group; 564 goto out_group;
570 } 565 }
571 566
567 hdaps_idev->poll = hdaps_mousedev_poll;
568 hdaps_idev->poll_interval = HDAPS_POLL_INTERVAL;
569
572 /* initial calibrate for the input device */ 570 /* initial calibrate for the input device */
573 hdaps_calibrate(); 571 hdaps_calibrate();
574 572
575 /* initialize the input class */ 573 /* initialize the input class */
576 hdaps_idev->name = "hdaps"; 574 idev = hdaps_idev->input;
577 hdaps_idev->dev.parent = &pdev->dev; 575 idev->name = "hdaps";
578 hdaps_idev->evbit[0] = BIT(EV_ABS); 576 idev->dev.parent = &pdev->dev;
579 input_set_abs_params(hdaps_idev, ABS_X, 577 idev->evbit[0] = BIT(EV_ABS);
578 input_set_abs_params(idev, ABS_X,
580 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); 579 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
581 input_set_abs_params(hdaps_idev, ABS_Y, 580 input_set_abs_params(idev, ABS_Y,
582 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); 581 -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT);
583 582
584 ret = input_register_device(hdaps_idev); 583 ret = input_register_polled_device(hdaps_idev);
585 if (ret) 584 if (ret)
586 goto out_idev; 585 goto out_idev;
587 586
588 /* start up our timer for the input device */
589 init_timer(&hdaps_timer);
590 hdaps_timer.function = hdaps_mousedev_poll;
591 hdaps_timer.expires = jiffies + HDAPS_POLL_PERIOD;
592 add_timer(&hdaps_timer);
593
594 printk(KERN_INFO "hdaps: driver successfully loaded.\n"); 587 printk(KERN_INFO "hdaps: driver successfully loaded.\n");
595 return 0; 588 return 0;
596 589
597out_idev: 590out_idev:
598 input_free_device(hdaps_idev); 591 input_free_polled_device(hdaps_idev);
599out_group: 592out_group:
600 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); 593 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
601out_device: 594out_device:
@@ -611,8 +604,8 @@ out:
611 604
612static void __exit hdaps_exit(void) 605static void __exit hdaps_exit(void)
613{ 606{
614 del_timer_sync(&hdaps_timer); 607 input_unregister_polled_device(hdaps_idev);
615 input_unregister_device(hdaps_idev); 608 input_free_polled_device(hdaps_idev);
616 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); 609 sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group);
617 platform_device_unregister(pdev); 610 platform_device_unregister(pdev);
618 platform_driver_unregister(&hdaps_driver); 611 platform_driver_unregister(&hdaps_driver);