From 7da8fb27eff04e7283d24b0e483c300c8b1a9f5c Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sat, 23 Nov 2013 21:02:51 +0800 Subject: dell-laptop: fix to return error code in dell_send_intensity() Fix to return error code instead always return 0 from function dell_send_intensity(). Signed-off-by: Wei Yongjun Signed-off-by: Matthew Garrett --- drivers/platform/x86/dell-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/platform/x86/dell-laptop.c') diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index c608b1d33f4a..9d7d6a02ae07 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -684,7 +684,7 @@ static int dell_send_intensity(struct backlight_device *bd) out: release_buffer(); - return 0; + return ret; } static int dell_get_intensity(struct backlight_device *bd) -- cgit v1.2.3 From ba5194f18637a95692b5d146004d1aa8be08c525 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Dec 2013 12:17:27 +0100 Subject: dell-laptop: rkill whitelist Precision models Given that Precision mobile workstations are top of the line Dell products, I expect the functionality of rfkill there to be as reliable as on Latitudes so whitelist Precisions. https://bugzilla.kernel.org/show_bug.cgi?id=65731 Reported-by: Calum Lind Signed-off-by: Hans de Goede Signed-off-by: Matthew Garrett --- drivers/platform/x86/dell-laptop.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'drivers/platform/x86/dell-laptop.c') diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 9d7d6a02ae07..d2ceb761a7a2 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -562,16 +562,19 @@ static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); static int __init dell_setup_rfkill(void) { - int status; - int ret; + int status, ret, whitelisted; const char *product; /* - * rfkill causes trouble on various non Latitudes, according to Dell - * actually testing the rfkill functionality is only done on Latitudes. + * rfkill support causes trouble on various models, mostly Inspirons. + * So we whitelist certain series, and don't support rfkill on others. */ + whitelisted = 0; product = dmi_get_system_info(DMI_PRODUCT_NAME); - if (!force_rfkill && (!product || strncmp(product, "Latitude", 8))) + if (product && (strncmp(product, "Latitude", 8) == 0 || + strncmp(product, "Precision", 9) == 0)) + whitelisted = 1; + if (!force_rfkill && !whitelisted) return 0; get_buffer(); -- cgit v1.2.3 From 97f440c23f2b02fac8af0558cba9ca0bed603794 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 24 Dec 2013 20:34:01 +0100 Subject: dell-laptop: Only install the i8042 filter when rfkill is active Installing the i8042 filter is not useful on machines where rfkill is not whitelisted, so move the filter installation into dell_setup_rfkill, after the whitelist check. This avoids doing a needless and potentially troublesome rfkill query (dell_send_request(buf, 17, 11)) when the wireless Fn key gets pressed on non whitelisted laptops. This patch was written as a result of: https://bugzilla.redhat.com/show_bug.cgi?id=1045807 It is not yet clear if this is related, but it is a good idea to not register the i8042 filter in general. Signed-off-by: Hans de Goede Signed-off-by: Matthew Garrett --- drivers/platform/x86/dell-laptop.c | 63 +++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 31 deletions(-) (limited to 'drivers/platform/x86/dell-laptop.c') diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index d2ceb761a7a2..fed4111ac31a 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -559,6 +559,29 @@ static void dell_update_rfkill(struct work_struct *ignored) } static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); +static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str, + struct serio *port) +{ + static bool extended; + + if (str & 0x20) + return false; + + if (unlikely(data == 0xe0)) { + extended = true; + return false; + } else if (unlikely(extended)) { + switch (data) { + case 0x8: + schedule_delayed_work(&dell_rfkill_work, + round_jiffies_relative(HZ / 4)); + break; + } + extended = false; + } + + return false; +} static int __init dell_setup_rfkill(void) { @@ -636,7 +659,16 @@ static int __init dell_setup_rfkill(void) goto err_wwan; } + ret = i8042_install_filter(dell_laptop_i8042_filter); + if (ret) { + pr_warn("Unable to install key filter\n"); + goto err_filter; + } + return 0; +err_filter: + if (wwan_rfkill) + rfkill_unregister(wwan_rfkill); err_wwan: rfkill_destroy(wwan_rfkill); if (bluetooth_rfkill) @@ -758,30 +790,6 @@ static void touchpad_led_exit(void) led_classdev_unregister(&touchpad_led); } -static bool dell_laptop_i8042_filter(unsigned char data, unsigned char str, - struct serio *port) -{ - static bool extended; - - if (str & 0x20) - return false; - - if (unlikely(data == 0xe0)) { - extended = true; - return false; - } else if (unlikely(extended)) { - switch (data) { - case 0x8: - schedule_delayed_work(&dell_rfkill_work, - round_jiffies_relative(HZ / 4)); - break; - } - extended = false; - } - - return false; -} - static int __init dell_init(void) { int max_intensity = 0; @@ -831,12 +839,6 @@ static int __init dell_init(void) goto fail_rfkill; } - ret = i8042_install_filter(dell_laptop_i8042_filter); - if (ret) { - pr_warn("Unable to install key filter\n"); - goto fail_filter; - } - if (quirks && quirks->touchpad_led) touchpad_led_init(&platform_device->dev); @@ -888,7 +890,6 @@ static int __init dell_init(void) fail_backlight: i8042_remove_filter(dell_laptop_i8042_filter); cancel_delayed_work_sync(&dell_rfkill_work); -fail_filter: dell_cleanup_rfkill(); fail_rfkill: free_page((unsigned long)bufferpage); -- cgit v1.2.3