Add a late HPD dock mode

This commit is contained in:
Baptiste MOINE committed 2026-11-13 13:38:17 +01:00
1 parent afc3dfe28a
commit 6e72741878
3 files changed
+11 -3

No files matched your search

+4
View File
@@ -517,6 +517,10 @@ struct EmuState {
// reads HOS docks with (state 0x16, 0x0B, 0x18) but not the LED or hub
// messages; 2 (nintendo:mute) answers none of the dock's own messages.
std::atomic<uint8_t> dock_clone{0};
// --dock ...:latehpd: the TV's HPD comes 25 s after the DisplayPort
// configuration instead of 150 ms (a VIA Labs adapter, 2109:0103,
// raised it after hwtest's 1.5 s wait; 25 s outlasts any wait).
std::atomic<bool> dock_late_hpd{false};
std::atomic<uint16_t> usb_pd_voltage_mv{5000};
std::atomic<uint16_t> usb_pd_amperage_ma{1500};
+3 -1
View File
@@ -347,7 +347,8 @@ int main(int argc, char *argv[]) {
// "none"; append ":notv" for a dock with nothing on its HDMI,
// ":clone" for one that answers the reads HOS docks with but
// not the LED or hub messages, ":mute" for one that answers
// none of the Nintendo dock's own messages.
// none of the Nintendo dock's own messages, ":latehpd" for a
// TV whose HPD comes 25 s after DisplayPort is configured.
const char *d = argv[++i];
uint8_t k = 0xFF;
if (!strncmp(d, "nintendo", 8)) k = 1;
@@ -361,6 +362,7 @@ int main(int argc, char *argv[]) {
state.dock_kind = k;
state.dock_tv = strstr(d, ":notv") == nullptr;
state.dock_clone = strstr(d, ":mute") ? 2 : strstr(d, ":clone") ? 1 : 0;
state.dock_late_hpd = strstr(d, ":latehpd") != nullptr;
printf("[emu] Dock: %s%s [overrides ini]\n", d, "");
} else if (strcmp(argv[i], "--oem") == 0 && i + 1 < argc) {
const char *oem = argv[++i];
+4 -2
View File
@@ -455,8 +455,10 @@ void command(uint16_t cmd) {
chip.dp_pin = (pin & 0x08) ? 0x08 : 0x04;
DLOG("DisplayPort configured, pin %c\n", chip.dp_pin == 0x08 ? 'D' : 'C');
done(LASTCMD_COMPLETE);
if (tv_present())
after_us(150000, [] { if (chip.dp_configured) hpd_update(true); });
if (tv_present()) {
bool late = g_state && g_state->dock_late_hpd.load();
after_us(late ? 25000000 : 150000, [] { if (chip.dp_configured) hpd_update(true); });
}
});
break;
}