From 5091807de83dea689805735e41b86fa530db9d0a Mon Sep 17 00:00:00 2001 From: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> Date: Fri, 6 Nov 2026 00:12:10 +1100 Subject: [PATCH] selftests: apple-dcp: give the backlight fixtures the DAC fade fields "drm/apple: fade the panel backlight on DAC firmware" added the fade state to struct dcp_brightness and a third delayed work that dcp_backlight_stop() cancels. The panel-takeover-registration and desktop-brightness-notifications fixtures declare their own cut-down struct apple_dcp, so both stopped compiling and the apple-dcp host selftests fell to 83/85. Add the fade fields to both fixtures. The takeover fixture runs only the desktop 26.x path, so the DAC fade helpers it now references assert if they are ever reached, like the other DAC-only stubs there. dcp_backlight_stop() now cancels three delayed works per call, so the notification fixture expects 3 and 6. Fixes: 2924f21d75a0 ("drm/apple: fade the panel backlight on DAC firmware") Assisted-by: LLM Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com> --- .../selftests/drivers/gpu/apple-dcp/desktop.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py index 860578ee16f1a..eef699612f2d7 100644 --- a/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py +++ b/tools/testing/selftests/drivers/gpu/apple-dcp/desktop.py @@ -241,7 +241,8 @@ def brightness_takeover(root): struct apple_dcp { int fw_compat;bool quiescing; struct {int iomfb_method_profile;} hw; - struct {u32 maximum,nits,dac;bool update;struct backlight_device *bl_dev;} brightness; + struct {u32 maximum,nits,dac;bool update;struct backlight_device *bl_dev; + u32 level,fade_from,fade_to;bool fading;unsigned long fade_start;int fade_work;} brightness; struct {bool lock;struct dcp_backlight_state state;unsigned long fade_start; int fade_work;void (*kick)(struct apple_dcp *);} backlight; struct {bool inherited_brightness_valid;u32 inherited_brightness;} *desktop; @@ -288,6 +289,10 @@ def brightness_takeover(root): static int drm_modeset_lock_single_interruptible(int *p) {(void)p;assert(false);return 0;} static void drm_modeset_unlock(int *p) {(void)p;assert(false);} static int dcp_backlight_update(struct apple_dcp *d) {(void)d;assert(false);return 0;} +/* The DAC fade (M1/M2 firmware) never runs on the desktop panel. */ +#define system_freezable_wq NULL +static bool dcp_dac_fade_starts(struct apple_dcp *d,u32 nits) {(void)d;(void)nits;assert(false);return false;} +static void mod_delayed_work(void *q,int *w,unsigned delay) {(void)q;(void)w;(void)delay;assert(false);} ''' + functions + r''' int main(void) { @@ -835,7 +840,7 @@ def brightness_notifications(root): struct backlight_device {struct {int kobj;} dev;struct {u32 brightness;} props;}; struct apple_dcp { int fw_compat;bool quiescing,crashed; - struct {struct backlight_device *bl_dev;} brightness; + struct {struct backlight_device *bl_dev;int fade_work;} brightness; struct {bool lock;struct dcp_backlight_state state;struct work_struct notify_work;int fade_work,retry_work;} backlight; struct {struct dcp_backlight_swap backlight;} *desktop; }; @@ -871,10 +876,10 @@ def brightness_notifications(root): dcp_backlight_desktop_finish(&d,9,true,false);assert(events==1); d.quiescing=true;dcp_backlight_notify(&d);assert(events==1); d.quiescing=false;d.fw_compat=1;dcp_backlight_notify(&d);assert(events==1); - dcp_backlight_stop(&d);assert(!cancelled && delayed_cancelled==2); + dcp_backlight_stop(&d);assert(!cancelled && delayed_cancelled==3); d.fw_compat=5;dcp_backlight_notify_release(&d); assert(!d.brightness.bl_dev && cancelled==1);dcp_backlight_notify(&d);assert(events==1); - dcp_backlight_stop(&d);assert(cancelled==2 && delayed_cancelled==4); + dcp_backlight_stop(&d);assert(cancelled==2 && delayed_cancelled==6); return 0; } '''