diff options
Diffstat (limited to 'drivers/platform')
23 files changed, 371 insertions, 147 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index e631dbeafd79..7bec4588c268 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -385,6 +385,16 @@ config EEEPC_LAPTOP | |||
385 | 385 | ||
386 | If you have an Eee PC laptop, say Y or M here. | 386 | If you have an Eee PC laptop, say Y or M here. |
387 | 387 | ||
388 | config EEEPC_WMI | ||
389 | tristate "Eee PC WMI Hotkey Driver (EXPERIMENTAL)" | ||
390 | depends on ACPI_WMI | ||
391 | depends on INPUT | ||
392 | depends on EXPERIMENTAL | ||
393 | ---help--- | ||
394 | Say Y here if you want to support WMI-based hotkeys on Eee PC laptops. | ||
395 | |||
396 | To compile this driver as a module, choose M here: the module will | ||
397 | be called eeepc-wmi. | ||
388 | 398 | ||
389 | config ACPI_WMI | 399 | config ACPI_WMI |
390 | tristate "WMI" | 400 | tristate "WMI" |
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index 9cd9fa0a27e6..a906490e3530 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile | |||
@@ -4,6 +4,7 @@ | |||
4 | # | 4 | # |
5 | obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o | 5 | obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o |
6 | obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o | 6 | obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o |
7 | obj-$(CONFIG_EEEPC_WMI) += eeepc-wmi.o | ||
7 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o | 8 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o |
8 | obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o | 9 | obj-$(CONFIG_ACPI_CMPC) += classmate-laptop.o |
9 | obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o | 10 | obj-$(CONFIG_COMPAL_LAPTOP) += compal-laptop.o |
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 226b3e93498c..1ea6c434d330 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/rfkill.h> | 36 | #include <linux/rfkill.h> |
37 | #include <linux/workqueue.h> | 37 | #include <linux/workqueue.h> |
38 | #include <linux/debugfs.h> | 38 | #include <linux/debugfs.h> |
39 | #include <linux/slab.h> | ||
39 | 40 | ||
40 | #include <acpi/acpi_drivers.h> | 41 | #include <acpi/acpi_drivers.h> |
41 | 42 | ||
@@ -922,9 +923,13 @@ static struct backlight_ops acer_bl_ops = { | |||
922 | 923 | ||
923 | static int __devinit acer_backlight_init(struct device *dev) | 924 | static int __devinit acer_backlight_init(struct device *dev) |
924 | { | 925 | { |
926 | struct backlight_properties props; | ||
925 | struct backlight_device *bd; | 927 | struct backlight_device *bd; |
926 | 928 | ||
927 | bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops); | 929 | memset(&props, 0, sizeof(struct backlight_properties)); |
930 | props.max_brightness = max_brightness; | ||
931 | bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops, | ||
932 | &props); | ||
928 | if (IS_ERR(bd)) { | 933 | if (IS_ERR(bd)) { |
929 | printk(ACER_ERR "Could not register Acer backlight device\n"); | 934 | printk(ACER_ERR "Could not register Acer backlight device\n"); |
930 | acer_backlight_device = NULL; | 935 | acer_backlight_device = NULL; |
@@ -935,7 +940,6 @@ static int __devinit acer_backlight_init(struct device *dev) | |||
935 | 940 | ||
936 | bd->props.power = FB_BLANK_UNBLANK; | 941 | bd->props.power = FB_BLANK_UNBLANK; |
937 | bd->props.brightness = read_brightness(bd); | 942 | bd->props.brightness = read_brightness(bd); |
938 | bd->props.max_brightness = max_brightness; | ||
939 | backlight_update_status(bd); | 943 | backlight_update_status(bd); |
940 | return 0; | 944 | return 0; |
941 | } | 945 | } |
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 791fcf321506..52262b012abb 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/input.h> | 49 | #include <linux/input.h> |
50 | #include <linux/input/sparse-keymap.h> | 50 | #include <linux/input/sparse-keymap.h> |
51 | #include <linux/rfkill.h> | 51 | #include <linux/rfkill.h> |
52 | #include <linux/slab.h> | ||
52 | #include <acpi/acpi_drivers.h> | 53 | #include <acpi/acpi_drivers.h> |
53 | #include <acpi/acpi_bus.h> | 54 | #include <acpi/acpi_bus.h> |
54 | 55 | ||
@@ -139,7 +140,7 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " | |||
139 | 140 | ||
140 | /* Backlight */ | 141 | /* Backlight */ |
141 | static acpi_handle lcd_switch_handle; | 142 | static acpi_handle lcd_switch_handle; |
142 | static const char *lcd_switch_paths[] = { | 143 | static char *lcd_switch_paths[] = { |
143 | "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ | 144 | "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ |
144 | "\\_SB.PCI0.ISA.EC0._Q10", /* A1x */ | 145 | "\\_SB.PCI0.ISA.EC0._Q10", /* A1x */ |
145 | "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */ | 146 | "\\_SB.PCI0.PX40.ECD0._Q10", /* L3C */ |
@@ -153,7 +154,7 @@ static const char *lcd_switch_paths[] = { | |||
153 | #define METHOD_SWITCH_DISPLAY "SDSP" | 154 | #define METHOD_SWITCH_DISPLAY "SDSP" |
154 | 155 | ||
155 | static acpi_handle display_get_handle; | 156 | static acpi_handle display_get_handle; |
156 | static const char *display_get_paths[] = { | 157 | static char *display_get_paths[] = { |
157 | /* A6B, A6K A6R A7D F3JM L4R M6R A3G M6A M6V VX-1 V6J V6V W3Z */ | 158 | /* A6B, A6K A6R A7D F3JM L4R M6R A3G M6A M6V VX-1 V6J V6V W3Z */ |
158 | "\\_SB.PCI0.P0P1.VGA.GETD", | 159 | "\\_SB.PCI0.P0P1.VGA.GETD", |
159 | /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V S5A M5A z33A W1Jc W2V G1 */ | 160 | /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V S5A M5A z33A W1Jc W2V G1 */ |
@@ -639,12 +640,16 @@ static int asus_backlight_init(struct asus_laptop *asus) | |||
639 | { | 640 | { |
640 | struct backlight_device *bd; | 641 | struct backlight_device *bd; |
641 | struct device *dev = &asus->platform_device->dev; | 642 | struct device *dev = &asus->platform_device->dev; |
643 | struct backlight_properties props; | ||
642 | 644 | ||
643 | if (!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) && | 645 | if (!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) && |
644 | !acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) && | 646 | !acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) && |
645 | lcd_switch_handle) { | 647 | lcd_switch_handle) { |
648 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
649 | props.max_brightness = 15; | ||
650 | |||
646 | bd = backlight_device_register(ASUS_LAPTOP_FILE, dev, | 651 | bd = backlight_device_register(ASUS_LAPTOP_FILE, dev, |
647 | asus, &asusbl_ops); | 652 | asus, &asusbl_ops, &props); |
648 | if (IS_ERR(bd)) { | 653 | if (IS_ERR(bd)) { |
649 | pr_err("Could not register asus backlight device\n"); | 654 | pr_err("Could not register asus backlight device\n"); |
650 | asus->backlight_device = NULL; | 655 | asus->backlight_device = NULL; |
@@ -653,7 +658,6 @@ static int asus_backlight_init(struct asus_laptop *asus) | |||
653 | 658 | ||
654 | asus->backlight_device = bd; | 659 | asus->backlight_device = bd; |
655 | 660 | ||
656 | bd->props.max_brightness = 15; | ||
657 | bd->props.power = FB_BLANK_UNBLANK; | 661 | bd->props.power = FB_BLANK_UNBLANK; |
658 | bd->props.brightness = asus_read_brightness(bd); | 662 | bd->props.brightness = asus_read_brightness(bd); |
659 | backlight_update_status(bd); | 663 | backlight_update_status(bd); |
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index 1381430e1105..92fd30c9379c 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include <linux/kernel.h> | 33 | #include <linux/kernel.h> |
34 | #include <linux/module.h> | 34 | #include <linux/module.h> |
35 | #include <linux/slab.h> | ||
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <linux/types.h> | 37 | #include <linux/types.h> |
37 | #include <linux/proc_fs.h> | 38 | #include <linux/proc_fs.h> |
@@ -1481,6 +1482,7 @@ static void asus_acpi_exit(void) | |||
1481 | 1482 | ||
1482 | static int __init asus_acpi_init(void) | 1483 | static int __init asus_acpi_init(void) |
1483 | { | 1484 | { |
1485 | struct backlight_properties props; | ||
1484 | int result; | 1486 | int result; |
1485 | 1487 | ||
1486 | result = acpi_bus_register_driver(&asus_hotk_driver); | 1488 | result = acpi_bus_register_driver(&asus_hotk_driver); |
@@ -1507,15 +1509,17 @@ static int __init asus_acpi_init(void) | |||
1507 | return -ENODEV; | 1509 | return -ENODEV; |
1508 | } | 1510 | } |
1509 | 1511 | ||
1512 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
1513 | props.max_brightness = 15; | ||
1510 | asus_backlight_device = backlight_device_register("asus", NULL, NULL, | 1514 | asus_backlight_device = backlight_device_register("asus", NULL, NULL, |
1511 | &asus_backlight_data); | 1515 | &asus_backlight_data, |
1516 | &props); | ||
1512 | if (IS_ERR(asus_backlight_device)) { | 1517 | if (IS_ERR(asus_backlight_device)) { |
1513 | printk(KERN_ERR "Could not register asus backlight device\n"); | 1518 | printk(KERN_ERR "Could not register asus backlight device\n"); |
1514 | asus_backlight_device = NULL; | 1519 | asus_backlight_device = NULL; |
1515 | asus_acpi_exit(); | 1520 | asus_acpi_exit(); |
1516 | return -ENODEV; | 1521 | return -ENODEV; |
1517 | } | 1522 | } |
1518 | asus_backlight_device->props.max_brightness = 15; | ||
1519 | 1523 | ||
1520 | return 0; | 1524 | return 0; |
1521 | } | 1525 | } |
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 035a7dd65a3f..7f9e5ddc9498 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/init.h> | 20 | #include <linux/init.h> |
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/slab.h> | ||
22 | #include <linux/workqueue.h> | 23 | #include <linux/workqueue.h> |
23 | #include <acpi/acpi_drivers.h> | 24 | #include <acpi/acpi_drivers.h> |
24 | #include <linux/backlight.h> | 25 | #include <linux/backlight.h> |
@@ -455,18 +456,22 @@ static int cmpc_bl_update_status(struct backlight_device *bd) | |||
455 | return -1; | 456 | return -1; |
456 | } | 457 | } |
457 | 458 | ||
458 | static struct backlight_ops cmpc_bl_ops = { | 459 | static const struct backlight_ops cmpc_bl_ops = { |
459 | .get_brightness = cmpc_bl_get_brightness, | 460 | .get_brightness = cmpc_bl_get_brightness, |
460 | .update_status = cmpc_bl_update_status | 461 | .update_status = cmpc_bl_update_status |
461 | }; | 462 | }; |
462 | 463 | ||
463 | static int cmpc_bl_add(struct acpi_device *acpi) | 464 | static int cmpc_bl_add(struct acpi_device *acpi) |
464 | { | 465 | { |
466 | struct backlight_properties props; | ||
465 | struct backlight_device *bd; | 467 | struct backlight_device *bd; |
466 | 468 | ||
467 | bd = backlight_device_register("cmpc_bl", &acpi->dev, | 469 | memset(&props, 0, sizeof(struct backlight_properties)); |
468 | acpi->handle, &cmpc_bl_ops); | 470 | props.max_brightness = 7; |
469 | bd->props.max_brightness = 7; | 471 | bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle, |
472 | &cmpc_bl_ops, &props); | ||
473 | if (IS_ERR(bd)) | ||
474 | return PTR_ERR(bd); | ||
470 | dev_set_drvdata(&acpi->dev, bd); | 475 | dev_set_drvdata(&acpi->dev, bd); |
471 | return 0; | 476 | return 0; |
472 | } | 477 | } |
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 2740b40aad9b..71ff1545a93e 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c | |||
@@ -291,12 +291,15 @@ static int __init compal_init(void) | |||
291 | /* Register backlight stuff */ | 291 | /* Register backlight stuff */ |
292 | 292 | ||
293 | if (!acpi_video_backlight_support()) { | 293 | if (!acpi_video_backlight_support()) { |
294 | compalbl_device = backlight_device_register("compal-laptop", NULL, NULL, | 294 | struct backlight_properties props; |
295 | &compalbl_ops); | 295 | memset(&props, 0, sizeof(struct backlight_properties)); |
296 | props.max_brightness = COMPAL_LCD_LEVEL_MAX - 1; | ||
297 | compalbl_device = backlight_device_register("compal-laptop", | ||
298 | NULL, NULL, | ||
299 | &compalbl_ops, | ||
300 | &props); | ||
296 | if (IS_ERR(compalbl_device)) | 301 | if (IS_ERR(compalbl_device)) |
297 | return PTR_ERR(compalbl_device); | 302 | return PTR_ERR(compalbl_device); |
298 | |||
299 | compalbl_device->props.max_brightness = COMPAL_LCD_LEVEL_MAX-1; | ||
300 | } | 303 | } |
301 | 304 | ||
302 | ret = platform_driver_register(&compal_driver); | 305 | ret = platform_driver_register(&compal_driver); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index ef614979afe9..661e3ac4d5b1 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/acpi.h> | 24 | #include <linux/acpi.h> |
25 | #include <linux/mm.h> | 25 | #include <linux/mm.h> |
26 | #include <linux/i8042.h> | 26 | #include <linux/i8042.h> |
27 | #include <linux/slab.h> | ||
27 | #include "../../firmware/dcdbas.h" | 28 | #include "../../firmware/dcdbas.h" |
28 | 29 | ||
29 | #define BRIGHTNESS_TOKEN 0x7d | 30 | #define BRIGHTNESS_TOKEN 0x7d |
@@ -559,10 +560,14 @@ static int __init dell_init(void) | |||
559 | release_buffer(); | 560 | release_buffer(); |
560 | 561 | ||
561 | if (max_intensity) { | 562 | if (max_intensity) { |
562 | dell_backlight_device = backlight_device_register( | 563 | struct backlight_properties props; |
563 | "dell_backlight", | 564 | memset(&props, 0, sizeof(struct backlight_properties)); |
564 | &platform_device->dev, NULL, | 565 | props.max_brightness = max_intensity; |
565 | &dell_ops); | 566 | dell_backlight_device = backlight_device_register("dell_backlight", |
567 | &platform_device->dev, | ||
568 | NULL, | ||
569 | &dell_ops, | ||
570 | &props); | ||
566 | 571 | ||
567 | if (IS_ERR(dell_backlight_device)) { | 572 | if (IS_ERR(dell_backlight_device)) { |
568 | ret = PTR_ERR(dell_backlight_device); | 573 | ret = PTR_ERR(dell_backlight_device); |
@@ -570,7 +575,6 @@ static int __init dell_init(void) | |||
570 | goto fail_backlight; | 575 | goto fail_backlight; |
571 | } | 576 | } |
572 | 577 | ||
573 | dell_backlight_device->props.max_brightness = max_intensity; | ||
574 | dell_backlight_device->props.brightness = | 578 | dell_backlight_device->props.brightness = |
575 | dell_get_intensity(dell_backlight_device); | 579 | dell_get_intensity(dell_backlight_device); |
576 | backlight_update_status(dell_backlight_device); | 580 | backlight_update_status(dell_backlight_device); |
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 1b1dddbd5744..6ba6c30e5bb6 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/slab.h> | ||
29 | #include <linux/types.h> | 30 | #include <linux/types.h> |
30 | #include <linux/input.h> | 31 | #include <linux/input.h> |
31 | #include <acpi/acpi_drivers.h> | 32 | #include <acpi/acpi_drivers.h> |
@@ -142,7 +143,7 @@ static struct key_entry *dell_wmi_keymap = dell_legacy_wmi_keymap; | |||
142 | 143 | ||
143 | static struct input_dev *dell_wmi_input_dev; | 144 | static struct input_dev *dell_wmi_input_dev; |
144 | 145 | ||
145 | static struct key_entry *dell_wmi_get_entry_by_scancode(int code) | 146 | static struct key_entry *dell_wmi_get_entry_by_scancode(unsigned int code) |
146 | { | 147 | { |
147 | struct key_entry *key; | 148 | struct key_entry *key; |
148 | 149 | ||
@@ -153,7 +154,7 @@ static struct key_entry *dell_wmi_get_entry_by_scancode(int code) | |||
153 | return NULL; | 154 | return NULL; |
154 | } | 155 | } |
155 | 156 | ||
156 | static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) | 157 | static struct key_entry *dell_wmi_get_entry_by_keycode(unsigned int keycode) |
157 | { | 158 | { |
158 | struct key_entry *key; | 159 | struct key_entry *key; |
159 | 160 | ||
@@ -164,8 +165,8 @@ static struct key_entry *dell_wmi_get_entry_by_keycode(int keycode) | |||
164 | return NULL; | 165 | return NULL; |
165 | } | 166 | } |
166 | 167 | ||
167 | static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, | 168 | static int dell_wmi_getkeycode(struct input_dev *dev, |
168 | int *keycode) | 169 | unsigned int scancode, unsigned int *keycode) |
169 | { | 170 | { |
170 | struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode); | 171 | struct key_entry *key = dell_wmi_get_entry_by_scancode(scancode); |
171 | 172 | ||
@@ -177,13 +178,11 @@ static int dell_wmi_getkeycode(struct input_dev *dev, int scancode, | |||
177 | return -EINVAL; | 178 | return -EINVAL; |
178 | } | 179 | } |
179 | 180 | ||
180 | static int dell_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) | 181 | static int dell_wmi_setkeycode(struct input_dev *dev, |
182 | unsigned int scancode, unsigned int keycode) | ||
181 | { | 183 | { |
182 | struct key_entry *key; | 184 | struct key_entry *key; |
183 | int old_keycode; | 185 | unsigned int old_keycode; |
184 | |||
185 | if (keycode < 0 || keycode > KEY_MAX) | ||
186 | return -EINVAL; | ||
187 | 186 | ||
188 | key = dell_wmi_get_entry_by_scancode(scancode); | 187 | key = dell_wmi_get_entry_by_scancode(scancode); |
189 | if (key && key->type == KE_KEY) { | 188 | if (key && key->type == KE_KEY) { |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 9a844caa3756..54a015785ca8 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/fb.h> | 27 | #include <linux/fb.h> |
28 | #include <linux/hwmon.h> | 28 | #include <linux/hwmon.h> |
29 | #include <linux/hwmon-sysfs.h> | 29 | #include <linux/hwmon-sysfs.h> |
30 | #include <linux/slab.h> | ||
30 | #include <acpi/acpi_drivers.h> | 31 | #include <acpi/acpi_drivers.h> |
31 | #include <acpi/acpi_bus.h> | 32 | #include <acpi/acpi_bus.h> |
32 | #include <linux/uaccess.h> | 33 | #include <linux/uaccess.h> |
@@ -1131,18 +1132,20 @@ static int eeepc_backlight_notify(struct eeepc_laptop *eeepc) | |||
1131 | 1132 | ||
1132 | static int eeepc_backlight_init(struct eeepc_laptop *eeepc) | 1133 | static int eeepc_backlight_init(struct eeepc_laptop *eeepc) |
1133 | { | 1134 | { |
1135 | struct backlight_properties props; | ||
1134 | struct backlight_device *bd; | 1136 | struct backlight_device *bd; |
1135 | 1137 | ||
1138 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
1139 | props.max_brightness = 15; | ||
1136 | bd = backlight_device_register(EEEPC_LAPTOP_FILE, | 1140 | bd = backlight_device_register(EEEPC_LAPTOP_FILE, |
1137 | &eeepc->platform_device->dev, | 1141 | &eeepc->platform_device->dev, eeepc, |
1138 | eeepc, &eeepcbl_ops); | 1142 | &eeepcbl_ops, &props); |
1139 | if (IS_ERR(bd)) { | 1143 | if (IS_ERR(bd)) { |
1140 | pr_err("Could not register eeepc backlight device\n"); | 1144 | pr_err("Could not register eeepc backlight device\n"); |
1141 | eeepc->backlight_device = NULL; | 1145 | eeepc->backlight_device = NULL; |
1142 | return PTR_ERR(bd); | 1146 | return PTR_ERR(bd); |
1143 | } | 1147 | } |
1144 | eeepc->backlight_device = bd; | 1148 | eeepc->backlight_device = bd; |
1145 | bd->props.max_brightness = 15; | ||
1146 | bd->props.brightness = read_brightness(bd); | 1149 | bd->props.brightness = read_brightness(bd); |
1147 | bd->props.power = FB_BLANK_UNBLANK; | 1150 | bd->props.power = FB_BLANK_UNBLANK; |
1148 | backlight_update_status(bd); | 1151 | backlight_update_status(bd); |
diff --git a/drivers/platform/x86/eeepc-wmi.c b/drivers/platform/x86/eeepc-wmi.c new file mode 100644 index 000000000000..9f8822658fd7 --- /dev/null +++ b/drivers/platform/x86/eeepc-wmi.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * Eee PC WMI hotkey driver | ||
3 | * | ||
4 | * Copyright(C) 2010 Intel Corporation. | ||
5 | * | ||
6 | * Portions based on wistron_btns.c: | ||
7 | * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> | ||
8 | * Copyright (C) 2005 Bernhard Rosenkraenzer <bero@arklinux.org> | ||
9 | * Copyright (C) 2005 Dmitry Torokhov <dtor@mail.ru> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | */ | ||
25 | |||
26 | #include <linux/kernel.h> | ||
27 | #include <linux/module.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/types.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/input.h> | ||
32 | #include <linux/input/sparse-keymap.h> | ||
33 | #include <acpi/acpi_bus.h> | ||
34 | #include <acpi/acpi_drivers.h> | ||
35 | |||
36 | MODULE_AUTHOR("Yong Wang <yong.y.wang@intel.com>"); | ||
37 | MODULE_DESCRIPTION("Eee PC WMI Hotkey Driver"); | ||
38 | MODULE_LICENSE("GPL"); | ||
39 | |||
40 | #define EEEPC_WMI_EVENT_GUID "ABBC0F72-8EA1-11D1-00A0-C90629100000" | ||
41 | |||
42 | MODULE_ALIAS("wmi:"EEEPC_WMI_EVENT_GUID); | ||
43 | |||
44 | #define NOTIFY_BRNUP_MIN 0x11 | ||
45 | #define NOTIFY_BRNUP_MAX 0x1f | ||
46 | #define NOTIFY_BRNDOWN_MIN 0x20 | ||
47 | #define NOTIFY_BRNDOWN_MAX 0x2e | ||
48 | |||
49 | static const struct key_entry eeepc_wmi_keymap[] = { | ||
50 | /* Sleep already handled via generic ACPI code */ | ||
51 | { KE_KEY, 0x5d, { KEY_WLAN } }, | ||
52 | { KE_KEY, 0x32, { KEY_MUTE } }, | ||
53 | { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, | ||
54 | { KE_KEY, 0x30, { KEY_VOLUMEUP } }, | ||
55 | { KE_IGNORE, NOTIFY_BRNDOWN_MIN, { KEY_BRIGHTNESSDOWN } }, | ||
56 | { KE_IGNORE, NOTIFY_BRNUP_MIN, { KEY_BRIGHTNESSUP } }, | ||
57 | { KE_KEY, 0xcc, { KEY_SWITCHVIDEOMODE } }, | ||
58 | { KE_END, 0}, | ||
59 | }; | ||
60 | |||
61 | static struct input_dev *eeepc_wmi_input_dev; | ||
62 | |||
63 | static void eeepc_wmi_notify(u32 value, void *context) | ||
64 | { | ||
65 | struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
66 | union acpi_object *obj; | ||
67 | acpi_status status; | ||
68 | int code; | ||
69 | |||
70 | status = wmi_get_event_data(value, &response); | ||
71 | if (status != AE_OK) { | ||
72 | pr_err("EEEPC WMI: bad event status 0x%x\n", status); | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | obj = (union acpi_object *)response.pointer; | ||
77 | |||
78 | if (obj && obj->type == ACPI_TYPE_INTEGER) { | ||
79 | code = obj->integer.value; | ||
80 | |||
81 | if (code >= NOTIFY_BRNUP_MIN && code <= NOTIFY_BRNUP_MAX) | ||
82 | code = NOTIFY_BRNUP_MIN; | ||
83 | else if (code >= NOTIFY_BRNDOWN_MIN && code <= NOTIFY_BRNDOWN_MAX) | ||
84 | code = NOTIFY_BRNDOWN_MIN; | ||
85 | |||
86 | if (!sparse_keymap_report_event(eeepc_wmi_input_dev, | ||
87 | code, 1, true)) | ||
88 | pr_info("EEEPC WMI: Unknown key %x pressed\n", code); | ||
89 | } | ||
90 | |||
91 | kfree(obj); | ||
92 | } | ||
93 | |||
94 | static int eeepc_wmi_input_setup(void) | ||
95 | { | ||
96 | int err; | ||
97 | |||
98 | eeepc_wmi_input_dev = input_allocate_device(); | ||
99 | if (!eeepc_wmi_input_dev) | ||
100 | return -ENOMEM; | ||
101 | |||
102 | eeepc_wmi_input_dev->name = "Eee PC WMI hotkeys"; | ||
103 | eeepc_wmi_input_dev->phys = "wmi/input0"; | ||
104 | eeepc_wmi_input_dev->id.bustype = BUS_HOST; | ||
105 | |||
106 | err = sparse_keymap_setup(eeepc_wmi_input_dev, eeepc_wmi_keymap, NULL); | ||
107 | if (err) | ||
108 | goto err_free_dev; | ||
109 | |||
110 | err = input_register_device(eeepc_wmi_input_dev); | ||
111 | if (err) | ||
112 | goto err_free_keymap; | ||
113 | |||
114 | return 0; | ||
115 | |||
116 | err_free_keymap: | ||
117 | sparse_keymap_free(eeepc_wmi_input_dev); | ||
118 | err_free_dev: | ||
119 | input_free_device(eeepc_wmi_input_dev); | ||
120 | return err; | ||
121 | } | ||
122 | |||
123 | static int __init eeepc_wmi_init(void) | ||
124 | { | ||
125 | int err; | ||
126 | acpi_status status; | ||
127 | |||
128 | if (!wmi_has_guid(EEEPC_WMI_EVENT_GUID)) { | ||
129 | pr_warning("EEEPC WMI: No known WMI GUID found\n"); | ||
130 | return -ENODEV; | ||
131 | } | ||
132 | |||
133 | err = eeepc_wmi_input_setup(); | ||
134 | if (err) | ||
135 | return err; | ||
136 | |||
137 | status = wmi_install_notify_handler(EEEPC_WMI_EVENT_GUID, | ||
138 | eeepc_wmi_notify, NULL); | ||
139 | if (ACPI_FAILURE(status)) { | ||
140 | sparse_keymap_free(eeepc_wmi_input_dev); | ||
141 | input_unregister_device(eeepc_wmi_input_dev); | ||
142 | pr_err("EEEPC WMI: Unable to register notify handler - %d\n", | ||
143 | status); | ||
144 | return -ENODEV; | ||
145 | } | ||
146 | |||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static void __exit eeepc_wmi_exit(void) | ||
151 | { | ||
152 | wmi_remove_notify_handler(EEEPC_WMI_EVENT_GUID); | ||
153 | sparse_keymap_free(eeepc_wmi_input_dev); | ||
154 | input_unregister_device(eeepc_wmi_input_dev); | ||
155 | } | ||
156 | |||
157 | module_init(eeepc_wmi_init); | ||
158 | module_exit(eeepc_wmi_exit); | ||
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 5f3320d468f6..47b4fd75aa34 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <linux/kfifo.h> | 66 | #include <linux/kfifo.h> |
67 | #include <linux/video_output.h> | 67 | #include <linux/video_output.h> |
68 | #include <linux/platform_device.h> | 68 | #include <linux/platform_device.h> |
69 | #include <linux/slab.h> | ||
69 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) | 70 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
70 | #include <linux/leds.h> | 71 | #include <linux/leds.h> |
71 | #endif | 72 | #endif |
@@ -1126,16 +1127,20 @@ static int __init fujitsu_init(void) | |||
1126 | /* Register backlight stuff */ | 1127 | /* Register backlight stuff */ |
1127 | 1128 | ||
1128 | if (!acpi_video_backlight_support()) { | 1129 | if (!acpi_video_backlight_support()) { |
1129 | fujitsu->bl_device = | 1130 | struct backlight_properties props; |
1130 | backlight_device_register("fujitsu-laptop", NULL, NULL, | 1131 | |
1131 | &fujitsubl_ops); | 1132 | memset(&props, 0, sizeof(struct backlight_properties)); |
1133 | max_brightness = fujitsu->max_brightness; | ||
1134 | props.max_brightness = max_brightness - 1; | ||
1135 | fujitsu->bl_device = backlight_device_register("fujitsu-laptop", | ||
1136 | NULL, NULL, | ||
1137 | &fujitsubl_ops, | ||
1138 | &props); | ||
1132 | if (IS_ERR(fujitsu->bl_device)) { | 1139 | if (IS_ERR(fujitsu->bl_device)) { |
1133 | ret = PTR_ERR(fujitsu->bl_device); | 1140 | ret = PTR_ERR(fujitsu->bl_device); |
1134 | fujitsu->bl_device = NULL; | 1141 | fujitsu->bl_device = NULL; |
1135 | goto fail_sysfs_group; | 1142 | goto fail_sysfs_group; |
1136 | } | 1143 | } |
1137 | max_brightness = fujitsu->max_brightness; | ||
1138 | fujitsu->bl_device->props.max_brightness = max_brightness - 1; | ||
1139 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; | 1144 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; |
1140 | } | 1145 | } |
1141 | 1146 | ||
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 7ccf33c08967..51c07a05a7bc 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/slab.h> | ||
29 | #include <linux/types.h> | 30 | #include <linux/types.h> |
30 | #include <linux/input.h> | 31 | #include <linux/input.h> |
31 | #include <acpi/acpi_drivers.h> | 32 | #include <acpi/acpi_drivers.h> |
@@ -278,7 +279,7 @@ static DEVICE_ATTR(als, S_IRUGO | S_IWUSR, show_als, set_als); | |||
278 | static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); | 279 | static DEVICE_ATTR(dock, S_IRUGO, show_dock, NULL); |
279 | static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); | 280 | static DEVICE_ATTR(tablet, S_IRUGO, show_tablet, NULL); |
280 | 281 | ||
281 | static struct key_entry *hp_wmi_get_entry_by_scancode(int code) | 282 | static struct key_entry *hp_wmi_get_entry_by_scancode(unsigned int code) |
282 | { | 283 | { |
283 | struct key_entry *key; | 284 | struct key_entry *key; |
284 | 285 | ||
@@ -289,7 +290,7 @@ static struct key_entry *hp_wmi_get_entry_by_scancode(int code) | |||
289 | return NULL; | 290 | return NULL; |
290 | } | 291 | } |
291 | 292 | ||
292 | static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) | 293 | static struct key_entry *hp_wmi_get_entry_by_keycode(unsigned int keycode) |
293 | { | 294 | { |
294 | struct key_entry *key; | 295 | struct key_entry *key; |
295 | 296 | ||
@@ -300,7 +301,8 @@ static struct key_entry *hp_wmi_get_entry_by_keycode(int keycode) | |||
300 | return NULL; | 301 | return NULL; |
301 | } | 302 | } |
302 | 303 | ||
303 | static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 304 | static int hp_wmi_getkeycode(struct input_dev *dev, |
305 | unsigned int scancode, unsigned int *keycode) | ||
304 | { | 306 | { |
305 | struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode); | 307 | struct key_entry *key = hp_wmi_get_entry_by_scancode(scancode); |
306 | 308 | ||
@@ -312,13 +314,11 @@ static int hp_wmi_getkeycode(struct input_dev *dev, int scancode, int *keycode) | |||
312 | return -EINVAL; | 314 | return -EINVAL; |
313 | } | 315 | } |
314 | 316 | ||
315 | static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode) | 317 | static int hp_wmi_setkeycode(struct input_dev *dev, |
318 | unsigned int scancode, unsigned int keycode) | ||
316 | { | 319 | { |
317 | struct key_entry *key; | 320 | struct key_entry *key; |
318 | int old_keycode; | 321 | unsigned int old_keycode; |
319 | |||
320 | if (keycode < 0 || keycode > KEY_MAX) | ||
321 | return -EINVAL; | ||
322 | 322 | ||
323 | key = hp_wmi_get_entry_by_scancode(scancode); | 323 | key = hp_wmi_get_entry_by_scancode(scancode); |
324 | if (key && key->type == KE_KEY) { | 324 | if (key && key->type == KE_KEY) { |
diff --git a/drivers/platform/x86/intel_menlow.c b/drivers/platform/x86/intel_menlow.c index f0a90a6bf396..2f795ce2b939 100644 --- a/drivers/platform/x86/intel_menlow.c +++ b/drivers/platform/x86/intel_menlow.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/slab.h> | ||
33 | #include <linux/types.h> | 34 | #include <linux/types.h> |
34 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
35 | #include <linux/pm.h> | 36 | #include <linux/pm.h> |
@@ -396,6 +397,7 @@ static int intel_menlow_add_one_attribute(char *name, int mode, void *show, | |||
396 | if (!attr) | 397 | if (!attr) |
397 | return -ENOMEM; | 398 | return -ENOMEM; |
398 | 399 | ||
400 | sysfs_attr_init(&attr->attr.attr); /* That is consistent naming :D */ | ||
399 | attr->attr.attr.name = name; | 401 | attr->attr.attr.name = name; |
400 | attr->attr.attr.mode = mode; | 402 | attr->attr.attr.mode = mode; |
401 | attr->attr.show = show; | 403 | attr->attr.show = show; |
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index c2b05da4289a..996223a7c009 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
@@ -683,11 +683,14 @@ static int __init msi_init(void) | |||
683 | printk(KERN_INFO "MSI: Brightness ignored, must be controlled " | 683 | printk(KERN_INFO "MSI: Brightness ignored, must be controlled " |
684 | "by ACPI video driver\n"); | 684 | "by ACPI video driver\n"); |
685 | } else { | 685 | } else { |
686 | struct backlight_properties props; | ||
687 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
688 | props.max_brightness = MSI_LCD_LEVEL_MAX - 1; | ||
686 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, | 689 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, |
687 | NULL, &msibl_ops); | 690 | NULL, &msibl_ops, |
691 | &props); | ||
688 | if (IS_ERR(msibl_device)) | 692 | if (IS_ERR(msibl_device)) |
689 | return PTR_ERR(msibl_device); | 693 | return PTR_ERR(msibl_device); |
690 | msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1; | ||
691 | } | 694 | } |
692 | 695 | ||
693 | ret = platform_driver_register(&msipf_driver); | 696 | ret = platform_driver_register(&msipf_driver); |
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index f5f70d4c6913..d1736009636f 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/input/sparse-keymap.h> | 26 | #include <linux/input/sparse-keymap.h> |
27 | #include <linux/acpi.h> | 27 | #include <linux/acpi.h> |
28 | #include <linux/backlight.h> | 28 | #include <linux/backlight.h> |
29 | #include <linux/slab.h> | ||
29 | 30 | ||
30 | MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>"); | 31 | MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>"); |
31 | MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver"); | 32 | MODULE_DESCRIPTION("MSI laptop WMI hotkeys driver"); |
@@ -138,7 +139,7 @@ static int bl_set_status(struct backlight_device *bd) | |||
138 | return msi_wmi_set_block(0, backlight_map[bright]); | 139 | return msi_wmi_set_block(0, backlight_map[bright]); |
139 | } | 140 | } |
140 | 141 | ||
141 | static struct backlight_ops msi_backlight_ops = { | 142 | static const struct backlight_ops msi_backlight_ops = { |
142 | .get_brightness = bl_get, | 143 | .get_brightness = bl_get, |
143 | .update_status = bl_set_status, | 144 | .update_status = bl_set_status, |
144 | }; | 145 | }; |
@@ -249,12 +250,17 @@ static int __init msi_wmi_init(void) | |||
249 | goto err_uninstall_notifier; | 250 | goto err_uninstall_notifier; |
250 | 251 | ||
251 | if (!acpi_video_backlight_support()) { | 252 | if (!acpi_video_backlight_support()) { |
252 | backlight = backlight_device_register(DRV_NAME, | 253 | struct backlight_properties props; |
253 | NULL, NULL, &msi_backlight_ops); | 254 | memset(&props, 0, sizeof(struct backlight_properties)); |
254 | if (IS_ERR(backlight)) | 255 | props.max_brightness = ARRAY_SIZE(backlight_map) - 1; |
256 | backlight = backlight_device_register(DRV_NAME, NULL, NULL, | ||
257 | &msi_backlight_ops, | ||
258 | &props); | ||
259 | if (IS_ERR(backlight)) { | ||
260 | err = PTR_ERR(backlight); | ||
255 | goto err_free_input; | 261 | goto err_free_input; |
262 | } | ||
256 | 263 | ||
257 | backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1; | ||
258 | err = bl_get(NULL); | 264 | err = bl_get(NULL); |
259 | if (err < 0) | 265 | if (err < 0) |
260 | goto err_free_backlight; | 266 | goto err_free_backlight; |
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index fe7cf0188acc..2fb9a32926f8 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -124,6 +124,7 @@ | |||
124 | #include <linux/ctype.h> | 124 | #include <linux/ctype.h> |
125 | #include <linux/seq_file.h> | 125 | #include <linux/seq_file.h> |
126 | #include <linux/uaccess.h> | 126 | #include <linux/uaccess.h> |
127 | #include <linux/slab.h> | ||
127 | #include <acpi/acpi_bus.h> | 128 | #include <acpi/acpi_bus.h> |
128 | #include <acpi/acpi_drivers.h> | 129 | #include <acpi/acpi_drivers.h> |
129 | #include <linux/input.h> | 130 | #include <linux/input.h> |
@@ -200,7 +201,7 @@ static struct acpi_driver acpi_pcc_driver = { | |||
200 | }; | 201 | }; |
201 | 202 | ||
202 | #define KEYMAP_SIZE 11 | 203 | #define KEYMAP_SIZE 11 |
203 | static const int initial_keymap[KEYMAP_SIZE] = { | 204 | static const unsigned int initial_keymap[KEYMAP_SIZE] = { |
204 | /* 0 */ KEY_RESERVED, | 205 | /* 0 */ KEY_RESERVED, |
205 | /* 1 */ KEY_BRIGHTNESSDOWN, | 206 | /* 1 */ KEY_BRIGHTNESSDOWN, |
206 | /* 2 */ KEY_BRIGHTNESSUP, | 207 | /* 2 */ KEY_BRIGHTNESSUP, |
@@ -222,7 +223,7 @@ struct pcc_acpi { | |||
222 | struct acpi_device *device; | 223 | struct acpi_device *device; |
223 | struct input_dev *input_dev; | 224 | struct input_dev *input_dev; |
224 | struct backlight_device *backlight; | 225 | struct backlight_device *backlight; |
225 | int keymap[KEYMAP_SIZE]; | 226 | unsigned int keymap[KEYMAP_SIZE]; |
226 | }; | 227 | }; |
227 | 228 | ||
228 | struct pcc_keyinput { | 229 | struct pcc_keyinput { |
@@ -352,7 +353,7 @@ static int bl_set_status(struct backlight_device *bd) | |||
352 | return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); | 353 | return acpi_pcc_write_sset(pcc, SINF_DC_CUR_BRIGHT, bright); |
353 | } | 354 | } |
354 | 355 | ||
355 | static struct backlight_ops pcc_backlight_ops = { | 356 | static const struct backlight_ops pcc_backlight_ops = { |
356 | .get_brightness = bl_get, | 357 | .get_brightness = bl_get, |
357 | .update_status = bl_set_status, | 358 | .update_status = bl_set_status, |
358 | }; | 359 | }; |
@@ -445,7 +446,8 @@ static struct attribute_group pcc_attr_group = { | |||
445 | 446 | ||
446 | /* hotkey input device driver */ | 447 | /* hotkey input device driver */ |
447 | 448 | ||
448 | static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 449 | static int pcc_getkeycode(struct input_dev *dev, |
450 | unsigned int scancode, unsigned int *keycode) | ||
449 | { | 451 | { |
450 | struct pcc_acpi *pcc = input_get_drvdata(dev); | 452 | struct pcc_acpi *pcc = input_get_drvdata(dev); |
451 | 453 | ||
@@ -457,7 +459,7 @@ static int pcc_getkeycode(struct input_dev *dev, int scancode, int *keycode) | |||
457 | return 0; | 459 | return 0; |
458 | } | 460 | } |
459 | 461 | ||
460 | static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) | 462 | static int keymap_get_by_keycode(struct pcc_acpi *pcc, unsigned int keycode) |
461 | { | 463 | { |
462 | int i; | 464 | int i; |
463 | 465 | ||
@@ -469,7 +471,8 @@ static int keymap_get_by_keycode(struct pcc_acpi *pcc, int keycode) | |||
469 | return 0; | 471 | return 0; |
470 | } | 472 | } |
471 | 473 | ||
472 | static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) | 474 | static int pcc_setkeycode(struct input_dev *dev, |
475 | unsigned int scancode, unsigned int keycode) | ||
473 | { | 476 | { |
474 | struct pcc_acpi *pcc = input_get_drvdata(dev); | 477 | struct pcc_acpi *pcc = input_get_drvdata(dev); |
475 | int oldkeycode; | 478 | int oldkeycode; |
@@ -477,9 +480,6 @@ static int pcc_setkeycode(struct input_dev *dev, int scancode, int keycode) | |||
477 | if (scancode >= ARRAY_SIZE(pcc->keymap)) | 480 | if (scancode >= ARRAY_SIZE(pcc->keymap)) |
478 | return -EINVAL; | 481 | return -EINVAL; |
479 | 482 | ||
480 | if (keycode < 0 || keycode > KEY_MAX) | ||
481 | return -EINVAL; | ||
482 | |||
483 | oldkeycode = pcc->keymap[scancode]; | 483 | oldkeycode = pcc->keymap[scancode]; |
484 | pcc->keymap[scancode] = keycode; | 484 | pcc->keymap[scancode] = keycode; |
485 | 485 | ||
@@ -601,6 +601,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) | |||
601 | 601 | ||
602 | static int acpi_pcc_hotkey_add(struct acpi_device *device) | 602 | static int acpi_pcc_hotkey_add(struct acpi_device *device) |
603 | { | 603 | { |
604 | struct backlight_properties props; | ||
604 | struct pcc_acpi *pcc; | 605 | struct pcc_acpi *pcc; |
605 | int num_sifr, result; | 606 | int num_sifr, result; |
606 | 607 | ||
@@ -638,24 +639,25 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
638 | if (result) { | 639 | if (result) { |
639 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 640 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
640 | "Error installing keyinput handler\n")); | 641 | "Error installing keyinput handler\n")); |
641 | goto out_sinf; | 642 | goto out_hotkey; |
642 | } | 643 | } |
643 | 644 | ||
644 | /* initialize backlight */ | ||
645 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
646 | &pcc_backlight_ops); | ||
647 | if (IS_ERR(pcc->backlight)) | ||
648 | goto out_input; | ||
649 | |||
650 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { | 645 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { |
651 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 646 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
652 | "Couldn't retrieve BIOS data\n")); | 647 | "Couldn't retrieve BIOS data\n")); |
653 | goto out_backlight; | 648 | goto out_input; |
649 | } | ||
650 | /* initialize backlight */ | ||
651 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
652 | props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
653 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
654 | &pcc_backlight_ops, &props); | ||
655 | if (IS_ERR(pcc->backlight)) { | ||
656 | result = PTR_ERR(pcc->backlight); | ||
657 | goto out_sinf; | ||
654 | } | 658 | } |
655 | 659 | ||
656 | /* read the initial brightness setting from the hardware */ | 660 | /* read the initial brightness setting from the hardware */ |
657 | pcc->backlight->props.max_brightness = | ||
658 | pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
659 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; | 661 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; |
660 | 662 | ||
661 | /* read the initial sticky key mode from the hardware */ | 663 | /* read the initial sticky key mode from the hardware */ |
@@ -670,12 +672,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
670 | 672 | ||
671 | out_backlight: | 673 | out_backlight: |
672 | backlight_device_unregister(pcc->backlight); | 674 | backlight_device_unregister(pcc->backlight); |
675 | out_sinf: | ||
676 | kfree(pcc->sinf); | ||
673 | out_input: | 677 | out_input: |
674 | input_unregister_device(pcc->input_dev); | 678 | input_unregister_device(pcc->input_dev); |
675 | /* no need to input_free_device() since core input API refcount and | 679 | /* no need to input_free_device() since core input API refcount and |
676 | * free()s the device */ | 680 | * free()s the device */ |
677 | out_sinf: | ||
678 | kfree(pcc->sinf); | ||
679 | out_hotkey: | 681 | out_hotkey: |
680 | kfree(pcc); | 682 | kfree(pcc); |
681 | 683 | ||
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 3f71a605a492..1387c5f9c24d 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/kfifo.h> | 58 | #include <linux/kfifo.h> |
59 | #include <linux/workqueue.h> | 59 | #include <linux/workqueue.h> |
60 | #include <linux/acpi.h> | 60 | #include <linux/acpi.h> |
61 | #include <linux/slab.h> | ||
61 | #include <acpi/acpi_drivers.h> | 62 | #include <acpi/acpi_drivers.h> |
62 | #include <acpi/acpi_bus.h> | 63 | #include <acpi/acpi_bus.h> |
63 | #include <asm/uaccess.h> | 64 | #include <asm/uaccess.h> |
@@ -145,7 +146,7 @@ struct sony_laptop_input_s { | |||
145 | struct input_dev *key_dev; | 146 | struct input_dev *key_dev; |
146 | struct kfifo fifo; | 147 | struct kfifo fifo; |
147 | spinlock_t fifo_lock; | 148 | spinlock_t fifo_lock; |
148 | struct workqueue_struct *wq; | 149 | struct timer_list release_key_timer; |
149 | }; | 150 | }; |
150 | 151 | ||
151 | static struct sony_laptop_input_s sony_laptop_input = { | 152 | static struct sony_laptop_input_s sony_laptop_input = { |
@@ -299,20 +300,26 @@ static int sony_laptop_input_keycode_map[] = { | |||
299 | }; | 300 | }; |
300 | 301 | ||
301 | /* release buttons after a short delay if pressed */ | 302 | /* release buttons after a short delay if pressed */ |
302 | static void do_sony_laptop_release_key(struct work_struct *work) | 303 | static void do_sony_laptop_release_key(unsigned long unused) |
303 | { | 304 | { |
304 | struct sony_laptop_keypress kp; | 305 | struct sony_laptop_keypress kp; |
306 | unsigned long flags; | ||
307 | |||
308 | spin_lock_irqsave(&sony_laptop_input.fifo_lock, flags); | ||
305 | 309 | ||
306 | while (kfifo_out_locked(&sony_laptop_input.fifo, (unsigned char *)&kp, | 310 | if (kfifo_out(&sony_laptop_input.fifo, |
307 | sizeof(kp), &sony_laptop_input.fifo_lock) | 311 | (unsigned char *)&kp, sizeof(kp)) == sizeof(kp)) { |
308 | == sizeof(kp)) { | ||
309 | msleep(10); | ||
310 | input_report_key(kp.dev, kp.key, 0); | 312 | input_report_key(kp.dev, kp.key, 0); |
311 | input_sync(kp.dev); | 313 | input_sync(kp.dev); |
312 | } | 314 | } |
315 | |||
316 | /* If there is something in the fifo schedule next release. */ | ||
317 | if (kfifo_len(&sony_laptop_input.fifo) != 0) | ||
318 | mod_timer(&sony_laptop_input.release_key_timer, | ||
319 | jiffies + msecs_to_jiffies(10)); | ||
320 | |||
321 | spin_unlock_irqrestore(&sony_laptop_input.fifo_lock, flags); | ||
313 | } | 322 | } |
314 | static DECLARE_WORK(sony_laptop_release_key_work, | ||
315 | do_sony_laptop_release_key); | ||
316 | 323 | ||
317 | /* forward event to the input subsystem */ | 324 | /* forward event to the input subsystem */ |
318 | static void sony_laptop_report_input_event(u8 event) | 325 | static void sony_laptop_report_input_event(u8 event) |
@@ -366,13 +373,13 @@ static void sony_laptop_report_input_event(u8 event) | |||
366 | /* we emit the scancode so we can always remap the key */ | 373 | /* we emit the scancode so we can always remap the key */ |
367 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); | 374 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); |
368 | input_sync(kp.dev); | 375 | input_sync(kp.dev); |
369 | kfifo_in_locked(&sony_laptop_input.fifo, | ||
370 | (unsigned char *)&kp, sizeof(kp), | ||
371 | &sony_laptop_input.fifo_lock); | ||
372 | 376 | ||
373 | if (!work_pending(&sony_laptop_release_key_work)) | 377 | /* schedule key release */ |
374 | queue_work(sony_laptop_input.wq, | 378 | kfifo_in_locked(&sony_laptop_input.fifo, |
375 | &sony_laptop_release_key_work); | 379 | (unsigned char *)&kp, sizeof(kp), |
380 | &sony_laptop_input.fifo_lock); | ||
381 | mod_timer(&sony_laptop_input.release_key_timer, | ||
382 | jiffies + msecs_to_jiffies(10)); | ||
376 | } else | 383 | } else |
377 | dprintk("unknown input event %.2x\n", event); | 384 | dprintk("unknown input event %.2x\n", event); |
378 | } | 385 | } |
@@ -390,27 +397,21 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
390 | 397 | ||
391 | /* kfifo */ | 398 | /* kfifo */ |
392 | spin_lock_init(&sony_laptop_input.fifo_lock); | 399 | spin_lock_init(&sony_laptop_input.fifo_lock); |
393 | error = | 400 | error = kfifo_alloc(&sony_laptop_input.fifo, |
394 | kfifo_alloc(&sony_laptop_input.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); | 401 | SONY_LAPTOP_BUF_SIZE, GFP_KERNEL); |
395 | if (error) { | 402 | if (error) { |
396 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); | 403 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); |
397 | goto err_dec_users; | 404 | goto err_dec_users; |
398 | } | 405 | } |
399 | 406 | ||
400 | /* init workqueue */ | 407 | setup_timer(&sony_laptop_input.release_key_timer, |
401 | sony_laptop_input.wq = create_singlethread_workqueue("sony-laptop"); | 408 | do_sony_laptop_release_key, 0); |
402 | if (!sony_laptop_input.wq) { | ||
403 | printk(KERN_ERR DRV_PFX | ||
404 | "Unable to create workqueue.\n"); | ||
405 | error = -ENXIO; | ||
406 | goto err_free_kfifo; | ||
407 | } | ||
408 | 409 | ||
409 | /* input keys */ | 410 | /* input keys */ |
410 | key_dev = input_allocate_device(); | 411 | key_dev = input_allocate_device(); |
411 | if (!key_dev) { | 412 | if (!key_dev) { |
412 | error = -ENOMEM; | 413 | error = -ENOMEM; |
413 | goto err_destroy_wq; | 414 | goto err_free_kfifo; |
414 | } | 415 | } |
415 | 416 | ||
416 | key_dev->name = "Sony Vaio Keys"; | 417 | key_dev->name = "Sony Vaio Keys"; |
@@ -419,18 +420,15 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
419 | key_dev->dev.parent = &acpi_device->dev; | 420 | key_dev->dev.parent = &acpi_device->dev; |
420 | 421 | ||
421 | /* Initialize the Input Drivers: special keys */ | 422 | /* Initialize the Input Drivers: special keys */ |
422 | set_bit(EV_KEY, key_dev->evbit); | 423 | input_set_capability(key_dev, EV_MSC, MSC_SCAN); |
423 | set_bit(EV_MSC, key_dev->evbit); | 424 | |
424 | set_bit(MSC_SCAN, key_dev->mscbit); | 425 | __set_bit(EV_KEY, key_dev->evbit); |
425 | key_dev->keycodesize = sizeof(sony_laptop_input_keycode_map[0]); | 426 | key_dev->keycodesize = sizeof(sony_laptop_input_keycode_map[0]); |
426 | key_dev->keycodemax = ARRAY_SIZE(sony_laptop_input_keycode_map); | 427 | key_dev->keycodemax = ARRAY_SIZE(sony_laptop_input_keycode_map); |
427 | key_dev->keycode = &sony_laptop_input_keycode_map; | 428 | key_dev->keycode = &sony_laptop_input_keycode_map; |
428 | for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++) { | 429 | for (i = 0; i < ARRAY_SIZE(sony_laptop_input_keycode_map); i++) |
429 | if (sony_laptop_input_keycode_map[i] != KEY_RESERVED) { | 430 | __set_bit(sony_laptop_input_keycode_map[i], key_dev->keybit); |
430 | set_bit(sony_laptop_input_keycode_map[i], | 431 | __clear_bit(KEY_RESERVED, key_dev->keybit); |
431 | key_dev->keybit); | ||
432 | } | ||
433 | } | ||
434 | 432 | ||
435 | error = input_register_device(key_dev); | 433 | error = input_register_device(key_dev); |
436 | if (error) | 434 | if (error) |
@@ -450,9 +448,8 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
450 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; | 448 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; |
451 | key_dev->dev.parent = &acpi_device->dev; | 449 | key_dev->dev.parent = &acpi_device->dev; |
452 | 450 | ||
453 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 451 | input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE); |
454 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); | 452 | input_set_capability(jog_dev, EV_REL, REL_WHEEL); |
455 | jog_dev->relbit[0] = BIT_MASK(REL_WHEEL); | ||
456 | 453 | ||
457 | error = input_register_device(jog_dev); | 454 | error = input_register_device(jog_dev); |
458 | if (error) | 455 | if (error) |
@@ -473,9 +470,6 @@ err_unregister_keydev: | |||
473 | err_free_keydev: | 470 | err_free_keydev: |
474 | input_free_device(key_dev); | 471 | input_free_device(key_dev); |
475 | 472 | ||
476 | err_destroy_wq: | ||
477 | destroy_workqueue(sony_laptop_input.wq); | ||
478 | |||
479 | err_free_kfifo: | 473 | err_free_kfifo: |
480 | kfifo_free(&sony_laptop_input.fifo); | 474 | kfifo_free(&sony_laptop_input.fifo); |
481 | 475 | ||
@@ -486,12 +480,23 @@ err_dec_users: | |||
486 | 480 | ||
487 | static void sony_laptop_remove_input(void) | 481 | static void sony_laptop_remove_input(void) |
488 | { | 482 | { |
489 | /* cleanup only after the last user has gone */ | 483 | struct sony_laptop_keypress kp = { NULL }; |
484 | |||
485 | /* Cleanup only after the last user has gone */ | ||
490 | if (!atomic_dec_and_test(&sony_laptop_input.users)) | 486 | if (!atomic_dec_and_test(&sony_laptop_input.users)) |
491 | return; | 487 | return; |
492 | 488 | ||
493 | /* flush workqueue first */ | 489 | del_timer_sync(&sony_laptop_input.release_key_timer); |
494 | flush_workqueue(sony_laptop_input.wq); | 490 | |
491 | /* | ||
492 | * Generate key-up events for remaining keys. Note that we don't | ||
493 | * need locking since nobody is adding new events to the kfifo. | ||
494 | */ | ||
495 | while (kfifo_out(&sony_laptop_input.fifo, | ||
496 | (unsigned char *)&kp, sizeof(kp)) == sizeof(kp)) { | ||
497 | input_report_key(kp.dev, kp.key, 0); | ||
498 | input_sync(kp.dev); | ||
499 | } | ||
495 | 500 | ||
496 | /* destroy input devs */ | 501 | /* destroy input devs */ |
497 | input_unregister_device(sony_laptop_input.key_dev); | 502 | input_unregister_device(sony_laptop_input.key_dev); |
@@ -502,7 +507,6 @@ static void sony_laptop_remove_input(void) | |||
502 | sony_laptop_input.jog_dev = NULL; | 507 | sony_laptop_input.jog_dev = NULL; |
503 | } | 508 | } |
504 | 509 | ||
505 | destroy_workqueue(sony_laptop_input.wq); | ||
506 | kfifo_free(&sony_laptop_input.fifo); | 510 | kfifo_free(&sony_laptop_input.fifo); |
507 | } | 511 | } |
508 | 512 | ||
@@ -1288,9 +1292,13 @@ static int sony_nc_add(struct acpi_device *device) | |||
1288 | "controlled by ACPI video driver\n"); | 1292 | "controlled by ACPI video driver\n"); |
1289 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | 1293 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
1290 | &handle))) { | 1294 | &handle))) { |
1295 | struct backlight_properties props; | ||
1296 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
1297 | props.max_brightness = SONY_MAX_BRIGHTNESS - 1; | ||
1291 | sony_backlight_device = backlight_device_register("sony", NULL, | 1298 | sony_backlight_device = backlight_device_register("sony", NULL, |
1292 | NULL, | 1299 | NULL, |
1293 | &sony_backlight_ops); | 1300 | &sony_backlight_ops, |
1301 | &props); | ||
1294 | 1302 | ||
1295 | if (IS_ERR(sony_backlight_device)) { | 1303 | if (IS_ERR(sony_backlight_device)) { |
1296 | printk(KERN_WARNING DRV_PFX "unable to register backlight device\n"); | 1304 | printk(KERN_WARNING DRV_PFX "unable to register backlight device\n"); |
@@ -1299,8 +1307,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1299 | sony_backlight_device->props.brightness = | 1307 | sony_backlight_device->props.brightness = |
1300 | sony_backlight_get_brightness | 1308 | sony_backlight_get_brightness |
1301 | (sony_backlight_device); | 1309 | (sony_backlight_device); |
1302 | sony_backlight_device->props.max_brightness = | ||
1303 | SONY_MAX_BRIGHTNESS - 1; | ||
1304 | } | 1310 | } |
1305 | 1311 | ||
1306 | } | 1312 | } |
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c index dd33b51c3486..1fe0f1feff71 100644 --- a/drivers/platform/x86/tc1100-wmi.c +++ b/drivers/platform/x86/tc1100-wmi.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/slab.h> | ||
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
31 | #include <linux/types.h> | 32 | #include <linux/types.h> |
32 | #include <acpi/acpi.h> | 33 | #include <acpi/acpi.h> |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c64e3528889b..63290b33c879 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/kthread.h> | 58 | #include <linux/kthread.h> |
59 | #include <linux/freezer.h> | 59 | #include <linux/freezer.h> |
60 | #include <linux/delay.h> | 60 | #include <linux/delay.h> |
61 | #include <linux/slab.h> | ||
61 | 62 | ||
62 | #include <linux/nvram.h> | 63 | #include <linux/nvram.h> |
63 | #include <linux/proc_fs.h> | 64 | #include <linux/proc_fs.h> |
@@ -6170,6 +6171,7 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = { | |||
6170 | 6171 | ||
6171 | static int __init brightness_init(struct ibm_init_struct *iibm) | 6172 | static int __init brightness_init(struct ibm_init_struct *iibm) |
6172 | { | 6173 | { |
6174 | struct backlight_properties props; | ||
6173 | int b; | 6175 | int b; |
6174 | unsigned long quirks; | 6176 | unsigned long quirks; |
6175 | 6177 | ||
@@ -6259,9 +6261,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6259 | printk(TPACPI_INFO | 6261 | printk(TPACPI_INFO |
6260 | "detected a 16-level brightness capable ThinkPad\n"); | 6262 | "detected a 16-level brightness capable ThinkPad\n"); |
6261 | 6263 | ||
6262 | ibm_backlight_device = backlight_device_register( | 6264 | memset(&props, 0, sizeof(struct backlight_properties)); |
6263 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, | 6265 | props.max_brightness = (tp_features.bright_16levels) ? 15 : 7; |
6264 | &ibm_backlight_data); | 6266 | ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, |
6267 | NULL, NULL, | ||
6268 | &ibm_backlight_data, | ||
6269 | &props); | ||
6265 | if (IS_ERR(ibm_backlight_device)) { | 6270 | if (IS_ERR(ibm_backlight_device)) { |
6266 | int rc = PTR_ERR(ibm_backlight_device); | 6271 | int rc = PTR_ERR(ibm_backlight_device); |
6267 | ibm_backlight_device = NULL; | 6272 | ibm_backlight_device = NULL; |
@@ -6280,8 +6285,6 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6280 | "or not on your ThinkPad\n", TPACPI_MAIL); | 6285 | "or not on your ThinkPad\n", TPACPI_MAIL); |
6281 | } | 6286 | } |
6282 | 6287 | ||
6283 | ibm_backlight_device->props.max_brightness = | ||
6284 | (tp_features.bright_16levels)? 15 : 7; | ||
6285 | ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; | 6288 | ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; |
6286 | backlight_update_status(ibm_backlight_device); | 6289 | backlight_update_status(ibm_backlight_device); |
6287 | 6290 | ||
diff --git a/drivers/platform/x86/topstar-laptop.c b/drivers/platform/x86/topstar-laptop.c index 02f3d4e9e666..ff4b476f1950 100644 --- a/drivers/platform/x86/topstar-laptop.c +++ b/drivers/platform/x86/topstar-laptop.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/slab.h> | ||
19 | #include <linux/acpi.h> | 20 | #include <linux/acpi.h> |
20 | #include <linux/input.h> | 21 | #include <linux/input.h> |
21 | 22 | ||
@@ -46,7 +47,7 @@ static struct tps_key_entry topstar_keymap[] = { | |||
46 | { } | 47 | { } |
47 | }; | 48 | }; |
48 | 49 | ||
49 | static struct tps_key_entry *tps_get_key_by_scancode(int code) | 50 | static struct tps_key_entry *tps_get_key_by_scancode(unsigned int code) |
50 | { | 51 | { |
51 | struct tps_key_entry *key; | 52 | struct tps_key_entry *key; |
52 | 53 | ||
@@ -57,7 +58,7 @@ static struct tps_key_entry *tps_get_key_by_scancode(int code) | |||
57 | return NULL; | 58 | return NULL; |
58 | } | 59 | } |
59 | 60 | ||
60 | static struct tps_key_entry *tps_get_key_by_keycode(int code) | 61 | static struct tps_key_entry *tps_get_key_by_keycode(unsigned int code) |
61 | { | 62 | { |
62 | struct tps_key_entry *key; | 63 | struct tps_key_entry *key; |
63 | 64 | ||
@@ -126,7 +127,8 @@ static int acpi_topstar_fncx_switch(struct acpi_device *device, bool state) | |||
126 | return 0; | 127 | return 0; |
127 | } | 128 | } |
128 | 129 | ||
129 | static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) | 130 | static int topstar_getkeycode(struct input_dev *dev, |
131 | unsigned int scancode, unsigned int *keycode) | ||
130 | { | 132 | { |
131 | struct tps_key_entry *key = tps_get_key_by_scancode(scancode); | 133 | struct tps_key_entry *key = tps_get_key_by_scancode(scancode); |
132 | 134 | ||
@@ -137,14 +139,12 @@ static int topstar_getkeycode(struct input_dev *dev, int scancode, int *keycode) | |||
137 | return 0; | 139 | return 0; |
138 | } | 140 | } |
139 | 141 | ||
140 | static int topstar_setkeycode(struct input_dev *dev, int scancode, int keycode) | 142 | static int topstar_setkeycode(struct input_dev *dev, |
143 | unsigned int scancode, unsigned int keycode) | ||
141 | { | 144 | { |
142 | struct tps_key_entry *key; | 145 | struct tps_key_entry *key; |
143 | int old_keycode; | 146 | int old_keycode; |
144 | 147 | ||
145 | if (keycode < 0 || keycode > KEY_MAX) | ||
146 | return -EINVAL; | ||
147 | |||
148 | key = tps_get_key_by_scancode(scancode); | 148 | key = tps_get_key_by_scancode(scancode); |
149 | 149 | ||
150 | if (!key) | 150 | if (!key) |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 405b969734d6..37aa14798551 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/platform_device.h> | 47 | #include <linux/platform_device.h> |
48 | #include <linux/rfkill.h> | 48 | #include <linux/rfkill.h> |
49 | #include <linux/input.h> | 49 | #include <linux/input.h> |
50 | #include <linux/slab.h> | ||
50 | 51 | ||
51 | #include <asm/uaccess.h> | 52 | #include <asm/uaccess.h> |
52 | 53 | ||
@@ -745,7 +746,7 @@ static struct backlight_ops toshiba_backlight_data = { | |||
745 | .update_status = set_lcd_status, | 746 | .update_status = set_lcd_status, |
746 | }; | 747 | }; |
747 | 748 | ||
748 | static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) | 749 | static struct key_entry *toshiba_acpi_get_entry_by_scancode(unsigned int code) |
749 | { | 750 | { |
750 | struct key_entry *key; | 751 | struct key_entry *key; |
751 | 752 | ||
@@ -756,7 +757,7 @@ static struct key_entry *toshiba_acpi_get_entry_by_scancode(int code) | |||
756 | return NULL; | 757 | return NULL; |
757 | } | 758 | } |
758 | 759 | ||
759 | static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) | 760 | static struct key_entry *toshiba_acpi_get_entry_by_keycode(unsigned int code) |
760 | { | 761 | { |
761 | struct key_entry *key; | 762 | struct key_entry *key; |
762 | 763 | ||
@@ -767,8 +768,8 @@ static struct key_entry *toshiba_acpi_get_entry_by_keycode(int code) | |||
767 | return NULL; | 768 | return NULL; |
768 | } | 769 | } |
769 | 770 | ||
770 | static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, | 771 | static int toshiba_acpi_getkeycode(struct input_dev *dev, |
771 | int *keycode) | 772 | unsigned int scancode, unsigned int *keycode) |
772 | { | 773 | { |
773 | struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode); | 774 | struct key_entry *key = toshiba_acpi_get_entry_by_scancode(scancode); |
774 | 775 | ||
@@ -780,14 +781,11 @@ static int toshiba_acpi_getkeycode(struct input_dev *dev, int scancode, | |||
780 | return -EINVAL; | 781 | return -EINVAL; |
781 | } | 782 | } |
782 | 783 | ||
783 | static int toshiba_acpi_setkeycode(struct input_dev *dev, int scancode, | 784 | static int toshiba_acpi_setkeycode(struct input_dev *dev, |
784 | int keycode) | 785 | unsigned int scancode, unsigned int keycode) |
785 | { | 786 | { |
786 | struct key_entry *key; | 787 | struct key_entry *key; |
787 | int old_keycode; | 788 | unsigned int old_keycode; |
788 | |||
789 | if (keycode < 0 || keycode > KEY_MAX) | ||
790 | return -EINVAL; | ||
791 | 789 | ||
792 | key = toshiba_acpi_get_entry_by_scancode(scancode); | 790 | key = toshiba_acpi_get_entry_by_scancode(scancode); |
793 | if (key && key->type == KE_KEY) { | 791 | if (key && key->type == KE_KEY) { |
@@ -927,6 +925,7 @@ static int __init toshiba_acpi_init(void) | |||
927 | u32 hci_result; | 925 | u32 hci_result; |
928 | bool bt_present; | 926 | bool bt_present; |
929 | int ret = 0; | 927 | int ret = 0; |
928 | struct backlight_properties props; | ||
930 | 929 | ||
931 | if (acpi_disabled) | 930 | if (acpi_disabled) |
932 | return -ENODEV; | 931 | return -ENODEV; |
@@ -977,10 +976,12 @@ static int __init toshiba_acpi_init(void) | |||
977 | } | 976 | } |
978 | } | 977 | } |
979 | 978 | ||
979 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | ||
980 | toshiba_backlight_device = backlight_device_register("toshiba", | 980 | toshiba_backlight_device = backlight_device_register("toshiba", |
981 | &toshiba_acpi.p_dev->dev, | 981 | &toshiba_acpi.p_dev->dev, |
982 | NULL, | 982 | NULL, |
983 | &toshiba_backlight_data); | 983 | &toshiba_backlight_data, |
984 | &props); | ||
984 | if (IS_ERR(toshiba_backlight_device)) { | 985 | if (IS_ERR(toshiba_backlight_device)) { |
985 | ret = PTR_ERR(toshiba_backlight_device); | 986 | ret = PTR_ERR(toshiba_backlight_device); |
986 | 987 | ||
@@ -989,7 +990,6 @@ static int __init toshiba_acpi_init(void) | |||
989 | toshiba_acpi_exit(); | 990 | toshiba_acpi_exit(); |
990 | return ret; | 991 | return ret; |
991 | } | 992 | } |
992 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | ||
993 | 993 | ||
994 | /* Register rfkill switch for Bluetooth */ | 994 | /* Register rfkill switch for Bluetooth */ |
995 | if (hci_get_bt_present(&bt_present) == HCI_SUCCESS && bt_present) { | 995 | if (hci_get_bt_present(&bt_present) == HCI_SUCCESS && bt_present) { |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 09e9918c69c1..39ec5b6c2e3a 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/list.h> | 34 | #include <linux/list.h> |
35 | #include <linux/acpi.h> | 35 | #include <linux/acpi.h> |
36 | #include <linux/slab.h> | ||
36 | #include <acpi/acpi_bus.h> | 37 | #include <acpi/acpi_bus.h> |
37 | #include <acpi/acpi_drivers.h> | 38 | #include <acpi/acpi_drivers.h> |
38 | 39 | ||