diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2011-06-05 15:22:35 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-07-07 10:39:05 -0400 |
commit | a50245af782ea85b1d5ad23e1015e0ac52996b27 (patch) | |
tree | 75c94da4e48279cb59b7fcd3d90d6ccbe711638c | |
parent | 96b269c1b0e5a218096aa6ff240d2286e99ddd6d (diff) |
thinkpad-acpi: handle HKEY 0x4010, 0x4011 events
Handle events 0x4010 and 0x4011 so that we do not pester users about them.
These events report when the thinkpad is docked/undocked to a native
hotplug dock (i.e. one that does not need ACPI handling, nor is represented
in the ACPI device tree). Such docks are based on USB 2.0/3.0, and also
work as port replicators.
We really want a proper dock class to report these, or at least new input
EV_SW events. Since it is not clear which one to use yet, keep reporting
them as vendor-specific ThinkPad events.
WARNING: As defined by the thinkpad-acpi sysfs ABI rules of engagement, the
vendor-specific events will be REMOVED as soon as generic events are made
available (duplicate events are a big problem), with an appropriate update
to the thinkpad-acpi sysfs/event ABI versioning. Userspace is already
prepared to provide easy backwards compatibility for such changes when
convenient to the distro (see acpi-fakekey).
* Event 0x4010: docking to hotplug dock/port replicator
* Event 0x4011: undocking from hotplug dock/port replicator
Typical usecase would be to trigger display reconfiguration.
Reports mention T410, T510, and series 3 docks/port replicators. Special
thanks to Robert de Rooy for his extensive report and analysis of the
situation.
http://www.thinkwiki.org/wiki/ThinkPad_Port_Replicator_Series_3
http://www.thinkwiki.org/wiki/ThinkPad_Mini_Dock_Series_3
http://www.thinkwiki.org/wiki/ThinkPad_Mini_Dock_Plus_Series_3
http://www.thinkwiki.org/wiki/ThinkPad_Mini_Dock_Plus_Series_3_for_Mobile_Workstations
http://lenovoblogs.com/insidethebox/?p=290
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Reported-by: Claudius Hubig <claudiushubig@chubig.net>
Reported-by: Doctor Bill <docbill@gmail.com>
Reported-by: Korte Noack <gbk.noack@gmx.de>
Reported-by: Robert de Rooy <robert.de.rooy@gmail.com>
Reported-by: Sebastian Will <swill@csail.mit.edu>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
-rw-r--r-- | Documentation/laptops/thinkpad-acpi.txt | 2 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 44 |
2 files changed, 37 insertions, 9 deletions
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 4bc92ea93f25..61815483efa3 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -547,6 +547,8 @@ Events that are propagated by the driver to userspace: | |||
547 | 0x3006 Bay hotplug request (hint to power up SATA link when | 547 | 0x3006 Bay hotplug request (hint to power up SATA link when |
548 | the optical drive tray is ejected) | 548 | the optical drive tray is ejected) |
549 | 0x4003 Undocked (see 0x2x04), can sleep again | 549 | 0x4003 Undocked (see 0x2x04), can sleep again |
550 | 0x4010 Docked into hotplug port replicator (non-ACPI dock) | ||
551 | 0x4011 Undocked from hotplug port replicator (non-ACPI dock) | ||
550 | 0x500B Tablet pen inserted into its storage bay | 552 | 0x500B Tablet pen inserted into its storage bay |
551 | 0x500C Tablet pen removed from its storage bay | 553 | 0x500C Tablet pen removed from its storage bay |
552 | 0x6011 ALARM: battery is too hot | 554 | 0x6011 ALARM: battery is too hot |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index cdcd2388af2b..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 */ |
@@ -3521,6 +3525,34 @@ static bool hotkey_notify_wakeup(const u32 hkey, | |||
3521 | return true; | 3525 | return true; |
3522 | } | 3526 | } |
3523 | 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 | |||
3524 | static bool hotkey_notify_usrevent(const u32 hkey, | 3556 | static bool hotkey_notify_usrevent(const u32 hkey, |
3525 | bool *send_acpi_ev, | 3557 | bool *send_acpi_ev, |
3526 | bool *ignore_acpi_ev) | 3558 | bool *ignore_acpi_ev) |
@@ -3669,15 +3701,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
3669 | } | 3701 | } |
3670 | break; | 3702 | break; |
3671 | case 4: | 3703 | case 4: |
3672 | /* 0x4000-0x4FFF: dock-related wakeups */ | 3704 | /* 0x4000-0x4FFF: dock-related events */ |
3673 | if (hkey == TP_HKEY_EV_UNDOCK_ACK) { | 3705 | known_ev = hotkey_notify_dockevent(hkey, &send_acpi_ev, |
3674 | hotkey_autosleep_ack = 1; | 3706 | &ignore_acpi_ev); |
3675 | pr_info("undocked\n"); | ||
3676 | hotkey_wakeup_hotunplug_complete_notify_change(); | ||
3677 | known_ev = true; | ||
3678 | } else { | ||
3679 | known_ev = false; | ||
3680 | } | ||
3681 | break; | 3707 | break; |
3682 | case 5: | 3708 | case 5: |
3683 | /* 0x5000-0x5FFF: human interface helpers */ | 3709 | /* 0x5000-0x5FFF: human interface helpers */ |