1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
#
# Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
#
Index: linux-2.6.24/drivers/video/backlight/Kconfig
===================================================================
--- linux-2.6.24.orig/drivers/video/backlight/Kconfig
+++ linux-2.6.24/drivers/video/backlight/Kconfig
@@ -90,3 +90,12 @@
help
If you have a Intel LE80578 (Carillo Ranch) say Y to enable the
backlight driver.
+
+config BACKLIGHT_EZX
+ tristate "Motorola EXZ Backlight Driver (A780/E680/E680i)"
+ depends on BACKLIGHT_CLASS_DEVICE && PXA_EZX
+ default y
+ help
+ If you have a Motorola A780 or E680(i), say y to enable the
+ backlight driver.
+
Index: linux-2.6.24/drivers/video/backlight/Makefile
===================================================================
--- linux-2.6.24.orig/drivers/video/backlight/Makefile
+++ linux-2.6.24/drivers/video/backlight/Makefile
@@ -9,3 +9,4 @@
obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
+obj-$(CONFIG_BACKLIGHT_EZX) += ezx_bl.o
Index: linux-2.6.24/drivers/video/backlight/ezx_bl.c
===================================================================
--- /dev/null
+++ linux-2.6.24/drivers/video/backlight/ezx_bl.c
@@ -0,0 +1,142 @@
+/*
+ * Backlight Driver for Motorola A780 and E680(i) GSM Phones.
+ *
+ * Copyright 2006 Vanille Media
+ *
+ * Author: Michael Lauer <mickey@Vanille.de>
+ *
+ * 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/platform_device.h>
+#include <linux/fb.h>
+#include <linux/backlight.h>
+
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/ezx.h>
+
+#define EZX_MIN_INTENSITY 0
+#define EZX_MAX_INTENSITY 50
+#define EZX_DEFAULT_INTENSITY 30
+
+static struct backlight_device *ezx_backlight_device;
+static int last_intensity;
+static int suspended;
+
+static int ezxbl_send_intensity(struct backlight_device *bd)
+{
+ int intensity = bd->props.brightness;
+
+ if (suspended || bd->props.power != FB_BLANK_UNBLANK ||
+ bd->props.fb_blank != FB_BLANK_UNBLANK)
+ intensity = 0;
+
+ if ( !last_intensity && intensity ) {
+ PWM_CTRL0 = 2; /* pre-scaler */
+ PWM_PWDUTY0 = intensity; /* duty cycle */
+ PWM_PERVAL0 = 49; /* period */
+ pxa_gpio_mode(GPIO16_PWM0_MD); /* set GPIO16 as alternate function + output */
+ pxa_set_cken(CKEN_PWM0, 1); /* clock enable */
+ }
+ else if ( last_intensity && !intensity ) {
+ PWM_PWDUTY0 = 0;
+ GAFR0_U &= 0xFFFFFFFC; /* ??? */
+ pxa_set_cken(CKEN_PWM0, 0); /* clock disable */
+ pxa_gpio_mode(GPIO16_PWM0); /* set GPIO16 as input */
+ } else if ( last_intensity && intensity ) {
+ PWM_PWDUTY0 = intensity; /* duty cycle */
+ }
+ last_intensity = intensity;
+ return 0;
+}
+
+static int ezxbl_get_intensity(struct backlight_device *bd)
+{
+ return last_intensity;
+}
+
+static int ezxbl_set_intensity(struct backlight_device *bd)
+{
+ return ezxbl_send_intensity(ezx_backlight_device);
+}
+
+#ifdef CONFIG_PM
+static int ezxbl_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ suspended = 1;
+ ezxbl_set_intensity(ezx_backlight_device);
+ return 0;
+}
+
+static int ezxbl_resume(struct platform_device *pdev)
+{
+ suspended = 0;
+ ezxbl_set_intensity(ezx_backlight_device);
+ return 0;
+}
+#else
+#define ezxbl_suspend NULL
+#define ezxbl_resume NULL
+#endif
+
+static struct backlight_ops ezxbl_ops = {
+ .get_brightness = ezxbl_get_intensity,
+ .update_status = ezxbl_set_intensity,
+};
+
+static int __init ezxbl_probe(struct platform_device *pdev)
+{
+ ezx_backlight_device = backlight_device_register ("ezx-bl",
+ &pdev->dev, NULL, &ezxbl_ops);
+ if (IS_ERR (ezx_backlight_device))
+ return PTR_ERR (ezx_backlight_device);
+
+ platform_set_drvdata(pdev, ezx_backlight_device);
+
+ ezx_backlight_device->props.power = FB_BLANK_UNBLANK;
+ ezx_backlight_device->props.max_brightness = EZX_MAX_INTENSITY;
+ ezx_backlight_device->props.brightness = EZX_DEFAULT_INTENSITY;
+ ezxbl_set_intensity(ezx_backlight_device);
+ backlight_update_status(ezx_backlight_device);
+
+ return 0;
+}
+
+static int ezxbl_remove(struct platform_device *pdev)
+{
+ backlight_device_unregister(ezx_backlight_device);
+ return 0;
+}
+
+static struct platform_driver ezxbl_driver = {
+ .probe = ezxbl_probe,
+ .remove = ezxbl_remove,
+ .suspend = ezxbl_suspend,
+ .resume = ezxbl_resume,
+ .driver = {
+ .name = "ezx-bl",
+ },
+};
+
+static int __init ezxbl_init(void)
+{
+ return platform_driver_register(&ezxbl_driver);
+}
+
+static void __exit ezxbl_exit(void)
+{
+ platform_driver_unregister(&ezxbl_driver);
+}
+
+module_init(ezxbl_init);
+module_exit(ezxbl_exit);
+
+MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
+MODULE_DESCRIPTION("Backlight Driver for Motorola A780|E680(i)");
+MODULE_LICENSE("GPL");
Index: linux-2.6.24/arch/arm/mach-pxa/ezx.c
===================================================================
--- linux-2.6.24.orig/arch/arm/mach-pxa/ezx.c
+++ linux-2.6.24/arch/arm/mach-pxa/ezx.c
@@ -66,6 +66,12 @@
#endif
EXPORT_SYMBOL_GPL(ezx_backlight_power);
+/* EZX LCD Backlight */
+static struct platform_device ezxbacklight_device = {
+ .name = "ezx-bl",
+ .id = -1,
+};
+
/* OHCI Controller */
static int ezx_ohci_init(struct device *dev)
{
@@ -107,6 +113,7 @@
static struct platform_device *devices[] __initdata = {
&ezxbp_device,
+ &ezxbacklight_device,
};
/* PM */
|