hh.org updates
[hh.org.git] / arch / arm / mach-pxa / asus730 / a730_bl.c
blobd9985118c60315fced0748f99fcbe5a0df0266e6
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 Serge Nikolaenko
8 */
10 #include <linux/types.h>
11 #include <asm/arch/hardware.h> /* for pxa-regs.h (__REG) */
12 #include <linux/platform_device.h>
13 #include <asm/arch/pxa-regs.h> /* LCCR[0,1,2,3]* */
14 #include <asm/mach-types.h>
15 #include <linux/backlight.h> /* backlight_device */
16 #include <linux/err.h>
18 #include <asm/arch/asus730-gpio.h>
19 #include <asm/arch/sharpsl.h> /* for struct corgibl_machinfo */
21 #include "../generic.h"
23 #define A730_MAX_INTENSITY 0xff
24 #define A730_DEFAULT_INTENSITY (A730_MAX_INTENSITY / 4)
26 static int cur_int;
28 static void a730_set_bl_intensity(int intensity)
30 printk("intensity=0x%x\n", intensity);
31 if (intensity < 0 || intensity > 255) return;
32 cur_int = intensity;
34 pxa_gpio_mode(GPIO_NR_A730_BACKLIGHT_EN | GPIO_OUT);
35 SET_A730_GPIO(BACKLIGHT_EN, intensity != 0);
36 PWM_CTRL0 = 1;
37 //PWM_PWDUTY0 = intensity;
38 //PWM_PERVAL0 = A730_MAX_INTENSITY;
40 if (intensity)
42 pxa_set_cken(CKEN0_PWM0, 1);
43 PWM_PWDUTY0 = intensity;
44 PWM_PERVAL0 = A730_MAX_INTENSITY;
46 else
48 PWM_PWDUTY0 = A730_MAX_INTENSITY;
49 PWM_PERVAL0 = 0;
50 pxa_set_cken(CKEN0_PWM0, 0);
54 static struct corgibl_machinfo a730_bl_machinfo = {
55 .default_intensity = A730_DEFAULT_INTENSITY,
56 .limit_mask = 0xff,
57 .max_intensity = A730_MAX_INTENSITY,
58 .set_bl_intensity = a730_set_bl_intensity,
61 struct platform_device a730_bl = {
62 .name = "corgi-bl",
63 .dev = {
64 .platform_data = &a730_bl_machinfo,
68 MODULE_AUTHOR("Serge Nikolaenko <mypal_hh@utl.ru>");
69 MODULE_DESCRIPTION("Backlight driver for ASUS A730(W)");
70 MODULE_LICENSE("GPL");