diff options
author | Matthew Garrett <mjg@redhat.com> | 2011-03-22 19:30:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:00 -0400 |
commit | 99fd28e19429f5212f0758adc1b2f08c6e63b6db (patch) | |
tree | 9d9139fa58c28b1f8a40b77df7b839bc70c59a25 /drivers/video/backlight | |
parent | 23a9847f0d5252872c4fecb5d4f803c523bd9283 (diff) |
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.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Acked-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: Mourad De Clerck <mourad@aquazul.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | 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 b22cfb24bd55..dd0e145170b7 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) | |||
143 | { | 143 | { |
144 | struct backlight_properties props; | 144 | struct backlight_properties props; |
145 | struct pci_dev *host; | 145 | struct pci_dev *host; |
146 | int intensity; | ||
146 | 147 | ||
147 | host = pci_get_bus_and_slot(0, 0); | 148 | host = pci_get_bus_and_slot(0, 0); |
148 | 149 | ||
@@ -163,6 +164,18 @@ static int __devinit mb_bl_add(struct acpi_device *dev) | |||
163 | return -ENODEV; | 164 | return -ENODEV; |
164 | } | 165 | } |
165 | 166 | ||
167 | /* Check that the hardware responds - this may not work under EFI */ | ||
168 | |||
169 | intensity = hw_data->backlight_ops.get_brightness(NULL); | ||
170 | |||
171 | if (!intensity) { | ||
172 | hw_data->set_brightness(1); | ||
173 | if (!hw_data->backlight_ops.get_brightness(NULL)) | ||
174 | return -ENODEV; | ||
175 | |||
176 | hw_data->set_brightness(0); | ||
177 | } | ||
178 | |||
166 | if (!request_region(hw_data->iostart, hw_data->iolen, | 179 | if (!request_region(hw_data->iostart, hw_data->iolen, |
167 | "Macbook backlight")) | 180 | "Macbook backlight")) |
168 | return -ENXIO; | 181 | return -ENXIO; |