You've already forked linux-t2-patches
mirror of
https://github.com/t2linux/linux-t2-patches.git
synced 2026-04-30 13:52:11 -07:00
gmux v3
This commit is contained in:
committed by
Aditya Garg
parent
3782176738
commit
21be1b4c1b
+4
-3
@@ -1,7 +1,7 @@
|
||||
From 4efdf7db67bb409336503cfef636a5b67f6ff7c9 Mon Sep 17 00:00:00 2001
|
||||
From a3a367b32d40764ab4d90291a08cc27ed261c2c5 Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Thu, 16 Feb 2023 19:28:31 +1100
|
||||
Subject: [PATCH 7/8] drm/amdgpu: register a vga_switcheroo client for MacBooks
|
||||
Subject: [PATCH 1/9] drm/amdgpu: register a vga_switcheroo client for MacBooks
|
||||
with apple-gmux
|
||||
|
||||
Commit 3840c5bcc245 ("drm/amdgpu: disentangle runtime pm and
|
||||
@@ -14,13 +14,14 @@ pci_is_thunderbolt_attached() to ensure eGPUs connected to Dual GPU
|
||||
Macbooks don't register with vga_switcheroo.
|
||||
|
||||
Fixes: 3840c5bcc245 ("drm/amdgpu: disentangle runtime pm and vga_switcheroo")
|
||||
Link: https://lore.kernel.org/amd-gfx/20230210044826.9834-10-orlandoch.dev@gmail.com/
|
||||
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 21 ++++++++++++++++-----
|
||||
1 file changed, 16 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||
index 2f28a8c02f64..ef8b996f0622 100644
|
||||
index fbf2f24169eb..e8bf5ec07b8e 100644
|
||||
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
|
||||
@@ -35,6 +35,7 @@
|
||||
+3
-2
@@ -1,7 +1,7 @@
|
||||
From 034dec654fe123ce11092f8057cef2ed20ff1509 Mon Sep 17 00:00:00 2001
|
||||
From afb1b48bef34582e3162b57e46c4c8a24432c800 Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Thu, 16 Feb 2023 19:30:31 +1100
|
||||
Subject: [PATCH 8/8] hda/hdmi: Register with vga_switcheroo on Dual GPU
|
||||
Subject: [PATCH 2/9] hda/hdmi: Register with vga_switcheroo on Dual GPU
|
||||
Macbooks
|
||||
|
||||
Commit 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for
|
||||
@@ -20,6 +20,7 @@ To resolve this, we use apple_gmux_detect() and register a
|
||||
vga_switcheroo audio client when apple-gmux is detected.
|
||||
|
||||
Fixes: 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD")
|
||||
Link: https://lore.kernel.org/all/20230210044826.9834-9-orlandoch.dev@gmail.com/
|
||||
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
---
|
||||
sound/pci/hda/hda_intel.c | 3 ++-
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
From 7dd5ce6d1f42bc06500d7c8e697654059a7916e9 Mon Sep 17 00:00:00 2001
|
||||
From aca5f8b9f935191aa38d9f68ee18109a4bc8dd34 Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Wed, 25 Jan 2023 18:16:29 +1100
|
||||
Subject: [PATCH 1/8] apple-gmux: use first bit to check switch state
|
||||
Subject: [PATCH 3/9] apple-gmux: use first bit to check switch state
|
||||
|
||||
On T2 Macs with MMIO gmux, when GMUX_PORT_SWITCH_DISPLAY is read, it can
|
||||
have values of 2, 3, 4, and 5. Odd values correspond to the discrete gpu,
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From 6d62b85e0d3af9715933c708edb629da0b02c2ef Mon Sep 17 00:00:00 2001
|
||||
From a156d5b7aef4a1a49d9abb822780a02a596d83be Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Wed, 25 Jan 2023 18:07:41 +1100
|
||||
Subject: [PATCH 2/8] apple-gmux: refactor gmux types
|
||||
Subject: [PATCH 4/9] apple-gmux: refactor gmux types
|
||||
|
||||
Add apple_gmux_config struct containing operations and data specific to
|
||||
each mux type.
|
||||
@@ -214,7 +214,7 @@ index ec99e05e532c..36208e93d745 100644
|
||||
pr_err("Failed to register vga_switcheroo handler\n");
|
||||
goto err_register_handler;
|
||||
diff --git a/include/linux/apple-gmux.h b/include/linux/apple-gmux.h
|
||||
index 1f68b49bcd68..5f658439f7f8 100644
|
||||
index 1f68b49bcd68..147dc1c52e08 100644
|
||||
--- a/include/linux/apple-gmux.h
|
||||
+++ b/include/linux/apple-gmux.h
|
||||
@@ -36,6 +36,11 @@
|
||||
@@ -223,7 +223,7 @@ index 1f68b49bcd68..5f658439f7f8 100644
|
||||
|
||||
+enum apple_gmux_type {
|
||||
+ APPLE_GMUX_TYPE_PIO,
|
||||
+ APPLE_GMUX_TYPE_INDEXED
|
||||
+ APPLE_GMUX_TYPE_INDEXED,
|
||||
+};
|
||||
+
|
||||
#if IS_ENABLED(CONFIG_APPLE_GMUX)
|
||||
+11
-13
@@ -1,7 +1,7 @@
|
||||
From 864df26e00fa72903842db1f02a1960fd717d45f Mon Sep 17 00:00:00 2001
|
||||
From d956389467cff5a4c1ce90a8551f7de149dbd77f Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Mon, 30 Jan 2023 15:14:41 +1100
|
||||
Subject: [PATCH 3/8] apple-gmux: Use GMSP acpi method for interrupt clear
|
||||
Subject: [PATCH 5/9] apple-gmux: Use GMSP acpi method for interrupt clear
|
||||
|
||||
This is needed for interrupts to be cleared correctly on MMIO based
|
||||
gmux's. It is untested if this helps/hinders other gmux types, so
|
||||
@@ -12,12 +12,14 @@ with 1 as its argument, but the purposes of these aren't known and they
|
||||
don't seem to be needed.
|
||||
|
||||
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
|
||||
v2->v3: remove status != 0 check
|
||||
---
|
||||
drivers/platform/x86/apple-gmux.c | 30 +++++++++++++++++++++++++++++-
|
||||
1 file changed, 29 insertions(+), 1 deletion(-)
|
||||
drivers/platform/x86/apple-gmux.c | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
|
||||
index 36208e93d745..12a93fc49c36 100644
|
||||
index 36208e93d745..8dfa1c02be64 100644
|
||||
--- a/drivers/platform/x86/apple-gmux.c
|
||||
+++ b/drivers/platform/x86/apple-gmux.c
|
||||
@@ -76,6 +76,7 @@ struct apple_gmux_config {
|
||||
@@ -74,16 +76,12 @@ index 36208e93d745..12a93fc49c36 100644
|
||||
static inline void gmux_disable_interrupts(struct apple_gmux_data *gmux_data)
|
||||
{
|
||||
gmux_write8(gmux_data, GMUX_PORT_INTERRUPT_ENABLE,
|
||||
@@ -536,7 +560,11 @@ static void gmux_clear_interrupts(struct apple_gmux_data *gmux_data)
|
||||
|
||||
@@ -537,6 +561,8 @@ static void gmux_clear_interrupts(struct apple_gmux_data *gmux_data)
|
||||
/* to clear interrupts write back current status */
|
||||
status = gmux_interrupt_get_status(gmux_data);
|
||||
- gmux_write8(gmux_data, GMUX_PORT_INTERRUPT_STATUS, status);
|
||||
+ if (status) {
|
||||
+ gmux_write8(gmux_data, GMUX_PORT_INTERRUPT_STATUS, status);
|
||||
+ if (gmux_data->config->use_acpi_gmsp)
|
||||
+ gmux_call_acpi_gmsp(gmux_data, 0);
|
||||
+ }
|
||||
gmux_write8(gmux_data, GMUX_PORT_INTERRUPT_STATUS, status);
|
||||
+ if (gmux_data->config->use_acpi_gmsp)
|
||||
+ gmux_call_acpi_gmsp(gmux_data, 0);
|
||||
}
|
||||
|
||||
static void gmux_notify_handler(acpi_handle device, u32 value, void *context)
|
||||
+65
-28
@@ -1,7 +1,7 @@
|
||||
From 023b7e558983667bb47ac14e2dfdfe984ede2195 Mon Sep 17 00:00:00 2001
|
||||
From 464c2067b97498a0ebef27ba65b6f4e799a56510 Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Thu, 16 Feb 2023 21:12:28 +1100
|
||||
Subject: [PATCH 4/8] apple-gmux: support MMIO gmux on T2 Macs
|
||||
Date: Fri, 17 Feb 2023 10:21:47 +1100
|
||||
Subject: [PATCH 6/9] apple-gmux: support MMIO gmux on T2 Macs
|
||||
|
||||
In some newer dual gpu MacBooks, gmux is controlled by the T2 security
|
||||
chip, and acessed with MMIO. Add support for these gmux controllers
|
||||
@@ -29,12 +29,12 @@ Issues:
|
||||
|
||||
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
---
|
||||
drivers/platform/x86/apple-gmux.c | 136 ++++++++++++++++++++++++++++--
|
||||
include/linux/apple-gmux.h | 40 ++++++---
|
||||
2 files changed, 154 insertions(+), 22 deletions(-)
|
||||
drivers/platform/x86/apple-gmux.c | 142 +++++++++++++++++++++++++++---
|
||||
include/linux/apple-gmux.h | 56 +++++++++---
|
||||
2 files changed, 174 insertions(+), 24 deletions(-)
|
||||
|
||||
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
|
||||
index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
index 8dfa1c02be64..01e7b1939916 100644
|
||||
--- a/drivers/platform/x86/apple-gmux.c
|
||||
+++ b/drivers/platform/x86/apple-gmux.c
|
||||
@@ -28,15 +28,17 @@
|
||||
@@ -146,6 +146,28 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
static u8 gmux_read8(struct apple_gmux_data *gmux_data, int port)
|
||||
{
|
||||
return gmux_data->config->read8(gmux_data, port);
|
||||
@@ -237,8 +313,8 @@ static void gmux_write32(struct apple_gmux_data *gmux_data, int port,
|
||||
* the GPU. On dual GPU MacBook Pros by contrast, either GPU may be suspended
|
||||
* to conserve energy. Hence the PWM signal needs to be generated by a separate
|
||||
* backlight driver which is controlled by gmux. The earliest generation
|
||||
- * MBP5 2008/09 uses a `TI LP8543`_ backlight driver. All newer models
|
||||
- * use a `TI LP8545`_.
|
||||
+ * MBP5 2008/09 uses a `TI LP8543`_ backlight driver. Newer models
|
||||
+ * use a `TI LP8545`_ or a TI LP8548.
|
||||
*
|
||||
* .. _TI LP8543: https://www.ti.com/lit/ds/symlink/lp8543.pdf
|
||||
* .. _TI LP8545: https://www.ti.com/lit/ds/symlink/lp8545.pdf
|
||||
@@ -302,8 +378,8 @@ static const struct backlight_ops gmux_bl_ops = {
|
||||
* connecting it either to the discrete GPU or the Thunderbolt controller.
|
||||
* Oddly enough, while the full port is no longer switchable, AUX and HPD
|
||||
* are still switchable by way of an `NXP CBTL03062`_ (on pre-retinas
|
||||
- * MBP8 2011 and MBP9 2012) or two `TI TS3DS10224`_ (on retinas) under the
|
||||
- * control of gmux. Since the integrated GPU is missing the main link,
|
||||
+ * MBP8 2011 and MBP9 2012) or two `TI TS3DS10224`_ (on pre-t2 retinas) under
|
||||
+ * the control of gmux. Since the integrated GPU is missing the main link,
|
||||
* external displays appear to it as phantoms which fail to link-train.
|
||||
*
|
||||
* gmux receives the HPD signal of all display connectors and sends an
|
||||
@@ -506,6 +582,20 @@ static const struct apple_gmux_config apple_gmux_index = {
|
||||
.name = "indexed"
|
||||
};
|
||||
@@ -167,16 +189,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
/**
|
||||
* DOC: Interrupt
|
||||
*
|
||||
@@ -558,7 +648,7 @@ static void gmux_clear_interrupts(struct apple_gmux_data *gmux_data)
|
||||
{
|
||||
u8 status;
|
||||
|
||||
- /* to clear interrupts write back current status */
|
||||
+ /* to clear interrupts write back current status. */
|
||||
status = gmux_interrupt_get_status(gmux_data);
|
||||
if (status) {
|
||||
gmux_write8(gmux_data, GMUX_PORT_INTERRUPT_STATUS, status);
|
||||
@@ -637,6 +727,25 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -635,6 +725,25 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
pnp_set_drvdata(pnp, gmux_data);
|
||||
|
||||
switch (type) {
|
||||
@@ -202,7 +215,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
case APPLE_GMUX_TYPE_INDEXED:
|
||||
gmux_data->config = &apple_gmux_index;
|
||||
mutex_init(&gmux_data->index_lock);
|
||||
@@ -656,6 +765,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -654,6 +763,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
@@ -210,7 +223,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
if (gmux_data->config->read_version_as_u32) {
|
||||
version = gmux_read32(gmux_data, GMUX_PORT_VERSION_MAJOR);
|
||||
ver_major = (version >> 24) & 0xff;
|
||||
@@ -686,7 +796,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -684,7 +794,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
gmux_data, &gmux_bl_ops, &props);
|
||||
if (IS_ERR(bdev)) {
|
||||
ret = PTR_ERR(bdev);
|
||||
@@ -219,7 +232,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
}
|
||||
|
||||
gmux_data->bdev = bdev;
|
||||
@@ -753,7 +863,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -751,7 +861,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
/*
|
||||
* Retina MacBook Pros cannot switch the panel's AUX separately
|
||||
* and need eDP pre-calibration. They are distinguishable from
|
||||
@@ -228,7 +241,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
*
|
||||
* Pre-retina MacBook Pros can switch the panel's DDC separately.
|
||||
*/
|
||||
@@ -778,8 +888,14 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -776,8 +886,14 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
&gmux_notify_handler);
|
||||
err_notify:
|
||||
backlight_device_unregister(bdev);
|
||||
@@ -244,7 +257,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
err_free:
|
||||
kfree(gmux_data);
|
||||
return ret;
|
||||
@@ -800,7 +916,11 @@ static void gmux_remove(struct pnp_dev *pnp)
|
||||
@@ -798,7 +914,11 @@ static void gmux_remove(struct pnp_dev *pnp)
|
||||
|
||||
backlight_device_unregister(gmux_data->bdev);
|
||||
|
||||
@@ -258,7 +271,7 @@ index 12a93fc49c36..a0ccdf2aa9cf 100644
|
||||
kfree(gmux_data);
|
||||
|
||||
diff --git a/include/linux/apple-gmux.h b/include/linux/apple-gmux.h
|
||||
index 5f658439f7f8..b7532f26b756 100644
|
||||
index 147dc1c52e08..272f63f8fd7c 100644
|
||||
--- a/include/linux/apple-gmux.h
|
||||
+++ b/include/linux/apple-gmux.h
|
||||
@@ -34,11 +34,18 @@
|
||||
@@ -275,13 +288,37 @@ index 5f658439f7f8..b7532f26b756 100644
|
||||
|
||||
enum apple_gmux_type {
|
||||
APPLE_GMUX_TYPE_PIO,
|
||||
- APPLE_GMUX_TYPE_INDEXED
|
||||
+ APPLE_GMUX_TYPE_INDEXED,
|
||||
+ APPLE_GMUX_TYPE_MMIO
|
||||
APPLE_GMUX_TYPE_INDEXED,
|
||||
+ APPLE_GMUX_TYPE_MMIO,
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_APPLE_GMUX)
|
||||
@@ -93,19 +100,24 @@ static inline bool apple_gmux_detect(struct pnp_dev *pnp_dev, enum apple_gmux_ty
|
||||
@@ -57,6 +64,24 @@ static inline bool apple_gmux_is_indexed(unsigned long iostart)
|
||||
return false;
|
||||
}
|
||||
|
||||
+static inline bool apple_gmux_is_mmio(unsigned long iostart)
|
||||
+{
|
||||
+ u8 *__iomem iomem_base = ioremap(iostart, 16);
|
||||
+ u8 val;
|
||||
+
|
||||
+ if (!iomem_base)
|
||||
+ return false;
|
||||
+
|
||||
+ /*
|
||||
+ * If this is 0xff, then gmux must not be present, as the gmux would
|
||||
+ * reset it to 0x00, or it would be one of 0x1, 0x4, 0x41, 0x44 if a
|
||||
+ * command is currently being processed.
|
||||
+ */
|
||||
+ val = ioread8(iomem_base + GMUX_MMIO_COMMAND_SEND);
|
||||
+ iounmap(iomem_base);
|
||||
+ return (val != 0xff);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* apple_gmux_detect() - detect if gmux is built into the machine
|
||||
*
|
||||
@@ -93,19 +118,24 @@ static inline bool apple_gmux_detect(struct pnp_dev *pnp_dev, enum apple_gmux_ty
|
||||
}
|
||||
|
||||
res = pnp_get_resource(pnp_dev, IORESOURCE_IO, 0);
|
||||
@@ -314,7 +351,7 @@ index 5f658439f7f8..b7532f26b756 100644
|
||||
+ }
|
||||
+ } else {
|
||||
+ res = pnp_get_resource(pnp_dev, IORESOURCE_MEM, 0);
|
||||
+ if (res)
|
||||
+ if (res && apple_gmux_is_mmio(res->start))
|
||||
+ type = APPLE_GMUX_TYPE_MMIO;
|
||||
else
|
||||
goto out;
|
||||
+12
-18
@@ -1,7 +1,7 @@
|
||||
From 2755390cc676c899b4df21b929fa33e6804dd665 Mon Sep 17 00:00:00 2001
|
||||
From 6690f0abebaf185fb5434bd2e6bd98a3ec7d0dec Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Fri, 27 Jan 2023 17:23:55 +1100
|
||||
Subject: [PATCH 5/8] apple-gmux: add debugfs interface
|
||||
Subject: [PATCH 7/9] apple-gmux: add debugfs interface
|
||||
|
||||
Allow reading and writing gmux ports from userspace.
|
||||
|
||||
@@ -14,11 +14,11 @@ Will show the gmux version information (00000005 in this case)
|
||||
|
||||
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
---
|
||||
drivers/platform/x86/apple-gmux.c | 88 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 88 insertions(+)
|
||||
drivers/platform/x86/apple-gmux.c | 82 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 82 insertions(+)
|
||||
|
||||
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
|
||||
index a0ccdf2aa9cf..e2a6ada34078 100644
|
||||
index 01e7b1939916..4cbdc9f9bd10 100644
|
||||
--- a/drivers/platform/x86/apple-gmux.c
|
||||
+++ b/drivers/platform/x86/apple-gmux.c
|
||||
@@ -22,6 +22,7 @@
|
||||
@@ -40,7 +40,7 @@ index a0ccdf2aa9cf..e2a6ada34078 100644
|
||||
};
|
||||
|
||||
static struct apple_gmux_data *apple_gmux_data;
|
||||
@@ -674,6 +679,87 @@ static void gmux_notify_handler(acpi_handle device, u32 value, void *context)
|
||||
@@ -672,6 +677,81 @@ static void gmux_notify_handler(acpi_handle device, u32 value, void *context)
|
||||
complete(&gmux_data->powerchange_done);
|
||||
}
|
||||
|
||||
@@ -106,17 +106,11 @@ index a0ccdf2aa9cf..e2a6ada34078 100644
|
||||
+
|
||||
+static void gmux_init_debugfs(struct apple_gmux_data *gmux_data)
|
||||
+{
|
||||
+ struct dentry *debug_dentry;
|
||||
+ gmux_data->debug_dentry = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
+
|
||||
+ debug_dentry = debugfs_create_dir(KBUILD_MODNAME, NULL);
|
||||
+
|
||||
+ if (IS_ERR(debug_dentry))
|
||||
+ return;
|
||||
+
|
||||
+ gmux_data->debug_dentry = debug_dentry;
|
||||
+
|
||||
+ debugfs_create_u8("selected_port", 0644, debug_dentry, &gmux_data->selected_port);
|
||||
+ debugfs_create_file("selected_port_data", 0644, debug_dentry,
|
||||
+ debugfs_create_u8("selected_port", 0644, gmux_data->debug_dentry,
|
||||
+ &gmux_data->selected_port);
|
||||
+ debugfs_create_file("selected_port_data", 0644, gmux_data->debug_dentry,
|
||||
+ gmux_data, &gmux_port_data_ops);
|
||||
+}
|
||||
+
|
||||
@@ -128,7 +122,7 @@ index a0ccdf2aa9cf..e2a6ada34078 100644
|
||||
static int gmux_suspend(struct device *dev)
|
||||
{
|
||||
struct pnp_dev *pnp = to_pnp_dev(dev);
|
||||
@@ -874,6 +960,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -872,6 +952,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
goto err_register_handler;
|
||||
}
|
||||
|
||||
@@ -136,7 +130,7 @@ index a0ccdf2aa9cf..e2a6ada34078 100644
|
||||
return 0;
|
||||
|
||||
err_register_handler:
|
||||
@@ -905,6 +992,7 @@ static void gmux_remove(struct pnp_dev *pnp)
|
||||
@@ -903,6 +984,7 @@ static void gmux_remove(struct pnp_dev *pnp)
|
||||
{
|
||||
struct apple_gmux_data *gmux_data = pnp_get_drvdata(pnp);
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
From 12c7a3306a631a651464ef56318a218dc4cdb157 Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Sat, 18 Feb 2023 23:05:05 +1100
|
||||
Subject: [PATCH 8/9] i915: 4 lane quirk for mbp15,1
|
||||
|
||||
Needed to use iGPU when dGPU was boot GPU
|
||||
|
||||
Patch written by Kerem Karabay <kekrby@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/i915/display/intel_ddi.c | 3 +++
|
||||
drivers/gpu/drm/i915/display/intel_quirks.c | 15 +++++++++++++++
|
||||
drivers/gpu/drm/i915/display/intel_quirks.h | 1 +
|
||||
3 files changed, 19 insertions(+)
|
||||
|
||||
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
|
||||
index 0f1ec2a98cc8..1ec67390f623 100644
|
||||
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
|
||||
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
|
||||
@@ -4097,6 +4097,9 @@ static bool intel_ddi_a_force_4_lanes(struct intel_digital_port *dig_port)
|
||||
if (dig_port->saved_port_bits & DDI_A_4_LANES)
|
||||
return false;
|
||||
|
||||
+ if (intel_has_quirk(dev_priv, QUIRK_DDI_A_FORCE_4_LANES))
|
||||
+ return true;
|
||||
+
|
||||
/* Broxton/Geminilake: Bspec says that DDI_A_4_LANES is the only
|
||||
* supported configuration
|
||||
*/
|
||||
diff --git a/drivers/gpu/drm/i915/display/intel_quirks.c b/drivers/gpu/drm/i915/display/intel_quirks.c
|
||||
index 6e48d3bcdfec..a8c55e165b46 100644
|
||||
--- a/drivers/gpu/drm/i915/display/intel_quirks.c
|
||||
+++ b/drivers/gpu/drm/i915/display/intel_quirks.c
|
||||
@@ -59,6 +59,18 @@ static void quirk_increase_ddi_disabled_time(struct drm_i915_private *i915)
|
||||
drm_info(&i915->drm, "Applying Increase DDI Disabled quirk\n");
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * In some cases, the firmware might not set the lane count to 4 (for example,
|
||||
+ * when booting in some dual GPU Macs with the dGPU as the default GPU), this
|
||||
+ * quirk is used to force it as otherwise it might not be possible to compute a
|
||||
+ * valid link configuration.
|
||||
+ */
|
||||
+static void quirk_ddi_a_force_4_lanes(struct drm_i915_private *i915)
|
||||
+{
|
||||
+ intel_set_quirk(i915, QUIRK_DDI_A_FORCE_4_LANES);
|
||||
+ drm_info(&i915->drm, "Applying DDI A Forced 4 Lanes quirk\n");
|
||||
+}
|
||||
+
|
||||
static void quirk_no_pps_backlight_power_hook(struct drm_i915_private *i915)
|
||||
{
|
||||
intel_set_quirk(i915, QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK);
|
||||
@@ -199,6 +211,9 @@ static struct intel_quirk intel_quirks[] = {
|
||||
/* ECS Liva Q2 */
|
||||
{ 0x3185, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time },
|
||||
{ 0x3184, 0x1019, 0xa94d, quirk_increase_ddi_disabled_time },
|
||||
+
|
||||
+ /* Apple MacBookPro15,1 */
|
||||
+ { 0x3e9b, 0x106b, 0x0176, quirk_ddi_a_force_4_lanes },
|
||||
};
|
||||
|
||||
void intel_init_quirks(struct drm_i915_private *i915)
|
||||
diff --git a/drivers/gpu/drm/i915/display/intel_quirks.h b/drivers/gpu/drm/i915/display/intel_quirks.h
|
||||
index 10a4d163149f..78aacf1f6f5c 100644
|
||||
--- a/drivers/gpu/drm/i915/display/intel_quirks.h
|
||||
+++ b/drivers/gpu/drm/i915/display/intel_quirks.h
|
||||
@@ -17,6 +17,7 @@ enum intel_quirk_id {
|
||||
QUIRK_INVERT_BRIGHTNESS,
|
||||
QUIRK_LVDS_SSC_DISABLE,
|
||||
QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK,
|
||||
+ QUIRK_DDI_A_FORCE_4_LANES,
|
||||
};
|
||||
|
||||
void intel_init_quirks(struct drm_i915_private *i915);
|
||||
--
|
||||
2.39.1
|
||||
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
From 62deb0c5d040fd193889b11a88b295a78ccda650 Mon Sep 17 00:00:00 2001
|
||||
From c91bbcc2aa30f0e41d758726e68107921dd68bed Mon Sep 17 00:00:00 2001
|
||||
From: Orlando Chamberlain <orlandoch.dev@gmail.com>
|
||||
Date: Fri, 10 Feb 2023 22:45:00 +1100
|
||||
Subject: [PATCH 6/8] apple-gmux: allow switching to igpu at probe
|
||||
Subject: [PATCH 9/9] apple-gmux: allow switching to igpu at probe
|
||||
|
||||
This means user don't need to set the gpu-power-prefs efivar to use the
|
||||
igpu while runtime switching isn't working, so macOS will be unaffected.
|
||||
@@ -62,7 +62,7 @@ index f80b6ec88dc3..952652944fbd 100644
|
||||
/**
|
||||
* vga_remove_vgacon - deactivete vga console
|
||||
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
|
||||
index e2a6ada34078..e2dd7ab8bceb 100644
|
||||
index 4cbdc9f9bd10..008d215dd2d5 100644
|
||||
--- a/drivers/platform/x86/apple-gmux.c
|
||||
+++ b/drivers/platform/x86/apple-gmux.c
|
||||
@@ -22,6 +22,7 @@
|
||||
@@ -84,7 +84,7 @@ index e2a6ada34078..e2dd7ab8bceb 100644
|
||||
static u8 gmux_pio_read8(struct apple_gmux_data *gmux_data, int port)
|
||||
{
|
||||
return inb(gmux_data->iostart + port);
|
||||
@@ -946,6 +951,20 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
@@ -938,6 +943,20 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
|
||||
gmux_enable_interrupts(gmux_data);
|
||||
gmux_read_switch_state(gmux_data);
|
||||
|
||||
Reference in New Issue
Block a user