2 * Generic panel support
4 * Copyright (C) 2008 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published by
9 * the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include <linux/module.h>
21 #include <linux/delay.h>
23 #include <plat/display.h>
25 static struct omap_video_timings generic_panel_timings
= {
26 /* 640 x 480 @ 60 Hz Reduced blanking VESA CVT 0.31M3-R */
38 static int generic_panel_power_on(struct omap_dss_device
*dssdev
)
42 r
= omapdss_dpi_display_enable(dssdev
);
46 if (dssdev
->platform_enable
) {
47 r
= dssdev
->platform_enable(dssdev
);
54 omapdss_dpi_display_disable(dssdev
);
59 static void generic_panel_power_off(struct omap_dss_device
*dssdev
)
61 if (dssdev
->platform_disable
)
62 dssdev
->platform_disable(dssdev
);
64 omapdss_dpi_display_disable(dssdev
);
67 static int generic_panel_probe(struct omap_dss_device
*dssdev
)
69 dssdev
->panel
.config
= OMAP_DSS_LCD_TFT
;
70 dssdev
->panel
.timings
= generic_panel_timings
;
75 static void generic_panel_remove(struct omap_dss_device
*dssdev
)
79 static int generic_panel_enable(struct omap_dss_device
*dssdev
)
83 r
= generic_panel_power_on(dssdev
);
87 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
92 static void generic_panel_disable(struct omap_dss_device
*dssdev
)
94 generic_panel_power_off(dssdev
);
96 dssdev
->state
= OMAP_DSS_DISPLAY_DISABLED
;
99 static int generic_panel_suspend(struct omap_dss_device
*dssdev
)
101 generic_panel_power_off(dssdev
);
102 dssdev
->state
= OMAP_DSS_DISPLAY_SUSPENDED
;
106 static int generic_panel_resume(struct omap_dss_device
*dssdev
)
110 r
= generic_panel_power_on(dssdev
);
114 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
119 static void generic_panel_set_timings(struct omap_dss_device
*dssdev
,
120 struct omap_video_timings
*timings
)
122 dpi_set_timings(dssdev
, timings
);
125 static void generic_panel_get_timings(struct omap_dss_device
*dssdev
,
126 struct omap_video_timings
*timings
)
128 *timings
= dssdev
->panel
.timings
;
131 static int generic_panel_check_timings(struct omap_dss_device
*dssdev
,
132 struct omap_video_timings
*timings
)
134 return dpi_check_timings(dssdev
, timings
);
137 static struct omap_dss_driver generic_driver
= {
138 .probe
= generic_panel_probe
,
139 .remove
= generic_panel_remove
,
141 .enable
= generic_panel_enable
,
142 .disable
= generic_panel_disable
,
143 .suspend
= generic_panel_suspend
,
144 .resume
= generic_panel_resume
,
146 .set_timings
= generic_panel_set_timings
,
147 .get_timings
= generic_panel_get_timings
,
148 .check_timings
= generic_panel_check_timings
,
151 .name
= "generic_panel",
152 .owner
= THIS_MODULE
,
156 static int __init
generic_panel_drv_init(void)
158 return omap_dss_register_driver(&generic_driver
);
161 static void __exit
generic_panel_drv_exit(void)
163 omap_dss_unregister_driver(&generic_driver
);
166 module_init(generic_panel_drv_init
);
167 module_exit(generic_panel_drv_exit
);
168 MODULE_LICENSE("GPL");