Full support for Ginger Console
[linux-ginger.git] / drivers / video / omap2 / displays / panel-ginger.c
blobc1ba06dee500a71973be0998fdcb1cca9dc3a6df
1 /*
2 * LCD panel driver for Ginger Console
3 * Author: LynxLuna <lynxluna@gmail.com>
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <linux/module.h>
19 #include <linux/delay.h>
21 #include <plat/display.h>
23 static char _lcd_type [10] = "Unknown\0";
25 static struct omap_video_timings ginger_lcd_timing = {
26 .x_res = 480,
27 .y_res = 272,
28 .hsw = 41, /* hsync_len (4) - 1 */
29 .hfp = 2, /* right_margin (4) - 1 */
30 .hbp = 2, /* left_margin (40) - 1 */
31 .vsw = 10, /* vsync_len (2) - 1 */
32 .vfp = 2, /* lower_margin */
33 .vbp = 2, /* upper_margin (8) - 1 */
34 .pixel_clock = 9600,
37 static int ginger_panel_probe(struct omap_dss_device *dssdev)
39 dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS;
40 printk(KERN_INFO "Probing Ginger LCD... [%s]", _lcd_type );
41 dssdev->panel.timings = ginger_lcd_timing;
42 return 0;
45 static void ginger_panel_remove(struct omap_dss_device *dssdev)
49 static int ginger_panel_enable(struct omap_dss_device *dssdev)
51 int r = 0;
53 /* wait couple of vsyncs until enabling the LCD */
54 msleep(50);
56 if (dssdev->platform_enable)
57 r = dssdev->platform_enable(dssdev);
59 return r;
62 static void ginger_panel_disable(struct omap_dss_device *dssdev)
64 if (dssdev->platform_disable)
65 dssdev->platform_disable(dssdev);
67 /* wait at least 5 vsyncs after disabling the LCD */
69 msleep(100);
72 static int ginger_panel_suspend(struct omap_dss_device *dssdev)
74 ginger_panel_disable(dssdev);
75 return 0;
78 static int ginger_panel_resume(struct omap_dss_device *dssdev)
80 return ginger_panel_enable(dssdev);
83 static struct omap_dss_driver ginger_driver = {
84 .probe = ginger_panel_probe,
85 .remove = ginger_panel_remove,
87 .enable = ginger_panel_enable,
88 .disable = ginger_panel_disable,
89 .suspend = ginger_panel_suspend,
90 .resume = ginger_panel_resume,
92 .driver = {
93 .name = "ginger_panel",
94 .owner = THIS_MODULE,
98 static int __init ginger_panel_drv_init(void)
100 printk ("Registering Ginger LCD Driver....");
101 return omap_dss_register_driver(&ginger_driver);
104 static void __exit ginger_panel_drv_exit(void)
106 omap_dss_unregister_driver(&ginger_driver);
109 module_param_string(lcd,_lcd_type, 10, 0);
111 module_init(ginger_panel_drv_init);
112 module_exit(ginger_panel_drv_exit);
113 MODULE_LICENSE("GPL");