171 lines · c
1/*2 * Copyright © 2014 Red Hat Inc.3 *4 * Permission is hereby granted, free of charge, to any person obtaining a5 * copy of this software and associated documentation files (the "Software"),6 * to deal in the Software without restriction, including without limitation7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,8 * and/or sell copies of the Software, and to permit persons to whom the9 * Software is furnished to do so, subject to the following conditions:10 *11 * The above copyright notice and this permission notice shall be included in12 * all copies or substantial portions of the Software.13 *14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR18 * 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 OR20 * OTHER DEALINGS IN THE SOFTWARE.21 */22 23#ifndef __DRM_DISPLAYID_INTERNAL_H__24#define __DRM_DISPLAYID_INTERNAL_H__25 26#include <linux/types.h>27#include <linux/bits.h>28 29struct drm_edid;30 31#define VESA_IEEE_OUI 0x3a029232 33/* DisplayID Structure versions */34#define DISPLAY_ID_STRUCTURE_VER_20 0x2035 36/* DisplayID Structure v1r2 Data Blocks */37#define DATA_BLOCK_PRODUCT_ID 0x0038#define DATA_BLOCK_DISPLAY_PARAMETERS 0x0139#define DATA_BLOCK_COLOR_CHARACTERISTICS 0x0240#define DATA_BLOCK_TYPE_1_DETAILED_TIMING 0x0341#define DATA_BLOCK_TYPE_2_DETAILED_TIMING 0x0442#define DATA_BLOCK_TYPE_3_SHORT_TIMING 0x0543#define DATA_BLOCK_TYPE_4_DMT_TIMING 0x0644#define DATA_BLOCK_VESA_TIMING 0x0745#define DATA_BLOCK_CEA_TIMING 0x0846#define DATA_BLOCK_VIDEO_TIMING_RANGE 0x0947#define DATA_BLOCK_PRODUCT_SERIAL_NUMBER 0x0a48#define DATA_BLOCK_GP_ASCII_STRING 0x0b49#define DATA_BLOCK_DISPLAY_DEVICE_DATA 0x0c50#define DATA_BLOCK_INTERFACE_POWER_SEQUENCING 0x0d51#define DATA_BLOCK_TRANSFER_CHARACTERISTICS 0x0e52#define DATA_BLOCK_DISPLAY_INTERFACE 0x0f53#define DATA_BLOCK_STEREO_DISPLAY_INTERFACE 0x1054#define DATA_BLOCK_TILED_DISPLAY 0x1255#define DATA_BLOCK_VENDOR_SPECIFIC 0x7f56#define DATA_BLOCK_CTA 0x8157 58/* DisplayID Structure v2r0 Data Blocks */59#define DATA_BLOCK_2_PRODUCT_ID 0x2060#define DATA_BLOCK_2_DISPLAY_PARAMETERS 0x2161#define DATA_BLOCK_2_TYPE_7_DETAILED_TIMING 0x2262#define DATA_BLOCK_2_TYPE_8_ENUMERATED_TIMING 0x2363#define DATA_BLOCK_2_TYPE_9_FORMULA_TIMING 0x2464#define DATA_BLOCK_2_DYNAMIC_VIDEO_TIMING 0x2565#define DATA_BLOCK_2_DISPLAY_INTERFACE_FEATURES 0x2666#define DATA_BLOCK_2_STEREO_DISPLAY_INTERFACE 0x2767#define DATA_BLOCK_2_TILED_DISPLAY_TOPOLOGY 0x2868#define DATA_BLOCK_2_CONTAINER_ID 0x2969#define DATA_BLOCK_2_VENDOR_SPECIFIC 0x7e70#define DATA_BLOCK_2_CTA_DISPLAY_ID 0x8171 72/* DisplayID Structure v1r2 Product Type */73#define PRODUCT_TYPE_EXTENSION 074#define PRODUCT_TYPE_TEST 175#define PRODUCT_TYPE_PANEL 276#define PRODUCT_TYPE_MONITOR 377#define PRODUCT_TYPE_TV 478#define PRODUCT_TYPE_REPEATER 579#define PRODUCT_TYPE_DIRECT_DRIVE 680 81/* DisplayID Structure v2r0 Display Product Primary Use Case (~Product Type) */82#define PRIMARY_USE_EXTENSION 083#define PRIMARY_USE_TEST 184#define PRIMARY_USE_GENERIC 285#define PRIMARY_USE_TV 386#define PRIMARY_USE_DESKTOP_PRODUCTIVITY 487#define PRIMARY_USE_DESKTOP_GAMING 588#define PRIMARY_USE_PRESENTATION 689#define PRIMARY_USE_HEAD_MOUNTED_VR 790#define PRIMARY_USE_HEAD_MOUNTED_AR 891 92struct displayid_header {93 u8 rev;94 u8 bytes;95 u8 prod_id;96 u8 ext_count;97} __packed;98 99struct displayid_block {100 u8 tag;101 u8 rev;102 u8 num_bytes;103} __packed;104 105struct displayid_tiled_block {106 struct displayid_block base;107 u8 tile_cap;108 u8 topo[3];109 u8 tile_size[4];110 u8 tile_pixel_bezel[5];111 u8 topology_id[8];112} __packed;113 114struct displayid_detailed_timings_1 {115 u8 pixel_clock[3];116 u8 flags;117 u8 hactive[2];118 u8 hblank[2];119 u8 hsync[2];120 u8 hsw[2];121 u8 vactive[2];122 u8 vblank[2];123 u8 vsync[2];124 u8 vsw[2];125} __packed;126 127struct displayid_detailed_timing_block {128 struct displayid_block base;129 struct displayid_detailed_timings_1 timings[];130};131 132#define DISPLAYID_VESA_MSO_OVERLAP GENMASK(3, 0)133#define DISPLAYID_VESA_MSO_MODE GENMASK(6, 5)134 135struct displayid_vesa_vendor_specific_block {136 struct displayid_block base;137 u8 oui[3];138 u8 data_structure_type;139 u8 mso;140} __packed;141 142/*143 * DisplayID iteration.144 *145 * Do not access directly, this is private.146 */147struct displayid_iter {148 const struct drm_edid *drm_edid;149 150 const u8 *section;151 int length;152 int idx;153 int ext_index;154 155 u8 version;156 u8 primary_use;157};158 159void displayid_iter_edid_begin(const struct drm_edid *drm_edid,160 struct displayid_iter *iter);161const struct displayid_block *162__displayid_iter_next(struct displayid_iter *iter);163#define displayid_iter_for_each(__block, __iter) \164 while (((__block) = __displayid_iter_next(__iter)))165void displayid_iter_end(struct displayid_iter *iter);166 167u8 displayid_version(const struct displayid_iter *iter);168u8 displayid_primary_use(const struct displayid_iter *iter);169 170#endif171