aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-01-08 10:02:40 -0500
committerLen Brown <len.brown@intel.com>2008-02-01 22:26:06 -0500
commitb7c8c200bfbf523ea0a72fd8a5e39089c74da371 (patch)
tree82adde8d0c034c9e0d954deddfad41ef08eaa806 /drivers/misc/thinkpad_acpi.c
parentb2c985e7eba858a1765db6d56bdd4df775f53633 (diff)
ACPI: thinkpad-acpi: prepare for NVRAM polling support
Make some small internal thinkpad-acpi changes to the hotkey subdriver code that will make it easier to add NVRAM polling support. 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/thinkpad_acpi.c')
-rw-r--r--drivers/misc/thinkpad_acpi.c82
1 files changed, 42 insertions, 40 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index 49d4f4af759e..e7ac1c8a5541 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -852,6 +852,46 @@ static int hotkey_status_set(int status)
852 return 0; 852 return 0;
853} 853}
854 854
855static void tpacpi_input_send_radiosw(void)
856{
857 int wlsw;
858
859 mutex_lock(&tpacpi_inputdev_send_mutex);
860
861 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
862 input_report_switch(tpacpi_inputdev,
863 SW_RADIO, !!wlsw);
864 input_sync(tpacpi_inputdev);
865 }
866
867 mutex_unlock(&tpacpi_inputdev_send_mutex);
868}
869
870static void tpacpi_input_send_key(unsigned int scancode)
871{
872 unsigned int keycode;
873
874 keycode = hotkey_keycode_map[scancode];
875
876 if (keycode != KEY_RESERVED) {
877 mutex_lock(&tpacpi_inputdev_send_mutex);
878
879 input_report_key(tpacpi_inputdev, keycode, 1);
880 if (keycode == KEY_UNKNOWN)
881 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
882 scancode);
883 input_sync(tpacpi_inputdev);
884
885 input_report_key(tpacpi_inputdev, keycode, 0);
886 if (keycode == KEY_UNKNOWN)
887 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
888 scancode);
889 input_sync(tpacpi_inputdev);
890
891 mutex_unlock(&tpacpi_inputdev_send_mutex);
892 }
893}
894
855/* sysfs hotkey enable ------------------------------------------------- */ 895/* sysfs hotkey enable ------------------------------------------------- */
856static ssize_t hotkey_enable_show(struct device *dev, 896static ssize_t hotkey_enable_show(struct device *dev,
857 struct device_attribute *attr, 897 struct device_attribute *attr,
@@ -1290,47 +1330,10 @@ static void hotkey_exit(void)
1290 } 1330 }
1291} 1331}
1292 1332
1293static void tpacpi_input_send_key(unsigned int scancode,
1294 unsigned int keycode)
1295{
1296 if (keycode != KEY_RESERVED) {
1297 mutex_lock(&tpacpi_inputdev_send_mutex);
1298
1299 input_report_key(tpacpi_inputdev, keycode, 1);
1300 if (keycode == KEY_UNKNOWN)
1301 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
1302 scancode);
1303 input_sync(tpacpi_inputdev);
1304
1305 input_report_key(tpacpi_inputdev, keycode, 0);
1306 if (keycode == KEY_UNKNOWN)
1307 input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN,
1308 scancode);
1309 input_sync(tpacpi_inputdev);
1310
1311 mutex_unlock(&tpacpi_inputdev_send_mutex);
1312 }
1313}
1314
1315static void tpacpi_input_send_radiosw(void)
1316{
1317 int wlsw;
1318
1319 mutex_lock(&tpacpi_inputdev_send_mutex);
1320
1321 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) {
1322 input_report_switch(tpacpi_inputdev,
1323 SW_RADIO, !!wlsw);
1324 input_sync(tpacpi_inputdev);
1325 }
1326
1327 mutex_unlock(&tpacpi_inputdev_send_mutex);
1328}
1329
1330static void hotkey_notify(struct ibm_struct *ibm, u32 event) 1333static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1331{ 1334{
1332 u32 hkey; 1335 u32 hkey;
1333 unsigned int keycode, scancode; 1336 unsigned int scancode;
1334 int send_acpi_ev; 1337 int send_acpi_ev;
1335 int ignore_acpi_ev; 1338 int ignore_acpi_ev;
1336 1339
@@ -1363,8 +1366,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1363 scancode = hkey & 0xfff; 1366 scancode = hkey & 0xfff;
1364 if (scancode > 0 && scancode < 0x21) { 1367 if (scancode > 0 && scancode < 0x21) {
1365 scancode--; 1368 scancode--;
1366 keycode = hotkey_keycode_map[scancode]; 1369 tpacpi_input_send_key(scancode);
1367 tpacpi_input_send_key(scancode, keycode);
1368 } else { 1370 } else {
1369 printk(IBM_ERR 1371 printk(IBM_ERR
1370 "hotkey 0x%04x out of range for keyboard map\n", 1372 "hotkey 0x%04x out of range for keyboard map\n",