blob: a3d95f263cd525cd319c208e3ae7f0f4aa8120b0 [file] [log] [blame]
Steffen Trumtrar8714c0c2012-12-17 14:20:17 +01001/*
2 * generic display timing functions
3 *
4 * Copyright (c) 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>, Pengutronix
5 *
6 * This file is released under the GPLv2
7 */
8
9#include <linux/errno.h>
10#include <linux/export.h>
11#include <video/display_timing.h>
12#include <video/videomode.h>
13
14int videomode_from_timing(const struct display_timings *disp,
15 struct videomode *vm, unsigned int index)
16{
17 struct display_timing *dt;
18
19 dt = display_timings_get(disp, index);
20 if (!dt)
21 return -EINVAL;
22
Tomi Valkeinen694f0502013-03-12 10:35:16 +020023 vm->pixelclock = dt->pixelclock.typ;
24 vm->hactive = dt->hactive.typ;
25 vm->hfront_porch = dt->hfront_porch.typ;
26 vm->hback_porch = dt->hback_porch.typ;
27 vm->hsync_len = dt->hsync_len.typ;
Steffen Trumtrar8714c0c2012-12-17 14:20:17 +010028
Tomi Valkeinen694f0502013-03-12 10:35:16 +020029 vm->vactive = dt->vactive.typ;
30 vm->vfront_porch = dt->vfront_porch.typ;
31 vm->vback_porch = dt->vback_porch.typ;
32 vm->vsync_len = dt->vsync_len.typ;
Steffen Trumtrar8714c0c2012-12-17 14:20:17 +010033
Tomi Valkeinen06a33072013-03-12 10:26:45 +020034 vm->flags = dt->flags;
Steffen Trumtrar8714c0c2012-12-17 14:20:17 +010035
36 return 0;
37}
38EXPORT_SYMBOL_GPL(videomode_from_timing);