All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Luke D. 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: Mon, 25 Mar 2024 15:47:46 +0200 (EET)	[thread overview]
Message-ID: <2cadcf26-7b99-3b32-8441-1b3939cf93b4@linux.intel.com> (raw)
In-Reply-To: <20240325054938.489732-2-luke@ljones.dev>

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>
> ---
>  .../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@ljones.dev>
> +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).


-- 
 i.


  reply	other threads:[~2024-03-25 13:47 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 [this message]
2024-03-25 20:35     ` Luke Jones
2024-03-26 11:49       ` Ilpo Järvinen
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=2cadcf26-7b99-3b32-8441-1b3939cf93b4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.