2 * Hardware definitions for HP iPAQ Handheld Computers
4 * Copyright 2000-2003 Hewlett-Packard Company.
6 * Use consistent with the GNU GPL is permitted,
7 * provided that this copyright notice is
8 * preserved in its entirety in all copies and derived works.
10 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
11 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
12 * FITNESS FOR ANY PARTICULAR PURPOSE.
14 * Author: Jamey Hicks.
18 * 2006-09-25 Paul Sokolovsky Split backlight code out to ease maintenance
19 * 2003-05-14 Joshua Wise Adapted for the HP iPAQ H1900
20 * 2002-08-23 Jamey Hicks Adapted for use with PXA250-based iPAQs
21 * 2001-10-?? Andrew Christian Added support for iPAQ H3800
22 * and abstracted EGPIO interface.
25 #include <linux/module.h>
26 #include <linux/init.h>
27 #include <linux/kernel.h>
28 #include <linux/tty.h>
29 #include <linux/sched.h>
30 #include <linux/delay.h>
32 #include <linux/lcd.h>
33 #include <linux/backlight.h>
35 #include <linux/err.h>
36 #include <linux/platform_device.h>
38 #include <asm/mach-types.h>
39 #include <asm/hardware.h>
40 #include <asm/setup.h>
42 #include <asm/mach/arch.h>
43 #include <asm/arch/pxa-regs.h>
44 #include <asm/arch/h3900-asic.h>
45 #include <asm/arch/ipaq.h>
47 #include <linux/soc/asic2_base.h>
48 #include <linux/soc/asic3_base.h>
50 extern struct platform_device h3900_asic2
, h3900_asic3
;
53 On screen enable, we get
59 On screen disable, we get
66 static int h3900_lcd_set_power( struct lcd_device
*lm
, int level
)
69 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_ON
, GPIO3_LCD_ON
);
71 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_NV_ON
, GPIO3_LCD_NV_ON
);
73 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_9V_ON
, GPIO3_LCD_9V_ON
);
75 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_5V_ON
, GPIO3_LCD_5V_ON
);
79 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_5V_ON
, 0);
81 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_9V_ON
, 0);
83 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_NV_ON
, 0);
85 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_ON
, 0);
89 mdelay(17); // Wait one from before turning on
90 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_PCI
, GPIO3_LCD_PCI
);
92 asic3_set_gpio_out_b(&h3900_asic3
.dev
, GPIO3_LCD_PCI
, 0);
93 mdelay(30); // Wait before turning off
99 static int h3900_lcd_get_power( struct lcd_device
*lm
)
101 if (asic3_get_gpio_out_b(&h3900_asic3
.dev
) & GPIO3_LCD_PCI
) {
102 if (asic3_get_gpio_out_b(&h3900_asic3
.dev
) & GPIO3_LCD_ON
)
110 static struct lcd_properties h3900_lcd_properties
= {
111 .owner
= THIS_MODULE
,
112 .set_power
= h3900_lcd_set_power
,
113 .get_power
= h3900_lcd_get_power
,
116 static struct lcd_device
*pxafb_lcd_device
;
118 static int h3900_lcd_probe(struct device
* dev
)
120 pxafb_lcd_device
= lcd_device_register("pxafb", NULL
, &h3900_lcd_properties
);
121 if (IS_ERR (pxafb_lcd_device
))
122 return PTR_ERR (pxafb_lcd_device
);
124 h3900_lcd_set_power (pxafb_lcd_device
, 0);
129 static int h3900_lcd_remove(struct device
* dev
)
131 h3900_lcd_set_power(pxafb_lcd_device
, 4);
132 lcd_device_unregister(pxafb_lcd_device
);
137 static int h3900_lcd_suspend(struct device
* dev
, pm_message_t state
)
139 h3900_lcd_set_power(pxafb_lcd_device
, 4);
143 static int h3900_lcd_resume(struct device
* dev
)
145 h3900_lcd_set_power(pxafb_lcd_device
, 0);
149 static struct device_driver h3900_lcd_driver
= {
151 .bus
= &platform_bus_type
,
152 .probe
= h3900_lcd_probe
,
153 .remove
= h3900_lcd_remove
,
154 .suspend
= h3900_lcd_suspend
,
155 .resume
= h3900_lcd_resume
,
160 h3900_lcd_init (void)
162 if (!machine_is_h3900())
165 return driver_register(&h3900_lcd_driver
);
171 h3900_lcd_exit (void)
173 lcd_device_unregister(pxafb_lcd_device
);
174 driver_unregister(&h3900_lcd_driver
);
177 module_init (h3900_lcd_init
);
178 module_exit (h3900_lcd_exit
);
180 MODULE_LICENSE("GPL");
181 MODULE_AUTHOR("Phil Blundell <pb@handhelds.org> and others");
182 MODULE_DESCRIPTION("iPAQ h3900 LCD driver glue");