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