Regression in 4.2.x: in airplane mode each time I open my laptop lid
Quoted 4 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issue
Pali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 11 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 4 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Hi! This looks strange. Driver dell_rbnt is just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. But dell_rbnt driver itself cannot set or change wireless rfkill or airplane mode.
So my opinion is that BIOS/ACPI could send such event, dell_rbnt then propagate it into userspace and some application process it and do something...
Signature · 2 lines
Pali Rohár [email protected]
Quoted 13 lines · On Wednesday 21 October 2015 11:19:54 Pali Rohár wrote:
Quoted 11 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 4 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Quoted 9 lines
Hi! This looks strange. Driver
dell_rbntis just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. Butdell_rbntdriver itself cannot set or change wireless rfkill or airplane mode.So my opinion is that BIOS/ACPI could send such event,
dell_rbntthen propagate it into userspace and some application process it and do something...
CCing Gabriele, owner of XPS machine too. Have you seen similar problems with dell_rbtn as described in above bug report?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 19 lines · Pali Rohár
Quoted 18 lines · On Wednesday 21 October 2015 11:19:54 Pali Rohár wrote:
Quoted 11 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 4 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Hi! This looks strange. Driver
dell_rbntis just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. Butdell_rbntdriver itself cannot set or change wireless rfkill or airplane mode.
Quoted 7 lines
Quoted 4 lines
So my opinion is that BIOS/ACPI could send such event,
dell_rbntthen propagate it into userspace and some application process it and do something...CCing Gabriele, owner of XPS machine too. Have you seen similar problems with
dell_rbtnas described in above bug report?
Here's some context I've gathered. I haven't drawn any conclusions from this, but perhaps you will find it useful:
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
http://www.trustedreviews.com/dell-xps-13-2015-photos-11
I see in the journal that systemd is working with two rfkill devices (8 and 9), and that dell-wmi is emitting unknown key events (e00e). This key is of course not in the dell_wmi_legacy_keymap, but it would land right after 0xe00d, labeled as a BIOS error.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
2015-10-21 13:12 GMT+02:00 Darren Hart <[email protected]>:
Quoted 20 lines · Pali Rohár
Quoted 19 lines · On Wednesday 21 October 2015 11:19:54 Pali Rohár wrote:
Quoted 18 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 11 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
Quoted 4 lines
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Hi! This looks strange. Driver
dell_rbntis just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. Butdell_rbntdriver itself cannot set or change wireless rfkill or airplane mode.
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
So my opinion is that BIOS/ACPI could send such event,
dell_rbntthen propagate it into userspace and some application process it and do something...CCing Gabriele, owner of XPS machine too. Have you seen similar problems with
dell_rbtnas described in above bug report?
I'll look into this ASAP. I haven't been using dell_rbtn not to disable the hardware switch, but I didn't notice anything strange the last time I tested it.
Quoted 11 lines
Here's some context I've gathered. I haven't drawn any conclusions from this, but perhaps you will find it useful:
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
http://www.trustedreviews.com/dell-xps-13-2015-photos-11
I see in the journal that systemd is working with two rfkill devices (8 and 9), and that dell-wmi is emitting unknown key events (e00e). This key is of course not in the
dell_wmi_legacy_keymap, but it would land right after0xe00d, labeled as a BIOS error.
e00e is some battery related event that is sent when some ACPI methods are executed. I know it's sent upon resume. I thought about adding it to the ignore list, but then I completely forgot. I'm not sure it has the same meaning on all the laptops, but I don't think it's something we care about.
Quoted 3 lines
--
Darren Hart
Intel Open Source Technology Center
2015-10-21 13:42 GMT+02:00 Gabriele Mazzotta <[email protected]>:
Quoted 26 lines
2015-10-21 13:12 GMT+02:00 Darren Hart <[email protected]>:
Quoted 25 lines · Pali Rohár
Quoted 24 lines · On Wednesday 21 October 2015 11:19:54 Pali Rohár wrote:
Quoted 22 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 11 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
Quoted 4 lines
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Hi! This looks strange. Driver
dell_rbntis just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. Butdell_rbntdriver itself cannot set or change wireless rfkill or airplane mode.So my opinion is that BIOS/ACPI could send such event,
dell_rbntthen propagate it into userspace and some application process it and do something...
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
CCing Gabriele, owner of XPS machine too. Have you seen similar problems with
dell_rbtnas described in above bug report?I'll look into this ASAP. I haven't been using
dell_rbtnnot to disable the hardware switch, but I didn't notice anything strange the last time I tested it.
I went back to see the old thread about dell-rbtn and apparently I was aware of this problem [1]. So yes, I confirm the bug.
We are assuming that RBTN receives notifications only when a button function keys are pressed, but this is true only for some laptops, while others, such as my XPS13, send a notification also on resume [2]. This makes things a bit more complicated.
CCed Alex since he might be interested in this.
[1] https://marc.info/?l=linux-kernel&m=141927583032180
[2] https://marc.info/?l=linux-kernel&m=141941243829713
Quoted 42 lines · Gabriele Mazzotta
2015-10-21 13:42 GMT+02:00 Gabriele Mazzotta <[email protected]>:
Quoted 26 lines
2015-10-21 13:12 GMT+02:00 Darren Hart <[email protected]>:
Quoted 25 lines · Pali Rohár
Quoted 24 lines · On Wednesday 21 October 2015 11:19:54 Pali Rohár wrote:
Quoted 22 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 11 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
Quoted 4 lines
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Hi! This looks strange. Driver
dell_rbntis just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. Butdell_rbntdriver itself cannot set or change wireless rfkill or airplane mode.So my opinion is that BIOS/ACPI could send such event,
dell_rbntthen propagate it into userspace and some application process it and do something...Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
CCing Gabriele, owner of XPS machine too. Have you seen similar problems with
dell_rbtnas described in above bug report?I'll look into this ASAP. I haven't been using
dell_rbtnnot to disable the hardware switch, but I didn't notice anything strange the last time I tested it.I went back to see the old thread about dell-rbtn and apparently I was aware of this problem [1]. So yes, I confirm the bug.
We are assuming that RBTN receives notifications only when a button function keys are pressed, but this is true only for some laptops, while others, such as my XPS13, send a notification also on resume [2]. This makes things a bit more complicated.
Quoted 5 lines
CCed Alex since he might be interested in this.
[1] https://marc.info/?l=linux-kernel&m=141927583032180
[2] https://marc.info/?l=linux-kernel&m=141941243829713
Am I correct in my understanding that there is no EC state associated with the RFKILL for the TOGGLE type?
Is there any point in sending the event upon resume? If not, perhaps we could set a flag on suspend and then ignore the event on resume and then clear the flag. This would have to be only for the affected latops though, which is certainly not ideal.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 3 lines · Darren Hart
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
The reporter states his radio toggle is on F2, so it is not the above machine, probably this one:
http://www.ibtimes.co.uk/dell-xps-13-review-ultrabook-341773
In any case, his logs confirm we are seeing a TOGGLE type which is using the input mechanism.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
2015-10-22 9:49 GMT+02:00 Darren Hart <[email protected]>:
Quoted 43 lines · Gabriele Mazzotta
Quoted 42 lines
2015-10-21 13:42 GMT+02:00 Gabriele Mazzotta <[email protected]>:
Quoted 26 lines
2015-10-21 13:12 GMT+02:00 Darren Hart <[email protected]>:
Quoted 25 lines · Pali Rohár
Quoted 24 lines · On Wednesday 21 October 2015 11:19:54 Pali Rohár wrote:
Quoted 22 lines · On Wednesday 21 October 2015 10:57:24 Darren Hart wrote:
Quoted 11 lines · On Sun, Oct 18, 2015 at 09:34:56AM +0000, [email protected]…
Quoted 4 lines
https://bugzilla.kernel.org/show_bug.cgi?id=106031
--- Comment #2 from Britt Yazel <[email protected]> --- Confirmed. Blacklisting the
dell_rbtnmodule solves this issuePali,
Can you take a look at this bug report regarding a 4.2 regression for rfkill after the introduction of the dell-rbtn driver please.
Hi! This looks strange. Driver
dell_rbntis just receiver of BIOS/ACPI events. It receive hotkey or slide switch event and translate it into either linux input keypress or rfkill block event. Butdell_rbntdriver itself cannot set or change wireless rfkill or airplane mode.So my opinion is that BIOS/ACPI could send such event,
dell_rbntthen propagate it into userspace and some application process it and do something...Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
CCing Gabriele, owner of XPS machine too. Have you seen similar problems with
dell_rbtnas described in above bug report?I'll look into this ASAP. I haven't been using
dell_rbtnnot to disable the hardware switch, but I didn't notice anything strange the last time I tested it.I went back to see the old thread about dell-rbtn and apparently I was aware of this problem [1]. So yes, I confirm the bug.
We are assuming that RBTN receives notifications only when a button function keys are pressed, but this is true only for some laptops, while others, such as my XPS13, send a notification also on resume [2]. This makes things a bit more complicated.
Quoted 8 lines
Quoted 5 lines
CCed Alex since he might be interested in this.
[1] https://marc.info/?l=linux-kernel&m=141927583032180
[2] https://marc.info/?l=linux-kernel&m=141941243829713Am I correct in my understanding that there is no EC state associated with the RFKILL for the TOGGLE type?
As far as I know, yes.
Quoted 4 lines
Is there any point in sending the event upon resume? If not, perhaps we could set a flag on suspend and then ignore the event on resume and then clear the flag. This would have to be only for the affected latops though, which is certainly not ideal.
The problem is that we don't know which are the affected laptops. I suspect they are those that support both the methods to disable radio devices (software and hardware), i.e. those with a working ARBT method, such as mine.
So this solution wouldn't really work properly, unless we define some time constraints, which makes the solution even worse.
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
Quoted 3 lines
--
Darren Hart
Intel Open Source Technology Center
Quoted 5 lines · On Thursday 22 October 2015 10:17:25 Darren Hart wrote:
Quoted 3 lines · Darren Hart
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
Quoted 8 lines
The reporter states his radio toggle is on F2, so it is not the above machine, probably this one:
http://www.ibtimes.co.uk/dell-xps-13-review-ultrabook-341773
In any case, his logs confirm we are seeing a TOGGLE type which is using the input mechanism.
So my assumption that turning rfkill on (airplane mode) is done by userspace (and not by kernel itself) is correct.
Now we need to know if we can drop that event input key after resuming from suspend on all dell machines which has toggle key.
Alex, do you know more? Can you help us?
Signature · 2 lines
Pali Rohár [email protected]
2015-10-22 10:17 GMT+02:00 Darren Hart <[email protected]>:
Quoted 5 lines · Darren Hart
Quoted 3 lines
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
Quoted 7 lines
The reporter states his radio toggle is on F2, so it is not the above machine, probably this one:
http://www.ibtimes.co.uk/dell-xps-13-review-ultrabook-341773
In any case, his logs confirm we are seeing a TOGGLE type which is using the input mechanism.
According to the dmesg it's an XPS13 9333, which is the one I own.
Quoted 3 lines
--
Darren Hart
Intel Open Source Technology Center
Quoted 9 lines · Gabriele Mazzotta
2015-10-22 10:17 GMT+02:00 Darren Hart <[email protected]>:
Quoted 8 lines · Darren Hart
Quoted 3 lines
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
The reporter states his radio toggle is on F2, so it is not the above machine, probably this one:
Quoted 6 lines
Quoted 4 lines
http://www.ibtimes.co.uk/dell-xps-13-review-ultrabook-341773
In any case, his logs confirm we are seeing a TOGGLE type which is using the input mechanism.
According to the dmesg it's an XPS13 9333, which is the one I own.
Oh excellent! That should help considerably!
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 2 lines · On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or toggle key.
And rfkill implementation in dell-laptop.ko does not work correctly on XPS machines. And because userspace implementation of smbios works fine, I think that problem is in kernel driver rather in BIOS/firmware...
Signature · 2 lines
Pali Rohár [email protected]
Quoted 9 lines · Pali Rohár
Quoted 8 lines · On Thursday 22 October 2015 10:17:25 Darren Hart wrote:
Quoted 3 lines · Darren Hart
From what I can tell, the XPS 13 has a TOGGLE type rfkill button (Fn-PrtScrn):
The reporter states his radio toggle is on F2, so it is not the above machine, probably this one:
Quoted 8 lines
Quoted 5 lines
http://www.ibtimes.co.uk/dell-xps-13-review-ultrabook-341773
In any case, his logs confirm we are seeing a TOGGLE type which is using the input mechanism.
So my assumption that turning rfkill on (airplane mode) is done by userspace (and not by kernel itself) is correct.
Agreed.
Quoted 4 lines
Now we need to know if we can drop that event input key after resuming from suspend on all dell machines which has toggle key.
Well, as Gabriele points out, it seems it is dependent on the system, as some with the TOGGLE emit the event on resume, and others do not.
We could of course do this on a case by case DMI match, but I'd really like to avoid that if at all possible.
Quoted 6 lines
Alex, do you know more? Can you help us?
Signature · 2 lines
Pali Rohár [email protected]
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 10 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or toggle key.
And rfkill implementation in dell-laptop.ko does not work correctly on XPS machines. And because userspace implementation of smbios works fine, I think that problem is in kernel driver rather in BIOS/firmware...
I was thinking about something such as the following, which should favor the hardware slider when available. This should work if my assumption is correct, that is the laptops with a working RBTN method are the ones having problems.
drivers/platform/x86/dell-rbtn.c +6 -2
@@ -321,6 +321,7 @@ static int rbtn_add(struct acpi_device *device)struct rbtn_data *rbtn_data;enum rbtn_type type;int ret =0 ; +bool has_hardware_slider;/* get this with SMI */ type =rbtn_check (device);if (type ==RBTN_UNKNOWN ) {
@@ -328,7 +329,7 @@ static int rbtn_add(struct acpi_device *device)return -EINVAL ; } - ret =rbtn_acquire (device, true); + ret =rbtn_acquire (device, !has_hardware_slider);if (ret <0 ) {dev_err (&device->dev,"Cannot enable device\n" );return ret;
@@ -343,7 +344,10 @@ static int rbtn_add(struct acpi_device *device)switch (rbtn_data->type) {case RBTN_TOGGLE : - ret =rbtn_input_init (rbtn_data); +if (has_hardware_slider) + ret =0 ; +else + ret =rbtn_input_init (rbtn_data);break ;case RBTN_SLIDER :if (auto_remove_rfkill && rbtn_chain_head.head)
Quoted 8 lines · On Thursday 22 October 2015 12:44:08 Gabriele Mazzotta wrote:
Quoted 7 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or toggle key.
Quoted 9 lines
Quoted 3 lines
And rfkill implementation in dell-laptop.ko does not work correctly on XPS machines. And because userspace implementation of smbios works fine, I think that problem is in kernel driver rather in BIOS/firmware...
I was thinking about something such as the following, which should favor the hardware slider when available. This should work if my assumption is correct, that is the laptops with a working RBTN method are the ones having problems.
Hm... wait! There are machines with HW slider and type is RBTN_TOGGLE?
I thought that all machines with HW slider has type RBTN_SLIDER and others have RBTN_TOGGLE.
Signature · 2 lines
Pali Rohár [email protected]
Quoted 19 lines · Pali Rohár
Quoted 8 lines · On Thursday 22 October 2015 12:44:08 Gabriele Mazzotta wrote:
Quoted 7 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or toggle key.
Quoted 9 lines
Quoted 3 lines
And rfkill implementation in dell-laptop.ko does not work correctly on XPS machines. And because userspace implementation of smbios works fine, I think that problem is in kernel driver rather in BIOS/firmware...
I was thinking about something such as the following, which should favor the hardware slider when available. This should work if my assumption is correct, that is the laptops with a working RBTN method are the ones having problems.
Quoted 4 lines
Hm... wait! There are machines with HW slider and type is
RBTN_TOGGLE?I thought that all machines with HW slider has type
RBTN_SLIDERand others haveRBTN_TOGGLE.
Yes, this is the problem I've been talking about ever since the work on this driver started. AFAIK we don't know how to detect these laptops (my XPS13 is one of them).
Quoted 20 lines · Gabriele Mazzotta
Quoted 19 lines · Pali Rohár
Quoted 17 lines · On Thursday 22 October 2015 12:44:08 Gabriele Mazzotta wrote:
Quoted 10 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or toggle key.
And rfkill implementation in dell-laptop.ko does not work correctly on XPS machines. And because userspace implementation of smbios works fine, I think that problem is in kernel driver rather in BIOS/firmware...
I was thinking about something such as the following, which should favor the hardware slider when available. This should work if my assumption is correct, that is the laptops with a working RBTN method are the ones having problems.
Quoted 8 lines
Quoted 4 lines
Hm... wait! There are machines with HW slider and type is
RBTN_TOGGLE?I thought that all machines with HW slider has type
RBTN_SLIDERand others haveRBTN_TOGGLE.Yes, this is the problem I've been talking about ever since the work on this driver started. AFAIK we don't know how to detect these laptops (my XPS13 is one of them).
Where is the radio hw slider on this machine?
This patch would effectively ignore Fn-F2 (radio toggle) key on this machine then - correct? I don't think that is desirable either.
Seems to me the desired behavior would be to restore the radio state on resume. Consider the following table:
SW: Switch state
SS: State at suspend
SR: State after resume
0: WiFi Enabled
1: WiFi Disabled
State SW SS SR
--------------
a 0 0 0 b 0 1 1 (switch is enabled, but toggle key disabled wifi) c 1 0 N/A (invalid state) d 1 1 1
State "a" is where we are failing currently I believe?
Do we know if DELRBTN and DELLABCE are always a TOGGLE or a SLIDER respectively? I'm wondering if these should be separate drivers.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 23 lines · Darren Hart
Quoted 22 lines · Gabriele Mazzotta
Quoted 21 lines · Pali Rohár
Quoted 8 lines · On Thursday 22 October 2015 12:44:08 Gabriele Mazzotta wrote:
Quoted 7 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 10:26:47 Gabriele Mazzotta wrote:
I'll see if I can find a batter way to deal with this problem, dell-laptop can detect the presence of an hardware switch.
dell-rbtn.ko has acpi method CRBT which returns if notebook has hw switch or toggle key.
Quoted 9 lines
Quoted 3 lines
And rfkill implementation in dell-laptop.ko does not work correctly on XPS machines. And because userspace implementation of smbios works fine, I think that problem is in kernel driver rather in BIOS/firmware...
I was thinking about something such as the following, which should favor the hardware slider when available. This should work if my assumption is correct, that is the laptops with a working RBTN method are the ones having problems.
Hm... wait! There are machines with HW slider and type is
RBTN_TOGGLE?
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I thought that all machines with HW slider has type
RBTN_SLIDERand others haveRBTN_TOGGLE.Yes, this is the problem I've been talking about ever since the work on this driver started. AFAIK we don't know how to detect these laptops (my XPS13 is one of them).
Where is the radio hw slider on this machine?
It's the F2 key. Depending on the value passed to the RBTN, it acts as hw slider or sw toggle. Currently dell-rbtn makes all the laptops with both the hw slider and sw toggle use the sw toggle. In this way we are sure that whenever CRBT returns either 1 or 0, we are using the sw mechanism to disable the radios.
The problem is that the CRBT method of these laptops supporting both the methods return 1 or 0 as the laptops that only have the sw toggle. That's why we are calling RBTN to force the sw toggle.
Quoted 2 lines
This patch would effectively ignore Fn-F2 (radio toggle) key on this machine then - correct? I don't think that is desirable either.
No, this patch would force the hw slider when it's available instead of blindly forcing the sw toggle. When the hw slider is in use, everything is handled by the BIOS, so userspace/kernel don't have to do anything.
Quoted 9 lines
Seems to me the desired behavior would be to restore the radio state on resume. Consider the following table:
SW: Switch state
SS: State at suspend
SR: State after resume
0: WiFi Enabled
1: WiFi Disabled
Quoted 8 lines
State SW SS SR
--------------a 0 0 0 b 0 1 1 (switch is enabled, but toggle key disabled wifi) c 1 0 N/A (invalid state) d 1 1 1State "a" is where we are failing currently I believe?
dell-rbtn is simply listening to the ACPI notifications sent to DELLABCE. These notifications are sent by the BIOS, both when users press the function key and when it wants. In my case, the BIOS sends a notification on resume (dell-rbtn sees this notification and sends an input event to userspace), but the BIOS of some other laptops don't do this.
Basically, dell-rbtn makes some laptop toggles the state of WiFi on resume, but not all of them.
In my case:
if WiFi is ON on suspend, it's turned OFF on resume. if WiFi is OFF on suspend, it's turned ON on resume.
Reading what Alex wrote some time ago [1], I guessed that the laptops that are misbehaving are those that can choose between sw toggle and hw toggle.
Quoted 2 lines
Do we know if DELRBTN and DELLABCE are always a TOGGLE or a SLIDER respectively? I'm wondering if these should be separate drivers.
I'm reading the acpidumps Alex provided some time ago [2] (and mine):
* XPS13 9333: DELLABCE, by default (without calling RBTN) SLIDER.
* Latitude E5440: DELLABCE, SLIDER
* Inspiron 7447: DELLABCE, TOGGLE
* Pali's laptop: DELLRBTN, SLIDER (correct?).
[1] https://marc.info/?l=linux-kernel&m=141941243829713
[2] http://people.canonical.com/~alexhung/dell-acpidump/
Quoted 2 lines · On Thursday 22 October 2015 15:43:46 Gabriele Mazzotta wrote:
It's the F2 key. Depending on the value passed to the RBTN, it acts as hw slider or sw toggle.
Ok, we have differences in terminology and everybody understood this problem differently.
To correct this situation, first define about what we are talking about:
* HW slider: It is hardware slider switch which as two positions ON and OFF. Position exactly defines hardware state of wireless radio devices. Not possible (or should not) to remap.
* SW hotkey toggle button: It is button or key, act in same way as any other key on keyboard, controlled by SW (if all drivers are installed, etc).
Next I think that this hypothesis is truth:
* Every machine on which is binded ACPI dell-rbtn.ko driver has either HW slider or SW toggle. Not both!
Correct?
Then follows my expected behaviour for HW slider:
* State of HW slider position is exported by kernel as rfkill device.
* In any case HW slider position (ON/OFF) match hard rfkill state device (rfkill device state is correct also after resume, wake from hibernate).
* Immediately after user change position of HW slider, rfkill device reflect it.
And then expected behaviour for SW toggle button:
* Every time when user press it, kernel just send input event "wireless key pressed" to userspace.
* Kernel does not send event "wireless key pressed" when user did not pressed it (e.g. after resuming from suspend, waking from hibernate).
* Kernel should provide rfkill devices to "soft" block appropriate wireless cards.
* Make sure that BIOS/firmware in any case does not change radio rfkill state of any wireless card and wireless cards stay in same state as before (no enable/disable or changing hard/soft rfkill state).
If last sentence is not truth, then kernel must not send "wireless key pressed" event to userspace and act like "no key was pressed".
Make this sense? Or are there any objections about this behaviour?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 10 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 15:43:46 Gabriele Mazzotta wrote:
It's the F2 key. Depending on the value passed to the RBTN, it acts as hw slider or sw toggle.
Ok, we have differences in terminology and everybody understood this problem differently.
To correct this situation, first define about what we are talking about:
Quoted 7 lines
* HW slider: It is hardware slider switch which as two positions ON and OFF. Position exactly defines hardware state of wireless radio devices. Not possible (or should not) to remap.
* SW hotkey toggle button: It is button or key, act in same way as any other key on keyboard, controlled by SW (if all drivers are installed, etc).
Sorry for the confusion, I know I've been using "HW slider" improperly, but I thought it was clear. Although it's a button, the BIOS makes it behave like an hardware slider when configured to behave as such through RBTN. The state of radio devices is changed by the BIOS when the function key is pressed, this state is never changed until the user presses the function key again (at least if we ignore the fact that we can perform some special SMI calls), this state is saved in the EC and both userspace and the kernel don't receive any event other than rfkill events (if we don't consider the WMI events ignored by dell-wmi).
I think this behavior is closer to the one of an hardware slider rather than the one of a software hotkey, which I can still request through the RBTN method.
Quoted 6 lines
Next I think that this hypothesis is truth:
* Every machine on which is binded ACPI dell-rbtn.ko driver has either HW slider or SW toggle. Not both!
Correct?
It depends on how you classify my laptop. The behavior changes completely depending on the value passed to RBTN.
Obviously it can behave either as HW slider (again, not an actual slider) or SW toggle, but I can choose between the two.
Quoted 11 lines
Then follows my expected behaviour for HW slider:
* State of HW slider position is exported by kernel as rfkill device.
* In any case HW slider position (ON/OFF) match hard rfkill state device (rfkill device state is correct also after resume, wake from hibernate).
* Immediately after user change position of HW slider, rfkill device reflect it.
Quoted 7 lines
And then expected behaviour for SW toggle button:
* Every time when user press it, kernel just send input event "wireless key pressed" to userspace.
* Kernel does not send event "wireless key pressed" when user did not pressed it (e.g. after resuming from suspend, waking from hibernate).
Yes, but we don't know exactly when the user pressed the button. As I said, the BIOS might send an event that triggers an input event even if the user didn't press anything.
Quoted 6 lines
* Kernel should provide rfkill devices to "soft" block appropriate wireless cards.
* Make sure that BIOS/firmware in any case does not change radio rfkill state of any wireless card and wireless cards stay in same state as before (no enable/disable or changing hard/soft rfkill state).
This is the problem. We can't differentiate notifications sent to DELLABCE/DELLRBTN by the BIOS because it felt like it was right to do so (e.g. after resuming) or because the user pressed the function key.
Quoted 6 lines
If last sentence is not truth, then kernel must not send "wireless key pressed" event to userspace and act like "no key was pressed".
Make this sense? Or are there any objections about this behaviour?
Quoted 38 lines · On Friday 23 October 2015 01:29:12 Gabriele Mazzotta wrote:
Quoted 10 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 15:43:46 Gabriele Mazzotta wrote:
It's the F2 key. Depending on the value passed to the RBTN, it acts as hw slider or sw toggle.
Ok, we have differences in terminology and everybody understood this problem differently.
To correct this situation, first define about what we are talking about:
Quoted 7 lines
* HW slider: It is hardware slider switch which as two positions ON and OFF. Position exactly defines hardware state of wireless radio devices. Not possible (or should not) to remap.
* SW hotkey toggle button: It is button or key, act in same way as any other key on keyboard, controlled by SW (if all drivers are installed, etc).
Sorry for the confusion, I know I've been using "HW slider" improperly, but I thought it was clear. Although it's a button, the BIOS makes it behave like an hardware slider when configured to behave as such through RBTN. The state of radio devices is changed by the BIOS when the function key is pressed, this state is never changed until the user presses the function key again (at least if we ignore the fact that we can perform some special SMI calls), this state is saved in the EC and both userspace and the kernel don't receive any event other than rfkill events (if we don't consider the WMI events ignored by dell-wmi).
I think this behavior is closer to the one of an hardware slider rather than the one of a software hotkey, which I can still request through the RBTN method.
Quoted 5 lines
Next I think that this hypothesis is truth:
* Every machine on which is binded ACPI dell-rbtn.ko driver has either HW slider or SW toggle. Not both!
Quoted 8 lines
Quoted 1 line
Correct?
It depends on how you classify my laptop. The behavior changes completely depending on the value passed to RBTN.
Obviously it can behave either as HW slider (again, not an actual slider) or SW toggle, but I can choose between the two.
If it has keyboard button and not switch with visible two positions, it is "toggle button" (from HW perspective).
Quoted 16 lines
Quoted 16 lines
Then follows my expected behaviour for HW slider:
* State of HW slider position is exported by kernel as rfkill device.
* In any case HW slider position (ON/OFF) match hard rfkill state device (rfkill device state is correct also after resume, wake from hibernate).
* Immediately after user change position of HW slider, rfkill device reflect it.
And then expected behaviour for SW toggle button:
* Every time when user press it, kernel just send input event "wireless key pressed" to userspace.
Quoted 7 lines
Quoted 2 lines
* Kernel does not send event "wireless key pressed" when user did not pressed it (e.g. after resuming from suspend, waking from hibernate).
Yes, but we don't know exactly when the user pressed the button. As I said, the BIOS might send an event that triggers an input event even if the user didn't press anything.
Ok. This is strange if BIOS send event "changed" even if it was not really changed.
Is BIOS sending this incorrect event only after waking from suspend? Or it is also randomly at any time?
If we know that it send incorrectly only after suspend, we can drop this event. But if it is completely randomly, we probably cannot do anything (and just do not use driver in this case).
Quoted 11 lines
Quoted 6 lines
* Kernel should provide rfkill devices to "soft" block appropriate wireless cards.
* Make sure that BIOS/firmware in any case does not change radio rfkill state of any wireless card and wireless cards stay in same state as before (no enable/disable or changing hard/soft rfkill state).
This is the problem. We can't differentiate notifications sent to DELLABCE/DELLRBTN by the BIOS because it felt like it was right to do so (e.g. after resuming) or because the user pressed the function key.
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
Quoted 6 lines
Quoted 6 lines
If last sentence is not truth, then kernel must not send "wireless key pressed" event to userspace and act like "no key was pressed".
Make this sense? Or are there any objections about this behaviour?
So if you are OK with above my description (from previous email), then we should fix dell-rbtn to act as it (if it is not implemented already and correctly).
So my next question is: Does dell-rbtn behave like my description? If not what are differences and what needs to be fixed?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 44 lines · Pali Rohár
Quoted 43 lines · On Friday 23 October 2015 01:29:12 Gabriele Mazzotta wrote:
Quoted 10 lines · Pali Rohár
Quoted 2 lines · On Thursday 22 October 2015 15:43:46 Gabriele Mazzotta wrote:
It's the F2 key. Depending on the value passed to the RBTN, it acts as hw slider or sw toggle.
Ok, we have differences in terminology and everybody understood this problem differently.
To correct this situation, first define about what we are talking about:
Quoted 7 lines
* HW slider: It is hardware slider switch which as two positions ON and OFF. Position exactly defines hardware state of wireless radio devices. Not possible (or should not) to remap.
* SW hotkey toggle button: It is button or key, act in same way as any other key on keyboard, controlled by SW (if all drivers are installed, etc).
Sorry for the confusion, I know I've been using "HW slider" improperly, but I thought it was clear. Although it's a button, the BIOS makes it behave like an hardware slider when configured to behave as such through RBTN. The state of radio devices is changed by the BIOS when the function key is pressed, this state is never changed until the user presses the function key again (at least if we ignore the fact that we can perform some special SMI calls), this state is saved in the EC and both userspace and the kernel don't receive any event other than rfkill events (if we don't consider the WMI events ignored by dell-wmi).
I think this behavior is closer to the one of an hardware slider rather than the one of a software hotkey, which I can still request through the RBTN method.
Quoted 6 lines
Next I think that this hypothesis is truth:
* Every machine on which is binded ACPI dell-rbtn.ko driver has either HW slider or SW toggle. Not both!
Correct?
It depends on how you classify my laptop. The behavior changes completely depending on the value passed to RBTN.
Quoted 6 lines
Quoted 3 lines
Obviously it can behave either as HW slider (again, not an actual slider) or SW toggle, but I can choose between the two.
If it has keyboard button and not switch with visible two positions, it is "toggle button" (from HW perspective).
Yes, sorry for the confusion.
Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Then follows my expected behaviour for HW slider:
* State of HW slider position is exported by kernel as rfkill device.
* In any case HW slider position (ON/OFF) match hard rfkill state device (rfkill device state is correct also after resume, wake from hibernate).
* Immediately after user change position of HW slider, rfkill device reflect it.
And then expected behaviour for SW toggle button:
* Every time when user press it, kernel just send input event "wireless key pressed" to userspace.
Quoted 7 lines
Quoted 2 lines
* Kernel does not send event "wireless key pressed" when user did not pressed it (e.g. after resuming from suspend, waking from hibernate).
Yes, but we don't know exactly when the user pressed the button. As I said, the BIOS might send an event that triggers an input event even if the user didn't press anything.
Quoted 5 lines
Ok. This is strange if BIOS send event "changed" even if it was not really changed.
Is BIOS sending this incorrect event only after waking from suspend? Or it is also randomly at any time?
I looked at the ACPI table. It happens only on resume (or when the user presses the function key).
Quoted 11 lines
If we know that it send incorrectly only after suspend, we can drop this event. But if it is completely randomly, we probably cannot do anything (and just do not use driver in this case).
Quoted 7 lines
Quoted 6 lines
* Kernel should provide rfkill devices to "soft" block appropriate wireless cards.
* Make sure that BIOS/firmware in any case does not change radio rfkill state of any wireless card and wireless cards stay in same state as before (no enable/disable or changing hard/soft rfkill state).
Quoted 7 lines
Quoted 4 lines
This is the problem. We can't differentiate notifications sent to DELLABCE/DELLRBTN by the BIOS because it felt like it was right to do so (e.g. after resuming) or because the user pressed the function key.
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before rbtn_resume() has been executed, so the extra event is ignored.
drivers/platform/x86/dell-rbtn.c +28 -0
@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };
@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,
@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) {dev_info (&device->dev,"Received unknown event (0x%x)\n" , event);
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
If last sentence is not truth, then kernel must not send "wireless key pressed" event to userspace and act like "no key was pressed".
Make this sense? Or are there any objections about this behaviour?
Quoted 6 lines
So if you are OK with above my description (from previous email), then we should fix dell-rbtn to act as it (if it is not implemented already and correctly).
So my next question is: Does dell-rbtn behave like my description? If not what are differences and what needs to be fixed?
Everything works as expected. We only have to deal with this extra notification.
Quoted 63 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",
Quoted 2 lines
event);
Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 70 lines · Pali Rohár
Quoted 63 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);
Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:e71eeb2a6bcc ("ACPI / button: Do not propagate wakeup-from-suspend events").
Quoted 74 lines · Gabriele Mazzotta
Quoted 70 lines · Pali Rohár
Quoted 63 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);
Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 7 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").
My understanding here though is that laptops with a Fn+RBTN key which changes the state of the radio in firmware should be handled via the rfkill interface rather than the inpu interface - so while this patch may appear to work, it's using the input interface to copy the rfkill interface/state.
The proper solution, if I'm understanding this correctly - and apologies if not, some of this is new territory for me as well - would be for this device to be detected as firmware controlled (what we refer to as a SLIDER in the code - which needs to be renamed IMHO).
Let's sort out this point, then we can pull in Rafael to make sure this is how to best deal with the spurious event on resume.
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 5 lines · On Monday 26 October 2015 23:38:13 Darren Hart wrote:
My understanding here though is that laptops with a Fn+RBTN key which changes the state of the radio in firmware should be handled via the rfkill interface rather than the inpu interface - so while this patch may appear to work, it's using the input interface to copy the rfkill interface/state.
Here is problem: ACPI device ABCE/RBTN (handled by dell-rbtn.ko) just receive events. It cannot set or change wireless state.
For changing rfkill/wireless state is there Dell SMBIOS api and it is implemented in dell-laptop.ko. But due to bugs in that module, it is disabled for XPS machines.
And problem is that on machines without HW switch you do not know if wifi switch is in ON or OFF mode. ACPI tell you just "key pressed". So for this reason Alex decided to export that event via input layer, because it is really just key press, not changing state.
Quoted 5 lines
The proper solution, if I'm understanding this correctly - and apologies if not, some of this is new territory for me as well - would be for this device to be detected as firmware controlled (what we refer to as a SLIDER in the code - which needs to be renamed IMHO).
I understood that if you blacklist dell-rbtn.ko on that XPS machine, then firmware takes control and automatically turn ON/OFF wifi card.
Quoted 3 lines
Let's sort out this point, then we can pull in Rafael to make sure this is how to best deal with the spurious event on resume.
For me solution (=ignore events when ACPI device is suspended) sounds good. I do not know if there is better way to implement it, maybe general linux device model should provide function "am_i_suspended?" instead tracking "suspend" state internally in each driver. But if such support in linux device or acpi model is not implemented, I'm fine with provided patch if it really works.
Signature · 2 lines
Pali Rohár [email protected]
Quoted 74 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 70 lines · Pali Rohár
Quoted 63 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);
Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 82 lines · Pali Rohár
Quoted 74 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 70 lines · Pali Rohár
Quoted 63 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);
Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").
Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Has Dell been involved here?
+Jared
Signature · 2 lines
Darren Hart Intel Open Source Technology Center
Quoted 91 lines · Darren Hart
Quoted 82 lines · Pali Rohár
Quoted 74 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 70 lines · Pali Rohár
Quoted 63 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);
Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Quoted 1 line
Has Dell been involved here?
Not that I know of.
Thanks,
Rafael
2015-12-20 17:21 GMT+01:00 Rafael J. Wysocki <[email protected]>:
Quoted 100 lines · Darren Hart
Quoted 91 lines · Pali Rohár
Quoted 82 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 74 lines · Pali Rohár
Quoted 70 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 63 lines
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Quoted 7 lines
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Hi,
sorry, but I'm not sure I understood everything, so I'll try to briefly describe the problem and its current solution.
Currently dell-rbtn listens for the notifications sent to an ACPI device and for notification sends an input event to userspace.
The problem we have is that some BIOSes send an extra notification on resume and therefore we send an extra input event.
What we want to do is to ignore this ACPI notification without affecting the systems whose BIOS does not send this extra notification. We know that not all of them send this notification.
What I noticed is that the extra notification is issued by the _WAK method and always arrives before dell-rbtn has been resumed, so what I did is to add a flag that is set by the suspend and resume callbacks of the device driver.
What we were wondering is whether this would be enough or we need to do something different, e.g. ignore all the notifications that arrived X seconds after the execution of the resume callback.
Thanks,
Gabriele
Quoted 7 lines
Quoted 1 line
Has Dell been involved here?
Not that I know of.
Thanks,
Rafael
Quoted 120 lines · Gabriele Mazzotta
2015-12-20 17:21 GMT+01:00 Rafael J. Wysocki <[email protected]>:
Quoted 100 lines · Darren Hart
Quoted 91 lines · Pali Rohár
Quoted 82 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 74 lines · Pali Rohár
Quoted 70 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 63 lines
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Quoted 7 lines
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Hi,
sorry, but I'm not sure I understood everything, so I'll try to briefly describe the problem and its current solution.
Currently dell-rbtn listens for the notifications sent to an ACPI device and for notification sends an input event to userspace.
The problem we have is that some BIOSes send an extra notification on resume and therefore we send an extra input event.
Quoted 8 lines
What we want to do is to ignore this ACPI notification without affecting the systems whose BIOS does not send this extra notification. We know that not all of them send this notification.
What I noticed is that the extra notification is issued by the
_WAKmethod and always arrives before dell-rbtn has been resumed, so what I did is to add a flag that is set by the suspend and resume callbacks of the device driver.
ACPI notifications are delivered asynchronously to drivers, so you'd need to flush kacpi_notify_wq in .resume(). That would make the driver wait for things it really doesn't need to wait for, so it would not be super-optimal.
Quoted 3 lines
What we were wondering is whether this would be enough or we need to do something different, e.g. ignore all the notifications that arrived X seconds after the execution of the resume callback.
I'd try something like setting the flag from .suspend() and then adding a work item to clear it to kacpi_notify_wq from .resume(). Then you'll know that all of the pending notifications have been processed before your flag is cleared.
That would require a new helper for adding work items to kacpi_notify_wq from drivers, but it shouldn't be too difficult to create one.
Thanks,
Rafael
Quoted 120 lines · Gabriele Mazzotta
2015-12-20 17:21 GMT+01:00 Rafael J. Wysocki <[email protected]>:
Quoted 100 lines · Darren Hart
Quoted 91 lines · Pali Rohár
Quoted 82 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 74 lines · Pali Rohár
Quoted 70 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 63 lines
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Quoted 7 lines
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Hi,
sorry, but I'm not sure I understood everything, so I'll try to briefly describe the problem and its current solution.
Currently dell-rbtn listens for the notifications sent to an ACPI device and for notification sends an input event to userspace.
The problem we have is that some BIOSes send an extra notification on resume and therefore we send an extra input event.
Quoted 8 lines
What we want to do is to ignore this ACPI notification without affecting the systems whose BIOS does not send this extra notification. We know that not all of them send this notification.
What I noticed is that the extra notification is issued by the
_WAKmethod and always arrives before dell-rbtn has been resumed, so what I did is to add a flag that is set by the suspend and resume callbacks of the device driver.
Sorry I screw up my mail filter and I wasn't aware of this thread until now.
BIOS sends this additional ACPI event for the systems with hardware switch so a driver can update its state; therefore this is done only once and therefore ignoring the ACPI event sent to dell rbtn once after resume is sufficient.
I actually tried a solution similar to Gabriele's patch above (one with rbtn_suspend and rbtn_resume) a while ago and it works fine.
If there is a conclusion and there is a patch to be tested, I am happy to test it on wider range (I should be able to find 5+ Dell systems that runs on dell-rbtn).
Quoted 15 lines
What we were wondering is whether this would be enough or we need to do something different, e.g. ignore all the notifications that arrived X seconds after the execution of the resume callback.
Thanks,
GabrieleQuoted 7 lines
Quoted 1 line
Has Dell been involved here?
Not that I know of.
Thanks,
Rafael
Signature · 2 lines
Cheers, Alex Hung
Quoted 144 lines · On Tuesday 22 December 2015 01:20:30 Rafael J. Wysocki wrote:
Quoted 120 lines · Gabriele Mazzotta
2015-12-20 17:21 GMT+01:00 Rafael J. Wysocki <[email protected]>:
Quoted 100 lines · Darren Hart
Quoted 91 lines · Pali Rohár
Quoted 82 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 74 lines · Pali Rohár
Quoted 70 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 63 lines
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Quoted 7 lines
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Hi,
sorry, but I'm not sure I understood everything, so I'll try to briefly describe the problem and its current solution.
Currently dell-rbtn listens for the notifications sent to an ACPI device and for notification sends an input event to userspace.
The problem we have is that some BIOSes send an extra notification on resume and therefore we send an extra input event.
Quoted 8 lines
What we want to do is to ignore this ACPI notification without affecting the systems whose BIOS does not send this extra notification. We know that not all of them send this notification.
What I noticed is that the extra notification is issued by the
_WAKmethod and always arrives before dell-rbtn has been resumed, so what I did is to add a flag that is set by the suspend and resume callbacks of the device driver.ACPI notifications are delivered asynchronously to drivers, so you'd need to flush
kacpi_notify_wqin .resume(). That would make the driver wait for things it really doesn't need to wait for, so it would not be super-optimal.Quoted 3 lines
What we were wondering is whether this would be enough or we need to do something different, e.g. ignore all the notifications that arrived X seconds after the execution of the resume callback.
I'd try something like setting the flag from .suspend() and then adding a work item to clear it to
kacpi_notify_wqfrom .resume(). Then you'll know that all of the pending notifications have been processed before your flag is cleared.
Quoted 6 lines
That would require a new helper for adding work items to
kacpi_notify_wqfrom drivers, but it shouldn't be too difficult to create one.Thanks,
Rafael
Hi all! Is there any progress or new version of this patch?
Signature · 2 lines
Pali Rohár [email protected]
Quoted 145 lines · On Thursday 07 January 2016 23:35:29 Pali Rohár wrote:
Quoted 144 lines · On Tuesday 22 December 2015 01:20:30 Rafael J. Wysocki wrote:
Quoted 120 lines · Gabriele Mazzotta
2015-12-20 17:21 GMT+01:00 Rafael J. Wysocki <[email protected]>:
Quoted 100 lines · Darren Hart
Quoted 91 lines · Pali Rohár
Quoted 82 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 74 lines · Pali Rohár
Quoted 70 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 63 lines
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Quoted 7 lines
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Hi,
sorry, but I'm not sure I understood everything, so I'll try to briefly describe the problem and its current solution.
Currently dell-rbtn listens for the notifications sent to an ACPI device and for notification sends an input event to userspace.
The problem we have is that some BIOSes send an extra notification on resume and therefore we send an extra input event.
Quoted 8 lines
What we want to do is to ignore this ACPI notification without affecting the systems whose BIOS does not send this extra notification. We know that not all of them send this notification.
What I noticed is that the extra notification is issued by the
_WAKmethod and always arrives before dell-rbtn has been resumed, so what I did is to add a flag that is set by the suspend and resume callbacks of the device driver.ACPI notifications are delivered asynchronously to drivers, so you'd need to flush
kacpi_notify_wqin .resume(). That would make the driver wait for things it really doesn't need to wait for, so it would not be super-optimal.Quoted 3 lines
What we were wondering is whether this would be enough or we need to do something different, e.g. ignore all the notifications that arrived X seconds after the execution of the resume callback.
I'd try something like setting the flag from .suspend() and then adding a work item to clear it to
kacpi_notify_wqfrom .resume(). Then you'll know that all of the pending notifications have been processed before your flag is cleared.
Quoted 9 lines
Quoted 6 lines
That would require a new helper for adding work items to
kacpi_notify_wqfrom drivers, but it shouldn't be too difficult to create one.Thanks,
RafaelHi all! Is there any progress or new version of this patch?
Gabriele, Darren, Alex... was this problem fixed? Or what is current state?
Signature · 2 lines
Pali Rohár [email protected]
2016-03-11 10:45 GMT+01:00 Pali Rohár <[email protected]>:
Quoted 149 lines · On Thursday 07 January 2016 23:35:29 Pali Rohár wrote:
Quoted 148 lines · On Tuesday 22 December 2015 01:20:30 Rafael J. Wysocki wrote:
Quoted 147 lines · Gabriele Mazzotta
Quoted 120 lines
2015-12-20 17:21 GMT+01:00 Rafael J. Wysocki <[email protected]>:
Quoted 100 lines · Darren Hart
Quoted 91 lines · Pali Rohár
Quoted 82 lines · On Friday 23 October 2015 20:03:19 Gabriele Mazzotta wrote:
Quoted 74 lines · Pali Rohár
Quoted 70 lines · On Friday 23 October 2015 11:47:25 Gabriele Mazzotta wrote:
Quoted 63 lines
Quoted 2 lines
In my opinion it is better to ignore user key press after resume, if it fix our problem. Better as false-positive event.
The following appears to work really well. The notification arrives before
rbtn_resume()has been executed, so the extra event is ignored.drivers/platform/x86/dell-rbtn.c +28
-0@@ -28,6 +28,7 @@ struct rbtn_data {enum rbtn_type type;struct rfkill *rfkill;struct input_dev *input_dev; +bool suspended; };@@ -220,9 +221,33 @@ static const struct acpi_device_id rbtn_ids[] = { { "", 0 }, }; +#ifdef CONFIG_PM_SLEEP +static int rbtn_suspend(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = true; + + return 0; +} + +static int rbtn_resume(struct device *dev) +{ + struct acpi_device *device = to_acpi_device(dev); + struct rbtn_data *rbtn_data = acpi_driver_data(device); + + rbtn_data->suspended = false; + + return 0; +} +#endif +static SIMPLE_DEV_PM_OPS(rbtn_pm_ops, rbtn_suspend, rbtn_resume); + static struct acpi_driver rbtn_driver = { .name = "dell-rbtn", .ids = rbtn_ids, + .drv.pm = &rbtn_pm_ops, .ops = { .add = rbtn_add, .remove = rbtn_remove,@@ -384,6 +409,9 @@ static void rbtn_notify(struct acpi_device *device, u32 event) {struct rbtn_data *rbtn_data = device->driver_data; +if (rbtn_data->suspended) +return ; +if (event !=0x80 ) { dev_info(&device->dev, "Received unknown event (0x%x)\n",Quoted 2 lines
event);Great, but is not there a better way to turn off .notify ACPI function when that ACPI device is suspended?
Quoted 2 lines
Is not this ACPI device driver bug that it allows to call .notify method even if device is suspended?
Quoted 6 lines
I was surprised this worked, I was assuming that nothing could run before the resume callback, but I was wrong. I think it makes sense to treat ACPI devices in a special way, but I really don't know, we need someone more knowledgeable to answer these questions. However, while I was trying to figure things out, I stumbled upon the following:
e71eeb2a6bcc("ACPI / button: Do not propagate wakeup-from-suspend events").Quoted 7 lines
Gabriele, are you going to send this patch?
I think that patch should be OK as it drop events when device is in suspend state (when it should not receive events)...
Darren, what do you think about it?
Quoted 7 lines
Sorry, this one has been difficult for me to track, but it's clearly an issue, and new systems are experiencing it as well.
I'd like to get Rafael's opinion on disabling .notify ACPI function while suspended.
+Rafael
Quoted 7 lines
This by far wouldn't be enough, because drivers may install ACPI notify handlers by themselves and those are hooked up directly into the ACPICA code.
Besides, some drivers may actually want to receive those events while the system is suspending or resuming, so I think this has to be addressed on a per-driver basis.
Hi,
sorry, but I'm not sure I understood everything, so I'll try to briefly describe the problem and its current solution.
Currently dell-rbtn listens for the notifications sent to an ACPI device and for notification sends an input event to userspace.
The problem we have is that some BIOSes send an extra notification on resume and therefore we send an extra input event.
Quoted 8 lines
What we want to do is to ignore this ACPI notification without affecting the systems whose BIOS does not send this extra notification. We know that not all of them send this notification.
What I noticed is that the extra notification is issued by the
_WAKmethod and always arrives before dell-rbtn has been resumed, so what I did is to add a flag that is set by the suspend and resume callbacks of the device driver.ACPI notifications are delivered asynchronously to drivers, so you'd need to flush
kacpi_notify_wqin .resume(). That would make the driver wait for things it really doesn't need to wait for, so it would not be super-optimal.Quoted 3 lines
What we were wondering is whether this would be enough or we need to do something different, e.g. ignore all the notifications that arrived X seconds after the execution of the resume callback.
I'd try something like setting the flag from .suspend() and then adding a work item to clear it to
kacpi_notify_wqfrom .resume(). Then you'll know that all of the pending notifications have been processed before your flag is cleared.That would require a new helper for adding work items to
kacpi_notify_wqfrom drivers, but it shouldn't be too difficult to create one.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Thanks,
RafaelHi all! Is there any progress or new version of this patch?
Gabriele, Darren, Alex... was this problem fixed? Or what is current state?
As far as I know, there was no progress. I'm now going to try what Rafael suggested and see what I can do.
Quoted 3 lines
--
Pali Rohár
[email protected]
Quoted 5 lines · On Saturday 12 March 2016 00:30:37 Gabriele Mazzotta wrote:
2016-03-11 10:45 GMT+01:00 Pali Rohár <[email protected]>:
Quoted 1 line
Gabriele, Darren, Alex... was this problem fixed? Or what is current state?
As far as I know, there was no progress. I'm now going to try what Rafael suggested and see what I can do.
Ok, thanks for info. If you have some results, let us know as we can finally fix this problem...
Signature · 2 lines
Pali Rohár [email protected]