Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: asus-wmi: fix screenpad brightness range

Fix screenpad brightness range being too limited without reason:
testing this patch on a Zenbook Duo showed the hardware minimum not being
too low, therefore allow the user to configure the entire range, and
expose to userspace the hardware brightness range and value.

Fixes: 2c97d3e55b70 ("platform/x86: asus-wmi: add support for ASUS screenpad")
Signed-off-by: Denis Benato <denis.benato@linux.dev>
Signed-off-by: Luke Jones <luke@ljones.dev>
Link: https://patch.msgid.link/20260302174431.349816-3-denis.benato@linux.dev
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Denis Benato and committed by
Ilpo Järvinen
8d95d1f4 130d29c5

+6 -10
+6 -10
drivers/platform/x86/asus-wmi.c
··· 125 125 #define NVIDIA_TEMP_MIN 75 126 126 #define NVIDIA_TEMP_MAX 87 127 127 128 - #define ASUS_SCREENPAD_BRIGHT_MIN 20 129 128 #define ASUS_SCREENPAD_BRIGHT_MAX 255 130 129 #define ASUS_SCREENPAD_BRIGHT_DEFAULT 60 131 130 ··· 4410 4411 return err; 4411 4412 /* The device brightness can only be read if powered, so return stored */ 4412 4413 if (err == BACKLIGHT_POWER_OFF) 4413 - return asus->driver->screenpad_brightness - ASUS_SCREENPAD_BRIGHT_MIN; 4414 + return bd->props.brightness; 4414 4415 4415 4416 err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_SCREENPAD_LIGHT, &retval); 4416 4417 if (err < 0) 4417 4418 return err; 4418 4419 4419 - return (retval & ASUS_WMI_DSTS_BRIGHTNESS_MASK) - ASUS_SCREENPAD_BRIGHT_MIN; 4420 + return retval & ASUS_WMI_DSTS_BRIGHTNESS_MASK; 4420 4421 } 4421 4422 4422 4423 static int update_screenpad_bl_status(struct backlight_device *bd) ··· 4456 4457 int err, power; 4457 4458 int brightness = 0; 4458 4459 4459 - power = read_screenpad_backlight_power(asus); 4460 + power = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_SCREENPAD_POWER); 4460 4461 if (power < 0) 4461 4462 return power; 4462 4463 4463 - if (power != BACKLIGHT_POWER_OFF) { 4464 + if (power) { 4464 4465 err = asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_SCREENPAD_LIGHT, &brightness); 4465 4466 if (err < 0) 4466 4467 return err; 4467 4468 } 4468 - /* default to an acceptable min brightness on boot if too low */ 4469 - if (brightness < ASUS_SCREENPAD_BRIGHT_MIN) 4470 - brightness = ASUS_SCREENPAD_BRIGHT_DEFAULT; 4471 4469 4472 4470 memset(&props, 0, sizeof(struct backlight_properties)); 4473 4471 props.type = BACKLIGHT_RAW; /* ensure this bd is last to be picked */ 4474 - props.max_brightness = ASUS_SCREENPAD_BRIGHT_MAX - ASUS_SCREENPAD_BRIGHT_MIN; 4472 + props.max_brightness = ASUS_SCREENPAD_BRIGHT_MAX; 4475 4473 bd = backlight_device_register("asus_screenpad", 4476 4474 &asus->platform_device->dev, asus, 4477 4475 &asus_screenpad_bl_ops, &props); ··· 4479 4483 4480 4484 asus->screenpad_backlight_device = bd; 4481 4485 asus->driver->screenpad_brightness = brightness; 4482 - bd->props.brightness = brightness - ASUS_SCREENPAD_BRIGHT_MIN; 4486 + bd->props.brightness = brightness; 4483 4487 bd->props.power = power; 4484 4488 backlight_update_status(bd); 4485 4489