All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
To: rpurdie@rpsys.net
Cc: FlorianSchandinat@gmx.de, akpm@linux-foundation.org,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Added backlight driver for Acer Aspire 4736
Date: Mon, 12 Mar 2012 23:12:17 -0400	[thread overview]
Message-ID: <1331608337.2267.67.camel@debian.Gayathri> (raw)

Hi ,

  Brightness control was not  working on Acer Aspire 4736 using default ACPI interface.  acer-acpi also do not support 4730 series since it uses new WMI interface.
This driver adds brightness control by accessing the LBB PCI configuration register. This approach may also work on other laptops in 4730 series .But currently ,  it is only tested  for 
Aspire 4736. 

>From 03dbda16c90278aa1c088e5208bd99ac3c76f911 Mon Sep 17 00:00:00 2001
From: Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
Date: Mon, 12 Mar 2012 23:08:20 -0400
Subject: [PATCH] Added backlight driver for Acer Aspire 4736

Added backlight driver for Acer Aspire 4736

Signed-off-by: Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
---
 drivers/video/backlight/acer4736_bl.c |  110 +++++++++++++++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/backlight/acer4736_bl.c

diff --git a/drivers/video/backlight/acer4736_bl.c b/drivers/video/backlight/acer4736_bl.c
new file mode 100644
index 0000000..6fe2937
--- /dev/null
+++ b/drivers/video/backlight/acer4736_bl.c
@@ -0,0 +1,110 @@
+/*
+ * Backlight driver for Acer Aspire 4736
+ *
+ * Copyright (C) Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
+ *
+ * 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.
+ *
+ * This driver uses LBB PCI configuration register to change the
+ * backlight brightness.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/backlight.h>
+#include <linux/err.h>
+#include <linux/dmi.h>
+#include <linux/io.h>
+#include <linux/pci.h>
+
+static u8 max_brightness = 0xFF;
+static u8 lbb_offset =  0xF4;
+static unsigned int device_id = 0x2a42;
+static unsigned int vendor_id = 0x8086;
+
+struct backlight_device *acer_backlight_device;
+struct pci_dev *pdev;
+
+static int acer_dmi_match(const struct dmi_system_id *id)
+{
+	printk(KERN_INFO "acer4736_bl: %s detected\n", id->ident);
+	return 1;
+}
+
+static const struct dmi_system_id __initdata acer_device_table[] = {
+{
+		.callback	= acer_dmi_match,
+		.ident		= "Aspire 4736",
+		.matches	= {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 4736"),
+		},
+	},
+	{}
+};
+static int read_brightness(struct backlight_device *bd)
+{
+	u8 result;
+	pci_read_config_byte(pdev, lbb_offset, &result);
+	return result;
+}
+
+static int update_brightness(struct backlight_device *bd)
+{
+	u8 intensity = bd->props.brightness;
+	if (intensity > max_brightness) {
+		printk(KERN_INFO "Acer4736_bl: Invalid parameter. Maximum value is %d"
+		, max_brightness);
+		return -1;
+	}
+	pci_write_config_byte(pdev, lbb_offset, intensity);
+	return 0;
+}
+static const struct  backlight_ops acer_backlight_ops = {
+	.get_brightness = read_brightness,
+	.update_status  = update_brightness,
+};
+
+static int __init acer4736_bl_init(void)
+{
+	struct backlight_properties props;
+	if (!dmi_check_system(acer_device_table))
+		return -ENODEV;
+
+	pdev = pci_get_device(vendor_id, device_id, NULL);
+
+	if (!pdev)
+		return -ENODEV;
+
+	printk(KERN_INFO "Loading Acer 4736 backlight driver\n");
+	memset(&props, 0, sizeof(struct backlight_properties));
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = max_brightness;
+
+	acer_backlight_device = backlight_device_register("acer_backlight",
+		NULL, NULL, &acer_backlight_ops, &props);
+	acer_backlight_device->props.max_brightness = max_brightness;
+	acer_backlight_device->props.brightness  =
+		read_brightness(acer_backlight_device);
+	backlight_update_status(acer_backlight_device);
+
+	return 0;
+}
+
+static void __exit acer4736_bl_exit(void)
+{
+	pci_dev_put(pdev);
+	backlight_device_unregister(acer_backlight_device);
+}
+
+module_init(acer4736_bl_init);
+module_exit(acer4736_bl_exit);
+
+MODULE_AUTHOR("Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>");
+MODULE_DESCRIPTION("Acer Aspire 4736 Backlight Driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(dmi, acer_device_table);
-- 
1.7.2.5



------

Thanks , 

Pradeep Subrahmanion



WARNING: multiple messages have this Message-ID (diff)
From: Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
To: rpurdie@rpsys.net
Cc: FlorianSchandinat@gmx.de, akpm@linux-foundation.org,
	linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] Added backlight driver for Acer Aspire 4736
Date: Mon, 12 Mar 2012 17:36:26 +0000	[thread overview]
Message-ID: <1331608337.2267.67.camel@debian.Gayathri> (raw)
In-Reply-To: <4F5D000E.8040104@gmx.de>

Hi ,

  Brightness control was not  working on Acer Aspire 4736 using default ACPI interface.  acer-acpi also do not support 4730 series since it uses new WMI interface.
This driver adds brightness control by accessing the LBB PCI configuration register. This approach may also work on other laptops in 4730 series .But currently ,  it is only tested  for 
Aspire 4736. 

From 03dbda16c90278aa1c088e5208bd99ac3c76f911 Mon Sep 17 00:00:00 2001
From: Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
Date: Mon, 12 Mar 2012 23:08:20 -0400
Subject: [PATCH] Added backlight driver for Acer Aspire 4736

Added backlight driver for Acer Aspire 4736

Signed-off-by: Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
---
 drivers/video/backlight/acer4736_bl.c |  110 +++++++++++++++++++++++++++++++++
 1 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/backlight/acer4736_bl.c

diff --git a/drivers/video/backlight/acer4736_bl.c b/drivers/video/backlight/acer4736_bl.c
new file mode 100644
index 0000000..6fe2937
--- /dev/null
+++ b/drivers/video/backlight/acer4736_bl.c
@@ -0,0 +1,110 @@
+/*
+ * Backlight driver for Acer Aspire 4736
+ *
+ * Copyright (C) Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>
+ *
+ * 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.
+ *
+ * This driver uses LBB PCI configuration register to change the
+ * backlight brightness.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/backlight.h>
+#include <linux/err.h>
+#include <linux/dmi.h>
+#include <linux/io.h>
+#include <linux/pci.h>
+
+static u8 max_brightness = 0xFF;
+static u8 lbb_offset =  0xF4;
+static unsigned int device_id = 0x2a42;
+static unsigned int vendor_id = 0x8086;
+
+struct backlight_device *acer_backlight_device;
+struct pci_dev *pdev;
+
+static int acer_dmi_match(const struct dmi_system_id *id)
+{
+	printk(KERN_INFO "acer4736_bl: %s detected\n", id->ident);
+	return 1;
+}
+
+static const struct dmi_system_id __initdata acer_device_table[] = {
+{
+		.callback	= acer_dmi_match,
+		.ident		= "Aspire 4736",
+		.matches	= {
+			DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 4736"),
+		},
+	},
+	{}
+};
+static int read_brightness(struct backlight_device *bd)
+{
+	u8 result;
+	pci_read_config_byte(pdev, lbb_offset, &result);
+	return result;
+}
+
+static int update_brightness(struct backlight_device *bd)
+{
+	u8 intensity = bd->props.brightness;
+	if (intensity > max_brightness) {
+		printk(KERN_INFO "Acer4736_bl: Invalid parameter. Maximum value is %d"
+		, max_brightness);
+		return -1;
+	}
+	pci_write_config_byte(pdev, lbb_offset, intensity);
+	return 0;
+}
+static const struct  backlight_ops acer_backlight_ops = {
+	.get_brightness = read_brightness,
+	.update_status  = update_brightness,
+};
+
+static int __init acer4736_bl_init(void)
+{
+	struct backlight_properties props;
+	if (!dmi_check_system(acer_device_table))
+		return -ENODEV;
+
+	pdev = pci_get_device(vendor_id, device_id, NULL);
+
+	if (!pdev)
+		return -ENODEV;
+
+	printk(KERN_INFO "Loading Acer 4736 backlight driver\n");
+	memset(&props, 0, sizeof(struct backlight_properties));
+	props.type = BACKLIGHT_RAW;
+	props.max_brightness = max_brightness;
+
+	acer_backlight_device = backlight_device_register("acer_backlight",
+		NULL, NULL, &acer_backlight_ops, &props);
+	acer_backlight_device->props.max_brightness = max_brightness;
+	acer_backlight_device->props.brightness  +		read_brightness(acer_backlight_device);
+	backlight_update_status(acer_backlight_device);
+
+	return 0;
+}
+
+static void __exit acer4736_bl_exit(void)
+{
+	pci_dev_put(pdev);
+	backlight_device_unregister(acer_backlight_device);
+}
+
+module_init(acer4736_bl_init);
+module_exit(acer4736_bl_exit);
+
+MODULE_AUTHOR("Pradeep Subrahmanion <subrahmanion.pradeep@gmail.com>");
+MODULE_DESCRIPTION("Acer Aspire 4736 Backlight Driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(dmi, acer_device_table);
-- 
1.7.2.5



------

Thanks , 

Pradeep Subrahmanion



         reply	other threads:[~2012-03-12 17:35 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CABNxG=CU+bOWUauLYfcS2vtFqKvXA-9axgokNoYz+KuU1Mzztw@mail.gmail.com>
2012-03-11 19:42 ` [PATCH] Added backlight driver for Acer Aspire 4736 Florian Tobias Schandinat
2012-03-11 19:42   ` Florian Tobias Schandinat
2012-03-12 17:36   ` Pradeep Subrahmanion [this message]
2012-03-13  3:12     ` Pradeep Subrahmanion
2012-03-12 17:51     ` Matthew Garrett
2012-03-13 12:09       ` Pradeep Subrahmanion
2012-03-13 12:47         ` Matthew Garrett
2012-03-13 13:29           ` Pradeep Subrahmanion
2012-03-13 13:41             ` Pradeep Subrahmanion
     [not found]           ` <CABNxG=Dqg26EHmC3vibf3-SjVhby1qgQfMniQObUeh9eJ6SwEw@mail.gmail.com>
2012-03-13 13:34             ` Matthew Garrett
2012-03-13 15:49               ` Pradeep Subrahmanion
2012-03-14  1:24                 ` Pradeep Subrahmanion
2012-03-13 23:12                 ` joeyli
2012-03-13 23:12                   ` joeyli
2012-03-14  2:43                   ` Pradeep Subrahmanion
2012-03-14  2:55                     ` Pradeep Subrahmanion
2012-03-14  5:51                     ` joeyli
2012-03-14  5:51                       ` joeyli
2012-03-14  6:17                       ` Pradeep Subrahmanion
2012-03-14  6:29                         ` Pradeep Subrahmanion
2012-03-15  8:05                         ` joeyli
2012-03-15  8:05                           ` joeyli
2012-03-18  5:10                           ` Pradeep Subrahmanion
2012-03-18  5:22                             ` Pradeep Subrahmanion
2012-03-19  2:01                             ` joeyli
2012-03-19  2:01                               ` joeyli
2012-03-19 11:33                               ` Pradeep Subrahmanion
2012-03-19 11:45                                 ` Pradeep Subrahmanion
2012-03-20  3:55                                 ` joeyli
2012-03-20  3:55                                   ` joeyli
2012-03-20 11:09                               ` joeyli
2012-03-20 11:09                                 ` joeyli
2012-03-20 18:55                                 ` Pradeep Subrahmanion
2012-03-20 18:55                                   ` Pradeep Subrahmanion
2012-03-21  3:00                                   ` joeyli
2012-03-21  3:00                                     ` joeyli
2012-03-21 19:09                                     ` Pradeep Subrahmanion
2012-03-21 19:21                                       ` Pradeep Subrahmanion
2012-03-22  1:33                                       ` joeyli
2012-03-22  1:33                                         ` joeyli
2012-03-22  2:33                                         ` Pradeep Subrahmanion
2012-03-22  2:45                                           ` Pradeep Subrahmanion
2012-03-22  3:25                                           ` joeyli
2012-03-22  3:25                                             ` joeyli
2012-03-22  3:32                                             ` Pradeep Subrahmanion
2012-03-22  3:44                                               ` Pradeep Subrahmanion
2012-03-22  3:54                                               ` joeyli
2012-03-22  3:54                                                 ` joeyli
2012-03-22  5:56                                                 ` Pradeep Subrahmanion
2012-03-22  5:57                                                   ` Pradeep Subrahmanion
2012-03-22  9:34                                                   ` joeyli
2012-03-22  9:34                                                     ` joeyli
2012-03-22 16:17                                                     ` Pradeep Subrahmanion
2012-03-22 16:29                                                       ` Pradeep Subrahmanion
2012-03-23  3:36                                     ` Pradeep Subrahmanion
2012-03-23  3:48                                       ` Pradeep Subrahmanion
2012-03-23  4:25                                       ` joeyli
2012-03-23  4:25                                         ` joeyli
2012-03-18  5:12                           ` Pradeep Subrahmanion
2012-03-18  5:24                             ` Pradeep Subrahmanion
2012-03-12 23:07     ` Joe Perches
2012-03-12 23:07       ` Joe Perches
2012-03-12 17:40   ` Pradeep Subrahmanion
2012-03-13  3:16     ` Pradeep Subrahmanion
2012-03-13  3:10   ` joeyli
2012-03-13  3:10     ` joeyli
2012-03-13 13:12     ` Pradeep Subrahmanion
2012-03-13  4:35       ` joeyli
2012-03-13  4:35         ` joeyli

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=1331608337.2267.67.camel@debian.Gayathri \
    --to=subrahmanion.pradeep@gmail.com \
    --cc=FlorianSchandinat@gmx.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fbdev@vger.kernel.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 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.