mbp_nvidia_bl: Remove DMI dependency
Subsystems (2)
PATCH 1/3 mbp_nvidia_bl: Remove DMI dependency
This driver only has to deal with two different classes of hardware, but right now it needs new DMI entries for every new machine. It turns out that there's an ACPI device that uniquely identifies Apples with backlights, so this patch reworks the driver into an ACPI one, identifies the hardware by checking the PCI vendor of the root bridge and strips out all the DMI code. It also changes the config text to clarify that it works on devices other than Macbook Pros and GPUs other than nvidia.
--- drivers/video/backlight/Kconfig | 8 +- drivers/video/backlight/Makefile | 2 +- drivers/video/backlight/mbp_nvidia_bl.c | 366 ++++++++----------------------- 3 files changed, 101 insertions(+), 275 deletions(-)
drivers/video/backlight/Kconfig +4 -4
@@ -236,12 +236,12 @@ config BACKLIGHT_MAX8925 If you have a LCD backlight connected to the WLED output of MAX8925 WLED output, say Y here to enable this driver. -config BACKLIGHT_MBP_NVIDIA - tristate "MacBook Pro Nvidia Backlight Driver" +config BACKLIGHT_MACBOOK + tristate "MacBook Backlight Driver" depends on X86 help - If you have an Apple Macbook Pro with Nvidia graphics hardware say Y - to enable a driver for its backlight + If you have an Apple Macbook say Y to enable a driver for its + backlight config BACKLIGHT_TOSA tristate "Sharp SL-6000 Backlight Driver"
drivers/video/backlight/Makefile +1 -1
@@ -26,7 +26,7 @@ obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o -obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o +obj-$(CONFIG_BACKLIGHT_MACBOOK) += mbp_nvidia_bl.o obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
drivers/video/backlight/mbp_nvidia_bl.c +96 -270
469 lines not on this page · raw message
Signature · 1 line
1.7.3.3
PATCH 2/3 mbp_nvidia_bl: Check that the backlight control functions
The SMI-based backlight control functionality may fail to work if the system is running under EFI rather than BIOS. Check that the hardware responds as expected, and exit if it doesn't.
--- drivers/video/backlight/mbp_nvidia_bl.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
drivers/video/backlight/mbp_nvidia_bl.c +13 -0
@@ -143,6 +143,7 @@ static int __devinit mb_bl_add(struct acpi_device *dev) {struct backlight_properties props;struct pci_dev *host; +int intensity; host =pci_get_bus_and_slot (0 ,0 );
@@ -163,6 +164,18 @@ static int __devinit mb_bl_add(struct acpi_device *dev)return -ENODEV ; } +/* Check that the hardware responds - this may not work under EFI */ + + intensity = hw_data->backlight_ops.get_brightness (NULL ); + +if (!intensity) { + hw_data->set_brightness (1 ); +if (!hw_data->backlight_ops.get_brightness (NULL )) +return -ENODEV ; + + hw_data->set_brightness (0 ); + } +if (!request_region (hw_data->iostart, hw_data->iolen,"Macbook backlight" ))return -ENXIO ;
Signature · 1 line
1.7.3.3
PATCH 3/3 mbp_nvidia_bl: Rename to apple_bl
In reply to Matthew GarrettIt works on hardware other than Macbook Pros, and it works on GPUs other than Nvidia. It should even work on iMacs, so change the name to match reality more precisely and include an alias so existing users don't get confused.
--- drivers/video/backlight/Kconfig | 6 +- drivers/video/backlight/Makefile | 2 +- drivers/video/backlight/apple_bl.c | 240 +++++++++++++++++++++++++++++++ drivers/video/backlight/mbp_nvidia_bl.c | 239 ------------------------------ 4 files changed, 244 insertions(+), 243 deletions(-) create mode 100644 drivers/video/backlight/apple_bl.c delete mode 100644 drivers/video/backlight/mbp_nvidia_bl.c
drivers/video/backlight/Kconfig +3 -3
@@ -236,11 +236,11 @@ config BACKLIGHT_MAX8925 If you have a LCD backlight connected to the WLED output of MAX8925 WLED output, say Y here to enable this driver. -config BACKLIGHT_MACBOOK - tristate "MacBook Backlight Driver" +config BACKLIGHT_APPLE + tristate "Apple Backlight Driver" depends on X86 help - If you have an Apple Macbook say Y to enable a driver for its + If you have an Intel-based Apple say Y to enable a driver for its backlight config BACKLIGHT_TOSA
drivers/video/backlight/Makefile +1 -1
@@ -26,7 +26,7 @@ obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o -obj-$(CONFIG_BACKLIGHT_MACBOOK) += mbp_nvidia_bl.o +obj-$(CONFIG_BACKLIGHT_APPLE) += apple_bl.o obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
drivers/video/backlight/apple_bl.c new file +240 -0
240 lines not on this page · raw message
drivers/video/backlight/mbp_nvidia_bl.c deleted +0 -239
239 lines not on this page · raw message
Signature · 1 line
1.7.3.3