From: Aditya Garg <aditya.garg@linux.dev>
To: vasilij.kernel@tototo.si, Aun-Ali Zaidi <admin@kodeit.net>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Kerem Karabay <kekrby@gmail.com>,
Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
Subject: [PATCH v2] drm/appletbdrm: Add suspend and resume support
Date: Sun, 4 Oct 2026 17:36:23 +0530 [thread overview]
Message-ID: <586d0b39-40c8-4f3d-a786-c1085f87b858@linux.dev> (raw)
In-Reply-To: <20260924-appletbdrm-pm-v1-1-0e5432132161@tototo.si>
From: Vasilij Markin <vasilij.kernel@tototo.si>
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
Signed-off-by: Vasilij Markin <vasilij.kernel@tototo.si>
Signed-off-by: Aditya Garg <aditya.garg@linux.dev>
---
v2: Remove reset_resume
drivers/gpu/drm/tiny/appletbdrm.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/gpu/drm/tiny/appletbdrm.c b/drivers/gpu/drm/tiny/appletbdrm.c
index ef71b9957..c94ed1068 100644
--- a/drivers/gpu/drm/tiny/appletbdrm.c
+++ b/drivers/gpu/drm/tiny/appletbdrm.c
@@ -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
prev parent reply other threads:[~2026-10-04 12:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 19:25 [PATCH] " Vasilij Markin via B4 Relay
2026-09-25 11:51 ` Aditya Garg
2026-10-04 12:06 ` Aditya Garg [this message]
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=586d0b39-40c8-4f3d-a786-c1085f87b858@linux.dev \
--to=aditya.garg@linux.dev \
--cc=admin@kodeit.net \
--cc=airlied@gmail.com \
--cc=atharvatiwarilinuxdev@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kekrby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=vasilij.kernel@tototo.si \
/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
all inboxes | Powered by JetHome®