From: Johannes Schneider <johannes.schneider@leica-geosystems.com>
To: barebox@lists.infradead.org, a.fatoum@pengutronix.de,
mgr@kernel.org, l.stach@pengutronix.de
Cc: thomas.haemmerle@leica-geosystems.com
Subject: [PATCH v2 04/11] video: backlight-pwm: make power-supply and enable-gpio optional
Date: Thu, 4 Jun 2026 06:49:59 +0000 [thread overview]
Message-ID: <20260604065006.2933142-5-johannes.schneider@leica-geosystems.com> (raw)
In-Reply-To: <20260604065006.2933142-1-johannes.schneider@leica-geosystems.com>
From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
Boards often omit power-supply (rail is always-on) or use enable-gpios
without a discrete supply. The driver returned -ENODEV when either was
missing, blocking display init.
Switch to regulator_get_optional() so a missing power-supply property
surfaces as -ENODEV (instead of a silent NULL the IS_ERR check never
catches), and handle that case by leaving ->power = NULL.
regulator_enable() / regulator_disable() are already NULL-safe, no
extra guards needed at the call sites.
While here, fix the GPIO descriptor name: gpiod_get_optional() appends
"-gpios" itself, so the previous "enable-gpios" looked for a non-existent
"enable-gpios-gpios" property and never resolved the enable GPIO. Use
"enable" with GPIOD_ASIS so the boot-time pin state is preserved.
Use dev_errp_probe() for the PWM lookup so the underlying error and
deferred-probe path are propagated correctly; drop an unused 'ret' in
of_backlight_find().
Fixes: 4c7238df6866 ("video: backlight-pwm: switch to gpiod functions")
Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
---
drivers/video/backlight-pwm.c | 16 ++++++++--------
drivers/video/backlight.c | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c
index d3c81114e0..14fad55637 100644
--- a/drivers/video/backlight-pwm.c
+++ b/drivers/video/backlight-pwm.c
@@ -148,7 +148,7 @@ static int pwm_backlight_parse_dt(struct device *dev,
pwm_backlight->backlight.brightness_max = pwm_backlight->scale;
}
- pwm_backlight->enable_gpio = gpiod_get_optional(dev, "enable-gpios", 0);
+ pwm_backlight->enable_gpio = gpiod_get_optional(dev, "enable", GPIOD_ASIS);
return 0;
}
@@ -160,10 +160,8 @@ static int backlight_pwm_of_probe(struct device *dev)
struct pwm_device *pwm;
pwm = of_pwm_request(dev->of_node, NULL);
- if (IS_ERR(pwm)) {
- dev_err(dev, "Cannot find PWM device\n");
- return PTR_ERR(pwm);
- }
+ if (IS_ERR(pwm))
+ return dev_errp_probe(dev, pwm, "Cannot find PWM device\n");
pwm_backlight = xzalloc(sizeof(*pwm_backlight));
pwm_backlight->pwm = pwm;
@@ -173,10 +171,12 @@ static int backlight_pwm_of_probe(struct device *dev)
if (ret)
return ret;
- pwm_backlight->power = regulator_get(dev, "power");
+ pwm_backlight->power = regulator_get_optional(dev, "power");
if (IS_ERR(pwm_backlight->power)) {
- dev_err(dev, "Cannot find regulator\n");
- return PTR_ERR(pwm_backlight->power);
+ if (PTR_ERR(pwm_backlight->power) != -ENODEV)
+ return dev_errp_probe(dev, pwm_backlight->power,
+ "power supply\n");
+ pwm_backlight->power = NULL;
}
pwm_backlight->backlight.slew_time_ms = 100;
diff --git a/drivers/video/backlight.c b/drivers/video/backlight.c
index 6d8146ee5a..066742fe28 100644
--- a/drivers/video/backlight.c
+++ b/drivers/video/backlight.c
@@ -95,7 +95,7 @@ struct backlight_device *of_backlight_find(struct device_node *node)
{
struct backlight_device *bl;
- of_device_ensure_probed(node);
+ (void)of_device_ensure_probed(node);
class_for_each_container_of_device(&backlight_class, bl, dev)
if (bl->node == node)
--
2.43.0
next prev parent reply other threads:[~2026-06-04 6:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 6:49 [PATCH v2 00/11] video: enable boot splash on i.MX8MP with LVDS panel Johannes Schneider
2026-06-04 6:49 ` [PATCH v2 01/11] clk: imx8mp: add 700 MHz rate entry for VIDEO_PLL1 Johannes Schneider
2026-06-04 6:49 ` [PATCH v2 02/11] clk: imx8mp: add 1039.5 MHz and 519.75 MHz rate entries " Johannes Schneider
2026-06-04 6:49 ` [PATCH v2 03/11] pmdomain: imx8mp-blk-ctrl: add media blk-ctrl power domain support Johannes Schneider
2026-06-04 6:49 ` Johannes Schneider [this message]
2026-06-04 6:50 ` [PATCH v2 05/11] video: lcdif: make functional on i.MX8MP Johannes Schneider
2026-06-04 6:50 ` [PATCH v2 06/11] video: lcdif: use 128B AXI bursts to avoid right-edge gap Johannes Schneider
2026-06-04 6:50 ` [PATCH v2 07/11] video: lcdif: default to RGB888_1X24 on VPL_GET_BUS_FORMAT failure Johannes Schneider
2026-06-04 6:50 ` [PATCH v2 08/11] video: lcdif: register simplefb fixup and enable framebuffer at probe Johannes Schneider
2026-06-04 6:50 ` [PATCH v2 09/11] video: lcdif: drain write-combine framebuffer in fb_damage Johannes Schneider
2026-06-04 6:50 ` [PATCH v2 10/11] video: simple-panel: support panel-lvds DT bindings Johannes Schneider
2026-06-04 6:50 ` [PATCH v2 11/11] video: simple-panel: lazily resolve backlight without failing Johannes Schneider
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=20260604065006.2933142-5-johannes.schneider@leica-geosystems.com \
--to=johannes.schneider@leica-geosystems.com \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=l.stach@pengutronix.de \
--cc=mgr@kernel.org \
--cc=thomas.haemmerle@leica-geosystems.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