Compare commits

...

1 Commits

Author SHA1 Message Date
Andy Nguyen
2c46113af9 linux: clean up and fix blackscreen 2026-05-25 00:38:04 +02:00
2 changed files with 43 additions and 40 deletions

View File

@@ -2402,7 +2402,7 @@ CONFIG_SMSC_PHY=m
# CONFIG_DP83TG720_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_XILINX_GMII2RGMII is not set
CONFIG_MTS=y
CONFIG_MTS=m
CONFIG_FWNODE_MDIO=y
CONFIG_ACPI_MDIO=y
# CONFIG_MDIO_BITBANG is not set

View File

@@ -604,7 +604,7 @@ index 3459d356151e..f09233c05e04 100644
break;
default:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index c91638e65174..c25b073ca658 100644
index c91638e65174..00618809031f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -41,6 +41,10 @@
@@ -639,14 +639,13 @@ index c91638e65174..c25b073ca658 100644
{0x1002, 0x13DB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYAN_SKILLFISH|AMD_IS_APU},
{0x1002, 0x13F9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYAN_SKILLFISH|AMD_IS_APU},
{0x1002, 0x13FA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_CYAN_SKILLFISH|AMD_IS_APU},
@@ -2393,6 +2404,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
@@ -2393,6 +2404,11 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
int ret, retry = 0, i;
bool supports_atomic = false;
+#ifdef CONFIG_X86_PS5
+ if (!isHdmiEnabled()) {
+ if (!spcie_is_initialized())
+ return -EPROBE_DEFER;
+ }
+#endif
+
if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA ||
@@ -1163,7 +1162,7 @@ index 000000000000..e01771be845b
+mts-y := mts_main.o mts_phy.o
diff --git a/drivers/net/phy/mts/mts.h b/drivers/net/phy/mts/mts.h
new file mode 100644
index 000000000000..d994ace066eb
index 000000000000..e846b6b0edbc
--- /dev/null
+++ b/drivers/net/phy/mts/mts.h
@@ -0,0 +1,181 @@
@@ -1174,8 +1173,8 @@ index 000000000000..d994ace066eb
+ * Based on the MediaTek Star Ethernet MAC (mtk_star_emac).
+ */
+
+#ifndef _PS5_GBE_H
+#define _PS5_GBE_H
+#ifndef _MTS_H
+#define _MTS_H
+
+#include <linux/types.h>
+#include <linux/bits.h>
@@ -1347,13 +1346,13 @@ index 000000000000..d994ace066eb
+
+int gbe_phy_init(struct gbe_priv *p);
+
+#endif /* _PS5_GBE_H */
+#endif /* _MTS_H */
diff --git a/drivers/net/phy/mts/mts_main.c b/drivers/net/phy/mts/mts_main.c
new file mode 100644
index 000000000000..cc9e18ebb7c3
index 000000000000..4250a25d7260
--- /dev/null
+++ b/drivers/net/phy/mts/mts_main.c
@@ -0,0 +1,808 @@
@@ -0,0 +1,810 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * PlayStation 5 Gigabit Ethernet driver
@@ -1374,9 +1373,8 @@ index 000000000000..cc9e18ebb7c3
+
+#include "mts.h"
+
+#define GBE_VENDOR_ID 0x104d
+#define GBE_DEVICE_ID 0x9104
+#define GBE_GLUE_ID 0x9107
+#define PCI_DEVICE_ID_GBE 0x9104
+#define PCI_DEVICE_ID_SPCIE 0x9107
+
+static void gbe_write_mac(struct gbe_priv *p, const u8 *addr)
+{
@@ -1390,7 +1388,7 @@ index 000000000000..cc9e18ebb7c3
+{
+ struct pci_dev *glue;
+
+ glue = pci_get_device(GBE_VENDOR_ID, GBE_GLUE_ID, NULL);
+ glue = pci_get_device(PCI_VENDOR_ID_SONY, PCI_DEVICE_ID_SPCIE, NULL);
+ if (!glue)
+ return -ENODEV;
+
@@ -2048,6 +2046,9 @@ index 000000000000..cc9e18ebb7c3
+ u8 mac[ETH_ALEN];
+ int ret;
+
+ if (!spcie_is_initialized())
+ return -EPROBE_DEFER;
+
+ ret = pcim_enable_device(pdev);
+ if (ret)
+ return ret;
@@ -2145,7 +2146,7 @@ index 000000000000..cc9e18ebb7c3
+}
+
+static const struct pci_device_id gbe_pci_tbl[] = {
+ { PCI_DEVICE(GBE_VENDOR_ID, GBE_DEVICE_ID) },
+ { PCI_DEVICE(PCI_VENDOR_ID_SONY, PCI_DEVICE_ID_GBE) },
+ { }
+};
+MODULE_DEVICE_TABLE(pci, gbe_pci_tbl);
@@ -4508,10 +4509,10 @@ index 000000000000..d2c25e461bf7
+#endif /* _AUTOSERVO_PARAM_H */
diff --git a/drivers/ps5/hdmi.c b/drivers/ps5/hdmi.c
new file mode 100644
index 000000000000..c0c8fee534cc
index 000000000000..1193d840f5d6
--- /dev/null
+++ b/drivers/ps5/hdmi.c
@@ -0,0 +1,1234 @@
@@ -0,0 +1,1226 @@
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
@@ -4614,7 +4615,6 @@ index 000000000000..c0c8fee534cc
+
+static struct i2c_context i2c_ctx;
+
+static bool hdmi_is_enabled;
+static u8 hdmi_ic_type;
+static u8 tmds_polarity;
+static u8 tmds_ch_swap;
@@ -5031,7 +5031,6 @@ index 000000000000..c0c8fee534cc
+ i2c_init(4);
+ i2c_cmd_5_4(enable);
+ i2c_exec();
+ hdmi_is_enabled = !!enable;
+}
+
+void hdmiSystemResume(void)
@@ -5039,16 +5038,16 @@ index 000000000000..c0c8fee534cc
+ sceSetBackToUnpluggedSequence();
+ sceSetBackToWaitResolutionSequence();
+ if (hdmi_ic_type == HDMI_IC_TYPE_FLAVA3) {
+ // i2c_cmd_4_2();
+ i2c_cmd_4_2();
+ // sceSetHdcpSequence1st();
+ // sceSetHdcpSequence2nd();
+ // sceSetHdcpSequence3rd();
+ // sceSetEdidSequence(0);
+ // sceSetEdidSequence(1);
+ // sceSetEdidSequence(2);
+ // sceSetEdidSequence(3);
+ // sceSetWaitPllSequence();
+ // unk_akv();
+ sceSetEdidSequence(0);
+ sceSetEdidSequence(1);
+ sceSetEdidSequence(2);
+ sceSetEdidSequence(3);
+ sceSetWaitPllSequence();
+ unk_akv();
+ }
+ sceControlHdmiEvent(1);
+}
@@ -5279,7 +5278,7 @@ index 000000000000..c0c8fee534cc
+
+ i2c_init(1);
+ i2c_mask(0x7021, 0x00, 0xf0);
+ i2c_delay(300);
+ i2c_delay(500);
+ i2c_begin_block();
+ i2c_write(0x100c, 0x01);
+ i2c_write_data(0x68a0, (u8[]){0x96, 0x04}, 2);
@@ -5380,7 +5379,7 @@ index 000000000000..c0c8fee534cc
+ i2c_write(0x700a, 0x02);
+ i2c_write(0x705f, 0x80);
+ i2c_end_block();
+ i2c_delay(500);
+ i2c_delay(700);
+ i2c_write(0x7a8b, 0x00);
+ i2c_cmd_5_3(0x01);
+ i2c_exec();
@@ -5663,12 +5662,6 @@ index 000000000000..c0c8fee534cc
+}
+EXPORT_SYMBOL(sceHdmiSetAudioMute);
+
+int isHdmiEnabled(void)
+{
+ return hdmi_is_enabled;
+}
+EXPORT_SYMBOL(isHdmiEnabled);
+
+int getHdmiConfiguration(void)
+{
+ u8 buf[ICC_MSG_MAX_SIZE] = {};
@@ -6242,10 +6235,10 @@ index 000000000000..4af890c842a7
+MODULE_LICENSE("GPL");
diff --git a/drivers/ps5/spcie.c b/drivers/ps5/spcie.c
new file mode 100644
index 000000000000..70c9dc4126f7
index 000000000000..8a073f2f0f0a
--- /dev/null
+++ b/drivers/ps5/spcie.c
@@ -0,0 +1,1075 @@
@@ -0,0 +1,1084 @@
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/module.h>
@@ -6333,6 +6326,7 @@ index 000000000000..70c9dc4126f7
+static struct spcie_dev *sdev;
+static struct spcie_icc_dev *icc_dev;
+
+static bool spcie_initialized = false;
+static u32 spcie_chip_revision_id = 0;
+
+static const u8 indicator_white_dim[] = {
@@ -7049,6 +7043,12 @@ index 000000000000..70c9dc4126f7
+ return 0;
+}
+
+bool spcie_is_initialized(void)
+{
+ return spcie_initialized;
+}
+EXPORT_SYMBOL(spcie_is_initialized);
+
+u32 spcie_get_chip_id(void)
+{
+ return spcie_chip_revision_id & 0xff0000;
@@ -7281,6 +7281,8 @@ index 000000000000..70c9dc4126f7
+ return ret;
+ }
+
+ spcie_initialized = true;
+
+ pci_set_drvdata(pdev, sdev);
+ return 0;
+}
@@ -7646,10 +7648,10 @@ index 2eedf44e6801..2785a47665be 100644
extern void dmi_setup(void);
diff --git a/include/linux/ps5.h b/include/linux/ps5.h
new file mode 100644
index 000000000000..f8d9a5ddc04b
index 000000000000..7ed7adc99719
--- /dev/null
+++ b/include/linux/ps5.h
@@ -0,0 +1,88 @@
@@ -0,0 +1,89 @@
+#ifndef _LINUX_PS5_H
+#define _LINUX_PS5_H
+
@@ -7692,6 +7694,8 @@ index 000000000000..f8d9a5ddc04b
+ ICC_SERVICE_ID_FLOYD = 0x9a,
+};
+
+bool spcie_is_initialized(void);
+
+u32 spcie_get_chip_id(void);
+u32 spcie_get_revision_id(void);
+u32 spcie_bar2_180000_read(u32 reg);
@@ -7707,7 +7711,6 @@ index 000000000000..f8d9a5ddc04b
+void sceHdmiDeviceSetVideoMute(int mute);
+void sceHdmiSetAudioMute(int mute);
+int getHdmiConfiguration(void);
+int isHdmiEnabled(void);
+bool isHdmiModeValid(const struct drm_display_mode *mode, int force_1080p);
+
+int icc_nvs_write(u32 partition, u16 offset, u16 length, const void *data);