display: Add workaround for Sequoia DCP handoff bug

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2024-09-17 23:42:42 +09:00
parent 793ca17209
commit cdb6d41aa2

View file

@ -8,6 +8,7 @@
#include "dcp.h"
#include "dcp_iboot.h"
#include "fb.h"
#include "firmware.h"
#include "memory.h"
#include "soc.h"
#include "string.h"
@ -31,6 +32,7 @@ static u64 fb_dva;
static u64 fb_size;
bool display_is_external;
bool display_is_dptx;
bool display_needs_power_cycle;
static const display_config_t display_config_m1 = {
.dcp = "/arm-io/dcp",
@ -401,6 +403,11 @@ int display_configure(const char *config)
}
if (!display_is_external) {
// Sequoia bug workaround: Force power cycle
if (display_needs_power_cycle) {
if ((ret = dcp_ib_set_power(iboot, false)) < 0)
printf("display: failed to set power off (continuing anyway)\n");
}
// Sonoma bug workaround: Power on internal panel early
if ((ret = dcp_ib_set_power(iboot, true)) < 0)
printf("display: failed to set power on (continuing anyway)\n");
@ -615,6 +622,12 @@ int display_init(void)
"reconfiguring\n");
fb_clear_direct(); // Old m1n1 stage1 ends up with an ugly logo situation, clear it.
return display_configure(NULL);
#ifndef CHAINLOADING
} else if ((chip_id == T8103 || chip_id == T8112) && firmware_sfw_in_range(V15_0B1, FW_MAX)) {
printf("display: Internal display on t8103 or t8112 with Sequoia SFW, power cycling\n");
display_needs_power_cycle = true;
return display_configure(NULL);
#endif
} else {
printf("display: Display is already initialized (%ldx%ld)\n", cur_boot_args.video.width,
cur_boot_args.video.height);