Bug 69131 - hp_wmi cannot hard-unblock wifi on HP nx6325
Summary: hp_wmi cannot hard-unblock wifi on HP nx6325
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Platform_x86 (show other bugs)
Hardware: x86-64 Linux
: P1 high
Assignee: Matthew Garrett
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-21 11:15 UTC by Adrian Knoth
Modified: 2018-06-08 19:40 UTC (History)
8 users (show)

See Also:
Kernel Version: 3.13
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
acpidump output (293.69 KB, application/octet-stream)
2014-01-21 14:09 UTC, Adrian Knoth
Details
Test patch (547 bytes, patch)
2014-01-21 14:54 UTC, Matthew Garrett
Details | Diff
Test patch v2 (851 bytes, patch)
2015-08-31 23:42 UTC, David Ward
Details | Diff

Description Adrian Knoth 2014-01-21 11:15:48 UTC
Hi!

As of 3.13, the wifi card on my HP nx6325 remains hard-blocked no matter how much I press the hardware button or run rfkill:

Oddly enough, it reports hard-blocked after trying to set the interface up.

Transcript:

chopin:~# rfkill list
2: phy2: Wireless LAN
        Soft blocked: no
        Hard blocked: yes
chopin:~# rmmod b43
chopin:~# modprobe b43
chopin:~# rfkill list
3: phy3: Wireless LAN
        Soft blocked: no
        Hard blocked: no
chopin:~# ifconfig wlan0 up
chopin:~# iwlist wlan0 scan
wlan0     Interface doesn't support scanning : Network is down

chopin:~# rfkill list
3: phy3: Wireless LAN
        Soft blocked: no
        Hard blocked: yes
--- end of transcript ---

The LED remains off all the time, it only flashes once when running "ifconfig wlan0 up", but the device isn't really up.


Needless to say it's impossible to connect via wifi, hence the raised priority.

For the sake of completeness, let me add that 3.12.8 isn't affected, so it's clearly a regression.
Comment 1 Matthew Garrett 2014-01-21 11:31:30 UTC
Does rfkill list show an hp-wmi entry on 3.12?
Comment 2 Adrian Knoth 2014-01-21 13:02:46 UTC
Yes, it does:

chopin:~# uname -a
Linux chopin 3.12.8 #2 SMP PREEMPT Tue Jan 21 13:42:16 CET 2014 x86_64 GNU/Linux
chopin:~# rfkill list
0: hp-wifi: Wireless LAN
        Soft blocked: yes
        Hard blocked: yes
1: hp-bluetooth: Bluetooth
        Soft blocked: yes
        Hard blocked: yes
2: hp-gps: GPS
        Soft blocked: yes
        Hard blocked: yes
3: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: no
Comment 3 Matthew Garrett 2014-01-21 13:27:34 UTC
Can you try reverting 997daa1bd9aca412ab97955a35b26c460c0ec7a4 and see if that helps?
Comment 4 Adrian Knoth 2014-01-21 14:09:17 UTC
This really helps. With 997daa1bd9aca412ab97955a35b26c460c0ec7a4 reverted, it works again:

chopin:~# uname -a
Linux chopin 3.13.0 #2 SMP PREEMPT Tue Jan 21 14:51:15 CET 2014 x86_64 GNU/Linux
chopin:~# rfkill list
0: hp-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: hp-bluetooth: Bluetooth
        Soft blocked: yes
        Hard blocked: no
2: hp-gps: GPS
        Soft blocked: yes
        Hard blocked: yes
3: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no


I took the liberty to attach the acpidump output of the machine in question, just in case you need to have a look at the WMI section.
Comment 5 Adrian Knoth 2014-01-21 14:09:43 UTC
Created attachment 122891 [details]
acpidump output
Comment 6 Matthew Garrett 2014-01-21 14:54:59 UTC
Created attachment 122901 [details]
Test patch

Ok. Can you reapply that commit and then test this patch?
Comment 7 Adrian Knoth 2014-01-21 15:12:50 UTC
Your patch works like a charm:

chopin:~# uname -a
Linux chopin 3.13.0 #3 SMP PREEMPT Tue Jan 21 16:06:03 CET 2014 x86_64 GNU/Linux
chopin:~# rfkill list
0: hp-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: hp-bluetooth: Bluetooth
        Soft blocked: yes
        Hard blocked: no
2: hp-gps: GPS
        Soft blocked: yes
        Hard blocked: yes
3: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no


JFTR, hp_wmi_bios_2009_later is unused for now:

drivers/platform/x86/hp-wmi.c:296:12: warning: ‘hp_wmi_bios_2009_later’ defined but not used [-Wunused-function]
 static int hp_wmi_bios_2009_later(void)
Comment 8 Matthew Garrett 2014-01-21 15:15:03 UTC
Thanks, I'll follow up with Alex and figure out the best plan here.
Comment 9 Andreas Amann 2014-04-20 22:13:23 UTC
This bug also occurs with my HP550 laptop. Wireless on this laptop worked well with kernel 3.10 (last tested) but stopped working as of 3.13 with precisely the same symptoms described above. As this is a clear regression, afix or at least some workaround would be much appreciated.
Comment 10 Adrian Knoth 2014-04-20 22:28:52 UTC
Andreas, Matthew's patch in <https://bugzilla.kernel.org/attachment.cgi?id=122901> does the trick for me (a workaround).

Have you tried it? Just apply it to the 3.13 or 3.14 kernel source.
Comment 11 Andreas Amann 2014-04-22 11:36:49 UTC
I compiled a 3.14 kernel with Matthew's patch and I confirm that it works. 
I now get:

# rfkill list
0: hp-wifi: Wireless LAN
	Soft blocked: no
	Hard blocked: no
1: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
2: hp-gps: GPS
	Soft blocked: yes
	Hard blocked: yes

while without the patch, only phy0 was listed and it was hard blocked. Pushing the wlan switch did not release the hard block.  What is strange however is that when I now rebooted once more into the old kernel, I can now unblock wlan even in the old kernel (without the patch) using the hardware switch!  Apparently something about the status of the wlan is stored between reboots? 

Anyhow, it now works for me, thanks a lot for the patch!
Comment 12 David Ward 2015-08-31 23:42:24 UTC
Created attachment 186411 [details]
Test patch v2

Adrian and Andreas,

The patch that worked for both of you was sent to the mailing list, but changes were requested. Can you please test this new patch instead? This will help with getting a fix into the kernel. Thanks.
Comment 13 Eugene A. Shatokhin 2016-02-29 14:19:44 UTC
One of our users has a similar problem on HP 6730b laptop.

OS: ROSA Linux R7 x86_64, kernel 4.1.16. 
The problem is seen with the kernel 4.4.3 as well.

'rfkill list' does not show hp-wifi, only phy0, and reports that WiFi is hard-blocked.

These kernels seem to have the first part of "Test patch v2" applied but miss the second hunk, namely:

-------------------
@@ -901,7 +906,7 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
 	gps_rfkill = NULL;
 	rfkill2_count = 0;
 
-	if (hp_wmi_bios_2009_later() || hp_wmi_rfkill_setup(device))
+	if (hp_wmi_rfkill_setup(device))
 		hp_wmi_rfkill2_setup(device);
 
 	err = device_create_file(&device->dev, &dev_attr_display);
-------------------

I applied that hunk and rebuilt hp-wmi module. After reboot, it works OK: rfkill shows "hp-wifi" and WiFi can be blocked and unblocked by the appropriate key. Thanks!

Any chances to get that part of the patch to the mainline kernel too?
Comment 14 Peter Klotz 2016-03-06 19:33:05 UTC
Same here with a HP 620 laptop. The one-line patch mentioned in Comment 13 fixes WLAN blocking. Tested with 4.1.18 LTS kernel.

Mainlining (and then backporting it to LTS kernels) would be great.
Comment 15 Akhil Vaid 2016-03-13 01:35:56 UTC
I'm afraid I can't get this to work. I'm running the 4.4.5 kernel on an HP 15-ab032tx with the rtl8723be chipset.
I recompiled the hp-wmi module and;

Before suspending, I'm (still) getting:
# rfkill list all
0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no

After suspending, this goes to:
# rfkill list all
0: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: yes

Can someone point me in the right direction?
Comment 16 David Ward 2016-03-14 15:34:27 UTC
(In reply to Akhil Vaid from comment #15)
> I'm afraid I can't get this to work. I'm running the 4.4.5 kernel on an HP
> 15-ab032tx with the rtl8723be chipset.
> I recompiled the hp-wmi module and;
> 
> Before suspending, I'm (still) getting:
> # rfkill list all
> 0: phy0: Wireless LAN
>         Soft blocked: no
>         Hard blocked: no
> 1: hci0: Bluetooth
>         Soft blocked: no
>         Hard blocked: no
> 
> After suspending, this goes to:
> # rfkill list all
> 0: phy0: Wireless LAN
>         Soft blocked: no
>         Hard blocked: yes
> 
> Can someone point me in the right direction?

When you boot your laptop and do not suspend it, does your Wi-Fi adapter work? Did it also work this way before you recompiled the hp-wmi module? If so I believe you have a different issue and need to file a separate bug. Please let us know. If you think the patch in this bug report causes a regression for you, please clarify.
Comment 17 Akhil Vaid 2016-03-14 17:12:37 UTC
I'll walk through the chronology of running into this. I hope that's helpful.

The native kernel driver for the rtl8723be doesn't work very well. So I had to make do with a USB dongle, while also blacklisting the rtl8723be module. I was able to suspend and resume successfully with this setup; with the "airplane mode" key (The only WiFi related hardware switch on this machine) toggling *only* the soft block on rfkill status.

Sometime back, I discovered newer, functional dkms drivers for the rtl8723be. (Those are here: https://github.com/lwfinger/rtlwifi_new/tree/rock.new_btcoex. It seems other people have run into this too and the author of that repo also believes this interaction is because of the hp-wmi module.)

This was the first time I actually used the card under Linux, and incidentally also when I discovered the issue with suspending the laptop. I should also emphasize that before filing this bug report, I uninstalled the dkms driver. Apart from the recompiled hp-wmi module, my kernel is a vanilla 4.4.5-1-ARCH.

So, I've run through the following permutations:
1. Blacklisted rtl8723be. WiFi dongle: Suspend/Resume works. rfkill output is the same before and after suspending:
# rfkill list all
4: phy3: Wireless LAN
        Soft blocked: no
        Hard blocked: no

2. rtl8723be only: WiFi is no longer functional upon resuming. rfkill output is what I described before (With the recompiled kernel module AND without).
WiFi is functional after rebooting.

3. rtl8723be and WiFi dongle: Only the dongle is functional upon resuming. The WiFi card remains hard blocked according to rfkill. Again, a reboot restores normalcy.
Comment 18 David Ward 2016-03-22 17:50:55 UTC
(In reply to Akhil Vaid from comment #17)
> I'll walk through the chronology of running into this. I hope that's helpful.
> 
> The native kernel driver for the rtl8723be doesn't work very well. So I had
> to make do with a USB dongle, while also blacklisting the rtl8723be module.
> I was able to suspend and resume successfully with this setup; with the
> "airplane mode" key (The only WiFi related hardware switch on this machine)
> toggling *only* the soft block on rfkill status.
> 
> Sometime back, I discovered newer, functional dkms drivers for the
> rtl8723be. (Those are here:
> https://github.com/lwfinger/rtlwifi_new/tree/rock.new_btcoex. It seems other
> people have run into this too and the author of that repo also believes this
> interaction is because of the hp-wmi module.)
> 
> This was the first time I actually used the card under Linux, and
> incidentally also when I discovered the issue with suspending the laptop. I
> should also emphasize that before filing this bug report, I uninstalled the
> dkms driver. Apart from the recompiled hp-wmi module, my kernel is a vanilla
> 4.4.5-1-ARCH.
> 
> So, I've run through the following permutations:
> 1. Blacklisted rtl8723be. WiFi dongle: Suspend/Resume works. rfkill output
> is the same before and after suspending:
> # rfkill list all
> 4: phy3: Wireless LAN
>         Soft blocked: no
>         Hard blocked: no
> 
> 2. rtl8723be only: WiFi is no longer functional upon resuming. rfkill output
> is what I described before (With the recompiled kernel module AND without).
> WiFi is functional after rebooting.
> 
> 3. rtl8723be and WiFi dongle: Only the dongle is functional upon resuming.
> The WiFi card remains hard blocked according to rfkill. Again, a reboot
> restores normalcy.

I believe you should create a separate bug for your issue. This bug pertains to older HP laptops that are always hard blocked (even at initial boot), and it has a patch that has been tested to resolve that issue for these users.
Comment 19 David Ward 2016-03-22 18:45:58 UTC
Eugene (and Peter),

(In reply to Eugene A. Shatokhin from comment #13)
> OS: ROSA Linux R7 x86_64, kernel 4.1.16. 
> The problem is seen with the kernel 4.4.3 as well.
> 
> These kernels seem to have the first part of "Test patch v2" applied [...]

Are you sure? The first part of the patch is not included in either upstream kernel version you mentioned:


https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/platform/x86/hp-wmi.c?h=v4.1.16#n716

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/platform/x86/hp-wmi.c?h=v4.4.3#n716


Note that the first part of the patch adds a second call to hp_wmi_perform_query() that appears nearly identical to the existing call -- except the second parameter is different.

Can you please test with both parts of the patch applied?
Comment 20 Eugene A. Shatokhin 2016-03-23 07:59:17 UTC
(In reply to David Ward from comment #19)
> Eugene (and Peter),
> 
> (In reply to Eugene A. Shatokhin from comment #13)
> > OS: ROSA Linux R7 x86_64, kernel 4.1.16. 
> > The problem is seen with the kernel 4.4.3 as well.
> > 
> > These kernels seem to have the first part of "Test patch v2" applied [...]
> 
> Are you sure? The first part of the patch is not included in either upstream
> kernel version you mentioned:
> 
> 
> https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/
> drivers/platform/x86/hp-wmi.c?h=v4.1.16#n716
> 
> https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/
> drivers/platform/x86/hp-wmi.c?h=v4.4.3#n716
> 
> 
> Note that the first part of the patch adds a second call to
> hp_wmi_perform_query() that appears nearly identical to the existing call --
> except the second parameter is different.

Ah, right. I did not notice it. 

> 
> Can you please test with both parts of the patch applied?

Yes, I'll prepare the kernel with the full patch and will ask our user to test it. I do not have such hardware myself unfortunately, so it might take several days.
Comment 21 Eugene A. Shatokhin 2016-03-28 08:41:55 UTC
I finally got my hands on that HP EliteBook 6930p. With the full patch, it works fine. I applied the patch to the kernel 4.1.19.

No problems with unblockable WiFi so far.

rfkill list:
0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: hp-wifi: Wireless LAN
    Soft blocked: no
    Hard blocked: no
2: hp-bluetooth: Bluetooth
    Soft blocked: yes
    Hard blocked: no
3: hp-gps: GPS
    Soft blocked: yes
    Hard blocked: yes

"hp-wifi" and others are there now. Without the patch (either full or partial), they were missing.

More hardware info and the logs from that system, in case they are needed:
http://hw.rosalinux.ru/index.php?probe=9a383897a2
Comment 22 samoht0 2016-05-29 09:50:42 UTC
I'm (most likely) hit by this issue and filed a report in Fedora's bug-tracker:
https://bugzilla.redhat.com/show_bug.cgi?id=1338025

As Laura Abbott noted and I perfectly understand, the patch can't be add in Fedora without proper credits (Signed-off-by).

@David Ward
Would you mind to submit the "Test patch v2" with Signed-off-by included? Thanks in advance.
Comment 23 David Ward 2016-06-01 15:49:57 UTC
(In reply to samoht0 from comment #22)
> Would you mind to submit the "Test patch v2" with Signed-off-by included?

I can't take credit for it either. It is a subset of a patch originally posted by Alex Hung:

http://permalink.gmane.org/gmane.linux.drivers.platform.x86.devel/5205

(The rest of his patch has either already been applied, or it is no longer relevant due to other changes.)
Comment 24 samoht0 2016-06-01 17:10:04 UTC
Thanks for the reply and the further information. This situation is rather tricky.

At least, blacklisting hp_wmi works on my machine without side-effects.
Comment 25 David Ward 2016-06-13 13:20:26 UTC
The patch has been signed off by Alex Hung and submitted to the platform-driver-x86 mailing list:

http://permalink.gmane.org/gmane.linux.drivers.platform.x86.devel/9288
Comment 26 David Ward 2016-06-28 02:07:05 UTC
@Eugene, @Peter,

Since this patch has now been sent to the mailing list, would you be able to add your "Tested-by" tag (as described in https://www.kernel.org/doc/Documentation/SubmittingPatches ) to indicate that it fixes the problem for you? This will help it get accepted in the kernel.

The original message can be downloaded in raw form from here:
http://article.gmane.org/gmane.linux.drivers.platform.x86.devel/9288/raw

You can download this as a file, open it in your mail client (e.g. with Thunderbird, go to File > Open > Saved Message), and then click "Reply All".
Comment 27 Eugene A. Shatokhin 2016-06-28 11:34:25 UTC
(In reply to David Ward from comment #26)
> @Eugene, @Peter,
> 
> Since this patch has now been sent to the mailing list, would you be able to
> add your "Tested-by" tag (as described in
> https://www.kernel.org/doc/Documentation/SubmittingPatches ) to indicate
> that it fixes the problem for you? This will help it get accepted in the
> kernel.

Sure. Done.
Comment 28 David Ward 2018-06-03 02:25:34 UTC
@Matthew Garrett: Please change status to "resolved" and resolution to "code fix".

Committed for v4.8: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc8a601e1175ae351f662506030f9939cb7fdbfe

Note You need to log in before you can comment on or make changes to this bug.