summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/Kconfig1
-rw-r--r--drivers/platform/x86/apple-gmux.c11
-rw-r--r--drivers/video/backlight/Kconfig1
-rw-r--r--drivers/video/backlight/apple_bl.c31
4 files changed, 11 insertions, 33 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index ec7c2b4e1721..1b3189d6e8d2 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -213,7 +213,6 @@ config APPLE_GMUX
depends on ACPI && PCI
depends on PNP
depends on BACKLIGHT_CLASS_DEVICE
- depends on BACKLIGHT_APPLE=n || BACKLIGHT_APPLE
help
This driver provides support for the gmux device found on many
Apple laptops, which controls the display mux for the hybrid
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[] = {
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 4c33e971c0f0..51387b1ef012 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -285,6 +285,7 @@ config BACKLIGHT_MT6370
config BACKLIGHT_APPLE
tristate "Apple Backlight Driver"
depends on X86 && ACPI
+ depends on ACPI_VIDEO=n || ACPI_VIDEO
help
If you have an Intel-based Apple say Y to enable a driver for its
backlight.
diff --git a/drivers/video/backlight/apple_bl.c b/drivers/video/backlight/apple_bl.c
index e9e7acb577bf..aaa824437a2a 100644
--- a/drivers/video/backlight/apple_bl.c
+++ b/drivers/video/backlight/apple_bl.c
@@ -24,7 +24,7 @@
#include <linux/pci.h>
#include <linux/acpi.h>
#include <linux/atomic.h>
-#include <linux/apple_bl.h>
+#include <acpi/video.h>
static struct backlight_device *apple_backlight_device;
@@ -215,32 +215,21 @@ static struct acpi_driver apple_bl_driver = {
},
};
-static atomic_t apple_bl_registered = ATOMIC_INIT(0);
-
-int apple_bl_register(void)
-{
- if (atomic_xchg(&apple_bl_registered, 1) == 0)
- return acpi_bus_register_driver(&apple_bl_driver);
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(apple_bl_register);
-
-void apple_bl_unregister(void)
-{
- if (atomic_xchg(&apple_bl_registered, 0) == 1)
- acpi_bus_unregister_driver(&apple_bl_driver);
-}
-EXPORT_SYMBOL_GPL(apple_bl_unregister);
-
static int __init apple_bl_init(void)
{
- return apple_bl_register();
+ /*
+ * Use ACPI video detection code to see if this driver should register
+ * or if another driver, e.g. the apple-gmux driver should be used.
+ */
+ if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
+ return -ENODEV;
+
+ return acpi_bus_register_driver(&apple_bl_driver);
}
static void __exit apple_bl_exit(void)
{
- apple_bl_unregister();
+ acpi_bus_unregister_driver(&apple_bl_driver);
}
module_init(apple_bl_init);