From: Hans de Goede <hdegoede@redhat.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Luke D. Jones" <luke@ljones.dev>
Cc: corentin.chary@gmail.com, platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/9] platform/x86: asus-wmi: add support for 2024 ROG Mini-LED
Date: Mon, 8 Apr 2024 18:32:03 +0200 [thread overview]
Message-ID: <b53104be-2443-4832-9bb0-c0bec64e72d8@redhat.com> (raw)
In-Reply-To: <590fea48-ac39-4db4-47c5-366a6814c9b3@linux.intel.com>
Hi,
On 4/4/24 11:33 AM, Ilpo Järvinen wrote:
> On Thu, 4 Apr 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.
>>
>> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>> signed-off-by: Luke D. Jones <luke@ljones.dev>
>> ---
>> .../ABI/testing/sysfs-platform-asus-wmi | 8 ++
>> drivers/platform/x86/asus-wmi.c | 96 +++++++++++++++++--
>> include/linux/platform_data/x86/asus-wmi.h | 1 +
>> 3 files changed, 95 insertions(+), 10 deletions(-)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-platform-asus-wmi b/Documentation/ABI/testing/sysfs-platform-asus-wmi
>> index 8a7e25bde085..ef1ac1a20a71 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: Apr 2024
>> +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 3f07bbf809ef..aa2a3b402e33 100644
>> --- a/drivers/platform/x86/asus-wmi.c
>> +++ b/drivers/platform/x86/asus-wmi.c
>> @@ -126,6 +126,17 @@ module_param(fnlock_default, bool, 0444);
>> #define ASUS_SCREENPAD_BRIGHT_MAX 255
>> #define ASUS_SCREENPAD_BRIGHT_DEFAULT 60
>>
>> +#define ASUS_MINI_LED_MODE_MASK 0x03
>> +/* Standard modes for devices with only on/off */
>> +#define ASUS_MINI_LED_OFF 0x00
>> +#define ASUS_MINI_LED_ON 0x01
>> +/* New mode on some devices, define here to clarify remapping later */
>> +#define ASUS_MINI_LED_STRONG_MODE 0x02
>> +/* New modes for devices with 3 mini-led mode types */
>> +#define ASUS_MINI_LED_2024_WEAK 0x00
>> +#define ASUS_MINI_LED_2024_STRONG 0x01
>> +#define ASUS_MINI_LED_2024_OFF 0x02
>> +
>> /* Controls the power state of the USB0 hub on ROG Ally which input is on */
>> #define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE"
>> /* 300ms so far seems to produce a reliable result on AC and battery */
>> @@ -288,7 +299,7 @@ struct asus_wmi {
>> bool battery_rsoc_available;
>>
>> bool panel_overdrive_available;
>> - bool mini_led_mode_available;
>> + u32 mini_led_dev_id;
>>
>> struct hotplug_slot hotplug_slot;
>> struct mutex hotplug_lock;
>> @@ -2108,13 +2119,33 @@ static ssize_t mini_led_mode_show(struct device *dev,
>> struct device_attribute *attr, char *buf)
>> {
>> struct asus_wmi *asus = dev_get_drvdata(dev);
>> - int result;
>> + u32 value;
>> + int err;
>>
>> - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MINI_LED_MODE);
>> - if (result < 0)
>> - return result;
>> + err = asus_wmi_get_devstate(asus, asus->mini_led_dev_id, &value);
>> + if (err < 0)
>> + return err;
>> + value = value & ASUS_MINI_LED_MODE_MASK;
>>
>> - return sysfs_emit(buf, "%d\n", result);
>> + /*
>> + * Remap the mode values to match previous generation mini-led. The last gen
>> + * WMI 0 == off, while on this version WMI 2 ==off (flipped).
>> + */
>> + if (asus->mini_led_dev_id == ASUS_WMI_DEVID_MINI_LED_MODE2) {
>> + switch (value) {
>> + case ASUS_MINI_LED_2024_WEAK:
>> + value = ASUS_MINI_LED_ON;
>> + break;
>> + case ASUS_MINI_LED_2024_STRONG:
>> + value = ASUS_MINI_LED_STRONG_MODE;
>> + break;
>> + case ASUS_MINI_LED_2024_OFF:
>> + value = ASUS_MINI_LED_OFF;
>> + break;
>> + }
>> + }
>> +
>> + return sysfs_emit(buf, "%d\n", value);
>> }
>>
>> static ssize_t mini_led_mode_store(struct device *dev,
>> @@ -2130,11 +2161,32 @@ static ssize_t mini_led_mode_store(struct device *dev,
>> if (result)
>> return result;
>>
>> - if (mode > 1)
>> + if (asus->mini_led_dev_id == ASUS_WMI_DEVID_MINI_LED_MODE &&
>> + mode > ASUS_MINI_LED_ON)
>> + return -EINVAL;
>> + if (asus->mini_led_dev_id == ASUS_WMI_DEVID_MINI_LED_MODE2 &&
>> + mode > ASUS_MINI_LED_STRONG_MODE)
>
> The if condition continations should not be indented to the same level as
> its statement block because it confuses the reader. Hans might be able to
> fix this while applying though so I'm not sure if it's necessary to send a
> new version just because of this.
Luke, thank you for the patches.
Ilpo, thank you for all the reviews.
I've fixed this small issue up while merging this and pushed out this
entire series to my review-hans branch.
Regards,
Hans
next prev parent reply other threads:[~2024-04-08 16:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 0:16 [PATCH v4 0/9] asus-wmi: add new features, clean up, fixes Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 1/9] platform/x86: asus-wmi: add support for 2024 ROG Mini-LED Luke D. Jones
2024-04-04 9:33 ` Ilpo Järvinen
2024-04-08 16:32 ` Hans de Goede [this message]
2024-04-04 0:16 ` [PATCH v4 2/9] platform/x86: asus-wmi: add support for Vivobook GPU MUX Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 3/9] platform/x86: asus-wmi: add support variant of TUF RGB Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 4/9] platform/x86: asus-wmi: support toggling POST sound Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 5/9] platform/x86: asus-wmi: store a min default for ppt options Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 6/9] platform/x86: asus-wmi: adjust formatting of ppt-<name>() functions Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 7/9] platform/x86: asus-wmi: ROG Ally increase wait time, allow MCU powersave Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 8/9] platform/x86: asus-wmi: Add support for " Luke D. Jones
2024-04-04 0:16 ` [PATCH v4 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=b53104be-2443-4832-9bb0-c0bec64e72d8@redhat.com \
--to=hdegoede@redhat.com \
--cc=corentin.chary@gmail.com \
--cc=ilpo.jarvinen@linux.intel.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
all inboxes | Powered by JetHome®