From 820ac5a6cbdc8486f634d884d3ee3333b6b0aa0b Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Fri, 4 Dec 2026 09:10:42 +0100 Subject: [PATCH 1/2] drm/adbe: Turn the backlight off with the pipe Nothing turned the backlight off when the display went off: a compositor's DPMS off and a power-down fbdev blank disable the CRTC, and this driver only handled the backlight around system sleep. The fbdev blank notifier does not help either, as the kernel is built without FB_BACKLIGHT. On an iPhone 6s the backlight stayed at its level through fb0 blank=4. Turn the backlight off when the CRTC is disabled and back on when it is enabled, looking it up first if no sleep has done so yet. A backlight held off after a failed panel wake stays off. Suspend and resume take panel_lock around, not inside, the CRTC's disable and enable, so this does not nest. Assisted-by: LLM Signed-off-by: Jeroen Trappers --- drivers/gpu/drm/adbe/adbe_drv.c | 77 +++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/adbe/adbe_drv.c b/drivers/gpu/drm/adbe/adbe_drv.c index aadb6128c4c129..cc527669a7db9b 100644 --- a/drivers/gpu/drm/adbe/adbe_drv.c +++ b/drivers/gpu/drm/adbe/adbe_drv.c @@ -1112,11 +1112,36 @@ static void adbe_dsi_panel_set(struct adbe *adbe, bool on) } } +static void adbe_panel_attach(struct adbe *adbe); +static bool adbe_backlight_find(struct adbe *adbe); + +/* + * The backlight follows the pipe: off when the CRTC goes off (a compositor's + * DPMS off, a power-down fbdev blank: this kernel has no FB_BACKLIGHT), on + * when it comes back. A backlight held off after a failed panel wake stays + * off. Never under panel_lock: suspend and resume take it around, not + * inside, the CRTC's disable and enable. + */ +static void adbe_backlight_set(struct adbe *adbe, bool on) +{ + mutex_lock(&adbe->panel_lock); + adbe_panel_attach(adbe); + adbe_backlight_find(adbe); + if (adbe->backlight && !adbe->bl_held) { + if (on) + backlight_enable(adbe->backlight); + else + backlight_disable(adbe->backlight); + } + mutex_unlock(&adbe->panel_lock); +} + static void adbe_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_atomic_commit *state) { drm_crtc_vblank_on(crtc); adbe_dsi_panel_set(to_adbe(crtc->dev), true); + adbe_backlight_set(to_adbe(crtc->dev), true); } static void adbe_crtc_atomic_disable(struct drm_crtc *crtc, @@ -1126,6 +1151,7 @@ static void adbe_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_pending_vblank_event *done; unsigned long flags; + adbe_backlight_set(adbe, false); timer_delete_sync(&adbe->flip_timer); spin_lock_irqsave(&crtc->dev->event_lock, flags); done = adbe->event; @@ -2450,6 +2476,36 @@ static int adbe_link_train(struct adbe *adbe) return ret; } +/* + * Under panel_lock: the backlight the "backlight" phandle names. False while + * it has not registered yet. Boards without a panel supply (the MIPI DSI + * panels) have one too, so this does not depend on the DisplayPort window. + */ +static bool adbe_backlight_find(struct adbe *adbe) +{ + struct device *dev = adbe->drm.dev; + struct device_node *np; + + if (adbe->bl_link) + return true; + np = of_parse_phandle(dev->of_node, "backlight", 0); + if (!np) + return true; + adbe->backlight = of_find_backlight_by_node(np); + of_node_put(np); + if (!adbe->backlight) + return false; + adbe->bl_link = device_link_add(&adbe->backlight->dev, dev, + DL_FLAG_STATELESS); + if (!adbe->bl_link) { + dev_warn(dev, "cannot order the backlight after the panel\n"); + put_device(&adbe->backlight->dev); + adbe->backlight = NULL; + return false; + } + return true; +} + /* * Look up the panel supply and the backlight once, before the first sleep, * and order system sleep: the display pipe suspends before the PMU GPIO @@ -2459,7 +2515,6 @@ static int adbe_link_train(struct adbe *adbe) static void adbe_panel_attach(struct adbe *adbe) { struct device *dev = adbe->drm.dev; - struct device_node *np; struct gpio_desc *ldo; if (adbe->panel_ready || !adbe->dp) @@ -2487,24 +2542,8 @@ static void adbe_panel_attach(struct adbe *adbe) } } - np = of_parse_phandle(dev->of_node, "backlight", 0); - if (np && !adbe->bl_link) { - adbe->backlight = of_find_backlight_by_node(np); - if (!adbe->backlight) { - of_node_put(np); - return; /* not registered yet: next sleep */ - } - adbe->bl_link = device_link_add(&adbe->backlight->dev, dev, - DL_FLAG_STATELESS); - if (!adbe->bl_link) { - dev_warn(dev, "cannot order the backlight after the panel\n"); - put_device(&adbe->backlight->dev); - adbe->backlight = NULL; - of_node_put(np); - return; - } - } - of_node_put(np); + if (!adbe_backlight_find(adbe)) + return; /* not registered yet: next sleep */ adbe->panel_ready = true; } From c4a5f9f7f2502ddabda5492e71daf9f9adf3a04b Mon Sep 17 00:00:00 2001 From: Jeroen Trappers Date: Fri, 4 Dec 2026 21:20:43 +0100 Subject: [PATCH 2/2] arm64: dts: apple: s800x-6s: Give the display pipe its backlight The iPhone 6s's display pipe has no backlight phandle, so the driver cannot turn the backlight off when the pipe goes off: after a power-down fbdev blank the panel showed nothing but the backlight stayed lit. Point it at the DWI backlight. post-init-providers keeps the backlight from holding up the pipe's probe, as on the iPad 5. Assisted-by: LLM Signed-off-by: Jeroen Trappers --- arch/arm64/boot/dts/apple/s800x-6s.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/boot/dts/apple/s800x-6s.dtsi b/arch/arm64/boot/dts/apple/s800x-6s.dtsi index c5224126cb8b4b..efc1c84850565e 100644 --- a/arch/arm64/boot/dts/apple/s800x-6s.dtsi +++ b/arch/arm64/boot/dts/apple/s800x-6s.dtsi @@ -289,6 +289,15 @@ power-domains = <&ps_disp0 &ps_mipi_dsi>; }; +/* + * The backlight goes off and on with the pipe. It does not hold up the pipe's + * probe: the driver looks it up when the pipe is next enabled or disabled. + */ +&disp0 { + backlight = <&dwi_bl>; + post-init-providers = <&dwi_bl>; +}; + &i2c0 { status = "okay";