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
Add upstreamed gmux patch
Workaround until the Apple-gmux patches are put here
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
From 6833726fd944d98c4722e166119ab87aced01deb Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 14 Dec 2022 22:45:47 +0100
|
||||
Subject: [PATCH] ACPI: video: Fix Apple GMUX backlight detection
|
||||
|
||||
The apple-gmux driver only binds to old GMUX devices which have an
|
||||
IORESOURCE_IO resource (using inb()/outb()) rather then memory-mapped
|
||||
IO (IORESOURCE_MEM).
|
||||
|
||||
T2 MacBooks use the new style GMUX devices (with IORESOURCE_MEM access),
|
||||
so these are not supported by the apple-gmux driver. This is not a problem
|
||||
since they have working ACPI video backlight support.
|
||||
|
||||
But the apple_gmux_present() helper only checks if an ACPI device with
|
||||
the "APP000B" HID is present, causing acpi_video_get_backlight_type()
|
||||
to return acpi_backlight_apple_gmux disabling the acpi_video backlight
|
||||
device.
|
||||
|
||||
Add a new apple_gmux_backlight_present() helper which checks that
|
||||
the "APP000B" device actually is an old GMUX device with an IORESOURCE_IO
|
||||
resource.
|
||||
|
||||
This fixes the acpi_video0 backlight no longer registering on T2 MacBooks.
|
||||
|
||||
Fixes: 21245df307cb ("ACPI: video: Add Apple GMUX brightness control detection")
|
||||
Reported-by: Aditya Garg <gargaditya08@live.com>
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/acpi/video_detect.c | 23 ++++++++++++++++++++++-
|
||||
1 file changed, 22 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
|
||||
index a934bbc9dd37..1b78c7434492 100644
|
||||
--- a/drivers/acpi/video_detect.c
|
||||
+++ b/drivers/acpi/video_detect.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/platform_data/x86/nvidia-wmi-ec-backlight.h>
|
||||
+#include <linux/pnp.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <acpi/video.h>
|
||||
@@ -105,6 +106,26 @@ static bool nvidia_wmi_ec_supported(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
+static bool apple_gmux_backlight_present(void)
|
||||
+{
|
||||
+ struct acpi_device *adev;
|
||||
+ struct device *dev;
|
||||
+
|
||||
+ adev = acpi_dev_get_first_match_dev(GMUX_ACPI_HID, NULL, -1);
|
||||
+ if (!adev)
|
||||
+ return false;
|
||||
+
|
||||
+ dev = acpi_get_first_physical_node(adev);
|
||||
+ if (!dev)
|
||||
+ return false;
|
||||
+
|
||||
+ /*
|
||||
+ * drivers/platform/x86/apple-gmux.c only supports old style
|
||||
+ * Apple GMUX with an IO-resource.
|
||||
+ */
|
||||
+ return pnp_get_resource(to_pnp_dev(dev), IORESOURCE_IO, 0) != NULL;
|
||||
+}
|
||||
+
|
||||
/* Force to use vendor driver when the ACPI device is known to be
|
||||
* buggy */
|
||||
static int video_detect_force_vendor(const struct dmi_system_id *d)
|
||||
@@ -767,7 +788,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
|
||||
if (nvidia_wmi_ec_present)
|
||||
return acpi_backlight_nvidia_wmi_ec;
|
||||
|
||||
- if (apple_gmux_present())
|
||||
+ if (apple_gmux_backlight_present())
|
||||
return acpi_backlight_apple_gmux;
|
||||
|
||||
/* Use ACPI video if available, except when native should be preferred. */
|
||||
--
|
||||
2.38.1
|
||||
|
||||
Reference in New Issue
Block a user