Commit e06e4831 authored by Michał Kępień's avatar Michał Kępień Committed by Darren Hart (VMware)

platform/x86: fujitsu-laptop: clean up use_alt_lcd_levels handling

The value of each module parameter can be changed on the fly via sysfs.
However, the current way of handling use_alt_lcd_levels prevents the
user from dynamically switching from a value of 0 or 1 back to
autodetection as the latter is only performed upon ACPI device
instantiation.  Fix this by moving autodetection (in a simplified form)
to set_lcd_level() and changing module parameter type to int.  Do not
announce autodetection results in a debug message as current value of
use_alt_lcd_levels can simply be read from sysfs.  Clarify module
parameter description.
Signed-off-by: default avatarMichał Kępień <kernel@kempniu.pl>
Reviewed-by: default avatarJonathan Woithe <jwoithe@just42.net>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent bd079a2c
...@@ -347,6 +347,12 @@ static int set_lcd_level(int level) ...@@ -347,6 +347,12 @@ static int set_lcd_level(int level)
char *method; char *method;
switch (use_alt_lcd_levels) { switch (use_alt_lcd_levels) {
case -1:
if (acpi_has_method(fujitsu_bl->acpi_handle, "SBL2"))
method = "SBL2";
else
method = "SBLL";
break;
case 1: case 1:
method = "SBL2"; method = "SBL2";
break; break;
...@@ -591,21 +597,10 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) ...@@ -591,21 +597,10 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)
pr_err("_INI Method failed\n"); pr_err("_INI Method failed\n");
} }
if (use_alt_lcd_levels == -1) {
if (acpi_has_method(NULL, "\\_SB.PCI0.LPCB.FJEX.SBL2"))
use_alt_lcd_levels = 1;
else
use_alt_lcd_levels = 0;
vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as %i\n",
use_alt_lcd_levels);
}
/* do config (detect defaults) */ /* do config (detect defaults) */
use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0;
disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0; disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0;
vdbg_printk(FUJLAPTOP_DBG_INFO, vdbg_printk(FUJLAPTOP_DBG_INFO, "config: [adjust disable: %d]\n",
"config: [alt interface: %d], [adjust disable: %d]\n", disable_brightness_adjust);
use_alt_lcd_levels, disable_brightness_adjust);
if (get_max_brightness() <= 0) if (get_max_brightness() <= 0)
fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS; fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS;
...@@ -1138,9 +1133,8 @@ static void __exit fujitsu_cleanup(void) ...@@ -1138,9 +1133,8 @@ static void __exit fujitsu_cleanup(void)
module_init(fujitsu_init); module_init(fujitsu_init);
module_exit(fujitsu_cleanup); module_exit(fujitsu_cleanup);
module_param(use_alt_lcd_levels, uint, 0644); module_param(use_alt_lcd_levels, int, 0644);
MODULE_PARM_DESC(use_alt_lcd_levels, MODULE_PARM_DESC(use_alt_lcd_levels, "Interface used for setting LCD brightness level (-1 = auto, 0 = force SBLL, 1 = force SBL2)");
"Use alternative interface for lcd_levels (needed for Lifebook s6410).");
module_param(disable_brightness_adjust, uint, 0644); module_param(disable_brightness_adjust, uint, 0644);
MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment ."); MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment .");
#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment