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>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/2] platform/x86: uniwill-laptop: Fix brightness notify for 3 level keyboards
Date: Wed, 26 Aug 2026 23:37:01 +0200	[thread overview]
Message-ID: <c84328eb-0126-4558-8241-a41e641f9681@gmx.de> (raw)
In-Reply-To: <20260822003012.851574-1-wse@tuxedocomputers.com>

Am 22.08.26 um 02:28 schrieb Werner Sembach:

> The devices with 3 brightness level keyboards send
> UNIWILL_OSD_KB_LED_LEVEL0, UNIWILL_OSD_KB_LED_LEVEL2, and
> UNIWILL_OSD_KB_LED_LEVEL4 and not UNIWILL_OSD_KB_LED_LEVEL0,
> UNIWILL_OSD_KB_LED_LEVEL1, and UNIWILL_OSD_KB_LED_LEVEL2.
>
> This patch maps the events correctly to brightness levels 0, 1, and 2.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

> Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
> ---
> V1->V2: Use the events as source of truth for brightness_hw_changed value
>          again to avoid a race condition as Armin had pointed out.
> V2->V3: Return error for unexpected brightness level count.
>
>   drivers/platform/x86/uniwill/uniwill-acpi.c | 26 +++++++++++++++++++++
>   1 file changed, 26 insertions(+)
>
> diff --git a/drivers/platform/x86/uniwill/uniwill-acpi.c b/drivers/platform/x86/uniwill/uniwill-acpi.c
> index 7a2eeaec4c961..5df3611919ce3 100644
> --- a/drivers/platform/x86/uniwill/uniwill-acpi.c
> +++ b/drivers/platform/x86/uniwill/uniwill-acpi.c
> @@ -1631,6 +1631,32 @@ static int uniwill_notify_kbd_led(struct uniwill_data *data, int brightness)
>   	struct led_classdev *led_cdev;
>   	int ret;
>   
> +	/*
> +	 * The devices with 3 brightness level keyboards send
> +	 * UNIWILL_OSD_KB_LED_LEVEL0, UNIWILL_OSD_KB_LED_LEVEL2, and
> +	 * UNIWILL_OSD_KB_LED_LEVEL4 which need to be mapped to 0, 1, and 2.
> +	 */
> +	switch (data->kbd_led_max_brightness) {
> +	case 4:
> +		break;
> +	case 2:
> +		switch (brightness) {
> +		case 0:
> +			break;
> +		case 2:
> +			brightness = 1;
> +			break;
> +		case 4:
> +			brightness = 2;
> +			break;
> +		default:
> +			return -EINVAL;
> +		}
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
>   	if (data->kbd_led_single_color)
>   		led_cdev = &data->kbd_led_cdev;
>   	else
>
> base-commit: 54745d563114b74f6fecebce68cd020d06c1772b

  parent reply	other threads:[~2026-08-26 21:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22  0:28 Werner Sembach
2026-08-22  0:28 ` [PATCH v3 2/2] platform/x86: uniwill-laptop: Enable kb backlight and lightbar for TUXEDO Werner Sembach
2026-09-17 14:45   ` Ilpo Järvinen
2026-09-18 14:18     ` Werner Sembach
2026-08-26 21:37 ` Armin Wolf [this message]
2026-09-11 20:57   ` [PATCH v3 1/2] platform/x86: uniwill-laptop: Fix brightness notify for 3 level keyboards 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=c84328eb-0126-4558-8241-a41e641f9681@gmx.de \
    --to=w_armin@gmx.de \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --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®