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
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 */
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
));
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,
47 .max_intensity
= HTCUNIVERSAL_MAX_INTENSITY
,
48 .set_bl_intensity
= htcuniversal_set_bl_intensity
,
51 struct platform_device htcuniversal_bl
= {
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");