staging: emgd: experimental build 2667
[profile/ivi/intel-emgd-kmod.git] / emgd / include / displayid.h
1 /*
2  *-----------------------------------------------------------------------------
3  * Filename: displayid.h
4  * $Revision: 1.10 $
5  *-----------------------------------------------------------------------------
6  * Copyright (c) 2002-2010, Intel Corporation.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a copy
9  * of this software and associated documentation files (the "Software"), to deal
10  * in the Software without restriction, including without limitation the rights
11  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12  * copies of the Software, and to permit persons to whom the Software is
13  * furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24  * THE SOFTWARE.
25  *
26  *-----------------------------------------------------------------------------
27  * Description:
28  *  Header file for DisplayID.
29  *  Supported DisplayID versions:
30  *  VESA DisplayID Standard Verion 1 12/13/2007
31  *-----------------------------------------------------------------------------
32  */
33
34 #ifndef _DISPLAYID_H
35 #define _DISPLAYID_H
36
37 #include <pd.h>
38
39 /* Max limits for DisplayID structure members */
40 #define DISPLAYID_MAX_RANGES        5
41 #define DISPLAYID_MAX_NUM_TIMINGS   5
42 /* Possible attributes from DisplayID:
43  *     T1, T2, T3, T4, T5
44  *     dual_channel
45  *     panel_depth
46  *     panel_type */
47 #define DISPLAYID_MAX_ATTRS        10
48
49 /* DisplayID return values */
50 #define DISPLAYID_ERROR_PARSE      1
51 #define DISPLAYID_READ_AGAIN       2
52 #define DISPLAYID_NOT_SUPPORTED    3
53
54 /* Print line macro */
55 #define DISPLAYID_PRINT_LINE() \
56         EMGD_DEBUG("----------------------------------------------------------")
57
58 /* DisplayID Product Type Identifiers */
59 #define PRODUCTID_EXTENSION        0x00
60 #define PRODUCTID_TEST             0x01
61 #define PRODUCTID_PANEL            0x02
62 #define PRODUCTID_STANDALONE       0x03
63 #define PRODUCTID_TV_RECEIVER      0x04
64 #define PRODUCTID_REPEATER         0x05
65
66 /* DisplayID Data Block Tags */
67 #define DATABLOCK_PRODUCTID        0x00
68 #define DATABLOCK_DISPLAY_PARAMS   0x01
69 #define DATABLOCK_COLOR_CHARS      0x02
70 #define DATABLOCK_TIMING_1_DETAIL  0x03
71 #define DATABLOCK_TIMING_2_DETAIL  0x04
72 #define DATABLOCK_TIMING_3_SHORT   0x05
73 #define DATABLOCK_TIMING_4_DMTID   0x06
74 #define DATABLOCK_VESA_TIMING_STD  0x07
75 #define DATABLOCK_CEA_TIMING_STD   0x08
76 #define DATABLOCK_VIDEO_RANGE      0x09
77 #define DATABLOCK_SERIAL_NUMBER    0x0A
78 #define DATABLOCK_ASCII_STRING     0x0B
79 #define DATABLOCK_DISPLAY_DEVICE   0x0C
80 #define DATABLOCK_LVDS_INTERFACE   0x0D
81 #define DATABLOCK_TRANSFER_CHAR    0x0E
82 #define DATABLOCK_DISPLAY_INTF     0x0F
83 #define DATABLOCK_STEREO_INTF      0x10
84 #define DATABLOCK_VENDOR_SPECIFIC  0x7F
85 #define DATABLOCK_RESERVED         0x80
86
87 /*
88  * typedef struct __attribute__((packed)) {
89  * } foo_t;
90  * This isn't available with Microsoft C compiler
91  * So use pragma to enable bytewise packing and at the end
92  * put it back to default.
93  */
94 #pragma pack(1)
95 /* General Data Block header - Max 251 bytes */
96 typedef struct _datablock {
97         unsigned char  tag;                /* data block type */
98         unsigned char  revision:3;
99         unsigned char  reserved:5;
100         unsigned char  payload;
101         unsigned char  payload_data[248];
102 } datablock_t;
103
104 /* Video Timing Range Limits Data Block.
105  * Note:
106  *   It is used to convey to a source the supported range of vertical and
107  *   horizontal frequencies along with the maximum supported pixel clock.
108  *   For a continuous frequency device any timing that lies within the
109  *   specified range will ensure a displayable image. The picture may not
110  *   be properly sized or centered, as guaranteed with explicitly reported
111  *   timing, but however the display should synchronize to the timing.
112  */
113
114 typedef struct _timing_range {
115         unsigned char  tag;                 /* data block type */
116         unsigned char  revision:3;
117         unsigned char  reserved:5;
118         unsigned char  payload;
119
120         struct {
121                 unsigned short lsb_min_dclk;
122                 unsigned char  msb_min_dclk;
123         } mindclk;
124         struct {
125                 unsigned short lsb_max_dclk;
126                 unsigned char  msb_max_dclk;
127         } maxdclk;
128         unsigned char  min_hrate;           /* KHz */
129         unsigned char  max_hrate;           /* KHz */
130         unsigned short min_hblank;          /* Pixels */
131         unsigned char  min_vrate;           /* Hz */
132         unsigned char  max_vrate;           /* Hz */
133         unsigned short min_vblank;          /* Lines */
134
135         /* Timing support flags */
136         unsigned char  reserved1:4;
137         unsigned char  discrete_display:1;
138         unsigned char  vesa_cvt_rb:1;
139         unsigned char  vesa_cvt_std:1;
140         unsigned char  interlaced:1;
141
142         /* Because there is no way to define a 3-byte quantity it is not possible
143          * to directly read the dclks into member variables automatically.
144          * Therefore 1st read into above dclk bytes and then copy values into
145          * below fields at the time of parsing. */
146         /* Below members are outside Data Block definition */
147         unsigned long  min_dclk;            /* KHz */
148         unsigned long  max_dclk;            /* KHz */
149 } timing_range_t;
150
151 /* Data Block Display params - Video input id */
152 #define VIDEO_INPUT_LVDS    0x01
153 #define VIDEO_INPUT_TMDS    0x02
154 #define VIDEO_INPUT_RSDS    0x03
155 #define VIDEO_INPUT_DVID    0x04
156 #define VIDEO_INPUT_DVII    0x05
157 #define VIDEO_INPUT_VESA_M1 0x06
158 #define VIDEO_INPUT_HDMI_A  0x07
159 #define VIDEO_INPUT_HDMI_B  0x08
160 #define VIDEO_INPUT_MDDI    0x09
161 #define VIDEO_INPUT_PORT    0x0A
162 #define VIDEO_INPUT_1394    0x0B
163 #define VIDEO_INPUT_USB     0x0C
164
165 /* Aspect Ratios */
166 #define TIMING_AR_1_1       0x0    /* 3-bits */
167 #define TIMING_AR_5_4       0x1
168 #define TIMING_AR_4_3       0x2
169 #define TIMING_AR_15_9      0x3
170 #define TIMING_AR_16_9      0x4
171 #define TIMING_AR_16_10     0x5
172
173 /* Data Block Display params - feature support flags */
174 typedef struct _display_params {
175         unsigned char  tag;                /* data block type */
176         unsigned char  revision:3;
177         unsigned char  reserved:5;
178         unsigned char  payload;
179
180         unsigned short horz_image_size;    /* horizontal image size in 0.1 mm */
181         unsigned short vert_image_size;    /* vertical image size in 0.1 mm */
182         unsigned short horz_pixels;        /* horizontal pixels */
183         unsigned short vert_pixels;        /* vertical pixels */
184
185         /* Display feature support flags */
186         unsigned char  deinterlacing:1;    /* de-interlacing capable display */
187         unsigned char  reserved1:1;
188         unsigned char  fixed_res:1;        /* fixed resolution display */
189         unsigned char  fixed_timing:1;     /* fixed timing display */
190         unsigned char  dpm_capable:1;      /* VESA DPM capable display */
191         unsigned char  audio_override:1;   /* override audio on video interface */
192         unsigned char  seperate_audio:1;   /* seperate audio input is available */
193         unsigned char  audio_on_video:1;   /* audio available on video interface */
194
195         unsigned char  transfer_gamma;     /* transfer characteristic gamma */
196         unsigned char  aspect_ratio;       /* aspect ratio */
197         unsigned char  native_color_depth:4; /* color bit depth */
198         unsigned char  overall_color_depth:4;/* color bit depth */
199 } display_params_t;
200
201
202 /* Product Identification Data Block */
203 typedef struct _productid {
204         unsigned char  tag;                /* data block type */
205         unsigned char  revision:3;
206         unsigned char  reserved:5;
207         unsigned char  payload;
208
209         char           vendor[3];          /* vendor name code, no NULL char */
210         unsigned short product_code;       /* product code */
211         unsigned long  serial_number;      /* 32-bit serial number */
212         unsigned char  manf_week;          /* manufactured week number */
213         unsigned char  manf_year;          /* # of years after 2000 */
214         unsigned char  string_size;        /* product id string size */
215         char           string[237];        /* product id string max 236 + NULL */
216 } productid_t;
217
218 /* Color Characteristices Data Block */
219 typedef struct _color_char {
220         unsigned char  tag;                /* data block type */
221         unsigned char  revision:3;
222         unsigned char  reserved:5;
223         unsigned char  payload;
224
225         unsigned char  white_points:4;
226         unsigned char  primaries:3;
227         unsigned char  temporal_color:1;
228
229         unsigned short color_x_value:12;   /* 1.5 bytes */
230         unsigned short color_y_value:12;   /* 1.5 bytes: 0.5 from above */
231 } color_char_t;
232
233 /* Type 1 - DTD - 20 bytes
234  * Notes:
235  * 1. In a Data Block, maximum of 12DTDs x 20bytes = 240bytes can fit.
236  * 2. As part of parsing, DTD data will be read into type1_dtd_t then
237  *    converted into pd_timing_t for IEGD consumption.
238  * 3. There is no limit on maximum number of type 1 timings.
239  *    They can be present not only in basic section but also in the
240  *    extension section as well.
241  */
242 typedef struct _type1_dtd {
243         struct {
244                 unsigned short lsb_dclk;
245                 unsigned char  msb_dclk;
246         } dclk;                                  /*  02-00 [07:00] */
247
248         /* timing options - 1 byte */
249         unsigned char  aspect_ratio:3;
250         unsigned char  reserved:1;
251         unsigned char  interlaced:1;
252         unsigned char  stereo_3d_support:2;
253         unsigned char  preferred:1;
254
255         unsigned short hactive;
256         unsigned short hblank;
257         unsigned short hsync_offset:15;
258         unsigned short hsync_polarity:1;
259         unsigned short hsync_width;
260         unsigned short vactive;
261         unsigned short vblank;
262         unsigned short vsync_offset:15;
263         unsigned short vsync_polarity:1;
264         unsigned short vsync_width;
265 } type1_dtd_t;
266
267 /* Type 2 - DTD - 11 bytes
268  * Notes:
269  * 1. In a Data Block, maximum of 22DTDs x 11bytes = 242bytes can fit.
270  * 2. As part of parsing, DTD data will be read into type2_dtd_t then
271  *    converted into pd_timing_t for IEGD consumption.
272  * 3. There is no limit on maximum number of type 2 timings.
273  *    They can be present not only in basic section but also in the
274  *    extension section as well.
275  */
276 typedef struct _type2_dtd {                   /* bytes: [bits] */
277         struct {
278                 unsigned short lsb_dclk;
279                 unsigned char  msb_dclk;
280         } dclk;                                  /*  02-00 [07:00] */
281
282         /* timing options - 1 byte */
283         unsigned char  reserved:4;                /*     03 [03:00] */
284         unsigned char  interlaced:1;              /*     03 [04:04] */
285         unsigned char  stereo_3d_support:2;       /*     03 [06:05] */
286         unsigned char  preferred:1;               /*     03 [07:07] */
287
288         unsigned short hactive:9;                 /*  05-04 [08:00] */
289         unsigned short hblank:7;                  /*  05-04 [15:09] */
290         unsigned char  hsync_width:4;             /*     06 [03:00] */
291         unsigned char  hsync_offset:4;            /*     06 [07:04] */
292         unsigned short vactive:12;                /*  08-07 [11:00] */
293         unsigned short reserved1:4;               /*     08 [15:12] */
294
295         unsigned char  vblank;                    /*     09 [07:00] */
296         unsigned char  vsync_width:4;             /*     10 [03:00] */
297         unsigned char  vsync_offset:4;            /*     10 [07:04] */
298 } type2_dtd_t;
299
300
301 /* Type 3 - DTD - CVT - 3 bytes
302  * Notes:
303  * 1. In a Data Block, maximum of 82timings x 3bytes = 246bytes can fit.
304  * 2. As part of parsing, data will be read into type3_cvt_t then
305  *    it will be made available for IEGD consumption
306  *    either
307  *         by marking in standard timing table
308  *    or
309  *         creating and inserting in pd_timing_t
310  *    based on CVT formula.
311  * 3. There is no limit on maximum number of type 3 timings.
312  *    They can be present not only in basic section but also in the
313  *    extension section as well.
314  */
315 typedef struct _type3_cvt {                   /* bytes: [bits] */
316         /* byte 0 - timing options */
317         unsigned char  aspect_ratio:4;
318         unsigned char  cvt_formula:3;
319         unsigned char  preferred:1;
320
321         /* byte 1 - horizontal active */
322         unsigned char  hactive;
323
324         /* byte 2 - other info */
325         unsigned char  refresh:7;
326         unsigned char  interlaced:1;
327 } type3_cvt_t;
328
329 /* Structure to emulate bit fields for Type1 Std or Type2 CEA timings */
330 typedef struct _type_std {
331         unsigned short width;
332         unsigned short height;
333         unsigned short refresh;
334         unsigned long  flags;         /* currently interlaced, rb, aspect ratio */
335 } type_std_t;
336
337 /* Display Device Data Block */
338 /* Analog interface subtype codes */
339 #define ANALOG_15HD_VGA     0x0
340 #define ANALOG_VESA_NAVI_V  0x1
341 #define ANALOG_VESA_NAVI_D  0x2
342
343 /* Device technology types */
344 #define TECH_CRT            0x0
345 #define TECH_LVDS           0x1
346 #define TECH_PLASMA         0x2
347 #define TECH_EL             0x3   /* Electroluminescent */
348 #define TECH_INORG          0x4
349 #define TECH_ORG            0x5
350 #define TECH_FED            0x6   /* FED or sim. "cold cathode" */
351 #define TECH_EP             0x7   /* Electrophoretic */
352 #define TECH_EC             0x8   /* Electrochromic */
353 #define TECH_EM             0x9   /* Electromechanical */
354 #define TECH_EW             0xA   /* Electrowetting */
355 #define TECH_OTHER          0xF   /* Othertype not defined here */
356
357 /* Device technoloty sub-types */
358 #define TECH_CRT_MONO       0x0   /* Mono chrome CRT */
359 #define TECH_CRT_STD        0x1   /* Standard tricolor CRT */
360 #define TECH_CRT_OTHER      0x2   /* other or undefined */
361
362 #define TECH_LVDS_PASSIVE_TN 0x0  /* Passive matrix TN */
363 #define TECH_LVDS_PASSIVE_CL 0x1  /* Passive matrix cholesteric LC */
364 #define TECH_LVDS_PASSIVE_FE 0x2  /* Passive matrix ferroelectric LC */
365 #define TECH_LVDS_PASSIVE_OT 0x3  /* Passive matrix other LC */
366 #define TECH_LVDS_ACTIVE_TN  0x4  /* Active matrix TN */
367 #define TECH_LVDS_ACTIVE_IPS 0x5  /* Active matrix IPS */
368 #define TECH_LVDS_ACTIVE_VA  0x6  /* Active matrix VA */
369 #define TECH_LVDS_ACTIVE_OCB 0x7  /* Active matrix OCB */
370 #define TECH_LVDS_ACTIVE_FL  0x8  /* Active matrix ferroelectric */
371 #define TECH_LVDS_OTHER      0xF  /* Other LVDS technology not defined above */
372
373 #define TECH_PLASMA_DC       0x0  /* DC plasma */
374 #define TECH_PLASMA_AC       0x1  /* AC plasma */
375
376 /* Content protection support */
377 #define CP_NOCP              0x0
378 #define CP_DTCP              0x2
379 #define CP_DPCP              0x3  /* Display port content protection */
380
381 /* Display physical orientation information */
382 #define DEFAULT_ORIENTATION(a)          ((a & 0xC0) >> 6)
383 #define ZERO_PIXEL(a)                           ((a & 0x0C) >> 2)
384 #define SCAN_DIRECTION(a)                       (a & 0x03)
385
386 #define SCAN_DIRECTION_LONG             0x1 /* Display scan direction (2 bits) */
387 #define SCAN_DIRECTION_SHORT            0x2
388
389 #define ZP_UPPER_LEFT                           0x0 /* Zero pixel position (2 bits) */
390 #define ZP_UPPER_RIGHT                          0x1
391 #define ZP_LOWER_LEFT                           0x2
392 #define ZP_LOWER_RIGHT                          0x3
393
394 #define DEF_ORIENTATION_LANDSCAPE       0x0 /* Default orientation (2 bits) */
395 #define DEF_ORIENTATION_PORTRAIT        0x1
396 #define DEF_ORIENTATION_UNKNOWN         0x2
397
398
399 typedef struct _display_device {
400         unsigned char  tag;                /* data block type */
401         unsigned char  revision:3;
402         unsigned char  reserved:5;
403         unsigned char  payload;
404
405         unsigned char  tech_subtype:4;
406         unsigned char  tech_type:4;
407         unsigned char  reserved1:2;
408         unsigned char  can_on_off_bklt:1;  /* This bit tells backlight can be
409                                                                                 * switched on or off using the control
410                                                                                 * method defined */
411         unsigned char  can_change_bklt:1;  /* This bit tells backlight intensity
412                                                                                 * can be changed using the control
413                                                                                 * method defined */
414         unsigned char  op_mode:4;
415
416         unsigned short horz_pixel_count;
417         unsigned short vert_pixel_count;
418         unsigned char  aspect_ratio;
419         unsigned char  orientation;
420         unsigned char  subpixel_info;
421         unsigned char  horz_pitch;
422         unsigned char  vert_pitch;
423
424         unsigned char  display_color_depth:4;
425         unsigned char  reserved2:4;
426         unsigned char  response_time;
427 } display_dev_t;
428
429 /* LVDS Interface Timing and Power Sequencing */
430 typedef struct _lvds_display {
431         unsigned char  tag;                /* data block type */
432         unsigned char  revision:3;
433         unsigned char  reserved:5;
434         unsigned char  payload;
435
436         unsigned char  max_t1:4;
437         unsigned char  min_t1:4;
438
439         unsigned char  max_t2:6;
440         unsigned char  reserved2:2;
441
442         unsigned char  max_t3:6;
443         unsigned char  reserved3:2;
444
445         unsigned char  min_t4:7;
446         unsigned char  reserved4:1;
447
448         unsigned char  min_t5:6;
449         unsigned char  reserved5:2;
450
451         unsigned char  min_t6:6;
452         unsigned char  reserved6:2;
453 } lvds_display_t;
454
455 /* Transfer Characteristics Data Block */
456 typedef struct _transfer_char {
457         unsigned char  tag;                /* data block type */
458         unsigned char  revision:3;
459         unsigned char  reserved:5;
460         unsigned char  payload;
461         unsigned char  luminance;
462 } transfer_char_t;
463
464 /* Vendor specific Data Block */
465 typedef struct _vendor {
466         unsigned char  tag;                /* data block type */
467         unsigned char  revision:3;
468         unsigned char  reserved:5;
469         unsigned char  payload;
470         unsigned char  vendor_id[3];                /* no NULL char */
471         unsigned char  vendor_specific_data[246];   /* 245 + NULL */
472 } vendor_t;
473
474 /* Stereo methods */
475 #define STEREO_FIELD_SEQUENTIAL      0x00
476 #define STEREO_SIDE_BY_SIDE          0x01
477 #define STEREO_PIXEL_INTERLEAVED     0x02
478 #define STEREO_DUAL_INTERFACE        0x03
479 #define STEREO_MULTIVIEW             0x04
480 #define STEREO_PROPRIETARY           0xFF
481
482 /* Stereo Display Interface Data Block */
483 typedef struct _stereo_intf {
484         unsigned char  tag;                /* data block type */
485         unsigned char  revision:3;
486         unsigned char  reserved:5;
487         unsigned char  payload;
488
489         unsigned char  stereo_intf_payload;
490         unsigned char  stereo_intf_method;
491         union {
492                 unsigned char  stereo_polarity;     /* Field Sequential Stereo */
493                 unsigned char  view_identity;       /* Side-by-side Stereo */
494                 unsigned char  pattern8x8[8];       /* Pixel Interleaved Stereo */
495                 unsigned char  polarity_mirroring;  /* Dual Interface Stereo */
496                 struct {                            /* Multiview stereo */
497                         unsigned char  num_views;
498                         unsigned char  interleaving_method;
499                 } multiview;
500                 /* Note: In case of proprietary stereo method, the parameters can be
501                  * somewhere in the Vendor Specific Block */
502                 unsigned char  stereo_params[8];
503         };
504 } stereo_intf_t;
505
506 /* Display Interface Data Block */
507 #define INTERFACE_ANALOG    0x0
508 #define INTERFACE_LVDS      0x1
509 #define INTERFACE_TMDS      0x2
510 #define INTERFACE_RSDS      0x3
511 #define INTERFACE_DVID      0x4
512 #define INTERFACE_DVII_A    0x5
513 #define INTERFACE_DVII_D    0x6
514 #define INTERFACE_HDMI_A    0x7
515 #define INTERFACE_HDMI_B    0x8
516 #define INTERFACE_MDDI      0x9
517 #define INTERFACE_DISP_PORT 0xA
518 #define INTERFACE_PROP_DIG  0xB
519
520 /* Interface color depth */
521 #define INTERFACE_6BPPC            0x01   /* 6 bits per primary color */
522 #define INTERFACE_8BPPC            0x02   /* 8 bits per primary color */
523 #define INTERFACE_10BPPC           0x04   /* 10 bits per primary color */
524 #define INTERFACE_12BPPC           0x08   /* 12 bits per primary color */
525 #define INTERFACE_14BPPC           0x10   /* 14 bits per primary color */
526 #define INTERFACE_16BPPC           0x20   /* 16 bits per primary color */
527
528 typedef struct _display_intf {
529         unsigned char  tag;                /* data block type */
530         unsigned char  revision:3;
531         unsigned char  reserved:5;
532         unsigned char  payload;
533
534         unsigned char  num_channels:4;
535         unsigned char  intf_type:4;
536
537         unsigned char  intf_revision:4;
538         unsigned char  intf_version:4;
539
540         unsigned char  rgb_color_depth:6;
541         unsigned char  reserved2:2;
542
543         unsigned char  ycbcr_444_color_depth:6;
544         unsigned char  reserved3:2;
545
546         unsigned char  ycbcr_422_color_depth:6;
547         unsigned char  reserved4:2;
548
549         unsigned char  cp_type:3;
550         unsigned char  reserved5:2;
551         unsigned char  color_encoding:3;
552
553         unsigned char  cp_revision:4;
554         unsigned char  cp_version:4;
555
556         unsigned char  ss_percent:4;
557         unsigned char  reserved6:2;
558         unsigned char  ss_type:2;
559
560         union {
561                 struct {
562                         /* Interface type: LVDS */
563                         unsigned char  support_3_3v:1;
564                         unsigned char  support_5v:1;
565                         unsigned char  support_12v:1;
566                         unsigned char  support_2_8v:1;
567                         unsigned char  openldi:1;
568                         unsigned char  reserved5:3;
569
570                         unsigned char  data_strobe:1;
571                         unsigned char  de_polarity:1;
572                         unsigned char  de_mode:1;
573                         unsigned char  reserved6:5;
574                 } lvds;
575                 struct {
576                         /* Interface type: Proprietary Digital Interface */
577                         unsigned char  data_strobe:1;
578                         unsigned char  de_polarity:1;
579                         unsigned char  de_mode:1;
580                         unsigned char  reserved7:5;
581
582                         unsigned char  reserved8;
583                 } pdi;
584                 unsigned short bytes9_10;
585         };
586 } display_intf_t;
587
588 /* Serial Number String */
589 typedef struct _serial_number {
590         unsigned char  tag;                /* data block type */
591         unsigned char  revision:3;
592         unsigned char  reserved:5;
593         unsigned char  payload;
594
595         unsigned char  serial_num[249];    /* 248 + NULL */
596 } serial_number_t;
597
598 /* General Purpose ASCII String */
599 typedef struct _general_string {
600         unsigned char  tag;                /* data block type */
601         unsigned char  revision:3;
602         unsigned char  reserved:5;
603         unsigned char  payload;
604
605         unsigned char  string[249];        /* 248 + NULL */
606 } general_string_t;
607
608 /* This structure holds all of the parsed DisplayID information.*/
609 /* 5-required bytes:
610  *  1-byte  - version, revision
611  *  1-byte  - payload
612  *  1-byte  - number of extensions
613  *  1-byte  - product type identifier
614  *  1-byte  - checksum
615  */
616 typedef struct _displayid {
617         unsigned char    revision:4;         /* HEADER: revision */
618         unsigned char    version:4;          /* version */
619         unsigned char    payload;            /* payload excluding 5 required bytes*/
620         unsigned char    ptype_id;           /* DisplayID product type identifier */
621         unsigned char    num_extensions;     /* number of extension sections */
622         unsigned char    check_sum;          /* FOOTER: last byte of the section */
623
624         display_params_t display_params;     /* display params block */
625         timing_range_t   timing_range;       /* timing range block */
626         lvds_display_t   lvds;               /* LVDS interface & display block */
627         display_dev_t    display_dev;        /* display device block */
628         display_intf_t   display_intf;       /* display interface block */
629         unsigned char    dummy_db[256];      /* dummy datablock */
630
631         /* Video Timing Modes Type I, II DTDs into pd_timing_t */
632         unsigned char   num_timings;
633         pd_timing_t     timings[DISPLAYID_MAX_NUM_TIMINGS];
634
635         /* DisplayID attributes */
636         unsigned char   num_attrs;
637         pd_attr_t       attr_list[DISPLAYID_MAX_ATTRS];
638
639 #ifndef CONFIG_MICRO
640         productid_t                     productid;       /* product id block */
641         color_char_t                    color_char;      /* color characteristics block */
642         serial_number_t                 serial_num;      /* serial number ASCII string */
643         general_string_t                general_string;  /* general purpose ASCII string */
644         transfer_char_t                 transfer_char;   /* transfer characteristics block */
645         stereo_intf_t                   stereo_intf;     /* stereo display interface */
646         vendor_t                                vendor;          /* vendor specific data */
647         igd_DID_rotation_info_t rotation_info;   /* display orientation data */
648 #endif
649 } displayid_t;
650
651 /* Pack back to default */
652 #pragma pack()
653
654 /* Functions */
655 void displayid_filter_range_timings(pd_timing_t *tt, timing_range_t *range,
656         unsigned char firmware_type);
657 int displayid_parse(unsigned char *buffer, displayid_t   *displayid,
658                 pd_timing_t *timings, int count, unsigned char upscale);
659
660 void displayid_dump(unsigned char *buffer, unsigned short size);
661 void displayid_print(unsigned char *buffer, displayid_t *displayid);
662
663 #endif