hh.org updates
[hh.org.git] / arch / arm / mach-pxa / h3900 / h3900_bl.c
blob3ee550d9cbd9a70001570d3add4d23321020c919
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 the code by Jamie Hicks and others
9 */
11 #include <linux/types.h>
12 #include <asm/arch/hardware.h> /* for pxa-regs.h (__REG) */
13 #include <linux/platform_device.h>
14 #include <asm/arch/pxa-regs.h> /* LCCR[0,1,2,3]* */
15 #include <asm/mach-types.h> /* machine_is_h3900 */
16 #include <linux/corgi_bl.h>
17 #include <linux/err.h>
19 #include <asm/arch/h3900-gpio.h>
20 #include <asm/arch/h3900-asic.h>
21 #include <asm/hardware/ipaq-asic3.h>
22 #include <linux/soc/asic2_base.h>
23 #include <linux/soc/asic3_base.h>
25 #define H3900_DEFAULT_INTENSITY (0x100 / 4)
27 extern struct platform_device h3900_asic3, h3900_asic2;
29 static void h3900_set_bl_intensity(int intensity)
31 if (intensity > 0) {
32 asic2_clock_enable(&h3900_asic2.dev, ASIC2_CLOCK_PWM | ASIC2_CLOCK_EX1,
33 ASIC2_CLOCK_PWM | ASIC2_CLOCK_EX1);
34 asic2_set_pwm(&h3900_asic2.dev, _IPAQ_ASIC2_PWM_0_Base, intensity, 0x100,
35 PWM_TIMEBASE_ENABLE | 0x8);
36 asic3_set_gpio_out_b(&h3900_asic3.dev, GPIO3_FL_PWR_ON, GPIO3_FL_PWR_ON);
37 } else {
38 asic3_set_gpio_out_b (&h3900_asic3.dev, GPIO3_FL_PWR_ON, 0);
39 asic2_set_pwm(&h3900_asic2.dev, _IPAQ_ASIC2_PWM_0_Base, 0, 0, 0);
40 asic2_clock_enable(&h3900_asic2.dev, ASIC2_CLOCK_PWM, 0);
45 static struct corgibl_machinfo h3900_bl_machinfo = {
46 .default_intensity = H3900_DEFAULT_INTENSITY,
47 .limit_mask = 0xffff,
48 .max_intensity = 0x100,
49 .set_bl_intensity = h3900_set_bl_intensity,
52 struct platform_device h3900_bl = {
53 .name = "corgi-bl",
54 .dev = {
55 .platform_data = &h3900_bl_machinfo,
59 MODULE_AUTHOR("Paul Sokolovsky <pmiscml@gmail.com>");
60 MODULE_DESCRIPTION("Backlight driver for iPAQ h3900");
61 MODULE_LICENSE("GPL");