diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/hdaps.c | 41 | ||||
-rw-r--r-- | drivers/hwmon/w83627hf.c | 16 |
2 files changed, 27 insertions, 30 deletions
diff --git a/drivers/hwmon/hdaps.c b/drivers/hwmon/hdaps.c index 3bf05d5d0c82..c81bd4bce1b8 100644 --- a/drivers/hwmon/hdaps.c +++ b/drivers/hwmon/hdaps.c | |||
@@ -60,9 +60,11 @@ | |||
60 | 60 | ||
61 | #define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ | 61 | #define HDAPS_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */ |
62 | #define HDAPS_INPUT_FUZZ 4 /* input event threshold */ | 62 | #define HDAPS_INPUT_FUZZ 4 /* input event threshold */ |
63 | #define HDAPS_INPUT_FLAT 4 | ||
63 | 64 | ||
64 | static struct timer_list hdaps_timer; | 65 | static struct timer_list hdaps_timer; |
65 | static struct platform_device *pdev; | 66 | static struct platform_device *pdev; |
67 | static struct input_dev *hdaps_idev; | ||
66 | static unsigned int hdaps_invert; | 68 | static unsigned int hdaps_invert; |
67 | static u8 km_activity; | 69 | static u8 km_activity; |
68 | static int rest_x; | 70 | static int rest_x; |
@@ -310,18 +312,6 @@ static struct platform_driver hdaps_driver = { | |||
310 | }, | 312 | }, |
311 | }; | 313 | }; |
312 | 314 | ||
313 | /* Input class stuff */ | ||
314 | |||
315 | static struct input_dev hdaps_idev = { | ||
316 | .name = "hdaps", | ||
317 | .evbit = { BIT(EV_ABS) }, | ||
318 | .absbit = { BIT(ABS_X) | BIT(ABS_Y) }, | ||
319 | .absmin = { [ABS_X] = -256, [ABS_Y] = -256 }, | ||
320 | .absmax = { [ABS_X] = 256, [ABS_Y] = 256 }, | ||
321 | .absfuzz = { [ABS_X] = HDAPS_INPUT_FUZZ, [ABS_Y] = HDAPS_INPUT_FUZZ }, | ||
322 | .absflat = { [ABS_X] = HDAPS_INPUT_FUZZ, [ABS_Y] = HDAPS_INPUT_FUZZ }, | ||
323 | }; | ||
324 | |||
325 | /* | 315 | /* |
326 | * hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_sem. | 316 | * hdaps_calibrate - Set our "resting" values. Callers must hold hdaps_sem. |
327 | */ | 317 | */ |
@@ -343,9 +333,9 @@ static void hdaps_mousedev_poll(unsigned long unused) | |||
343 | if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) | 333 | if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y)) |
344 | goto out; | 334 | goto out; |
345 | 335 | ||
346 | input_report_abs(&hdaps_idev, ABS_X, x - rest_x); | 336 | input_report_abs(hdaps_idev, ABS_X, x - rest_x); |
347 | input_report_abs(&hdaps_idev, ABS_Y, y - rest_y); | 337 | input_report_abs(hdaps_idev, ABS_Y, y - rest_y); |
348 | input_sync(&hdaps_idev); | 338 | input_sync(hdaps_idev); |
349 | 339 | ||
350 | mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD); | 340 | mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD); |
351 | 341 | ||
@@ -565,12 +555,25 @@ static int __init hdaps_init(void) | |||
565 | if (ret) | 555 | if (ret) |
566 | goto out_device; | 556 | goto out_device; |
567 | 557 | ||
558 | hdaps_idev = input_allocate_device(); | ||
559 | if (!hdaps_idev) { | ||
560 | ret = -ENOMEM; | ||
561 | goto out_group; | ||
562 | } | ||
563 | |||
568 | /* initial calibrate for the input device */ | 564 | /* initial calibrate for the input device */ |
569 | hdaps_calibrate(); | 565 | hdaps_calibrate(); |
570 | 566 | ||
571 | /* initialize the input class */ | 567 | /* initialize the input class */ |
572 | hdaps_idev.dev = &pdev->dev; | 568 | hdaps_idev->name = "hdaps"; |
573 | input_register_device(&hdaps_idev); | 569 | hdaps_idev->cdev.dev = &pdev->dev; |
570 | hdaps_idev->evbit[0] = BIT(EV_ABS); | ||
571 | input_set_abs_params(hdaps_idev, ABS_X, | ||
572 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); | ||
573 | input_set_abs_params(hdaps_idev, ABS_X, | ||
574 | -256, 256, HDAPS_INPUT_FUZZ, HDAPS_INPUT_FLAT); | ||
575 | |||
576 | input_register_device(hdaps_idev); | ||
574 | 577 | ||
575 | /* start up our timer for the input device */ | 578 | /* start up our timer for the input device */ |
576 | init_timer(&hdaps_timer); | 579 | init_timer(&hdaps_timer); |
@@ -581,6 +584,8 @@ static int __init hdaps_init(void) | |||
581 | printk(KERN_INFO "hdaps: driver successfully loaded.\n"); | 584 | printk(KERN_INFO "hdaps: driver successfully loaded.\n"); |
582 | return 0; | 585 | return 0; |
583 | 586 | ||
587 | out_group: | ||
588 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); | ||
584 | out_device: | 589 | out_device: |
585 | platform_device_unregister(pdev); | 590 | platform_device_unregister(pdev); |
586 | out_driver: | 591 | out_driver: |
@@ -595,7 +600,7 @@ out: | |||
595 | static void __exit hdaps_exit(void) | 600 | static void __exit hdaps_exit(void) |
596 | { | 601 | { |
597 | del_timer_sync(&hdaps_timer); | 602 | del_timer_sync(&hdaps_timer); |
598 | input_unregister_device(&hdaps_idev); | 603 | input_unregister_device(hdaps_idev); |
599 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); | 604 | sysfs_remove_group(&pdev->dev.kobj, &hdaps_attribute_group); |
600 | platform_device_unregister(pdev); | 605 | platform_device_unregister(pdev); |
601 | platform_driver_unregister(&hdaps_driver); | 606 | platform_driver_unregister(&hdaps_driver); |
diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 70ef926c3bd8..4e9a04e1f08e 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c | |||
@@ -180,11 +180,10 @@ superio_exit(void) | |||
180 | #define W83781D_REG_BANK 0x4E | 180 | #define W83781D_REG_BANK 0x4E |
181 | 181 | ||
182 | #define W83781D_REG_CONFIG 0x40 | 182 | #define W83781D_REG_CONFIG 0x40 |
183 | #define W83781D_REG_ALARM1 0x41 | 183 | #define W83781D_REG_ALARM1 0x459 |
184 | #define W83781D_REG_ALARM2 0x42 | 184 | #define W83781D_REG_ALARM2 0x45A |
185 | #define W83781D_REG_ALARM3 0x450 | 185 | #define W83781D_REG_ALARM3 0x45B |
186 | 186 | ||
187 | #define W83781D_REG_IRQ 0x4C | ||
188 | #define W83781D_REG_BEEP_CONFIG 0x4D | 187 | #define W83781D_REG_BEEP_CONFIG 0x4D |
189 | #define W83781D_REG_BEEP_INTS1 0x56 | 188 | #define W83781D_REG_BEEP_INTS1 0x56 |
190 | #define W83781D_REG_BEEP_INTS2 0x57 | 189 | #define W83781D_REG_BEEP_INTS2 0x57 |
@@ -1370,13 +1369,6 @@ static void w83627hf_init_client(struct i2c_client *client) | |||
1370 | W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); | 1369 | W83781D_REG_TEMP3_CONFIG, tmp & 0xfe); |
1371 | } | 1370 | } |
1372 | } | 1371 | } |
1373 | |||
1374 | /* enable comparator mode for temp2 and temp3 so | ||
1375 | alarm indication will work correctly */ | ||
1376 | i = w83627hf_read_value(client, W83781D_REG_IRQ); | ||
1377 | if (!(i & 0x40)) | ||
1378 | w83627hf_write_value(client, W83781D_REG_IRQ, | ||
1379 | i | 0x40); | ||
1380 | } | 1372 | } |
1381 | 1373 | ||
1382 | /* Start monitoring */ | 1374 | /* Start monitoring */ |
@@ -1400,7 +1392,7 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev) | |||
1400 | /* skip missing sensors */ | 1392 | /* skip missing sensors */ |
1401 | if (((data->type == w83697hf) && (i == 1)) || | 1393 | if (((data->type == w83697hf) && (i == 1)) || |
1402 | ((data->type == w83627thf || data->type == w83637hf) | 1394 | ((data->type == w83627thf || data->type == w83637hf) |
1403 | && (i == 4 || i == 5))) | 1395 | && (i == 5 || i == 6))) |
1404 | continue; | 1396 | continue; |
1405 | data->in[i] = | 1397 | data->in[i] = |
1406 | w83627hf_read_value(client, W83781D_REG_IN(i)); | 1398 | w83627hf_read_value(client, W83781D_REG_IN(i)); |