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 * Copyright (C) 2006 Luke Kenneth Casson Leighton
9 * Based on code from older versions of h4000_lcd.c
10 * Based on code from h4000_bl.c
13 #include <linux/types.h>
14 #include <asm/arch/hardware.h> /* for pxa-regs.h (__REG) */
15 #include <linux/platform_device.h>
16 #include <asm/arch/pxa-regs.h> /* LCCR[0,1,2,3]* */
17 #include <asm/mach-types.h> /* machine_is_htcsable */
18 #include <linux/corgi_bl.h>
19 #include <linux/err.h>
20 #include <linux/delay.h>
22 #include <asm/arch/htcsable-gpio.h>
23 #include <asm/arch/htcsable-asic.h>
24 #include <asm/hardware/ipaq-asic3.h>
25 #include <linux/soc/asic3_base.h>
27 #define HTCSABLE_MAX_INTENSITY 0x3ff
29 extern struct platform_device htcsable_asic3
;
31 static void htcsable_set_bl_intensity(int intensity
)
33 printk("htcsable_set_bl_intensity: %d\n", intensity
);
35 /* LCD brightness is driven by PWM0.
36 * We'll set the pre-scaler to 8, and the period to 1024, this
37 * means the backlight refresh rate will be 3686400/(8*1024) =
38 * 450 Hz which is quite enough.
40 PWM_CTRL0
= 7; /* pre-scaler */
41 PWM_PWDUTY0
= intensity
; /* duty cycle */
42 PWM_PERVAL0
= HTCSABLE_MAX_INTENSITY
; /* period */
45 asic3_set_gpio_out_d(&htcsable_asic3
.dev
,
46 GPIOD_LCD_BACKLIGHT
, GPIOD_LCD_BACKLIGHT
);
48 asic3_set_gpio_out_d(&htcsable_asic3
.dev
,
51 pxa_set_cken(CKEN0_PWM0
, 1);
53 asic3_set_gpio_out_d(&htcsable_asic3
.dev
,
54 GPIOD_LCD_BACKLIGHT
, 0);
56 asic3_set_gpio_out_d(&htcsable_asic3
.dev
,
59 pxa_set_cken(CKEN0_PWM0
, 0);
64 static struct corgibl_machinfo htcsable_bl_machinfo
= {
65 .default_intensity
= HTCSABLE_MAX_INTENSITY
/ 4,
67 .max_intensity
= HTCSABLE_MAX_INTENSITY
,
68 .set_bl_intensity
= htcsable_set_bl_intensity
,
71 struct platform_device htcsable_bl
= {
74 .platform_data
= &htcsable_bl_machinfo
,
78 MODULE_AUTHOR("Paul Sokolovsky <pmiscml@gmail.com>, Luke Kenneth Casson Leighton");
79 MODULE_DESCRIPTION("Backlight driver for iPAQ HTCSABLE");
80 MODULE_LICENSE("GPL");