mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Acked-by: Richard Purdie <[email protected]> Cc: Mourad De Clerck <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
23a9847f0d
commit
99fd28e194
1 changed files with 13 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue