diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2007-07-18 22:45:38 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-07-21 23:46:31 -0400 |
commit | 5c29d58f471099401513e2e567f6c28001bb0f13 (patch) | |
tree | c914d46ce92a87ba88dde864ff739635b698bb08 /drivers/misc | |
parent | e295e8508c1dd56e06c73e78a2f67f2eb563e74f (diff) |
ACPI: thinkpad-acpi: export EV_SW SW_RADIO events
The expected user case for the radio slider switch on a ThinkPad includes
interfacing to applications, so that the user gets an offer to find and
associate with a wireless network when the switch is changed from disabled
to enabled (ThinkVantage suite).
Export the information about the switch state, and switch change events as
an EV_SW SW_RADIO event over the input layer.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Ivo van Doorn <ivdoorn@gmail.com>
Cc: Richard Hughes <hughsient@gmail.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 78914bf2166d..cfef218c4513 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -1014,6 +1014,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
1014 | } | 1014 | } |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | if (tp_features.hotkey_wlsw) { | ||
1018 | set_bit(EV_SW, tpacpi_inputdev->evbit); | ||
1019 | set_bit(SW_RADIO, tpacpi_inputdev->swbit); | ||
1020 | } | ||
1021 | |||
1017 | #ifdef CONFIG_THINKPAD_ACPI_INPUT_ENABLED | 1022 | #ifdef CONFIG_THINKPAD_ACPI_INPUT_ENABLED |
1018 | dbg_printk(TPACPI_DBG_INIT, | 1023 | dbg_printk(TPACPI_DBG_INIT, |
1019 | "enabling hot key handling\n"); | 1024 | "enabling hot key handling\n"); |
@@ -1062,6 +1067,15 @@ static void tpacpi_input_send_key(unsigned int scancode, | |||
1062 | } | 1067 | } |
1063 | } | 1068 | } |
1064 | 1069 | ||
1070 | static void tpacpi_input_send_radiosw(void) | ||
1071 | { | ||
1072 | int wlsw; | ||
1073 | |||
1074 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) | ||
1075 | input_report_switch(tpacpi_inputdev, | ||
1076 | SW_RADIO, !!wlsw); | ||
1077 | } | ||
1078 | |||
1065 | static void hotkey_notify(struct ibm_struct *ibm, u32 event) | 1079 | static void hotkey_notify(struct ibm_struct *ibm, u32 event) |
1066 | { | 1080 | { |
1067 | u32 hkey; | 1081 | u32 hkey; |
@@ -1096,6 +1110,14 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
1096 | hkey); | 1110 | hkey); |
1097 | } | 1111 | } |
1098 | break; | 1112 | break; |
1113 | case 7: | ||
1114 | /* 0x7000-0x7FFF: misc */ | ||
1115 | if (tp_features.hotkey_wlsw && hkey == 0x7000) { | ||
1116 | tpacpi_input_send_radiosw(); | ||
1117 | sendacpi = 0; | ||
1118 | break; | ||
1119 | } | ||
1120 | /* fallthrough to default */ | ||
1099 | default: | 1121 | default: |
1100 | /* case 2: dock-related */ | 1122 | /* case 2: dock-related */ |
1101 | /* 0x2305 - T43 waking up due to bay lever eject while aslept */ | 1123 | /* 0x2305 - T43 waking up due to bay lever eject while aslept */ |
@@ -1113,6 +1135,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
1113 | } | 1135 | } |
1114 | } | 1136 | } |
1115 | 1137 | ||
1138 | static void hotkey_resume(void) | ||
1139 | { | ||
1140 | tpacpi_input_send_radiosw(); | ||
1141 | } | ||
1142 | |||
1116 | /* | 1143 | /* |
1117 | * Call with hotkey_mutex held | 1144 | * Call with hotkey_mutex held |
1118 | */ | 1145 | */ |
@@ -1240,6 +1267,7 @@ static struct ibm_struct hotkey_driver_data = { | |||
1240 | .read = hotkey_read, | 1267 | .read = hotkey_read, |
1241 | .write = hotkey_write, | 1268 | .write = hotkey_write, |
1242 | .exit = hotkey_exit, | 1269 | .exit = hotkey_exit, |
1270 | .resume = hotkey_resume, | ||
1243 | .acpi = &ibm_hotkey_acpidriver, | 1271 | .acpi = &ibm_hotkey_acpidriver, |
1244 | }; | 1272 | }; |
1245 | 1273 | ||