]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/video/omap/lcd_h6300.c
h63xx: pca9535 support.
[linux-2.6-omap-h63xx.git] / drivers / video / omap / lcd_h6300.c
1 /*
2  * File: drivers/video/omap_new/lcd-h6300.c
3  *
4  * LCD panel support for the TI OMAP1510 based iPAQ h63xx series of mobile phones.
5  * (h6315, h6340 and h6365)
6  *
7  * Copyright (C) 2009 Mika Laitio
8  * Copyright (C) 2009 Husam Senussi
9  *
10  * This program is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU General Public License as published by the
12  * Free Software Foundation; either version 2 of the License, or (at your
13  * option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23  */
24
25 #include <linux/module.h>
26 #include <linux/platform_device.h>
27
28 #include <asm/io.h>
29 #include <asm/arch/pca9535.h>
30 #include <asm/arch/omapfb.h>
31
32 /* #define OMAPFB_DBG 1 */
33
34 #include "debug.h"
35
36 //static struct clk *h6300_lcd_ck;
37
38 static int h6300_panel_init(struct omapfb_device *fbdev)
39 {
40         DBGENTER(1);
41 /*
42         if ((h6300_lcd_ck = clk_get (NULL, "lcd_ck")) == NULL) {
43                 printk(KERN_ERR "Unable to get the clock LCD_CK!!!\n");
44                 return -EPERM;
45         } clk_enable(h6300_lcd_ck);
46 */
47         DBGLEAVE(1);
48         printk(KERN_INFO "lcd_h6300.c: h6300_panel_init() done\n");
49         return 0;
50 }
51
52 static void h6300_panel_cleanup(void)
53 {
54         DBGENTER(1);
55 /*
56         if (h6300_lcd_ck) {
57                 clk_disable(h6300_lcd_ck);
58                 clk_put(h6300_lcd_ck);
59                 h6300_lcd_ck = NULL;
60         }
61 */
62         DBGLEAVE(1);
63         printk(KERN_INFO "lcd_h6300.c: h6300_panel_cleanup() done\n");
64 }
65
66 static int h6300_panel_enable(void)
67 {
68         DBGENTER(1);
69         DBGLEAVE(1);
70         printk(KERN_INFO "lcd_h6300.c: h6300_panel_enable() done\n");
71         return 0;
72 }
73
74 static void h6300_panel_disable(void)
75 {
76         DBGENTER(1);
77         DBGLEAVE(1);
78         printk(KERN_INFO "lcd_h6300.c: h6300_panel_disable() done\n");  
79 }
80
81 static unsigned long h6300_panel_get_caps(void)
82 {
83         printk(KERN_INFO "lcd_h6300.c: h6300_panel_get_caps() called\n");       
84         return 0;
85 }
86
87 struct lcd_panel h6300_panel = {
88         .name           = "h6300",
89         .config         = OMAP_LCDC_PANEL_TFT,
90
91         .bpp            = 16,
92         .data_lines     = 16,
93         .x_res          = 240,
94         .y_res          = 320,
95         .pixel_clock    = 21000,
96         .hsw            = 12,
97         .hfp            = 10,
98         .hbp            = 10,
99         .vsw            = 3,
100         .vfp            = 10,
101         .vbp            = 3,
102         .pcd            = 0,
103
104         .init           = h6300_panel_init,
105         .cleanup        = h6300_panel_cleanup,
106         .enable         = h6300_panel_enable,
107         .disable        = h6300_panel_disable,
108         .get_caps       = h6300_panel_get_caps,
109 };
110
111 static int h6300_panel_probe(struct platform_device *pdev)
112 {
113         DBGENTER(1);
114         omapfb_register_panel(&h6300_panel);
115         return 0;
116 }
117
118 static int h6300_panel_remove(struct platform_device *pdev)
119 {
120         DBGENTER(1);
121         return 0;
122 }
123
124 static int h6300_panel_suspend(struct platform_device *pdev, pm_message_t mesg)
125 {
126         DBGENTER(1);
127         pca9535_gpio_write(GPIO3, HI);
128         return 0;
129 }
130
131 static int h6300_panel_resume(struct platform_device *pdev)
132 {
133         DBGENTER(1);
134         pca9535_gpio_write(GPIO3, LOW);
135         return 0;
136 }
137
138 struct platform_driver h6300_panel_driver = {
139         .probe          = h6300_panel_probe,
140         .remove         = h6300_panel_remove,
141         .suspend        = h6300_panel_suspend,
142         .resume         = h6300_panel_resume,
143         .driver         = {
144                 .name   = "lcd_h6300",
145                 .owner  = THIS_MODULE,
146         },
147 };
148
149 static int h6300_panel_drv_init(void)
150 {
151         return platform_driver_register(&h6300_panel_driver);
152 }
153
154 static void h6300_panel_drv_cleanup(void)
155 {
156         platform_driver_unregister(&h6300_panel_driver);
157 }
158
159 module_init(h6300_panel_drv_init);
160 module_exit(h6300_panel_drv_cleanup);