[kernel/f19] Add patch to fix wifi on lenove yoga 2 series (rhbz#1021036)
Hans de Goede
jwrdegoede at fedoraproject.org
Fri Jun 27 08:51:10 UTC 2014
commit 0ffb23583d79e10d3617573af14ac59b4bedd609
Author: Hans de Goede <hdegoede at redhat.com>
Date: Fri Jun 27 10:51:14 2014 +0200
Add patch to fix wifi on lenove yoga 2 series (rhbz#1021036)
...top-Blacklist-rfkill-control-on-the-Lenov.patch | 73 ++++++++++
...top-Change-Lenovo-Yoga-2-series-rfkill-ha.patch | 138 ++++++++++++++++++++
kernel.spec | 11 ++
3 files changed, 222 insertions(+), 0 deletions(-)
---
diff --git a/0001-ideapad-laptop-Blacklist-rfkill-control-on-the-Lenov.patch b/0001-ideapad-laptop-Blacklist-rfkill-control-on-the-Lenov.patch
new file mode 100644
index 0000000..29df8d7
--- /dev/null
+++ b/0001-ideapad-laptop-Blacklist-rfkill-control-on-the-Lenov.patch
@@ -0,0 +1,73 @@
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1021036
+Upstream-status: Accepted into 3.16
+
+From ec5a006650d13c183124bd4279b95625f85efc6d Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Mon, 2 Jun 2014 17:41:00 +0200
+Subject: [PATCH 03/14] ideapad-laptop: Blacklist rfkill control on the Lenovo
+ Yoga 2 11
+
+The Lenovo Yoga 2 11 always reports everything as blocked, causing userspace
+to not even try to use the wlan / bluetooth even though they work fine.
+
+Note this patch also removes the "else priv->rfk[i] = NULL;" bit of the
+rfkill initialization, it is not necessary as the priv struct is allocated
+with kzalloc.
+
+Reported-and-tested-by: Vincent Gerris <vgerris at gmail.com>
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ drivers/platform/x86/ideapad-laptop.c | 23 ++++++++++++++++++-----
+ 1 file changed, 18 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
+index 6dd060a0bb65..219eb289a909 100644
+--- a/drivers/platform/x86/ideapad-laptop.c
++++ b/drivers/platform/x86/ideapad-laptop.c
+@@ -36,6 +36,7 @@
+ #include <linux/debugfs.h>
+ #include <linux/seq_file.h>
+ #include <linux/i8042.h>
++#include <linux/dmi.h>
+
+ #define IDEAPAD_RFKILL_DEV_NUM (3)
+
+@@ -819,6 +820,19 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
+ }
+ }
+
++/* Blacklist for devices where the ideapad rfkill interface does not work */
++static struct dmi_system_id rfkill_blacklist[] = {
++ /* The Lenovo Yoga 2 11 always reports everything as blocked */
++ {
++ .ident = "Lenovo Yoga 2 11",
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2 11"),
++ },
++ },
++ {}
++};
++
+ static int ideapad_acpi_add(struct platform_device *pdev)
+ {
+ int ret, i;
+@@ -854,11 +868,10 @@ static int ideapad_acpi_add(struct platform_device *pdev)
+ if (ret)
+ goto input_failed;
+
+- for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
+- if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
+- ideapad_register_rfkill(priv, i);
+- else
+- priv->rfk[i] = NULL;
++ if (!dmi_check_system(rfkill_blacklist)) {
++ for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
++ if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
++ ideapad_register_rfkill(priv, i);
+ }
+ ideapad_sync_rfk_state(priv);
+ ideapad_sync_touchpad_state(priv);
+--
+1.9.0
+
diff --git a/0002-ideapad-laptop-Change-Lenovo-Yoga-2-series-rfkill-ha.patch b/0002-ideapad-laptop-Change-Lenovo-Yoga-2-series-rfkill-ha.patch
new file mode 100644
index 0000000..aab1c4e
--- /dev/null
+++ b/0002-ideapad-laptop-Change-Lenovo-Yoga-2-series-rfkill-ha.patch
@@ -0,0 +1,138 @@
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1021036
+Upstream-status: Send upstream for 3.17
+
+From 0ad19912cb324f0a356a212433ec0b2a31f61acc Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede at redhat.com>
+Date: Fri, 20 Jun 2014 10:29:16 +0200
+Subject: [PATCH] ideapad-laptop: Change Lenovo Yoga 2 series rfkill handling
+
+It seems that the same problems which lead to adding an rfkill blacklist and
+putting the Lenovo Yoga 2 11 on it are also present on the Lenovo Yoga 2 13
+and Lenovo Yoga 2 Pro too:
+https://bugzilla.redhat.com/show_bug.cgi?id=1021036
+https://forums.lenovo.com/t5/Linux-Discussion/Yoga-2-13-not-Pro-Linux-Warning/m-p/1517612
+
+Testing has shown that the firmware rfkill settings are persistent over
+reboots. So blacklisting the driver is not good enough, if the wifi is blocked
+at the firmware level the wifi needs to be explictly unblocked through the
+ideapad-laptop interface.
+
+And at least on the Lenovo Yoga 2 13 the VPCCMD_RF register which on devices
+with hardware kill switch reports the hardware switch state, needs to be
+explictly set to 1 (radio enabled / not blocked).
+
+So this patch does 3 things to get proper rfkill handling on these models:
+
+1) Instead of blacklisting the rfkill functionality, which means that people
+with a firmware blocked wifi get stuck in that situation, ignore the value
+reported by the not present hardware rfkill switch, as this is what is causing
+ideapad-laptop to wrongly report all radios as hardware blocks. But do register
+the rfkill interfaces so that the user can soft [un]block them.
+
+2) On models without a hardware rfkill switch, explictly set VPCCMD_RF to 1
+
+3) Drop the " 11" postfix from the dmi match string, as the entire Yoga 2
+series is affected.
+
+Yoga 2 11:
+Reported-and-tested-by: Vincent Gerris <vgerris at gmail.com>
+
+Yoga 2 13:
+Tested-by: madls05 <http://ubuntuforums.org/showthread.php?t=2215044>
+
+Yoga 2 Pro:
+Reported-and-tested-by: Peter F. Patel-Schneider <pfpschneider at gmail.com>
+
+Signed-off-by: Hans de Goede <hdegoede at redhat.com>
+---
+ drivers/platform/x86/ideapad-laptop.c | 41 +++++++++++++++++++++++------------
+ 1 file changed, 27 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
+index b4c495a..b0e3a2e 100644
+--- a/drivers/platform/x86/ideapad-laptop.c
++++ b/drivers/platform/x86/ideapad-laptop.c
+@@ -87,6 +87,7 @@ struct ideapad_private {
+ struct backlight_device *blightdev;
+ struct dentry *debug;
+ unsigned long cfg;
++ bool has_hw_rfkill_switch;
+ };
+
+ static bool no_bt_rfkill;
+@@ -473,12 +474,14 @@ static struct rfkill_ops ideapad_rfk_ops = {
+
+ static void ideapad_sync_rfk_state(struct ideapad_private *priv)
+ {
+- unsigned long hw_blocked;
++ unsigned long hw_blocked = 0;
+ int i;
+
+- if (read_ec_data(priv->adev->handle, VPCCMD_R_RF, &hw_blocked))
+- return;
+- hw_blocked = !hw_blocked;
++ if (priv->has_hw_rfkill_switch) {
++ if (read_ec_data(priv->adev->handle, VPCCMD_R_RF, &hw_blocked))
++ return;
++ hw_blocked = !hw_blocked;
++ }
+
+ for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
+ if (priv->rfk[i])
+@@ -821,14 +824,17 @@ static void ideapad_acpi_notify(acpi_handle handle, u32 event, void *data)
+ }
+ }
+
+-/* Blacklist for devices where the ideapad rfkill interface does not work */
+-static struct dmi_system_id rfkill_blacklist[] = {
+- /* The Lenovo Yoga 2 11 always reports everything as blocked */
++/*
++ * Some ideapads don't have a hardware rfkill switch, reading VPCCMD_R_RF
++ * always results in 0 on these models, causing ideapad_laptop to wrongly
++ * report all radios as hardware-blocked.
++ */
++static struct dmi_system_id no_hw_rfkill_list[] = {
+ {
+- .ident = "Lenovo Yoga 2 11",
++ .ident = "Lenovo Yoga 2 11 / 13 / Pro",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+- DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2 11"),
++ DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"),
+ },
+ },
+ {}
+@@ -856,6 +862,7 @@ static int ideapad_acpi_add(struct platform_device *pdev)
+ priv->cfg = cfg;
+ priv->adev = adev;
+ priv->platform_device = pdev;
++ priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list);
+
+ ret = ideapad_sysfs_init(priv);
+ if (ret)
+@@ -869,11 +876,17 @@ static int ideapad_acpi_add(struct platform_device *pdev)
+ if (ret)
+ goto input_failed;
+
+- if (!dmi_check_system(rfkill_blacklist)) {
+- for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
+- if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
+- ideapad_register_rfkill(priv, i);
+- }
++ /*
++ * On some models without a hw-switch (the yoga 2 13 at least)
++ * VPCCMD_W_RF must be explicitly set to 1 for the wifi to work.
++ */
++ if (!priv->has_hw_rfkill_switch)
++ write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);
++
++ for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
++ if (test_bit(ideapad_rfk_data[i].cfgbit, &priv->cfg))
++ ideapad_register_rfkill(priv, i);
++
+ ideapad_sync_rfk_state(priv);
+ ideapad_sync_touchpad_state(priv);
+
+--
+2.0.0
+
diff --git a/kernel.spec b/kernel.spec
index ab7e03a..ed5cc94 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -777,6 +777,10 @@ Patch25108: aio-fix-aio-request-leak-when-events-are-reaped-by-u.patch
Patch25109: revert-input-wacom-testing-result-shows-get_report-is-unnecessary.patch
+#rhbz 1021036
+Patch25110: 0001-ideapad-laptop-Blacklist-rfkill-control-on-the-Lenov.patch
+Patch25111: 0002-ideapad-laptop-Change-Lenovo-Yoga-2-series-rfkill-ha.patch
+
# END OF PATCH DEFINITIONS
%endif
@@ -1497,6 +1501,10 @@ ApplyPatch aio-fix-aio-request-leak-when-events-are-reaped-by-u.patch
ApplyPatch revert-input-wacom-testing-result-shows-get_report-is-unnecessary.patch
+#rhbz 1021036
+ApplyPatch 0001-ideapad-laptop-Blacklist-rfkill-control-on-the-Lenov.patch
+ApplyPatch 0002-ideapad-laptop-Change-Lenovo-Yoga-2-series-rfkill-ha.patch
+
# END OF PATCH APPLICATIONS
%endif
@@ -2309,6 +2317,9 @@ fi
# and build.
%changelog
+* Fri Jun 27 2014 Hans de Goede <hdegoede at redhat.com>
+- Add patch to fix wifi on lenove yoga 2 series (rhbz#1021036)
+
* Thu Jun 26 2014 Justin M. Forbes <jforbes at fedoraproject.org> - 3.14.9-100
- Linux v3.14.9
More information about the scm-commits
mailing list