From: Matthew Garrett <mjg@redhat.com>
To: rpurdie@rpsys.net
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 2/3] mbp_nvidia_bl: Check that the backlight control functions
Date: Thu, 16 Dec 2010 10:13:49 -0500 [thread overview]
Message-ID: <1292512430-13291-2-git-send-email-mjg@redhat.com> (raw)
In-Reply-To: <1292512430-13291-1-git-send-email-mjg@redhat.com>
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
next prev parent reply other threads:[~2010-12-16 15:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-16 15:13 [PATCH 1/3] mbp_nvidia_bl: Remove DMI dependency Matthew Garrett
2010-12-16 15:13 ` Matthew Garrett [this message]
2010-12-16 15:13 ` [PATCH 3/3] mbp_nvidia_bl: Rename to apple_bl Matthew Garrett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1292512430-13291-2-git-send-email-mjg@redhat.com \
--to=mjg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®