All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriele Mazzotta <gabriele.mzt@gmail.com>
To: Darren Hart <dvhart@infradead.org>
Cc: "Pali Rohár" <pali.rohar@gmail.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"Alex Hung" <alex.hung@canonical.com>
Subject: Re: [Bug 106031] Regression in 4.2.x: in airplane mode each time I open my laptop lid
Date: Thu, 22 Oct 2015 15:43:46 +0200	[thread overview]
Message-ID: <5628E812.2070708@gmail.com> (raw)
In-Reply-To: <20151022130211.GA110029@vmdeb7>

On 22/10/2015 15:02, Darren Hart wrote:
> On Thu, Oct 22, 2015 at 12:54:33PM +0200, Gabriele Mazzotta wrote:
>> On 22/10/2015 12:50, Pali Rohár wrote:
>>> On Thursday 22 October 2015 12:44:08 Gabriele Mazzotta wrote:
>>>> On 22/10/2015 10:51, Pali Rohár wrote:
>>>>> 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.
>>>>
>>>
>>> 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.
>>
>> 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.

> 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.

> 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?

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.

> 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/

  reply	other threads:[~2015-10-22 13:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-106031-5380@https.bugzilla.kernel.org/>
     [not found] ` <bug-106031-5380-zVXKHiyrZU@https.bugzilla.kernel.org/>
2015-10-21  8:57   ` [Bug 106031] Regression in 4.2.x: in airplane mode each time I open my laptop lid Darren Hart
2015-10-21  9:19     ` Pali Rohár
2015-10-21 11:00       ` Pali Rohár
2015-10-21 11:12         ` Darren Hart
2015-10-21 11:42           ` Gabriele Mazzotta
2015-10-21 18:53             ` Gabriele Mazzotta
2015-10-22  7:49               ` Darren Hart
2015-10-22  8:26                 ` Gabriele Mazzotta
2015-10-22  8:51                   ` Pali Rohár
2015-10-22 10:44                     ` Gabriele Mazzotta
2015-10-22 10:50                       ` Pali Rohár
2015-10-22 10:54                         ` Gabriele Mazzotta
2015-10-22 13:02                           ` Darren Hart
2015-10-22 13:43                             ` Gabriele Mazzotta [this message]
2015-10-22 14:17                               ` Pali Rohár
2015-10-22 23:29                                 ` Gabriele Mazzotta
2015-10-23  9:00                                   ` Pali Rohár
2015-10-23  9:47                                     ` Gabriele Mazzotta
2015-10-23 11:14                                       ` Pali Rohár
2015-10-23 18:03                                         ` Gabriele Mazzotta
2015-10-26 14:38                                           ` Darren Hart
2015-10-26 14:58                                             ` Pali Rohár
2015-11-20 14:44                                           ` Pali Rohár
2015-12-19  0:12                                             ` Darren Hart
2015-12-20 16:21                                               ` Rafael J. Wysocki
2015-12-21 15:34                                                 ` Gabriele Mazzotta
2015-12-22  0:20                                                   ` Rafael J. Wysocki
2016-01-07 22:35                                                     ` Pali Rohár
2016-03-11  9:45                                                       ` Pali Rohár
2016-03-11 23:30                                                         ` Gabriele Mazzotta
2016-03-14 11:29                                                           ` Pali Rohár
2015-12-22  9:03                                                   ` Alex Hung
2015-10-22  8:17           ` Darren Hart
2015-10-22  8:27             ` Pali Rohár
2015-10-22  8:53               ` Darren Hart
2015-10-22  8:28             ` Gabriele Mazzotta
2015-10-22  8:35               ` Darren Hart
     [not found] <bug-106031-215701@https.bugzilla.kernel.org/>
2022-02-21 21:19 ` bugzilla-daemon
2022-02-21 21:19 ` bugzilla-daemon

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=5628E812.2070708@gmail.com \
    --to=gabriele.mzt@gmail.com \
    --cc=alex.hung@canonical.com \
    --cc=dvhart@infradead.org \
    --cc=pali.rohar@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

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

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