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 h4000_lcd.c
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_h4000 */
16 #include <linux/corgi_bl.h>
17 #include <linux/err.h>
19 #include <asm/arch/h4000-gpio.h>
20 #include <asm/arch/h4000-asic.h>
21 #include <asm/hardware/ipaq-asic3.h>
22 #include <linux/soc/asic3_base.h>
24 #define H4000_MAX_INTENSITY 0x3ff
26 extern struct platform_device h4000_asic3
;
28 static void h4000_set_bl_intensity(int intensity
)
30 /* LCD brightness is driven by PWM0.
31 * We'll set the pre-scaler to 8, and the period to 1024, this
32 * means the backlight refresh rate will be 3686400/(8*1024) =
33 * 450 Hz which is quite enough.
35 PWM_CTRL0
= 7; /* pre-scaler */
36 PWM_PWDUTY0
= intensity
; /* duty cycle */
37 PWM_PERVAL0
= H4000_MAX_INTENSITY
; /* period */
40 pxa_set_cken(CKEN0_PWM0
, 1);
41 asic3_set_gpio_out_b(&h4000_asic3
.dev
,
42 GPIOB_BACKLIGHT_POWER_ON
, GPIOB_BACKLIGHT_POWER_ON
);
44 pxa_set_cken(CKEN0_PWM0
, 0);
45 asic3_set_gpio_out_b(&h4000_asic3
.dev
,
46 GPIOB_BACKLIGHT_POWER_ON
, 0);
51 static struct corgibl_machinfo h4000_bl_machinfo
= {
52 .default_intensity
= H4000_MAX_INTENSITY
/ 4,
54 .max_intensity
= H4000_MAX_INTENSITY
,
55 .set_bl_intensity
= h4000_set_bl_intensity
,
58 struct platform_device h4000_bl
= {
61 .platform_data
= &h4000_bl_machinfo
,
65 MODULE_AUTHOR("Paul Sokolovsky <pmiscml@gmail.com>");
66 MODULE_DESCRIPTION("Backlight driver for iPAQ H4000");
67 MODULE_LICENSE("GPL");