diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-05-10 06:02:32 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2013-06-17 07:00:47 -0400 |
commit | 6fcd485b04e67c370026b41a951e0dc410a8d47b (patch) | |
tree | 7ff169ed707a68c491e6967b7f1dfa6027f2a1bb /drivers/video/omap2/dss/display.c | |
parent | 7e436bb2e3b14706a8bbed21d8d244a89199a907 (diff) |
OMAPDSS: add videomode conversion support
Add helper functions to convert between omapdss specific video timings
and the common videomode.
Eventually omapdss will be changed to use only the common video timings,
and these helper functions will make the transition easier.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss/display.c')
-rw-r--r-- | drivers/video/omap2/dss/display.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c index 0aa8ad8f9667..72ac058a56d3 100644 --- a/drivers/video/omap2/dss/display.c +++ b/drivers/video/omap2/dss/display.c | |||
@@ -219,3 +219,72 @@ void omap_dss_stop_device(struct omap_dss_device *dssdev) | |||
219 | } | 219 | } |
220 | EXPORT_SYMBOL(omap_dss_stop_device); | 220 | EXPORT_SYMBOL(omap_dss_stop_device); |
221 | 221 | ||
222 | void videomode_to_omap_video_timings(const struct videomode *vm, | ||
223 | struct omap_video_timings *ovt) | ||
224 | { | ||
225 | memset(ovt, 0, sizeof(*ovt)); | ||
226 | |||
227 | ovt->pixel_clock = vm->pixelclock / 1000; | ||
228 | ovt->x_res = vm->hactive; | ||
229 | ovt->hbp = vm->hback_porch; | ||
230 | ovt->hfp = vm->hfront_porch; | ||
231 | ovt->hsw = vm->hsync_len; | ||
232 | ovt->y_res = vm->vactive; | ||
233 | ovt->vbp = vm->vback_porch; | ||
234 | ovt->vfp = vm->vfront_porch; | ||
235 | ovt->vsw = vm->vsync_len; | ||
236 | |||
237 | ovt->vsync_level = vm->flags & DISPLAY_FLAGS_VSYNC_HIGH ? | ||
238 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
239 | OMAPDSS_SIG_ACTIVE_LOW; | ||
240 | ovt->hsync_level = vm->flags & DISPLAY_FLAGS_HSYNC_HIGH ? | ||
241 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
242 | OMAPDSS_SIG_ACTIVE_LOW; | ||
243 | ovt->de_level = vm->flags & DISPLAY_FLAGS_DE_HIGH ? | ||
244 | OMAPDSS_SIG_ACTIVE_HIGH : | ||
245 | OMAPDSS_SIG_ACTIVE_HIGH; | ||
246 | ovt->data_pclk_edge = vm->flags & DISPLAY_FLAGS_PIXDATA_POSEDGE ? | ||
247 | OMAPDSS_DRIVE_SIG_RISING_EDGE : | ||
248 | OMAPDSS_DRIVE_SIG_FALLING_EDGE; | ||
249 | |||
250 | ovt->sync_pclk_edge = OMAPDSS_DRIVE_SIG_OPPOSITE_EDGES; | ||
251 | } | ||
252 | EXPORT_SYMBOL(videomode_to_omap_video_timings); | ||
253 | |||
254 | void omap_video_timings_to_videomode(const struct omap_video_timings *ovt, | ||
255 | struct videomode *vm) | ||
256 | { | ||
257 | memset(vm, 0, sizeof(*vm)); | ||
258 | |||
259 | vm->pixelclock = ovt->pixel_clock * 1000; | ||
260 | |||
261 | vm->hactive = ovt->x_res; | ||
262 | vm->hback_porch = ovt->hbp; | ||
263 | vm->hfront_porch = ovt->hfp; | ||
264 | vm->hsync_len = ovt->hsw; | ||
265 | vm->vactive = ovt->y_res; | ||
266 | vm->vback_porch = ovt->vbp; | ||
267 | vm->vfront_porch = ovt->vfp; | ||
268 | vm->vsync_len = ovt->vsw; | ||
269 | |||
270 | if (ovt->hsync_level == OMAPDSS_SIG_ACTIVE_HIGH) | ||
271 | vm->flags |= DISPLAY_FLAGS_HSYNC_HIGH; | ||
272 | else | ||
273 | vm->flags |= DISPLAY_FLAGS_HSYNC_LOW; | ||
274 | |||
275 | if (ovt->vsync_level == OMAPDSS_SIG_ACTIVE_HIGH) | ||
276 | vm->flags |= DISPLAY_FLAGS_VSYNC_HIGH; | ||
277 | else | ||
278 | vm->flags |= DISPLAY_FLAGS_VSYNC_LOW; | ||
279 | |||
280 | if (ovt->de_level == OMAPDSS_SIG_ACTIVE_HIGH) | ||
281 | vm->flags |= DISPLAY_FLAGS_DE_HIGH; | ||
282 | else | ||
283 | vm->flags |= DISPLAY_FLAGS_DE_LOW; | ||
284 | |||
285 | if (ovt->data_pclk_edge == OMAPDSS_DRIVE_SIG_RISING_EDGE) | ||
286 | vm->flags |= DISPLAY_FLAGS_PIXDATA_POSEDGE; | ||
287 | else | ||
288 | vm->flags |= DISPLAY_FLAGS_PIXDATA_NEGEDGE; | ||
289 | } | ||
290 | EXPORT_SYMBOL(omap_video_timings_to_videomode); | ||