> On 4 Oct 2026, at 5:36 PM, Aditya Garg <[email protected]> wrote:
> 
> 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
> Signed-off-by: Vasilij Markin <[email protected]>
> Signed-off-by: Aditya Garg <[email protected]>

Could anyone please merge it if they are ok with it? Thanks.
> ---
> 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

Reply via email to