Merge current mainline tree into linux-omap tree
[pandora-kernel.git] / drivers / video / omap / lcd_ams_delta.c
1 /*
2  * File: drivers/video/omap/lcd_ams_delta.c
3  *
4  * Based on drivers/video/omap/lcd_inn1510.c
5  *
6  * LCD panel support for the Amstrad E3 (Delta) videophone.
7  *
8  * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
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/delay.h>
29 #include <asm/io.h>
30
31 #include <mach/board-ams-delta.h>
32 #include <mach/hardware.h>
33 #include <mach/omapfb.h>
34
35 #define AMS_DELTA_DEFAULT_CONTRAST      112
36
37 static int ams_delta_panel_init(struct lcd_panel *panel,
38                 struct omapfb_device *fbdev)
39 {
40         return 0;
41 }
42
43 static void ams_delta_panel_cleanup(struct lcd_panel *panel)
44 {
45 }
46
47 static int ams_delta_panel_enable(struct lcd_panel *panel)
48 {
49         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_NDISP,
50                         AMS_DELTA_LATCH2_LCD_NDISP);
51         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN,
52                         AMS_DELTA_LATCH2_LCD_VBLEN);
53
54         omap_writeb(1, OMAP_PWL_CLK_ENABLE);
55         omap_writeb(AMS_DELTA_DEFAULT_CONTRAST, OMAP_PWL_ENABLE);
56
57         return 0;
58 }
59
60 static void ams_delta_panel_disable(struct lcd_panel *panel)
61 {
62         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN, 0);
63         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_NDISP, 0);
64 }
65
66 static unsigned long ams_delta_panel_get_caps(struct lcd_panel *panel)
67 {
68         return 0;
69 }
70
71 static struct lcd_panel ams_delta_panel = {
72         .name           = "ams-delta",
73         .config         = 0,
74
75         .bpp            = 12,
76         .data_lines     = 16,
77         .x_res          = 480,
78         .y_res          = 320,
79         .pixel_clock    = 4687,
80         .hsw            = 3,
81         .hfp            = 1,
82         .hbp            = 1,
83         .vsw            = 1,
84         .vfp            = 0,
85         .vbp            = 0,
86         .pcd            = 0,
87         .acb            = 37,
88
89         .init           = ams_delta_panel_init,
90         .cleanup        = ams_delta_panel_cleanup,
91         .enable         = ams_delta_panel_enable,
92         .disable        = ams_delta_panel_disable,
93         .get_caps       = ams_delta_panel_get_caps,
94 };
95
96 static int ams_delta_panel_probe(struct platform_device *pdev)
97 {
98         omapfb_register_panel(&ams_delta_panel);
99         return 0;
100 }
101
102 static int ams_delta_panel_remove(struct platform_device *pdev)
103 {
104         return 0;
105 }
106
107 static int ams_delta_panel_suspend(struct platform_device *pdev,
108                 pm_message_t mesg)
109 {
110         return 0;
111 }
112
113 static int ams_delta_panel_resume(struct platform_device *pdev)
114 {
115         return 0;
116 }
117
118 struct platform_driver ams_delta_panel_driver = {
119         .probe          = ams_delta_panel_probe,
120         .remove         = ams_delta_panel_remove,
121         .suspend        = ams_delta_panel_suspend,
122         .resume         = ams_delta_panel_resume,
123         .driver         = {
124                 .name   = "lcd_ams_delta",
125                 .owner  = THIS_MODULE,
126         },
127 };
128
129 static int ams_delta_panel_drv_init(void)
130 {
131         return platform_driver_register(&ams_delta_panel_driver);
132 }
133
134 static void ams_delta_panel_drv_cleanup(void)
135 {
136         platform_driver_unregister(&ams_delta_panel_driver);
137 }
138
139 module_init(ams_delta_panel_drv_init);
140 module_exit(ams_delta_panel_drv_cleanup);