From: Mario Schwalbe <schwalbe@inf.tu-dresden.de>
To: Matthew Garrett <mjg@redhat.com>, Richard Purdie <rpurdie@rpsys.net>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] video: mbp_nvidia_bl: Add a debug switch
Date: Fri, 12 Dec 2008 21:49:04 +0100 [thread overview]
Message-ID: <4942CE40.5080905@inf.tu-dresden.de> (raw)
In-Reply-To: <2e9ff482f36dc7e7694141df51ea977a52474089.1229087880.git.mario@snoopy.(none)>
This patch adds a debug switch to enable (little) diagnostic
output, to help to trace down the remaining problems.
Signed-off-by: Mario Schwalbe <schwalbe@inf.tu-dresden.de>
---
drivers/video/backlight/mbp_nvidia_bl.c | 37 +++++++++++++++++++++++++++++-
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c
index 559daf0..f014399 100644
--- a/drivers/video/backlight/mbp_nvidia_bl.c
+++ b/drivers/video/backlight/mbp_nvidia_bl.c
@@ -33,6 +33,11 @@ struct dmi_match_data {
struct backlight_ops backlight_ops;
};
+/* Module parameters. */
+static int debug;
+module_param_named(debug, debug, int, 0644);
+MODULE_PARM_DESC(debug, "Set to one to enable debugging messages.");
+
/*
* Implementation for MacBooks with Intel chipset.
*/
@@ -40,6 +45,10 @@ static int intel_chipset_send_intensity(struct backlight_device *bd)
{
int intensity = bd->props.brightness;
+ if (debug)
+ printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n",
+ intensity);
+
outb(0x04 | (intensity << 4), 0xb3);
outb(0xbf, 0xb2);
return 0;
@@ -47,9 +56,17 @@ static int intel_chipset_send_intensity(struct backlight_device *bd)
static int intel_chipset_get_intensity(struct backlight_device *bd)
{
+ int intensity;
+
outb(0x03, 0xb3);
outb(0xbf, 0xb2);
- return inb(0xb3) >> 4;
+ intensity = inb(0xb3) >> 4;
+
+ if (debug)
+ printk(KERN_DEBUG "mbp_nvidia_bl: read brightness of %d\n",
+ intensity);
+
+ return intensity;
}
static const struct dmi_match_data intel_chipset_data = {
@@ -72,6 +89,10 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd)
{
int intensity = bd->props.brightness;
+ if (debug)
+ printk(KERN_DEBUG "mbp_nvidia_bl: setting brightness to %d\n",
+ intensity);
+
outb(0x04 | (intensity << 4), 0x52f);
outb(0xbf, 0x52e);
return 0;
@@ -79,9 +100,17 @@ static int nvidia_chipset_send_intensity(struct backlight_device *bd)
static int nvidia_chipset_get_intensity(struct backlight_device *bd)
{
+ int intensity;
+
outb(0x03, 0x52f);
outb(0xbf, 0x52e);
- return inb(0x52f) >> 4;
+ intensity = inb(0x52f) >> 4;
+
+ if (debug)
+ printk(KERN_DEBUG "mbp_nvidia_bl: read brightness of %d\n",
+ intensity);
+
+ return intensity;
}
static const struct dmi_match_data nvidia_chipset_data = {
@@ -211,6 +240,10 @@ static int mbp_resume(struct platform_device *pdev)
*/
struct backlight_device *bd = platform_get_drvdata(pdev);
+ if (debug)
+ printk(KERN_DEBUG "mbp_nvidia_bl: resuming with"
+ " brightness %d\n", bd->props.brightness);
+
backlight_update_status(bd);
return 0;
}
--
1.5.6.3
parent reply other threads:[~2008-12-12 20:50 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <2e9ff482f36dc7e7694141df51ea977a52474089.1229087880.git.mario@snoopy.(none)>]
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=4942CE40.5080905@inf.tu-dresden.de \
--to=schwalbe@inf.tu-dresden.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mjg@redhat.com \
--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