All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Barnabás Pőcze" <pobrn@protonmail.com>
To: "Ambrož Bizjak" <abizjak.pro@gmail.com>
Cc: platform-driver-x86@vger.kernel.org
Subject: Re: ideapad-laptop incorrectly sets RF-kill block on initialization
Date: Wed, 17 Mar 2021 21:11:05 +0000	[thread overview]
Message-ID: <mnJ0jnYMf3YuKnmsEAlDy3eUoYDYxLkik71c8kD1aL1bpchFA59g71nAUr8GAU0dVIhv4l4pxU4DvyMbVK5YRq9uDIcREW939N4mlqi5KIQ=@protonmail.com> (raw)
In-Reply-To: <CAJ4FQ9A=Xcom1d0fWVw+dRLX+yKAg3ACeXW=LgQEo9W-D7EfrQ@mail.gmail.com>

Hi

> I have found an issue in the ideapad-laptop driver which causes WiFi
> to not work on the Lenovo Legion Y720 laptop. It seems the issue is
> generally present on this laptop as can be found by googling and
> finding that the workaround is to blacklist ideapad-laptop.
>
> In the code comment here:
> https://github.com/torvalds/linux/blob/1df27313f50a57497c1faeb6a6ae4ca939c85a7d/drivers/platform/x86/ideapad-laptop.c#L1462
> it is explained that the driver has a list of devices which are known
> to have an RF-kill switch and for other devices it assumes that it
> does not have one. Since the list is in fact empty, one would conclude
> that the driver should never cause an RF-kill block. However on this
> laptop loading the driver has this exact effect.
>
> The reason is what seems to be a bug here:
> https://github.com/torvalds/linux/blob/1df27313f50a57497c1faeb6a6ae4ca939c85a7d/drivers/platform/x86/ideapad-laptop.c#L1001
> At initialization, ideapad_register_rfkill() sets the initial RF-kill
> block state based on reading the state of the possibly nonexisting
> RF-kill switch without considering priv->features.hw_rfkill_switch.

Note, that there are two distinct things at play here: hard and soft blocking.
The part of the code you're referring to here is concerned about the soft blocking
state. Therefore it makes sense that it does not consider the value of
features.hw_rfkill_switch.


> This is inconsistent with ideapad_sync_rfk_state() which sets
> unblocked if hw_rfkill_switch is false. The result is that
> ideapad_register_rfkill() would block but ideapad_sync_rfk_state()
> would unblock as soon as it is called. But on my laptop
> ideapad_sync_rfk_state() is presumably never called and the blocked
> state persists indefinitely. I have verified this by changing
> ideapad_register_rfkill() to use the same logic as
> ideapad_sync_rfk_state() which has fixed the problem.
>
> I am attaching a patch for master and 5.4, I have only tested the latter.
>

It seems from those patches that simply reading from that address causes
wifi not to work. Could you please add some printing to the driver without the patches
to check the value of sw_blocked? (e.g. pr_info("sw_blocked = %lu\n", sw_blocked); )
And also attach the output of the `rfkill` utility after the module loads
and wifi does not work?


Regards,
Barnabás Pőcze

      reply	other threads:[~2021-03-17 21:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-17 20:39 ideapad-laptop incorrectly sets RF-kill block on initialization Ambrož Bizjak
2021-03-17 21:11 ` Barnabás Pőcze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='mnJ0jnYMf3YuKnmsEAlDy3eUoYDYxLkik71c8kD1aL1bpchFA59g71nAUr8GAU0dVIhv4l4pxU4DvyMbVK5YRq9uDIcREW939N4mlqi5KIQ=@protonmail.com' \
    --to=pobrn@protonmail.com \
    --cc=abizjak.pro@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.