Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / video / omap / lcd_ams_delta.c
1 /*
2  * Based on drivers/video/omap/lcd_inn1510.c
3  *
4  * LCD panel support for the Amstrad E3 (Delta) videophone.
5  *
6  * Copyright (C) 2006 Jonathan McDowell <noodles@earth.li>
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #include <linux/module.h>
24 #include <linux/platform_device.h>
25 #include <linux/io.h>
26 #include <linux/delay.h>
27
28 #include <plat/board-ams-delta.h>
29 #include <mach/hardware.h>
30
31 #include "omapfb.h"
32
33 #define AMS_DELTA_DEFAULT_CONTRAST      112
34
35 static int ams_delta_panel_init(struct lcd_panel *panel,
36                 struct omapfb_device *fbdev)
37 {
38         return 0;
39 }
40
41 static void ams_delta_panel_cleanup(struct lcd_panel *panel)
42 {
43 }
44
45 static int ams_delta_panel_enable(struct lcd_panel *panel)
46 {
47         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_NDISP,
48                         AMS_DELTA_LATCH2_LCD_NDISP);
49         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN,
50                         AMS_DELTA_LATCH2_LCD_VBLEN);
51
52         omap_writeb(1, OMAP_PWL_CLK_ENABLE);
53         omap_writeb(AMS_DELTA_DEFAULT_CONTRAST, OMAP_PWL_ENABLE);
54
55         return 0;
56 }
57
58 static void ams_delta_panel_disable(struct lcd_panel *panel)
59 {
60         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_VBLEN, 0);
61         ams_delta_latch2_write(AMS_DELTA_LATCH2_LCD_NDISP, 0);
62 }
63
64 static unsigned long ams_delta_panel_get_caps(struct lcd_panel *panel)
65 {
66         return 0;
67 }
68
69 static struct lcd_panel ams_delta_panel = {
70         .name           = "ams-delta",
71         .config         = 0,
72
73         .bpp            = 12,
74         .data_lines     = 16,
75         .x_res          = 480,
76         .y_res          = 320,
77         .pixel_clock    = 4687,
78         .hsw            = 3,
79         .hfp            = 1,
80         .hbp            = 1,
81         .vsw            = 1,
82         .vfp            = 0,
83         .vbp            = 0,
84         .pcd            = 0,
85         .acb            = 37,
86
87         .init           = ams_delta_panel_init,
88         .cleanup        = ams_delta_panel_cleanup,
89         .enable         = ams_delta_panel_enable,
90         .disable        = ams_delta_panel_disable,
91         .get_caps       = ams_delta_panel_get_caps,
92 };
93
94 static int ams_delta_panel_probe(struct platform_device *pdev)
95 {
96         omapfb_register_panel(&ams_delta_panel);
97         return 0;
98 }
99
100 static int ams_delta_panel_remove(struct platform_device *pdev)
101 {
102         return 0;
103 }
104
105 static int ams_delta_panel_suspend(struct platform_device *pdev,
106                 pm_message_t mesg)
107 {
108         return 0;
109 }
110
111 static int ams_delta_panel_resume(struct platform_device *pdev)
112 {
113         return 0;
114 }
115
116 struct platform_driver ams_delta_panel_driver = {
117         .probe          = ams_delta_panel_probe,
118         .remove         = ams_delta_panel_remove,
119         .suspend        = ams_delta_panel_suspend,
120         .resume         = ams_delta_panel_resume,
121         .driver         = {
122                 .name   = "lcd_ams_delta",
123                 .owner  = THIS_MODULE,
124         },
125 };
126
127 static int __init ams_delta_panel_drv_init(void)
128 {
129         return platform_driver_register(&ams_delta_panel_driver);
130 }
131
132 static void __exit ams_delta_panel_drv_cleanup(void)
133 {
134         platform_driver_unregister(&ams_delta_panel_driver);
135 }
136
137 module_init(ams_delta_panel_drv_init);
138 module_exit(ams_delta_panel_drv_cleanup);