From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Dmitry Torokhov <dtor_core@ameritech.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RESEND] Add Dell laptop backlight brightness display
Date: Tue, 7 Feb 2006 12:32:04 +0000 [thread overview]
Message-ID: <20060207123204.GA1423@srcf.ucam.org> (raw)
In-Reply-To: <200602062237.55653.dtor_core@ameritech.net>
[-- Attachment #1: Type: text/plain, Size: 192 bytes --]
On Mon, Feb 06, 2006 at 10:37:55PM -0500, Dmitry Torokhov wrote:
> This is not gonna work - dellbl_* vs hpbl_*
Good point. Third time's the charm?
--
Matthew Garrett | mjg59@srcf.ucam.org
[-- Attachment #2: dell.diff --]
[-- Type: text/plain, Size: 3598 bytes --]
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index e4f84eb..0f83183 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -56,4 +56,12 @@ config BACKLIGHT_HP
default n
help
Allows userspace applications to read the current screen brightness
- on HP laptops
\ No newline at end of file
+ on HP laptops
+
+config BACKLIGHT_DELL
+ tristate "Dell Laptop Backlight Driver"
+ depends on BACKLIGHT_DEVICE && X86
+ default n
+ help
+ Allows userspace applications to read the current screen brightness
+ on Dell laptops
\ No newline at end of file
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 93ac108..f337f01 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -4,4 +4,5 @@ obj-$(CONFIG_LCD_CLASS_DEVICE) += lc
obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o
obj-$(CONFIG_SHARP_LOCOMO) += locomolcd.o
-obj-$(CONFIG_BACKLIGHT_HP) += hp_bl.o
\ No newline at end of file
+obj-$(CONFIG_BACKLIGHT_HP) += hp_bl.o
+obj-$(CONFIG_BACKLIGHT_DELL) += dell_bl.o
\ No newline at end of file
diff --git a/drivers/video/backlight/dell_bl.c b/drivers/video/backlight/dell_bl.c
new file mode 100644
index 0000000..a97a4b8
--- /dev/null
+++ b/drivers/video/backlight/dell_bl.c
@@ -0,0 +1,92 @@
+/*
+ * Backlight Driver for Dell laptops
+ *
+ * Copyright (c) 2006 Matthew Garrett
+ *
+ * Based on corgi_bl.c, Copyright (c) 2004-2005 Richard Purdie
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+#include <linux/dmi.h>
+#include <linux/nvram.h>
+
+static struct backlight_properties dellbl_data;
+
+static struct dmi_system_id __initdata delllcd_device_table[] = {
+ {
+ .ident = "Dell",
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Dell Inc."),
+ DMI_MATCH(DMI_CHASSIS_TYPE, "Portable"),
+ },
+ },
+ { }
+};
+
+
+static int dellbl_get_intensity(struct backlight_device *bd)
+{
+ /* The backlight interface doesn't give us a means of providing
+ more than one brightness value, so we put the AC value in the
+ top bits of the brightness and the DC value in the bottom bits */
+
+ int value;
+ int combined;
+
+ value = nvram_read_byte(0x53);
+
+ value &= 0xf0; // Brightness is in the upper 4 bits
+ combined = value << 12;
+
+ value = nvram_read_byte(0x16);
+
+ outb(0x99, 0x72);
+ value = inb(0x73);
+
+ value &= 0x0f; // Brightness is in the lower 4 bits
+ combined |= value;
+
+ return combined;
+}
+
+static struct backlight_properties dellbl_data = {
+ .owner = THIS_MODULE,
+ .get_brightness = dellbl_get_intensity,
+ .max_brightness = 0xe,
+};
+
+static struct backlight_device *dell_backlight_device;
+
+static int __init dellbl_init(void)
+{
+ if (!dmi_check_system(delllcd_device_table))
+ return -ENODEV;
+
+ dell_backlight_device = backlight_device_register ("dell-bl",
+ NULL, &dellbl_data);
+ if (IS_ERR (dell_backlight_device))
+ return PTR_ERR (dell_backlight_device);
+
+ return 0;
+}
+
+static void __exit dellbl_exit(void)
+{
+ backlight_device_unregister(dell_backlight_device);
+}
+
+module_init(dellbl_init);
+module_exit(dellbl_exit);
+
+MODULE_AUTHOR("Matthew Garrett <mjg59@srcf.ucam.org>");
+MODULE_DESCRIPTION("Dell Backlight Driver");
+MODULE_LICENSE("GPL");
next prev parent reply other threads:[~2006-02-07 12:32 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-06 19:15 [PATCH] Make DMI code store chassis type Matthew Garrett
2006-02-06 19:18 ` [PATCH] Add HP laptop backlight brightness display Matthew Garrett
2006-02-06 19:19 ` [PATCH] Add Dell " Matthew Garrett
2006-02-07 0:37 ` [PATCH] [RESEND] " Matthew Garrett
2006-02-07 3:37 ` Dmitry Torokhov
2006-02-07 12:32 ` Matthew Garrett [this message]
2006-02-07 13:06 ` Richard Purdie
2006-02-07 13:23 ` Matthew Garrett
2006-02-07 13:37 ` Richard Purdie
2006-02-07 13:55 ` Matthew Garrett
2006-02-07 14:54 ` Richard Purdie
2006-02-08 9:06 ` Pavel Machek
2006-02-06 20:04 ` [PATCH] Add HP " Jan-Benedict Glaw
-- strict thread matches above, loose matches on Subject: below --
2006-02-07 3:43 [PATCH] [RESEND] Add Dell " Michael E Brown
2006-02-07 4:09 ` Matthew Garrett
2006-02-07 16:34 Michael_E_Brown
2006-02-07 17:20 ` Matthew Garrett
2006-02-12 17:26 ` Pavel Machek
2006-02-07 17:23 Michael_E_Brown
2006-02-20 16:45 Michael_E_Brown
2006-02-20 16:53 ` Pavel Machek
2006-02-23 5:17 ` Michael E Brown
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=20060207123204.GA1423@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.