lkml.org 
[lkml]   [2010]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] mbp_nvidia_bl: Check that the backlight control functions
Date
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.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---
drivers/video/backlight/mbp_nvidia_bl.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c
index 984699b..11f6c47 100644
--- a/drivers/video/backlight/mbp_nvidia_bl.c
+++ b/drivers/video/backlight/mbp_nvidia_bl.c
@@ -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;
--
1.7.3.3


\
 
 \ /
  Last update: 2010-12-16 16:17    [W:0.030 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site