3 # Patch managed by http://www.mn-logistik.de/unsupported/pxa250/patcher
6 Index: linux-2.6.21/drivers/video/backlight/Kconfig
7 ===================================================================
8 --- linux-2.6.21.orig/drivers/video/backlight/Kconfig 2007-05-08 14:19:18.000000000 -0300
9 +++ linux-2.6.21/drivers/video/backlight/Kconfig 2007-05-08 14:22:22.000000000 -0300
12 If you have a Frontpath ProGear say Y to enable the
16 + tristate "Motorola EXZ Backlight Driver (A780/E680/E680i)"
17 + depends on BACKLIGHT_CLASS_DEVICE && PXA_EZX
20 + If you have a Motorola A780 or E680(i), say y to enable the
23 Index: linux-2.6.21/drivers/video/backlight/Makefile
24 ===================================================================
25 --- linux-2.6.21.orig/drivers/video/backlight/Makefile 2007-05-08 14:19:18.000000000 -0300
26 +++ linux-2.6.21/drivers/video/backlight/Makefile 2007-05-08 14:22:22.000000000 -0300
28 obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o
29 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
30 obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
31 +obj-$(CONFIG_BACKLIGHT_EZX) += ezx_bl.o
32 Index: linux-2.6.21/drivers/video/backlight/ezx_bl.c
33 ===================================================================
34 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
35 +++ linux-2.6.21/drivers/video/backlight/ezx_bl.c 2007-05-08 14:24:16.000000000 -0300
38 + * Backlight Driver for Motorola A780 and E680(i) GSM Phones.
40 + * Copyright 2006 Vanille Media
42 + * Author: Michael Lauer <mickey@Vanille.de>
44 + * This program is free software; you can redistribute it and/or modify
45 + * it under the terms of the GNU General Public License version 2 as
46 + * published by the Free Software Foundation.
50 +#include <linux/module.h>
51 +#include <linux/kernel.h>
52 +#include <linux/init.h>
53 +#include <linux/platform_device.h>
54 +#include <linux/fb.h>
55 +#include <linux/backlight.h>
57 +#include <asm/arch/pxa-regs.h>
58 +#include <asm/arch/ezx.h>
60 +#define EZX_MIN_INTENSITY 0
61 +#define EZX_MAX_INTENSITY 50
62 +#define EZX_DEFAULT_INTENSITY 30
64 +static struct backlight_device *ezx_backlight_device;
65 +static int last_intensity;
66 +static int suspended;
68 +static int ezxbl_send_intensity(struct backlight_device *bd)
70 + int intensity = bd->props.brightness;
72 + if (suspended || bd->props.power != FB_BLANK_UNBLANK ||
73 + bd->props.fb_blank != FB_BLANK_UNBLANK)
76 + if ( !last_intensity && intensity ) {
77 + PWM_CTRL0 = 2; /* pre-scaler */
78 + PWM_PWDUTY0 = intensity; /* duty cycle */
79 + PWM_PERVAL0 = 49; /* period */
80 + pxa_gpio_mode(GPIO16_PWM0_MD); /* set GPIO16 as alternate function + output */
81 + pxa_set_cken(CKEN0_PWM0, 1); /* clock enable */
83 + else if ( last_intensity && !intensity ) {
85 + GAFR0_U &= 0xFFFFFFFC; /* ??? */
86 + pxa_set_cken(CKEN0_PWM0, 0); /* clock disable */
87 + pxa_gpio_mode(GPIO16_PWM0); /* set GPIO16 as input */
88 + } else if ( last_intensity && intensity ) {
89 + PWM_PWDUTY0 = intensity; /* duty cycle */
91 + last_intensity = intensity;
95 +static int ezxbl_get_intensity(struct backlight_device *bd)
97 + return last_intensity;
100 +static int ezxbl_set_intensity(struct backlight_device *bd)
102 + return ezxbl_send_intensity(ezx_backlight_device);
106 +static int ezxbl_suspend(struct platform_device *pdev, pm_message_t state)
109 + ezxbl_set_intensity(ezx_backlight_device);
113 +static int ezxbl_resume(struct platform_device *pdev)
116 + ezxbl_set_intensity(ezx_backlight_device);
120 +#define ezxbl_suspend NULL
121 +#define ezxbl_resume NULL
124 +static struct backlight_ops ezxbl_ops = {
125 + .get_brightness = ezxbl_get_intensity,
126 + .update_status = ezxbl_set_intensity,
129 +static int __init ezxbl_probe(struct platform_device *pdev)
131 + ezx_backlight_device = backlight_device_register ("ezx-bl",
132 + &pdev->dev, NULL, &ezxbl_ops);
133 + if (IS_ERR (ezx_backlight_device))
134 + return PTR_ERR (ezx_backlight_device);
136 + platform_set_drvdata(pdev, ezx_backlight_device);
138 + ezx_backlight_device->props.power = FB_BLANK_UNBLANK;
139 + ezx_backlight_device->props.max_brightness = EZX_MAX_INTENSITY;
140 + ezx_backlight_device->props.brightness = EZX_DEFAULT_INTENSITY;
141 + ezxbl_set_intensity(ezx_backlight_device);
142 + backlight_update_status(ezx_backlight_device);
147 +static int ezxbl_remove(struct platform_device *pdev)
149 + backlight_device_unregister(ezx_backlight_device);
153 +static struct platform_driver ezxbl_driver = {
154 + .probe = ezxbl_probe,
155 + .remove = ezxbl_remove,
156 + .suspend = ezxbl_suspend,
157 + .resume = ezxbl_resume,
163 +static int __init ezxbl_init(void)
165 + return platform_driver_register(&ezxbl_driver);
168 +static void __exit ezxbl_exit(void)
170 + platform_driver_unregister(&ezxbl_driver);
173 +module_init(ezxbl_init);
174 +module_exit(ezxbl_exit);
176 +MODULE_AUTHOR("Michael Lauer <mickey@Vanille.de>");
177 +MODULE_DESCRIPTION("Backlight Driver for Motorola A780|E680(i)");
178 +MODULE_LICENSE("GPL");
179 Index: linux-2.6.21/arch/arm/mach-pxa/ezx.c
180 ===================================================================
181 --- linux-2.6.21.orig/arch/arm/mach-pxa/ezx.c 2007-05-08 14:22:21.000000000 -0300
182 +++ linux-2.6.21/arch/arm/mach-pxa/ezx.c 2007-05-08 14:22:22.000000000 -0300
185 EXPORT_SYMBOL(ezx_backlight_power);
187 +/* EZX LCD Backlight */
188 +static struct platform_device ezxbacklight_device = {
194 struct platform_device ezxssp_device = {
200 + &ezxbacklight_device,