From: Thorsten Blum <blum@kernel.org>
To: "Lee Jones" <lee@kernel.org>,
"Daniel Thompson" <danielt@kernel.org>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Helge Deller" <deller@gmx.de>,
"Linus Walleij" <linusw@kernel.org>,
"Duje Mihanović" <duje@dujemihanovic.xyz>,
"Jin Park" <jinyoungp@nvidia.com>,
"Samuel Ortiz" <sameo@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
Thorsten Blum <blum@kernel.org>
Subject: [PATCH 2/3] backlight: ktd2801: Initialize properties before device registration
Date: Fri, 20 Nov 2026 00:07:35 +0100 [thread overview]
Message-ID: <20261119230733.790573-5-blum@kernel.org> (raw)
In-Reply-To: <20261119230733.790573-4-blum@kernel.org>
The backlight API requires max_brightness to be supplied at device
registration and not to be modified afterwards. KTD2801 currently sets
it after registering the device, allowing userspace to read a maximum
brightness of 0 before the configured value is applied.
Pass the initial brightness and the maximum brightness to
devm_backlight_device_register() to set them before the sysfs attributes
become visible to userspace.
Fixes: a5554f1b5bc3 ("backlight: Add Kinetic KTD2801 Backlight support")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/video/backlight/ktd2801-backlight.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/video/backlight/ktd2801-backlight.c b/drivers/video/backlight/ktd2801-backlight.c
index c218ee55f253..ff149de36dee 100644
--- a/drivers/video/backlight/ktd2801-backlight.c
+++ b/drivers/video/backlight/ktd2801-backlight.c
@@ -58,6 +58,9 @@ static const struct backlight_ops ktd2801_backlight_ops = {
static int ktd2801_backlight_probe(struct platform_device *pdev)
{
+ struct backlight_properties props = {
+ .type = BACKLIGHT_RAW,
+ };
struct device *dev = &pdev->dev;
struct backlight_device *bd;
struct ktd2801_backlight *ktd2801;
@@ -92,15 +95,15 @@ static int ktd2801_backlight_probe(struct platform_device *pdev)
"failed to get backlight GPIO");
gpiod_set_consumer_name(ktd2801->props.ctrl_gpio, dev_name(dev));
+ props.max_brightness = max_brightness;
+ props.brightness = brightness;
+
bd = devm_backlight_device_register(dev, dev_name(dev), dev, ktd2801,
- &ktd2801_backlight_ops, NULL);
+ &ktd2801_backlight_ops, &props);
if (IS_ERR(bd))
return dev_err_probe(dev, PTR_ERR(bd),
"failed to register backlight");
- bd->props.max_brightness = max_brightness;
- bd->props.brightness = brightness;
-
ktd2801->bd = bd;
platform_set_drvdata(pdev, bd);
backlight_update_status(bd);
next prev parent reply other threads:[~2026-11-19 23:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 23:07 [PATCH 1/3] backlight: ktd253: Initialize properties before device registration Thorsten Blum
2026-11-19 23:07 ` Thorsten Blum [this message]
2026-11-19 23:07 ` [PATCH 3/3] backlight: aat2870: " Thorsten Blum
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=20261119230733.790573-5-blum@kernel.org \
--to=blum@kernel.org \
--cc=danielt@kernel.org \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=duje@dujemihanovic.xyz \
--cc=jingoohan1@gmail.com \
--cc=jinyoungp@nvidia.com \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=sameo@linux.intel.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