diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-03-07 15:05:40 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-03-16 15:33:11 +0300 |
commit | 3608a2cd818a8d97bd3d4dc32f6c0afaf09b15ec (patch) | |
tree | 456d6791cc25e151b40b9471bd7be489e6f8fdce /drivers/platform/x86/apple-gmux.c | |
parent | f0f2903de50418899a5e5dcecf2906da44a7a05e (diff) | |
download | linux-3608a2cd818a8d97bd3d4dc32f6c0afaf09b15ec.tar.xz |
backlight: apple_bl: Use acpi_video_get_backlight_type()
On some MacBooks both the apple_bl and the apple-gmux backlight drivers
may be able to export a /sys/class/backlight device.
To avoid having 2 backlight devices for one LCD panel until now
the apple-gmux driver has been calling apple_bl_unregister() to move
the apple_bl backlight device out of the way when it loads.
Similar problems exist on other x86 laptops and all backlight drivers
which may be used on x86 laptops have moved to using
acpi_video_get_backlight_type() to determine whether they should load
or not.
Switch apple_bl to this model too, so that it is consistent with all
the other x86 backlight drivers.
Besides code-simplification and consistency this has 2 other benefits:
1) It removes a race during boot where userspace will briefly see
an apple_bl backlight and then have it disappear again, leading to e.g.:
https://bbs.archlinux.org/viewtopic.php?id=269920
2) This allows user to switch between the drivers by passing
acpi_backlight=apple_gmux or acpi_backlight=vendor on the kernel
commandline.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Acked-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230307120540.389920-1-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86/apple-gmux.c')
-rw-r--r-- | drivers/platform/x86/apple-gmux.c | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c index 8aa81a3517b1..4c311e1dedad 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -16,7 +16,6 @@ #include <linux/backlight.h> #include <linux/acpi.h> #include <linux/pnp.h> -#include <linux/apple_bl.h> #include <linux/apple-gmux.h> #include <linux/slab.h> #include <linux/delay.h> @@ -883,14 +882,6 @@ get_version: gmux_data->bdev = bdev; bdev->props.brightness = gmux_get_brightness(bdev); backlight_update_status(bdev); - - /* - * The backlight situation on Macs is complicated. If the gmux is - * present it's the best choice, because it always works for - * backlight control and supports more levels than other options. - * Disable the other backlight choices. - */ - apple_bl_unregister(); } gmux_data->power_state = VGA_SWITCHEROO_ON; @@ -1007,8 +998,6 @@ static void gmux_remove(struct pnp_dev *pnp) release_region(gmux_data->iostart, gmux_data->iolen); apple_gmux_data = NULL; kfree(gmux_data); - - apple_bl_register(); } static const struct pnp_device_id gmux_device_ids[] = { |