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 if (dssdev
->state
== OMAP_DSS_DISPLAY_ACTIVE
)
45 r
= omapdss_dpi_display_enable(dssdev
);
49 if (dssdev
->platform_enable
) {
50 r
= dssdev
->platform_enable(dssdev
);
57 omapdss_dpi_display_disable(dssdev
);
62 static void generic_panel_power_off(struct omap_dss_device
*dssdev
)
64 if (dssdev
->state
!= OMAP_DSS_DISPLAY_ACTIVE
)
67 if (dssdev
->platform_disable
)
68 dssdev
->platform_disable(dssdev
);
70 omapdss_dpi_display_disable(dssdev
);
73 static int generic_panel_probe(struct omap_dss_device
*dssdev
)
75 dssdev
->panel
.config
= OMAP_DSS_LCD_TFT
;
76 dssdev
->panel
.timings
= generic_panel_timings
;
81 static void generic_panel_remove(struct omap_dss_device
*dssdev
)
85 static int generic_panel_enable(struct omap_dss_device
*dssdev
)
89 r
= generic_panel_power_on(dssdev
);
93 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
98 static void generic_panel_disable(struct omap_dss_device
*dssdev
)
100 generic_panel_power_off(dssdev
);
102 dssdev
->state
= OMAP_DSS_DISPLAY_DISABLED
;
105 static int generic_panel_suspend(struct omap_dss_device
*dssdev
)
107 generic_panel_power_off(dssdev
);
108 dssdev
->state
= OMAP_DSS_DISPLAY_SUSPENDED
;
112 static int generic_panel_resume(struct omap_dss_device
*dssdev
)
116 r
= generic_panel_power_on(dssdev
);
120 dssdev
->state
= OMAP_DSS_DISPLAY_ACTIVE
;
125 static void generic_panel_set_timings(struct omap_dss_device
*dssdev
,
126 struct omap_video_timings
*timings
)
128 dpi_set_timings(dssdev
, timings
);
131 static void generic_panel_get_timings(struct omap_dss_device
*dssdev
,
132 struct omap_video_timings
*timings
)
134 *timings
= dssdev
->panel
.timings
;
137 static int generic_panel_check_timings(struct omap_dss_device
*dssdev
,
138 struct omap_video_timings
*timings
)
140 return dpi_check_timings(dssdev
, timings
);
143 static struct omap_dss_driver generic_driver
= {
144 .probe
= generic_panel_probe
,
145 .remove
= generic_panel_remove
,
147 .enable
= generic_panel_enable
,
148 .disable
= generic_panel_disable
,
149 .suspend
= generic_panel_suspend
,
150 .resume
= generic_panel_resume
,
152 .set_timings
= generic_panel_set_timings
,
153 .get_timings
= generic_panel_get_timings
,
154 .check_timings
= generic_panel_check_timings
,
157 .name
= "generic_panel",
158 .owner
= THIS_MODULE
,
162 static int __init
generic_panel_drv_init(void)
164 return omap_dss_register_driver(&generic_driver
);
167 static void __exit
generic_panel_drv_exit(void)
169 omap_dss_unregister_driver(&generic_driver
);
172 module_init(generic_panel_drv_init
);
173 module_exit(generic_panel_drv_exit
);
174 MODULE_LICENSE("GPL");