diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-12 09:30:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-12 09:30:38 -0400 |
commit | 4ee9f6112923f270e67a9bac9f554494153d5de6 (patch) | |
tree | 47ebacb7da1d3309f4be6f0bcf24398736425cff | |
parent | ce254b34da41b121c6d781fea8940090c0107a20 (diff) | |
parent | eabde0fa967052df12bdd8e8a72f0af799e1e704 (diff) |
Merge tag 'platform-drivers-x86-v3.18-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
Pull x86 platform driver updates from Darren Hart:
"The following have all spent at least a few days in linux-next, most
for more than a week. These are mostly cleanups and error handling
improvements with a few updates to extend existing support to newer
hardware.
Details:
- dell-wmi: fix access out of memory
- eeepc-laptop: cleanups, refactoring, sysfs perms, and improved
error handling
- intel-rst: ACPI and error handling cleanups
- thinkpad-acpi: whitespace cleanup
- toshiba_acpi: HCI/SCI interface update, keyboard backlight type 2
support, new scancodes, cleanups"
* tag 'platform-drivers-x86-v3.18-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (23 commits)
toshiba_acpi: Adapt kbd_bl_timeout_store to the new kbd type
toshiba_acpi: Change HCI/SCI functions return code type
toshiba_acpi: Unify return codes prefix from HCI/SCI to TOS
toshiba_acpi: Rename hci_raw to tci_raw
dell-wmi: Fix access out of memory
eeepc-laptop: clean up control flow in *_rfkill_notifier
eeepc-laptop: store_cpufv: return error if set_acpi fails
eeepc-laptop: check proper return values in get_cpufv
eeepc-laptop: make fan1_input really read-only
eeepc-laptop: pull out SENSOR_STORE_FUNC and SENSOR_SHOW_FUNC macros
eeepc-laptop: tell sysfs that the disp attribute is write-only
eeepc-laptop: pull out ACPI_STORE_FUNC and ACPI_SHOW_FUNC macros
eeepc-laptop: use DEVICE_ATTR* to instantiate device_attributes
eeepc-laptop: change sysfs function names to API expectations
eeepc-laptop: clean up coding style
eeepc-laptop: simplify parse_arg()
intel-rst: Clean up ACPI add function
intel-rst: Use ACPI_FAILURE() macro instead !ACPI_SUCCESS() for error checking
x86: thinkpad_acpi.c: fixed spacing coding style issue
toshiba_acpi: Support new keyboard backlight type
...
-rw-r--r-- | drivers/platform/x86/dell-wmi.c | 12 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 206 | ||||
-rw-r--r-- | drivers/platform/x86/intel-rst.c | 23 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 44 | ||||
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 606 |
5 files changed, 522 insertions, 369 deletions
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c index 390e8e33d5e3..25721bf20092 100644 --- a/drivers/platform/x86/dell-wmi.c +++ b/drivers/platform/x86/dell-wmi.c | |||
@@ -163,18 +163,24 @@ static void dell_wmi_notify(u32 value, void *context) | |||
163 | const struct key_entry *key; | 163 | const struct key_entry *key; |
164 | int reported_key; | 164 | int reported_key; |
165 | u16 *buffer_entry = (u16 *)obj->buffer.pointer; | 165 | u16 *buffer_entry = (u16 *)obj->buffer.pointer; |
166 | int buffer_size = obj->buffer.length/2; | ||
166 | 167 | ||
167 | if (dell_new_hk_type && (buffer_entry[1] != 0x10)) { | 168 | if (buffer_size >= 2 && dell_new_hk_type && buffer_entry[1] != 0x10) { |
168 | pr_info("Received unknown WMI event (0x%x)\n", | 169 | pr_info("Received unknown WMI event (0x%x)\n", |
169 | buffer_entry[1]); | 170 | buffer_entry[1]); |
170 | kfree(obj); | 171 | kfree(obj); |
171 | return; | 172 | return; |
172 | } | 173 | } |
173 | 174 | ||
174 | if (dell_new_hk_type || buffer_entry[1] == 0x0) | 175 | if (buffer_size >= 3 && (dell_new_hk_type || buffer_entry[1] == 0x0)) |
175 | reported_key = (int)buffer_entry[2]; | 176 | reported_key = (int)buffer_entry[2]; |
176 | else | 177 | else if (buffer_size >= 2) |
177 | reported_key = (int)buffer_entry[1] & 0xffff; | 178 | reported_key = (int)buffer_entry[1] & 0xffff; |
179 | else { | ||
180 | pr_info("Received unknown WMI event\n"); | ||
181 | kfree(obj); | ||
182 | return; | ||
183 | } | ||
178 | 184 | ||
179 | key = sparse_keymap_entry_from_scancode(dell_wmi_input_dev, | 185 | key = sparse_keymap_entry_from_scancode(dell_wmi_input_dev, |
180 | reported_key); | 186 | reported_key); |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index bd533c22be57..db79902c4a8e 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -263,13 +263,11 @@ static int acpi_setter_handle(struct eeepc_laptop *eeepc, int cm, | |||
263 | /* | 263 | /* |
264 | * Sys helpers | 264 | * Sys helpers |
265 | */ | 265 | */ |
266 | static int parse_arg(const char *buf, unsigned long count, int *val) | 266 | static int parse_arg(const char *buf, int *val) |
267 | { | 267 | { |
268 | if (!count) | ||
269 | return 0; | ||
270 | if (sscanf(buf, "%i", val) != 1) | 268 | if (sscanf(buf, "%i", val) != 1) |
271 | return -EINVAL; | 269 | return -EINVAL; |
272 | return count; | 270 | return 0; |
273 | } | 271 | } |
274 | 272 | ||
275 | static ssize_t store_sys_acpi(struct device *dev, int cm, | 273 | static ssize_t store_sys_acpi(struct device *dev, int cm, |
@@ -278,12 +276,13 @@ static ssize_t store_sys_acpi(struct device *dev, int cm, | |||
278 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); | 276 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); |
279 | int rv, value; | 277 | int rv, value; |
280 | 278 | ||
281 | rv = parse_arg(buf, count, &value); | 279 | rv = parse_arg(buf, &value); |
282 | if (rv > 0) | 280 | if (rv < 0) |
283 | value = set_acpi(eeepc, cm, value); | 281 | return rv; |
284 | if (value < 0) | 282 | rv = set_acpi(eeepc, cm, value); |
283 | if (rv < 0) | ||
285 | return -EIO; | 284 | return -EIO; |
286 | return rv; | 285 | return count; |
287 | } | 286 | } |
288 | 287 | ||
289 | static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf) | 288 | static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf) |
@@ -296,30 +295,34 @@ static ssize_t show_sys_acpi(struct device *dev, int cm, char *buf) | |||
296 | return sprintf(buf, "%d\n", value); | 295 | return sprintf(buf, "%d\n", value); |
297 | } | 296 | } |
298 | 297 | ||
299 | #define EEEPC_CREATE_DEVICE_ATTR(_name, _mode, _cm) \ | 298 | #define EEEPC_ACPI_SHOW_FUNC(_name, _cm) \ |
300 | static ssize_t show_##_name(struct device *dev, \ | 299 | static ssize_t _name##_show(struct device *dev, \ |
301 | struct device_attribute *attr, \ | 300 | struct device_attribute *attr, \ |
302 | char *buf) \ | 301 | char *buf) \ |
303 | { \ | 302 | { \ |
304 | return show_sys_acpi(dev, _cm, buf); \ | 303 | return show_sys_acpi(dev, _cm, buf); \ |
305 | } \ | 304 | } |
306 | static ssize_t store_##_name(struct device *dev, \ | 305 | |
306 | #define EEEPC_ACPI_STORE_FUNC(_name, _cm) \ | ||
307 | static ssize_t _name##_store(struct device *dev, \ | ||
307 | struct device_attribute *attr, \ | 308 | struct device_attribute *attr, \ |
308 | const char *buf, size_t count) \ | 309 | const char *buf, size_t count) \ |
309 | { \ | 310 | { \ |
310 | return store_sys_acpi(dev, _cm, buf, count); \ | 311 | return store_sys_acpi(dev, _cm, buf, count); \ |
311 | } \ | ||
312 | static struct device_attribute dev_attr_##_name = { \ | ||
313 | .attr = { \ | ||
314 | .name = __stringify(_name), \ | ||
315 | .mode = _mode }, \ | ||
316 | .show = show_##_name, \ | ||
317 | .store = store_##_name, \ | ||
318 | } | 312 | } |
319 | 313 | ||
320 | EEEPC_CREATE_DEVICE_ATTR(camera, 0644, CM_ASL_CAMERA); | 314 | #define EEEPC_CREATE_DEVICE_ATTR_RW(_name, _cm) \ |
321 | EEEPC_CREATE_DEVICE_ATTR(cardr, 0644, CM_ASL_CARDREADER); | 315 | EEEPC_ACPI_SHOW_FUNC(_name, _cm) \ |
322 | EEEPC_CREATE_DEVICE_ATTR(disp, 0200, CM_ASL_DISPLAYSWITCH); | 316 | EEEPC_ACPI_STORE_FUNC(_name, _cm) \ |
317 | static DEVICE_ATTR_RW(_name) | ||
318 | |||
319 | #define EEEPC_CREATE_DEVICE_ATTR_WO(_name, _cm) \ | ||
320 | EEEPC_ACPI_STORE_FUNC(_name, _cm) \ | ||
321 | static DEVICE_ATTR_WO(_name) | ||
322 | |||
323 | EEEPC_CREATE_DEVICE_ATTR_RW(camera, CM_ASL_CAMERA); | ||
324 | EEEPC_CREATE_DEVICE_ATTR_RW(cardr, CM_ASL_CARDREADER); | ||
325 | EEEPC_CREATE_DEVICE_ATTR_WO(disp, CM_ASL_DISPLAYSWITCH); | ||
323 | 326 | ||
324 | struct eeepc_cpufv { | 327 | struct eeepc_cpufv { |
325 | int num; | 328 | int num; |
@@ -329,14 +332,17 @@ struct eeepc_cpufv { | |||
329 | static int get_cpufv(struct eeepc_laptop *eeepc, struct eeepc_cpufv *c) | 332 | static int get_cpufv(struct eeepc_laptop *eeepc, struct eeepc_cpufv *c) |
330 | { | 333 | { |
331 | c->cur = get_acpi(eeepc, CM_ASL_CPUFV); | 334 | c->cur = get_acpi(eeepc, CM_ASL_CPUFV); |
335 | if (c->cur < 0) | ||
336 | return -ENODEV; | ||
337 | |||
332 | c->num = (c->cur >> 8) & 0xff; | 338 | c->num = (c->cur >> 8) & 0xff; |
333 | c->cur &= 0xff; | 339 | c->cur &= 0xff; |
334 | if (c->cur < 0 || c->num <= 0 || c->num > 12) | 340 | if (c->num == 0 || c->num > 12) |
335 | return -ENODEV; | 341 | return -ENODEV; |
336 | return 0; | 342 | return 0; |
337 | } | 343 | } |
338 | 344 | ||
339 | static ssize_t show_available_cpufv(struct device *dev, | 345 | static ssize_t available_cpufv_show(struct device *dev, |
340 | struct device_attribute *attr, | 346 | struct device_attribute *attr, |
341 | char *buf) | 347 | char *buf) |
342 | { | 348 | { |
@@ -353,7 +359,7 @@ static ssize_t show_available_cpufv(struct device *dev, | |||
353 | return len; | 359 | return len; |
354 | } | 360 | } |
355 | 361 | ||
356 | static ssize_t show_cpufv(struct device *dev, | 362 | static ssize_t cpufv_show(struct device *dev, |
357 | struct device_attribute *attr, | 363 | struct device_attribute *attr, |
358 | char *buf) | 364 | char *buf) |
359 | { | 365 | { |
@@ -365,7 +371,7 @@ static ssize_t show_cpufv(struct device *dev, | |||
365 | return sprintf(buf, "%#x\n", (c.num << 8) | c.cur); | 371 | return sprintf(buf, "%#x\n", (c.num << 8) | c.cur); |
366 | } | 372 | } |
367 | 373 | ||
368 | static ssize_t store_cpufv(struct device *dev, | 374 | static ssize_t cpufv_store(struct device *dev, |
369 | struct device_attribute *attr, | 375 | struct device_attribute *attr, |
370 | const char *buf, size_t count) | 376 | const char *buf, size_t count) |
371 | { | 377 | { |
@@ -377,16 +383,18 @@ static ssize_t store_cpufv(struct device *dev, | |||
377 | return -EPERM; | 383 | return -EPERM; |
378 | if (get_cpufv(eeepc, &c)) | 384 | if (get_cpufv(eeepc, &c)) |
379 | return -ENODEV; | 385 | return -ENODEV; |
380 | rv = parse_arg(buf, count, &value); | 386 | rv = parse_arg(buf, &value); |
381 | if (rv < 0) | 387 | if (rv < 0) |
382 | return rv; | 388 | return rv; |
383 | if (!rv || value < 0 || value >= c.num) | 389 | if (value < 0 || value >= c.num) |
384 | return -EINVAL; | 390 | return -EINVAL; |
385 | set_acpi(eeepc, CM_ASL_CPUFV, value); | 391 | rv = set_acpi(eeepc, CM_ASL_CPUFV, value); |
386 | return rv; | 392 | if (rv) |
393 | return rv; | ||
394 | return count; | ||
387 | } | 395 | } |
388 | 396 | ||
389 | static ssize_t show_cpufv_disabled(struct device *dev, | 397 | static ssize_t cpufv_disabled_show(struct device *dev, |
390 | struct device_attribute *attr, | 398 | struct device_attribute *attr, |
391 | char *buf) | 399 | char *buf) |
392 | { | 400 | { |
@@ -395,14 +403,14 @@ static ssize_t show_cpufv_disabled(struct device *dev, | |||
395 | return sprintf(buf, "%d\n", eeepc->cpufv_disabled); | 403 | return sprintf(buf, "%d\n", eeepc->cpufv_disabled); |
396 | } | 404 | } |
397 | 405 | ||
398 | static ssize_t store_cpufv_disabled(struct device *dev, | 406 | static ssize_t cpufv_disabled_store(struct device *dev, |
399 | struct device_attribute *attr, | 407 | struct device_attribute *attr, |
400 | const char *buf, size_t count) | 408 | const char *buf, size_t count) |
401 | { | 409 | { |
402 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); | 410 | struct eeepc_laptop *eeepc = dev_get_drvdata(dev); |
403 | int rv, value; | 411 | int rv, value; |
404 | 412 | ||
405 | rv = parse_arg(buf, count, &value); | 413 | rv = parse_arg(buf, &value); |
406 | if (rv < 0) | 414 | if (rv < 0) |
407 | return rv; | 415 | return rv; |
408 | 416 | ||
@@ -412,7 +420,7 @@ static ssize_t store_cpufv_disabled(struct device *dev, | |||
412 | pr_warn("cpufv enabled (not officially supported " | 420 | pr_warn("cpufv enabled (not officially supported " |
413 | "on this model)\n"); | 421 | "on this model)\n"); |
414 | eeepc->cpufv_disabled = false; | 422 | eeepc->cpufv_disabled = false; |
415 | return rv; | 423 | return count; |
416 | case 1: | 424 | case 1: |
417 | return -EPERM; | 425 | return -EPERM; |
418 | default: | 426 | default: |
@@ -421,29 +429,9 @@ static ssize_t store_cpufv_disabled(struct device *dev, | |||
421 | } | 429 | } |
422 | 430 | ||
423 | 431 | ||
424 | static struct device_attribute dev_attr_cpufv = { | 432 | static DEVICE_ATTR_RW(cpufv); |
425 | .attr = { | 433 | static DEVICE_ATTR_RO(available_cpufv); |
426 | .name = "cpufv", | 434 | static DEVICE_ATTR_RW(cpufv_disabled); |
427 | .mode = 0644 }, | ||
428 | .show = show_cpufv, | ||
429 | .store = store_cpufv | ||
430 | }; | ||
431 | |||
432 | static struct device_attribute dev_attr_available_cpufv = { | ||
433 | .attr = { | ||
434 | .name = "available_cpufv", | ||
435 | .mode = 0444 }, | ||
436 | .show = show_available_cpufv | ||
437 | }; | ||
438 | |||
439 | static struct device_attribute dev_attr_cpufv_disabled = { | ||
440 | .attr = { | ||
441 | .name = "cpufv_disabled", | ||
442 | .mode = 0644 }, | ||
443 | .show = show_cpufv_disabled, | ||
444 | .store = store_cpufv_disabled | ||
445 | }; | ||
446 | |||
447 | 435 | ||
448 | static struct attribute *platform_attributes[] = { | 436 | static struct attribute *platform_attributes[] = { |
449 | &dev_attr_camera.attr, | 437 | &dev_attr_camera.attr, |
@@ -545,7 +533,7 @@ static int eeepc_led_init(struct eeepc_laptop *eeepc) | |||
545 | eeepc->tpd_led.name = "eeepc::touchpad"; | 533 | eeepc->tpd_led.name = "eeepc::touchpad"; |
546 | eeepc->tpd_led.brightness_set = tpd_led_set; | 534 | eeepc->tpd_led.brightness_set = tpd_led_set; |
547 | if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available */ | 535 | if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available */ |
548 | eeepc->tpd_led.brightness_get = tpd_led_get; | 536 | eeepc->tpd_led.brightness_get = tpd_led_get; |
549 | eeepc->tpd_led.max_brightness = 1; | 537 | eeepc->tpd_led.max_brightness = 1; |
550 | 538 | ||
551 | rv = led_classdev_register(&eeepc->platform_device->dev, | 539 | rv = led_classdev_register(&eeepc->platform_device->dev, |
@@ -680,22 +668,21 @@ static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, | |||
680 | 668 | ||
681 | status = acpi_get_handle(NULL, node, &handle); | 669 | status = acpi_get_handle(NULL, node, &handle); |
682 | 670 | ||
683 | if (ACPI_SUCCESS(status)) { | 671 | if (ACPI_FAILURE(status)) |
684 | status = acpi_install_notify_handler(handle, | ||
685 | ACPI_SYSTEM_NOTIFY, | ||
686 | eeepc_rfkill_notify, | ||
687 | eeepc); | ||
688 | if (ACPI_FAILURE(status)) | ||
689 | pr_warn("Failed to register notify on %s\n", node); | ||
690 | |||
691 | /* | ||
692 | * Refresh pci hotplug in case the rfkill state was | ||
693 | * changed during setup. | ||
694 | */ | ||
695 | eeepc_rfkill_hotplug(eeepc, handle); | ||
696 | } else | ||
697 | return -ENODEV; | 672 | return -ENODEV; |
698 | 673 | ||
674 | status = acpi_install_notify_handler(handle, | ||
675 | ACPI_SYSTEM_NOTIFY, | ||
676 | eeepc_rfkill_notify, | ||
677 | eeepc); | ||
678 | if (ACPI_FAILURE(status)) | ||
679 | pr_warn("Failed to register notify on %s\n", node); | ||
680 | |||
681 | /* | ||
682 | * Refresh pci hotplug in case the rfkill state was | ||
683 | * changed during setup. | ||
684 | */ | ||
685 | eeepc_rfkill_hotplug(eeepc, handle); | ||
699 | return 0; | 686 | return 0; |
700 | } | 687 | } |
701 | 688 | ||
@@ -707,20 +694,21 @@ static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, | |||
707 | 694 | ||
708 | status = acpi_get_handle(NULL, node, &handle); | 695 | status = acpi_get_handle(NULL, node, &handle); |
709 | 696 | ||
710 | if (ACPI_SUCCESS(status)) { | 697 | if (ACPI_FAILURE(status)) |
711 | status = acpi_remove_notify_handler(handle, | 698 | return; |
712 | ACPI_SYSTEM_NOTIFY, | 699 | |
713 | eeepc_rfkill_notify); | 700 | status = acpi_remove_notify_handler(handle, |
714 | if (ACPI_FAILURE(status)) | 701 | ACPI_SYSTEM_NOTIFY, |
715 | pr_err("Error removing rfkill notify handler %s\n", | 702 | eeepc_rfkill_notify); |
716 | node); | 703 | if (ACPI_FAILURE(status)) |
717 | /* | 704 | pr_err("Error removing rfkill notify handler %s\n", |
718 | * Refresh pci hotplug in case the rfkill | 705 | node); |
719 | * state was changed after | 706 | /* |
720 | * eeepc_unregister_rfkill_notifier() | 707 | * Refresh pci hotplug in case the rfkill |
721 | */ | 708 | * state was changed after |
722 | eeepc_rfkill_hotplug(eeepc, handle); | 709 | * eeepc_unregister_rfkill_notifier() |
723 | } | 710 | */ |
711 | eeepc_rfkill_hotplug(eeepc, handle); | ||
724 | } | 712 | } |
725 | 713 | ||
726 | static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, | 714 | static int eeepc_get_adapter_status(struct hotplug_slot *hotplug_slot, |
@@ -1042,10 +1030,11 @@ static ssize_t store_sys_hwmon(void (*set)(int), const char *buf, size_t count) | |||
1042 | { | 1030 | { |
1043 | int rv, value; | 1031 | int rv, value; |
1044 | 1032 | ||
1045 | rv = parse_arg(buf, count, &value); | 1033 | rv = parse_arg(buf, &value); |
1046 | if (rv > 0) | 1034 | if (rv < 0) |
1047 | set(value); | 1035 | return rv; |
1048 | return rv; | 1036 | set(value); |
1037 | return count; | ||
1049 | } | 1038 | } |
1050 | 1039 | ||
1051 | static ssize_t show_sys_hwmon(int (*get)(void), char *buf) | 1040 | static ssize_t show_sys_hwmon(int (*get)(void), char *buf) |
@@ -1053,26 +1042,36 @@ static ssize_t show_sys_hwmon(int (*get)(void), char *buf) | |||
1053 | return sprintf(buf, "%d\n", get()); | 1042 | return sprintf(buf, "%d\n", get()); |
1054 | } | 1043 | } |
1055 | 1044 | ||
1056 | #define EEEPC_CREATE_SENSOR_ATTR(_name, _mode, _get, _set) \ | 1045 | #define EEEPC_SENSOR_SHOW_FUNC(_name, _get) \ |
1057 | static ssize_t show_##_name(struct device *dev, \ | 1046 | static ssize_t _name##_show(struct device *dev, \ |
1058 | struct device_attribute *attr, \ | 1047 | struct device_attribute *attr, \ |
1059 | char *buf) \ | 1048 | char *buf) \ |
1060 | { \ | 1049 | { \ |
1061 | return show_sys_hwmon(_get, buf); \ | 1050 | return show_sys_hwmon(_get, buf); \ |
1062 | } \ | 1051 | } |
1063 | static ssize_t store_##_name(struct device *dev, \ | 1052 | |
1053 | #define EEEPC_SENSOR_STORE_FUNC(_name, _set) \ | ||
1054 | static ssize_t _name##_store(struct device *dev, \ | ||
1064 | struct device_attribute *attr, \ | 1055 | struct device_attribute *attr, \ |
1065 | const char *buf, size_t count) \ | 1056 | const char *buf, size_t count) \ |
1066 | { \ | 1057 | { \ |
1067 | return store_sys_hwmon(_set, buf, count); \ | 1058 | return store_sys_hwmon(_set, buf, count); \ |
1068 | } \ | 1059 | } |
1069 | static DEVICE_ATTR(_name, _mode, show_##_name, store_##_name) | 1060 | |
1061 | #define EEEPC_CREATE_SENSOR_ATTR_RW(_name, _get, _set) \ | ||
1062 | EEEPC_SENSOR_SHOW_FUNC(_name, _get) \ | ||
1063 | EEEPC_SENSOR_STORE_FUNC(_name, _set) \ | ||
1064 | static DEVICE_ATTR_RW(_name) | ||
1070 | 1065 | ||
1071 | EEEPC_CREATE_SENSOR_ATTR(fan1_input, S_IRUGO, eeepc_get_fan_rpm, NULL); | 1066 | #define EEEPC_CREATE_SENSOR_ATTR_RO(_name, _get) \ |
1072 | EEEPC_CREATE_SENSOR_ATTR(pwm1, S_IRUGO | S_IWUSR, | 1067 | EEEPC_SENSOR_SHOW_FUNC(_name, _get) \ |
1073 | eeepc_get_fan_pwm, eeepc_set_fan_pwm); | 1068 | static DEVICE_ATTR_RO(_name) |
1074 | EEEPC_CREATE_SENSOR_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, | 1069 | |
1075 | eeepc_get_fan_ctrl, eeepc_set_fan_ctrl); | 1070 | EEEPC_CREATE_SENSOR_ATTR_RO(fan1_input, eeepc_get_fan_rpm); |
1071 | EEEPC_CREATE_SENSOR_ATTR_RW(pwm1, eeepc_get_fan_pwm, | ||
1072 | eeepc_set_fan_pwm); | ||
1073 | EEEPC_CREATE_SENSOR_ATTR_RW(pwm1_enable, eeepc_get_fan_ctrl, | ||
1074 | eeepc_set_fan_ctrl); | ||
1076 | 1075 | ||
1077 | static struct attribute *hwmon_attrs[] = { | 1076 | static struct attribute *hwmon_attrs[] = { |
1078 | &dev_attr_pwm1.attr, | 1077 | &dev_attr_pwm1.attr, |
@@ -1424,8 +1423,9 @@ static int eeepc_acpi_add(struct acpi_device *device) | |||
1424 | result = eeepc_backlight_init(eeepc); | 1423 | result = eeepc_backlight_init(eeepc); |
1425 | if (result) | 1424 | if (result) |
1426 | goto fail_backlight; | 1425 | goto fail_backlight; |
1427 | } else | 1426 | } else { |
1428 | pr_info("Backlight controlled by ACPI video driver\n"); | 1427 | pr_info("Backlight controlled by ACPI video driver\n"); |
1428 | } | ||
1429 | 1429 | ||
1430 | result = eeepc_input_init(eeepc); | 1430 | result = eeepc_input_init(eeepc); |
1431 | if (result) | 1431 | if (result) |
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c index d45bca34bf1b..7344d841f4d9 100644 --- a/drivers/platform/x86/intel-rst.c +++ b/drivers/platform/x86/intel-rst.c | |||
@@ -35,7 +35,7 @@ static ssize_t irst_show_wakeup_events(struct device *dev, | |||
35 | acpi = to_acpi_device(dev); | 35 | acpi = to_acpi_device(dev); |
36 | 36 | ||
37 | status = acpi_evaluate_integer(acpi->handle, "GFFS", NULL, &value); | 37 | status = acpi_evaluate_integer(acpi->handle, "GFFS", NULL, &value); |
38 | if (!ACPI_SUCCESS(status)) | 38 | if (ACPI_FAILURE(status)) |
39 | return -EINVAL; | 39 | return -EINVAL; |
40 | 40 | ||
41 | return sprintf(buf, "%lld\n", value); | 41 | return sprintf(buf, "%lld\n", value); |
@@ -59,7 +59,7 @@ static ssize_t irst_store_wakeup_events(struct device *dev, | |||
59 | 59 | ||
60 | status = acpi_execute_simple_method(acpi->handle, "SFFS", value); | 60 | status = acpi_execute_simple_method(acpi->handle, "SFFS", value); |
61 | 61 | ||
62 | if (!ACPI_SUCCESS(status)) | 62 | if (ACPI_FAILURE(status)) |
63 | return -EINVAL; | 63 | return -EINVAL; |
64 | 64 | ||
65 | return count; | 65 | return count; |
@@ -81,7 +81,7 @@ static ssize_t irst_show_wakeup_time(struct device *dev, | |||
81 | acpi = to_acpi_device(dev); | 81 | acpi = to_acpi_device(dev); |
82 | 82 | ||
83 | status = acpi_evaluate_integer(acpi->handle, "GFTV", NULL, &value); | 83 | status = acpi_evaluate_integer(acpi->handle, "GFTV", NULL, &value); |
84 | if (!ACPI_SUCCESS(status)) | 84 | if (ACPI_FAILURE(status)) |
85 | return -EINVAL; | 85 | return -EINVAL; |
86 | 86 | ||
87 | return sprintf(buf, "%lld\n", value); | 87 | return sprintf(buf, "%lld\n", value); |
@@ -105,7 +105,7 @@ static ssize_t irst_store_wakeup_time(struct device *dev, | |||
105 | 105 | ||
106 | status = acpi_execute_simple_method(acpi->handle, "SFTV", value); | 106 | status = acpi_execute_simple_method(acpi->handle, "SFTV", value); |
107 | 107 | ||
108 | if (!ACPI_SUCCESS(status)) | 108 | if (ACPI_FAILURE(status)) |
109 | return -EINVAL; | 109 | return -EINVAL; |
110 | 110 | ||
111 | return count; | 111 | return count; |
@@ -119,21 +119,16 @@ static struct device_attribute irst_timeout_attr = { | |||
119 | 119 | ||
120 | static int irst_add(struct acpi_device *acpi) | 120 | static int irst_add(struct acpi_device *acpi) |
121 | { | 121 | { |
122 | int error = 0; | 122 | int error; |
123 | 123 | ||
124 | error = device_create_file(&acpi->dev, &irst_timeout_attr); | 124 | error = device_create_file(&acpi->dev, &irst_timeout_attr); |
125 | if (error) | 125 | if (unlikely(error)) |
126 | goto out; | 126 | return error; |
127 | 127 | ||
128 | error = device_create_file(&acpi->dev, &irst_wakeup_attr); | 128 | error = device_create_file(&acpi->dev, &irst_wakeup_attr); |
129 | if (error) | 129 | if (unlikely(error)) |
130 | goto out_timeout; | 130 | device_remove_file(&acpi->dev, &irst_timeout_attr); |
131 | 131 | ||
132 | return 0; | ||
133 | |||
134 | out_timeout: | ||
135 | device_remove_file(&acpi->dev, &irst_timeout_attr); | ||
136 | out: | ||
137 | return error; | 132 | return error; |
138 | } | 133 | } |
139 | 134 | ||
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 3bbc6eb60de5..f959978c7aac 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -3440,7 +3440,7 @@ err_exit: | |||
3440 | delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj); | 3440 | delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj); |
3441 | hotkey_dev_attributes = NULL; | 3441 | hotkey_dev_attributes = NULL; |
3442 | 3442 | ||
3443 | return (res < 0)? res : 1; | 3443 | return (res < 0) ? res : 1; |
3444 | } | 3444 | } |
3445 | 3445 | ||
3446 | /* Thinkpad X1 Carbon support 5 modes including Home mode, Web browser | 3446 | /* Thinkpad X1 Carbon support 5 modes including Home mode, Web browser |
@@ -4576,7 +4576,7 @@ static int __init video_init(struct ibm_init_struct *iibm) | |||
4576 | str_supported(video_supported != TPACPI_VIDEO_NONE), | 4576 | str_supported(video_supported != TPACPI_VIDEO_NONE), |
4577 | video_supported); | 4577 | video_supported); |
4578 | 4578 | ||
4579 | return (video_supported != TPACPI_VIDEO_NONE)? 0 : 1; | 4579 | return (video_supported != TPACPI_VIDEO_NONE) ? 0 : 1; |
4580 | } | 4580 | } |
4581 | 4581 | ||
4582 | static void video_exit(void) | 4582 | static void video_exit(void) |
@@ -4669,7 +4669,7 @@ static int video_outputsw_set(int status) | |||
4669 | return -ENOSYS; | 4669 | return -ENOSYS; |
4670 | } | 4670 | } |
4671 | 4671 | ||
4672 | return (res)? 0 : -EIO; | 4672 | return (res) ? 0 : -EIO; |
4673 | } | 4673 | } |
4674 | 4674 | ||
4675 | static int video_autosw_get(void) | 4675 | static int video_autosw_get(void) |
@@ -4695,7 +4695,7 @@ static int video_autosw_get(void) | |||
4695 | 4695 | ||
4696 | static int video_autosw_set(int enable) | 4696 | static int video_autosw_set(int enable) |
4697 | { | 4697 | { |
4698 | if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", (enable)? 1 : 0)) | 4698 | if (!acpi_evalf(vid_handle, NULL, "_DOS", "vd", (enable) ? 1 : 0)) |
4699 | return -EIO; | 4699 | return -EIO; |
4700 | return 0; | 4700 | return 0; |
4701 | } | 4701 | } |
@@ -4730,20 +4730,20 @@ static int video_outputsw_cycle(void) | |||
4730 | return -EIO; | 4730 | return -EIO; |
4731 | } | 4731 | } |
4732 | 4732 | ||
4733 | return (res)? 0 : -EIO; | 4733 | return (res) ? 0 : -EIO; |
4734 | } | 4734 | } |
4735 | 4735 | ||
4736 | static int video_expand_toggle(void) | 4736 | static int video_expand_toggle(void) |
4737 | { | 4737 | { |
4738 | switch (video_supported) { | 4738 | switch (video_supported) { |
4739 | case TPACPI_VIDEO_570: | 4739 | case TPACPI_VIDEO_570: |
4740 | return acpi_evalf(ec_handle, NULL, "_Q17", "v")? | 4740 | return acpi_evalf(ec_handle, NULL, "_Q17", "v") ? |
4741 | 0 : -EIO; | 4741 | 0 : -EIO; |
4742 | case TPACPI_VIDEO_770: | 4742 | case TPACPI_VIDEO_770: |
4743 | return acpi_evalf(vid_handle, NULL, "VEXP", "v")? | 4743 | return acpi_evalf(vid_handle, NULL, "VEXP", "v") ? |
4744 | 0 : -EIO; | 4744 | 0 : -EIO; |
4745 | case TPACPI_VIDEO_NEW: | 4745 | case TPACPI_VIDEO_NEW: |
4746 | return acpi_evalf(NULL, NULL, "\\VEXP", "v")? | 4746 | return acpi_evalf(NULL, NULL, "\\VEXP", "v") ? |
4747 | 0 : -EIO; | 4747 | 0 : -EIO; |
4748 | default: | 4748 | default: |
4749 | return -ENOSYS; | 4749 | return -ENOSYS; |
@@ -4887,14 +4887,14 @@ static int light_set_status(int status) | |||
4887 | if (tp_features.light) { | 4887 | if (tp_features.light) { |
4888 | if (cmos_handle) { | 4888 | if (cmos_handle) { |
4889 | rc = acpi_evalf(cmos_handle, NULL, NULL, "vd", | 4889 | rc = acpi_evalf(cmos_handle, NULL, NULL, "vd", |
4890 | (status)? | 4890 | (status) ? |
4891 | TP_CMOS_THINKLIGHT_ON : | 4891 | TP_CMOS_THINKLIGHT_ON : |
4892 | TP_CMOS_THINKLIGHT_OFF); | 4892 | TP_CMOS_THINKLIGHT_OFF); |
4893 | } else { | 4893 | } else { |
4894 | rc = acpi_evalf(lght_handle, NULL, NULL, "vd", | 4894 | rc = acpi_evalf(lght_handle, NULL, NULL, "vd", |
4895 | (status)? 1 : 0); | 4895 | (status) ? 1 : 0); |
4896 | } | 4896 | } |
4897 | return (rc)? 0 : -EIO; | 4897 | return (rc) ? 0 : -EIO; |
4898 | } | 4898 | } |
4899 | 4899 | ||
4900 | return -ENXIO; | 4900 | return -ENXIO; |
@@ -4923,7 +4923,7 @@ static void light_sysfs_set(struct led_classdev *led_cdev, | |||
4923 | 4923 | ||
4924 | static enum led_brightness light_sysfs_get(struct led_classdev *led_cdev) | 4924 | static enum led_brightness light_sysfs_get(struct led_classdev *led_cdev) |
4925 | { | 4925 | { |
4926 | return (light_get_status() == 1)? LED_FULL : LED_OFF; | 4926 | return (light_get_status() == 1) ? LED_FULL : LED_OFF; |
4927 | } | 4927 | } |
4928 | 4928 | ||
4929 | static struct tpacpi_led_classdev tpacpi_led_thinklight = { | 4929 | static struct tpacpi_led_classdev tpacpi_led_thinklight = { |
@@ -5045,7 +5045,7 @@ static ssize_t cmos_command_store(struct device *dev, | |||
5045 | return -EINVAL; | 5045 | return -EINVAL; |
5046 | 5046 | ||
5047 | res = issue_thinkpad_cmos_command(cmos_cmd); | 5047 | res = issue_thinkpad_cmos_command(cmos_cmd); |
5048 | return (res)? res : count; | 5048 | return (res) ? res : count; |
5049 | } | 5049 | } |
5050 | 5050 | ||
5051 | static struct device_attribute dev_attr_cmos_command = | 5051 | static struct device_attribute dev_attr_cmos_command = |
@@ -5069,7 +5069,7 @@ static int __init cmos_init(struct ibm_init_struct *iibm) | |||
5069 | if (res) | 5069 | if (res) |
5070 | return res; | 5070 | return res; |
5071 | 5071 | ||
5072 | return (cmos_handle)? 0 : 1; | 5072 | return (cmos_handle) ? 0 : 1; |
5073 | } | 5073 | } |
5074 | 5074 | ||
5075 | static void cmos_exit(void) | 5075 | static void cmos_exit(void) |
@@ -5179,9 +5179,9 @@ static int led_get_status(const unsigned int led) | |||
5179 | if (!acpi_evalf(ec_handle, | 5179 | if (!acpi_evalf(ec_handle, |
5180 | &status, "GLED", "dd", 1 << led)) | 5180 | &status, "GLED", "dd", 1 << led)) |
5181 | return -EIO; | 5181 | return -EIO; |
5182 | led_s = (status == 0)? | 5182 | led_s = (status == 0) ? |
5183 | TPACPI_LED_OFF : | 5183 | TPACPI_LED_OFF : |
5184 | ((status == 1)? | 5184 | ((status == 1) ? |
5185 | TPACPI_LED_ON : | 5185 | TPACPI_LED_ON : |
5186 | TPACPI_LED_BLINK); | 5186 | TPACPI_LED_BLINK); |
5187 | tpacpi_led_state_cache[led] = led_s; | 5187 | tpacpi_led_state_cache[led] = led_s; |
@@ -5578,7 +5578,7 @@ static int __init beep_init(struct ibm_init_struct *iibm) | |||
5578 | 5578 | ||
5579 | tp_features.beep_needs_two_args = !!(quirks & TPACPI_BEEP_Q1); | 5579 | tp_features.beep_needs_two_args = !!(quirks & TPACPI_BEEP_Q1); |
5580 | 5580 | ||
5581 | return (beep_handle)? 0 : 1; | 5581 | return (beep_handle) ? 0 : 1; |
5582 | } | 5582 | } |
5583 | 5583 | ||
5584 | static int beep_read(struct seq_file *m) | 5584 | static int beep_read(struct seq_file *m) |
@@ -6527,7 +6527,7 @@ static int brightness_write(char *buf) | |||
6527 | if (!rc && ibm_backlight_device) | 6527 | if (!rc && ibm_backlight_device) |
6528 | backlight_force_update(ibm_backlight_device, | 6528 | backlight_force_update(ibm_backlight_device, |
6529 | BACKLIGHT_UPDATE_SYSFS); | 6529 | BACKLIGHT_UPDATE_SYSFS); |
6530 | return (rc == -EINTR)? -ERESTARTSYS : rc; | 6530 | return (rc == -EINTR) ? -ERESTARTSYS : rc; |
6531 | } | 6531 | } |
6532 | 6532 | ||
6533 | static struct ibm_struct brightness_driver_data = { | 6533 | static struct ibm_struct brightness_driver_data = { |
@@ -7984,7 +7984,7 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
7984 | } | 7984 | } |
7985 | 7985 | ||
7986 | mutex_unlock(&fan_mutex); | 7986 | mutex_unlock(&fan_mutex); |
7987 | return (rc)? rc : count; | 7987 | return (rc) ? rc : count; |
7988 | } | 7988 | } |
7989 | 7989 | ||
7990 | static struct device_attribute dev_attr_fan_pwm1 = | 7990 | static struct device_attribute dev_attr_fan_pwm1 = |
@@ -8662,7 +8662,7 @@ static const char * __init str_supported(int is_supported) | |||
8662 | { | 8662 | { |
8663 | static char text_unsupported[] __initdata = "not supported"; | 8663 | static char text_unsupported[] __initdata = "not supported"; |
8664 | 8664 | ||
8665 | return (is_supported)? &text_unsupported[4] : &text_unsupported[0]; | 8665 | return (is_supported) ? &text_unsupported[4] : &text_unsupported[0]; |
8666 | } | 8666 | } |
8667 | #endif /* CONFIG_THINKPAD_ACPI_DEBUG */ | 8667 | #endif /* CONFIG_THINKPAD_ACPI_DEBUG */ |
8668 | 8668 | ||
@@ -8783,7 +8783,7 @@ err_out: | |||
8783 | ibm->name, ret); | 8783 | ibm->name, ret); |
8784 | 8784 | ||
8785 | ibm_exit(ibm); | 8785 | ibm_exit(ibm); |
8786 | return (ret < 0)? ret : 0; | 8786 | return (ret < 0) ? ret : 0; |
8787 | } | 8787 | } |
8788 | 8788 | ||
8789 | /* Probing */ | 8789 | /* Probing */ |
@@ -8794,7 +8794,7 @@ static bool __pure __init tpacpi_is_fw_digit(const char c) | |||
8794 | } | 8794 | } |
8795 | 8795 | ||
8796 | /* Most models: xxyTkkWW (#.##c); Ancient 570/600 and -SL lacks (#.##c) */ | 8796 | /* Most models: xxyTkkWW (#.##c); Ancient 570/600 and -SL lacks (#.##c) */ |
8797 | static bool __pure __init tpacpi_is_valid_fw_id(const char* const s, | 8797 | static bool __pure __init tpacpi_is_valid_fw_id(const char * const s, |
8798 | const char t) | 8798 | const char t) |
8799 | { | 8799 | { |
8800 | return s && strlen(s) >= 8 && | 8800 | return s && strlen(s) >= 8 && |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index d0dce734b2ed..ef3a1904e92f 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -71,7 +71,8 @@ MODULE_LICENSE("GPL"); | |||
71 | /* Toshiba ACPI method paths */ | 71 | /* Toshiba ACPI method paths */ |
72 | #define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" | 72 | #define METHOD_VIDEO_OUT "\\_SB_.VALX.DSSX" |
73 | 73 | ||
74 | /* Toshiba HCI interface definitions | 74 | /* The Toshiba configuration interface is composed of the HCI and the SCI, |
75 | * which are defined as follows: | ||
75 | * | 76 | * |
76 | * HCI is Toshiba's "Hardware Control Interface" which is supposed to | 77 | * HCI is Toshiba's "Hardware Control Interface" which is supposed to |
77 | * be uniform across all their models. Ideally we would just call | 78 | * be uniform across all their models. Ideally we would just call |
@@ -84,7 +85,7 @@ MODULE_LICENSE("GPL"); | |||
84 | * conceal differences in hardware between different models. | 85 | * conceal differences in hardware between different models. |
85 | */ | 86 | */ |
86 | 87 | ||
87 | #define HCI_WORDS 6 | 88 | #define TCI_WORDS 6 |
88 | 89 | ||
89 | /* operations */ | 90 | /* operations */ |
90 | #define HCI_SET 0xff00 | 91 | #define HCI_SET 0xff00 |
@@ -95,17 +96,18 @@ MODULE_LICENSE("GPL"); | |||
95 | #define SCI_SET 0xf400 | 96 | #define SCI_SET 0xf400 |
96 | 97 | ||
97 | /* return codes */ | 98 | /* return codes */ |
98 | #define HCI_SUCCESS 0x0000 | 99 | #define TOS_SUCCESS 0x0000 |
99 | #define HCI_FAILURE 0x1000 | 100 | #define TOS_OPEN_CLOSE_OK 0x0044 |
100 | #define HCI_NOT_SUPPORTED 0x8000 | 101 | #define TOS_FAILURE 0x1000 |
101 | #define HCI_EMPTY 0x8c00 | 102 | #define TOS_NOT_SUPPORTED 0x8000 |
102 | #define HCI_DATA_NOT_AVAILABLE 0x8d20 | 103 | #define TOS_ALREADY_OPEN 0x8100 |
103 | #define HCI_NOT_INITIALIZED 0x8d50 | 104 | #define TOS_NOT_OPENED 0x8200 |
104 | #define SCI_OPEN_CLOSE_OK 0x0044 | 105 | #define TOS_INPUT_DATA_ERROR 0x8300 |
105 | #define SCI_ALREADY_OPEN 0x8100 | 106 | #define TOS_WRITE_PROTECTED 0x8400 |
106 | #define SCI_NOT_OPENED 0x8200 | 107 | #define TOS_NOT_PRESENT 0x8600 |
107 | #define SCI_INPUT_DATA_ERROR 0x8300 | 108 | #define TOS_FIFO_EMPTY 0x8c00 |
108 | #define SCI_NOT_PRESENT 0x8600 | 109 | #define TOS_DATA_NOT_AVAILABLE 0x8d20 |
110 | #define TOS_NOT_INITIALIZED 0x8d50 | ||
109 | 111 | ||
110 | /* registers */ | 112 | /* registers */ |
111 | #define HCI_FAN 0x0004 | 113 | #define HCI_FAN 0x0004 |
@@ -138,8 +140,12 @@ MODULE_LICENSE("GPL"); | |||
138 | #define HCI_WIRELESS_BT_PRESENT 0x0f | 140 | #define HCI_WIRELESS_BT_PRESENT 0x0f |
139 | #define HCI_WIRELESS_BT_ATTACH 0x40 | 141 | #define HCI_WIRELESS_BT_ATTACH 0x40 |
140 | #define HCI_WIRELESS_BT_POWER 0x80 | 142 | #define HCI_WIRELESS_BT_POWER 0x80 |
143 | #define SCI_KBD_MODE_MASK 0x1f | ||
141 | #define SCI_KBD_MODE_FNZ 0x1 | 144 | #define SCI_KBD_MODE_FNZ 0x1 |
142 | #define SCI_KBD_MODE_AUTO 0x2 | 145 | #define SCI_KBD_MODE_AUTO 0x2 |
146 | #define SCI_KBD_MODE_ON 0x8 | ||
147 | #define SCI_KBD_MODE_OFF 0x10 | ||
148 | #define SCI_KBD_TIME_MAX 0x3c001a | ||
143 | 149 | ||
144 | struct toshiba_acpi_dev { | 150 | struct toshiba_acpi_dev { |
145 | struct acpi_device *acpi_dev; | 151 | struct acpi_device *acpi_dev; |
@@ -155,6 +161,7 @@ struct toshiba_acpi_dev { | |||
155 | int force_fan; | 161 | int force_fan; |
156 | int last_key_event; | 162 | int last_key_event; |
157 | int key_event_valid; | 163 | int key_event_valid; |
164 | int kbd_type; | ||
158 | int kbd_mode; | 165 | int kbd_mode; |
159 | int kbd_time; | 166 | int kbd_time; |
160 | 167 | ||
@@ -190,6 +197,7 @@ static const struct key_entry toshiba_acpi_keymap[] = { | |||
190 | { KE_KEY, 0x101, { KEY_MUTE } }, | 197 | { KE_KEY, 0x101, { KEY_MUTE } }, |
191 | { KE_KEY, 0x102, { KEY_ZOOMOUT } }, | 198 | { KE_KEY, 0x102, { KEY_ZOOMOUT } }, |
192 | { KE_KEY, 0x103, { KEY_ZOOMIN } }, | 199 | { KE_KEY, 0x103, { KEY_ZOOMIN } }, |
200 | { KE_KEY, 0x10f, { KEY_TAB } }, | ||
193 | { KE_KEY, 0x12c, { KEY_KBDILLUMTOGGLE } }, | 201 | { KE_KEY, 0x12c, { KEY_KBDILLUMTOGGLE } }, |
194 | { KE_KEY, 0x139, { KEY_ZOOMRESET } }, | 202 | { KE_KEY, 0x139, { KEY_ZOOMRESET } }, |
195 | { KE_KEY, 0x13b, { KEY_COFFEE } }, | 203 | { KE_KEY, 0x13b, { KEY_COFFEE } }, |
@@ -210,7 +218,11 @@ static const struct key_entry toshiba_acpi_keymap[] = { | |||
210 | { KE_KEY, 0xb32, { KEY_NEXTSONG } }, | 218 | { KE_KEY, 0xb32, { KEY_NEXTSONG } }, |
211 | { KE_KEY, 0xb33, { KEY_PLAYPAUSE } }, | 219 | { KE_KEY, 0xb33, { KEY_PLAYPAUSE } }, |
212 | { KE_KEY, 0xb5a, { KEY_MEDIA } }, | 220 | { KE_KEY, 0xb5a, { KEY_MEDIA } }, |
213 | { KE_IGNORE, 0x1430, { KEY_RESERVED } }, | 221 | { KE_IGNORE, 0x1430, { KEY_RESERVED } }, /* Wake from sleep */ |
222 | { KE_IGNORE, 0x1501, { KEY_RESERVED } }, /* Output changed */ | ||
223 | { KE_IGNORE, 0x1502, { KEY_RESERVED } }, /* HDMI plugged/unplugged */ | ||
224 | { KE_IGNORE, 0x1ABE, { KEY_RESERVED } }, /* Protection level set */ | ||
225 | { KE_IGNORE, 0x1ABF, { KEY_RESERVED } }, /* Protection level off */ | ||
214 | { KE_END, 0 }, | 226 | { KE_END, 0 }, |
215 | }; | 227 | }; |
216 | 228 | ||
@@ -264,22 +276,22 @@ static int write_acpi_int(const char *methodName, int val) | |||
264 | return (status == AE_OK) ? 0 : -EIO; | 276 | return (status == AE_OK) ? 0 : -EIO; |
265 | } | 277 | } |
266 | 278 | ||
267 | /* Perform a raw HCI call. Here we don't care about input or output buffer | 279 | /* Perform a raw configuration call. Here we don't care about input or output |
268 | * format. | 280 | * buffer format. |
269 | */ | 281 | */ |
270 | static acpi_status hci_raw(struct toshiba_acpi_dev *dev, | 282 | static acpi_status tci_raw(struct toshiba_acpi_dev *dev, |
271 | const u32 in[HCI_WORDS], u32 out[HCI_WORDS]) | 283 | const u32 in[TCI_WORDS], u32 out[TCI_WORDS]) |
272 | { | 284 | { |
273 | struct acpi_object_list params; | 285 | struct acpi_object_list params; |
274 | union acpi_object in_objs[HCI_WORDS]; | 286 | union acpi_object in_objs[TCI_WORDS]; |
275 | struct acpi_buffer results; | 287 | struct acpi_buffer results; |
276 | union acpi_object out_objs[HCI_WORDS + 1]; | 288 | union acpi_object out_objs[TCI_WORDS + 1]; |
277 | acpi_status status; | 289 | acpi_status status; |
278 | int i; | 290 | int i; |
279 | 291 | ||
280 | params.count = HCI_WORDS; | 292 | params.count = TCI_WORDS; |
281 | params.pointer = in_objs; | 293 | params.pointer = in_objs; |
282 | for (i = 0; i < HCI_WORDS; ++i) { | 294 | for (i = 0; i < TCI_WORDS; ++i) { |
283 | in_objs[i].type = ACPI_TYPE_INTEGER; | 295 | in_objs[i].type = ACPI_TYPE_INTEGER; |
284 | in_objs[i].integer.value = in[i]; | 296 | in_objs[i].integer.value = in[i]; |
285 | } | 297 | } |
@@ -290,7 +302,7 @@ static acpi_status hci_raw(struct toshiba_acpi_dev *dev, | |||
290 | status = acpi_evaluate_object(dev->acpi_dev->handle, | 302 | status = acpi_evaluate_object(dev->acpi_dev->handle, |
291 | (char *)dev->method_hci, ¶ms, | 303 | (char *)dev->method_hci, ¶ms, |
292 | &results); | 304 | &results); |
293 | if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) { | 305 | if ((status == AE_OK) && (out_objs->package.count <= TCI_WORDS)) { |
294 | for (i = 0; i < out_objs->package.count; ++i) { | 306 | for (i = 0; i < out_objs->package.count; ++i) { |
295 | out[i] = out_objs->package.elements[i].integer.value; | 307 | out[i] = out_objs->package.elements[i].integer.value; |
296 | } | 308 | } |
@@ -305,47 +317,49 @@ static acpi_status hci_raw(struct toshiba_acpi_dev *dev, | |||
305 | * may be useful (such as "not supported"). | 317 | * may be useful (such as "not supported"). |
306 | */ | 318 | */ |
307 | 319 | ||
308 | static acpi_status hci_write1(struct toshiba_acpi_dev *dev, u32 reg, | 320 | static u32 hci_write1(struct toshiba_acpi_dev *dev, u32 reg, u32 in1) |
309 | u32 in1, u32 *result) | ||
310 | { | 321 | { |
311 | u32 in[HCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 }; | 322 | u32 in[TCI_WORDS] = { HCI_SET, reg, in1, 0, 0, 0 }; |
312 | u32 out[HCI_WORDS]; | 323 | u32 out[TCI_WORDS]; |
313 | acpi_status status = hci_raw(dev, in, out); | 324 | acpi_status status = tci_raw(dev, in, out); |
314 | *result = (status == AE_OK) ? out[0] : HCI_FAILURE; | 325 | |
315 | return status; | 326 | return ACPI_SUCCESS(status) ? out[0] : TOS_FAILURE; |
316 | } | 327 | } |
317 | 328 | ||
318 | static acpi_status hci_read1(struct toshiba_acpi_dev *dev, u32 reg, | 329 | static u32 hci_read1(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1) |
319 | u32 *out1, u32 *result) | ||
320 | { | 330 | { |
321 | u32 in[HCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; | 331 | u32 in[TCI_WORDS] = { HCI_GET, reg, 0, 0, 0, 0 }; |
322 | u32 out[HCI_WORDS]; | 332 | u32 out[TCI_WORDS]; |
323 | acpi_status status = hci_raw(dev, in, out); | 333 | acpi_status status = tci_raw(dev, in, out); |
334 | if (ACPI_FAILURE(status)) | ||
335 | return TOS_FAILURE; | ||
336 | |||
324 | *out1 = out[2]; | 337 | *out1 = out[2]; |
325 | *result = (status == AE_OK) ? out[0] : HCI_FAILURE; | 338 | |
326 | return status; | 339 | return out[0]; |
327 | } | 340 | } |
328 | 341 | ||
329 | static acpi_status hci_write2(struct toshiba_acpi_dev *dev, u32 reg, | 342 | static u32 hci_write2(struct toshiba_acpi_dev *dev, u32 reg, u32 in1, u32 in2) |
330 | u32 in1, u32 in2, u32 *result) | ||
331 | { | 343 | { |
332 | u32 in[HCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 }; | 344 | u32 in[TCI_WORDS] = { HCI_SET, reg, in1, in2, 0, 0 }; |
333 | u32 out[HCI_WORDS]; | 345 | u32 out[TCI_WORDS]; |
334 | acpi_status status = hci_raw(dev, in, out); | 346 | acpi_status status = tci_raw(dev, in, out); |
335 | *result = (status == AE_OK) ? out[0] : HCI_FAILURE; | 347 | |
336 | return status; | 348 | return ACPI_SUCCESS(status) ? out[0] : TOS_FAILURE; |
337 | } | 349 | } |
338 | 350 | ||
339 | static acpi_status hci_read2(struct toshiba_acpi_dev *dev, u32 reg, | 351 | static u32 hci_read2(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1, u32 *out2) |
340 | u32 *out1, u32 *out2, u32 *result) | ||
341 | { | 352 | { |
342 | u32 in[HCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 }; | 353 | u32 in[TCI_WORDS] = { HCI_GET, reg, *out1, *out2, 0, 0 }; |
343 | u32 out[HCI_WORDS]; | 354 | u32 out[TCI_WORDS]; |
344 | acpi_status status = hci_raw(dev, in, out); | 355 | acpi_status status = tci_raw(dev, in, out); |
356 | if (ACPI_FAILURE(status)) | ||
357 | return TOS_FAILURE; | ||
358 | |||
345 | *out1 = out[2]; | 359 | *out1 = out[2]; |
346 | *out2 = out[3]; | 360 | *out2 = out[3]; |
347 | *result = (status == AE_OK) ? out[0] : HCI_FAILURE; | 361 | |
348 | return status; | 362 | return out[0]; |
349 | } | 363 | } |
350 | 364 | ||
351 | /* common sci tasks | 365 | /* common sci tasks |
@@ -353,22 +367,22 @@ static acpi_status hci_read2(struct toshiba_acpi_dev *dev, u32 reg, | |||
353 | 367 | ||
354 | static int sci_open(struct toshiba_acpi_dev *dev) | 368 | static int sci_open(struct toshiba_acpi_dev *dev) |
355 | { | 369 | { |
356 | u32 in[HCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 }; | 370 | u32 in[TCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 }; |
357 | u32 out[HCI_WORDS]; | 371 | u32 out[TCI_WORDS]; |
358 | acpi_status status; | 372 | acpi_status status; |
359 | 373 | ||
360 | status = hci_raw(dev, in, out); | 374 | status = tci_raw(dev, in, out); |
361 | if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { | 375 | if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) { |
362 | pr_err("ACPI call to open SCI failed\n"); | 376 | pr_err("ACPI call to open SCI failed\n"); |
363 | return 0; | 377 | return 0; |
364 | } | 378 | } |
365 | 379 | ||
366 | if (out[0] == SCI_OPEN_CLOSE_OK) { | 380 | if (out[0] == TOS_OPEN_CLOSE_OK) { |
367 | return 1; | 381 | return 1; |
368 | } else if (out[0] == SCI_ALREADY_OPEN) { | 382 | } else if (out[0] == TOS_ALREADY_OPEN) { |
369 | pr_info("Toshiba SCI already opened\n"); | 383 | pr_info("Toshiba SCI already opened\n"); |
370 | return 1; | 384 | return 1; |
371 | } else if (out[0] == SCI_NOT_PRESENT) { | 385 | } else if (out[0] == TOS_NOT_PRESENT) { |
372 | pr_info("Toshiba SCI is not present\n"); | 386 | pr_info("Toshiba SCI is not present\n"); |
373 | } | 387 | } |
374 | 388 | ||
@@ -377,61 +391,62 @@ static int sci_open(struct toshiba_acpi_dev *dev) | |||
377 | 391 | ||
378 | static void sci_close(struct toshiba_acpi_dev *dev) | 392 | static void sci_close(struct toshiba_acpi_dev *dev) |
379 | { | 393 | { |
380 | u32 in[HCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 }; | 394 | u32 in[TCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 }; |
381 | u32 out[HCI_WORDS]; | 395 | u32 out[TCI_WORDS]; |
382 | acpi_status status; | 396 | acpi_status status; |
383 | 397 | ||
384 | status = hci_raw(dev, in, out); | 398 | status = tci_raw(dev, in, out); |
385 | if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { | 399 | if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) { |
386 | pr_err("ACPI call to close SCI failed\n"); | 400 | pr_err("ACPI call to close SCI failed\n"); |
387 | return; | 401 | return; |
388 | } | 402 | } |
389 | 403 | ||
390 | if (out[0] == SCI_OPEN_CLOSE_OK) | 404 | if (out[0] == TOS_OPEN_CLOSE_OK) |
391 | return; | 405 | return; |
392 | else if (out[0] == SCI_NOT_OPENED) | 406 | else if (out[0] == TOS_NOT_OPENED) |
393 | pr_info("Toshiba SCI not opened\n"); | 407 | pr_info("Toshiba SCI not opened\n"); |
394 | else if (out[0] == SCI_NOT_PRESENT) | 408 | else if (out[0] == TOS_NOT_PRESENT) |
395 | pr_info("Toshiba SCI is not present\n"); | 409 | pr_info("Toshiba SCI is not present\n"); |
396 | } | 410 | } |
397 | 411 | ||
398 | static acpi_status sci_read(struct toshiba_acpi_dev *dev, u32 reg, | 412 | static u32 sci_read(struct toshiba_acpi_dev *dev, u32 reg, u32 *out1) |
399 | u32 *out1, u32 *result) | ||
400 | { | 413 | { |
401 | u32 in[HCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 }; | 414 | u32 in[TCI_WORDS] = { SCI_GET, reg, 0, 0, 0, 0 }; |
402 | u32 out[HCI_WORDS]; | 415 | u32 out[TCI_WORDS]; |
403 | acpi_status status = hci_raw(dev, in, out); | 416 | acpi_status status = tci_raw(dev, in, out); |
417 | if (ACPI_FAILURE(status)) | ||
418 | return TOS_FAILURE; | ||
419 | |||
404 | *out1 = out[2]; | 420 | *out1 = out[2]; |
405 | *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE; | 421 | |
406 | return status; | 422 | return out[0]; |
407 | } | 423 | } |
408 | 424 | ||
409 | static acpi_status sci_write(struct toshiba_acpi_dev *dev, u32 reg, | 425 | static u32 sci_write(struct toshiba_acpi_dev *dev, u32 reg, u32 in1) |
410 | u32 in1, u32 *result) | ||
411 | { | 426 | { |
412 | u32 in[HCI_WORDS] = { SCI_SET, reg, in1, 0, 0, 0 }; | 427 | u32 in[TCI_WORDS] = { SCI_SET, reg, in1, 0, 0, 0 }; |
413 | u32 out[HCI_WORDS]; | 428 | u32 out[TCI_WORDS]; |
414 | acpi_status status = hci_raw(dev, in, out); | 429 | acpi_status status = tci_raw(dev, in, out); |
415 | *result = (ACPI_SUCCESS(status)) ? out[0] : HCI_FAILURE; | 430 | |
416 | return status; | 431 | return ACPI_SUCCESS(status) ? out[0] : TOS_FAILURE; |
417 | } | 432 | } |
418 | 433 | ||
419 | /* Illumination support */ | 434 | /* Illumination support */ |
420 | static int toshiba_illumination_available(struct toshiba_acpi_dev *dev) | 435 | static int toshiba_illumination_available(struct toshiba_acpi_dev *dev) |
421 | { | 436 | { |
422 | u32 in[HCI_WORDS] = { SCI_GET, SCI_ILLUMINATION, 0, 0, 0, 0 }; | 437 | u32 in[TCI_WORDS] = { SCI_GET, SCI_ILLUMINATION, 0, 0, 0, 0 }; |
423 | u32 out[HCI_WORDS]; | 438 | u32 out[TCI_WORDS]; |
424 | acpi_status status; | 439 | acpi_status status; |
425 | 440 | ||
426 | if (!sci_open(dev)) | 441 | if (!sci_open(dev)) |
427 | return 0; | 442 | return 0; |
428 | 443 | ||
429 | status = hci_raw(dev, in, out); | 444 | status = tci_raw(dev, in, out); |
430 | sci_close(dev); | 445 | sci_close(dev); |
431 | if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { | 446 | if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) { |
432 | pr_err("ACPI call to query Illumination support failed\n"); | 447 | pr_err("ACPI call to query Illumination support failed\n"); |
433 | return 0; | 448 | return 0; |
434 | } else if (out[0] == HCI_NOT_SUPPORTED || out[1] != 1) { | 449 | } else if (out[0] == TOS_NOT_SUPPORTED) { |
435 | pr_info("Illumination device not available\n"); | 450 | pr_info("Illumination device not available\n"); |
436 | return 0; | 451 | return 0; |
437 | } | 452 | } |
@@ -445,7 +460,6 @@ static void toshiba_illumination_set(struct led_classdev *cdev, | |||
445 | struct toshiba_acpi_dev *dev = container_of(cdev, | 460 | struct toshiba_acpi_dev *dev = container_of(cdev, |
446 | struct toshiba_acpi_dev, led_dev); | 461 | struct toshiba_acpi_dev, led_dev); |
447 | u32 state, result; | 462 | u32 state, result; |
448 | acpi_status status; | ||
449 | 463 | ||
450 | /* First request : initialize communication. */ | 464 | /* First request : initialize communication. */ |
451 | if (!sci_open(dev)) | 465 | if (!sci_open(dev)) |
@@ -453,12 +467,12 @@ static void toshiba_illumination_set(struct led_classdev *cdev, | |||
453 | 467 | ||
454 | /* Switch the illumination on/off */ | 468 | /* Switch the illumination on/off */ |
455 | state = brightness ? 1 : 0; | 469 | state = brightness ? 1 : 0; |
456 | status = sci_write(dev, SCI_ILLUMINATION, state, &result); | 470 | result = sci_write(dev, SCI_ILLUMINATION, state); |
457 | sci_close(dev); | 471 | sci_close(dev); |
458 | if (ACPI_FAILURE(status)) { | 472 | if (result == TOS_FAILURE) { |
459 | pr_err("ACPI call for illumination failed\n"); | 473 | pr_err("ACPI call for illumination failed\n"); |
460 | return; | 474 | return; |
461 | } else if (result == HCI_NOT_SUPPORTED) { | 475 | } else if (result == TOS_NOT_SUPPORTED) { |
462 | pr_info("Illumination not supported\n"); | 476 | pr_info("Illumination not supported\n"); |
463 | return; | 477 | return; |
464 | } | 478 | } |
@@ -469,19 +483,18 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev) | |||
469 | struct toshiba_acpi_dev *dev = container_of(cdev, | 483 | struct toshiba_acpi_dev *dev = container_of(cdev, |
470 | struct toshiba_acpi_dev, led_dev); | 484 | struct toshiba_acpi_dev, led_dev); |
471 | u32 state, result; | 485 | u32 state, result; |
472 | acpi_status status; | ||
473 | 486 | ||
474 | /*Â First request : initialize communication. */ | 487 | /*Â First request : initialize communication. */ |
475 | if (!sci_open(dev)) | 488 | if (!sci_open(dev)) |
476 | return LED_OFF; | 489 | return LED_OFF; |
477 | 490 | ||
478 | /* Check the illumination */ | 491 | /* Check the illumination */ |
479 | status = sci_read(dev, SCI_ILLUMINATION, &state, &result); | 492 | result = sci_read(dev, SCI_ILLUMINATION, &state); |
480 | sci_close(dev); | 493 | sci_close(dev); |
481 | if (ACPI_FAILURE(status) || result == SCI_INPUT_DATA_ERROR) { | 494 | if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) { |
482 | pr_err("ACPI call for illumination failed\n"); | 495 | pr_err("ACPI call for illumination failed\n"); |
483 | return LED_OFF; | 496 | return LED_OFF; |
484 | } else if (result == HCI_NOT_SUPPORTED) { | 497 | } else if (result == TOS_NOT_SUPPORTED) { |
485 | pr_info("Illumination not supported\n"); | 498 | pr_info("Illumination not supported\n"); |
486 | return LED_OFF; | 499 | return LED_OFF; |
487 | } | 500 | } |
@@ -490,20 +503,55 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev) | |||
490 | } | 503 | } |
491 | 504 | ||
492 | /* KBD Illumination */ | 505 | /* KBD Illumination */ |
506 | static int toshiba_kbd_illum_available(struct toshiba_acpi_dev *dev) | ||
507 | { | ||
508 | u32 in[TCI_WORDS] = { SCI_GET, SCI_KBD_ILLUM_STATUS, 0, 0, 0, 0 }; | ||
509 | u32 out[TCI_WORDS]; | ||
510 | acpi_status status; | ||
511 | |||
512 | if (!sci_open(dev)) | ||
513 | return 0; | ||
514 | |||
515 | status = tci_raw(dev, in, out); | ||
516 | sci_close(dev); | ||
517 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { | ||
518 | pr_err("ACPI call to query kbd illumination support failed\n"); | ||
519 | return 0; | ||
520 | } else if (out[0] == TOS_NOT_SUPPORTED) { | ||
521 | pr_info("Keyboard illumination not available\n"); | ||
522 | return 0; | ||
523 | } | ||
524 | |||
525 | /* Check for keyboard backlight timeout max value, | ||
526 | * previous kbd backlight implementation set this to | ||
527 | * 0x3c0003, and now the new implementation set this | ||
528 | * to 0x3c001a, use this to distinguish between them | ||
529 | */ | ||
530 | if (out[3] == SCI_KBD_TIME_MAX) | ||
531 | dev->kbd_type = 2; | ||
532 | else | ||
533 | dev->kbd_type = 1; | ||
534 | /* Get the current keyboard backlight mode */ | ||
535 | dev->kbd_mode = out[2] & SCI_KBD_MODE_MASK; | ||
536 | /* Get the current time (1-60 seconds) */ | ||
537 | dev->kbd_time = out[2] >> HCI_MISC_SHIFT; | ||
538 | |||
539 | return 1; | ||
540 | } | ||
541 | |||
493 | static int toshiba_kbd_illum_status_set(struct toshiba_acpi_dev *dev, u32 time) | 542 | static int toshiba_kbd_illum_status_set(struct toshiba_acpi_dev *dev, u32 time) |
494 | { | 543 | { |
495 | u32 result; | 544 | u32 result; |
496 | acpi_status status; | ||
497 | 545 | ||
498 | if (!sci_open(dev)) | 546 | if (!sci_open(dev)) |
499 | return -EIO; | 547 | return -EIO; |
500 | 548 | ||
501 | status = sci_write(dev, SCI_KBD_ILLUM_STATUS, time, &result); | 549 | result = sci_write(dev, SCI_KBD_ILLUM_STATUS, time); |
502 | sci_close(dev); | 550 | sci_close(dev); |
503 | if (ACPI_FAILURE(status) || result == SCI_INPUT_DATA_ERROR) { | 551 | if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) { |
504 | pr_err("ACPI call to set KBD backlight status failed\n"); | 552 | pr_err("ACPI call to set KBD backlight status failed\n"); |
505 | return -EIO; | 553 | return -EIO; |
506 | } else if (result == HCI_NOT_SUPPORTED) { | 554 | } else if (result == TOS_NOT_SUPPORTED) { |
507 | pr_info("Keyboard backlight status not supported\n"); | 555 | pr_info("Keyboard backlight status not supported\n"); |
508 | return -ENODEV; | 556 | return -ENODEV; |
509 | } | 557 | } |
@@ -514,17 +562,16 @@ static int toshiba_kbd_illum_status_set(struct toshiba_acpi_dev *dev, u32 time) | |||
514 | static int toshiba_kbd_illum_status_get(struct toshiba_acpi_dev *dev, u32 *time) | 562 | static int toshiba_kbd_illum_status_get(struct toshiba_acpi_dev *dev, u32 *time) |
515 | { | 563 | { |
516 | u32 result; | 564 | u32 result; |
517 | acpi_status status; | ||
518 | 565 | ||
519 | if (!sci_open(dev)) | 566 | if (!sci_open(dev)) |
520 | return -EIO; | 567 | return -EIO; |
521 | 568 | ||
522 | status = sci_read(dev, SCI_KBD_ILLUM_STATUS, time, &result); | 569 | result = sci_read(dev, SCI_KBD_ILLUM_STATUS, time); |
523 | sci_close(dev); | 570 | sci_close(dev); |
524 | if (ACPI_FAILURE(status) || result == SCI_INPUT_DATA_ERROR) { | 571 | if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) { |
525 | pr_err("ACPI call to get KBD backlight status failed\n"); | 572 | pr_err("ACPI call to get KBD backlight status failed\n"); |
526 | return -EIO; | 573 | return -EIO; |
527 | } else if (result == HCI_NOT_SUPPORTED) { | 574 | } else if (result == TOS_NOT_SUPPORTED) { |
528 | pr_info("Keyboard backlight status not supported\n"); | 575 | pr_info("Keyboard backlight status not supported\n"); |
529 | return -ENODEV; | 576 | return -ENODEV; |
530 | } | 577 | } |
@@ -537,14 +584,13 @@ static enum led_brightness toshiba_kbd_backlight_get(struct led_classdev *cdev) | |||
537 | struct toshiba_acpi_dev *dev = container_of(cdev, | 584 | struct toshiba_acpi_dev *dev = container_of(cdev, |
538 | struct toshiba_acpi_dev, kbd_led); | 585 | struct toshiba_acpi_dev, kbd_led); |
539 | u32 state, result; | 586 | u32 state, result; |
540 | acpi_status status; | ||
541 | 587 | ||
542 | /* Check the keyboard backlight state */ | 588 | /* Check the keyboard backlight state */ |
543 | status = hci_read1(dev, HCI_KBD_ILLUMINATION, &state, &result); | 589 | result = hci_read1(dev, HCI_KBD_ILLUMINATION, &state); |
544 | if (ACPI_FAILURE(status) || result == SCI_INPUT_DATA_ERROR) { | 590 | if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) { |
545 | pr_err("ACPI call to get the keyboard backlight failed\n"); | 591 | pr_err("ACPI call to get the keyboard backlight failed\n"); |
546 | return LED_OFF; | 592 | return LED_OFF; |
547 | } else if (result == HCI_NOT_SUPPORTED) { | 593 | } else if (result == TOS_NOT_SUPPORTED) { |
548 | pr_info("Keyboard backlight not supported\n"); | 594 | pr_info("Keyboard backlight not supported\n"); |
549 | return LED_OFF; | 595 | return LED_OFF; |
550 | } | 596 | } |
@@ -558,15 +604,14 @@ static void toshiba_kbd_backlight_set(struct led_classdev *cdev, | |||
558 | struct toshiba_acpi_dev *dev = container_of(cdev, | 604 | struct toshiba_acpi_dev *dev = container_of(cdev, |
559 | struct toshiba_acpi_dev, kbd_led); | 605 | struct toshiba_acpi_dev, kbd_led); |
560 | u32 state, result; | 606 | u32 state, result; |
561 | acpi_status status; | ||
562 | 607 | ||
563 | /* Set the keyboard backlight state */ | 608 | /* Set the keyboard backlight state */ |
564 | state = brightness ? 1 : 0; | 609 | state = brightness ? 1 : 0; |
565 | status = hci_write1(dev, HCI_KBD_ILLUMINATION, state, &result); | 610 | result = hci_write1(dev, HCI_KBD_ILLUMINATION, state); |
566 | if (ACPI_FAILURE(status) || result == SCI_INPUT_DATA_ERROR) { | 611 | if (result == TOS_FAILURE || result == TOS_INPUT_DATA_ERROR) { |
567 | pr_err("ACPI call to set KBD Illumination mode failed\n"); | 612 | pr_err("ACPI call to set KBD Illumination mode failed\n"); |
568 | return; | 613 | return; |
569 | } else if (result == HCI_NOT_SUPPORTED) { | 614 | } else if (result == TOS_NOT_SUPPORTED) { |
570 | pr_info("Keyboard backlight not supported\n"); | 615 | pr_info("Keyboard backlight not supported\n"); |
571 | return; | 616 | return; |
572 | } | 617 | } |
@@ -576,17 +621,16 @@ static void toshiba_kbd_backlight_set(struct led_classdev *cdev, | |||
576 | static int toshiba_touchpad_set(struct toshiba_acpi_dev *dev, u32 state) | 621 | static int toshiba_touchpad_set(struct toshiba_acpi_dev *dev, u32 state) |
577 | { | 622 | { |
578 | u32 result; | 623 | u32 result; |
579 | acpi_status status; | ||
580 | 624 | ||
581 | if (!sci_open(dev)) | 625 | if (!sci_open(dev)) |
582 | return -EIO; | 626 | return -EIO; |
583 | 627 | ||
584 | status = sci_write(dev, SCI_TOUCHPAD, state, &result); | 628 | result = sci_write(dev, SCI_TOUCHPAD, state); |
585 | sci_close(dev); | 629 | sci_close(dev); |
586 | if (ACPI_FAILURE(status)) { | 630 | if (result == TOS_FAILURE) { |
587 | pr_err("ACPI call to set the touchpad failed\n"); | 631 | pr_err("ACPI call to set the touchpad failed\n"); |
588 | return -EIO; | 632 | return -EIO; |
589 | } else if (result == HCI_NOT_SUPPORTED) { | 633 | } else if (result == TOS_NOT_SUPPORTED) { |
590 | return -ENODEV; | 634 | return -ENODEV; |
591 | } | 635 | } |
592 | 636 | ||
@@ -596,17 +640,16 @@ static int toshiba_touchpad_set(struct toshiba_acpi_dev *dev, u32 state) | |||
596 | static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state) | 640 | static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state) |
597 | { | 641 | { |
598 | u32 result; | 642 | u32 result; |
599 | acpi_status status; | ||
600 | 643 | ||
601 | if (!sci_open(dev)) | 644 | if (!sci_open(dev)) |
602 | return -EIO; | 645 | return -EIO; |
603 | 646 | ||
604 | status = sci_read(dev, SCI_TOUCHPAD, state, &result); | 647 | result = sci_read(dev, SCI_TOUCHPAD, state); |
605 | sci_close(dev); | 648 | sci_close(dev); |
606 | if (ACPI_FAILURE(status)) { | 649 | if (result == TOS_FAILURE) { |
607 | pr_err("ACPI call to query the touchpad failed\n"); | 650 | pr_err("ACPI call to query the touchpad failed\n"); |
608 | return -EIO; | 651 | return -EIO; |
609 | } else if (result == HCI_NOT_SUPPORTED) { | 652 | } else if (result == TOS_NOT_SUPPORTED) { |
610 | return -ENODEV; | 653 | return -ENODEV; |
611 | } | 654 | } |
612 | 655 | ||
@@ -617,11 +660,11 @@ static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state) | |||
617 | static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) | 660 | static int toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) |
618 | { | 661 | { |
619 | acpi_status status; | 662 | acpi_status status; |
620 | u32 in[HCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; | 663 | u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; |
621 | u32 out[HCI_WORDS]; | 664 | u32 out[TCI_WORDS]; |
622 | 665 | ||
623 | status = hci_raw(dev, in, out); | 666 | status = tci_raw(dev, in, out); |
624 | if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { | 667 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { |
625 | pr_info("ACPI call to get ECO led failed\n"); | 668 | pr_info("ACPI call to get ECO led failed\n"); |
626 | return 0; | 669 | return 0; |
627 | } | 670 | } |
@@ -633,12 +676,12 @@ static enum led_brightness toshiba_eco_mode_get_status(struct led_classdev *cdev | |||
633 | { | 676 | { |
634 | struct toshiba_acpi_dev *dev = container_of(cdev, | 677 | struct toshiba_acpi_dev *dev = container_of(cdev, |
635 | struct toshiba_acpi_dev, eco_led); | 678 | struct toshiba_acpi_dev, eco_led); |
636 | u32 in[HCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; | 679 | u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 1, 0, 0 }; |
637 | u32 out[HCI_WORDS]; | 680 | u32 out[TCI_WORDS]; |
638 | acpi_status status; | 681 | acpi_status status; |
639 | 682 | ||
640 | status = hci_raw(dev, in, out); | 683 | status = tci_raw(dev, in, out); |
641 | if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { | 684 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { |
642 | pr_err("ACPI call to get ECO led failed\n"); | 685 | pr_err("ACPI call to get ECO led failed\n"); |
643 | return LED_OFF; | 686 | return LED_OFF; |
644 | } | 687 | } |
@@ -651,14 +694,14 @@ static void toshiba_eco_mode_set_status(struct led_classdev *cdev, | |||
651 | { | 694 | { |
652 | struct toshiba_acpi_dev *dev = container_of(cdev, | 695 | struct toshiba_acpi_dev *dev = container_of(cdev, |
653 | struct toshiba_acpi_dev, eco_led); | 696 | struct toshiba_acpi_dev, eco_led); |
654 | u32 in[HCI_WORDS] = { HCI_SET, HCI_ECO_MODE, 0, 1, 0, 0 }; | 697 | u32 in[TCI_WORDS] = { HCI_SET, HCI_ECO_MODE, 0, 1, 0, 0 }; |
655 | u32 out[HCI_WORDS]; | 698 | u32 out[TCI_WORDS]; |
656 | acpi_status status; | 699 | acpi_status status; |
657 | 700 | ||
658 | /* Switch the Eco Mode led on/off */ | 701 | /* Switch the Eco Mode led on/off */ |
659 | in[2] = (brightness) ? 1 : 0; | 702 | in[2] = (brightness) ? 1 : 0; |
660 | status = hci_raw(dev, in, out); | 703 | status = tci_raw(dev, in, out); |
661 | if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { | 704 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { |
662 | pr_err("ACPI call to set ECO led failed\n"); | 705 | pr_err("ACPI call to set ECO led failed\n"); |
663 | return; | 706 | return; |
664 | } | 707 | } |
@@ -667,22 +710,22 @@ static void toshiba_eco_mode_set_status(struct led_classdev *cdev, | |||
667 | /* Accelerometer support */ | 710 | /* Accelerometer support */ |
668 | static int toshiba_accelerometer_supported(struct toshiba_acpi_dev *dev) | 711 | static int toshiba_accelerometer_supported(struct toshiba_acpi_dev *dev) |
669 | { | 712 | { |
670 | u32 in[HCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER2, 0, 0, 0, 0 }; | 713 | u32 in[TCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER2, 0, 0, 0, 0 }; |
671 | u32 out[HCI_WORDS]; | 714 | u32 out[TCI_WORDS]; |
672 | acpi_status status; | 715 | acpi_status status; |
673 | 716 | ||
674 | /* Check if the accelerometer call exists, | 717 | /* Check if the accelerometer call exists, |
675 | * this call also serves as initialization | 718 | * this call also serves as initialization |
676 | */ | 719 | */ |
677 | status = hci_raw(dev, in, out); | 720 | status = tci_raw(dev, in, out); |
678 | if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { | 721 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { |
679 | pr_err("ACPI call to query the accelerometer failed\n"); | 722 | pr_err("ACPI call to query the accelerometer failed\n"); |
680 | return -EIO; | 723 | return -EIO; |
681 | } else if (out[0] == HCI_DATA_NOT_AVAILABLE || | 724 | } else if (out[0] == TOS_DATA_NOT_AVAILABLE || |
682 | out[0] == HCI_NOT_INITIALIZED) { | 725 | out[0] == TOS_NOT_INITIALIZED) { |
683 | pr_err("Accelerometer not initialized\n"); | 726 | pr_err("Accelerometer not initialized\n"); |
684 | return -EIO; | 727 | return -EIO; |
685 | } else if (out[0] == HCI_NOT_SUPPORTED) { | 728 | } else if (out[0] == TOS_NOT_SUPPORTED) { |
686 | pr_info("Accelerometer not supported\n"); | 729 | pr_info("Accelerometer not supported\n"); |
687 | return -ENODEV; | 730 | return -ENODEV; |
688 | } | 731 | } |
@@ -693,13 +736,13 @@ static int toshiba_accelerometer_supported(struct toshiba_acpi_dev *dev) | |||
693 | static int toshiba_accelerometer_get(struct toshiba_acpi_dev *dev, | 736 | static int toshiba_accelerometer_get(struct toshiba_acpi_dev *dev, |
694 | u32 *xy, u32 *z) | 737 | u32 *xy, u32 *z) |
695 | { | 738 | { |
696 | u32 in[HCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER, 0, 1, 0, 0 }; | 739 | u32 in[TCI_WORDS] = { HCI_GET, HCI_ACCELEROMETER, 0, 1, 0, 0 }; |
697 | u32 out[HCI_WORDS]; | 740 | u32 out[TCI_WORDS]; |
698 | acpi_status status; | 741 | acpi_status status; |
699 | 742 | ||
700 | /* Check the Accelerometer status */ | 743 | /* Check the Accelerometer status */ |
701 | status = hci_raw(dev, in, out); | 744 | status = tci_raw(dev, in, out); |
702 | if (ACPI_FAILURE(status) || out[0] == SCI_INPUT_DATA_ERROR) { | 745 | if (ACPI_FAILURE(status) || out[0] == TOS_INPUT_DATA_ERROR) { |
703 | pr_err("ACPI call to query the accelerometer failed\n"); | 746 | pr_err("ACPI call to query the accelerometer failed\n"); |
704 | return -EIO; | 747 | return -EIO; |
705 | } | 748 | } |
@@ -719,8 +762,8 @@ static u32 hci_get_bt_present(struct toshiba_acpi_dev *dev, bool *present) | |||
719 | 762 | ||
720 | value = 0; | 763 | value = 0; |
721 | value2 = 0; | 764 | value2 = 0; |
722 | hci_read2(dev, HCI_WIRELESS, &value, &value2, &hci_result); | 765 | hci_result = hci_read2(dev, HCI_WIRELESS, &value, &value2); |
723 | if (hci_result == HCI_SUCCESS) | 766 | if (hci_result == TOS_SUCCESS) |
724 | *present = (value & HCI_WIRELESS_BT_PRESENT) ? true : false; | 767 | *present = (value & HCI_WIRELESS_BT_PRESENT) ? true : false; |
725 | 768 | ||
726 | return hci_result; | 769 | return hci_result; |
@@ -733,7 +776,7 @@ static u32 hci_get_radio_state(struct toshiba_acpi_dev *dev, bool *radio_state) | |||
733 | 776 | ||
734 | value = 0; | 777 | value = 0; |
735 | value2 = 0x0001; | 778 | value2 = 0x0001; |
736 | hci_read2(dev, HCI_WIRELESS, &value, &value2, &hci_result); | 779 | hci_result = hci_read2(dev, HCI_WIRELESS, &value, &value2); |
737 | 780 | ||
738 | *radio_state = value & HCI_WIRELESS_KILL_SWITCH; | 781 | *radio_state = value & HCI_WIRELESS_KILL_SWITCH; |
739 | return hci_result; | 782 | return hci_result; |
@@ -750,7 +793,7 @@ static int bt_rfkill_set_block(void *data, bool blocked) | |||
750 | value = (blocked == false); | 793 | value = (blocked == false); |
751 | 794 | ||
752 | mutex_lock(&dev->mutex); | 795 | mutex_lock(&dev->mutex); |
753 | if (hci_get_radio_state(dev, &radio_state) != HCI_SUCCESS) { | 796 | if (hci_get_radio_state(dev, &radio_state) != TOS_SUCCESS) { |
754 | err = -EIO; | 797 | err = -EIO; |
755 | goto out; | 798 | goto out; |
756 | } | 799 | } |
@@ -760,10 +803,10 @@ static int bt_rfkill_set_block(void *data, bool blocked) | |||
760 | goto out; | 803 | goto out; |
761 | } | 804 | } |
762 | 805 | ||
763 | hci_write2(dev, HCI_WIRELESS, value, HCI_WIRELESS_BT_POWER, &result1); | 806 | result1 = hci_write2(dev, HCI_WIRELESS, value, HCI_WIRELESS_BT_POWER); |
764 | hci_write2(dev, HCI_WIRELESS, value, HCI_WIRELESS_BT_ATTACH, &result2); | 807 | result2 = hci_write2(dev, HCI_WIRELESS, value, HCI_WIRELESS_BT_ATTACH); |
765 | 808 | ||
766 | if (result1 != HCI_SUCCESS || result2 != HCI_SUCCESS) | 809 | if (result1 != TOS_SUCCESS || result2 != TOS_SUCCESS) |
767 | err = -EIO; | 810 | err = -EIO; |
768 | else | 811 | else |
769 | err = 0; | 812 | err = 0; |
@@ -782,7 +825,7 @@ static void bt_rfkill_poll(struct rfkill *rfkill, void *data) | |||
782 | mutex_lock(&dev->mutex); | 825 | mutex_lock(&dev->mutex); |
783 | 826 | ||
784 | hci_result = hci_get_radio_state(dev, &value); | 827 | hci_result = hci_get_radio_state(dev, &value); |
785 | if (hci_result != HCI_SUCCESS) { | 828 | if (hci_result != TOS_SUCCESS) { |
786 | /* Can't do anything useful */ | 829 | /* Can't do anything useful */ |
787 | mutex_unlock(&dev->mutex); | 830 | mutex_unlock(&dev->mutex); |
788 | return; | 831 | return; |
@@ -806,9 +849,9 @@ static int get_tr_backlight_status(struct toshiba_acpi_dev *dev, bool *enabled) | |||
806 | u32 hci_result; | 849 | u32 hci_result; |
807 | u32 status; | 850 | u32 status; |
808 | 851 | ||
809 | hci_read1(dev, HCI_TR_BACKLIGHT, &status, &hci_result); | 852 | hci_result = hci_read1(dev, HCI_TR_BACKLIGHT, &status); |
810 | *enabled = !status; | 853 | *enabled = !status; |
811 | return hci_result == HCI_SUCCESS ? 0 : -EIO; | 854 | return hci_result == TOS_SUCCESS ? 0 : -EIO; |
812 | } | 855 | } |
813 | 856 | ||
814 | static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, bool enable) | 857 | static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, bool enable) |
@@ -816,8 +859,8 @@ static int set_tr_backlight_status(struct toshiba_acpi_dev *dev, bool enable) | |||
816 | u32 hci_result; | 859 | u32 hci_result; |
817 | u32 value = !enable; | 860 | u32 value = !enable; |
818 | 861 | ||
819 | hci_write1(dev, HCI_TR_BACKLIGHT, value, &hci_result); | 862 | hci_result = hci_write1(dev, HCI_TR_BACKLIGHT, value); |
820 | return hci_result == HCI_SUCCESS ? 0 : -EIO; | 863 | return hci_result == TOS_SUCCESS ? 0 : -EIO; |
821 | } | 864 | } |
822 | 865 | ||
823 | static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ; | 866 | static struct proc_dir_entry *toshiba_proc_dir /*= 0*/ ; |
@@ -838,8 +881,8 @@ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) | |||
838 | brightness++; | 881 | brightness++; |
839 | } | 882 | } |
840 | 883 | ||
841 | hci_read1(dev, HCI_LCD_BRIGHTNESS, &value, &hci_result); | 884 | hci_result = hci_read1(dev, HCI_LCD_BRIGHTNESS, &value); |
842 | if (hci_result == HCI_SUCCESS) | 885 | if (hci_result == TOS_SUCCESS) |
843 | return brightness + (value >> HCI_LCD_BRIGHTNESS_SHIFT); | 886 | return brightness + (value >> HCI_LCD_BRIGHTNESS_SHIFT); |
844 | 887 | ||
845 | return -EIO; | 888 | return -EIO; |
@@ -879,8 +922,8 @@ static int lcd_proc_open(struct inode *inode, struct file *file) | |||
879 | 922 | ||
880 | static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) | 923 | static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) |
881 | { | 924 | { |
882 | u32 in[HCI_WORDS] = { HCI_SET, HCI_LCD_BRIGHTNESS, 0, 0, 0, 0 }; | 925 | u32 in[TCI_WORDS] = { HCI_SET, HCI_LCD_BRIGHTNESS, 0, 0, 0, 0 }; |
883 | u32 out[HCI_WORDS]; | 926 | u32 out[TCI_WORDS]; |
884 | acpi_status status; | 927 | acpi_status status; |
885 | 928 | ||
886 | if (dev->tr_backlight_supported) { | 929 | if (dev->tr_backlight_supported) { |
@@ -893,19 +936,19 @@ static int set_lcd_brightness(struct toshiba_acpi_dev *dev, int value) | |||
893 | } | 936 | } |
894 | 937 | ||
895 | in[2] = value << HCI_LCD_BRIGHTNESS_SHIFT; | 938 | in[2] = value << HCI_LCD_BRIGHTNESS_SHIFT; |
896 | status = hci_raw(dev, in, out); | 939 | status = tci_raw(dev, in, out); |
897 | if (ACPI_FAILURE(status) || out[0] == HCI_FAILURE) { | 940 | if (ACPI_FAILURE(status) || out[0] == TOS_FAILURE) { |
898 | pr_err("ACPI call to set brightness failed"); | 941 | pr_err("ACPI call to set brightness failed"); |
899 | return -EIO; | 942 | return -EIO; |
900 | } | 943 | } |
901 | /* Extra check for "incomplete" backlight method, where the AML code | 944 | /* Extra check for "incomplete" backlight method, where the AML code |
902 | * doesn't check for HCI_SET or HCI_GET and returns HCI_SUCCESS, | 945 | * doesn't check for HCI_SET or HCI_GET and returns TOS_SUCCESS, |
903 | * the actual brightness, and in some cases the max brightness. | 946 | * the actual brightness, and in some cases the max brightness. |
904 | */ | 947 | */ |
905 | if (out[2] > 0 || out[3] == 0xE000) | 948 | if (out[2] > 0 || out[3] == 0xE000) |
906 | return -ENODEV; | 949 | return -ENODEV; |
907 | 950 | ||
908 | return out[0] == HCI_SUCCESS ? 0 : -EIO; | 951 | return out[0] == TOS_SUCCESS ? 0 : -EIO; |
909 | } | 952 | } |
910 | 953 | ||
911 | static int set_lcd_status(struct backlight_device *bd) | 954 | static int set_lcd_status(struct backlight_device *bd) |
@@ -953,8 +996,8 @@ static int get_video_status(struct toshiba_acpi_dev *dev, u32 *status) | |||
953 | { | 996 | { |
954 | u32 hci_result; | 997 | u32 hci_result; |
955 | 998 | ||
956 | hci_read1(dev, HCI_VIDEO_OUT, status, &hci_result); | 999 | hci_result = hci_read1(dev, HCI_VIDEO_OUT, status); |
957 | return hci_result == HCI_SUCCESS ? 0 : -EIO; | 1000 | return hci_result == TOS_SUCCESS ? 0 : -EIO; |
958 | } | 1001 | } |
959 | 1002 | ||
960 | static int video_proc_show(struct seq_file *m, void *v) | 1003 | static int video_proc_show(struct seq_file *m, void *v) |
@@ -1057,8 +1100,8 @@ static int get_fan_status(struct toshiba_acpi_dev *dev, u32 *status) | |||
1057 | { | 1100 | { |
1058 | u32 hci_result; | 1101 | u32 hci_result; |
1059 | 1102 | ||
1060 | hci_read1(dev, HCI_FAN, status, &hci_result); | 1103 | hci_result = hci_read1(dev, HCI_FAN, status); |
1061 | return hci_result == HCI_SUCCESS ? 0 : -EIO; | 1104 | return hci_result == TOS_SUCCESS ? 0 : -EIO; |
1062 | } | 1105 | } |
1063 | 1106 | ||
1064 | static int fan_proc_show(struct seq_file *m, void *v) | 1107 | static int fan_proc_show(struct seq_file *m, void *v) |
@@ -1097,8 +1140,8 @@ static ssize_t fan_proc_write(struct file *file, const char __user *buf, | |||
1097 | 1140 | ||
1098 | if (sscanf(cmd, " force_on : %i", &value) == 1 && | 1141 | if (sscanf(cmd, " force_on : %i", &value) == 1 && |
1099 | value >= 0 && value <= 1) { | 1142 | value >= 0 && value <= 1) { |
1100 | hci_write1(dev, HCI_FAN, value, &hci_result); | 1143 | hci_result = hci_write1(dev, HCI_FAN, value); |
1101 | if (hci_result != HCI_SUCCESS) | 1144 | if (hci_result != TOS_SUCCESS) |
1102 | return -EIO; | 1145 | return -EIO; |
1103 | else | 1146 | else |
1104 | dev->force_fan = value; | 1147 | dev->force_fan = value; |
@@ -1125,17 +1168,17 @@ static int keys_proc_show(struct seq_file *m, void *v) | |||
1125 | u32 value; | 1168 | u32 value; |
1126 | 1169 | ||
1127 | if (!dev->key_event_valid && dev->system_event_supported) { | 1170 | if (!dev->key_event_valid && dev->system_event_supported) { |
1128 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); | 1171 | hci_result = hci_read1(dev, HCI_SYSTEM_EVENT, &value); |
1129 | if (hci_result == HCI_SUCCESS) { | 1172 | if (hci_result == TOS_SUCCESS) { |
1130 | dev->key_event_valid = 1; | 1173 | dev->key_event_valid = 1; |
1131 | dev->last_key_event = value; | 1174 | dev->last_key_event = value; |
1132 | } else if (hci_result == HCI_EMPTY) { | 1175 | } else if (hci_result == TOS_FIFO_EMPTY) { |
1133 | /* better luck next time */ | 1176 | /* better luck next time */ |
1134 | } else if (hci_result == HCI_NOT_SUPPORTED) { | 1177 | } else if (hci_result == TOS_NOT_SUPPORTED) { |
1135 | /* This is a workaround for an unresolved issue on | 1178 | /* This is a workaround for an unresolved issue on |
1136 | * some machines where system events sporadically | 1179 | * some machines where system events sporadically |
1137 | * become disabled. */ | 1180 | * become disabled. */ |
1138 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); | 1181 | hci_result = hci_write1(dev, HCI_SYSTEM_EVENT, 1); |
1139 | pr_notice("Re-enabled hotkeys\n"); | 1182 | pr_notice("Re-enabled hotkeys\n"); |
1140 | } else { | 1183 | } else { |
1141 | pr_err("Error reading hotkey status\n"); | 1184 | pr_err("Error reading hotkey status\n"); |
@@ -1249,6 +1292,62 @@ static const struct backlight_ops toshiba_backlight_data = { | |||
1249 | /* | 1292 | /* |
1250 | * Sysfs files | 1293 | * Sysfs files |
1251 | */ | 1294 | */ |
1295 | static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | ||
1296 | struct device_attribute *attr, | ||
1297 | const char *buf, size_t count); | ||
1298 | static ssize_t toshiba_kbd_bl_mode_show(struct device *dev, | ||
1299 | struct device_attribute *attr, | ||
1300 | char *buf); | ||
1301 | static ssize_t toshiba_kbd_type_show(struct device *dev, | ||
1302 | struct device_attribute *attr, | ||
1303 | char *buf); | ||
1304 | static ssize_t toshiba_available_kbd_modes_show(struct device *dev, | ||
1305 | struct device_attribute *attr, | ||
1306 | char *buf); | ||
1307 | static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev, | ||
1308 | struct device_attribute *attr, | ||
1309 | const char *buf, size_t count); | ||
1310 | static ssize_t toshiba_kbd_bl_timeout_show(struct device *dev, | ||
1311 | struct device_attribute *attr, | ||
1312 | char *buf); | ||
1313 | static ssize_t toshiba_touchpad_store(struct device *dev, | ||
1314 | struct device_attribute *attr, | ||
1315 | const char *buf, size_t count); | ||
1316 | static ssize_t toshiba_touchpad_show(struct device *dev, | ||
1317 | struct device_attribute *attr, | ||
1318 | char *buf); | ||
1319 | static ssize_t toshiba_position_show(struct device *dev, | ||
1320 | struct device_attribute *attr, | ||
1321 | char *buf); | ||
1322 | |||
1323 | static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR, | ||
1324 | toshiba_kbd_bl_mode_show, toshiba_kbd_bl_mode_store); | ||
1325 | static DEVICE_ATTR(kbd_type, S_IRUGO, toshiba_kbd_type_show, NULL); | ||
1326 | static DEVICE_ATTR(available_kbd_modes, S_IRUGO, | ||
1327 | toshiba_available_kbd_modes_show, NULL); | ||
1328 | static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR, | ||
1329 | toshiba_kbd_bl_timeout_show, toshiba_kbd_bl_timeout_store); | ||
1330 | static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR, | ||
1331 | toshiba_touchpad_show, toshiba_touchpad_store); | ||
1332 | static DEVICE_ATTR(position, S_IRUGO, toshiba_position_show, NULL); | ||
1333 | |||
1334 | static struct attribute *toshiba_attributes[] = { | ||
1335 | &dev_attr_kbd_backlight_mode.attr, | ||
1336 | &dev_attr_kbd_type.attr, | ||
1337 | &dev_attr_available_kbd_modes.attr, | ||
1338 | &dev_attr_kbd_backlight_timeout.attr, | ||
1339 | &dev_attr_touchpad.attr, | ||
1340 | &dev_attr_position.attr, | ||
1341 | NULL, | ||
1342 | }; | ||
1343 | |||
1344 | static umode_t toshiba_sysfs_is_visible(struct kobject *, | ||
1345 | struct attribute *, int); | ||
1346 | |||
1347 | static struct attribute_group toshiba_attr_group = { | ||
1348 | .is_visible = toshiba_sysfs_is_visible, | ||
1349 | .attrs = toshiba_attributes, | ||
1350 | }; | ||
1252 | 1351 | ||
1253 | static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | 1352 | static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, |
1254 | struct device_attribute *attr, | 1353 | struct device_attribute *attr, |
@@ -1263,20 +1362,50 @@ static ssize_t toshiba_kbd_bl_mode_store(struct device *dev, | |||
1263 | ret = kstrtoint(buf, 0, &mode); | 1362 | ret = kstrtoint(buf, 0, &mode); |
1264 | if (ret) | 1363 | if (ret) |
1265 | return ret; | 1364 | return ret; |
1266 | if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO) | 1365 | |
1267 | return -EINVAL; | 1366 | /* Check for supported modes depending on keyboard backlight type */ |
1367 | if (toshiba->kbd_type == 1) { | ||
1368 | /* Type 1 supports SCI_KBD_MODE_FNZ and SCI_KBD_MODE_AUTO */ | ||
1369 | if (mode != SCI_KBD_MODE_FNZ && mode != SCI_KBD_MODE_AUTO) | ||
1370 | return -EINVAL; | ||
1371 | } else if (toshiba->kbd_type == 2) { | ||
1372 | /* Type 2 doesn't support SCI_KBD_MODE_FNZ */ | ||
1373 | if (mode != SCI_KBD_MODE_AUTO && mode != SCI_KBD_MODE_ON && | ||
1374 | mode != SCI_KBD_MODE_OFF) | ||
1375 | return -EINVAL; | ||
1376 | } | ||
1268 | 1377 | ||
1269 | /* Set the Keyboard Backlight Mode where: | 1378 | /* Set the Keyboard Backlight Mode where: |
1270 | * Mode - Auto (2) | FN-Z (1) | ||
1271 | * Auto - KBD backlight turns off automatically in given time | 1379 | * Auto - KBD backlight turns off automatically in given time |
1272 | * FN-Z - KBD backlight "toggles" when hotkey pressed | 1380 | * FN-Z - KBD backlight "toggles" when hotkey pressed |
1381 | * ON - KBD backlight is always on | ||
1382 | * OFF - KBD backlight is always off | ||
1273 | */ | 1383 | */ |
1384 | |||
1385 | /* Only make a change if the actual mode has changed */ | ||
1274 | if (toshiba->kbd_mode != mode) { | 1386 | if (toshiba->kbd_mode != mode) { |
1387 | /* Shift the time to "base time" (0x3c0000 == 60 seconds) */ | ||
1275 | time = toshiba->kbd_time << HCI_MISC_SHIFT; | 1388 | time = toshiba->kbd_time << HCI_MISC_SHIFT; |
1276 | time = time + toshiba->kbd_mode; | 1389 | |
1390 | /* OR the "base time" to the actual method format */ | ||
1391 | if (toshiba->kbd_type == 1) { | ||
1392 | /* Type 1 requires the current mode */ | ||
1393 | time |= toshiba->kbd_mode; | ||
1394 | } else if (toshiba->kbd_type == 2) { | ||
1395 | /* Type 2 requires the desired mode */ | ||
1396 | time |= mode; | ||
1397 | } | ||
1398 | |||
1277 | ret = toshiba_kbd_illum_status_set(toshiba, time); | 1399 | ret = toshiba_kbd_illum_status_set(toshiba, time); |
1278 | if (ret) | 1400 | if (ret) |
1279 | return ret; | 1401 | return ret; |
1402 | |||
1403 | /* Update sysfs entries on successful mode change*/ | ||
1404 | ret = sysfs_update_group(&toshiba->acpi_dev->dev.kobj, | ||
1405 | &toshiba_attr_group); | ||
1406 | if (ret) | ||
1407 | return ret; | ||
1408 | |||
1280 | toshiba->kbd_mode = mode; | 1409 | toshiba->kbd_mode = mode; |
1281 | } | 1410 | } |
1282 | 1411 | ||
@@ -1293,7 +1422,30 @@ static ssize_t toshiba_kbd_bl_mode_show(struct device *dev, | |||
1293 | if (toshiba_kbd_illum_status_get(toshiba, &time) < 0) | 1422 | if (toshiba_kbd_illum_status_get(toshiba, &time) < 0) |
1294 | return -EIO; | 1423 | return -EIO; |
1295 | 1424 | ||
1296 | return sprintf(buf, "%i\n", time & 0x07); | 1425 | return sprintf(buf, "%i\n", time & SCI_KBD_MODE_MASK); |
1426 | } | ||
1427 | |||
1428 | static ssize_t toshiba_kbd_type_show(struct device *dev, | ||
1429 | struct device_attribute *attr, | ||
1430 | char *buf) | ||
1431 | { | ||
1432 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | ||
1433 | |||
1434 | return sprintf(buf, "%d\n", toshiba->kbd_type); | ||
1435 | } | ||
1436 | |||
1437 | static ssize_t toshiba_available_kbd_modes_show(struct device *dev, | ||
1438 | struct device_attribute *attr, | ||
1439 | char *buf) | ||
1440 | { | ||
1441 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | ||
1442 | |||
1443 | if (toshiba->kbd_type == 1) | ||
1444 | return sprintf(buf, "%x %x\n", | ||
1445 | SCI_KBD_MODE_FNZ, SCI_KBD_MODE_AUTO); | ||
1446 | |||
1447 | return sprintf(buf, "%x %x %x\n", | ||
1448 | SCI_KBD_MODE_AUTO, SCI_KBD_MODE_ON, SCI_KBD_MODE_OFF); | ||
1297 | } | 1449 | } |
1298 | 1450 | ||
1299 | static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev, | 1451 | static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev, |
@@ -1301,18 +1453,38 @@ static ssize_t toshiba_kbd_bl_timeout_store(struct device *dev, | |||
1301 | const char *buf, size_t count) | 1453 | const char *buf, size_t count) |
1302 | { | 1454 | { |
1303 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | 1455 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); |
1304 | int time = -1; | 1456 | int time; |
1457 | int ret; | ||
1305 | 1458 | ||
1306 | if (sscanf(buf, "%i", &time) != 1 && (time < 0 || time > 60)) | 1459 | ret = kstrtoint(buf, 0, &time); |
1307 | return -EINVAL; | 1460 | if (ret) |
1461 | return ret; | ||
1308 | 1462 | ||
1309 | /* Set the Keyboard Backlight Timeout: 0-60 seconds */ | 1463 | /* Check for supported values depending on kbd_type */ |
1310 | if (time != -1 && toshiba->kbd_time != time) { | 1464 | if (toshiba->kbd_type == 1) { |
1465 | if (time < 0 || time > 60) | ||
1466 | return -EINVAL; | ||
1467 | } else if (toshiba->kbd_type == 2) { | ||
1468 | if (time < 1 || time > 60) | ||
1469 | return -EINVAL; | ||
1470 | } | ||
1471 | |||
1472 | /* Set the Keyboard Backlight Timeout */ | ||
1473 | |||
1474 | /* Only make a change if the actual timeout has changed */ | ||
1475 | if (toshiba->kbd_time != time) { | ||
1476 | /* Shift the time to "base time" (0x3c0000 == 60 seconds) */ | ||
1311 | time = time << HCI_MISC_SHIFT; | 1477 | time = time << HCI_MISC_SHIFT; |
1312 | time = (toshiba->kbd_mode == SCI_KBD_MODE_AUTO) ? | 1478 | /* OR the "base time" to the actual method format */ |
1313 | time + 1 : time + 2; | 1479 | if (toshiba->kbd_type == 1) |
1314 | if (toshiba_kbd_illum_status_set(toshiba, time) < 0) | 1480 | time |= SCI_KBD_MODE_FNZ; |
1315 | return -EIO; | 1481 | else if (toshiba->kbd_type == 2) |
1482 | time |= SCI_KBD_MODE_AUTO; | ||
1483 | |||
1484 | ret = toshiba_kbd_illum_status_set(toshiba, time); | ||
1485 | if (ret) | ||
1486 | return ret; | ||
1487 | |||
1316 | toshiba->kbd_time = time >> HCI_MISC_SHIFT; | 1488 | toshiba->kbd_time = time >> HCI_MISC_SHIFT; |
1317 | } | 1489 | } |
1318 | 1490 | ||
@@ -1338,12 +1510,18 @@ static ssize_t toshiba_touchpad_store(struct device *dev, | |||
1338 | { | 1510 | { |
1339 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); | 1511 | struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); |
1340 | int state; | 1512 | int state; |
1513 | int ret; | ||
1341 | 1514 | ||
1342 | /* Set the TouchPad on/off, 0 - Disable | 1 - Enable */ | 1515 | /* Set the TouchPad on/off, 0 - Disable | 1 - Enable */ |
1343 | if (sscanf(buf, "%i", &state) == 1 && (state == 0 || state == 1)) { | 1516 | ret = kstrtoint(buf, 0, &state); |
1344 | if (toshiba_touchpad_set(toshiba, state) < 0) | 1517 | if (ret) |
1345 | return -EIO; | 1518 | return ret; |
1346 | } | 1519 | if (state != 0 && state != 1) |
1520 | return -EINVAL; | ||
1521 | |||
1522 | ret = toshiba_touchpad_set(toshiba, state); | ||
1523 | if (ret) | ||
1524 | return ret; | ||
1347 | 1525 | ||
1348 | return count; | 1526 | return count; |
1349 | } | 1527 | } |
@@ -1383,22 +1561,6 @@ static ssize_t toshiba_position_show(struct device *dev, | |||
1383 | return sprintf(buf, "%d %d %d\n", x, y, z); | 1561 | return sprintf(buf, "%d %d %d\n", x, y, z); |
1384 | } | 1562 | } |
1385 | 1563 | ||
1386 | static DEVICE_ATTR(kbd_backlight_mode, S_IRUGO | S_IWUSR, | ||
1387 | toshiba_kbd_bl_mode_show, toshiba_kbd_bl_mode_store); | ||
1388 | static DEVICE_ATTR(kbd_backlight_timeout, S_IRUGO | S_IWUSR, | ||
1389 | toshiba_kbd_bl_timeout_show, toshiba_kbd_bl_timeout_store); | ||
1390 | static DEVICE_ATTR(touchpad, S_IRUGO | S_IWUSR, | ||
1391 | toshiba_touchpad_show, toshiba_touchpad_store); | ||
1392 | static DEVICE_ATTR(position, S_IRUGO, toshiba_position_show, NULL); | ||
1393 | |||
1394 | static struct attribute *toshiba_attributes[] = { | ||
1395 | &dev_attr_kbd_backlight_mode.attr, | ||
1396 | &dev_attr_kbd_backlight_timeout.attr, | ||
1397 | &dev_attr_touchpad.attr, | ||
1398 | &dev_attr_position.attr, | ||
1399 | NULL, | ||
1400 | }; | ||
1401 | |||
1402 | static umode_t toshiba_sysfs_is_visible(struct kobject *kobj, | 1564 | static umode_t toshiba_sysfs_is_visible(struct kobject *kobj, |
1403 | struct attribute *attr, int idx) | 1565 | struct attribute *attr, int idx) |
1404 | { | 1566 | { |
@@ -1418,11 +1580,6 @@ static umode_t toshiba_sysfs_is_visible(struct kobject *kobj, | |||
1418 | return exists ? attr->mode : 0; | 1580 | return exists ? attr->mode : 0; |
1419 | } | 1581 | } |
1420 | 1582 | ||
1421 | static struct attribute_group toshiba_attr_group = { | ||
1422 | .is_visible = toshiba_sysfs_is_visible, | ||
1423 | .attrs = toshiba_attributes, | ||
1424 | }; | ||
1425 | |||
1426 | static bool toshiba_acpi_i8042_filter(unsigned char data, unsigned char str, | 1583 | static bool toshiba_acpi_i8042_filter(unsigned char data, unsigned char str, |
1427 | struct serio *port) | 1584 | struct serio *port) |
1428 | { | 1585 | { |
@@ -1535,8 +1692,8 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) | |||
1535 | if (acpi_has_method(dev->acpi_dev->handle, "INFO")) | 1692 | if (acpi_has_method(dev->acpi_dev->handle, "INFO")) |
1536 | dev->info_supported = 1; | 1693 | dev->info_supported = 1; |
1537 | else { | 1694 | else { |
1538 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, &hci_result); | 1695 | hci_result = hci_write1(dev, HCI_SYSTEM_EVENT, 1); |
1539 | if (hci_result == HCI_SUCCESS) | 1696 | if (hci_result == TOS_SUCCESS) |
1540 | dev->system_event_supported = 1; | 1697 | dev->system_event_supported = 1; |
1541 | } | 1698 | } |
1542 | 1699 | ||
@@ -1558,7 +1715,7 @@ static int toshiba_acpi_setup_keyboard(struct toshiba_acpi_dev *dev) | |||
1558 | goto err_remove_filter; | 1715 | goto err_remove_filter; |
1559 | } | 1716 | } |
1560 | 1717 | ||
1561 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &hci_result); | 1718 | hci_result = hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE); |
1562 | return 0; | 1719 | return 0; |
1563 | 1720 | ||
1564 | err_remove_filter: | 1721 | err_remove_filter: |
@@ -1716,7 +1873,7 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) | |||
1716 | goto error; | 1873 | goto error; |
1717 | 1874 | ||
1718 | /* Register rfkill switch for Bluetooth */ | 1875 | /* Register rfkill switch for Bluetooth */ |
1719 | if (hci_get_bt_present(dev, &bt_present) == HCI_SUCCESS && bt_present) { | 1876 | if (hci_get_bt_present(dev, &bt_present) == TOS_SUCCESS && bt_present) { |
1720 | dev->bt_rfk = rfkill_alloc("Toshiba Bluetooth", | 1877 | dev->bt_rfk = rfkill_alloc("Toshiba Bluetooth", |
1721 | &acpi_dev->dev, | 1878 | &acpi_dev->dev, |
1722 | RFKILL_TYPE_BLUETOOTH, | 1879 | RFKILL_TYPE_BLUETOOTH, |
@@ -1754,12 +1911,7 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) | |||
1754 | dev->eco_supported = 1; | 1911 | dev->eco_supported = 1; |
1755 | } | 1912 | } |
1756 | 1913 | ||
1757 | ret = toshiba_kbd_illum_status_get(dev, &dummy); | 1914 | dev->kbd_illum_supported = toshiba_kbd_illum_available(dev); |
1758 | if (!ret) { | ||
1759 | dev->kbd_time = dummy >> HCI_MISC_SHIFT; | ||
1760 | dev->kbd_mode = dummy & 0x07; | ||
1761 | } | ||
1762 | dev->kbd_illum_supported = !ret; | ||
1763 | /* | 1915 | /* |
1764 | * Only register the LED if KBD illumination is supported | 1916 | * Only register the LED if KBD illumination is supported |
1765 | * and the keyboard backlight operation mode is set to FN-Z | 1917 | * and the keyboard backlight operation mode is set to FN-Z |
@@ -1824,26 +1976,26 @@ static void toshiba_acpi_notify(struct acpi_device *acpi_dev, u32 event) | |||
1824 | toshiba_acpi_report_hotkey(dev, scancode); | 1976 | toshiba_acpi_report_hotkey(dev, scancode); |
1825 | } else if (dev->system_event_supported) { | 1977 | } else if (dev->system_event_supported) { |
1826 | do { | 1978 | do { |
1827 | hci_read1(dev, HCI_SYSTEM_EVENT, &value, &hci_result); | 1979 | hci_result = hci_read1(dev, HCI_SYSTEM_EVENT, &value); |
1828 | switch (hci_result) { | 1980 | switch (hci_result) { |
1829 | case HCI_SUCCESS: | 1981 | case TOS_SUCCESS: |
1830 | toshiba_acpi_report_hotkey(dev, (int)value); | 1982 | toshiba_acpi_report_hotkey(dev, (int)value); |
1831 | break; | 1983 | break; |
1832 | case HCI_NOT_SUPPORTED: | 1984 | case TOS_NOT_SUPPORTED: |
1833 | /* | 1985 | /* |
1834 | * This is a workaround for an unresolved | 1986 | * This is a workaround for an unresolved |
1835 | * issue on some machines where system events | 1987 | * issue on some machines where system events |
1836 | * sporadically become disabled. | 1988 | * sporadically become disabled. |
1837 | */ | 1989 | */ |
1838 | hci_write1(dev, HCI_SYSTEM_EVENT, 1, | 1990 | hci_result = |
1839 | &hci_result); | 1991 | hci_write1(dev, HCI_SYSTEM_EVENT, 1); |
1840 | pr_notice("Re-enabled hotkeys\n"); | 1992 | pr_notice("Re-enabled hotkeys\n"); |
1841 | /* fall through */ | 1993 | /* fall through */ |
1842 | default: | 1994 | default: |
1843 | retries--; | 1995 | retries--; |
1844 | break; | 1996 | break; |
1845 | } | 1997 | } |
1846 | } while (retries && hci_result != HCI_EMPTY); | 1998 | } while (retries && hci_result != TOS_FIFO_EMPTY); |
1847 | } | 1999 | } |
1848 | } | 2000 | } |
1849 | 2001 | ||
@@ -1854,7 +2006,7 @@ static int toshiba_acpi_suspend(struct device *device) | |||
1854 | u32 result; | 2006 | u32 result; |
1855 | 2007 | ||
1856 | if (dev->hotkey_dev) | 2008 | if (dev->hotkey_dev) |
1857 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_DISABLE, &result); | 2009 | result = hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_DISABLE); |
1858 | 2010 | ||
1859 | return 0; | 2011 | return 0; |
1860 | } | 2012 | } |
@@ -1871,7 +2023,7 @@ static int toshiba_acpi_resume(struct device *device) | |||
1871 | if (ACPI_FAILURE(status)) | 2023 | if (ACPI_FAILURE(status)) |
1872 | pr_info("Unable to re-enable hotkeys\n"); | 2024 | pr_info("Unable to re-enable hotkeys\n"); |
1873 | 2025 | ||
1874 | hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE, &result); | 2026 | result = hci_write1(dev, HCI_HOTKEY_EVENT, HCI_HOTKEY_ENABLE); |
1875 | } | 2027 | } |
1876 | 2028 | ||
1877 | return 0; | 2029 | return 0; |