xref: /openbmc/linux/include/drm/drm_displayid.h (revision c4f7ac64)
1 /*
2  * Copyright © 2014 Red Hat Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  */
22 #ifndef DRM_DISPLAYID_H
23 #define DRM_DISPLAYID_H
24 
25 #include <linux/types.h>
26 
27 struct edid;
28 
29 #define DATA_BLOCK_PRODUCT_ID 0x00
30 #define DATA_BLOCK_DISPLAY_PARAMETERS 0x01
31 #define DATA_BLOCK_COLOR_CHARACTERISTICS 0x02
32 #define DATA_BLOCK_TYPE_1_DETAILED_TIMING 0x03
33 #define DATA_BLOCK_TYPE_2_DETAILED_TIMING 0x04
34 #define DATA_BLOCK_TYPE_3_SHORT_TIMING 0x05
35 #define DATA_BLOCK_TYPE_4_DMT_TIMING 0x06
36 #define DATA_BLOCK_VESA_TIMING 0x07
37 #define DATA_BLOCK_CEA_TIMING 0x08
38 #define DATA_BLOCK_VIDEO_TIMING_RANGE 0x09
39 #define DATA_BLOCK_PRODUCT_SERIAL_NUMBER 0x0a
40 #define DATA_BLOCK_GP_ASCII_STRING 0x0b
41 #define DATA_BLOCK_DISPLAY_DEVICE_DATA 0x0c
42 #define DATA_BLOCK_INTERFACE_POWER_SEQUENCING 0x0d
43 #define DATA_BLOCK_TRANSFER_CHARACTERISTICS 0x0e
44 #define DATA_BLOCK_DISPLAY_INTERFACE 0x0f
45 #define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10
46 #define DATA_BLOCK_TILED_DISPLAY 0x12
47 #define DATA_BLOCK_CTA 0x81
48 
49 #define DATA_BLOCK_VENDOR_SPECIFIC 0x7f
50 
51 #define PRODUCT_TYPE_EXTENSION 0
52 #define PRODUCT_TYPE_TEST 1
53 #define PRODUCT_TYPE_PANEL 2
54 #define PRODUCT_TYPE_MONITOR 3
55 #define PRODUCT_TYPE_TV 4
56 #define PRODUCT_TYPE_REPEATER 5
57 #define PRODUCT_TYPE_DIRECT_DRIVE 6
58 
59 struct displayid_header {
60 	u8 rev;
61 	u8 bytes;
62 	u8 prod_id;
63 	u8 ext_count;
64 } __packed;
65 
66 struct displayid_block {
67 	u8 tag;
68 	u8 rev;
69 	u8 num_bytes;
70 } __packed;
71 
72 struct displayid_tiled_block {
73 	struct displayid_block base;
74 	u8 tile_cap;
75 	u8 topo[3];
76 	u8 tile_size[4];
77 	u8 tile_pixel_bezel[5];
78 	u8 topology_id[8];
79 } __packed;
80 
81 struct displayid_detailed_timings_1 {
82 	u8 pixel_clock[3];
83 	u8 flags;
84 	u8 hactive[2];
85 	u8 hblank[2];
86 	u8 hsync[2];
87 	u8 hsw[2];
88 	u8 vactive[2];
89 	u8 vblank[2];
90 	u8 vsync[2];
91 	u8 vsw[2];
92 } __packed;
93 
94 struct displayid_detailed_timing_block {
95 	struct displayid_block base;
96 	struct displayid_detailed_timings_1 timings[];
97 };
98 
99 /* DisplayID iteration */
100 struct displayid_iter {
101 	const struct edid *edid;
102 
103 	const u8 *section;
104 	int length;
105 	int idx;
106 	int ext_index;
107 };
108 
109 void displayid_iter_edid_begin(const struct edid *edid,
110 			       struct displayid_iter *iter);
111 const struct displayid_block *
112 __displayid_iter_next(struct displayid_iter *iter);
113 #define displayid_iter_for_each(__block, __iter) \
114 	while (((__block) = __displayid_iter_next(__iter)))
115 void displayid_iter_end(struct displayid_iter *iter);
116 
117 #endif
118