sync hh.org
[hh.org.git] / drivers / video / backlight / h2200_bl.c
blobb79808344f88491e9239047b998c0a59b3da99b9
1 /*
2 * LCD backlight support for iPAQ H2200
4 * Copyright (c) 2004 Andrew Zabolotny
5 * Copyright (c) 2004-6 Matt Reimer
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file COPYING in the main directory of this archive for
9 * more details.
12 #include <linux/platform_device.h>
13 #include <asm/arch/hardware.h>
14 #include <asm/arch/pxa-regs.h>
15 #include <asm/arch/h2200-gpio.h>
16 #include <asm/arch/sharpsl.h>
18 #define H2200_MAX_INTENSITY 0x3ff
20 static
21 void h2200_set_bl_intensity(int intensity)
23 if (intensity < 7) intensity = 0;
25 PWM_CTRL0 = 1;
26 PWM_PERVAL0 = H2200_MAX_INTENSITY;
27 PWM_PWDUTY0 = intensity;
29 if (intensity) {
30 pxa_gpio_mode(GPIO16_PWM0_MD);
31 pxa_set_cken(CKEN0_PWM0, 1);
32 SET_H2200_GPIO(BACKLIGHT_ON, 1);
33 } else {
34 pxa_set_cken(CKEN0_PWM0, 0);
35 SET_H2200_GPIO(BACKLIGHT_ON, 0);
39 static struct corgibl_machinfo h2200_bl_machinfo = {
40 .max_intensity = H2200_MAX_INTENSITY,
41 .default_intensity = H2200_MAX_INTENSITY,
42 .limit_mask = 0xff, /* limit brightness to about 1/4 on low battery */
43 .set_bl_intensity = h2200_set_bl_intensity,
46 struct platform_device h2200_bl = {
47 .name = "corgi-bl",
48 .dev = {
49 .platform_data = &h2200_bl_machinfo,
53 static int __init h2200_bl_init(void)
55 return platform_device_register(&h2200_bl);
58 static void __exit h2200_bl_exit(void)
60 platform_device_unregister(&h2200_bl);
63 module_init(h2200_bl_init);
64 module_exit(h2200_bl_exit);
66 MODULE_AUTHOR("Andrew Zabolotny, Matt Reimer <mreimer@vpop.net>");
67 MODULE_DESCRIPTION("Backlight driver for iPAQ H2200");
68 MODULE_LICENSE("GPL");