videomode: simplify videomode Kconfig and Makefile
[linux-3.10.git] / drivers / video / videomode.c
1 /*
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
14 int 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
23         vm->pixelclock = display_timing_get_value(&dt->pixelclock, TE_TYP);
24         vm->hactive = display_timing_get_value(&dt->hactive, TE_TYP);
25         vm->hfront_porch = display_timing_get_value(&dt->hfront_porch, TE_TYP);
26         vm->hback_porch = display_timing_get_value(&dt->hback_porch, TE_TYP);
27         vm->hsync_len = display_timing_get_value(&dt->hsync_len, TE_TYP);
28
29         vm->vactive = display_timing_get_value(&dt->vactive, TE_TYP);
30         vm->vfront_porch = display_timing_get_value(&dt->vfront_porch, TE_TYP);
31         vm->vback_porch = display_timing_get_value(&dt->vback_porch, TE_TYP);
32         vm->vsync_len = display_timing_get_value(&dt->vsync_len, TE_TYP);
33
34         vm->dmt_flags = dt->dmt_flags;
35         vm->data_flags = dt->data_flags;
36
37         return 0;
38 }
39 EXPORT_SYMBOL_GPL(videomode_from_timing);