Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright © 2014 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 #ifndef DRM_DISPLAYID_H
0023 #define DRM_DISPLAYID_H
0024 
0025 #include <linux/types.h>
0026 #include <linux/bits.h>
0027 
0028 struct drm_edid;
0029 
0030 #define VESA_IEEE_OUI               0x3a0292
0031 
0032 /* DisplayID Structure versions */
0033 #define DISPLAY_ID_STRUCTURE_VER_12     0x12
0034 #define DISPLAY_ID_STRUCTURE_VER_20     0x20
0035 
0036 /* DisplayID Structure v1r2 Data Blocks */
0037 #define DATA_BLOCK_PRODUCT_ID           0x00
0038 #define DATA_BLOCK_DISPLAY_PARAMETERS       0x01
0039 #define DATA_BLOCK_COLOR_CHARACTERISTICS    0x02
0040 #define DATA_BLOCK_TYPE_1_DETAILED_TIMING   0x03
0041 #define DATA_BLOCK_TYPE_2_DETAILED_TIMING   0x04
0042 #define DATA_BLOCK_TYPE_3_SHORT_TIMING      0x05
0043 #define DATA_BLOCK_TYPE_4_DMT_TIMING        0x06
0044 #define DATA_BLOCK_VESA_TIMING          0x07
0045 #define DATA_BLOCK_CEA_TIMING           0x08
0046 #define DATA_BLOCK_VIDEO_TIMING_RANGE       0x09
0047 #define DATA_BLOCK_PRODUCT_SERIAL_NUMBER    0x0a
0048 #define DATA_BLOCK_GP_ASCII_STRING      0x0b
0049 #define DATA_BLOCK_DISPLAY_DEVICE_DATA      0x0c
0050 #define DATA_BLOCK_INTERFACE_POWER_SEQUENCING   0x0d
0051 #define DATA_BLOCK_TRANSFER_CHARACTERISTICS 0x0e
0052 #define DATA_BLOCK_DISPLAY_INTERFACE        0x0f
0053 #define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x10
0054 #define DATA_BLOCK_TILED_DISPLAY        0x12
0055 #define DATA_BLOCK_VENDOR_SPECIFIC      0x7f
0056 #define DATA_BLOCK_CTA              0x81
0057 
0058 /* DisplayID Structure v2r0 Data Blocks */
0059 #define DATA_BLOCK_2_PRODUCT_ID         0x20
0060 #define DATA_BLOCK_2_DISPLAY_PARAMETERS     0x21
0061 #define DATA_BLOCK_2_TYPE_7_DETAILED_TIMING 0x22
0062 #define DATA_BLOCK_2_TYPE_8_ENUMERATED_TIMING   0x23
0063 #define DATA_BLOCK_2_TYPE_9_FORMULA_TIMING  0x24
0064 #define DATA_BLOCK_2_DYNAMIC_VIDEO_TIMING   0x25
0065 #define DATA_BLOCK_2_DISPLAY_INTERFACE_FEATURES 0x26
0066 #define DATA_BLOCK_2_STEREO_DISPLAY_INTERFACE   0x27
0067 #define DATA_BLOCK_2_TILED_DISPLAY_TOPOLOGY 0x28
0068 #define DATA_BLOCK_2_CONTAINER_ID       0x29
0069 #define DATA_BLOCK_2_VENDOR_SPECIFIC        0x7e
0070 #define DATA_BLOCK_2_CTA_DISPLAY_ID     0x81
0071 
0072 /* DisplayID Structure v1r2 Product Type */
0073 #define PRODUCT_TYPE_EXTENSION          0
0074 #define PRODUCT_TYPE_TEST           1
0075 #define PRODUCT_TYPE_PANEL          2
0076 #define PRODUCT_TYPE_MONITOR            3
0077 #define PRODUCT_TYPE_TV             4
0078 #define PRODUCT_TYPE_REPEATER           5
0079 #define PRODUCT_TYPE_DIRECT_DRIVE       6
0080 
0081 /* DisplayID Structure v2r0 Display Product Primary Use Case (~Product Type) */
0082 #define PRIMARY_USE_EXTENSION           0
0083 #define PRIMARY_USE_TEST            1
0084 #define PRIMARY_USE_GENERIC         2
0085 #define PRIMARY_USE_TV              3
0086 #define PRIMARY_USE_DESKTOP_PRODUCTIVITY    4
0087 #define PRIMARY_USE_DESKTOP_GAMING      5
0088 #define PRIMARY_USE_PRESENTATION        6
0089 #define PRIMARY_USE_HEAD_MOUNTED_VR     7
0090 #define PRIMARY_USE_HEAD_MOUNTED_AR     8
0091 
0092 struct displayid_header {
0093     u8 rev;
0094     u8 bytes;
0095     u8 prod_id;
0096     u8 ext_count;
0097 } __packed;
0098 
0099 struct displayid_block {
0100     u8 tag;
0101     u8 rev;
0102     u8 num_bytes;
0103 } __packed;
0104 
0105 struct displayid_tiled_block {
0106     struct displayid_block base;
0107     u8 tile_cap;
0108     u8 topo[3];
0109     u8 tile_size[4];
0110     u8 tile_pixel_bezel[5];
0111     u8 topology_id[8];
0112 } __packed;
0113 
0114 struct displayid_detailed_timings_1 {
0115     u8 pixel_clock[3];
0116     u8 flags;
0117     u8 hactive[2];
0118     u8 hblank[2];
0119     u8 hsync[2];
0120     u8 hsw[2];
0121     u8 vactive[2];
0122     u8 vblank[2];
0123     u8 vsync[2];
0124     u8 vsw[2];
0125 } __packed;
0126 
0127 struct displayid_detailed_timing_block {
0128     struct displayid_block base;
0129     struct displayid_detailed_timings_1 timings[];
0130 };
0131 
0132 #define DISPLAYID_VESA_MSO_OVERLAP  GENMASK(3, 0)
0133 #define DISPLAYID_VESA_MSO_MODE     GENMASK(6, 5)
0134 
0135 struct displayid_vesa_vendor_specific_block {
0136     struct displayid_block base;
0137     u8 oui[3];
0138     u8 data_structure_type;
0139     u8 mso;
0140 } __packed;
0141 
0142 /* DisplayID iteration */
0143 struct displayid_iter {
0144     const struct drm_edid *drm_edid;
0145 
0146     const u8 *section;
0147     int length;
0148     int idx;
0149     int ext_index;
0150 };
0151 
0152 void displayid_iter_edid_begin(const struct drm_edid *drm_edid,
0153                    struct displayid_iter *iter);
0154 const struct displayid_block *
0155 __displayid_iter_next(struct displayid_iter *iter);
0156 #define displayid_iter_for_each(__block, __iter) \
0157     while (((__block) = __displayid_iter_next(__iter)))
0158 void displayid_iter_end(struct displayid_iter *iter);
0159 
0160 #endif