diff options
author | Henrique de Moraes Holschuh <hmh@hmh.eng.br> | 2009-12-15 18:51:06 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-12-15 23:57:00 -0500 |
commit | d89a727aff649f6768f7a34ee57f031ebf8bab4c (patch) | |
tree | ebe7489016c4c64dfc6c33b143242824b4666bce /drivers/platform | |
parent | 792979c8032b8f5adb77ea986db7082fff04c8e7 (diff) |
thinkpad-acpi: sync input device EV_SW initial state
Before we register the input device, sync the input layer EV_SW state
through a call to input_report_switch(), to avoid issuing a gratuitous
event for the initial state of these switches.
This fixes some annoyances caused by the interaction with rfkill and
EV_SW SW_RFKILL_ALL events.
Reported-by: Kevin Locke <kevin@kevinlocke.name>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 53d6c3318069..3daf349ddc98 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -3186,6 +3186,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3186 | int res, i; | 3186 | int res, i; |
3187 | int status; | 3187 | int status; |
3188 | int hkeyv; | 3188 | int hkeyv; |
3189 | bool radiosw_state = false; | ||
3190 | bool tabletsw_state = false; | ||
3189 | 3191 | ||
3190 | unsigned long quirks; | 3192 | unsigned long quirks; |
3191 | 3193 | ||
@@ -3291,6 +3293,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3291 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES | 3293 | #ifdef CONFIG_THINKPAD_ACPI_DEBUGFACILITIES |
3292 | if (dbg_wlswemul) { | 3294 | if (dbg_wlswemul) { |
3293 | tp_features.hotkey_wlsw = 1; | 3295 | tp_features.hotkey_wlsw = 1; |
3296 | radiosw_state = !!tpacpi_wlsw_emulstate; | ||
3294 | printk(TPACPI_INFO | 3297 | printk(TPACPI_INFO |
3295 | "radio switch emulation enabled\n"); | 3298 | "radio switch emulation enabled\n"); |
3296 | } else | 3299 | } else |
@@ -3298,6 +3301,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3298 | /* Not all thinkpads have a hardware radio switch */ | 3301 | /* Not all thinkpads have a hardware radio switch */ |
3299 | if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { | 3302 | if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { |
3300 | tp_features.hotkey_wlsw = 1; | 3303 | tp_features.hotkey_wlsw = 1; |
3304 | radiosw_state = !!status; | ||
3301 | printk(TPACPI_INFO | 3305 | printk(TPACPI_INFO |
3302 | "radio switch found; radios are %s\n", | 3306 | "radio switch found; radios are %s\n", |
3303 | enabled(status, 0)); | 3307 | enabled(status, 0)); |
@@ -3309,11 +3313,11 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3309 | /* For X41t, X60t, X61t Tablets... */ | 3313 | /* For X41t, X60t, X61t Tablets... */ |
3310 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { | 3314 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { |
3311 | tp_features.hotkey_tablet = 1; | 3315 | tp_features.hotkey_tablet = 1; |
3316 | tabletsw_state = !!(status & TP_HOTKEY_TABLET_MASK); | ||
3312 | printk(TPACPI_INFO | 3317 | printk(TPACPI_INFO |
3313 | "possible tablet mode switch found; " | 3318 | "possible tablet mode switch found; " |
3314 | "ThinkPad in %s mode\n", | 3319 | "ThinkPad in %s mode\n", |
3315 | (status & TP_HOTKEY_TABLET_MASK)? | 3320 | (tabletsw_state) ? "tablet" : "laptop"); |
3316 | "tablet" : "laptop"); | ||
3317 | res = add_to_attr_set(hotkey_dev_attributes, | 3321 | res = add_to_attr_set(hotkey_dev_attributes, |
3318 | &dev_attr_hotkey_tablet_mode.attr); | 3322 | &dev_attr_hotkey_tablet_mode.attr); |
3319 | } | 3323 | } |
@@ -3364,9 +3368,13 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3364 | 3368 | ||
3365 | if (tp_features.hotkey_wlsw) { | 3369 | if (tp_features.hotkey_wlsw) { |
3366 | input_set_capability(tpacpi_inputdev, EV_SW, SW_RFKILL_ALL); | 3370 | input_set_capability(tpacpi_inputdev, EV_SW, SW_RFKILL_ALL); |
3371 | input_report_switch(tpacpi_inputdev, | ||
3372 | SW_RFKILL_ALL, radiosw_state); | ||
3367 | } | 3373 | } |
3368 | if (tp_features.hotkey_tablet) { | 3374 | if (tp_features.hotkey_tablet) { |
3369 | input_set_capability(tpacpi_inputdev, EV_SW, SW_TABLET_MODE); | 3375 | input_set_capability(tpacpi_inputdev, EV_SW, SW_TABLET_MODE); |
3376 | input_report_switch(tpacpi_inputdev, | ||
3377 | SW_TABLET_MODE, tabletsw_state); | ||
3370 | } | 3378 | } |
3371 | 3379 | ||
3372 | /* Do not issue duplicate brightness change events to | 3380 | /* Do not issue duplicate brightness change events to |
@@ -3433,8 +3441,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3433 | tpacpi_inputdev->close = &hotkey_inputdev_close; | 3441 | tpacpi_inputdev->close = &hotkey_inputdev_close; |
3434 | 3442 | ||
3435 | hotkey_poll_setup_safe(true); | 3443 | hotkey_poll_setup_safe(true); |
3436 | tpacpi_send_radiosw_update(); | ||
3437 | tpacpi_input_send_tabletsw(); | ||
3438 | 3444 | ||
3439 | return 0; | 3445 | return 0; |
3440 | 3446 | ||