linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: fbtft: add support for a device tree of backlight.
@ 2025-07-26  0:04 chalianis1
  2025-07-26  6:31 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: chalianis1 @ 2025-07-26  0:04 UTC (permalink / raw)
  To: andy; +Cc: linux-staging, linux-fbdev, stable, gregkh, Chali Anis

From: Chali Anis <chalianis1@gmail.com>

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

Cc: stable@vger.kernel.org
Signed-off-by: Chali Anis <chalianis1@gmail.com>
---
 drivers/staging/fbtft/fbtft-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index da9c64152a60..5f0220dbe397 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -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__);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-26  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-26  0:04 [PATCH] staging: fbtft: add support for a device tree of backlight chalianis1
2025-07-26  6:31 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).