Commit | Line | Data |
---|---|---|
8714c0ce ST |
1 | /* |
2 | * Copyright 2012 Steffen Trumtrar <s.trumtrar@pengutronix.de> | |
3 | * | |
4 | * description of display timings | |
5 | * | |
6 | * This file is released under the GPLv2 | |
7 | */ | |
8 | ||
9 | #ifndef __LINUX_DISPLAY_TIMING_H | |
10 | #define __LINUX_DISPLAY_TIMING_H | |
11 | ||
12 | #include <linux/bitops.h> | |
13 | #include <linux/types.h> | |
14 | ||
32ed6ef1 TV |
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), | |
20 | ||
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 | }; | |
8714c0ce ST |
31 | |
32 | /* | |
33 | * A single signal can be specified via a range of minimal and maximal values | |
34 | * with a typical value, that lies somewhere inbetween. | |
35 | */ | |
36 | struct timing_entry { | |
37 | u32 min; | |
38 | u32 typ; | |
39 | u32 max; | |
40 | }; | |
41 | ||
8714c0ce ST |
42 | /* |
43 | * Single "mode" entry. This describes one set of signal timings a display can | |
44 | * have in one setting. This struct can later be converted to struct videomode | |
45 | * (see include/video/videomode.h). As each timing_entry can be defined as a | |
46 | * range, one struct display_timing may become multiple struct videomodes. | |
47 | * | |
48 | * Example: hsync active high, vsync active low | |
49 | * | |
50 | * Active Video | |
51 | * Video ______________________XXXXXXXXXXXXXXXXXXXXXX_____________________ | |
52 | * |<- sync ->|<- back ->|<----- active ----->|<- front ->|<- sync.. | |
53 | * | | porch | | porch | | |
54 | * | |
55 | * HSync _|¯¯¯¯¯¯¯¯¯¯|___________________________________________|¯¯¯¯¯¯¯¯¯ | |
56 | * | |
57 | * VSync ¯|__________|¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|_________ | |
58 | */ | |
59 | struct display_timing { | |
60 | struct timing_entry pixelclock; | |
61 | ||
62 | struct timing_entry hactive; /* hor. active video */ | |
63 | struct timing_entry hfront_porch; /* hor. front porch */ | |
64 | struct timing_entry hback_porch; /* hor. back porch */ | |
65 | struct timing_entry hsync_len; /* hor. sync len */ | |
66 | ||
67 | struct timing_entry vactive; /* ver. active video */ | |
68 | struct timing_entry vfront_porch; /* ver. front porch */ | |
69 | struct timing_entry vback_porch; /* ver. back porch */ | |
70 | struct timing_entry vsync_len; /* ver. sync len */ | |
71 | ||
32ed6ef1 | 72 | enum display_flags flags; /* display flags */ |
8714c0ce ST |
73 | }; |
74 | ||
75 | /* | |
76 | * This describes all timing settings a display provides. | |
77 | * The native_mode is the default setting for this display. | |
78 | * Drivers that can handle multiple videomodes should work with this struct and | |
79 | * convert each entry to the desired end result. | |
80 | */ | |
81 | struct display_timings { | |
82 | unsigned int num_timings; | |
83 | unsigned int native_mode; | |
84 | ||
85 | struct display_timing **timings; | |
86 | }; | |
87 | ||
8714c0ce ST |
88 | /* get one entry from struct display_timings */ |
89 | static inline struct display_timing *display_timings_get(const struct | |
90 | display_timings *disp, | |
91 | unsigned int index) | |
92 | { | |
93 | if (disp->num_timings > index) | |
94 | return disp->timings[index]; | |
95 | else | |
96 | return NULL; | |
97 | } | |
98 | ||
99 | void display_timings_release(struct display_timings *disp); | |
100 | ||
101 | #endif |