[PATCH] dell-rbtn: Add module param to force the radio hardware switch

From: Gabriele Mazzotta
Date: Wed Apr 29 2015 - 06:24:52 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/