[PATCH] dell-laptop: Add hwswitch_only module parameter

From: Keng-Yu Lin
Date: Wed Oct 06 2010 - 23:31:21 EST


Some BIOS does not report the correct state of the wireless killswitch
in the return value of SMI Class 17, Select 11.

This causes the killswitch to always stay as soft-blocked once the rfkill
hotkey is pressed.

This patch adds a module parameter to work around this by disregarding
the software rfkill and using only Bit 16 in the return value of
SMI Class 17, Select 11 as the hardware killswitch.

Signed-off-by: Keng-Yu Lin <keng-yu.lin@xxxxxxxxxxxxx>
---
drivers/platform/x86/dell-laptop.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

This patch is intended to work around the buggy BIOS.

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 4413975..a105d7e 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -74,6 +74,8 @@ static struct rfkill *wifi_rfkill;
static struct rfkill *bluetooth_rfkill;
static struct rfkill *wwan_rfkill;

+static bool hwswitch_only;
+
static const struct dmi_system_id __initdata dell_device_table[] = {
{
.ident = "Dell laptop",
@@ -314,7 +316,8 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
status = buffer->output[1];
release_buffer();

- rfkill_set_sw_state(rfkill, !!(status & BIT(bit)));
+ if (!hwswitch_only)
+ rfkill_set_sw_state(rfkill, !!(status & BIT(bit)));

if (hwswitch_state & (BIT(hwswitch_bit)))
rfkill_set_hw_state(rfkill, !(status & BIT(16)));
@@ -630,6 +633,9 @@ static void __exit dell_exit(void)
module_init(dell_init);
module_exit(dell_exit);

+module_param(hwswitch_only, bool, 0644);
+MODULE_PARM_DESC(hwswitch_only, "Use the hardware rfkill only");
+
MODULE_AUTHOR("Matthew Garrett <mjg@xxxxxxxxxx>");
MODULE_DESCRIPTION("Dell laptop driver");
MODULE_LICENSE("GPL");
--
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/