Skip to content

Commit b0935f1

Browse files
committed
ACPI: video: Fix apple gmux detection
Some apple laptop models have an ACPI device with a HID of APP000B and that device has an IO resource (so it does not describe the new unsupported MMIO based gmux type), but there actually is no gmux in the laptop at all. The gmux_probe() function of the actual apple-gmux driver has code to detect this, this code has been factored out into a new apple_gmux_detect() helper in apple-gmux.h. Use this new function to fix acpi_video_get_backlight_type() wrongly returning apple_gmux as type on the following laptops: MacBookPro5,4 https://pastebin.com/8Xjq7RhS MacBookPro8,1 https://linux-hardware.org/?probe=e513cfbadb&log=dmesg MacBookPro9,2 https://bugzilla.kernel.org/attachment.cgi?id=278961 MacBookPro10,2 https://lkml.org/lkml/2014/9/22/657 MacBookPro11,2 https://forums.fedora-fr.org/viewtopic.php?id=70142 MacBookPro11,4 https://raw.githubusercontent.com/im-0/investigate-card-reader-suspend-problem-on-mbp11.4/mast Fixes: 21245df ("ACPI: video: Add Apple GMUX brightness control detection") Link: https://lore.kernel.org/platform-driver-x86/[email protected]/ Reported-by: Emmanouil Kouroupakis <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d143908 commit b0935f1

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

drivers/acpi/video_detect.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,26 +110,6 @@ static bool nvidia_wmi_ec_supported(void)
110110
}
111111
#endif
112112

113-
static bool apple_gmux_backlight_present(void)
114-
{
115-
struct acpi_device *adev;
116-
struct device *dev;
117-
118-
adev = acpi_dev_get_first_match_dev(GMUX_ACPI_HID, NULL, -1);
119-
if (!adev)
120-
return false;
121-
122-
dev = acpi_get_first_physical_node(adev);
123-
if (!dev)
124-
return false;
125-
126-
/*
127-
* drivers/platform/x86/apple-gmux.c only supports old style
128-
* Apple GMUX with an IO-resource.
129-
*/
130-
return pnp_get_resource(to_pnp_dev(dev), IORESOURCE_IO, 0) != NULL;
131-
}
132-
133113
/* Force to use vendor driver when the ACPI device is known to be
134114
* buggy */
135115
static int video_detect_force_vendor(const struct dmi_system_id *d)
@@ -766,6 +746,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
766746
{
767747
static DEFINE_MUTEX(init_mutex);
768748
static bool nvidia_wmi_ec_present;
749+
static bool apple_gmux_present;
769750
static bool native_available;
770751
static bool init_done;
771752
static long video_caps;
@@ -779,6 +760,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
779760
ACPI_UINT32_MAX, find_video, NULL,
780761
&video_caps, NULL);
781762
nvidia_wmi_ec_present = nvidia_wmi_ec_supported();
763+
apple_gmux_present = apple_gmux_detect(NULL, NULL);
782764
init_done = true;
783765
}
784766
if (native)
@@ -800,7 +782,7 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
800782
if (nvidia_wmi_ec_present)
801783
return acpi_backlight_nvidia_wmi_ec;
802784

803-
if (apple_gmux_backlight_present())
785+
if (apple_gmux_present)
804786
return acpi_backlight_apple_gmux;
805787

806788
/* Use ACPI video if available, except when native should be preferred. */

0 commit comments

Comments
 (0)