Skip to contentSkip to conversation

staging: fbtft: add support for a device tree of backlight.

PATCH In review [email protected] 2 participants 2 messages Jul 26, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: fbtft: add support for a device tree of backlight.

From: Chali Anis <[email protected]>

Support the of backlight from device tree and keep compatibility for the legacy gpio backlight.

---
 drivers/staging/fbtft/fbtft-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/staging/fbtft/fbtft-core.c +12 -0
index da9c64152a60..5f0220dbe397 100644
@@ -170,6 +170,18 @@ void fbtft_register_backlight(struct fbtft_par *par)
 	struct backlight_device *bd;
 	struct backlight_properties bl_props = { 0, };
 
+	bd = devm_of_find_backlight(par->info->device);
+	if (IS_ERR(bd)) {
+		dev_warn(par->info->device,
+			"cannot find of backlight device (%ld), trying legacy\n",
+			PTR_ERR(bd));
+	}
+
+	if (bd) {
+		par->info->bl_dev = bd;
+		return;
+	}
+
 	if (!par->gpio.led[0]) {
 		fbtft_par_dbg(DEBUG_BACKLIGHT, par,
 			      "%s(): led pin not set, exiting.\n", __func__);
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 16 lines · On Fri, Jul 25, 2025 at 08:04:16PM -0400, [email protected] wrote:

From: Chali Anis <[email protected]>

Support the of backlight from device tree and keep compatibility for the legacy gpio backlight.

---
 drivers/staging/fbtft/fbtft-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/staging/fbtft/fbtft-core.c +0 -0
index da9c64152a60..5f0220dbe397 100644

drivers/staging/fbtft/fbtft-core.c void fbtft_register_backlight(struct fbtft_par *par) · line 177

Quoted 8 lines
drivers/staging/fbtft/fbtft-core.c +5 -0
@@ -170,6 +170,18 @@ void fbtft_register_backlight(struct fbtft_par *par)
 	struct backlight_device *bd;
 	struct backlight_properties bl_props = { 0, };
 
+	bd = devm_of_find_backlight(par->info->device);
+	if (IS_ERR(bd)) {
+		dev_warn(par->info->device,
+			"cannot find of backlight device (%ld), trying legacy\n",
+			PTR_ERR(bd));

So now you are going to get a warning message for a system that previously did not at all? That's not very nice to those users :(