Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254816
b: refs/heads/master
c: a50245a
h: refs/heads/master
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and Matthew Garrett committed Jul 7, 2011
1 parent efd9f4c commit 457bca6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 96b269c1b0e5a218096aa6ff240d2286e99ddd6d
refs/heads/master: a50245af782ea85b1d5ad23e1015e0ac52996b27
2 changes: 2 additions & 0 deletions trunk/Documentation/laptops/thinkpad-acpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,8 @@ Events that are propagated by the driver to userspace:
0x3006 Bay hotplug request (hint to power up SATA link when
the optical drive tray is ejected)
0x4003 Undocked (see 0x2x04), can sleep again
0x4010 Docked into hotplug port replicator (non-ACPI dock)
0x4011 Undocked from hotplug port replicator (non-ACPI dock)
0x500B Tablet pen inserted into its storage bay
0x500C Tablet pen removed from its storage bay
0x6011 ALARM: battery is too hot
Expand Down
44 changes: 35 additions & 9 deletions trunk/drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ enum tpacpi_hkey_event_t {

/* Misc bay events */
TP_HKEY_EV_OPTDRV_EJ = 0x3006, /* opt. drive tray ejected */
TP_HKEY_EV_HOTPLUG_DOCK = 0x4010, /* docked into hotplug dock
or port replicator */
TP_HKEY_EV_HOTPLUG_UNDOCK = 0x4011, /* undocked from hotplug
dock or port replicator */

/* User-interface events */
TP_HKEY_EV_LID_CLOSE = 0x5001, /* laptop lid closed */
Expand Down Expand Up @@ -3521,6 +3525,34 @@ static bool hotkey_notify_wakeup(const u32 hkey,
return true;
}

static bool hotkey_notify_dockevent(const u32 hkey,
bool *send_acpi_ev,
bool *ignore_acpi_ev)
{
/* 0x4000-0x4FFF: dock-related events */
*send_acpi_ev = true;
*ignore_acpi_ev = false;

switch (hkey) {
case TP_HKEY_EV_UNDOCK_ACK:
/* ACPI undock operation completed after wakeup */
hotkey_autosleep_ack = 1;
pr_info("undocked\n");
hotkey_wakeup_hotunplug_complete_notify_change();
return true;

case TP_HKEY_EV_HOTPLUG_DOCK: /* docked to port replicator */
pr_info("docked into hotplug port replicator\n");
return true;
case TP_HKEY_EV_HOTPLUG_UNDOCK: /* undocked from port replicator */
pr_info("undocked from hotplug port replicator\n");
return true;

default:
return false;
}
}

static bool hotkey_notify_usrevent(const u32 hkey,
bool *send_acpi_ev,
bool *ignore_acpi_ev)
Expand Down Expand Up @@ -3669,15 +3701,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
}
break;
case 4:
/* 0x4000-0x4FFF: dock-related wakeups */
if (hkey == TP_HKEY_EV_UNDOCK_ACK) {
hotkey_autosleep_ack = 1;
pr_info("undocked\n");
hotkey_wakeup_hotunplug_complete_notify_change();
known_ev = true;
} else {
known_ev = false;
}
/* 0x4000-0x4FFF: dock-related events */
known_ev = hotkey_notify_dockevent(hkey, &send_acpi_ev,
&ignore_acpi_ev);
break;
case 5:
/* 0x5000-0x5FFF: human interface helpers */
Expand Down

0 comments on commit 457bca6

Please sign in to comment.