[3/3,SRU,B,C,D] UBUNTU: SAUCE: platform/x86: dell-uart-backlight: add force parameter

Message ID 20190130091026.14290-4-acelan.kao@canonical.com
State New
Headers show
Series
  • Can't adjust brightness on DELL UHD dGPU AIO
Related show

Commit Message

AceLan Kao Jan. 30, 2019, 9:10 a.m.
BugLink: https://bugs.launchpad.net/bugs/1813877

Add force parameter to force load the driver if the platform doesn't
provide a working scalar status command.

Signed-off-by: AceLan Kao <acelan.kao@canonical.com>
---
 drivers/platform/x86/dell-uart-backlight.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/platform/x86/dell-uart-backlight.c b/drivers/platform/x86/dell-uart-backlight.c
index a1ec0067291f..f81fc01606d0 100644
--- a/drivers/platform/x86/dell-uart-backlight.c
+++ b/drivers/platform/x86/dell-uart-backlight.c
@@ -40,6 +40,10 @@  unsigned int (*io_serial_in)(struct uart_port *p, int offset);
 int (*uart_write)(struct tty_struct *tty, const unsigned char *buf, int count);
 int (*uart_chars_in_buffer)(struct tty_struct *tty);
 
+static bool force;
+module_param(force, bool, 0444);
+MODULE_PARM_DESC(force, "load the driver regardless of the scalar status");
+
 static struct dell_uart_bl_cmd uart_cmd[] = {
 	/*
 	 * Get Firmware Version: Tool uses this command to get firmware version.
@@ -381,7 +385,7 @@  static int dell_uart_bl_add(struct acpi_device *dev)
 
 	mutex_init(&dell_pdata->brightness_mutex);
 
-	if (!dell_uart_get_scalar_status(dell_pdata)) {
+	if (!force && !dell_uart_get_scalar_status(dell_pdata)) {
 		pr_debug("Scalar is not in charge of brightness adjustment.\n");
 		kzfree(dell_pdata);
 		return -1;