diff options
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/acer-wmi.c | 47 | ||||
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 1 | ||||
-rw-r--r-- | drivers/platform/x86/compal-laptop.c | 4 | ||||
-rw-r--r-- | drivers/platform/x86/dell-laptop.c | 30 | ||||
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 11 | ||||
-rw-r--r-- | drivers/platform/x86/intel_oaktrail.c | 1 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 72 |
7 files changed, 103 insertions, 63 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 005417bd429e..e1c4938b301b 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -1156,9 +1156,9 @@ static acpi_status wmid3_set_device_status(u32 value, u16 device) | |||
1156 | struct wmid3_gds_input_param params = { | 1156 | struct wmid3_gds_input_param params = { |
1157 | .function_num = 0x1, | 1157 | .function_num = 0x1, |
1158 | .hotkey_number = 0x01, | 1158 | .hotkey_number = 0x01, |
1159 | .devices = ACER_WMID3_GDS_WIRELESS & | 1159 | .devices = ACER_WMID3_GDS_WIRELESS | |
1160 | ACER_WMID3_GDS_THREEG & | 1160 | ACER_WMID3_GDS_THREEG | |
1161 | ACER_WMID3_GDS_WIMAX & | 1161 | ACER_WMID3_GDS_WIMAX | |
1162 | ACER_WMID3_GDS_BLUETOOTH, | 1162 | ACER_WMID3_GDS_BLUETOOTH, |
1163 | }; | 1163 | }; |
1164 | struct acpi_buffer input = { | 1164 | struct acpi_buffer input = { |
@@ -1445,6 +1445,8 @@ static void acer_wmi_notify(u32 value, void *context) | |||
1445 | union acpi_object *obj; | 1445 | union acpi_object *obj; |
1446 | struct event_return_value return_value; | 1446 | struct event_return_value return_value; |
1447 | acpi_status status; | 1447 | acpi_status status; |
1448 | u16 device_state; | ||
1449 | const struct key_entry *key; | ||
1448 | 1450 | ||
1449 | status = wmi_get_event_data(value, &response); | 1451 | status = wmi_get_event_data(value, &response); |
1450 | if (status != AE_OK) { | 1452 | if (status != AE_OK) { |
@@ -1472,23 +1474,32 @@ static void acer_wmi_notify(u32 value, void *context) | |||
1472 | 1474 | ||
1473 | switch (return_value.function) { | 1475 | switch (return_value.function) { |
1474 | case WMID_HOTKEY_EVENT: | 1476 | case WMID_HOTKEY_EVENT: |
1475 | if (return_value.device_state) { | 1477 | device_state = return_value.device_state; |
1476 | u16 device_state = return_value.device_state; | 1478 | pr_debug("device state: 0x%x\n", device_state); |
1477 | pr_debug("device state: 0x%x\n", device_state); | 1479 | |
1478 | if (has_cap(ACER_CAP_WIRELESS)) | 1480 | key = sparse_keymap_entry_from_scancode(acer_wmi_input_dev, |
1479 | rfkill_set_sw_state(wireless_rfkill, | 1481 | return_value.key_num); |
1480 | !(device_state & ACER_WMID3_GDS_WIRELESS)); | 1482 | if (!key) { |
1481 | if (has_cap(ACER_CAP_BLUETOOTH)) | ||
1482 | rfkill_set_sw_state(bluetooth_rfkill, | ||
1483 | !(device_state & ACER_WMID3_GDS_BLUETOOTH)); | ||
1484 | if (has_cap(ACER_CAP_THREEG)) | ||
1485 | rfkill_set_sw_state(threeg_rfkill, | ||
1486 | !(device_state & ACER_WMID3_GDS_THREEG)); | ||
1487 | } | ||
1488 | if (!sparse_keymap_report_event(acer_wmi_input_dev, | ||
1489 | return_value.key_num, 1, true)) | ||
1490 | pr_warn("Unknown key number - 0x%x\n", | 1483 | pr_warn("Unknown key number - 0x%x\n", |
1491 | return_value.key_num); | 1484 | return_value.key_num); |
1485 | } else { | ||
1486 | switch (key->keycode) { | ||
1487 | case KEY_WLAN: | ||
1488 | case KEY_BLUETOOTH: | ||
1489 | if (has_cap(ACER_CAP_WIRELESS)) | ||
1490 | rfkill_set_sw_state(wireless_rfkill, | ||
1491 | !(device_state & ACER_WMID3_GDS_WIRELESS)); | ||
1492 | if (has_cap(ACER_CAP_THREEG)) | ||
1493 | rfkill_set_sw_state(threeg_rfkill, | ||
1494 | !(device_state & ACER_WMID3_GDS_THREEG)); | ||
1495 | if (has_cap(ACER_CAP_BLUETOOTH)) | ||
1496 | rfkill_set_sw_state(bluetooth_rfkill, | ||
1497 | !(device_state & ACER_WMID3_GDS_BLUETOOTH)); | ||
1498 | break; | ||
1499 | } | ||
1500 | sparse_keymap_report_entry(acer_wmi_input_dev, key, | ||
1501 | 1, true); | ||
1502 | } | ||
1492 | break; | 1503 | break; |
1493 | default: | 1504 | default: |
1494 | pr_warn("Unknown function number - %d - %d\n", | 1505 | pr_warn("Unknown function number - %d - %d\n", |
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 00460cb9587b..3c7857c71a23 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -1025,6 +1025,7 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus) | |||
1025 | return power; | 1025 | return power; |
1026 | 1026 | ||
1027 | memset(&props, 0, sizeof(struct backlight_properties)); | 1027 | memset(&props, 0, sizeof(struct backlight_properties)); |
1028 | props.type = BACKLIGHT_PLATFORM; | ||
1028 | props.max_brightness = max; | 1029 | props.max_brightness = max; |
1029 | bd = backlight_device_register(asus->driver->name, | 1030 | bd = backlight_device_register(asus->driver->name, |
1030 | &asus->platform_device->dev, asus, | 1031 | &asus->platform_device->dev, asus, |
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 3f204fde1b02..8877b836d27c 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c | |||
@@ -1030,8 +1030,10 @@ static int __devinit compal_probe(struct platform_device *pdev) | |||
1030 | initialize_fan_control_data(data); | 1030 | initialize_fan_control_data(data); |
1031 | 1031 | ||
1032 | err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group); | 1032 | err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group); |
1033 | if (err) | 1033 | if (err) { |
1034 | kfree(data); | ||
1034 | return err; | 1035 | return err; |
1036 | } | ||
1035 | 1037 | ||
1036 | data->hwmon_dev = hwmon_device_register(&pdev->dev); | 1038 | data->hwmon_dev = hwmon_device_register(&pdev->dev); |
1037 | if (IS_ERR(data->hwmon_dev)) { | 1039 | if (IS_ERR(data->hwmon_dev)) { |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index d3841de6a8cf..e39ab1d3ed87 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -292,12 +292,9 @@ static int dell_rfkill_set(void *data, bool blocked) | |||
292 | dell_send_request(buffer, 17, 11); | 292 | dell_send_request(buffer, 17, 11); |
293 | 293 | ||
294 | /* If the hardware switch controls this radio, and the hardware | 294 | /* If the hardware switch controls this radio, and the hardware |
295 | switch is disabled, don't allow changing the software state. | 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. */ | ||
298 | if ((hwswitch_state & BIT(hwswitch_bit)) && | 296 | if ((hwswitch_state & BIT(hwswitch_bit)) && |
299 | !(buffer->output[1] & BIT(16)) && | 297 | !(buffer->output[1] & BIT(16))) { |
300 | (buffer->output[1] & BIT(0))) { | ||
301 | ret = -EINVAL; | 298 | ret = -EINVAL; |
302 | goto out; | 299 | goto out; |
303 | } | 300 | } |
@@ -403,23 +400,6 @@ static const struct file_operations dell_debugfs_fops = { | |||
403 | 400 | ||
404 | static void dell_update_rfkill(struct work_struct *ignored) | 401 | static void dell_update_rfkill(struct work_struct *ignored) |
405 | { | 402 | { |
406 | int status; | ||
407 | |||
408 | get_buffer(); | ||
409 | dell_send_request(buffer, 17, 11); | ||
410 | status = buffer->output[1]; | ||
411 | release_buffer(); | ||
412 | |||
413 | /* if hardware rfkill is not supported, set it explicitly */ | ||
414 | if (!(status & BIT(0))) { | ||
415 | if (wifi_rfkill) | ||
416 | dell_rfkill_set((void *)1, !((status & BIT(17)) >> 17)); | ||
417 | if (bluetooth_rfkill) | ||
418 | dell_rfkill_set((void *)2, !((status & BIT(18)) >> 18)); | ||
419 | if (wwan_rfkill) | ||
420 | dell_rfkill_set((void *)3, !((status & BIT(19)) >> 19)); | ||
421 | } | ||
422 | |||
423 | if (wifi_rfkill) | 403 | if (wifi_rfkill) |
424 | dell_rfkill_query(wifi_rfkill, (void *)1); | 404 | dell_rfkill_query(wifi_rfkill, (void *)1); |
425 | if (bluetooth_rfkill) | 405 | if (bluetooth_rfkill) |
@@ -560,11 +540,11 @@ static int dell_get_intensity(struct backlight_device *bd) | |||
560 | else | 540 | else |
561 | dell_send_request(buffer, 0, 1); | 541 | dell_send_request(buffer, 0, 1); |
562 | 542 | ||
543 | ret = buffer->output[1]; | ||
544 | |||
563 | out: | 545 | out: |
564 | release_buffer(); | 546 | release_buffer(); |
565 | if (ret) | 547 | return ret; |
566 | return ret; | ||
567 | return buffer->output[1]; | ||
568 | } | 548 | } |
569 | 549 | ||
570 | static const struct backlight_ops dell_ops = { | 550 | static const struct backlight_ops dell_ops = { |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index f94017bcdd6e..e2faa3cbb792 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -207,6 +207,7 @@ static int hp_wmi_perform_query(int query, int write, void *buffer, | |||
207 | }; | 207 | }; |
208 | struct acpi_buffer input = { sizeof(struct bios_args), &args }; | 208 | struct acpi_buffer input = { sizeof(struct bios_args), &args }; |
209 | struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; | 209 | struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL }; |
210 | u32 rc; | ||
210 | 211 | ||
211 | if (WARN_ON(insize > sizeof(args.data))) | 212 | if (WARN_ON(insize > sizeof(args.data))) |
212 | return -EINVAL; | 213 | return -EINVAL; |
@@ -224,13 +225,13 @@ static int hp_wmi_perform_query(int query, int write, void *buffer, | |||
224 | } | 225 | } |
225 | 226 | ||
226 | bios_return = (struct bios_return *)obj->buffer.pointer; | 227 | bios_return = (struct bios_return *)obj->buffer.pointer; |
228 | rc = bios_return->return_code; | ||
227 | 229 | ||
228 | if (bios_return->return_code) { | 230 | if (rc) { |
229 | if (bios_return->return_code != HPWMI_RET_UNKNOWN_CMDTYPE) | 231 | if (rc != HPWMI_RET_UNKNOWN_CMDTYPE) |
230 | pr_warn("query 0x%x returned error 0x%x\n", | 232 | pr_warn("query 0x%x returned error 0x%x\n", query, rc); |
231 | query, bios_return->return_code); | ||
232 | kfree(obj); | 233 | kfree(obj); |
233 | return bios_return->return_code; | 234 | return rc; |
234 | } | 235 | } |
235 | 236 | ||
236 | if (!outsize) { | 237 | if (!outsize) { |
diff --git a/drivers/platform/x86/intel_oaktrail.c b/drivers/platform/x86/intel_oaktrail.c index e936364a609d..7f88c7923fc6 100644 --- a/drivers/platform/x86/intel_oaktrail.c +++ b/drivers/platform/x86/intel_oaktrail.c | |||
@@ -250,6 +250,7 @@ static int oaktrail_backlight_init(void) | |||
250 | struct backlight_properties props; | 250 | struct backlight_properties props; |
251 | 251 | ||
252 | memset(&props, 0, sizeof(struct backlight_properties)); | 252 | memset(&props, 0, sizeof(struct backlight_properties)); |
253 | props.type = BACKLIGHT_PLATFORM; | ||
253 | props.max_brightness = OT_EC_BL_BRIGHTNESS_MAX; | 254 | props.max_brightness = OT_EC_BL_BRIGHTNESS_MAX; |
254 | bd = backlight_device_register(DRIVER_NAME, | 255 | bd = backlight_device_register(DRIVER_NAME, |
255 | &oaktrail_device->dev, NULL, | 256 | &oaktrail_device->dev, NULL, |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 77f6e707a2a9..26c5b117df22 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -184,6 +184,10 @@ enum tpacpi_hkey_event_t { | |||
184 | 184 | ||
185 | /* Misc bay events */ | 185 | /* Misc bay events */ |
186 | TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */ | 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 | /* User-interface events */ | 192 | /* User-interface events */ |
189 | TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ | 193 | TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */ |
@@ -194,6 +198,10 @@ enum tpacpi_hkey_event_t { | |||
194 | TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */ | 198 | TP_HKEY_EV_PEN_REMOVED = 0x500c, /* tablet pen removed */ |
195 | TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */ | 199 | TP_HKEY_EV_BRGHT_CHANGED = 0x5010, /* backlight control event */ |
196 | 200 | ||
201 | /* Key-related user-interface events */ | ||
202 | TP_HKEY_EV_KEY_NUMLOCK = 0x6000, /* NumLock key pressed */ | ||
203 | TP_HKEY_EV_KEY_FN = 0x6005, /* Fn key pressed? E420 */ | ||
204 | |||
197 | /* Thermal events */ | 205 | /* Thermal events */ |
198 | TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ | 206 | TP_HKEY_EV_ALARM_BAT_HOT = 0x6011, /* battery too hot */ |
199 | TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */ | 207 | TP_HKEY_EV_ALARM_BAT_XHOT = 0x6012, /* battery critically hot */ |
@@ -201,6 +209,10 @@ enum tpacpi_hkey_event_t { | |||
201 | TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ | 209 | TP_HKEY_EV_ALARM_SENSOR_XHOT = 0x6022, /* sensor critically hot */ |
202 | TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ | 210 | TP_HKEY_EV_THM_TABLE_CHANGED = 0x6030, /* thermal table changed */ |
203 | 211 | ||
212 | TP_HKEY_EV_UNK_6040 = 0x6040, /* Related to AC change? | ||
213 | some sort of APM hint, | ||
214 | W520 */ | ||
215 | |||
204 | /* Misc */ | 216 | /* Misc */ |
205 | TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ | 217 | TP_HKEY_EV_RFKILL_CHANGED = 0x7000, /* rfkill switch changed */ |
206 | }; | 218 | }; |
@@ -3513,6 +3525,34 @@ static bool hotkey_notify_wakeup(const u32 hkey, | |||
3513 | return true; | 3525 | return true; |
3514 | } | 3526 | } |
3515 | 3527 | ||
3528 | static bool hotkey_notify_dockevent(const u32 hkey, | ||
3529 | bool *send_acpi_ev, | ||
3530 | bool *ignore_acpi_ev) | ||
3531 | { | ||
3532 | /* 0x4000-0x4FFF: dock-related events */ | ||
3533 | *send_acpi_ev = true; | ||
3534 | *ignore_acpi_ev = false; | ||
3535 | |||
3536 | switch (hkey) { | ||
3537 | case TP_HKEY_EV_UNDOCK_ACK: | ||
3538 | /* ACPI undock operation completed after wakeup */ | ||
3539 | hotkey_autosleep_ack = 1; | ||
3540 | pr_info("undocked\n"); | ||
3541 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
3542 | return true; | ||
3543 | |||
3544 | case TP_HKEY_EV_HOTPLUG_DOCK: /* docked to port replicator */ | ||
3545 | pr_info("docked into hotplug port replicator\n"); | ||
3546 | return true; | ||
3547 | case TP_HKEY_EV_HOTPLUG_UNDOCK: /* undocked from port replicator */ | ||
3548 | pr_info("undocked from hotplug port replicator\n"); | ||
3549 | return true; | ||
3550 | |||
3551 | default: | ||
3552 | return false; | ||
3553 | } | ||
3554 | } | ||
3555 | |||
3516 | static bool hotkey_notify_usrevent(const u32 hkey, | 3556 | static bool hotkey_notify_usrevent(const u32 hkey, |
3517 | bool *send_acpi_ev, | 3557 | bool *send_acpi_ev, |
3518 | bool *ignore_acpi_ev) | 3558 | bool *ignore_acpi_ev) |
@@ -3547,13 +3587,13 @@ static bool hotkey_notify_usrevent(const u32 hkey, | |||
3547 | 3587 | ||
3548 | static void thermal_dump_all_sensors(void); | 3588 | static void thermal_dump_all_sensors(void); |
3549 | 3589 | ||
3550 | static bool hotkey_notify_thermal(const u32 hkey, | 3590 | static bool hotkey_notify_6xxx(const u32 hkey, |
3551 | bool *send_acpi_ev, | 3591 | bool *send_acpi_ev, |
3552 | bool *ignore_acpi_ev) | 3592 | bool *ignore_acpi_ev) |
3553 | { | 3593 | { |
3554 | bool known = true; | 3594 | bool known = true; |
3555 | 3595 | ||
3556 | /* 0x6000-0x6FFF: thermal alarms */ | 3596 | /* 0x6000-0x6FFF: thermal alarms/notices and keyboard events */ |
3557 | *send_acpi_ev = true; | 3597 | *send_acpi_ev = true; |
3558 | *ignore_acpi_ev = false; | 3598 | *ignore_acpi_ev = false; |
3559 | 3599 | ||
@@ -3582,8 +3622,17 @@ static bool hotkey_notify_thermal(const u32 hkey, | |||
3582 | "a sensor reports something is extremely hot!\n"); | 3622 | "a sensor reports something is extremely hot!\n"); |
3583 | /* recommended action: immediate sleep/hibernate */ | 3623 | /* recommended action: immediate sleep/hibernate */ |
3584 | break; | 3624 | break; |
3625 | |||
3626 | case TP_HKEY_EV_KEY_NUMLOCK: | ||
3627 | case TP_HKEY_EV_KEY_FN: | ||
3628 | /* key press events, we just ignore them as long as the EC | ||
3629 | * is still reporting them in the normal keyboard stream */ | ||
3630 | *send_acpi_ev = false; | ||
3631 | *ignore_acpi_ev = true; | ||
3632 | return true; | ||
3633 | |||
3585 | default: | 3634 | default: |
3586 | pr_alert("THERMAL ALERT: unknown thermal alarm received\n"); | 3635 | pr_warn("unknown possible thermal alarm or keyboard event received\n"); |
3587 | known = false; | 3636 | known = false; |
3588 | } | 3637 | } |
3589 | 3638 | ||
@@ -3652,15 +3701,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3652 | } | 3701 | } |
3653 | break; | 3702 | break; |
3654 | case 4: | 3703 | case 4: |
3655 | /* 0x4000-0x4FFF: dock-related wakeups */ | 3704 | /* 0x4000-0x4FFF: dock-related events */ |
3656 | if (hkey == TP_HKEY_EV_UNDOCK_ACK) { | 3705 | known_ev = hotkey_notify_dockevent(hkey, &send_acpi_ev, |
3657 | hotkey_autosleep_ack = 1; | 3706 | &ignore_acpi_ev); |
3658 | pr_info("undocked\n"); | ||
3659 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
3660 | known_ev = true; | ||
3661 | } else { | ||
3662 | known_ev = false; | ||
3663 | } | ||
3664 | break; | 3707 | break; |
3665 | case 5: | 3708 | case 5: |
3666 | /* 0x5000-0x5FFF: human interface helpers */ | 3709 | /* 0x5000-0x5FFF: human interface helpers */ |
@@ -3668,8 +3711,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3668 | &ignore_acpi_ev); | 3711 | &ignore_acpi_ev); |
3669 | break; | 3712 | break; |
3670 | case 6: | 3713 | case 6: |
3671 | /* 0x6000-0x6FFF: thermal alarms */ | 3714 | /* 0x6000-0x6FFF: thermal alarms/notices and |
3672 | known_ev = hotkey_notify_thermal(hkey, &send_acpi_ev, | 3715 | * keyboard events */ |
3716 | known_ev = hotkey_notify_6xxx(hkey, &send_acpi_ev, | ||
3673 | &ignore_acpi_ev); | 3717 | &ignore_acpi_ev); |
3674 | break; | 3718 | break; |
3675 | case 7: | 3719 | case 7: |