On Tue, 26 Mar 2024, at 2:47 AM, Ilpo Järvinen wrote: > On Mon, 25 Mar 2024, Luke D. Jones wrote: > > > Support the 2024 mini-led backlight and adjust the related functions > > to select the relevant dev-id. Also add `available_mini_led_mode` to the > > platform sysfs since the available mini-led levels can be different. > > > > Signed-off-by: Luke D. Jones <luke@xxxxxxxxxx> > > --- > > .../ABI/testing/sysfs-platform-asus-wmi | 8 ++ > > drivers/platform/x86/asus-wmi.c | 74 +++++++++++++++++-- > > include/linux/platform_data/x86/asus-wmi.h | 1 + > > 3 files changed, 76 insertions(+), 7 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi > > index 8a7e25bde085..61a745d2476f 100644 > > --- a/Documentation/ABI/testing/sysfs-platform-asus-wmi > > +++ b/Documentation/ABI/testing/sysfs-platform-asus-wmi > > @@ -126,6 +126,14 @@ Description: > > Change the mini-LED mode: > > * 0 - Single-zone, > > * 1 - Multi-zone > > + * 2 - Multi-zone strong (available on newer generation mini-led) > > + > > +What: /sys/devices/platform/<platform>/available_mini_led_mode > > +Date: Jun 2023 > > +KernelVersion: 6.10 > > +Contact: "Luke Jones" <luke@xxxxxxxxxx> > > +Description: > > + List the available mini-led modes. > > > > What: /sys/devices/platform/<platform>/ppt_pl1_spl > > Date: Jun 2023 > > diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c > > index 18be35fdb381..54ce0fb26f42 100644 > > --- a/drivers/platform/x86/asus-wmi.c > > +++ b/drivers/platform/x86/asus-wmi.c > > @@ -297,6 +297,7 @@ struct asus_wmi { > > > > bool panel_overdrive_available; > > bool mini_led_mode_available; > > + u32 mini_led_dev_id; > > > > struct hotplug_slot hotplug_slot; > > struct mutex hotplug_lock; > > @@ -2109,10 +2110,27 @@ static ssize_t mini_led_mode_show(struct device *dev, > > struct asus_wmi *asus = dev_get_drvdata(dev); > > int result; > > > > - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MINI_LED_MODE); > > - if (result < 0) > > - return result; > > + result = asus_wmi_get_devstate_simple(asus, asus->mini_led_dev_id); > > > > + /* Remap the mode values to match previous generation mini-led. > > + * Some BIOSes return -19 instead of 2, which is "mini-LED off", this > > + * appears to be a BIOS bug. > > + */ > > + if (asus->mini_led_dev_id == ASUS_WMI_DEVID_MINI_LED_MODE2) { > > + switch (result) { > > + case 0: > > + result = 1; > > + break; > > + case 1: > > + result = 2; > > + break; > > + case 2: > > + case -19: > > Can you confirm this -19 really does come from BIOS? Because I suspect > it's -ENODEV error code from from one of the functions on the driver side > (which is why I asked you to change it into -ENODEV). Yes it does. It is rather annoying. What happens in this case is that `2` is written to the WMI endpoint to turn off the MINI-Led feature, this works fine and it is turned off, there are no errors from the write at all - verifying the accepted limits in dsdt also shows it is correct. However, after that, the read fails once. And only if that `2` was written. `0` and `1` write fine, and read fine also. I hope I've managed to describe and clarify what I'm seeing here. I'm happy to change -ENODEV. No problem, queued on my todo list. Cheers, Luke.