提交 5c29d58f 编写于 作者: H Henrique de Moraes Holschuh 提交者: Len Brown

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: NHenrique 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: NLen Brown <len.brown@intel.com>
上级 e295e850
...@@ -1014,6 +1014,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) ...@@ -1014,6 +1014,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
} }
} }
if (tp_features.hotkey_wlsw) {
set_bit(EV_SW, tpacpi_inputdev->evbit);
set_bit(SW_RADIO, tpacpi_inputdev->swbit);
}
#ifdef CONFIG_THINKPAD_ACPI_INPUT_ENABLED #ifdef CONFIG_THINKPAD_ACPI_INPUT_ENABLED
dbg_printk(TPACPI_DBG_INIT, dbg_printk(TPACPI_DBG_INIT,
"enabling hot key handling\n"); "enabling hot key handling\n");
...@@ -1062,6 +1067,15 @@ static void tpacpi_input_send_key(unsigned int scancode, ...@@ -1062,6 +1067,15 @@ static void tpacpi_input_send_key(unsigned int scancode,
} }
} }
static void tpacpi_input_send_radiosw(void)
{
int wlsw;
if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw))
input_report_switch(tpacpi_inputdev,
SW_RADIO, !!wlsw);
}
static void hotkey_notify(struct ibm_struct *ibm, u32 event) static void hotkey_notify(struct ibm_struct *ibm, u32 event)
{ {
u32 hkey; u32 hkey;
...@@ -1096,6 +1110,14 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) ...@@ -1096,6 +1110,14 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
hkey); hkey);
} }
break; break;
case 7:
/* 0x7000-0x7FFF: misc */
if (tp_features.hotkey_wlsw && hkey == 0x7000) {
tpacpi_input_send_radiosw();
sendacpi = 0;
break;
}
/* fallthrough to default */
default: default:
/* case 2: dock-related */ /* case 2: dock-related */
/* 0x2305 - T43 waking up due to bay lever eject while aslept */ /* 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,6 +1135,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
} }
} }
static void hotkey_resume(void)
{
tpacpi_input_send_radiosw();
}
/* /*
* Call with hotkey_mutex held * Call with hotkey_mutex held
*/ */
...@@ -1240,6 +1267,7 @@ static struct ibm_struct hotkey_driver_data = { ...@@ -1240,6 +1267,7 @@ static struct ibm_struct hotkey_driver_data = {
.read = hotkey_read, .read = hotkey_read,
.write = hotkey_write, .write = hotkey_write,
.exit = hotkey_exit, .exit = hotkey_exit,
.resume = hotkey_resume,
.acpi = &ibm_hotkey_acpidriver, .acpi = &ibm_hotkey_acpidriver,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册