* [PATCH] platform/x86: ideapad-laptop: Fix rfkill invert
@ 2018-05-24 13:32 Oleg Keri
2018-05-31 12:02 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Oleg Keri @ 2018-05-24 13:32 UTC (permalink / raw)
Cc: Oleg Keri, Ike Panhc, Darren Hart, Andy Shevchenko,
platform-driver-x86, linux-kernel
There are a lot of reports on the Internet about rfkill lock on
modern Yoga Ideapad laptops while loading ideapad_laptop platform module.
This patch offers the fix. Obviously it's impossible for me
to test this patch on all ideapad laptops, so i've made an module
parameter init_rfkill_inverted to keep old behavior. Comments are
welcome.
Signed-off-by: Oleg Keri <ezhi99@gmail.com>
---
drivers/platform/x86/ideapad-laptop.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c
index 535199c9e6bc..1eeda7bc74a3 100644
--- a/drivers/platform/x86/ideapad-laptop.c
+++ b/drivers/platform/x86/ideapad-laptop.c
@@ -110,6 +110,10 @@ static bool no_bt_rfkill;
module_param(no_bt_rfkill, bool, 0444);
MODULE_PARM_DESC(no_bt_rfkill, "No rfkill for bluetooth.");
+static bool init_rfkill_inverted;
+module_param(init_rfkill_inverted, bool, 0444);
+MODULE_PARM_DESC(init_rfkill_inverted, "Invert rfkill on initialization");
+
/*
* ACPI Helpers
*/
@@ -604,7 +608,9 @@ static int ideapad_register_rfkill(struct ideapad_private *priv, int dev)
&sw_blocked)) {
rfkill_init_sw_state(priv->rfk[dev], 0);
} else {
- sw_blocked = !sw_blocked;
+ /* Do not apply invert for ideapads which haven't hw switch */
+ if (priv->has_hw_rfkill_switch || init_rfkill_inverted)
+ sw_blocked = !sw_blocked;
rfkill_init_sw_state(priv->rfk[dev], sw_blocked);
}
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: ideapad-laptop: Fix rfkill invert
2018-05-24 13:32 [PATCH] platform/x86: ideapad-laptop: Fix rfkill invert Oleg Keri
@ 2018-05-31 12:02 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2018-05-31 12:02 UTC (permalink / raw)
To: Oleg Keri
Cc: Ike Panhc, Darren Hart, Andy Shevchenko, Platform Driver,
Linux Kernel Mailing List
On Thu, May 24, 2018 at 4:32 PM, Oleg Keri <ezhi99@gmail.com> wrote:
> There are a lot of reports on the Internet about rfkill lock on
> modern Yoga Ideapad laptops while loading ideapad_laptop platform module.
> This patch offers the fix. Obviously it's impossible for me
> to test this patch on all ideapad laptops, so i've made an module
> parameter init_rfkill_inverted to keep old behavior.
> Comments are
> welcome.
So, it should have RFC in the Subject.
> +static bool init_rfkill_inverted;
> +module_param(init_rfkill_inverted, bool, 0444);
> +MODULE_PARM_DESC(init_rfkill_inverted, "Invert rfkill on initialization");
Module parameters are subject to not being added anymore (yes, there
are some significantly rare cases when it makes sense).
> + /* Do not apply invert for ideapads which haven't hw switch */
> + if (priv->has_hw_rfkill_switch || init_rfkill_inverted)
> + sw_blocked = !sw_blocked;
Since this is under else branch of reading value from Embedded
Controller, we need to understand what and why it returns.
For me a solution rather would be not to read EC value at all in case
of no hw switch, but I also can't test that on many possible laptops.
Would be good to get a comment from Ike.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-31 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-24 13:32 [PATCH] platform/x86: ideapad-laptop: Fix rfkill invert Oleg Keri
2018-05-31 12:02 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox