summaryrefslogtreecommitdiffstats
path: root/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.31-samsung.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.31-samsung.patch')
-rw-r--r--meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.31-samsung.patch206
1 files changed, 0 insertions, 206 deletions
diff --git a/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.31-samsung.patch b/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.31-samsung.patch
deleted file mode 100644
index 88c9788013..0000000000
--- a/meta-moblin/packages/linux/linux-moblin-2.6.31.5/linux-2.6.31-samsung.patch
+++ /dev/null
@@ -1,206 +0,0 @@
1
2
3From: Greg Kroah-Hartman <gregkh@suse.de>
4Subject: Samsung backlight driver
5
6This driver implements backlight controls for Samsung laptops that currently do not have ACPI support for this control.
7
8It has been tested on the N130 laptop and properly works there.
9
10Info for the NC10 was provided by Soeren Sonnenburg <bugreports@nn7.de> Info for the NP-Q45 from Jie Huchet <jeremie@lamah.info>
11
12Many thanks to Dmitry Torokhov <dmitry.torokhov@gmail.com> for cleanups and other suggestions on how to make the driver simpler.
13
14Cc: Soeren Sonnenburg <bugreports@nn7.de>
15Cc: Jie Huchet <jeremie@lamah.info>
16Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
17Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18
19---
20 drivers/platform/x86/Kconfig | 12 ++
21 drivers/platform/x86/Makefile | 1
22 drivers/platform/x86/samsung-backlight.c | 157
23+++++++++++++++++++++++++++++++ 3 files changed, 170 insertions(+)
24diff -purN vanilla-2.6.31-rc6/drivers/platform/x86/Kconfig linux-2.6.31-rc6/drivers/platform/x86/Kconfig
25--- vanilla-2.6.31-rc6/drivers/platform/x86/Kconfig 2009-08-17 20:55:37.000000000 +0000
26+++ linux-2.6.31-rc6/drivers/platform/x86/Kconfig 2009-08-17 20:58:25.000000000 +0000
27@@ -425,4 +425,16 @@ config ACPI_TOSHIBA
28
29 If you have a legacy free Toshiba laptop (such as the Libretto L1
30 series), say Y.
31+
32+config SAMSUNG_BACKLIGHT
33+ tristate "Samsung Backlight driver"
34+ depends on BACKLIGHT_CLASS_DEVICE
35+ depends on DMI
36+ ---help---
37+ This driver adds support to control the backlight on a number of
38+ Samsung laptops, like the N130.
39+
40+ It will only be loaded on laptops that properly need it, so it is
41+ safe to say Y here.
42+
43 endif # X86_PLATFORM_DEVICES
44diff -purN vanilla-2.6.31-rc6/drivers/platform/x86/Makefile linux-2.6.31-rc6/drivers/platform/x86/Makefile
45--- vanilla-2.6.31-rc6/drivers/platform/x86/Makefile 2009-08-17 20:55:37.000000000 +0000
46+++ linux-2.6.31-rc6/drivers/platform/x86/Makefile 2009-08-17 20:58:44.000000000 +0000
47@@ -20,3 +20,4 @@ obj-$(CONFIG_INTEL_MENLOW) += intel_menl
48 obj-$(CONFIG_ACPI_WMI) += wmi.o
49 obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
50 obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
51+obj-$(CONFIG_SAMSUNG_BACKLIGHT) += samsung-backlight.o
52diff -purN vanilla-2.6.31-rc6/drivers/platform/x86/samsung-backlight.c linux-2.6.31-rc6/drivers/platform/x86/samsung-backlight.c
53--- vanilla-2.6.31-rc6/drivers/platform/x86/samsung-backlight.c 1970-01-01 00:00:00.000000000 +0000
54+++ linux-2.6.31-rc6/drivers/platform/x86/samsung-backlight.c 2009-08-17 21:00:10.000000000 +0000
55@@ -0,0 +1,151 @@
56+/*
57+ * Samsung N130 and NC10 Laptop Backlight driver
58+ *
59+ * Copyright (C) 2009 Greg Kroah-Hartman (gregkh@suse.de)
60+ * Copyright (C) 2009 Novell Inc.
61+ *
62+ * This program is free software; you can redistribute it and/or modify it
63+ * under the terms of the GNU General Public License version 2 as published by
64+ * the Free Software Foundation.
65+ */
66+
67+#include <linux/kernel.h>
68+#include <linux/init.h>
69+#include <linux/module.h>
70+#include <linux/pci.h>
71+#include <linux/backlight.h>
72+#include <linux/fb.h>
73+#include <linux/dmi.h>
74+
75+#define MAX_BRIGHT 0xff
76+#define OFFSET 0xf4
77+
78+static int offset = OFFSET;
79+module_param(offset, int, S_IRUGO | S_IWUSR);
80+MODULE_PARM_DESC(offset, "The offset into the PCI device for the brightness control");
81+static struct pci_dev *pci_device;
82+static struct backlight_device *backlight_device;
83+
84+static u8 read_brightness(void)
85+{
86+ u8 brightness;
87+
88+ pci_read_config_byte(pci_device, offset, &brightness);
89+ return brightness;
90+}
91+
92+static void set_brightness(u8 brightness) {
93+ pci_write_config_byte(pci_device, offset, brightness); }
94+
95+static int get_brightness(struct backlight_device *bd) {
96+ return bd->props.brightness;
97+}
98+
99+static int update_status(struct backlight_device *bd) {
100+ set_brightness(bd->props.brightness);
101+ return 0;
102+}
103+
104+static struct backlight_ops backlight_ops = {
105+ .get_brightness = get_brightness,
106+ .update_status = update_status,
107+};
108+
109+static int __init dmi_check_cb(const struct dmi_system_id *id) {
110+ printk(KERN_INFO KBUILD_MODNAME ": found laptop model '%s'\n",
111+ id->ident);
112+ return 0;
113+}
114+
115+static struct dmi_system_id __initdata samsung_dmi_table[] = {
116+ {
117+ .ident = "N120",
118+ .matches = {
119+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
120+ DMI_MATCH(DMI_PRODUCT_NAME, "N120"),
121+ DMI_MATCH(DMI_BOARD_NAME, "N120"),
122+ },
123+ .callback = dmi_check_cb,
124+ },
125+ {
126+ .ident = "N130",
127+ .matches = {
128+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
129+ DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
130+ DMI_MATCH(DMI_BOARD_NAME, "N130"),
131+ },
132+ .callback = dmi_check_cb,
133+ },
134+ {
135+ .ident = "NC10",
136+ .matches = {
137+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
138+ DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
139+ DMI_MATCH(DMI_BOARD_NAME, "NC10"),
140+ },
141+ .callback = dmi_check_cb,
142+ },
143+ {
144+ .ident = "NP-Q45",
145+ .matches = {
146+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
147+ DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"),
148+ DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"),
149+ },
150+ .callback = dmi_check_cb,
151+ },
152+ { },
153+};
154+
155+static int __init samsung_init(void)
156+{
157+ if (!dmi_check_system(samsung_dmi_table))
158+ return -ENODEV;
159+
160+ /*
161+ * The Samsung N120, N130, and NC10 use pci device id 0x27ae, while the
162+ * NP-Q45 uses 0x2a02. Odds are we might need to add more to the
163+ * list over time...
164+ */
165+ pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0x27ae, NULL);
166+ if (!pci_device) {
167+ pci_device = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2a02, NULL);
168+ if (!pci_device)
169+ return -ENODEV;
170+ }
171+
172+ /* create a backlight device to talk to this one */
173+ backlight_device = backlight_device_register("samsung",
174+ &pci_device->dev,
175+ NULL, &backlight_ops);
176+ if (IS_ERR(backlight_device)) {
177+ pci_dev_put(pci_device);
178+ return PTR_ERR(backlight_device);
179+ }
180+
181+ backlight_device->props.max_brightness = MAX_BRIGHT;
182+ backlight_device->props.brightness = read_brightness();
183+ backlight_device->props.power = FB_BLANK_UNBLANK;
184+ backlight_update_status(backlight_device);
185+
186+ return 0;
187+}
188+
189+static void __exit samsung_exit(void)
190+{
191+ backlight_device_unregister(backlight_device);
192+
193+ /* we are done with the PCI device, put it back */
194+ pci_dev_put(pci_device);
195+}
196+
197+module_init(samsung_init);
198+module_exit(samsung_exit);
199+
200+MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>");
201+MODULE_DESCRIPTION("Samsung Backlight driver");
202+MODULE_LICENSE("GPL");
203+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN120:*:rnN120:*");
204+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnN130:*:rnN130:*");
205+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnNC10:*:rnNC10:*");
206+MODULE_ALIAS("dmi:*:svnSAMSUNGELECTRONICSCO.,LTD.:pnSQ45S70S:*:rnSQ45S70S:*");