linux: re-add link training

Some monitors blackscreen without it.
This commit is contained in:
Andy Nguyen
2026-05-24 15:27:37 +02:00
parent d44cfeb934
commit 7d5d7976dd

View File

@@ -1143,10 +1143,10 @@ index 000000000000..7acb030a4976
+obj-y += spcie.o tpcie.o hdmi.o mp1.o
diff --git a/drivers/ps5/hdmi.c b/drivers/ps5/hdmi.c
new file mode 100644
index 000000000000..78ffc4f80a6d
index 000000000000..c0c8fee534cc
--- /dev/null
+++ b/drivers/ps5/hdmi.c
@@ -0,0 +1,1237 @@
@@ -0,0 +1,1234 @@
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
@@ -1615,11 +1615,8 @@ index 000000000000..78ffc4f80a6d
+static void sceSetEdidSequence(int sequence)
+{
+ static u8 seq_0[] = {0x04, 0x3f, 0x06, 0x00, 0x02, 0x0c, 0x02, 0x02, 0x01, 0x7a, 0x88, 0xff, 0x01, 0x7a, 0x83, 0x88, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01, 0x02, 0x0f, 0x02, 0x02, 0x01, 0x7a, 0x9c, 0x0e, 0x04, 0x7a, 0x80, 0x00, 0x00, 0x7f, 0x82, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01};
+
+ static u8 seq_1[] = {0x05, 0x3f, 0x06, 0x00, 0x02, 0x0c, 0x02, 0x02, 0x01, 0x7a, 0x88, 0xff, 0x01, 0x7a, 0x83, 0x88, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01, 0x02, 0x0f, 0x02, 0x02, 0x01, 0x7a, 0x9c, 0x0e, 0x04, 0x7a, 0x80, 0x00, 0x80, 0x7f, 0x82, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01};
+
+ static u8 seq_2[] = {0x06, 0x3f, 0x06, 0x00, 0x02, 0x0c, 0x02, 0x02, 0x01, 0x7a, 0x88, 0xff, 0x01, 0x7a, 0x83, 0x88, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01, 0x02, 0x0f, 0x02, 0x02, 0x01, 0x7a, 0x9c, 0x0e, 0x04, 0x7a, 0x80, 0x01, 0x00, 0x7f, 0x82, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01};
+
+ static u8 seq_3[] = {0x07, 0x3f, 0x06, 0x00, 0x02, 0x0c, 0x02, 0x02, 0x01, 0x7a, 0x88, 0xff, 0x01, 0x7a, 0x83, 0x88, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01, 0x02, 0x0f, 0x02, 0x02, 0x01, 0x7a, 0x9c, 0x0e, 0x04, 0x7a, 0x80, 0x01, 0x80, 0x7f, 0x82, 0x03, 0x08, 0x02, 0x01, 0x00, 0x7a, 0x84, 0xa0, 0x03, 0x08, 0x03, 0x01, 0x00, 0x7a, 0x84, 0x01};
+
+ i2c_init(0);
@@ -1674,8 +1671,8 @@ index 000000000000..78ffc4f80a6d
+
+void hdmiSystemResume(void)
+{
+ // sceSetBackToUnpluggedSequence();
+ // sceSetBackToWaitResolutionSequence();
+ sceSetBackToUnpluggedSequence();
+ sceSetBackToWaitResolutionSequence();
+ if (hdmi_ic_type == HDMI_IC_TYPE_FLAVA3) {
+ // i2c_cmd_4_2();
+ // sceSetHdcpSequence1st();
@@ -1687,8 +1684,8 @@ index 000000000000..78ffc4f80a6d
+ // sceSetEdidSequence(3);
+ // sceSetWaitPllSequence();
+ // unk_akv();
+ sceControlHdmiEvent(1);
+ }
+ sceControlHdmiEvent(1);
+}
+EXPORT_SYMBOL(hdmiSystemResume);
+
@@ -1917,7 +1914,7 @@ index 000000000000..78ffc4f80a6d
+
+ i2c_init(1);
+ i2c_mask(0x7021, 0x00, 0xf0);
+ i2c_delay(500);
+ i2c_delay(300);
+ i2c_begin_block();
+ i2c_write(0x100c, 0x01);
+ i2c_write_data(0x68a0, (u8[]){0x96, 0x04}, 2);
@@ -2018,7 +2015,7 @@ index 000000000000..78ffc4f80a6d
+ i2c_write(0x700a, 0x02);
+ i2c_write(0x705f, 0x80);
+ i2c_end_block();
+ i2c_delay(700);
+ i2c_delay(500);
+ i2c_write(0x7a8b, 0x00);
+ i2c_cmd_5_3(0x01);
+ i2c_exec();
@@ -2026,8 +2023,8 @@ index 000000000000..78ffc4f80a6d
+
+static void setHdmiVideoConfigFlava3(const struct drm_display_mode *mode)
+{
+ // configParamFlava3Pre();
+ // configLinkTrainingFlava3();
+ configParamFlava3Pre();
+ configLinkTrainingFlava3();
+ setHdmiBasicVideoConfigFlava3(mode);
+ initHdmiPhyForFlava3_1st();
+ initHdmiPhyForFlava3_2nd();