mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yao Zi <ziyao@disroot.org>
To: Huacai Chen <chenhuacai@kernel.org>,
	Jianmin Lv <lvjianmin@loongson.cn>,
	WANG Xuerui <kernel@xen0n.name>
Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev,
	Mingcong Bai <jeffbai@aosc.io>,
	Kexy Biscuit <kexybiscuit@aosc.io>, Yao Zi <ziyao@disroot.org>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] platform/loongarch: laptop: Get brightness setting from EC on probe
Date: Sat, 31 May 2025 11:38:50 +0000	[thread overview]
Message-ID: <20250531113851.21426-2-ziyao@disroot.org> (raw)
In-Reply-To: <20250531113851.21426-1-ziyao@disroot.org>

Previously 1 is unconditionally taken as current brightness value. This
causes problems since it's required to restore brightness settings on
resumption, and a value that doesn't match EC's state before suspension
will cause surprising changes of screen brightness.

Let's get brightness from EC and take it as the current brightness on
probe of the laptop driver to avoid the surprising behavior. Tested on
TongFang L860-T2 3A5000 laptop.

Cc: stable@vger.kernel.org
Fixes: 6246ed09111f ("LoongArch: Add ACPI-based generic laptop driver")
Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 drivers/platform/loongarch/loongson-laptop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/loongarch/loongson-laptop.c b/drivers/platform/loongarch/loongson-laptop.c
index 99203584949d..828bd62e3596 100644
--- a/drivers/platform/loongarch/loongson-laptop.c
+++ b/drivers/platform/loongarch/loongson-laptop.c
@@ -392,7 +392,7 @@ static int laptop_backlight_register(void)
 	if (!acpi_evalf(hotkey_handle, &status, "ECLL", "d"))
 		return -EIO;
 
-	props.brightness = 1;
+	props.brightness = ec_get_brightness();
 	props.max_brightness = status;
 	props.type = BACKLIGHT_PLATFORM;
 
-- 
2.49.0


  reply	other threads:[~2025-05-31 11:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-31 11:38 [PATCH 0/2] Backlight control improvements for loongson_laptop Yao Zi
2025-05-31 11:38 ` Yao Zi [this message]
2025-06-03  4:11   ` [PATCH 1/2] platform/loongarch: laptop: Get brightness setting from EC on probe Huacai Chen
2025-06-03  6:44     ` Yao Zi
2025-06-04 13:56       ` Huacai Chen
2025-06-04 14:47         ` Yao Zi
2025-05-31 11:38 ` [PATCH 2/2] platform/loongarch: laptop: Support backlight power control Yao Zi
2025-06-03  4:16   ` Huacai Chen
2025-06-03  5:44     ` WANG Xuerui
2025-06-03  5:52       ` Xi Ruoyao
2025-06-03  7:05     ` Yao Zi
2025-06-04 13:57       ` Huacai Chen

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=20250531113851.21426-2-ziyao@disroot.org \
    --to=ziyao@disroot.org \
    --cc=chenhuacai@kernel.org \
    --cc=jeffbai@aosc.io \
    --cc=kernel@xen0n.name \
    --cc=kexybiscuit@aosc.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=lvjianmin@loongson.cn \
    --cc=stable@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®