hh.org updates
[hh.org.git] / arch / arm / mach-pxa / htcuniversal / htcuniversal_bl.c
blob2bf85bea103801b1f891e89a4650c2e8de578b55
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
7 * Based on code from older versions of htcuniversal_lcd.c
9 */
11 #include <linux/types.h>
12 #include <linux/platform_device.h>
13 #include <asm/arch/hardware.h> /* for pxa-regs.h (__REG) */
14 #include <asm/arch/pxa-regs.h>
15 #include <asm/mach-types.h> /* machine_is_htcuniversal */
16 #include <linux/corgi_bl.h>
17 #include <linux/err.h>
19 #include <asm/arch/htcuniversal-gpio.h>
20 #include <asm/arch/htcuniversal-asic.h>
21 #include <asm/hardware/ipaq-asic3.h>
22 #include <linux/soc/asic3_base.h>
24 #define HTCUNIVERSAL_MAX_INTENSITY 0xc7
26 static void htcuniversal_set_bl_intensity(int intensity)
28 PWM_CTRL1 = 1; /* pre-scaler */
29 PWM_PWDUTY1 = intensity; /* duty cycle */
30 PWM_PERVAL1 = HTCUNIVERSAL_MAX_INTENSITY+1; /* period */
32 if (intensity > 0) {
33 pxa_set_cken(CKEN1_PWM1, 1);
34 asic3_set_gpio_out_d(&htcuniversal_asic3.dev,
35 (1<<GPIOD_FL_PWR_ON), (1<<GPIOD_FL_PWR_ON));
36 } else {
37 pxa_set_cken(CKEN1_PWM1, 0);
38 asic3_set_gpio_out_d(&htcuniversal_asic3.dev,
39 (1<<GPIOD_FL_PWR_ON), 0);
44 static struct corgibl_machinfo htcuniversal_bl_machinfo = {
45 .default_intensity = HTCUNIVERSAL_MAX_INTENSITY / 4,
46 .limit_mask = 0xff,
47 .max_intensity = HTCUNIVERSAL_MAX_INTENSITY,
48 .set_bl_intensity = htcuniversal_set_bl_intensity,
51 struct platform_device htcuniversal_bl = {
52 .name = "corgi-bl",
53 .dev = {
54 .platform_data = &htcuniversal_bl_machinfo,
58 MODULE_AUTHOR("Paul Sokolovsky <pmiscml@gmail.com>");
59 MODULE_DESCRIPTION("Backlight driver for HTC Universal");
60 MODULE_LICENSE("GPL");