mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Armin Wolf <W_Armin@gmx.de>
To: "Werner Sembach" <wse@tuxedocomputers.com>,
	"Pőcze Barnabás" <pobrn@protonmail.com>,
	ilpo.jarvinen@linux.intel.com, hdegoede@redhat.com,
	chumuzero@gmail.com, corbet@lwn.net, cs@tuxedo.de,
	ggo@tuxedocomputers.com
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Subject: Re: [RFC PATCH 2/3] platform/x86: Add Uniwill laptop driver
Date: Mon, 30 Jun 2025 15:21:26 +0200	[thread overview]
Message-ID: <645bc973-bc0e-4e2f-9df1-6670892e7f32@gmx.de> (raw)
In-Reply-To: <13ae680f-7384-4261-8555-d77ba94ecd3c@tuxedocomputers.com>

Am 30.06.25 um 14:55 schrieb Werner Sembach:

>
> Am 30.06.25 um 14:40 schrieb Armin Wolf:
>> Am 30.06.25 um 14:32 schrieb Werner Sembach:
>>
>>> Hi,
>>>
>>> Am 28.06.25 um 01:09 schrieb Armin Wolf:
>>>> Am 25.06.25 um 17:59 schrieb Pőcze Barnabás:
>>>>
>>>>> Hi
>>>>>
>>>>> 2025. 06. 23. 0:36 keltezéssel, Armin Wolf írta:
>>>>>> Am 22.06.25 um 23:37 schrieb Pőcze Barnabás:
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>>
>>>>>>> 2025. 06. 15. 19:59 keltezéssel, Armin Wolf írta:
>>>>>>>> Add a new driver for Uniwill laptops. The driver uses a ACPI WMI
>>>>>>>> interface to talk with the embedded controller, but relies on a
>>>>>>>> DMI whitelist for autoloading since Uniwill just copied the WMI
>>>>>>>> GUID from the Windows driver example.
>>>>>>>>
>>>>>>>> The driver is reverse-engineered based on the following 
>>>>>>>> information:
>>>>>>>> - OEM software from intel
>>>>>>>> - https://github.com/pobrn/qc71_laptop
>>>>>>> Oh... I suppose an end of an era for me...
>>>>>> I now remember that we interacted on the mailing lists before, 
>>>>>> sorry for not CCing
>>>>>> you on this patch series.
>>>>>>
>>>>>> Do you want a Co-developed-by tag on those patches?
>>>>> I'll leave it up to you.
>>>>>
>>>>>
>>>>>>>> - https://github.com/tuxedocomputers/tuxedo-drivers
>>>>>>>> - https://github.com/tuxedocomputers/tuxedo-control-center
>>>>>>>>
>>>>>>>> The underlying EC supports various features, including hwmon 
>>>>>>>> sensors,
>>>>>>>> battery charge limiting, a RGB lightbar and keyboard-related 
>>>>>>>> controls.
>>>>>>>>
>>>>>>>> Reported-by: cyear <chumuzero@gmail.com>
>>>>>>>> Closes: https://github.com/lm-sensors/lm-sensors/issues/508
>>>>>>>> Closes: https://github.com/Wer-Wolf/uniwill-laptop/issues/3
>>>>>>>> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
>>>>>>>> ---
>>>>>>>>      .../ABI/testing/sysfs-driver-uniwill-laptop   | 53 +
>>>>>>>>      Documentation/wmi/devices/uniwill-laptop.rst  | 109 ++
>>>>>>>>      MAINTAINERS                                   | 8 +
>>>>>>>>      drivers/platform/x86/uniwill/Kconfig          | 17 +
>>>>>>>>      drivers/platform/x86/uniwill/Makefile         | 1 +
>>>>>>>>      drivers/platform/x86/uniwill/uniwill-laptop.c | 1477 
>>>>>>>> +++++++++++++++++
>>>>>>>>      drivers/platform/x86/uniwill/uniwill-wmi.c    | 3 +-
>>>>>>>>      7 files changed, 1667 insertions(+), 1 deletion(-)
>>>>>>>>      create mode 100644 
>>>>>>>> Documentation/ABI/testing/sysfs-driver-uniwill-laptop
>>>>>>>>      create mode 100644 
>>>>>>>> Documentation/wmi/devices/uniwill-laptop.rst
>>>>>>>>      create mode 100644 
>>>>>>>> drivers/platform/x86/uniwill/uniwill-laptop.c
>>>>>>>>
>>>>>> [...]
>>>>>>>> +
>>>>>>>> +static const unsigned int 
>>>>>>>> uniwill_led_channel_to_bat_reg[LED_CHANNELS] = {
>>>>>>>> +    EC_ADDR_LIGHTBAR_BAT_RED,
>>>>>>>> +    EC_ADDR_LIGHTBAR_BAT_GREEN,
>>>>>>>> +    EC_ADDR_LIGHTBAR_BAT_BLUE,
>>>>>>>> +};
>>>>>>>> +
>>>>>>>> +static const unsigned int 
>>>>>>>> uniwill_led_channel_to_ac_reg[LED_CHANNELS] = {
>>>>>>>> +    EC_ADDR_LIGHTBAR_AC_RED,
>>>>>>>> +    EC_ADDR_LIGHTBAR_AC_GREEN,
>>>>>>>> +    EC_ADDR_LIGHTBAR_AC_BLUE,
>>>>>>>> +};
>>>>>>>> +
>>>>>>>> +static int uniwill_led_brightness_set(struct led_classdev 
>>>>>>>> *led_cdev, enum led_brightness brightness)
>>>>>>>> +{
>>>>>>>> +    struct led_classdev_mc *led_mc_cdev = 
>>>>>>>> lcdev_to_mccdev(led_cdev);
>>>>>>>> +    struct uniwill_data *data = container_of(led_mc_cdev, 
>>>>>>>> struct uniwill_data, led_mc_cdev);
>>>>>>>> +    unsigned int value;
>>>>>>>> +    int ret;
>>>>>>>> +
>>>>>>>> +    ret = led_mc_calc_color_components(led_mc_cdev, brightness);
>>>>>>>> +    if (ret < 0)
>>>>>>>> +        return ret;
>>>>>>>> +
>>>>>>>> +    for (int i = 0; i < LED_CHANNELS; i++) {
>>>>>>>> +        /* Prevent the brightness values from overflowing */
>>>>>>>> +        value = min(LED_MAX_BRIGHTNESS, 
>>>>>>>> data->led_mc_subled_info[i].brightness);
>>>>>>>> +        ret = regmap_write(data->regmap, 
>>>>>>>> uniwill_led_channel_to_ac_reg[i], value);
>>>>>>> This is interesting. I am not sure which "control center" 
>>>>>>> application you have looked at,
>>>>>>> but I found many lookup tables based on the exact model, etc. 
>>>>>>> For example, on my laptop
>>>>>>> any value larger than 36 will simply turn that color component 
>>>>>>> off. Have you seen
>>>>>>> anything like that?
>>>>>> I was using the Intel NUC studio software application during 
>>>>>> reverse-engineering and had a user
>>>>>> test the resulting code on a Intel NUC notebook. AFAIK the OEM 
>>>>>> software did not use a lookup table.
>>>>>>
>>>>>> If we extend this driver in the future then we might indeed use 
>>>>>> the quirk system to change the max.
>>>>>> LED brightness depending on the model.
>>>>> I see. So everything up to 200 works. And after that do you know 
>>>>> if it turns off or what happens?
>>>>
>>>> The user who tested the driver reported that "the brightest 
>>>> lightbar setting is 200", so i assume
>>>> that the lightbar simply clamps the values. However i would not 
>>>> trust the EC firmware in the slightest,
>>>> i can definitely imagine that other models react differently.
>>>
>>> Iirc at least for keyboard backlight on tf devices there was a value 
>>> that could be overwritten to make the values 0-255 instead of 0-200, 
>>> maybe this is also true for the lightbar, but i don't know if this 
>>> affects the livespan of the leds.
>>>
>>> Best regards,
>>>
>>> Werner
>>>
>> Interesting, do you know the register offset of this value?
>
> Not out of my head, would have to dig for it again or even re reverse 
> engineer it again as I'm not sure if I wrote it down ...
>
> So if it is not required I would like to leave it at that and only do 
> the work if it turns out to be needed.
>
Fine with me.

>>
>> Thanks,
>> Armin Wolf
>>
>

  reply	other threads:[~2025-06-30 13:21 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-15 17:59 [RFC PATCH 0/3] platform/x86: Add support for Uniwill laptop features Armin Wolf
2025-06-15 17:59 ` [RFC PATCH 1/3] platform/x86: Add Uniwill WMI driver Armin Wolf
2025-06-15 18:46   ` Randy Dunlap
2025-06-15 19:05   ` ALOK TIWARI
2025-06-17 20:58     ` Armin Wolf
2025-06-15 20:32   ` Randy Dunlap
2025-06-16  9:21   ` Hans de Goede
2025-06-17 21:10     ` Armin Wolf
2025-06-18  7:23       ` Hans de Goede
2025-06-16 11:14   ` Werner Sembach
2025-06-15 17:59 ` [RFC PATCH 2/3] platform/x86: Add Uniwill laptop driver Armin Wolf
2025-06-15 19:00   ` Randy Dunlap
2025-06-17 21:40     ` Armin Wolf
2025-06-15 20:39   ` Randy Dunlap
2025-06-16  8:10   ` Ilpo Järvinen
2025-06-17 21:47     ` Armin Wolf
2025-06-16 12:32   ` Werner Sembach
2025-06-17 21:50     ` Armin Wolf
2025-06-18 11:15       ` Werner Sembach
2025-06-22 18:58         ` Armin Wolf
2025-06-16 12:46   ` Werner Sembach
2025-06-17 21:52     ` Armin Wolf
2025-06-19  9:47       ` Lee Jones
2025-06-19 12:30         ` Hans de Goede
2025-06-19 15:17           ` Lee Jones
2025-06-19 20:03             ` Hans de Goede
2025-06-22 19:19               ` Armin Wolf
2025-06-22 21:37   ` Pőcze Barnabás
2025-06-22 22:36     ` Armin Wolf
2025-06-25 15:59       ` Pőcze Barnabás
2025-06-27 23:09         ` Armin Wolf
2025-06-30 12:32           ` Werner Sembach
2025-06-30 12:40             ` Armin Wolf
2025-06-30 12:55               ` Werner Sembach
2025-06-30 13:21                 ` Armin Wolf [this message]
2025-06-15 17:59 ` [RFC PATCH 3/3] Documentation: laptops: Add documentation for uniwill laptops Armin Wolf
2025-06-18  6:23   ` Randy Dunlap
2025-06-18 20:06     ` Armin Wolf
2025-06-16 12:59 ` [RFC PATCH 0/3] platform/x86: Add support for Uniwill laptop features Werner Sembach
2025-06-17 22:02   ` Armin Wolf

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=645bc973-bc0e-4e2f-9df1-6670892e7f32@gmx.de \
    --to=w_armin@gmx.de \
    --cc=chumuzero@gmail.com \
    --cc=corbet@lwn.net \
    --cc=cs@tuxedo.de \
    --cc=ggo@tuxedocomputers.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.com \
    --cc=wse@tuxedocomputers.com \
    /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®