[ibm-acpi-devel] [PATCH 4/7] ACPI: thinkpad-acpi: WLSW overrides other rfkill switches
On ThinkPads where the WLSW switch exists, the firmware or the hardware ANDs the WLSW state with the device-specific switches (WWAN, Bluetooth). It is downright impossible to enable WWAN or Bluetooth when WLSW is blocking the radios. This reality does not necessarily carry over to the WWAN and Bluetooth firmware interfaces, though... so the state thinkpad-acpi was reporting could be incorrect. Tie the three switches in the driver so that we keep their state sane. When WLSL is off, force the other switches to off as well. Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED] --- drivers/misc/thinkpad_acpi.c | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index 743a4d6..202d63e 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -2588,6 +2588,10 @@ static int bluetooth_get_radiosw(void) if (!tp_features.bluetooth) return -ENODEV; + /* WLSW overrides bluetooth in firmware/hardware, reflect that */ + if (tp_features.hotkey_wlsw !hotkey_get_wlsw(status) !status) + return 0; + if (!acpi_evalf(hkey_handle, status, GBDC, d)) return -EIO; @@ -2601,6 +2605,12 @@ static int bluetooth_set_radiosw(int radio_on) if (!tp_features.bluetooth) return -ENODEV; + /* WLSW overrides bluetooth in firmware/hardware, but there is no +* reason to risk weird behaviour. */ + if (tp_features.hotkey_wlsw !hotkey_get_wlsw(status) !status +radio_on) + return -EPERM; + if (!acpi_evalf(hkey_handle, status, GBDC, d)) return -EIO; if (radio_on) @@ -2760,6 +2770,10 @@ static int wan_get_radiosw(void) if (!tp_features.wan) return -ENODEV; + /* WLSW overrides WWAN in firmware/hardware, reflect that */ + if (tp_features.hotkey_wlsw !hotkey_get_wlsw(status) !status) + return 0; + if (!acpi_evalf(hkey_handle, status, GWAN, d)) return -EIO; @@ -2773,6 +2787,12 @@ static int wan_set_radiosw(int radio_on) if (!tp_features.wan) return -ENODEV; + /* WLSW overrides bluetooth in firmware/hardware, but there is no +* reason to risk weird behaviour. */ + if (tp_features.hotkey_wlsw !hotkey_get_wlsw(status) !status +radio_on) + return -EPERM; + if (!acpi_evalf(hkey_handle, status, GWAN, d)) return -EIO; if (radio_on) -- 1.5.5.4 - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
[ibm-acpi-devel] [PATCH 1/7] ACPI: thinkpad-acpi: minor refactor on radio switch init
Change the code of hotkey_init, wan_init and bluetooth_init a bit to make it much easier to add some Kconfig-selected debugging code later. Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED] --- drivers/misc/thinkpad_acpi.c | 49 ++--- 1 files changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index b596929..c800855 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -2167,9 +2167,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) printk(TPACPI_INFO radio switch found; radios are %s\n, enabled(status, 0)); + } + if (tp_features.hotkey_wlsw) res = add_to_attr_set(hotkey_dev_attributes, dev_attr_hotkey_radio_sw.attr); - } /* For X41t, X60t, X61t Tablets... */ if (!res acpi_evalf(hkey_handle, status, MHKG, qd)) { @@ -2646,18 +2647,19 @@ static int __init bluetooth_init(struct ibm_init_struct *iibm) str_supported(tp_features.bluetooth), status); + if (tp_features.bluetooth + !(status TP_ACPI_BLUETOOTH_HWPRESENT)) { + /* no bluetooth hardware present in system */ + tp_features.bluetooth = 0; + dbg_printk(TPACPI_DBG_INIT, + bluetooth hardware not installed\n); + } + if (tp_features.bluetooth) { - if (!(status TP_ACPI_BLUETOOTH_HWPRESENT)) { - /* no bluetooth hardware present in system */ - tp_features.bluetooth = 0; - dbg_printk(TPACPI_DBG_INIT, - bluetooth hardware not installed\n); - } else { - res = sysfs_create_group(tpacpi_pdev-dev.kobj, - bluetooth_attr_group); - if (res) - return res; - } + res = sysfs_create_group(tpacpi_pdev-dev.kobj, + bluetooth_attr_group); + if (res) + return res; } return (tp_features.bluetooth)? 0 : 1; @@ -2818,18 +2820,19 @@ static int __init wan_init(struct ibm_init_struct *iibm) str_supported(tp_features.wan), status); + if (tp_features.wan + !(status TP_ACPI_WANCARD_HWPRESENT)) { + /* no wan hardware present in system */ + tp_features.wan = 0; + dbg_printk(TPACPI_DBG_INIT, + wan hardware not installed\n); + } + if (tp_features.wan) { - if (!(status TP_ACPI_WANCARD_HWPRESENT)) { - /* no wan hardware present in system */ - tp_features.wan = 0; - dbg_printk(TPACPI_DBG_INIT, - wan hardware not installed\n); - } else { - res = sysfs_create_group(tpacpi_pdev-dev.kobj, - wan_attr_group); - if (res) - return res; - } + res = sysfs_create_group(tpacpi_pdev-dev.kobj, + wan_attr_group); + if (res) + return res; } return (tp_features.wan)? 0 : 1; -- 1.5.5.4 - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
[ibm-acpi-devel] [PATCH 2/7] ACPI: thinkpad-acpi: consolidate wlsw notification function
Rename tpacpi_input_send_radiosw() to tpacpi_send_radiosw_update(), and make it a central point to issue radio switch changed state notifications by consolidating also the poll() notification in the same function. Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED] --- drivers/misc/thinkpad_acpi.c | 39 +++ 1 files changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index c800855..9179f23 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -1285,21 +1285,6 @@ static int hotkey_status_set(int status) return 0; } -static void tpacpi_input_send_radiosw(void) -{ - int wlsw; - - if (tp_features.hotkey_wlsw !hotkey_get_wlsw(wlsw)) { - mutex_lock(tpacpi_inputdev_send_mutex); - - input_report_switch(tpacpi_inputdev, - SW_RFKILL_ALL, !!wlsw); - input_sync(tpacpi_inputdev); - - mutex_unlock(tpacpi_inputdev_send_mutex); - } -} - static void tpacpi_input_send_tabletsw(void) { int state; @@ -1921,6 +1906,22 @@ static struct attribute *hotkey_mask_attributes[] __initdata = { dev_attr_hotkey_wakeup_hotunplug_complete.attr, }; +static void tpacpi_send_radiosw_update(void) +{ + int wlsw; + + if (tp_features.hotkey_wlsw !hotkey_get_wlsw(wlsw)) { + mutex_lock(tpacpi_inputdev_send_mutex); + + input_report_switch(tpacpi_inputdev, + SW_RFKILL_ALL, !!wlsw); + input_sync(tpacpi_inputdev); + + mutex_unlock(tpacpi_inputdev_send_mutex); + } + hotkey_radio_sw_notify_change(); +} + static void hotkey_exit(void) { #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL @@ -2288,7 +2289,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) tpacpi_inputdev-close = hotkey_inputdev_close; hotkey_poll_setup_safe(1); - tpacpi_input_send_radiosw(); + tpacpi_send_radiosw_update(); tpacpi_input_send_tabletsw(); return 0; @@ -2420,8 +2421,7 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) case 7: /* 0x7000-0x7FFF: misc */ if (tp_features.hotkey_wlsw hkey == 0x7000) { - tpacpi_input_send_radiosw(); - hotkey_radio_sw_notify_change(); + tpacpi_send_radiosw_update(); send_acpi_ev = 0; break; } @@ -2464,8 +2464,7 @@ static void hotkey_resume(void) printk(TPACPI_ERR error while trying to read hot key mask from firmware\n); - tpacpi_input_send_radiosw(); - hotkey_radio_sw_notify_change(); + tpacpi_send_radiosw_update(); hotkey_tablet_mode_notify_change(); hotkey_wakeup_reason_notify_change(); hotkey_wakeup_hotunplug_complete_notify_change(); -- 1.5.5.4 - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
[ibm-acpi-devel] [PATCH 6/7] ACPI: thinkpad-acpi: bump up version to 0.21
rfkill support deserves a new version checkpoint... Signed-off-by: Henrique de Moraes Holschuh [EMAIL PROTECTED] --- Documentation/laptops/thinkpad-acpi.txt |4 ++-- drivers/misc/thinkpad_acpi.c|2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 1c1c021..02dc748 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt @@ -1,7 +1,7 @@ ThinkPad ACPI Extras Driver -Version 0.20 - April 09th, 2008 +Version 0.21 + May 29th, 2008 Borislav Deianov [EMAIL PROTECTED] Henrique de Moraes Holschuh [EMAIL PROTECTED] diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index dc8d00a..3eb01af 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c @@ -21,7 +21,7 @@ * 02110-1301, USA. */ -#define TPACPI_VERSION 0.20 +#define TPACPI_VERSION 0.21 #define TPACPI_SYSFS_VERSION 0x020200 /* -- 1.5.5.4 - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
Re: [ibm-acpi-devel] [PATCH 1/7] ACPI: thinkpad-acpi: minor refactor on radio switch init
Henrique de Moraes Holschuh wrote: Change the code of hotkey_init, wan_init and bluetooth_init a bit to make it much easier to add some Kconfig-selected debugging code later. The later seems to be wrong, the debugging code is already included? Description seems to be incomplete. -Andi - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
[ibm-acpi-devel] Typo on patch name
I think there is a small typo in the naming of this patch: http://downloads.sourceforge.net/ibm-acpi/thinkpad-acpi-0.21-20080629_v2.6.28-rc8.patch.gz Thanks for the latest round of updates, Henrique, all! -jesse -- There are 10 types of people in this world, those that can read binary and those that can not. - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel
Re: [ibm-acpi-devel] Typo on patch name
On Tue, 01 Jul 2008, [EMAIL PROTECTED] wrote: I think there is a small typo in the naming of this patch: http://downloads.sourceforge.net/ibm-acpi/thinkpad-acpi-0.21-20080629_v2.6.28-rc8.patch.gz Oops, indeed :-) will fix. Thanks for the report. -- One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie. -- The Silicon Valley Tarot Henrique Holschuh - Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 ___ ibm-acpi-devel mailing list ibm-acpi-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel