Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422760AbbD2Kah (ORCPT ); Wed, 29 Apr 2015 06:30:37 -0400 Received: from mail-wi0-f180.google.com ([209.85.212.180]:37718 "EHLO mail-wi0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753492AbbD2Kag convert rfc822-to-8bit (ORCPT ); Wed, 29 Apr 2015 06:30:36 -0400 From: Gabriele Mazzotta To: Pali =?ISO-8859-1?Q?Roh=E1r?= Cc: Matthew Garrett , Darren Hart , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Alex Hung Subject: Re: [PATCH v2 1/3] platform: x86: dell-rbtn: Dell Airplane Mode Switch driver Date: Wed, 29 Apr 2015 12:30:32 +0200 Message-ID: <37641224.OJKZVtGCPV@xps13> In-Reply-To: <1430301066-22870-2-git-send-email-pali.rohar@gmail.com> References: <1416755361-17357-1-git-send-email-pali.rohar@gmail.com> <1430301066-22870-1-git-send-email-pali.rohar@gmail.com> <1430301066-22870-2-git-send-email-pali.rohar@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="iso-8859-1" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3139 Lines: 82 On Wednesday 29 April 2015 11:51:04 Pali Roh?r wrote: > This is an ACPI driver for Dell laptops which receive HW switch events. > It exports rfkill device dell-rbtn which provide correct hard rfkill state. > > Alex Hung added code for supporting Dell laptops which have toggle button > instead HW slider switch. On these laptops toggle button event is reported > by new input device (instead rfkill) as they do not have hw radio switch. > > It looks like those are two different functions (rfkill, input device), but > Dell BIOS exports them via same ACPI device and uses same ACPI functions. > So code is in one kernel driver. I made a patch some time ago that I've just adapted. It allows to prefer RBTN_SLIDER over RBTN_TOGGLE. The main reason why I'd like to have the hardware switch is that the BIOS doesn't alter the soft state of the devices. This comes in handy when the function key controls multiple radio devices. Here below the simple patch. Maybe I could improve it and allow a dynamic switch between RBTN_TOGGLE and RBTN_SLIDER. >From 35d39a4ad079489147b4ce22651c5e4e18856cf0 Mon Sep 17 00:00:00 2001 From: Gabriele Mazzotta Date: Wed, 29 Apr 2015 12:24:52 +0200 Subject: [PATCH] dell-rbtn: Add module param to force the radio hardware switch dell-rbtn determines whether the BIOS controls the radio devices when function keys are pressed by calling the ACPI method CRBT. As long as the ACPI method ARBT is called with 1 as argument, we are sure that what is returned by CRBT holds. This patch adds the possibility to pass a parameter that will make dell-rbtn ignore the value returned by CRBT and call ARBT with 0 as argument. This will allow users to have the BIOS control the radio devices. Since there is no way to know when this is possible, it's up to the user to force the mode. This guarantees the correct functionality of the driver except when the user forces the mode. --- drivers/platform/x86/dell-rbtn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/dell-rbtn.c b/drivers/platform/x86/dell-rbtn.c index 07dfd8f..8f8d62b 100644 --- a/drivers/platform/x86/dell-rbtn.c +++ b/drivers/platform/x86/dell-rbtn.c @@ -30,6 +30,8 @@ struct rbtn_data { struct input_dev *input_dev; }; +static bool force_hw_switch; +module_param(force_hw_switch, bool, S_IRUGO); /* * acpi functions @@ -44,6 +46,9 @@ static enum rbtn_type rbtn_check(struct acpi_device *device) if (ACPI_FAILURE(status)) return RBTN_UNKNOWN; + if (force_hw_switch) + return RBTN_SLIDER; + switch (output) { case 0: case 1: @@ -321,7 +326,7 @@ static int rbtn_add(struct acpi_device *device) return -EINVAL; } - ret = rbtn_radio_enable(device, true); + ret = rbtn_radio_enable(device, !force_hw_switch); if (ret < 0) { dev_err(&device->dev, "Cannot enable device\n"); return ret; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/