Skip to contentSkip to conversation

drm/appletbdrm: Add suspend and resume support

PATCH Superseded Vasilij Markin 4 participants 8 messages Sep 24 – Oct 15

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/appletbdrm: Add suspend and resume support

The driver has no USB power management callbacks, so the USB core unbinds it before system suspend and binds it again on resume. The DRM device is unregistered and registered again on every suspend and resume cycle, userspace driving the Touch Bar through it (such as tiny-dfr) loses its device, and the Touch Bar stays dark after resume.

Implement suspend and resume with drm_mode_config_helper_suspend() and drm_mode_config_helper_resume(), so the device stays registered and the last committed state is restored on resume. If the device was reset while suspended, repeat the probe-time handshake first.

Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Assisted-by Claude:claude-opus-5-5

---
Tested on a MacBookPro16,2 with this change backported to 7.2.7, deep (S3) suspend by closing the lid, tiny-dfr 0.3.7. Without it the driver is probed again on every resume and systemd stops tiny-dfr; with it tiny-dfr keeps running, the driver is not probed again and the Touch Bar shows its content right after resume. The reset_resume path is untested: the device never came back reset.

Kernels before commit 3d95f93b30b8 ("drm/appletbdrm: Convert to atomic_create_state") also need the plane reset hook to free the existing state, otherwise drm_mode_config_reset() on resume hits WARN_ON(plane->state) in appletbdrm_primary_plane_reset() and leaks the old state. 7.2.y is such a kernel; the tested backport carries that change as a separate patch.

Built on drm-misc-next (c4c54ffd6) with W=1 without warnings.

---
 drivers/gpu/drm/tiny/appletbdrm.c | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
drivers/gpu/drm/tiny/appletbdrm.c +43 -0
index 4297d9c11..024ad8bf6 100644
@@ -30,6 +30,7 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_gem_shmem_helper.h>
+#include <drm/drm_modeset_helper.h>
 #include <drm/drm_plane.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
@@ -821,6 +822,45 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
 	drm_atomic_helper_shutdown(&adev->drm);
 }
 
+static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_suspend(&adev->drm);
+}
+
+static int appletbdrm_resume(struct usb_interface *intf)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_resume(&adev->drm);
+}
+
+static int appletbdrm_reset_resume(struct usb_interface *intf)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+	struct drm_device *drm = &adev->drm;
+	int ret;
+
+	/*
+	 * A reset puts the device back into its initial state, where it
+	 * expects the same handshake as during probe
+	 */
+	ret = appletbdrm_get_information(adev);
+	if (ret) {
+		drm_err(drm, "Failed to get display information\n");
+		return ret;
+	}
+
+	ret = appletbdrm_signal_readiness(adev);
+	if (ret) {
+		drm_err(drm, "Failed to signal readiness\n");
+		return ret;
+	}
+
+	return drm_mode_config_helper_resume(drm);
+}
+
 static const struct usb_device_id appletbdrm_usb_id_table[] = {
 	{ USB_DEVICE_INTERFACE_CLASS(0x05ac, 0x8302, USB_CLASS_AUDIO_VIDEO) },
 	{}
@@ -832,6 +872,9 @@ static struct usb_driver appletbdrm_usb_driver = {
 	.probe		= appletbdrm_probe,
 	.disconnect	= appletbdrm_disconnect,
 	.shutdown	= appletbdrm_shutdown,
+	.suspend	= appletbdrm_suspend,
+	.resume		= appletbdrm_resume,
+	.reset_resume	= appletbdrm_reset_resume,
 	.id_table	= appletbdrm_usb_id_table,
 };
 module_usb_driver(appletbdrm_usb_driver);

---
base-commit: c4c54ffd65555ac5316f8faf4d7dc8c815877937
change-id: 20260924-appletbdrm-pm-6bd220385beb

Best regards,

Signature · 1 line
Vasilij Markin <[email protected]>
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/appletbdrm: Memory leak of suspend_state on reset_resume error --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/appletbdrm: Memory leak of suspend_state on reset_resume error --

commit 60e19da684ddfb4bbf66c6f0c2624ed415d96f12
Author: Vasilij Markin <[email protected]>
Subject: drm/appletbdrm: Add suspend and resume support

This commit introduces suspend and resume support for the appletbdrm driver. It uses drm_mode_config_helper_suspend() and drm_mode_config_helper_resume() to keep the device registered across cycles. In case the device was reset while suspended, it repeats the probe-time handshake.

Quoted 4 lines
drivers/gpu/drm/tiny/appletbdrm.c +0 -0
index 4297d9c1125e4..024ad8bf6e1c4 100644

[ ... ]

Quoted 22 lines
drivers/gpu/drm/tiny/appletbdrm.c +18 -0
@@ -821,6 +822,45 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
 	drm_atomic_helper_shutdown(&adev->drm);
 }
 
+static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_suspend(&adev->drm);
+}
+
+static int appletbdrm_resume(struct usb_interface *intf)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_resume(&adev->drm);
+}
+
+static int appletbdrm_reset_resume(struct usb_interface *intf)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+	struct drm_device *drm = &adev->drm;

drivers/gpu/drm/tiny/appletbdrm.c static void appletbdrm_shutdown(struct usb_interface *intf) · line 852

Quoted 10 lines
drivers/gpu/drm/tiny/appletbdrm.c +10 -0
+	int ret;
+
+	/*
+	 * A reset puts the device back into its initial state, where it
+	 * expects the same handshake as during probe
+	 */
+	ret = appletbdrm_get_information(adev);
+	if (ret) {
+		drm_err(drm, "Failed to get display information\n");
+		return ret;

[Severity: Medium]
During system suspend, drm_mode_config_helper_suspend() duplicates the atomic commit state and stores it in dev->mode_config.suspend_state.

If appletbdrm_get_information() fails here, we return early and bypass the call to drm_mode_config_helper_resume(). Does this leak the suspend_state and its associated DRM object references, since they never get freed or put by drm_atomic_state_put()?

drivers/gpu/drm/tiny/appletbdrm.c static void appletbdrm_shutdown(struct usb_interface *intf) · line 858

Quoted 6 lines
drivers/gpu/drm/tiny/appletbdrm.c +6 -0
+	}
+
+	ret = appletbdrm_signal_readiness(adev);
+	if (ret) {
+		drm_err(drm, "Failed to signal readiness\n");
+		return ret;

[Severity: Medium]
Similar to the issue above, if appletbdrm_signal_readiness() fails, does returning early without calling drm_mode_config_helper_resume() leak the atomic commit state stored in dev->mode_config.suspend_state?

Quoted 5 lines
drivers/gpu/drm/tiny/appletbdrm.c +5 -0
+	}
+
+	return drm_mode_config_helper_resume(drm);
+}
+
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer
#2 lore raw
In reply to Vasilij Markin

Hi Vasilij

Thanks for the patch

Quoted 56 lines

From: Vasilij Markin <[email protected]>

The driver has no USB power management callbacks, so the USB core unbinds it before system suspend and binds it again on resume. The DRM device is unregistered and registered again on every suspend and resume cycle, userspace driving the Touch Bar through it (such as tiny-dfr) loses its device, and the Touch Bar stays dark after resume.

Implement suspend and resume with drm_mode_config_helper_suspend() and drm_mode_config_helper_resume(), so the device stays registered and the last committed state is restored on resume. If the device was reset while suspended, repeat the probe-time handshake first.

Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Assisted-by Claude:claude-opus-5-5

---
Tested on a MacBookPro16,2 with this change backported to 7.2.7, deep (S3) suspend by closing the lid, tiny-dfr 0.3.7. Without it the driver is probed again on every resume and systemd stops tiny-dfr; with it tiny-dfr keeps running, the driver is not probed again and the Touch Bar shows its content right after resume. The reset_resume path is untested: the device never came back reset.

Kernels before commit 3d95f93b30b8 ("drm/appletbdrm: Convert to atomic_create_state") also need the plane reset hook to free the existing state, otherwise drm_mode_config_reset() on resume hits WARN_ON(plane->state) in appletbdrm_primary_plane_reset() and leaks the old state. 7.2.y is such a kernel; the tested backport carries that change as a separate patch.

Built on drm-misc-next (c4c54ffd6) with W=1 without warnings.

---
  drivers/gpu/drm/tiny/appletbdrm.c | 43 +++++++++++++++++++++++++++++++++++++++
  1 file changed, 43 insertions(+)
drivers/gpu/drm/tiny/appletbdrm.c +6 -0
index 4297d9c11..024ad8bf6 100644
@@ -30,6 +30,7 @@
  #include <drm/drm_gem_atomic_helper.h>
  #include <drm/drm_gem_framebuffer_helper.h>
  #include <drm/drm_gem_shmem_helper.h>
+#include <drm/drm_modeset_helper.h>
  #include <drm/drm_plane.h>
  #include <drm/drm_print.h>
  #include <drm/drm_probe_helper.h>
@@ -821,6 +822,45 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
  	drm_atomic_helper_shutdown(&adev->drm);
  }
 
+static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_suspend(&adev->drm);

drivers/gpu/drm/tiny/appletbdrm.c static void appletbdrm_shutdown(struct usb_interface *intf) · line 839

Quoted 10 lines
drivers/gpu/drm/tiny/appletbdrm.c +10 -0
+}
+
+static int appletbdrm_resume(struct usb_interface *intf)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_resume(&adev->drm);
+}
+
+static int appletbdrm_reset_resume(struct usb_interface *intf)

We don't need a reset_resume function as the USB device is virtually exposed by the t2bce driver and current implementation doesn't reset the device in any case. If the need arises, it can be added in a later patch.

Quoted 43 lines
drivers/gpu/drm/tiny/appletbdrm.c +27 -1
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+	struct drm_device *drm = &adev->drm;
+	int ret;
+
+	/*
+	 * A reset puts the device back into its initial state, where it
+	 * expects the same handshake as during probe
+	 */
+	ret = appletbdrm_get_information(adev);
+	if (ret) {
+		drm_err(drm, "Failed to get display information\n");
+		return ret;
+	}
+
+	ret = appletbdrm_signal_readiness(adev);
+	if (ret) {
+		drm_err(drm, "Failed to signal readiness\n");
+		return ret;
+	}
+
+	return drm_mode_config_helper_resume(drm);
+}
+
  static const struct usb_device_id appletbdrm_usb_id_table[] = {
  	{ USB_DEVICE_INTERFACE_CLASS(0x05ac, 0x8302, USB_CLASS_AUDIO_VIDEO) },
  	{}
@@ -832,6 +872,9 @@ static struct usb_driver appletbdrm_usb_driver = {
  	.probe		= appletbdrm_probe,
  	.disconnect	= appletbdrm_disconnect,
  	.shutdown	= appletbdrm_shutdown,
+	.suspend	= appletbdrm_suspend,
+	.resume		= appletbdrm_resume,
+	.reset_resume	= appletbdrm_reset_resume,
  	.id_table	= appletbdrm_usb_id_table,
  };
  module_usb_driver(appletbdrm_usb_driver);
 
---

base-commit: c4c54ffd65555ac5316f8faf4d7dc8c815877937
change-id: 20260924-appletbdrm-pm-6bd220385beb

Best regards,

maintainer
#3 lore raw

PATCH v2 1/1 drm/appletbdrm: Add suspend and resume support

In reply to Vasilij Markin

From: Vasilij Markin <[email protected]>

The driver has no USB power management callbacks, so the USB core unbinds it before system suspend and binds it again on resume. The DRM device is unregistered and registered again on every suspend and resume cycle, userspace driving the Touch Bar through it (such as tiny-dfr) loses its device, and the Touch Bar stays dark after resume.

Implement suspend and resume with drm_mode_config_helper_suspend() and drm_mode_config_helper_resume(), so the device stays registered and the last committed state is restored on resume. If the device was reset while suspended, repeat the probe-time handshake first.

Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Assisted-by Claude:claude-opus-5-5

---
v2: Remove reset_resume

 drivers/gpu/drm/tiny/appletbdrm.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/gpu/drm/tiny/appletbdrm.c +17 -0
index ef71b9957..c94ed1068 100644
@@ -30,6 +30,7 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_gem_shmem_helper.h>
+#include <drm/drm_modeset_helper.h>
 #include <drm/drm_plane.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
@@ -821,6 +822,20 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
 	drm_atomic_helper_shutdown(&adev->drm);
 }
 
+static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_suspend(&adev->drm);
+}
+
+static int appletbdrm_resume(struct usb_interface *intf)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_resume(&adev->drm);
+}
+
 static const struct usb_device_id appletbdrm_usb_id_table[] = {
 	{ USB_DEVICE_INTERFACE_CLASS(0x05ac, 0x8302, USB_CLASS_AUDIO_VIDEO) },
 	{}
@@ -832,6 +847,8 @@ static struct usb_driver appletbdrm_usb_driver = {
 	.probe		= appletbdrm_probe,
 	.disconnect	= appletbdrm_disconnect,
 	.shutdown	= appletbdrm_shutdown,
+	.suspend	= appletbdrm_suspend,
+	.resume		= appletbdrm_resume,
 	.id_table	= appletbdrm_usb_id_table,
 };
 module_usb_driver(appletbdrm_usb_driver);
Signature · 1 line
2.53.0
#4 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] drm/appletbdrm: memory leak of suspend_state on unbind - [Medium] drm/appletbdrm: missing…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/appletbdrm: memory leak of suspend_state on unbind
- [Medium] drm/appletbdrm: missing reset_resume handler breaks reset recovery --

commit c3fac1e92efd5498a32a50fb4e9a862ae7b24e77
Author: Vasilij Markin <[email protected]>

drm/appletbdrm: Add suspend and resume support

The driver has no USB power management callbacks, so the USB core unbinds it before system suspend and binds it again on resume. The DRM device is unregistered and registered again on every suspend and resume cycle, userspace driving the Touch Bar through it (such as tiny-dfr) loses its device, and the Touch Bar stays dark after resume.

Quoted 4 lines

Implement suspend and resume with drm_mode_config_helper_suspend() and drm_mode_config_helper_resume(), so the device stays registered and the last committed state is restored on resume. If the device was reset while suspended, repeat the probe-time handshake first.

[Severity: Medium]
Will the device actually stay registered if it is reset while suspended?

According to the Linux USB core logic, if a device is reset during suspend and the driver lacks a .reset_resume callback, the USB core sets needs_binding = 1, which forcefully unbinds and rebinds the driver. This fallback unbinds the DRM device, destroying the userspace connection and defeating the stated goal for the reset scenario.

Quoted 4 lines
drivers/gpu/drm/tiny/appletbdrm.c +0 -0
index 4297d9c1125e4..919ca14181af3 100644

[ ... ]

drivers/gpu/drm/tiny/appletbdrm.c static void appletbdrm_shutdown(struct usb_interface *intf) · line 829

Quoted 9 lines
drivers/gpu/drm/tiny/appletbdrm.c +5 -0
@@ -821,6 +822,20 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
 	drm_atomic_helper_shutdown(&adev->drm);
 }
 
+static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+	return drm_mode_config_helper_suspend(&adev->drm);

[Severity: Medium]
Does this code leak adev->drm.mode_config.suspend_state if the device is unbound while suspended?

drm_mode_config_helper_suspend() allocates an atomic state and stores it in adev->drm.mode_config.suspend_state.

If the device is reset during suspend, the USB core forcefully unbinds the driver because it lacks a reset_resume handler. The unbind path calls appletbdrm_disconnect() and tears down the DRM device.

Neither appletbdrm_disconnect() nor the DRM core cleanup routines free suspend_state. Does this cause a memory leak of the atomic commit object and all its duplicated plane/CRTC states on every suspend/reset cycle?

Quoted 3 lines
drivers/gpu/drm/tiny/appletbdrm.c +3 -0
+}
+
+static int appletbdrm_resume(struct usb_interface *intf)

[ ... ]

drivers/gpu/drm/tiny/appletbdrm.c static struct usb_driver appletbdrm_usb_driver = { · line 853

Quoted 8 lines
drivers/gpu/drm/tiny/appletbdrm.c +2 -0
@@ -832,6 +847,8 @@ static struct usb_driver appletbdrm_usb_driver = {
 	.probe		= appletbdrm_probe,
 	.disconnect	= appletbdrm_disconnect,
 	.shutdown	= appletbdrm_shutdown,
+	.suspend	= appletbdrm_suspend,
+	.resume		= appletbdrm_resume,
 	.id_table	= appletbdrm_usb_id_table,
 };

[Severity: Medium]
Is the .reset_resume callback missing here?

The commit message states: "If the device was reset while suspended, repeat the probe-time handshake first" to ensure the device stays registered.

However, intentionally omitting the .reset_resume callback causes the USB core to unbind the driver on reset instead of restoring the DRM state.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer
#5 lore raw
In reply to Aditya Garg
Quoted 17 lines · Aditya Garg

From: Vasilij Markin <[email protected]>

The driver has no USB power management callbacks, so the USB core unbinds it before system suspend and binds it again on resume. The DRM device is unregistered and registered again on every suspend and resume cycle, userspace driving the Touch Bar through it (such as tiny-dfr) loses its device, and the Touch Bar stays dark after resume.

Implement suspend and resume with drm_mode_config_helper_suspend() and drm_mode_config_helper_resume(), so the device stays registered and the last committed state is restored on resume. If the device was reset while suspended, repeat the probe-time handshake first.

Quoted 4 lines
Fixes 0670c2f56e45 ("drm/tiny: add driver for Apple Touch Bars in x86 Macs")
Assisted-by Claude:claude-opus-5-5

Could anyone please merge it if they are ok with it? Thanks.

Quoted 50 lines

---
v2: Remove reset_resume

drivers/gpu/drm/tiny/appletbdrm.c | 17 +++++++++++++++++

1 file changed, 17 insertions(+)
drivers/gpu/drm/tiny/appletbdrm.c +17 -1
index ef71b9957..c94ed1068 100644
@@ -30,6 +30,7 @@
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_gem_shmem_helper.h>
+#include <drm/drm_modeset_helper.h>
 #include <drm/drm_plane.h>
 #include <drm/drm_print.h>
 #include <drm/drm_probe_helper.h>
@@ -821,6 +822,20 @@ static void appletbdrm_shutdown(struct usb_interface *intf)
   drm_atomic_helper_shutdown(&adev->drm);
 }
 
+static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
+{
+    struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+    return drm_mode_config_helper_suspend(&adev->drm);
+}
+
+static int appletbdrm_resume(struct usb_interface *intf)
+{
+    struct appletbdrm_device *adev = usb_get_intfdata(intf);
+
+    return drm_mode_config_helper_resume(&adev->drm);
+}
+
 static const struct usb_device_id appletbdrm_usb_id_table[] = {
   { USB_DEVICE_INTERFACE_CLASS(0x05ac, 0x8302, USB_CLASS_AUDIO_VIDEO) },
   {}
@@ -832,6 +847,8 @@ static struct usb_driver appletbdrm_usb_driver = {
   .probe        = appletbdrm_probe,
   .disconnect    = appletbdrm_disconnect,
   .shutdown    = appletbdrm_shutdown,
+    .suspend    = appletbdrm_suspend,
+    .resume        = appletbdrm_resume,
   .id_table    = appletbdrm_usb_id_table,
 };
 module_usb_driver(appletbdrm_usb_driver);
--

2.53.0

#6 lore raw
Quoted 11 lines · Aditya Garg
Quoted 11 lines · Aditya Garg

The driver has no USB power management callbacks, so the USB core unbinds it before system suspend and binds it again on resume. The DRM device is unregistered and registered again on every suspend and resume cycle, userspace driving the Touch Bar through it (such as tiny-dfr) loses its device, and the Touch Bar stays dark after resume.

Implement suspend and resume with drm_mode_config_helper_suspend() and drm_mode_config_helper_resume(), so the device stays registered and the last committed state is restored on resume. If the device was reset while suspended, repeat the probe-time handshake first.

[...]

Quoted 1 line

Could anyone please merge it if they are ok with it? Thanks.

I'd love to, but both v1 and v2 have sashiko findings that nobody bothered to debunk or fix. (The fix for v1 consisted of removing a callback, which triggered other sashiko findings.) I'm neither an expert on this driver nor the tiny drm library, but I'd like to help improve Linux Mac support. Please help me understand whether the sashiko findings are valid.

Thanks,

Lukas

author
#7 lore raw
Quoted 5 lines · Lukas Wunner

I'd love to, but both v1 and v2 have sashiko findings that nobody bothered to debunk or fix. (The fix for v1 consisted of removing a callback, which triggered other sashiko findings.) I'm neither an expert on this driver nor the tiny drm library, but I'd like to help improve Linux Mac support. Please help me understand whether the sashiko findings are valid.

Thanks for looking at it, and sorry for leaving the findings unanswered. I went through all of them; in short, the v1 finding and the first two v2 findings are valid. v3 brings back reset_resume with the error path fixed:
https://lore.kernel.org/all/[email protected]/

v1, "memory leak of suspend_state on reset_resume error": valid. If appletbdrm_get_information() or appletbdrm_signal_readiness() fails, reset_resume returns before drm_mode_config_helper_resume(), so the state saved by drm_mode_config_helper_suspend() is never put, and fbdev/polling stay suspended. The USB core only logs a reset_resume error and keeps the driver bound, so nothing else cleans it up. v3 logs the handshake error and still calls drm_mode_config_helper_resume(), the same way udl and gm12u320 do it.

v2, "missing reset_resume breaks reset recovery": valid, and not only in theory. v2 dropped reset_resume because the device was not reset on resume, but with the current t2linux 7.2.11 kernel (which carries v2) the Touch Bar is reset on every resume here (MacBookPro16,2, S3):

usb 5-6: reset high-speed USB device number 7 using t2bce_core [drm] Initialized appletbdrm 1.0.0 for 5-6:2.1 on minor 2

Without reset_resume the USB core unbinds and probes the driver again, tiny-dfr loses its device and the Touch Bar stays dark, which is the bug the patch is meant to fix. With v1 (reset_resume doing the probe handshake) on the same kernel the reset still happens, but the driver is not probed again and the Touch Bar works after resume.

v2, "suspend_state leaked on unbind while suspended": with reset_resume back, a reset no longer unbinds the driver, which was the scenario sashiko described. What is left is the device going away while the system sleeps: then disconnect runs without a resume and the saved state is not freed. As far as I can see udl and gm12u320 have the same gap, and drm_mode_config_cleanup() does not free suspend_state either. v3 leaves it out; I can drop the saved state in appletbdrm_disconnect() in a follow-up, or it could be fixed once in the helpers if the DRM maintainers prefer that.

v3 is tested on the t2linux 7.2.11 kernel: 7 suspend/resume cycles, the Touch Bar was reset on each resume, the driver was not probed again, tiny-dfr kept running and the Touch Bar worked every time. (I went through the findings with the help of an AI assistant, Claude; the logs and tests are from my machine.)

Thanks,
Vasilij