2 * Hardware definitions for Compaq iPAQ H36xx Handheld Computers
4 * Use consistent with the GNU GPL is permitted,
5 * provided that this copyright notice is
6 * preserved in its entirety in all copies and derived works.
8 * Author: Alessandro Gardich.
10 * History : based on 2.4 drivers.
12 * 2005-11-xx Alessandro Gardich, let start.
17 #include <linux/module.h>
18 #include <linux/init.h>
19 #include <linux/kernel.h>
20 #include <linux/tty.h>
21 #include <linux/sched.h>
22 #include <linux/delay.h>
24 #include <linux/lcd.h>
25 #include <linux/backlight.h>
27 #include <linux/err.h>
28 #include <linux/platform_device.h>
30 #include <asm/mach-types.h>
31 #include <asm/hardware.h>
32 #include <asm/setup.h>
34 #include <asm/mach/arch.h>
35 #include <asm/arch/h3600.h>
36 #include <asm/hardware/ipaq-ops.h>
38 #include <../arch/arm/mach-sa1100/generic.h>
40 static int h3600_lcd_power
;
45 static void __h3600_lcd_power(int enable
)
47 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_POWER
, enable
);
48 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_ENABLE
, enable
);
53 /*--- sa1100fb END ---*/
56 static int h3600_lcd_set_power( struct lcd_device
*lm
, int level
)
58 h3600_lcd_power
= level
;
61 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_POWER
, 1);
63 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_POWER
, 0);
67 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_ENABLE
, 1);
69 assign_ipaqsa_egpio(IPAQ_EGPIO_LCD_ENABLE
, 0);
75 static int h3600_lcd_get_power( struct lcd_device
*lm
)
77 return h3600_lcd_power
;
81 static struct lcd_properties h3600_lcd_properties
= {
83 .get_power
= h3600_lcd_get_power
,
84 .set_power
= h3600_lcd_set_power
,
87 static struct lcd_device
*h3600_lcd_device
;
89 static int h3600_fp_probe (struct device
*dev
)
91 if (! machine_is_h3600 ())
94 h3600_lcd_device
= lcd_device_register("sa1100fb", NULL
, &h3600_lcd_properties
);
95 if (IS_ERR (h3600_lcd_device
))
96 return PTR_ERR (h3600_lcd_device
);
98 h3600_lcd_set_power (h3600_lcd_device
, 0);
100 sa1100fb_lcd_power
= __h3600_lcd_power
;
105 static int h3600_fp_remove (struct device
*dev
)
107 h3600_lcd_set_power(h3600_lcd_device
, 4);
108 lcd_device_unregister (h3600_lcd_device
);
110 sa1100fb_lcd_power
= NULL
;
115 static int h3600_fp_suspend ( struct device
*dev
, pm_message_t msg
)
117 h3600_lcd_set_power(h3600_lcd_device
, 4);
121 static int h3600_fp_resume (struct device
*dev
)
123 h3600_lcd_set_power(h3600_lcd_device
, 0);
127 struct device_driver h3600_fp_driver
= {
129 .bus
= &platform_bus_type
,
130 .probe
= h3600_fp_probe
,
131 .remove
= h3600_fp_remove
,
132 .suspend
= h3600_fp_suspend
,
133 .resume
= h3600_fp_resume
,
136 static int __init
h3600_fp_init(void)
140 if (!machine_is_h3600())
143 rc
= driver_register(&h3600_fp_driver
);
148 static void __exit
h3600_fp_exit(void)
150 lcd_device_unregister(h3600_lcd_device
);
151 driver_unregister(&h3600_fp_driver
);
154 module_init (h3600_fp_init
);
155 module_exit (h3600_fp_exit
);
157 MODULE_LICENSE("GPL");
158 MODULE_AUTHOR("Alessandro Gardich <gremlin-4KDpiRHFOM2onA0d6jMUrA@public.gmane.org>");
159 MODULE_DESCRIPTION("iPAQ h3600 LCD driver");