From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Luke Jones <luke@ljones.dev>
Cc: Hans de Goede <hdegoede@redhat.com>,
corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/9] platform/x86: asus-wmi: add support for 2024 ROG Mini-LED
Date: Tue, 26 Mar 2024 13:49:16 +0200 (EET) [thread overview]
Message-ID: <13a24576-da89-95b8-4ed2-c24b5ba54a21@linux.intel.com> (raw)
In-Reply-To: <9962eb39-23b8-470c-aab9-698f10c80358@app.fastmail.com>
[-- Attachment #1: Type: text/plain, Size: 2993 bytes --]
On Tue, 26 Mar 2024, Luke Jones wrote:
> 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@ljones.dev>
> > > ---
> > > @@ -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.
Hi,
I'm left a bit unsure how to interpret your response. If "read fails", it
would indicate that -ENODEV originates from asus_wmi_evaluate_method3(),
asus_wmi_get_devstate() or asus_wmi_get_devstate_bits(), not from BIOS? So
which way it is?
After reading some more code, I think I figured out the answer myself.
However, that raises another question... So lets now take a step back and
walk through the code:
Your patch does:
result = asus_wmi_get_devstate_simple(asus, asus->mini_led_dev_id);
asus_wmi_get_devstate_simple() calls asus_wmi_get_devstate_bits() with
ASUS_WMI_DSTS_STATUS_BIT mask that is 0x00000001.
If there's no error, retval is masked with that ASUS_WMI_DSTS_STATUS_BIT
forcing the return value to 0-1 range so:
a) I don't think -19 can originate from BIOS but comes from kernel side.
b) How can it ever return 2 (mini-LED off) ?????
> 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.
--
i.
next prev parent reply other threads:[~2024-03-26 11:49 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 5:49 [PATCH 0/9] asus-wmi: add new features, clean up, fixes Luke D. Jones
2024-03-25 5:49 ` [PATCH 1/9] platform/x86: asus-wmi: add support for 2024 ROG Mini-LED Luke D. Jones
2024-03-25 13:47 ` Ilpo Järvinen
2024-03-25 20:35 ` Luke Jones
2024-03-26 11:49 ` Ilpo Järvinen [this message]
2024-03-27 3:01 ` Luke Jones
2024-03-25 5:49 ` [PATCH 2/9] platform/x86: asus-wmi: add support for Vivobook GPU MUX Luke D. Jones
2024-03-25 5:49 ` [PATCH 3/9] platform/x86: asus-wmi: add support variant of TUF RGB Luke D. Jones
2024-03-25 5:49 ` [PATCH 4/9] platform/x86: asus-wmi: support toggling POST sound Luke D. Jones
2024-03-25 13:51 ` Ilpo Järvinen
2024-03-25 14:02 ` Ilpo Järvinen
2024-03-25 20:40 ` Luke Jones
2024-03-25 5:49 ` [PATCH 5/9] platform/x86: asus-wmi: store a min default for ppt options Luke D. Jones
2024-03-25 5:49 ` [PATCH 6/9] platform/x86: asus-wmi: adjust formatting of ppt-<name>() functions Luke D. Jones
2024-03-25 5:49 ` [PATCH 7/9] platform/x86: asus-wmi: ROG Ally increase wait time, allow MCU powersave Luke D. Jones
2024-03-25 5:49 ` [PATCH 8/9] platform/x86: asus-wmi: Add support for " Luke D. Jones
2024-03-25 13:53 ` Ilpo Järvinen
2024-03-25 20:36 ` Luke Jones
2024-03-25 5:49 ` [PATCH 9/9] platform/x86: asus-wmi: cleanup main struct to avoid some holes Luke D. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13a24576-da89-95b8-4ed2-c24b5ba54a21@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=corentin.chary@gmail.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox