hh.org updates
[hh.org.git] / arch / arm / mach-pxa / htcapache / htcapache-bl.c
blob8ffb9d4157becbcac3e3c8421402250274f084ff
1 /*
2 * Use consistent with the GNU GPL is permitted,
3 * provided that this copyright notice is
4 * preserved in its entirety in all copies and derived works.
6 * Copyright (C) 2006 Paul Sokolosvky
8 */
10 #include <linux/types.h>
11 #include <linux/platform_device.h>
12 #include <asm/arch/hardware.h> /* for pxa-regs.h (__REG) */
13 #include <asm/arch/pxa-regs.h>
14 #include <linux/corgi_bl.h>
15 #include <linux/err.h>
17 #include <asm/arch/htcapache-gpio.h>
19 #define MAX_INTENSITY 0xc7
21 static void set_bl_intensity(int intensity)
23 PWM_CTRL0 = 1; /* pre-scaler */
24 PWM_PWDUTY0 = intensity; /* duty cycle */
25 PWM_PERVAL0 = MAX_INTENSITY+1; /* period */
27 if (intensity > 0) {
28 pxa_set_cken(CKEN0_PWM0, 1);
29 } else {
30 pxa_set_cken(CKEN0_PWM0, 0);
34 static struct corgibl_machinfo bl_machinfo = {
35 .default_intensity = MAX_INTENSITY / 4,
36 .limit_mask = 0xff,
37 .max_intensity = MAX_INTENSITY,
38 .set_bl_intensity = set_bl_intensity,
41 struct platform_device htcapache_bl = {
42 .name = "corgi-bl",
43 .dev = {
44 .platform_data = &bl_machinfo,
48 MODULE_AUTHOR("Kevin O'Connor <kevin@koconnor.net>");
49 MODULE_DESCRIPTION("Backlight driver for HTC Apache");
50 MODULE_LICENSE("GPL");