æ åï2011-03-19 æ 07:46 +0800ïLee, Chun-Yi æåï > Acer WMI hotkey event's result include current device status, just > need sync the status to killswitch after acer-wmi driver receive > hotkey event but not always poll device status. This is good for > performance. > > But, if use EC raw mode, Acer BIOS will not emit wmi event and > leave EC to control device status. So, still startup polling job > when doesn't detect WMI event GUID or user choice to use ec_raw_mode. > > Tested on Acer TravelMate 8572 notebook. > > Cc: Carlos Corbacho <carlos@xxxxxxxxxxxxxxxxxxx> > Cc: Matthew Garrett <mjg@xxxxxxxxxx> > Cc: Dmitry Torokhov <dtor@xxxxxxx> > Cc: Corentin Chary <corentincj@xxxxxxxxxx> > Cc: Thomas Renninger <trenn@xxxxxxx> > Signed-off-by: Lee, Chun-Yi <jlee@xxxxxxxxxx> > --- > drivers/platform/x86/acer-wmi.c | 20 ++++++++++++++++++-- > 1 files changed, 18 insertions(+), 2 deletions(-) > > diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c > index 1953c70..9764ddc 100644 > --- a/drivers/platform/x86/acer-wmi.c > +++ b/drivers/platform/x86/acer-wmi.c > @@ -1224,14 +1224,17 @@ static int acer_rfkill_init(struct device *dev) > } > } > > - schedule_delayed_work(&acer_rfkill_work, round_jiffies_relative(HZ)); > + if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) > + schedule_delayed_work(&acer_rfkill_work, > + round_jiffies_relative(HZ)); > > return 0; > } > > static void acer_rfkill_exit(void) > { > - cancel_delayed_work_sync(&acer_rfkill_work); > + if (ec_raw_mode || !wmi_has_guid(ACERWMID_EVENT_GUID)) > + cancel_delayed_work_sync(&acer_rfkill_work); > > rfkill_unregister(wireless_rfkill); > rfkill_destroy(wireless_rfkill); > @@ -1332,6 +1335,19 @@ static void acer_wmi_notify(u32 value, void *context) > return_value.key_num, 1, true)) > pr_warning("Unknown key number - 0x%x\n", > return_value.key_num); > + if (return_value.device_state) { > + u16 device_state = return_value.device_state; > + pr_debug("deivces states: 0x%x\n", device_state); > + if (has_cap(ACER_CAP_WIRELESS)) > + rfkill_set_sw_state(wireless_rfkill, > + !(device_state & ACER_WMID3_GDS_WIRELESS)); > + if (has_cap(ACER_CAP_BLUETOOTH)) > + rfkill_set_sw_state(bluetooth_rfkill, > + !(device_state & ACER_WMID3_GDS_BLUETOOTH)); > + if (has_cap(ACER_CAP_THREEG)) > + rfkill_set_sw_state(threeg_rfkill, > + !(device_state & ACER_WMID3_GDS_THREEG)); > + } > break; > default: > pr_warning("Unknown function number - %d - %d\n", That will be better move the set devices state to before send out key event when rfkill-input enabled: @@ -1338,6 +1341,19 @@ static void acer_wmi_notify(u32 value, void *context) switch (return_value.function) { case WMID_HOTKEY_EVENT: + if (return_value.device_state) { + u16 device_state = return_value.device_state; + pr_debug("deivces states: 0x%x\n", device_state); + if (has_cap(ACER_CAP_WIRELESS)) + rfkill_set_sw_state(wireless_rfkill, + !(device_state & ACER_WMID3_GDS_WIRELESS)); + if (has_cap(ACER_CAP_BLUETOOTH)) + rfkill_set_sw_state(bluetooth_rfkill, + !(device_state & ACER_WMID3_GDS_BLUETOOTH)); + if (has_cap(ACER_CAP_THREEG)) + rfkill_set_sw_state(threeg_rfkill, + !(device_state & ACER_WMID3_GDS_THREEG)); + } if (!sparse_keymap_report_event(acer_wmi_input_dev, return_value.key_num, 1, true)) pr_warning("Unknown key number - 0x%x\n", Will send out v2 patch for review. Thank's Joey Lee -- To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html