X86 platform drivers
 help / color / mirror / Atom feed
From: Gabriele Mazzotta <gabriele.mzt@gmail.com>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>,
	"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 12:44:08 +0200	[thread overview]
Message-ID: <5628BDF8.9030506@gmail.com> (raw)
In-Reply-To: <20151022085117.GQ15219@pali>

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.

diff --git a/drivers/platform/x86/dell-rbtn.c 
b/drivers/platform/x86/dell-rbtn.c
index cd410e3..cf3c11c 100644
--- a/drivers/platform/x86/dell-rbtn.c
+++ b/drivers/platform/x86/dell-rbtn.c
@@ -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)

  reply	other threads:[~2015-10-22 10:44 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 [this message]
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
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=5628BDF8.9030506@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox