Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86:
hp-wmi: fix use after free
dell-laptop - using buffer without mutex_lock
Revert: "dell-laptop: Toggle the unsupported hardware killswitch"
platform-drivers-x86: set backlight type to BACKLIGHT_PLATFORM
thinkpad-acpi: handle HKEY 0x4010, 0x4011 events
drivers/platform/x86: Fix memory leak
thinkpad-acpi: handle some new HKEY 0x60xx events
acer-wmi: fix bitwise bug when set device state
acer-wmi: Only update rfkill status for associated hotkey events

+108 -63
+5
Documentation/laptops/thinkpad-acpi.txt
··· 534 534 0x2404 System is waking up from hibernation to undock 535 535 0x2405 System is waking up from hibernation to eject bay 536 536 0x5010 Brightness level changed/control event 537 + 0x6000 KEYBOARD: Numlock key pressed 538 + 0x6005 KEYBOARD: Fn key pressed (TO BE VERIFIED) 537 539 538 540 Events that are propagated by the driver to userspace: 539 541 ··· 547 545 0x3006 Bay hotplug request (hint to power up SATA link when 548 546 the optical drive tray is ejected) 549 547 0x4003 Undocked (see 0x2x04), can sleep again 548 + 0x4010 Docked into hotplug port replicator (non-ACPI dock) 549 + 0x4011 Undocked from hotplug port replicator (non-ACPI dock) 550 550 0x500B Tablet pen inserted into its storage bay 551 551 0x500C Tablet pen removed from its storage bay 552 552 0x6011 ALARM: battery is too hot ··· 556 552 0x6021 ALARM: a sensor is too hot 557 553 0x6022 ALARM: a sensor is extremely hot 558 554 0x6030 System thermal table changed 555 + 0x6040 Nvidia Optimus/AC adapter related (TO BE VERIFIED) 559 556 560 557 Battery nearly empty alarms are a last resort attempt to get the 561 558 operating system to hibernate or shutdown cleanly (0x2313), or shutdown
+29 -18
drivers/platform/x86/acer-wmi.c
··· 1156 1156 struct wmid3_gds_input_param params = { 1157 1157 .function_num = 0x1, 1158 1158 .hotkey_number = 0x01, 1159 - .devices = ACER_WMID3_GDS_WIRELESS & 1160 - ACER_WMID3_GDS_THREEG & 1161 - ACER_WMID3_GDS_WIMAX & 1159 + .devices = ACER_WMID3_GDS_WIRELESS | 1160 + ACER_WMID3_GDS_THREEG | 1161 + ACER_WMID3_GDS_WIMAX | 1162 1162 ACER_WMID3_GDS_BLUETOOTH, 1163 1163 }; 1164 1164 struct acpi_buffer input = { ··· 1445 1445 union acpi_object *obj; 1446 1446 struct event_return_value return_value; 1447 1447 acpi_status status; 1448 + u16 device_state; 1449 + const struct key_entry *key; 1448 1450 1449 1451 status = wmi_get_event_data(value, &response); 1450 1452 if (status != AE_OK) { ··· 1474 1472 1475 1473 switch (return_value.function) { 1476 1474 case WMID_HOTKEY_EVENT: 1477 - if (return_value.device_state) { 1478 - u16 device_state = return_value.device_state; 1479 - pr_debug("device state: 0x%x\n", device_state); 1480 - if (has_cap(ACER_CAP_WIRELESS)) 1481 - rfkill_set_sw_state(wireless_rfkill, 1482 - !(device_state & ACER_WMID3_GDS_WIRELESS)); 1483 - if (has_cap(ACER_CAP_BLUETOOTH)) 1484 - rfkill_set_sw_state(bluetooth_rfkill, 1485 - !(device_state & ACER_WMID3_GDS_BLUETOOTH)); 1486 - if (has_cap(ACER_CAP_THREEG)) 1487 - rfkill_set_sw_state(threeg_rfkill, 1488 - !(device_state & ACER_WMID3_GDS_THREEG)); 1489 - } 1490 - if (!sparse_keymap_report_event(acer_wmi_input_dev, 1491 - return_value.key_num, 1, true)) 1475 + device_state = return_value.device_state; 1476 + pr_debug("device state: 0x%x\n", device_state); 1477 + 1478 + key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev, 1479 + return_value.key_num); 1480 + if (!key) { 1492 1481 pr_warn("Unknown key number - 0x%x\n", 1493 1482 return_value.key_num); 1483 + } else { 1484 + switch (key->keycode) { 1485 + case KEY_WLAN: 1486 + case KEY_BLUETOOTH: 1487 + if (has_cap(ACER_CAP_WIRELESS)) 1488 + rfkill_set_sw_state(wireless_rfkill, 1489 + !(device_state & ACER_WMID3_GDS_WIRELESS)); 1490 + if (has_cap(ACER_CAP_THREEG)) 1491 + rfkill_set_sw_state(threeg_rfkill, 1492 + !(device_state & ACER_WMID3_GDS_THREEG)); 1493 + if (has_cap(ACER_CAP_BLUETOOTH)) 1494 + rfkill_set_sw_state(bluetooth_rfkill, 1495 + !(device_state & ACER_WMID3_GDS_BLUETOOTH)); 1496 + break; 1497 + } 1498 + sparse_keymap_report_entry(acer_wmi_input_dev, key, 1499 + 1, true); 1500 + } 1494 1501 break; 1495 1502 default: 1496 1503 pr_warn("Unknown function number - %d - %d\n",
+1
drivers/platform/x86/asus-wmi.c
··· 1025 1025 return power; 1026 1026 1027 1027 memset(&props, 0, sizeof(struct backlight_properties)); 1028 + props.type = BACKLIGHT_PLATFORM; 1028 1029 props.max_brightness = max; 1029 1030 bd = backlight_device_register(asus->driver->name, 1030 1031 &asus->platform_device->dev, asus,
+3 -1
drivers/platform/x86/compal-laptop.c
··· 1030 1030 initialize_fan_control_data(data); 1031 1031 1032 1032 err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group); 1033 - if (err) 1033 + if (err) { 1034 + kfree(data); 1034 1035 return err; 1036 + } 1035 1037 1036 1038 data->hwmon_dev = hwmon_device_register(&pdev->dev); 1037 1039 if (IS_ERR(data->hwmon_dev)) {
+5 -25
drivers/platform/x86/dell-laptop.c
··· 292 292 dell_send_request(buffer, 17, 11); 293 293 294 294 /* If the hardware switch controls this radio, and the hardware 295 - switch is disabled, don't allow changing the software state. 296 - If the hardware switch is reported as not supported, always 297 - fire the SMI to toggle the killswitch. */ 295 + switch is disabled, don't allow changing the software state */ 298 296 if ((hwswitch_state & BIT(hwswitch_bit)) && 299 - !(buffer->output[1] & BIT(16)) && 300 - (buffer->output[1] & BIT(0))) { 297 + !(buffer->output[1] & BIT(16))) { 301 298 ret = -EINVAL; 302 299 goto out; 303 300 } ··· 400 403 401 404 static void dell_update_rfkill(struct work_struct *ignored) 402 405 { 403 - int status; 404 - 405 - get_buffer(); 406 - dell_send_request(buffer, 17, 11); 407 - status = buffer->output[1]; 408 - release_buffer(); 409 - 410 - /* if hardware rfkill is not supported, set it explicitly */ 411 - if (!(status & BIT(0))) { 412 - if (wifi_rfkill) 413 - dell_rfkill_set((void *)1, !((status & BIT(17)) >> 17)); 414 - if (bluetooth_rfkill) 415 - dell_rfkill_set((void *)2, !((status & BIT(18)) >> 18)); 416 - if (wwan_rfkill) 417 - dell_rfkill_set((void *)3, !((status & BIT(19)) >> 19)); 418 - } 419 - 420 406 if (wifi_rfkill) 421 407 dell_rfkill_query(wifi_rfkill, (void *)1); 422 408 if (bluetooth_rfkill) ··· 540 560 else 541 561 dell_send_request(buffer, 0, 1); 542 562 563 + ret = buffer->output[1]; 564 + 543 565 out: 544 566 release_buffer(); 545 - if (ret) 546 - return ret; 547 - return buffer->output[1]; 567 + return ret; 548 568 } 549 569 550 570 static const struct backlight_ops dell_ops = {
+6 -5
drivers/platform/x86/hp-wmi.c
··· 207 207 }; 208 208 struct acpi_buffer input = { sizeof(struct bios_args), &args }; 209 209 struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; 210 + u32 rc; 210 211 211 212 if (WARN_ON(insize > sizeof(args.data))) 212 213 return -EINVAL; ··· 225 224 } 226 225 227 226 bios_return = (struct bios_return *)obj->buffer.pointer; 227 + rc = bios_return->return_code; 228 228 229 - if (bios_return->return_code) { 230 - if (bios_return->return_code != HPWMI_RET_UNKNOWN_CMDTYPE) 231 - pr_warn("query 0x%x returned error 0x%x\n", 232 - query, bios_return->return_code); 229 + if (rc) { 230 + if (rc != HPWMI_RET_UNKNOWN_CMDTYPE) 231 + pr_warn("query 0x%x returned error 0x%x\n", query, rc); 233 232 kfree(obj); 234 - return bios_return->return_code; 233 + return rc; 235 234 } 236 235 237 236 if (!outsize) {
+1
drivers/platform/x86/intel_oaktrail.c
··· 250 250 struct backlight_properties props; 251 251 252 252 memset(&props, 0, sizeof(struct backlight_properties)); 253 + props.type = BACKLIGHT_PLATFORM; 253 254 props.max_brightness = OT_EC_BL_BRIGHTNESS_MAX; 254 255 bd = backlight_device_register(DRIVER_NAME, 255 256 &oaktrail_device->dev, NULL,
+58 -14
drivers/platform/x86/thinkpad_acpi.c
··· 184 184 185 185 /* Misc bay events */ 186 186 TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */ 187 + TP_HKEY_EV_HOTPLUG_DOCK = 0x4010, /* docked into hotplug dock 188 + or port replicator */ 189 + TP_HKEY_EV_HOTPLUG_UNDOCK = 0x4011, /* undocked from hotplug 190 + dock or port replicator */ 187 191 188 192 /* User-interface events */ 189 193 TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ ··· 198 194 TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */ 199 195 TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */ 200 196 197 + /* Key-related user-interface events */ 198 + TP_HKEY_EV_KEY_NUMLOCK = 0x6000, /* NumLock key pressed */ 199 + TP_HKEY_EV_KEY_FN = 0x6005, /* Fn key pressed? E420 */ 200 + 201 201 /* Thermal events */ 202 202 TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ 203 203 TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */ 204 204 TP_HKEY_EV_ALARM_SENSOR_HOT = 0x6021, /* sensor too hot */ 205 205 TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ 206 206 TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ 207 + 208 + TP_HKEY_EV_UNK_6040 = 0x6040, /* Related to AC change? 209 + some sort of APM hint, 210 + W520 */ 207 211 208 212 /* Misc */ 209 213 TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ ··· 3525 3513 return true; 3526 3514 } 3527 3515 3516 + static bool hotkey_notify_dockevent(const u32 hkey, 3517 + bool *send_acpi_ev, 3518 + bool *ignore_acpi_ev) 3519 + { 3520 + /* 0x4000-0x4FFF: dock-related events */ 3521 + *send_acpi_ev = true; 3522 + *ignore_acpi_ev = false; 3523 + 3524 + switch (hkey) { 3525 + case TP_HKEY_EV_UNDOCK_ACK: 3526 + /* ACPI undock operation completed after wakeup */ 3527 + hotkey_autosleep_ack = 1; 3528 + pr_info("undocked\n"); 3529 + hotkey_wakeup_hotunplug_complete_notify_change(); 3530 + return true; 3531 + 3532 + case TP_HKEY_EV_HOTPLUG_DOCK: /* docked to port replicator */ 3533 + pr_info("docked into hotplug port replicator\n"); 3534 + return true; 3535 + case TP_HKEY_EV_HOTPLUG_UNDOCK: /* undocked from port replicator */ 3536 + pr_info("undocked from hotplug port replicator\n"); 3537 + return true; 3538 + 3539 + default: 3540 + return false; 3541 + } 3542 + } 3543 + 3528 3544 static bool hotkey_notify_usrevent(const u32 hkey, 3529 3545 bool *send_acpi_ev, 3530 3546 bool *ignore_acpi_ev) ··· 3587 3547 3588 3548 static void thermal_dump_all_sensors(void); 3589 3549 3590 - static bool hotkey_notify_thermal(const u32 hkey, 3550 + static bool hotkey_notify_6xxx(const u32 hkey, 3591 3551 bool *send_acpi_ev, 3592 3552 bool *ignore_acpi_ev) 3593 3553 { 3594 3554 bool known = true; 3595 3555 3596 - /* 0x6000-0x6FFF: thermal alarms */ 3556 + /* 0x6000-0x6FFF: thermal alarms/notices and keyboard events */ 3597 3557 *send_acpi_ev = true; 3598 3558 *ignore_acpi_ev = false; 3599 3559 ··· 3622 3582 "a sensor reports something is extremely hot!\n"); 3623 3583 /* recommended action: immediate sleep/hibernate */ 3624 3584 break; 3585 + 3586 + case TP_HKEY_EV_KEY_NUMLOCK: 3587 + case TP_HKEY_EV_KEY_FN: 3588 + /* key press events, we just ignore them as long as the EC 3589 + * is still reporting them in the normal keyboard stream */ 3590 + *send_acpi_ev = false; 3591 + *ignore_acpi_ev = true; 3592 + return true; 3593 + 3625 3594 default: 3626 - pr_alert("THERMAL ALERT: unknown thermal alarm received\n"); 3595 + pr_warn("unknown possible thermal alarm or keyboard event received\n"); 3627 3596 known = false; 3628 3597 } 3629 3598 ··· 3701 3652 } 3702 3653 break; 3703 3654 case 4: 3704 - /* 0x4000-0x4FFF: dock-related wakeups */ 3705 - if (hkey == TP_HKEY_EV_UNDOCK_ACK) { 3706 - hotkey_autosleep_ack = 1; 3707 - pr_info("undocked\n"); 3708 - hotkey_wakeup_hotunplug_complete_notify_change(); 3709 - known_ev = true; 3710 - } else { 3711 - known_ev = false; 3712 - } 3655 + /* 0x4000-0x4FFF: dock-related events */ 3656 + known_ev = hotkey_notify_dockevent(hkey, &send_acpi_ev, 3657 + &ignore_acpi_ev); 3713 3658 break; 3714 3659 case 5: 3715 3660 /* 0x5000-0x5FFF: human interface helpers */ ··· 3711 3668 &ignore_acpi_ev); 3712 3669 break; 3713 3670 case 6: 3714 - /* 0x6000-0x6FFF: thermal alarms */ 3715 - known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev, 3671 + /* 0x6000-0x6FFF: thermal alarms/notices and 3672 + * keyboard events */ 3673 + known_ev = hotkey_notify_6xxx(hkey, &send_acpi_ev, 3716 3674 &ignore_acpi_ev); 3717 3675 break; 3718 3676 case 7: