Merge branch 'for-linus' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / include / video / display_timing.h
blob28d9d0d566cacf8d2e61f5fed0434421aca696ed
1 /*
2 * Copyright 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de>
4 * description of display timings
6 * This file is released under the GPLv2
7 */
9 #ifndef __LINUX_DISPLAY_TIMING_H
10 #define __LINUX_DISPLAY_TIMING_H
12 #include <linux/bitops.h>
13 #include <linux/types.h>
15 enum display_flags {
16 DISPLAY_FLAGS_HSYNC_LOW = BIT(0),
17 DISPLAY_FLAGS_HSYNC_HIGH = BIT(1),
18 DISPLAY_FLAGS_VSYNC_LOW = BIT(2),
19 DISPLAY_FLAGS_VSYNC_HIGH = BIT(3),
21 /* data enable flag */
22 DISPLAY_FLAGS_DE_LOW = BIT(4),
23 DISPLAY_FLAGS_DE_HIGH = BIT(5),
24 /* drive data on pos. edge */
25 DISPLAY_FLAGS_PIXDATA_POSEDGE = BIT(6),
26 /* drive data on neg. edge */
27 DISPLAY_FLAGS_PIXDATA_NEGEDGE = BIT(7),
28 DISPLAY_FLAGS_INTERLACED = BIT(8),
29 DISPLAY_FLAGS_DOUBLESCAN = BIT(9),
30 DISPLAY_FLAGS_DOUBLECLK = BIT(10),
34 * A single signal can be specified via a range of minimal and maximal values
35 * with a typical value, that lies somewhere inbetween.
37 struct timing_entry {
38 u32 min;
39 u32 typ;
40 u32 max;
44 * Single "mode" entry. This describes one set of signal timings a display can
45 * have in one setting. This struct can later be converted to struct videomode
46 * (see include/video/videomode.h). As each timing_entry can be defined as a
47 * range, one struct display_timing may become multiple struct videomodes.
49 * Example: hsync active high, vsync active low
51 * Active Video
52 * Video ______________________XXXXXXXXXXXXXXXXXXXXXX_____________________
53 * |<- sync ->|<- back ->|<----- active ----->|<- front ->|<- sync..
54 * | | porch | | porch |
56 * HSync _|¯¯¯¯¯¯¯¯¯¯|___________________________________________|¯¯¯¯¯¯¯¯¯
58 * VSync ¯|__________|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|_________
60 struct display_timing {
61 struct timing_entry pixelclock;
63 struct timing_entry hactive; /* hor. active video */
64 struct timing_entry hfront_porch; /* hor. front porch */
65 struct timing_entry hback_porch; /* hor. back porch */
66 struct timing_entry hsync_len; /* hor. sync len */
68 struct timing_entry vactive; /* ver. active video */
69 struct timing_entry vfront_porch; /* ver. front porch */
70 struct timing_entry vback_porch; /* ver. back porch */
71 struct timing_entry vsync_len; /* ver. sync len */
73 enum display_flags flags; /* display flags */
77 * This describes all timing settings a display provides.
78 * The native_mode is the default setting for this display.
79 * Drivers that can handle multiple videomodes should work with this struct and
80 * convert each entry to the desired end result.
82 struct display_timings {
83 unsigned int num_timings;
84 unsigned int native_mode;
86 struct display_timing **timings;
89 /* get one entry from struct display_timings */
90 static inline struct display_timing *display_timings_get(const struct
91 display_timings *disp,
92 unsigned int index)
94 if (disp->num_timings > index)
95 return disp->timings[index];
96 else
97 return NULL;
100 void display_timings_release(struct display_timings *disp);
102 #endif