aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2007-09-23 10:39:04 -0400
committerLen Brown <len.brown@intel.com>2007-09-23 22:38:15 -0400
commit3eea123df1637a88d0899626a67b83dca959efff (patch)
treefcade902437301c693c2951ec97969075319e324 /drivers/misc
parent1b6521dc84f372dd92a96381fbeeebb01173d050 (diff)
ACPI: thinkpad-acpi: dequeue all pending hot key events at once (v2.2)
Receive all pending HKEY events at once from a single notification, and don't complain if the queue is empty. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/thinkpad_acpi.c51
1 files changed, 34 insertions, 17 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 9a611402ee9d..3efe81b1b73c 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -1196,9 +1196,30 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1196{ 1196{
1197 u32 hkey; 1197 u32 hkey;
1198 unsigned int keycode, scancode; 1198 unsigned int keycode, scancode;
1199 int send_acpi_ev = 0; 1199 int send_acpi_ev;
1200
1201 if (event != 0x80) {
1202 printk(IBM_ERR "unknown HKEY notification event %d\n", event);
1203 /* forward it to userspace, maybe it knows how to handle it */
1204 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
1205 ibm->acpi->device->dev.bus_id,
1206 event, 0);
1207 return;
1208 }
1209
1210 while (1) {
1211 if (!acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
1212 printk(IBM_ERR "failed to retrieve HKEY event\n");
1213 return;
1214 }
1215
1216 if (hkey == 0) {
1217 /* queue empty */
1218 return;
1219 }
1220
1221 send_acpi_ev = 0;
1200 1222
1201 if (event == 0x80 && acpi_evalf(hkey_handle, &hkey, "MHKP", "d")) {
1202 switch (hkey >> 12) { 1223 switch (hkey >> 12) {
1203 case 1: 1224 case 1:
1204 /* 0x1000-0x1FFF: key presses */ 1225 /* 0x1000-0x1FFF: key presses */
@@ -1220,8 +1241,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1220 * eat up known LID events */ 1241 * eat up known LID events */
1221 if (hkey != 0x5001 && hkey != 0x5002) { 1242 if (hkey != 0x5001 && hkey != 0x5002) {
1222 printk(IBM_ERR 1243 printk(IBM_ERR
1223 "unknown LID-related hotkey event: 0x%04x\n", 1244 "unknown LID-related HKEY event: 0x%04x\n",
1224 hkey); 1245 hkey);
1225 send_acpi_ev = 1; 1246 send_acpi_ev = 1;
1226 } 1247 }
1227 break; 1248 break;
@@ -1240,21 +1261,17 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1240 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey); 1261 printk(IBM_NOTICE "unhandled HKEY event 0x%04x\n", hkey);
1241 send_acpi_ev = 1; 1262 send_acpi_ev = 1;
1242 } 1263 }
1243 } else {
1244 printk(IBM_ERR "unknown hotkey notification event %d\n", event);
1245 hkey = 0;
1246 send_acpi_ev = 1;
1247 }
1248 1264
1249 /* Legacy events */ 1265 /* Legacy events */
1250 if (send_acpi_ev || hotkey_report_mode < 2) 1266 if (send_acpi_ev || hotkey_report_mode < 2)
1251 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); 1267 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
1252 1268
1253 /* netlink events */ 1269 /* netlink events */
1254 if (send_acpi_ev) { 1270 if (send_acpi_ev) {
1255 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 1271 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
1256 ibm->acpi->device->dev.bus_id, 1272 ibm->acpi->device->dev.bus_id,
1257 event, hkey); 1273 event, hkey);
1274 }
1258 } 1275 }
1259} 1276}
1260 1277