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.
8 #include <linux/types.h>
9 #include <asm/arch/hardware.h> /* for pxa-regs.h (__REG) */
10 #include <linux/platform_device.h>
11 #include <asm/arch/pxa-regs.h> /* LCCR[0,1,2,3]* */
12 #include <asm/arch/bitfield.h> /* for pxa-regs.h (Fld, etc) */
13 #include <asm/arch/pxafb.h> /* pxafb_mach_info, set_pxa_fb_info */
14 #include <asm/mach-types.h> /* machine_is_a730 */
15 #include <linux/lcd.h> /* lcd_device */
16 #include <linux/backlight.h> /* backlight_device */
18 #include <linux/lcd.h>
19 #include <linux/err.h>
20 #include <linux/delay.h>
22 #include <asm/arch/asus730-gpio.h>
23 #include <asm/arch/pxa-regs.h>
25 extern void pca9535_write_output(u16
);
26 extern u32
pca9535_read_input(void);
28 static int a730_lcd_get_power(struct lcd_device
*lm
)
30 //return (pca9535_read_input() & 0x1);
32 int p = pca9535_read_input();*/
33 int i
, p
= GET_A730_GPIO(LCD_EN
);
35 else if (!(p
& 0x1)) i
= 4;
36 printk("%s: input=0x%x, i=0x%x\n", __FUNCTION__
, p
, i
);
40 static int a730_lcd_set_power(struct lcd_device
*lm
, int power
)
42 //u16 i = pca9535_read_input();
46 case FB_BLANK_UNBLANK
://0
48 //pca9535_write_output(i);
49 SET_A730_GPIO(LCD_EN
, 0);
51 case FB_BLANK_NORMAL
://1
52 case FB_BLANK_VSYNC_SUSPEND
://2
53 case FB_BLANK_HSYNC_SUSPEND
://3
54 case FB_BLANK_POWERDOWN
://4
56 SET_A730_GPIO(LCD_EN
, 1);
57 //pca9535_write_output(i);
64 static int a730_lcd_get_contrast(struct lcd_device
*ld
)
69 static int a730_lcd_set_contrast(struct lcd_device
*ld
, int contrast
)
74 static struct lcd_properties a730_lcd_properties
=
77 .get_power
= a730_lcd_get_power
,
78 .set_power
= a730_lcd_set_power
,
80 .get_contrast
= a730_lcd_get_contrast
,
81 .set_contrast
= a730_lcd_set_contrast
,
84 static struct lcd_device
*a730_lcd_dev
= NULL
;
86 static int a730_lcd_probe(struct device
* dev
)
88 pxa_gpio_mode(GPIO_NR_A730_LCD_EN
| GPIO_OUT
);
89 a730_lcd_dev
= lcd_device_register("pxa2xx-fb", NULL
, &a730_lcd_properties
);
91 if (IS_ERR(a730_lcd_dev
)) {
92 printk("a730-lcd: Error registering device\n");
99 static int a730_lcd_remove(struct device
* dev
)
101 a730_lcd_set_power(a730_lcd_dev
, 4);
102 lcd_device_unregister(a730_lcd_dev
);
106 static int a730_lcd_suspend(struct device
* dev
, pm_message_t state
)
108 a730_lcd_set_power(a730_lcd_dev
, 4);
112 static int a730_lcd_resume(struct device
* dev
)
114 a730_lcd_set_power(a730_lcd_dev
, 0);
118 /*********************************************/
120 static struct device_driver a730_lcd_driver
= {
122 .bus
= &platform_bus_type
,
123 .probe
= a730_lcd_probe
,
124 .remove
= a730_lcd_remove
,
125 .suspend
= a730_lcd_suspend
,
126 .resume
= a730_lcd_resume
,
129 static int a730_lcd_init(void)
131 if (!machine_is_a730())
134 driver_register(&a730_lcd_driver
);
139 static void a730_lcd_exit(void)
141 lcd_device_unregister(a730_lcd_dev
);
142 driver_unregister(&a730_lcd_driver
);
145 module_init(a730_lcd_init
);
146 module_exit(a730_lcd_exit
);
148 MODULE_AUTHOR("Serge Nikolaenko <mypal_hh@utl.ru>");
149 MODULE_DESCRIPTION("LCD handling for ASUS A730(W)");
150 MODULE_LICENSE("GPL");