Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/display-failures.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ not an illumination measurement; accepted unpark writes did not relight the
reported panels. The next experiment is observation, not another reset or
speculative power write.

On a MacBookPro14,3 in s2idle, the panel stayed parked (report 3 mode 1)
after every resume, and an unpark followed by fresh frames relit it. Resume
now ends the rearm with that unpark, before the DRM state is restored. This
was observed on s2idle only; the 14,2 S3 reports above, where the same write
did not relight, remain open.

## Opt-in reply evidence

The following diagnostic records require **v0.1.11 or newer**. They are not
Expand Down
24 changes: 24 additions & 0 deletions kernel/appletbdrm-t1/appletbdrm.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,30 @@ static void appletbdrm_t1_park(struct appletbdrm_device *adev)
appletbdrm_clear_display(adev);
}

/*
* Undo appletbdrm_t1_park() after system sleep. The T1 keeps the panel parked
* (report 3 mode 1) across resume, and the rearm handshake alone does not
* change that, so the panel stays dark until the mode is set back to 2.
*/
static int appletbdrm_t1_unpark(struct appletbdrm_device *adev)
{
static const u8 report[15] = { 0x03, 0x02 };
struct usb_device *udev = adev_to_udev(adev);
u8 *buffer;
int ret;

buffer = kmemdup(report, sizeof(report), GFP_KERNEL);
if (!buffer)
return -ENOMEM;

ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x09, 0x21,
0x0303, APPLETBDRM_T1_HID_INTERFACE, buffer,
sizeof(report), USB_CTRL_SET_TIMEOUT);
kfree(buffer);

return ret < 0 ? ret : 0;
}

static int appletbdrm_suspend(struct usb_interface *intf, pm_message_t message)
{
struct appletbdrm_device *adev = usb_get_intfdata(intf);
Expand Down
5 changes: 4 additions & 1 deletion kernel/appletbdrm-t1/appletbdrm_resume.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ static int appletbdrm_t1_rearm(struct appletbdrm_device *adev)
if (ret)
return ret;
ret = appletbdrm_clear_display(adev);
if (ret)
return ret;
ret = appletbdrm_clear_display(adev);
if (ret)
return ret;

return appletbdrm_clear_display(adev);
return appletbdrm_t1_unpark(adev);
}

static int appletbdrm_resume(struct usb_interface *intf)
Expand Down
10 changes: 8 additions & 2 deletions kernel/appletbdrm-t1/test_appletbdrm_resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <stddef.h>
#include <stdio.h>

enum step { CLEAR_OUT, CLEAR_IN, INFORMATION, READINESS, CLEAR, RESTORE };
enum step { CLEAR_OUT, CLEAR_IN, INFORMATION, READINESS, CLEAR, UNPARK, RESTORE };
static const enum step recovery[] = {
CLEAR_OUT, CLEAR_IN, INFORMATION, READINESS, CLEAR, CLEAR, RESTORE,
CLEAR_OUT, CLEAR_IN, INFORMATION, READINESS, CLEAR, CLEAR, UNPARK, RESTORE,
};
static enum step observed[sizeof(recovery) / sizeof(recovery[0])];
static size_t calls, fail_at, errors;
Expand Down Expand Up @@ -77,6 +77,12 @@ static int appletbdrm_clear_display(struct appletbdrm_device *adev)
return perform(CLEAR);
}

static int appletbdrm_t1_unpark(struct appletbdrm_device *adev)
{
(void)adev;
return perform(UNPARK);
}

static int drm_mode_config_helper_resume(struct drm_device *drm)
{
(void)drm;
Expand Down
Loading