18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright © 2008 Keith Packard 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, distribute, and sell this software and its 58c2ecf20Sopenharmony_ci * documentation for any purpose is hereby granted without fee, provided that 68c2ecf20Sopenharmony_ci * the above copyright notice appear in all copies and that both that copyright 78c2ecf20Sopenharmony_ci * notice and this permission notice appear in supporting documentation, and 88c2ecf20Sopenharmony_ci * that the name of the copyright holders not be used in advertising or 98c2ecf20Sopenharmony_ci * publicity pertaining to distribution of the software without specific, 108c2ecf20Sopenharmony_ci * written prior permission. The copyright holders make no representations 118c2ecf20Sopenharmony_ci * about the suitability of this software for any purpose. It is provided "as 128c2ecf20Sopenharmony_ci * is" without express or implied warranty. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 158c2ecf20Sopenharmony_ci * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 168c2ecf20Sopenharmony_ci * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR 178c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 188c2ecf20Sopenharmony_ci * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 198c2ecf20Sopenharmony_ci * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 208c2ecf20Sopenharmony_ci * OF THIS SOFTWARE. 218c2ecf20Sopenharmony_ci */ 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#ifndef _DRM_DP_HELPER_H_ 248c2ecf20Sopenharmony_ci#define _DRM_DP_HELPER_H_ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#include <linux/delay.h> 278c2ecf20Sopenharmony_ci#include <linux/i2c.h> 288c2ecf20Sopenharmony_ci#include <linux/types.h> 298c2ecf20Sopenharmony_ci#include <drm/drm_connector.h> 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistruct drm_device; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* 348c2ecf20Sopenharmony_ci * Unless otherwise noted, all values are from the DP 1.1a spec. Note that 358c2ecf20Sopenharmony_ci * DP and DPCD versions are independent. Differences from 1.0 are not noted, 368c2ecf20Sopenharmony_ci * 1.0 devices basically don't exist in the wild. 378c2ecf20Sopenharmony_ci * 388c2ecf20Sopenharmony_ci * Abbreviations, in chronological order: 398c2ecf20Sopenharmony_ci * 408c2ecf20Sopenharmony_ci * eDP: Embedded DisplayPort version 1 418c2ecf20Sopenharmony_ci * DPI: DisplayPort Interoperability Guideline v1.1a 428c2ecf20Sopenharmony_ci * 1.2: DisplayPort 1.2 438c2ecf20Sopenharmony_ci * MST: Multistream Transport - part of DP 1.2a 448c2ecf20Sopenharmony_ci * 458c2ecf20Sopenharmony_ci * 1.2 formally includes both eDP and DPI definitions. 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* MSA (Main Stream Attribute) MISC bits (as MISC1<<8|MISC0) */ 498c2ecf20Sopenharmony_ci#define DP_MSA_MISC_SYNC_CLOCK (1 << 0) 508c2ecf20Sopenharmony_ci#define DP_MSA_MISC_INTERLACE_VTOTAL_EVEN (1 << 8) 518c2ecf20Sopenharmony_ci#define DP_MSA_MISC_STEREO_NO_3D (0 << 9) 528c2ecf20Sopenharmony_ci#define DP_MSA_MISC_STEREO_PROG_RIGHT_EYE (1 << 9) 538c2ecf20Sopenharmony_ci#define DP_MSA_MISC_STEREO_PROG_LEFT_EYE (3 << 9) 548c2ecf20Sopenharmony_ci/* bits per component for non-RAW */ 558c2ecf20Sopenharmony_ci#define DP_MSA_MISC_6_BPC (0 << 5) 568c2ecf20Sopenharmony_ci#define DP_MSA_MISC_8_BPC (1 << 5) 578c2ecf20Sopenharmony_ci#define DP_MSA_MISC_10_BPC (2 << 5) 588c2ecf20Sopenharmony_ci#define DP_MSA_MISC_12_BPC (3 << 5) 598c2ecf20Sopenharmony_ci#define DP_MSA_MISC_16_BPC (4 << 5) 608c2ecf20Sopenharmony_ci/* bits per component for RAW */ 618c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_6_BPC (1 << 5) 628c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_7_BPC (2 << 5) 638c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_8_BPC (3 << 5) 648c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_10_BPC (4 << 5) 658c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_12_BPC (5 << 5) 668c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_14_BPC (6 << 5) 678c2ecf20Sopenharmony_ci#define DP_MSA_MISC_RAW_16_BPC (7 << 5) 688c2ecf20Sopenharmony_ci/* pixel encoding/colorimetry format */ 698c2ecf20Sopenharmony_ci#define _DP_MSA_MISC_COLOR(misc1_7, misc0_21, misc0_3, misc0_4) \ 708c2ecf20Sopenharmony_ci ((misc1_7) << 15 | (misc0_4) << 4 | (misc0_3) << 3 | ((misc0_21) << 1)) 718c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_RGB _DP_MSA_MISC_COLOR(0, 0, 0, 0) 728c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_CEA_RGB _DP_MSA_MISC_COLOR(0, 0, 1, 0) 738c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_RGB_WIDE_FIXED _DP_MSA_MISC_COLOR(0, 3, 0, 0) 748c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_RGB_WIDE_FLOAT _DP_MSA_MISC_COLOR(0, 3, 0, 1) 758c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_Y_ONLY _DP_MSA_MISC_COLOR(1, 0, 0, 0) 768c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_RAW _DP_MSA_MISC_COLOR(1, 1, 0, 0) 778c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_YCBCR_422_BT601 _DP_MSA_MISC_COLOR(0, 1, 1, 0) 788c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_YCBCR_422_BT709 _DP_MSA_MISC_COLOR(0, 1, 1, 1) 798c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_YCBCR_444_BT601 _DP_MSA_MISC_COLOR(0, 2, 1, 0) 808c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_YCBCR_444_BT709 _DP_MSA_MISC_COLOR(0, 2, 1, 1) 818c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_XVYCC_422_BT601 _DP_MSA_MISC_COLOR(0, 1, 0, 0) 828c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_XVYCC_422_BT709 _DP_MSA_MISC_COLOR(0, 1, 0, 1) 838c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_XVYCC_444_BT601 _DP_MSA_MISC_COLOR(0, 2, 0, 0) 848c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_XVYCC_444_BT709 _DP_MSA_MISC_COLOR(0, 2, 0, 1) 858c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_OPRGB _DP_MSA_MISC_COLOR(0, 0, 1, 1) 868c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_DCI_P3 _DP_MSA_MISC_COLOR(0, 3, 1, 0) 878c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_COLOR_PROFILE _DP_MSA_MISC_COLOR(0, 3, 1, 1) 888c2ecf20Sopenharmony_ci#define DP_MSA_MISC_COLOR_VSC_SDP (1 << 14) 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci#define DP_AUX_MAX_PAYLOAD_BYTES 16 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define DP_AUX_I2C_WRITE 0x0 938c2ecf20Sopenharmony_ci#define DP_AUX_I2C_READ 0x1 948c2ecf20Sopenharmony_ci#define DP_AUX_I2C_WRITE_STATUS_UPDATE 0x2 958c2ecf20Sopenharmony_ci#define DP_AUX_I2C_MOT 0x4 968c2ecf20Sopenharmony_ci#define DP_AUX_NATIVE_WRITE 0x8 978c2ecf20Sopenharmony_ci#define DP_AUX_NATIVE_READ 0x9 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_ci#define DP_AUX_NATIVE_REPLY_ACK (0x0 << 0) 1008c2ecf20Sopenharmony_ci#define DP_AUX_NATIVE_REPLY_NACK (0x1 << 0) 1018c2ecf20Sopenharmony_ci#define DP_AUX_NATIVE_REPLY_DEFER (0x2 << 0) 1028c2ecf20Sopenharmony_ci#define DP_AUX_NATIVE_REPLY_MASK (0x3 << 0) 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_ci#define DP_AUX_I2C_REPLY_ACK (0x0 << 2) 1058c2ecf20Sopenharmony_ci#define DP_AUX_I2C_REPLY_NACK (0x1 << 2) 1068c2ecf20Sopenharmony_ci#define DP_AUX_I2C_REPLY_DEFER (0x2 << 2) 1078c2ecf20Sopenharmony_ci#define DP_AUX_I2C_REPLY_MASK (0x3 << 2) 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ci/* AUX CH addresses */ 1108c2ecf20Sopenharmony_ci/* DPCD */ 1118c2ecf20Sopenharmony_ci#define DP_DPCD_REV 0x000 1128c2ecf20Sopenharmony_ci# define DP_DPCD_REV_10 0x10 1138c2ecf20Sopenharmony_ci# define DP_DPCD_REV_11 0x11 1148c2ecf20Sopenharmony_ci# define DP_DPCD_REV_12 0x12 1158c2ecf20Sopenharmony_ci# define DP_DPCD_REV_13 0x13 1168c2ecf20Sopenharmony_ci# define DP_DPCD_REV_14 0x14 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci#define DP_MAX_LINK_RATE 0x001 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#define DP_MAX_LANE_COUNT 0x002 1218c2ecf20Sopenharmony_ci# define DP_MAX_LANE_COUNT_MASK 0x1f 1228c2ecf20Sopenharmony_ci# define DP_TPS3_SUPPORTED (1 << 6) /* 1.2 */ 1238c2ecf20Sopenharmony_ci# define DP_ENHANCED_FRAME_CAP (1 << 7) 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci#define DP_MAX_DOWNSPREAD 0x003 1268c2ecf20Sopenharmony_ci# define DP_MAX_DOWNSPREAD_0_5 (1 << 0) 1278c2ecf20Sopenharmony_ci# define DP_NO_AUX_HANDSHAKE_LINK_TRAINING (1 << 6) 1288c2ecf20Sopenharmony_ci# define DP_TPS4_SUPPORTED (1 << 7) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#define DP_NORP 0x004 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define DP_DOWNSTREAMPORT_PRESENT 0x005 1338c2ecf20Sopenharmony_ci# define DP_DWN_STRM_PORT_PRESENT (1 << 0) 1348c2ecf20Sopenharmony_ci# define DP_DWN_STRM_PORT_TYPE_MASK 0x06 1358c2ecf20Sopenharmony_ci# define DP_DWN_STRM_PORT_TYPE_DP (0 << 1) 1368c2ecf20Sopenharmony_ci# define DP_DWN_STRM_PORT_TYPE_ANALOG (1 << 1) 1378c2ecf20Sopenharmony_ci# define DP_DWN_STRM_PORT_TYPE_TMDS (2 << 1) 1388c2ecf20Sopenharmony_ci# define DP_DWN_STRM_PORT_TYPE_OTHER (3 << 1) 1398c2ecf20Sopenharmony_ci# define DP_FORMAT_CONVERSION (1 << 3) 1408c2ecf20Sopenharmony_ci# define DP_DETAILED_CAP_INFO_AVAILABLE (1 << 4) /* DPI */ 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define DP_MAIN_LINK_CHANNEL_CODING 0x006 1438c2ecf20Sopenharmony_ci# define DP_CAP_ANSI_8B10B (1 << 0) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define DP_DOWN_STREAM_PORT_COUNT 0x007 1468c2ecf20Sopenharmony_ci# define DP_PORT_COUNT_MASK 0x0f 1478c2ecf20Sopenharmony_ci# define DP_MSA_TIMING_PAR_IGNORED (1 << 6) /* eDP */ 1488c2ecf20Sopenharmony_ci# define DP_OUI_SUPPORT (1 << 7) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci#define DP_RECEIVE_PORT_0_CAP_0 0x008 1518c2ecf20Sopenharmony_ci# define DP_LOCAL_EDID_PRESENT (1 << 1) 1528c2ecf20Sopenharmony_ci# define DP_ASSOCIATED_TO_PRECEDING_PORT (1 << 2) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define DP_RECEIVE_PORT_0_BUFFER_SIZE 0x009 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci#define DP_RECEIVE_PORT_1_CAP_0 0x00a 1578c2ecf20Sopenharmony_ci#define DP_RECEIVE_PORT_1_BUFFER_SIZE 0x00b 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci#define DP_I2C_SPEED_CAP 0x00c /* DPI */ 1608c2ecf20Sopenharmony_ci# define DP_I2C_SPEED_1K 0x01 1618c2ecf20Sopenharmony_ci# define DP_I2C_SPEED_5K 0x02 1628c2ecf20Sopenharmony_ci# define DP_I2C_SPEED_10K 0x04 1638c2ecf20Sopenharmony_ci# define DP_I2C_SPEED_100K 0x08 1648c2ecf20Sopenharmony_ci# define DP_I2C_SPEED_400K 0x10 1658c2ecf20Sopenharmony_ci# define DP_I2C_SPEED_1M 0x20 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#define DP_EDP_CONFIGURATION_CAP 0x00d /* XXX 1.2? */ 1688c2ecf20Sopenharmony_ci# define DP_ALTERNATE_SCRAMBLER_RESET_CAP (1 << 0) 1698c2ecf20Sopenharmony_ci# define DP_FRAMING_CHANGE_CAP (1 << 1) 1708c2ecf20Sopenharmony_ci# define DP_DPCD_DISPLAY_CONTROL_CAPABLE (1 << 3) /* edp v1.2 or higher */ 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define DP_TRAINING_AUX_RD_INTERVAL 0x00e /* XXX 1.2? */ 1738c2ecf20Sopenharmony_ci# define DP_TRAINING_AUX_RD_MASK 0x7F /* DP 1.3 */ 1748c2ecf20Sopenharmony_ci# define DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT (1 << 7) /* DP 1.3 */ 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define DP_ADAPTER_CAP 0x00f /* 1.2 */ 1778c2ecf20Sopenharmony_ci# define DP_FORCE_LOAD_SENSE_CAP (1 << 0) 1788c2ecf20Sopenharmony_ci# define DP_ALTERNATE_I2C_PATTERN_CAP (1 << 1) 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_ci#define DP_SUPPORTED_LINK_RATES 0x010 /* eDP 1.4 */ 1818c2ecf20Sopenharmony_ci# define DP_MAX_SUPPORTED_RATES 8 /* 16-bit little-endian */ 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci/* Multiple stream transport */ 1848c2ecf20Sopenharmony_ci#define DP_FAUX_CAP 0x020 /* 1.2 */ 1858c2ecf20Sopenharmony_ci# define DP_FAUX_CAP_1 (1 << 0) 1868c2ecf20Sopenharmony_ci 1878c2ecf20Sopenharmony_ci#define DP_MSTM_CAP 0x021 /* 1.2 */ 1888c2ecf20Sopenharmony_ci# define DP_MST_CAP (1 << 0) 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#define DP_NUMBER_OF_AUDIO_ENDPOINTS 0x022 /* 1.2 */ 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci/* AV_SYNC_DATA_BLOCK 1.2 */ 1938c2ecf20Sopenharmony_ci#define DP_AV_GRANULARITY 0x023 1948c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_MASK (0xf << 0) 1958c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_3MS (0 << 0) 1968c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_2MS (1 << 0) 1978c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_1MS (2 << 0) 1988c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_500US (3 << 0) 1998c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_200US (4 << 0) 2008c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_100US (5 << 0) 2018c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_10US (6 << 0) 2028c2ecf20Sopenharmony_ci# define DP_AG_FACTOR_1US (7 << 0) 2038c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_MASK (0xf << 4) 2048c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_3MS (0 << 4) 2058c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_2MS (1 << 4) 2068c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_1MS (2 << 4) 2078c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_500US (3 << 4) 2088c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_200US (4 << 4) 2098c2ecf20Sopenharmony_ci# define DP_VG_FACTOR_100US (5 << 4) 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci#define DP_AUD_DEC_LAT0 0x024 2128c2ecf20Sopenharmony_ci#define DP_AUD_DEC_LAT1 0x025 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci#define DP_AUD_PP_LAT0 0x026 2158c2ecf20Sopenharmony_ci#define DP_AUD_PP_LAT1 0x027 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci#define DP_VID_INTER_LAT 0x028 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_ci#define DP_VID_PROG_LAT 0x029 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci#define DP_REP_LAT 0x02a 2228c2ecf20Sopenharmony_ci 2238c2ecf20Sopenharmony_ci#define DP_AUD_DEL_INS0 0x02b 2248c2ecf20Sopenharmony_ci#define DP_AUD_DEL_INS1 0x02c 2258c2ecf20Sopenharmony_ci#define DP_AUD_DEL_INS2 0x02d 2268c2ecf20Sopenharmony_ci/* End of AV_SYNC_DATA_BLOCK */ 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci#define DP_RECEIVER_ALPM_CAP 0x02e /* eDP 1.4 */ 2298c2ecf20Sopenharmony_ci# define DP_ALPM_CAP (1 << 0) 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP 0x02f /* eDP 1.4 */ 2328c2ecf20Sopenharmony_ci# define DP_AUX_FRAME_SYNC_CAP (1 << 0) 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci#define DP_GUID 0x030 /* 1.2 */ 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci#define DP_DSC_SUPPORT 0x060 /* DP 1.4 */ 2378c2ecf20Sopenharmony_ci# define DP_DSC_DECOMPRESSION_IS_SUPPORTED (1 << 0) 2388c2ecf20Sopenharmony_ci 2398c2ecf20Sopenharmony_ci#define DP_DSC_REV 0x061 2408c2ecf20Sopenharmony_ci# define DP_DSC_MAJOR_MASK (0xf << 0) 2418c2ecf20Sopenharmony_ci# define DP_DSC_MINOR_MASK (0xf << 4) 2428c2ecf20Sopenharmony_ci# define DP_DSC_MAJOR_SHIFT 0 2438c2ecf20Sopenharmony_ci# define DP_DSC_MINOR_SHIFT 4 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci#define DP_DSC_RC_BUF_BLK_SIZE 0x062 2468c2ecf20Sopenharmony_ci# define DP_DSC_RC_BUF_BLK_SIZE_1 0x0 2478c2ecf20Sopenharmony_ci# define DP_DSC_RC_BUF_BLK_SIZE_4 0x1 2488c2ecf20Sopenharmony_ci# define DP_DSC_RC_BUF_BLK_SIZE_16 0x2 2498c2ecf20Sopenharmony_ci# define DP_DSC_RC_BUF_BLK_SIZE_64 0x3 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci#define DP_DSC_RC_BUF_SIZE 0x063 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci#define DP_DSC_SLICE_CAP_1 0x064 2548c2ecf20Sopenharmony_ci# define DP_DSC_1_PER_DP_DSC_SINK (1 << 0) 2558c2ecf20Sopenharmony_ci# define DP_DSC_2_PER_DP_DSC_SINK (1 << 1) 2568c2ecf20Sopenharmony_ci# define DP_DSC_4_PER_DP_DSC_SINK (1 << 3) 2578c2ecf20Sopenharmony_ci# define DP_DSC_6_PER_DP_DSC_SINK (1 << 4) 2588c2ecf20Sopenharmony_ci# define DP_DSC_8_PER_DP_DSC_SINK (1 << 5) 2598c2ecf20Sopenharmony_ci# define DP_DSC_10_PER_DP_DSC_SINK (1 << 6) 2608c2ecf20Sopenharmony_ci# define DP_DSC_12_PER_DP_DSC_SINK (1 << 7) 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci#define DP_DSC_LINE_BUF_BIT_DEPTH 0x065 2638c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_MASK (0xf << 0) 2648c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_9 0x0 2658c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_10 0x1 2668c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_11 0x2 2678c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_12 0x3 2688c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_13 0x4 2698c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_14 0x5 2708c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_15 0x6 2718c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_16 0x7 2728c2ecf20Sopenharmony_ci# define DP_DSC_LINE_BUF_BIT_DEPTH_8 0x8 2738c2ecf20Sopenharmony_ci 2748c2ecf20Sopenharmony_ci#define DP_DSC_BLK_PREDICTION_SUPPORT 0x066 2758c2ecf20Sopenharmony_ci# define DP_DSC_BLK_PREDICTION_IS_SUPPORTED (1 << 0) 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci#define DP_DSC_MAX_BITS_PER_PIXEL_LOW 0x067 /* eDP 1.4 */ 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci#define DP_DSC_MAX_BITS_PER_PIXEL_HI 0x068 /* eDP 1.4 */ 2808c2ecf20Sopenharmony_ci# define DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK (0x3 << 0) 2818c2ecf20Sopenharmony_ci# define DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT 8 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci#define DP_DSC_DEC_COLOR_FORMAT_CAP 0x069 2848c2ecf20Sopenharmony_ci# define DP_DSC_RGB (1 << 0) 2858c2ecf20Sopenharmony_ci# define DP_DSC_YCbCr444 (1 << 1) 2868c2ecf20Sopenharmony_ci# define DP_DSC_YCbCr422_Simple (1 << 2) 2878c2ecf20Sopenharmony_ci# define DP_DSC_YCbCr422_Native (1 << 3) 2888c2ecf20Sopenharmony_ci# define DP_DSC_YCbCr420_Native (1 << 4) 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_ci#define DP_DSC_DEC_COLOR_DEPTH_CAP 0x06A 2918c2ecf20Sopenharmony_ci# define DP_DSC_8_BPC (1 << 1) 2928c2ecf20Sopenharmony_ci# define DP_DSC_10_BPC (1 << 2) 2938c2ecf20Sopenharmony_ci# define DP_DSC_12_BPC (1 << 3) 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#define DP_DSC_PEAK_THROUGHPUT 0x06B 2968c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_MASK (0xf << 0) 2978c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0 2988c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_UNSUPPORTED 0 2998c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_340 (1 << 0) 3008c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_400 (2 << 0) 3018c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_450 (3 << 0) 3028c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_500 (4 << 0) 3038c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_550 (5 << 0) 3048c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_600 (6 << 0) 3058c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_650 (7 << 0) 3068c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_700 (8 << 0) 3078c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_750 (9 << 0) 3088c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_800 (10 << 0) 3098c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_850 (11 << 0) 3108c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_900 (12 << 0) 3118c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_950 (13 << 0) 3128c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_1000 (14 << 0) 3138c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_0_170 (15 << 0) /* 1.4a */ 3148c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_MASK (0xf << 4) 3158c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4 3168c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_UNSUPPORTED 0 3178c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_340 (1 << 4) 3188c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_400 (2 << 4) 3198c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_450 (3 << 4) 3208c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_500 (4 << 4) 3218c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_550 (5 << 4) 3228c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_600 (6 << 4) 3238c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_650 (7 << 4) 3248c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_700 (8 << 4) 3258c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_750 (9 << 4) 3268c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_800 (10 << 4) 3278c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_850 (11 << 4) 3288c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_900 (12 << 4) 3298c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_950 (13 << 4) 3308c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_1000 (14 << 4) 3318c2ecf20Sopenharmony_ci# define DP_DSC_THROUGHPUT_MODE_1_170 (15 << 4) 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci#define DP_DSC_MAX_SLICE_WIDTH 0x06C 3348c2ecf20Sopenharmony_ci#define DP_DSC_MIN_SLICE_WIDTH_VALUE 2560 3358c2ecf20Sopenharmony_ci#define DP_DSC_SLICE_WIDTH_MULTIPLIER 320 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci#define DP_DSC_SLICE_CAP_2 0x06D 3388c2ecf20Sopenharmony_ci# define DP_DSC_16_PER_DP_DSC_SINK (1 << 0) 3398c2ecf20Sopenharmony_ci# define DP_DSC_20_PER_DP_DSC_SINK (1 << 1) 3408c2ecf20Sopenharmony_ci# define DP_DSC_24_PER_DP_DSC_SINK (1 << 2) 3418c2ecf20Sopenharmony_ci 3428c2ecf20Sopenharmony_ci#define DP_DSC_BITS_PER_PIXEL_INC 0x06F 3438c2ecf20Sopenharmony_ci# define DP_DSC_BITS_PER_PIXEL_1_16 0x0 3448c2ecf20Sopenharmony_ci# define DP_DSC_BITS_PER_PIXEL_1_8 0x1 3458c2ecf20Sopenharmony_ci# define DP_DSC_BITS_PER_PIXEL_1_4 0x2 3468c2ecf20Sopenharmony_ci# define DP_DSC_BITS_PER_PIXEL_1_2 0x3 3478c2ecf20Sopenharmony_ci# define DP_DSC_BITS_PER_PIXEL_1 0x4 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_ci#define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ 3508c2ecf20Sopenharmony_ci# define DP_PSR_IS_SUPPORTED 1 3518c2ecf20Sopenharmony_ci# define DP_PSR2_IS_SUPPORTED 2 /* eDP 1.4 */ 3528c2ecf20Sopenharmony_ci# define DP_PSR2_WITH_Y_COORD_IS_SUPPORTED 3 /* eDP 1.4a */ 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci#define DP_PSR_CAPS 0x071 /* XXX 1.2? */ 3558c2ecf20Sopenharmony_ci# define DP_PSR_NO_TRAIN_ON_EXIT 1 3568c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_330 (0 << 1) 3578c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_275 (1 << 1) 3588c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_220 (2 << 1) 3598c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_165 (3 << 1) 3608c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_110 (4 << 1) 3618c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_55 (5 << 1) 3628c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_0 (6 << 1) 3638c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_MASK (7 << 1) 3648c2ecf20Sopenharmony_ci# define DP_PSR_SETUP_TIME_SHIFT 1 3658c2ecf20Sopenharmony_ci# define DP_PSR2_SU_Y_COORDINATE_REQUIRED (1 << 4) /* eDP 1.4a */ 3668c2ecf20Sopenharmony_ci# define DP_PSR2_SU_GRANULARITY_REQUIRED (1 << 5) /* eDP 1.4b */ 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci#define DP_PSR2_SU_X_GRANULARITY 0x072 /* eDP 1.4b */ 3698c2ecf20Sopenharmony_ci#define DP_PSR2_SU_Y_GRANULARITY 0x074 /* eDP 1.4b */ 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci/* 3728c2ecf20Sopenharmony_ci * 0x80-0x8f describe downstream port capabilities, but there are two layouts 3738c2ecf20Sopenharmony_ci * based on whether DP_DETAILED_CAP_INFO_AVAILABLE was set. If it was not, 3748c2ecf20Sopenharmony_ci * each port's descriptor is one byte wide. If it was set, each port's is 3758c2ecf20Sopenharmony_ci * four bytes wide, starting with the one byte from the base info. As of 3768c2ecf20Sopenharmony_ci * DP interop v1.1a only VGA defines additional detail. 3778c2ecf20Sopenharmony_ci */ 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci/* offset 0 */ 3808c2ecf20Sopenharmony_ci#define DP_DOWNSTREAM_PORT_0 0x80 3818c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_MASK (7 << 0) 3828c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_DP 0 3838c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_VGA 1 3848c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_DVI 2 3858c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_HDMI 3 3868c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_NON_EDID 4 3878c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_DP_DUALMODE 5 3888c2ecf20Sopenharmony_ci# define DP_DS_PORT_TYPE_WIRELESS 6 3898c2ecf20Sopenharmony_ci# define DP_DS_PORT_HPD (1 << 3) 3908c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_MASK (0xf << 4) 3918c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_720x480i_60 (1 << 4) 3928c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_720x480i_50 (2 << 4) 3938c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_1920x1080i_60 (3 << 4) 3948c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_1920x1080i_50 (4 << 4) 3958c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_1280x720_60 (5 << 4) 3968c2ecf20Sopenharmony_ci# define DP_DS_NON_EDID_1280x720_50 (7 << 4) 3978c2ecf20Sopenharmony_ci/* offset 1 for VGA is maximum megapixels per second / 8 */ 3988c2ecf20Sopenharmony_ci/* offset 1 for DVI/HDMI is maximum TMDS clock in Mbps / 2.5 */ 3998c2ecf20Sopenharmony_ci/* offset 2 for VGA/DVI/HDMI */ 4008c2ecf20Sopenharmony_ci# define DP_DS_MAX_BPC_MASK (3 << 0) 4018c2ecf20Sopenharmony_ci# define DP_DS_8BPC 0 4028c2ecf20Sopenharmony_ci# define DP_DS_10BPC 1 4038c2ecf20Sopenharmony_ci# define DP_DS_12BPC 2 4048c2ecf20Sopenharmony_ci# define DP_DS_16BPC 3 4058c2ecf20Sopenharmony_ci/* offset 3 for DVI */ 4068c2ecf20Sopenharmony_ci# define DP_DS_DVI_DUAL_LINK (1 << 1) 4078c2ecf20Sopenharmony_ci# define DP_DS_DVI_HIGH_COLOR_DEPTH (1 << 2) 4088c2ecf20Sopenharmony_ci/* offset 3 for HDMI */ 4098c2ecf20Sopenharmony_ci# define DP_DS_HDMI_FRAME_SEQ_TO_FRAME_PACK (1 << 0) 4108c2ecf20Sopenharmony_ci# define DP_DS_HDMI_YCBCR422_PASS_THROUGH (1 << 1) 4118c2ecf20Sopenharmony_ci# define DP_DS_HDMI_YCBCR420_PASS_THROUGH (1 << 2) 4128c2ecf20Sopenharmony_ci# define DP_DS_HDMI_YCBCR444_TO_422_CONV (1 << 3) 4138c2ecf20Sopenharmony_ci# define DP_DS_HDMI_YCBCR444_TO_420_CONV (1 << 4) 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci#define DP_MAX_DOWNSTREAM_PORTS 0x10 4168c2ecf20Sopenharmony_ci 4178c2ecf20Sopenharmony_ci/* DP Forward error Correction Registers */ 4188c2ecf20Sopenharmony_ci#define DP_FEC_CAPABILITY 0x090 /* 1.4 */ 4198c2ecf20Sopenharmony_ci# define DP_FEC_CAPABLE (1 << 0) 4208c2ecf20Sopenharmony_ci# define DP_FEC_UNCORR_BLK_ERROR_COUNT_CAP (1 << 1) 4218c2ecf20Sopenharmony_ci# define DP_FEC_CORR_BLK_ERROR_COUNT_CAP (1 << 2) 4228c2ecf20Sopenharmony_ci# define DP_FEC_BIT_ERROR_COUNT_CAP (1 << 3) 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci/* DP Extended DSC Capabilities */ 4258c2ecf20Sopenharmony_ci#define DP_DSC_BRANCH_OVERALL_THROUGHPUT_0 0x0a0 /* DP 1.4a SCR */ 4268c2ecf20Sopenharmony_ci#define DP_DSC_BRANCH_OVERALL_THROUGHPUT_1 0x0a1 4278c2ecf20Sopenharmony_ci#define DP_DSC_BRANCH_MAX_LINE_WIDTH 0x0a2 4288c2ecf20Sopenharmony_ci 4298c2ecf20Sopenharmony_ci/* link configuration */ 4308c2ecf20Sopenharmony_ci#define DP_LINK_BW_SET 0x100 4318c2ecf20Sopenharmony_ci# define DP_LINK_RATE_TABLE 0x00 /* eDP 1.4 */ 4328c2ecf20Sopenharmony_ci# define DP_LINK_BW_1_62 0x06 4338c2ecf20Sopenharmony_ci# define DP_LINK_BW_2_7 0x0a 4348c2ecf20Sopenharmony_ci# define DP_LINK_BW_5_4 0x14 /* 1.2 */ 4358c2ecf20Sopenharmony_ci# define DP_LINK_BW_8_1 0x1e /* 1.4 */ 4368c2ecf20Sopenharmony_ci 4378c2ecf20Sopenharmony_ci#define DP_LANE_COUNT_SET 0x101 4388c2ecf20Sopenharmony_ci# define DP_LANE_COUNT_MASK 0x0f 4398c2ecf20Sopenharmony_ci# define DP_LANE_COUNT_ENHANCED_FRAME_EN (1 << 7) 4408c2ecf20Sopenharmony_ci 4418c2ecf20Sopenharmony_ci#define DP_TRAINING_PATTERN_SET 0x102 4428c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_DISABLE 0 4438c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_1 1 4448c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_2 2 4458c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_3 3 /* 1.2 */ 4468c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_4 7 /* 1.4 */ 4478c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_MASK 0x3 4488c2ecf20Sopenharmony_ci# define DP_TRAINING_PATTERN_MASK_1_4 0xf 4498c2ecf20Sopenharmony_ci 4508c2ecf20Sopenharmony_ci/* DPCD 1.1 only. For DPCD >= 1.2 see per-lane DP_LINK_QUAL_LANEn_SET */ 4518c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_11_DISABLE (0 << 2) 4528c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_11_D10_2 (1 << 2) 4538c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_11_ERROR_RATE (2 << 2) 4548c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_11_PRBS7 (3 << 2) 4558c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_11_MASK (3 << 2) 4568c2ecf20Sopenharmony_ci 4578c2ecf20Sopenharmony_ci# define DP_RECOVERED_CLOCK_OUT_EN (1 << 4) 4588c2ecf20Sopenharmony_ci# define DP_LINK_SCRAMBLING_DISABLE (1 << 5) 4598c2ecf20Sopenharmony_ci 4608c2ecf20Sopenharmony_ci# define DP_SYMBOL_ERROR_COUNT_BOTH (0 << 6) 4618c2ecf20Sopenharmony_ci# define DP_SYMBOL_ERROR_COUNT_DISPARITY (1 << 6) 4628c2ecf20Sopenharmony_ci# define DP_SYMBOL_ERROR_COUNT_SYMBOL (2 << 6) 4638c2ecf20Sopenharmony_ci# define DP_SYMBOL_ERROR_COUNT_MASK (3 << 6) 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE0_SET 0x103 4668c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE1_SET 0x104 4678c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE2_SET 0x105 4688c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE3_SET 0x106 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_ci# define DP_TRAIN_VOLTAGE_SWING_MASK 0x3 4718c2ecf20Sopenharmony_ci# define DP_TRAIN_VOLTAGE_SWING_SHIFT 0 4728c2ecf20Sopenharmony_ci# define DP_TRAIN_MAX_SWING_REACHED (1 << 2) 4738c2ecf20Sopenharmony_ci# define DP_TRAIN_VOLTAGE_SWING_LEVEL_0 (0 << 0) 4748c2ecf20Sopenharmony_ci# define DP_TRAIN_VOLTAGE_SWING_LEVEL_1 (1 << 0) 4758c2ecf20Sopenharmony_ci# define DP_TRAIN_VOLTAGE_SWING_LEVEL_2 (2 << 0) 4768c2ecf20Sopenharmony_ci# define DP_TRAIN_VOLTAGE_SWING_LEVEL_3 (3 << 0) 4778c2ecf20Sopenharmony_ci 4788c2ecf20Sopenharmony_ci# define DP_TRAIN_PRE_EMPHASIS_MASK (3 << 3) 4798c2ecf20Sopenharmony_ci# define DP_TRAIN_PRE_EMPH_LEVEL_0 (0 << 3) 4808c2ecf20Sopenharmony_ci# define DP_TRAIN_PRE_EMPH_LEVEL_1 (1 << 3) 4818c2ecf20Sopenharmony_ci# define DP_TRAIN_PRE_EMPH_LEVEL_2 (2 << 3) 4828c2ecf20Sopenharmony_ci# define DP_TRAIN_PRE_EMPH_LEVEL_3 (3 << 3) 4838c2ecf20Sopenharmony_ci 4848c2ecf20Sopenharmony_ci# define DP_TRAIN_PRE_EMPHASIS_SHIFT 3 4858c2ecf20Sopenharmony_ci# define DP_TRAIN_MAX_PRE_EMPHASIS_REACHED (1 << 5) 4868c2ecf20Sopenharmony_ci 4878c2ecf20Sopenharmony_ci#define DP_DOWNSPREAD_CTRL 0x107 4888c2ecf20Sopenharmony_ci# define DP_SPREAD_AMP_0_5 (1 << 4) 4898c2ecf20Sopenharmony_ci# define DP_MSA_TIMING_PAR_IGNORE_EN (1 << 7) /* eDP */ 4908c2ecf20Sopenharmony_ci 4918c2ecf20Sopenharmony_ci#define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108 4928c2ecf20Sopenharmony_ci# define DP_SET_ANSI_8B10B (1 << 0) 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_ci#define DP_I2C_SPEED_CONTROL_STATUS 0x109 /* DPI */ 4958c2ecf20Sopenharmony_ci/* bitmask as for DP_I2C_SPEED_CAP */ 4968c2ecf20Sopenharmony_ci 4978c2ecf20Sopenharmony_ci#define DP_EDP_CONFIGURATION_SET 0x10a /* XXX 1.2? */ 4988c2ecf20Sopenharmony_ci# define DP_ALTERNATE_SCRAMBLER_RESET_ENABLE (1 << 0) 4998c2ecf20Sopenharmony_ci# define DP_FRAMING_CHANGE_ENABLE (1 << 1) 5008c2ecf20Sopenharmony_ci# define DP_PANEL_SELF_TEST_ENABLE (1 << 7) 5018c2ecf20Sopenharmony_ci 5028c2ecf20Sopenharmony_ci#define DP_LINK_QUAL_LANE0_SET 0x10b /* DPCD >= 1.2 */ 5038c2ecf20Sopenharmony_ci#define DP_LINK_QUAL_LANE1_SET 0x10c 5048c2ecf20Sopenharmony_ci#define DP_LINK_QUAL_LANE2_SET 0x10d 5058c2ecf20Sopenharmony_ci#define DP_LINK_QUAL_LANE3_SET 0x10e 5068c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_DISABLE 0 5078c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_D10_2 1 5088c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_ERROR_RATE 2 5098c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_PRBS7 3 5108c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_80BIT_CUSTOM 4 5118c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_HBR2_EYE 5 5128c2ecf20Sopenharmony_ci# define DP_LINK_QUAL_PATTERN_MASK 7 5138c2ecf20Sopenharmony_ci 5148c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE0_1_SET2 0x10f 5158c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE2_3_SET2 0x110 5168c2ecf20Sopenharmony_ci# define DP_LANE02_POST_CURSOR2_SET_MASK (3 << 0) 5178c2ecf20Sopenharmony_ci# define DP_LANE02_MAX_POST_CURSOR2_REACHED (1 << 2) 5188c2ecf20Sopenharmony_ci# define DP_LANE13_POST_CURSOR2_SET_MASK (3 << 4) 5198c2ecf20Sopenharmony_ci# define DP_LANE13_MAX_POST_CURSOR2_REACHED (1 << 6) 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci#define DP_MSTM_CTRL 0x111 /* 1.2 */ 5228c2ecf20Sopenharmony_ci# define DP_MST_EN (1 << 0) 5238c2ecf20Sopenharmony_ci# define DP_UP_REQ_EN (1 << 1) 5248c2ecf20Sopenharmony_ci# define DP_UPSTREAM_IS_SRC (1 << 2) 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci#define DP_AUDIO_DELAY0 0x112 /* 1.2 */ 5278c2ecf20Sopenharmony_ci#define DP_AUDIO_DELAY1 0x113 5288c2ecf20Sopenharmony_ci#define DP_AUDIO_DELAY2 0x114 5298c2ecf20Sopenharmony_ci 5308c2ecf20Sopenharmony_ci#define DP_LINK_RATE_SET 0x115 /* eDP 1.4 */ 5318c2ecf20Sopenharmony_ci# define DP_LINK_RATE_SET_SHIFT 0 5328c2ecf20Sopenharmony_ci# define DP_LINK_RATE_SET_MASK (7 << 0) 5338c2ecf20Sopenharmony_ci 5348c2ecf20Sopenharmony_ci#define DP_RECEIVER_ALPM_CONFIG 0x116 /* eDP 1.4 */ 5358c2ecf20Sopenharmony_ci# define DP_ALPM_ENABLE (1 << 0) 5368c2ecf20Sopenharmony_ci# define DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE (1 << 1) 5378c2ecf20Sopenharmony_ci 5388c2ecf20Sopenharmony_ci#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CONF 0x117 /* eDP 1.4 */ 5398c2ecf20Sopenharmony_ci# define DP_AUX_FRAME_SYNC_ENABLE (1 << 0) 5408c2ecf20Sopenharmony_ci# define DP_IRQ_HPD_ENABLE (1 << 1) 5418c2ecf20Sopenharmony_ci 5428c2ecf20Sopenharmony_ci#define DP_UPSTREAM_DEVICE_DP_PWR_NEED 0x118 /* 1.2 */ 5438c2ecf20Sopenharmony_ci# define DP_PWR_NOT_NEEDED (1 << 0) 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci#define DP_FEC_CONFIGURATION 0x120 /* 1.4 */ 5468c2ecf20Sopenharmony_ci# define DP_FEC_READY (1 << 0) 5478c2ecf20Sopenharmony_ci# define DP_FEC_ERR_COUNT_SEL_MASK (7 << 1) 5488c2ecf20Sopenharmony_ci# define DP_FEC_ERR_COUNT_DIS (0 << 1) 5498c2ecf20Sopenharmony_ci# define DP_FEC_UNCORR_BLK_ERROR_COUNT (1 << 1) 5508c2ecf20Sopenharmony_ci# define DP_FEC_CORR_BLK_ERROR_COUNT (2 << 1) 5518c2ecf20Sopenharmony_ci# define DP_FEC_BIT_ERROR_COUNT (3 << 1) 5528c2ecf20Sopenharmony_ci# define DP_FEC_LANE_SELECT_MASK (3 << 4) 5538c2ecf20Sopenharmony_ci# define DP_FEC_LANE_0_SELECT (0 << 4) 5548c2ecf20Sopenharmony_ci# define DP_FEC_LANE_1_SELECT (1 << 4) 5558c2ecf20Sopenharmony_ci# define DP_FEC_LANE_2_SELECT (2 << 4) 5568c2ecf20Sopenharmony_ci# define DP_FEC_LANE_3_SELECT (3 << 4) 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci#define DP_AUX_FRAME_SYNC_VALUE 0x15c /* eDP 1.4 */ 5598c2ecf20Sopenharmony_ci# define DP_AUX_FRAME_SYNC_VALID (1 << 0) 5608c2ecf20Sopenharmony_ci 5618c2ecf20Sopenharmony_ci#define DP_DSC_ENABLE 0x160 /* DP 1.4 */ 5628c2ecf20Sopenharmony_ci# define DP_DECOMPRESSION_EN (1 << 0) 5638c2ecf20Sopenharmony_ci 5648c2ecf20Sopenharmony_ci#define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ 5658c2ecf20Sopenharmony_ci# define DP_PSR_ENABLE (1 << 0) 5668c2ecf20Sopenharmony_ci# define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) 5678c2ecf20Sopenharmony_ci# define DP_PSR_CRC_VERIFICATION (1 << 2) 5688c2ecf20Sopenharmony_ci# define DP_PSR_FRAME_CAPTURE (1 << 3) 5698c2ecf20Sopenharmony_ci# define DP_PSR_SELECTIVE_UPDATE (1 << 4) 5708c2ecf20Sopenharmony_ci# define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS (1 << 5) 5718c2ecf20Sopenharmony_ci# define DP_PSR_ENABLE_PSR2 (1 << 6) /* eDP 1.4a */ 5728c2ecf20Sopenharmony_ci 5738c2ecf20Sopenharmony_ci#define DP_ADAPTER_CTRL 0x1a0 5748c2ecf20Sopenharmony_ci# define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE (1 << 0) 5758c2ecf20Sopenharmony_ci 5768c2ecf20Sopenharmony_ci#define DP_BRANCH_DEVICE_CTRL 0x1a1 5778c2ecf20Sopenharmony_ci# define DP_BRANCH_DEVICE_IRQ_HPD (1 << 0) 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci#define DP_PAYLOAD_ALLOCATE_SET 0x1c0 5808c2ecf20Sopenharmony_ci#define DP_PAYLOAD_ALLOCATE_START_TIME_SLOT 0x1c1 5818c2ecf20Sopenharmony_ci#define DP_PAYLOAD_ALLOCATE_TIME_SLOT_COUNT 0x1c2 5828c2ecf20Sopenharmony_ci 5838c2ecf20Sopenharmony_ci#define DP_SINK_COUNT 0x200 5848c2ecf20Sopenharmony_ci/* prior to 1.2 bit 7 was reserved mbz */ 5858c2ecf20Sopenharmony_ci# define DP_GET_SINK_COUNT(x) ((((x) & 0x80) >> 1) | ((x) & 0x3f)) 5868c2ecf20Sopenharmony_ci# define DP_SINK_CP_READY (1 << 6) 5878c2ecf20Sopenharmony_ci 5888c2ecf20Sopenharmony_ci#define DP_DEVICE_SERVICE_IRQ_VECTOR 0x201 5898c2ecf20Sopenharmony_ci# define DP_REMOTE_CONTROL_COMMAND_PENDING (1 << 0) 5908c2ecf20Sopenharmony_ci# define DP_AUTOMATED_TEST_REQUEST (1 << 1) 5918c2ecf20Sopenharmony_ci# define DP_CP_IRQ (1 << 2) 5928c2ecf20Sopenharmony_ci# define DP_MCCS_IRQ (1 << 3) 5938c2ecf20Sopenharmony_ci# define DP_DOWN_REP_MSG_RDY (1 << 4) /* 1.2 MST */ 5948c2ecf20Sopenharmony_ci# define DP_UP_REQ_MSG_RDY (1 << 5) /* 1.2 MST */ 5958c2ecf20Sopenharmony_ci# define DP_SINK_SPECIFIC_IRQ (1 << 6) 5968c2ecf20Sopenharmony_ci 5978c2ecf20Sopenharmony_ci#define DP_LANE0_1_STATUS 0x202 5988c2ecf20Sopenharmony_ci#define DP_LANE2_3_STATUS 0x203 5998c2ecf20Sopenharmony_ci# define DP_LANE_CR_DONE (1 << 0) 6008c2ecf20Sopenharmony_ci# define DP_LANE_CHANNEL_EQ_DONE (1 << 1) 6018c2ecf20Sopenharmony_ci# define DP_LANE_SYMBOL_LOCKED (1 << 2) 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci#define DP_CHANNEL_EQ_BITS (DP_LANE_CR_DONE | \ 6048c2ecf20Sopenharmony_ci DP_LANE_CHANNEL_EQ_DONE | \ 6058c2ecf20Sopenharmony_ci DP_LANE_SYMBOL_LOCKED) 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ci#define DP_LANE_ALIGN_STATUS_UPDATED 0x204 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ci#define DP_INTERLANE_ALIGN_DONE (1 << 0) 6108c2ecf20Sopenharmony_ci#define DP_DOWNSTREAM_PORT_STATUS_CHANGED (1 << 6) 6118c2ecf20Sopenharmony_ci#define DP_LINK_STATUS_UPDATED (1 << 7) 6128c2ecf20Sopenharmony_ci 6138c2ecf20Sopenharmony_ci#define DP_SINK_STATUS 0x205 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci#define DP_RECEIVE_PORT_0_STATUS (1 << 0) 6168c2ecf20Sopenharmony_ci#define DP_RECEIVE_PORT_1_STATUS (1 << 1) 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci#define DP_ADJUST_REQUEST_LANE0_1 0x206 6198c2ecf20Sopenharmony_ci#define DP_ADJUST_REQUEST_LANE2_3 0x207 6208c2ecf20Sopenharmony_ci# define DP_ADJUST_VOLTAGE_SWING_LANE0_MASK 0x03 6218c2ecf20Sopenharmony_ci# define DP_ADJUST_VOLTAGE_SWING_LANE0_SHIFT 0 6228c2ecf20Sopenharmony_ci# define DP_ADJUST_PRE_EMPHASIS_LANE0_MASK 0x0c 6238c2ecf20Sopenharmony_ci# define DP_ADJUST_PRE_EMPHASIS_LANE0_SHIFT 2 6248c2ecf20Sopenharmony_ci# define DP_ADJUST_VOLTAGE_SWING_LANE1_MASK 0x30 6258c2ecf20Sopenharmony_ci# define DP_ADJUST_VOLTAGE_SWING_LANE1_SHIFT 4 6268c2ecf20Sopenharmony_ci# define DP_ADJUST_PRE_EMPHASIS_LANE1_MASK 0xc0 6278c2ecf20Sopenharmony_ci# define DP_ADJUST_PRE_EMPHASIS_LANE1_SHIFT 6 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci#define DP_ADJUST_REQUEST_POST_CURSOR2 0x20c 6308c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE0_MASK 0x03 6318c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE0_SHIFT 0 6328c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE1_MASK 0x0c 6338c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE1_SHIFT 2 6348c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE2_MASK 0x30 6358c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE2_SHIFT 4 6368c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE3_MASK 0xc0 6378c2ecf20Sopenharmony_ci# define DP_ADJUST_POST_CURSOR2_LANE3_SHIFT 6 6388c2ecf20Sopenharmony_ci 6398c2ecf20Sopenharmony_ci#define DP_TEST_REQUEST 0x218 6408c2ecf20Sopenharmony_ci# define DP_TEST_LINK_TRAINING (1 << 0) 6418c2ecf20Sopenharmony_ci# define DP_TEST_LINK_VIDEO_PATTERN (1 << 1) 6428c2ecf20Sopenharmony_ci# define DP_TEST_LINK_EDID_READ (1 << 2) 6438c2ecf20Sopenharmony_ci# define DP_TEST_LINK_PHY_TEST_PATTERN (1 << 3) /* DPCD >= 1.1 */ 6448c2ecf20Sopenharmony_ci# define DP_TEST_LINK_FAUX_PATTERN (1 << 4) /* DPCD >= 1.2 */ 6458c2ecf20Sopenharmony_ci# define DP_TEST_LINK_AUDIO_PATTERN (1 << 5) /* DPCD >= 1.2 */ 6468c2ecf20Sopenharmony_ci# define DP_TEST_LINK_AUDIO_DISABLED_VIDEO (1 << 6) /* DPCD >= 1.2 */ 6478c2ecf20Sopenharmony_ci 6488c2ecf20Sopenharmony_ci#define DP_TEST_LINK_RATE 0x219 6498c2ecf20Sopenharmony_ci# define DP_LINK_RATE_162 (0x6) 6508c2ecf20Sopenharmony_ci# define DP_LINK_RATE_27 (0xa) 6518c2ecf20Sopenharmony_ci 6528c2ecf20Sopenharmony_ci#define DP_TEST_LANE_COUNT 0x220 6538c2ecf20Sopenharmony_ci 6548c2ecf20Sopenharmony_ci#define DP_TEST_PATTERN 0x221 6558c2ecf20Sopenharmony_ci# define DP_NO_TEST_PATTERN 0x0 6568c2ecf20Sopenharmony_ci# define DP_COLOR_RAMP 0x1 6578c2ecf20Sopenharmony_ci# define DP_BLACK_AND_WHITE_VERTICAL_LINES 0x2 6588c2ecf20Sopenharmony_ci# define DP_COLOR_SQUARE 0x3 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ci#define DP_TEST_H_TOTAL_HI 0x222 6618c2ecf20Sopenharmony_ci#define DP_TEST_H_TOTAL_LO 0x223 6628c2ecf20Sopenharmony_ci 6638c2ecf20Sopenharmony_ci#define DP_TEST_V_TOTAL_HI 0x224 6648c2ecf20Sopenharmony_ci#define DP_TEST_V_TOTAL_LO 0x225 6658c2ecf20Sopenharmony_ci 6668c2ecf20Sopenharmony_ci#define DP_TEST_H_START_HI 0x226 6678c2ecf20Sopenharmony_ci#define DP_TEST_H_START_LO 0x227 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_ci#define DP_TEST_V_START_HI 0x228 6708c2ecf20Sopenharmony_ci#define DP_TEST_V_START_LO 0x229 6718c2ecf20Sopenharmony_ci 6728c2ecf20Sopenharmony_ci#define DP_TEST_HSYNC_HI 0x22A 6738c2ecf20Sopenharmony_ci# define DP_TEST_HSYNC_POLARITY (1 << 7) 6748c2ecf20Sopenharmony_ci# define DP_TEST_HSYNC_WIDTH_HI_MASK (127 << 0) 6758c2ecf20Sopenharmony_ci#define DP_TEST_HSYNC_WIDTH_LO 0x22B 6768c2ecf20Sopenharmony_ci 6778c2ecf20Sopenharmony_ci#define DP_TEST_VSYNC_HI 0x22C 6788c2ecf20Sopenharmony_ci# define DP_TEST_VSYNC_POLARITY (1 << 7) 6798c2ecf20Sopenharmony_ci# define DP_TEST_VSYNC_WIDTH_HI_MASK (127 << 0) 6808c2ecf20Sopenharmony_ci#define DP_TEST_VSYNC_WIDTH_LO 0x22D 6818c2ecf20Sopenharmony_ci 6828c2ecf20Sopenharmony_ci#define DP_TEST_H_WIDTH_HI 0x22E 6838c2ecf20Sopenharmony_ci#define DP_TEST_H_WIDTH_LO 0x22F 6848c2ecf20Sopenharmony_ci 6858c2ecf20Sopenharmony_ci#define DP_TEST_V_HEIGHT_HI 0x230 6868c2ecf20Sopenharmony_ci#define DP_TEST_V_HEIGHT_LO 0x231 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci#define DP_TEST_MISC0 0x232 6898c2ecf20Sopenharmony_ci# define DP_TEST_SYNC_CLOCK (1 << 0) 6908c2ecf20Sopenharmony_ci# define DP_TEST_COLOR_FORMAT_MASK (3 << 1) 6918c2ecf20Sopenharmony_ci# define DP_TEST_COLOR_FORMAT_SHIFT 1 6928c2ecf20Sopenharmony_ci# define DP_COLOR_FORMAT_RGB (0 << 1) 6938c2ecf20Sopenharmony_ci# define DP_COLOR_FORMAT_YCbCr422 (1 << 1) 6948c2ecf20Sopenharmony_ci# define DP_COLOR_FORMAT_YCbCr444 (2 << 1) 6958c2ecf20Sopenharmony_ci# define DP_TEST_DYNAMIC_RANGE_VESA (0 << 3) 6968c2ecf20Sopenharmony_ci# define DP_TEST_DYNAMIC_RANGE_CEA (1 << 3) 6978c2ecf20Sopenharmony_ci# define DP_TEST_YCBCR_COEFFICIENTS (1 << 4) 6988c2ecf20Sopenharmony_ci# define DP_YCBCR_COEFFICIENTS_ITU601 (0 << 4) 6998c2ecf20Sopenharmony_ci# define DP_YCBCR_COEFFICIENTS_ITU709 (1 << 4) 7008c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_MASK (7 << 5) 7018c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_SHIFT 5 7028c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_6 (0 << 5) 7038c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_8 (1 << 5) 7048c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_10 (2 << 5) 7058c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_12 (3 << 5) 7068c2ecf20Sopenharmony_ci# define DP_TEST_BIT_DEPTH_16 (4 << 5) 7078c2ecf20Sopenharmony_ci 7088c2ecf20Sopenharmony_ci#define DP_TEST_MISC1 0x233 7098c2ecf20Sopenharmony_ci# define DP_TEST_REFRESH_DENOMINATOR (1 << 0) 7108c2ecf20Sopenharmony_ci# define DP_TEST_INTERLACED (1 << 1) 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_ci#define DP_TEST_REFRESH_RATE_NUMERATOR 0x234 7138c2ecf20Sopenharmony_ci 7148c2ecf20Sopenharmony_ci#define DP_TEST_MISC0 0x232 7158c2ecf20Sopenharmony_ci 7168c2ecf20Sopenharmony_ci#define DP_TEST_CRC_R_CR 0x240 7178c2ecf20Sopenharmony_ci#define DP_TEST_CRC_G_Y 0x242 7188c2ecf20Sopenharmony_ci#define DP_TEST_CRC_B_CB 0x244 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_ci#define DP_TEST_SINK_MISC 0x246 7218c2ecf20Sopenharmony_ci# define DP_TEST_CRC_SUPPORTED (1 << 5) 7228c2ecf20Sopenharmony_ci# define DP_TEST_COUNT_MASK 0xf 7238c2ecf20Sopenharmony_ci 7248c2ecf20Sopenharmony_ci#define DP_PHY_TEST_PATTERN 0x248 7258c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_SEL_MASK 0x7 7268c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_NONE 0x0 7278c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_D10_2 0x1 7288c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_ERROR_COUNT 0x2 7298c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_PRBS7 0x3 7308c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_80BIT_CUSTOM 0x4 7318c2ecf20Sopenharmony_ci# define DP_PHY_TEST_PATTERN_CP2520 0x5 7328c2ecf20Sopenharmony_ci 7338c2ecf20Sopenharmony_ci#define DP_TEST_HBR2_SCRAMBLER_RESET 0x24A 7348c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_7_0 0x250 7358c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_15_8 0x251 7368c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_23_16 0x252 7378c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_31_24 0x253 7388c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_39_32 0x254 7398c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_47_40 0x255 7408c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_55_48 0x256 7418c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_63_56 0x257 7428c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_71_64 0x258 7438c2ecf20Sopenharmony_ci#define DP_TEST_80BIT_CUSTOM_PATTERN_79_72 0x259 7448c2ecf20Sopenharmony_ci 7458c2ecf20Sopenharmony_ci#define DP_TEST_RESPONSE 0x260 7468c2ecf20Sopenharmony_ci# define DP_TEST_ACK (1 << 0) 7478c2ecf20Sopenharmony_ci# define DP_TEST_NAK (1 << 1) 7488c2ecf20Sopenharmony_ci# define DP_TEST_EDID_CHECKSUM_WRITE (1 << 2) 7498c2ecf20Sopenharmony_ci 7508c2ecf20Sopenharmony_ci#define DP_TEST_EDID_CHECKSUM 0x261 7518c2ecf20Sopenharmony_ci 7528c2ecf20Sopenharmony_ci#define DP_TEST_SINK 0x270 7538c2ecf20Sopenharmony_ci# define DP_TEST_SINK_START (1 << 0) 7548c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_MODE 0x271 7558c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PATTERN_TYPE 0x272 7568c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH1 0x273 7578c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH2 0x274 7588c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH3 0x275 7598c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH4 0x276 7608c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH5 0x277 7618c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH6 0x278 7628c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH7 0x279 7638c2ecf20Sopenharmony_ci#define DP_TEST_AUDIO_PERIOD_CH8 0x27A 7648c2ecf20Sopenharmony_ci 7658c2ecf20Sopenharmony_ci#define DP_FEC_STATUS 0x280 /* 1.4 */ 7668c2ecf20Sopenharmony_ci# define DP_FEC_DECODE_EN_DETECTED (1 << 0) 7678c2ecf20Sopenharmony_ci# define DP_FEC_DECODE_DIS_DETECTED (1 << 1) 7688c2ecf20Sopenharmony_ci 7698c2ecf20Sopenharmony_ci#define DP_FEC_ERROR_COUNT_LSB 0x0281 /* 1.4 */ 7708c2ecf20Sopenharmony_ci 7718c2ecf20Sopenharmony_ci#define DP_FEC_ERROR_COUNT_MSB 0x0282 /* 1.4 */ 7728c2ecf20Sopenharmony_ci# define DP_FEC_ERROR_COUNT_MASK 0x7F 7738c2ecf20Sopenharmony_ci# define DP_FEC_ERR_COUNT_VALID (1 << 7) 7748c2ecf20Sopenharmony_ci 7758c2ecf20Sopenharmony_ci#define DP_PAYLOAD_TABLE_UPDATE_STATUS 0x2c0 /* 1.2 MST */ 7768c2ecf20Sopenharmony_ci# define DP_PAYLOAD_TABLE_UPDATED (1 << 0) 7778c2ecf20Sopenharmony_ci# define DP_PAYLOAD_ACT_HANDLED (1 << 1) 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci#define DP_VC_PAYLOAD_ID_SLOT_1 0x2c1 /* 1.2 MST */ 7808c2ecf20Sopenharmony_ci/* up to ID_SLOT_63 at 0x2ff */ 7818c2ecf20Sopenharmony_ci 7828c2ecf20Sopenharmony_ci#define DP_SOURCE_OUI 0x300 7838c2ecf20Sopenharmony_ci#define DP_SINK_OUI 0x400 7848c2ecf20Sopenharmony_ci#define DP_BRANCH_OUI 0x500 7858c2ecf20Sopenharmony_ci#define DP_BRANCH_ID 0x503 7868c2ecf20Sopenharmony_ci#define DP_BRANCH_REVISION_START 0x509 7878c2ecf20Sopenharmony_ci#define DP_BRANCH_HW_REV 0x509 7888c2ecf20Sopenharmony_ci#define DP_BRANCH_SW_REV 0x50A 7898c2ecf20Sopenharmony_ci 7908c2ecf20Sopenharmony_ci#define DP_SET_POWER 0x600 7918c2ecf20Sopenharmony_ci# define DP_SET_POWER_D0 0x1 7928c2ecf20Sopenharmony_ci# define DP_SET_POWER_D3 0x2 7938c2ecf20Sopenharmony_ci# define DP_SET_POWER_MASK 0x3 7948c2ecf20Sopenharmony_ci# define DP_SET_POWER_D3_AUX_ON 0x5 7958c2ecf20Sopenharmony_ci 7968c2ecf20Sopenharmony_ci#define DP_EDP_DPCD_REV 0x700 /* eDP 1.2 */ 7978c2ecf20Sopenharmony_ci# define DP_EDP_11 0x00 7988c2ecf20Sopenharmony_ci# define DP_EDP_12 0x01 7998c2ecf20Sopenharmony_ci# define DP_EDP_13 0x02 8008c2ecf20Sopenharmony_ci# define DP_EDP_14 0x03 8018c2ecf20Sopenharmony_ci# define DP_EDP_14a 0x04 /* eDP 1.4a */ 8028c2ecf20Sopenharmony_ci# define DP_EDP_14b 0x05 /* eDP 1.4b */ 8038c2ecf20Sopenharmony_ci 8048c2ecf20Sopenharmony_ci#define DP_EDP_GENERAL_CAP_1 0x701 8058c2ecf20Sopenharmony_ci# define DP_EDP_TCON_BACKLIGHT_ADJUSTMENT_CAP (1 << 0) 8068c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_PIN_ENABLE_CAP (1 << 1) 8078c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_AUX_ENABLE_CAP (1 << 2) 8088c2ecf20Sopenharmony_ci# define DP_EDP_PANEL_SELF_TEST_PIN_ENABLE_CAP (1 << 3) 8098c2ecf20Sopenharmony_ci# define DP_EDP_PANEL_SELF_TEST_AUX_ENABLE_CAP (1 << 4) 8108c2ecf20Sopenharmony_ci# define DP_EDP_FRC_ENABLE_CAP (1 << 5) 8118c2ecf20Sopenharmony_ci# define DP_EDP_COLOR_ENGINE_CAP (1 << 6) 8128c2ecf20Sopenharmony_ci# define DP_EDP_SET_POWER_CAP (1 << 7) 8138c2ecf20Sopenharmony_ci 8148c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_ADJUSTMENT_CAP 0x702 8158c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_BRIGHTNESS_PWM_PIN_CAP (1 << 0) 8168c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_BRIGHTNESS_AUX_SET_CAP (1 << 1) 8178c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT (1 << 2) 8188c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_AUX_PWM_PRODUCT_CAP (1 << 3) 8198c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_FREQ_PWM_PIN_PASSTHRU_CAP (1 << 4) 8208c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_FREQ_AUX_SET_CAP (1 << 5) 8218c2ecf20Sopenharmony_ci# define DP_EDP_DYNAMIC_BACKLIGHT_CAP (1 << 6) 8228c2ecf20Sopenharmony_ci# define DP_EDP_VBLANK_BACKLIGHT_UPDATE_CAP (1 << 7) 8238c2ecf20Sopenharmony_ci 8248c2ecf20Sopenharmony_ci#define DP_EDP_GENERAL_CAP_2 0x703 8258c2ecf20Sopenharmony_ci# define DP_EDP_OVERDRIVE_ENGINE_ENABLED (1 << 0) 8268c2ecf20Sopenharmony_ci 8278c2ecf20Sopenharmony_ci#define DP_EDP_GENERAL_CAP_3 0x704 /* eDP 1.4 */ 8288c2ecf20Sopenharmony_ci# define DP_EDP_X_REGION_CAP_MASK (0xf << 0) 8298c2ecf20Sopenharmony_ci# define DP_EDP_X_REGION_CAP_SHIFT 0 8308c2ecf20Sopenharmony_ci# define DP_EDP_Y_REGION_CAP_MASK (0xf << 4) 8318c2ecf20Sopenharmony_ci# define DP_EDP_Y_REGION_CAP_SHIFT 4 8328c2ecf20Sopenharmony_ci 8338c2ecf20Sopenharmony_ci#define DP_EDP_DISPLAY_CONTROL_REGISTER 0x720 8348c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_ENABLE (1 << 0) 8358c2ecf20Sopenharmony_ci# define DP_EDP_BLACK_VIDEO_ENABLE (1 << 1) 8368c2ecf20Sopenharmony_ci# define DP_EDP_FRC_ENABLE (1 << 2) 8378c2ecf20Sopenharmony_ci# define DP_EDP_COLOR_ENGINE_ENABLE (1 << 3) 8388c2ecf20Sopenharmony_ci# define DP_EDP_VBLANK_BACKLIGHT_UPDATE_ENABLE (1 << 7) 8398c2ecf20Sopenharmony_ci 8408c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_MODE_SET_REGISTER 0x721 8418c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_CONTROL_MODE_MASK (3 << 0) 8428c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_CONTROL_MODE_PWM (0 << 0) 8438c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_CONTROL_MODE_PRESET (1 << 0) 8448c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_CONTROL_MODE_DPCD (2 << 0) 8458c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_CONTROL_MODE_PRODUCT (3 << 0) 8468c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_FREQ_PWM_PIN_PASSTHRU_ENABLE (1 << 2) 8478c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_FREQ_AUX_SET_ENABLE (1 << 3) 8488c2ecf20Sopenharmony_ci# define DP_EDP_DYNAMIC_BACKLIGHT_ENABLE (1 << 4) 8498c2ecf20Sopenharmony_ci# define DP_EDP_REGIONAL_BACKLIGHT_ENABLE (1 << 5) 8508c2ecf20Sopenharmony_ci# define DP_EDP_UPDATE_REGION_BRIGHTNESS (1 << 6) /* eDP 1.4 */ 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_BRIGHTNESS_MSB 0x722 8538c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_BRIGHTNESS_LSB 0x723 8548c2ecf20Sopenharmony_ci 8558c2ecf20Sopenharmony_ci#define DP_EDP_PWMGEN_BIT_COUNT 0x724 8568c2ecf20Sopenharmony_ci#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN 0x725 8578c2ecf20Sopenharmony_ci#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX 0x726 8588c2ecf20Sopenharmony_ci# define DP_EDP_PWMGEN_BIT_COUNT_MASK (0x1f << 0) 8598c2ecf20Sopenharmony_ci 8608c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_CONTROL_STATUS 0x727 8618c2ecf20Sopenharmony_ci 8628c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_SET 0x728 8638c2ecf20Sopenharmony_ci# define DP_EDP_BACKLIGHT_FREQ_BASE_KHZ 27000 8648c2ecf20Sopenharmony_ci 8658c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB 0x72a 8668c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID 0x72b 8678c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_LSB 0x72c 8688c2ecf20Sopenharmony_ci 8698c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MSB 0x72d 8708c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MID 0x72e 8718c2ecf20Sopenharmony_ci#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_LSB 0x72f 8728c2ecf20Sopenharmony_ci 8738c2ecf20Sopenharmony_ci#define DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET 0x732 8748c2ecf20Sopenharmony_ci#define DP_EDP_DBC_MAXIMUM_BRIGHTNESS_SET 0x733 8758c2ecf20Sopenharmony_ci 8768c2ecf20Sopenharmony_ci#define DP_EDP_REGIONAL_BACKLIGHT_BASE 0x740 /* eDP 1.4 */ 8778c2ecf20Sopenharmony_ci#define DP_EDP_REGIONAL_BACKLIGHT_0 0x741 /* eDP 1.4 */ 8788c2ecf20Sopenharmony_ci 8798c2ecf20Sopenharmony_ci#define DP_SIDEBAND_MSG_DOWN_REQ_BASE 0x1000 /* 1.2 MST */ 8808c2ecf20Sopenharmony_ci#define DP_SIDEBAND_MSG_UP_REP_BASE 0x1200 /* 1.2 MST */ 8818c2ecf20Sopenharmony_ci#define DP_SIDEBAND_MSG_DOWN_REP_BASE 0x1400 /* 1.2 MST */ 8828c2ecf20Sopenharmony_ci#define DP_SIDEBAND_MSG_UP_REQ_BASE 0x1600 /* 1.2 MST */ 8838c2ecf20Sopenharmony_ci 8848c2ecf20Sopenharmony_ci#define DP_SINK_COUNT_ESI 0x2002 /* 1.2 */ 8858c2ecf20Sopenharmony_ci/* 0-5 sink count */ 8868c2ecf20Sopenharmony_ci# define DP_SINK_COUNT_CP_READY (1 << 6) 8878c2ecf20Sopenharmony_ci 8888c2ecf20Sopenharmony_ci#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */ 8898c2ecf20Sopenharmony_ci 8908c2ecf20Sopenharmony_ci#define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */ 8918c2ecf20Sopenharmony_ci# define DP_RX_GTC_MSTR_REQ_STATUS_CHANGE (1 << 0) 8928c2ecf20Sopenharmony_ci# define DP_LOCK_ACQUISITION_REQUEST (1 << 1) 8938c2ecf20Sopenharmony_ci# define DP_CEC_IRQ (1 << 2) 8948c2ecf20Sopenharmony_ci 8958c2ecf20Sopenharmony_ci#define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005 /* 1.2 */ 8968c2ecf20Sopenharmony_ci 8978c2ecf20Sopenharmony_ci#define DP_PSR_ERROR_STATUS 0x2006 /* XXX 1.2? */ 8988c2ecf20Sopenharmony_ci# define DP_PSR_LINK_CRC_ERROR (1 << 0) 8998c2ecf20Sopenharmony_ci# define DP_PSR_RFB_STORAGE_ERROR (1 << 1) 9008c2ecf20Sopenharmony_ci# define DP_PSR_VSC_SDP_UNCORRECTABLE_ERROR (1 << 2) /* eDP 1.4 */ 9018c2ecf20Sopenharmony_ci 9028c2ecf20Sopenharmony_ci#define DP_PSR_ESI 0x2007 /* XXX 1.2? */ 9038c2ecf20Sopenharmony_ci# define DP_PSR_CAPS_CHANGE (1 << 0) 9048c2ecf20Sopenharmony_ci 9058c2ecf20Sopenharmony_ci#define DP_PSR_STATUS 0x2008 /* XXX 1.2? */ 9068c2ecf20Sopenharmony_ci# define DP_PSR_SINK_INACTIVE 0 9078c2ecf20Sopenharmony_ci# define DP_PSR_SINK_ACTIVE_SRC_SYNCED 1 9088c2ecf20Sopenharmony_ci# define DP_PSR_SINK_ACTIVE_RFB 2 9098c2ecf20Sopenharmony_ci# define DP_PSR_SINK_ACTIVE_SINK_SYNCED 3 9108c2ecf20Sopenharmony_ci# define DP_PSR_SINK_ACTIVE_RESYNC 4 9118c2ecf20Sopenharmony_ci# define DP_PSR_SINK_INTERNAL_ERROR 7 9128c2ecf20Sopenharmony_ci# define DP_PSR_SINK_STATE_MASK 0x07 9138c2ecf20Sopenharmony_ci 9148c2ecf20Sopenharmony_ci#define DP_SYNCHRONIZATION_LATENCY_IN_SINK 0x2009 /* edp 1.4 */ 9158c2ecf20Sopenharmony_ci# define DP_MAX_RESYNC_FRAME_COUNT_MASK (0xf << 0) 9168c2ecf20Sopenharmony_ci# define DP_MAX_RESYNC_FRAME_COUNT_SHIFT 0 9178c2ecf20Sopenharmony_ci# define DP_LAST_ACTUAL_SYNCHRONIZATION_LATENCY_MASK (0xf << 4) 9188c2ecf20Sopenharmony_ci# define DP_LAST_ACTUAL_SYNCHRONIZATION_LATENCY_SHIFT 4 9198c2ecf20Sopenharmony_ci 9208c2ecf20Sopenharmony_ci#define DP_LAST_RECEIVED_PSR_SDP 0x200a /* eDP 1.2 */ 9218c2ecf20Sopenharmony_ci# define DP_PSR_STATE_BIT (1 << 0) /* eDP 1.2 */ 9228c2ecf20Sopenharmony_ci# define DP_UPDATE_RFB_BIT (1 << 1) /* eDP 1.2 */ 9238c2ecf20Sopenharmony_ci# define DP_CRC_VALID_BIT (1 << 2) /* eDP 1.2 */ 9248c2ecf20Sopenharmony_ci# define DP_SU_VALID (1 << 3) /* eDP 1.4 */ 9258c2ecf20Sopenharmony_ci# define DP_FIRST_SCAN_LINE_SU_REGION (1 << 4) /* eDP 1.4 */ 9268c2ecf20Sopenharmony_ci# define DP_LAST_SCAN_LINE_SU_REGION (1 << 5) /* eDP 1.4 */ 9278c2ecf20Sopenharmony_ci# define DP_Y_COORDINATE_VALID (1 << 6) /* eDP 1.4a */ 9288c2ecf20Sopenharmony_ci 9298c2ecf20Sopenharmony_ci#define DP_RECEIVER_ALPM_STATUS 0x200b /* eDP 1.4 */ 9308c2ecf20Sopenharmony_ci# define DP_ALPM_LOCK_TIMEOUT_ERROR (1 << 0) 9318c2ecf20Sopenharmony_ci 9328c2ecf20Sopenharmony_ci#define DP_LANE0_1_STATUS_ESI 0x200c /* status same as 0x202 */ 9338c2ecf20Sopenharmony_ci#define DP_LANE2_3_STATUS_ESI 0x200d /* status same as 0x203 */ 9348c2ecf20Sopenharmony_ci#define DP_LANE_ALIGN_STATUS_UPDATED_ESI 0x200e /* status same as 0x204 */ 9358c2ecf20Sopenharmony_ci#define DP_SINK_STATUS_ESI 0x200f /* status same as 0x205 */ 9368c2ecf20Sopenharmony_ci 9378c2ecf20Sopenharmony_ci#define DP_DP13_DPCD_REV 0x2200 9388c2ecf20Sopenharmony_ci#define DP_DP13_MAX_LINK_RATE 0x2201 9398c2ecf20Sopenharmony_ci 9408c2ecf20Sopenharmony_ci#define DP_DPRX_FEATURE_ENUMERATION_LIST 0x2210 /* DP 1.3 */ 9418c2ecf20Sopenharmony_ci# define DP_GTC_CAP (1 << 0) /* DP 1.3 */ 9428c2ecf20Sopenharmony_ci# define DP_SST_SPLIT_SDP_CAP (1 << 1) /* DP 1.4 */ 9438c2ecf20Sopenharmony_ci# define DP_AV_SYNC_CAP (1 << 2) /* DP 1.3 */ 9448c2ecf20Sopenharmony_ci# define DP_VSC_SDP_EXT_FOR_COLORIMETRY_SUPPORTED (1 << 3) /* DP 1.3 */ 9458c2ecf20Sopenharmony_ci# define DP_VSC_EXT_VESA_SDP_SUPPORTED (1 << 4) /* DP 1.4 */ 9468c2ecf20Sopenharmony_ci# define DP_VSC_EXT_VESA_SDP_CHAINING_SUPPORTED (1 << 5) /* DP 1.4 */ 9478c2ecf20Sopenharmony_ci# define DP_VSC_EXT_CEA_SDP_SUPPORTED (1 << 6) /* DP 1.4 */ 9488c2ecf20Sopenharmony_ci# define DP_VSC_EXT_CEA_SDP_CHAINING_SUPPORTED (1 << 7) /* DP 1.4 */ 9498c2ecf20Sopenharmony_ci 9508c2ecf20Sopenharmony_ci/* HDMI CEC tunneling over AUX DP 1.3 section 5.3.3.3.1 DPCD 1.4+ */ 9518c2ecf20Sopenharmony_ci#define DP_CEC_TUNNELING_CAPABILITY 0x3000 9528c2ecf20Sopenharmony_ci# define DP_CEC_TUNNELING_CAPABLE (1 << 0) 9538c2ecf20Sopenharmony_ci# define DP_CEC_SNOOPING_CAPABLE (1 << 1) 9548c2ecf20Sopenharmony_ci# define DP_CEC_MULTIPLE_LA_CAPABLE (1 << 2) 9558c2ecf20Sopenharmony_ci 9568c2ecf20Sopenharmony_ci#define DP_CEC_TUNNELING_CONTROL 0x3001 9578c2ecf20Sopenharmony_ci# define DP_CEC_TUNNELING_ENABLE (1 << 0) 9588c2ecf20Sopenharmony_ci# define DP_CEC_SNOOPING_ENABLE (1 << 1) 9598c2ecf20Sopenharmony_ci 9608c2ecf20Sopenharmony_ci#define DP_CEC_RX_MESSAGE_INFO 0x3002 9618c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_LEN_MASK (0xf << 0) 9628c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_LEN_SHIFT 0 9638c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_HPD_STATE (1 << 4) 9648c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_HPD_LOST (1 << 5) 9658c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_ACKED (1 << 6) 9668c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_ENDED (1 << 7) 9678c2ecf20Sopenharmony_ci 9688c2ecf20Sopenharmony_ci#define DP_CEC_TX_MESSAGE_INFO 0x3003 9698c2ecf20Sopenharmony_ci# define DP_CEC_TX_MESSAGE_LEN_MASK (0xf << 0) 9708c2ecf20Sopenharmony_ci# define DP_CEC_TX_MESSAGE_LEN_SHIFT 0 9718c2ecf20Sopenharmony_ci# define DP_CEC_TX_RETRY_COUNT_MASK (0x7 << 4) 9728c2ecf20Sopenharmony_ci# define DP_CEC_TX_RETRY_COUNT_SHIFT 4 9738c2ecf20Sopenharmony_ci# define DP_CEC_TX_MESSAGE_SEND (1 << 7) 9748c2ecf20Sopenharmony_ci 9758c2ecf20Sopenharmony_ci#define DP_CEC_TUNNELING_IRQ_FLAGS 0x3004 9768c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_INFO_VALID (1 << 0) 9778c2ecf20Sopenharmony_ci# define DP_CEC_RX_MESSAGE_OVERFLOW (1 << 1) 9788c2ecf20Sopenharmony_ci# define DP_CEC_TX_MESSAGE_SENT (1 << 4) 9798c2ecf20Sopenharmony_ci# define DP_CEC_TX_LINE_ERROR (1 << 5) 9808c2ecf20Sopenharmony_ci# define DP_CEC_TX_ADDRESS_NACK_ERROR (1 << 6) 9818c2ecf20Sopenharmony_ci# define DP_CEC_TX_DATA_NACK_ERROR (1 << 7) 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_ci#define DP_CEC_LOGICAL_ADDRESS_MASK 0x300E /* 0x300F word */ 9848c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_0 (1 << 0) 9858c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_1 (1 << 1) 9868c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_2 (1 << 2) 9878c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_3 (1 << 3) 9888c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_4 (1 << 4) 9898c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_5 (1 << 5) 9908c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_6 (1 << 6) 9918c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_7 (1 << 7) 9928c2ecf20Sopenharmony_ci#define DP_CEC_LOGICAL_ADDRESS_MASK_2 0x300F /* 0x300E word */ 9938c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_8 (1 << 0) 9948c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_9 (1 << 1) 9958c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_10 (1 << 2) 9968c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_11 (1 << 3) 9978c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_12 (1 << 4) 9988c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_13 (1 << 5) 9998c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_14 (1 << 6) 10008c2ecf20Sopenharmony_ci# define DP_CEC_LOGICAL_ADDRESS_15 (1 << 7) 10018c2ecf20Sopenharmony_ci 10028c2ecf20Sopenharmony_ci#define DP_CEC_RX_MESSAGE_BUFFER 0x3010 10038c2ecf20Sopenharmony_ci#define DP_CEC_TX_MESSAGE_BUFFER 0x3020 10048c2ecf20Sopenharmony_ci#define DP_CEC_MESSAGE_BUFFER_LENGTH 0x10 10058c2ecf20Sopenharmony_ci 10068c2ecf20Sopenharmony_ci#define DP_PROTOCOL_CONVERTER_CONTROL_0 0x3050 /* DP 1.3 */ 10078c2ecf20Sopenharmony_ci# define DP_HDMI_DVI_OUTPUT_CONFIG (1 << 0) /* DP 1.3 */ 10088c2ecf20Sopenharmony_ci#define DP_PROTOCOL_CONVERTER_CONTROL_1 0x3051 /* DP 1.3 */ 10098c2ecf20Sopenharmony_ci# define DP_CONVERSION_TO_YCBCR420_ENABLE (1 << 0) /* DP 1.3 */ 10108c2ecf20Sopenharmony_ci# define DP_HDMI_EDID_PROCESSING_DISABLE (1 << 1) /* DP 1.4 */ 10118c2ecf20Sopenharmony_ci# define DP_HDMI_AUTONOMOUS_SCRAMBLING_DISABLE (1 << 2) /* DP 1.4 */ 10128c2ecf20Sopenharmony_ci# define DP_HDMI_FORCE_SCRAMBLING (1 << 3) /* DP 1.4 */ 10138c2ecf20Sopenharmony_ci#define DP_PROTOCOL_CONVERTER_CONTROL_2 0x3052 /* DP 1.3 */ 10148c2ecf20Sopenharmony_ci# define DP_CONVERSION_TO_YCBCR422_ENABLE (1 << 0) /* DP 1.3 */ 10158c2ecf20Sopenharmony_ci 10168c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_BKSV 0x68000 10178c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_RI_PRIME 0x68005 10188c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_AKSV 0x68007 10198c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_AN 0x6800C 10208c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_V_PRIME(h) (0x68014 + h * 4) 10218c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_BCAPS 0x68028 10228c2ecf20Sopenharmony_ci# define DP_BCAPS_REPEATER_PRESENT BIT(1) 10238c2ecf20Sopenharmony_ci# define DP_BCAPS_HDCP_CAPABLE BIT(0) 10248c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_BSTATUS 0x68029 10258c2ecf20Sopenharmony_ci# define DP_BSTATUS_REAUTH_REQ BIT(3) 10268c2ecf20Sopenharmony_ci# define DP_BSTATUS_LINK_FAILURE BIT(2) 10278c2ecf20Sopenharmony_ci# define DP_BSTATUS_R0_PRIME_READY BIT(1) 10288c2ecf20Sopenharmony_ci# define DP_BSTATUS_READY BIT(0) 10298c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_BINFO 0x6802A 10308c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_KSV_FIFO 0x6802C 10318c2ecf20Sopenharmony_ci#define DP_AUX_HDCP_AINFO 0x6803B 10328c2ecf20Sopenharmony_ci 10338c2ecf20Sopenharmony_ci/* DP HDCP2.2 parameter offsets in DPCD address space */ 10348c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RTX_OFFSET 0x69000 10358c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_TXCAPS_OFFSET 0x69008 10368c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_CERT_RX_OFFSET 0x6900B 10378c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RRX_OFFSET 0x69215 10388c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RX_CAPS_OFFSET 0x6921D 10398c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_EKPUB_KM_OFFSET 0x69220 10408c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_EKH_KM_WR_OFFSET 0x692A0 10418c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_M_OFFSET 0x692B0 10428c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_HPRIME_OFFSET 0x692C0 10438c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_EKH_KM_RD_OFFSET 0x692E0 10448c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RN_OFFSET 0x692F0 10458c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_LPRIME_OFFSET 0x692F8 10468c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_EDKEY_KS_OFFSET 0x69318 10478c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RIV_OFFSET 0x69328 10488c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RXINFO_OFFSET 0x69330 10498c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_SEQ_NUM_V_OFFSET 0x69332 10508c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_VPRIME_OFFSET 0x69335 10518c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RECV_ID_LIST_OFFSET 0x69345 10528c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_V_OFFSET 0x693E0 10538c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_SEQ_NUM_M_OFFSET 0x693F0 10548c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_K_OFFSET 0x693F3 10558c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_STREAM_ID_TYPE_OFFSET 0x693F5 10568c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_MPRIME_OFFSET 0x69473 10578c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_RXSTATUS_OFFSET 0x69493 10588c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET 0x69494 10598c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REG_DBG_OFFSET 0x69518 10608c2ecf20Sopenharmony_ci 10618c2ecf20Sopenharmony_ci/* Link Training (LT)-tunable PHY Repeaters */ 10628c2ecf20Sopenharmony_ci#define DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV 0xf0000 /* 1.3 */ 10638c2ecf20Sopenharmony_ci#define DP_MAX_LINK_RATE_PHY_REPEATER 0xf0001 /* 1.4a */ 10648c2ecf20Sopenharmony_ci#define DP_PHY_REPEATER_CNT 0xf0002 /* 1.3 */ 10658c2ecf20Sopenharmony_ci#define DP_PHY_REPEATER_MODE 0xf0003 /* 1.3 */ 10668c2ecf20Sopenharmony_ci#define DP_MAX_LANE_COUNT_PHY_REPEATER 0xf0004 /* 1.4a */ 10678c2ecf20Sopenharmony_ci#define DP_Repeater_FEC_CAPABILITY 0xf0004 /* 1.4 */ 10688c2ecf20Sopenharmony_ci#define DP_PHY_REPEATER_EXTENDED_WAIT_TIMEOUT 0xf0005 /* 1.4a */ 10698c2ecf20Sopenharmony_ci#define DP_TRAINING_PATTERN_SET_PHY_REPEATER1 0xf0010 /* 1.3 */ 10708c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE0_SET_PHY_REPEATER1 0xf0011 /* 1.3 */ 10718c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE1_SET_PHY_REPEATER1 0xf0012 /* 1.3 */ 10728c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE2_SET_PHY_REPEATER1 0xf0013 /* 1.3 */ 10738c2ecf20Sopenharmony_ci#define DP_TRAINING_LANE3_SET_PHY_REPEATER1 0xf0014 /* 1.3 */ 10748c2ecf20Sopenharmony_ci#define DP_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 0xf0020 /* 1.4a */ 10758c2ecf20Sopenharmony_ci#define DP_TRANSMITTER_CAPABILITY_PHY_REPEATER1 0xf0021 /* 1.4a */ 10768c2ecf20Sopenharmony_ci#define DP_LANE0_1_STATUS_PHY_REPEATER1 0xf0030 /* 1.3 */ 10778c2ecf20Sopenharmony_ci#define DP_LANE2_3_STATUS_PHY_REPEATER1 0xf0031 /* 1.3 */ 10788c2ecf20Sopenharmony_ci#define DP_LANE_ALIGN_STATUS_UPDATED_PHY_REPEATER1 0xf0032 /* 1.3 */ 10798c2ecf20Sopenharmony_ci#define DP_ADJUST_REQUEST_LANE0_1_PHY_REPEATER1 0xf0033 /* 1.3 */ 10808c2ecf20Sopenharmony_ci#define DP_ADJUST_REQUEST_LANE2_3_PHY_REPEATER1 0xf0034 /* 1.3 */ 10818c2ecf20Sopenharmony_ci#define DP_SYMBOL_ERROR_COUNT_LANE0_PHY_REPEATER1 0xf0035 /* 1.3 */ 10828c2ecf20Sopenharmony_ci#define DP_SYMBOL_ERROR_COUNT_LANE1_PHY_REPEATER1 0xf0037 /* 1.3 */ 10838c2ecf20Sopenharmony_ci#define DP_SYMBOL_ERROR_COUNT_LANE2_PHY_REPEATER1 0xf0039 /* 1.3 */ 10848c2ecf20Sopenharmony_ci#define DP_SYMBOL_ERROR_COUNT_LANE3_PHY_REPEATER1 0xf003b /* 1.3 */ 10858c2ecf20Sopenharmony_ci#define DP_FEC_STATUS_PHY_REPEATER1 0xf0290 /* 1.4 */ 10868c2ecf20Sopenharmony_ci#define DP_FEC_ERROR_COUNT_PHY_REPEATER1 0xf0291 /* 1.4 */ 10878c2ecf20Sopenharmony_ci#define DP_FEC_CAPABILITY_PHY_REPEATER1 0xf0294 /* 1.4a */ 10888c2ecf20Sopenharmony_ci 10898c2ecf20Sopenharmony_ci/* Repeater modes */ 10908c2ecf20Sopenharmony_ci#define DP_PHY_REPEATER_MODE_TRANSPARENT 0x55 /* 1.3 */ 10918c2ecf20Sopenharmony_ci#define DP_PHY_REPEATER_MODE_NON_TRANSPARENT 0xaa /* 1.3 */ 10928c2ecf20Sopenharmony_ci 10938c2ecf20Sopenharmony_ci/* DP HDCP message start offsets in DPCD address space */ 10948c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_AKE_INIT_OFFSET DP_HDCP_2_2_REG_RTX_OFFSET 10958c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_AKE_SEND_CERT_OFFSET DP_HDCP_2_2_REG_CERT_RX_OFFSET 10968c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET DP_HDCP_2_2_REG_EKPUB_KM_OFFSET 10978c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_AKE_STORED_KM_OFFSET DP_HDCP_2_2_REG_EKH_KM_WR_OFFSET 10988c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET DP_HDCP_2_2_REG_HPRIME_OFFSET 10998c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET \ 11008c2ecf20Sopenharmony_ci DP_HDCP_2_2_REG_EKH_KM_RD_OFFSET 11018c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_LC_INIT_OFFSET DP_HDCP_2_2_REG_RN_OFFSET 11028c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET DP_HDCP_2_2_REG_LPRIME_OFFSET 11038c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_SKE_SEND_EKS_OFFSET DP_HDCP_2_2_REG_EDKEY_KS_OFFSET 11048c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET DP_HDCP_2_2_REG_RXINFO_OFFSET 11058c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REP_SEND_ACK_OFFSET DP_HDCP_2_2_REG_V_OFFSET 11068c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET DP_HDCP_2_2_REG_SEQ_NUM_M_OFFSET 11078c2ecf20Sopenharmony_ci#define DP_HDCP_2_2_REP_STREAM_READY_OFFSET DP_HDCP_2_2_REG_MPRIME_OFFSET 11088c2ecf20Sopenharmony_ci 11098c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_RXSTATUS_LEN 1 11108c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_RXSTATUS_READY(x) ((x) & BIT(0)) 11118c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_RXSTATUS_H_PRIME(x) ((x) & BIT(1)) 11128c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_RXSTATUS_PAIRING(x) ((x) & BIT(2)) 11138c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_RXSTATUS_REAUTH_REQ(x) ((x) & BIT(3)) 11148c2ecf20Sopenharmony_ci#define HDCP_2_2_DP_RXSTATUS_LINK_FAILED(x) ((x) & BIT(4)) 11158c2ecf20Sopenharmony_ci 11168c2ecf20Sopenharmony_ci/* DP 1.2 Sideband message defines */ 11178c2ecf20Sopenharmony_ci/* peer device type - DP 1.2a Table 2-92 */ 11188c2ecf20Sopenharmony_ci#define DP_PEER_DEVICE_NONE 0x0 11198c2ecf20Sopenharmony_ci#define DP_PEER_DEVICE_SOURCE_OR_SST 0x1 11208c2ecf20Sopenharmony_ci#define DP_PEER_DEVICE_MST_BRANCHING 0x2 11218c2ecf20Sopenharmony_ci#define DP_PEER_DEVICE_SST_SINK 0x3 11228c2ecf20Sopenharmony_ci#define DP_PEER_DEVICE_DP_LEGACY_CONV 0x4 11238c2ecf20Sopenharmony_ci 11248c2ecf20Sopenharmony_ci/* DP 1.2 MST sideband request names DP 1.2a Table 2-80 */ 11258c2ecf20Sopenharmony_ci#define DP_GET_MSG_TRANSACTION_VERSION 0x00 /* DP 1.3 */ 11268c2ecf20Sopenharmony_ci#define DP_LINK_ADDRESS 0x01 11278c2ecf20Sopenharmony_ci#define DP_CONNECTION_STATUS_NOTIFY 0x02 11288c2ecf20Sopenharmony_ci#define DP_ENUM_PATH_RESOURCES 0x10 11298c2ecf20Sopenharmony_ci#define DP_ALLOCATE_PAYLOAD 0x11 11308c2ecf20Sopenharmony_ci#define DP_QUERY_PAYLOAD 0x12 11318c2ecf20Sopenharmony_ci#define DP_RESOURCE_STATUS_NOTIFY 0x13 11328c2ecf20Sopenharmony_ci#define DP_CLEAR_PAYLOAD_ID_TABLE 0x14 11338c2ecf20Sopenharmony_ci#define DP_REMOTE_DPCD_READ 0x20 11348c2ecf20Sopenharmony_ci#define DP_REMOTE_DPCD_WRITE 0x21 11358c2ecf20Sopenharmony_ci#define DP_REMOTE_I2C_READ 0x22 11368c2ecf20Sopenharmony_ci#define DP_REMOTE_I2C_WRITE 0x23 11378c2ecf20Sopenharmony_ci#define DP_POWER_UP_PHY 0x24 11388c2ecf20Sopenharmony_ci#define DP_POWER_DOWN_PHY 0x25 11398c2ecf20Sopenharmony_ci#define DP_SINK_EVENT_NOTIFY 0x30 11408c2ecf20Sopenharmony_ci#define DP_QUERY_STREAM_ENC_STATUS 0x38 11418c2ecf20Sopenharmony_ci#define DP_QUERY_STREAM_ENC_STATUS_STATE_NO_EXIST 0 11428c2ecf20Sopenharmony_ci#define DP_QUERY_STREAM_ENC_STATUS_STATE_INACTIVE 1 11438c2ecf20Sopenharmony_ci#define DP_QUERY_STREAM_ENC_STATUS_STATE_ACTIVE 2 11448c2ecf20Sopenharmony_ci 11458c2ecf20Sopenharmony_ci/* DP 1.2 MST sideband reply types */ 11468c2ecf20Sopenharmony_ci#define DP_SIDEBAND_REPLY_ACK 0x00 11478c2ecf20Sopenharmony_ci#define DP_SIDEBAND_REPLY_NAK 0x01 11488c2ecf20Sopenharmony_ci 11498c2ecf20Sopenharmony_ci/* DP 1.2 MST sideband nak reasons - table 2.84 */ 11508c2ecf20Sopenharmony_ci#define DP_NAK_WRITE_FAILURE 0x01 11518c2ecf20Sopenharmony_ci#define DP_NAK_INVALID_READ 0x02 11528c2ecf20Sopenharmony_ci#define DP_NAK_CRC_FAILURE 0x03 11538c2ecf20Sopenharmony_ci#define DP_NAK_BAD_PARAM 0x04 11548c2ecf20Sopenharmony_ci#define DP_NAK_DEFER 0x05 11558c2ecf20Sopenharmony_ci#define DP_NAK_LINK_FAILURE 0x06 11568c2ecf20Sopenharmony_ci#define DP_NAK_NO_RESOURCES 0x07 11578c2ecf20Sopenharmony_ci#define DP_NAK_DPCD_FAIL 0x08 11588c2ecf20Sopenharmony_ci#define DP_NAK_I2C_NAK 0x09 11598c2ecf20Sopenharmony_ci#define DP_NAK_ALLOCATE_FAIL 0x0a 11608c2ecf20Sopenharmony_ci 11618c2ecf20Sopenharmony_ci#define MODE_I2C_START 1 11628c2ecf20Sopenharmony_ci#define MODE_I2C_WRITE 2 11638c2ecf20Sopenharmony_ci#define MODE_I2C_READ 4 11648c2ecf20Sopenharmony_ci#define MODE_I2C_STOP 8 11658c2ecf20Sopenharmony_ci 11668c2ecf20Sopenharmony_ci/* DP 1.2 MST PORTs - Section 2.5.1 v1.2a spec */ 11678c2ecf20Sopenharmony_ci#define DP_MST_PHYSICAL_PORT_0 0 11688c2ecf20Sopenharmony_ci#define DP_MST_LOGICAL_PORT_0 8 11698c2ecf20Sopenharmony_ci 11708c2ecf20Sopenharmony_ci#define DP_LINK_CONSTANT_N_VALUE 0x8000 11718c2ecf20Sopenharmony_ci#define DP_LINK_STATUS_SIZE 6 11728c2ecf20Sopenharmony_cibool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE], 11738c2ecf20Sopenharmony_ci int lane_count); 11748c2ecf20Sopenharmony_cibool drm_dp_clock_recovery_ok(const u8 link_status[DP_LINK_STATUS_SIZE], 11758c2ecf20Sopenharmony_ci int lane_count); 11768c2ecf20Sopenharmony_ciu8 drm_dp_get_adjust_request_voltage(const u8 link_status[DP_LINK_STATUS_SIZE], 11778c2ecf20Sopenharmony_ci int lane); 11788c2ecf20Sopenharmony_ciu8 drm_dp_get_adjust_request_pre_emphasis(const u8 link_status[DP_LINK_STATUS_SIZE], 11798c2ecf20Sopenharmony_ci int lane); 11808c2ecf20Sopenharmony_ciu8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE], 11818c2ecf20Sopenharmony_ci unsigned int lane); 11828c2ecf20Sopenharmony_ci 11838c2ecf20Sopenharmony_ci#define DP_BRANCH_OUI_HEADER_SIZE 0xc 11848c2ecf20Sopenharmony_ci#define DP_RECEIVER_CAP_SIZE 0xf 11858c2ecf20Sopenharmony_ci#define DP_DSC_RECEIVER_CAP_SIZE 0x10 /* DSC Capabilities 0x60 through 0x6F */ 11868c2ecf20Sopenharmony_ci#define EDP_PSR_RECEIVER_CAP_SIZE 2 11878c2ecf20Sopenharmony_ci#define EDP_DISPLAY_CTL_CAP_SIZE 3 11888c2ecf20Sopenharmony_ci 11898c2ecf20Sopenharmony_civoid drm_dp_link_train_clock_recovery_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]); 11908c2ecf20Sopenharmony_civoid drm_dp_link_train_channel_eq_delay(const u8 dpcd[DP_RECEIVER_CAP_SIZE]); 11918c2ecf20Sopenharmony_ci 11928c2ecf20Sopenharmony_ciu8 drm_dp_link_rate_to_bw_code(int link_rate); 11938c2ecf20Sopenharmony_ciint drm_dp_bw_code_to_link_rate(u8 link_bw); 11948c2ecf20Sopenharmony_ci 11958c2ecf20Sopenharmony_ci#define DP_SDP_AUDIO_TIMESTAMP 0x01 11968c2ecf20Sopenharmony_ci#define DP_SDP_AUDIO_STREAM 0x02 11978c2ecf20Sopenharmony_ci#define DP_SDP_EXTENSION 0x04 /* DP 1.1 */ 11988c2ecf20Sopenharmony_ci#define DP_SDP_AUDIO_COPYMANAGEMENT 0x05 /* DP 1.2 */ 11998c2ecf20Sopenharmony_ci#define DP_SDP_ISRC 0x06 /* DP 1.2 */ 12008c2ecf20Sopenharmony_ci#define DP_SDP_VSC 0x07 /* DP 1.2 */ 12018c2ecf20Sopenharmony_ci#define DP_SDP_CAMERA_GENERIC(i) (0x08 + (i)) /* 0-7, DP 1.3 */ 12028c2ecf20Sopenharmony_ci#define DP_SDP_PPS 0x10 /* DP 1.4 */ 12038c2ecf20Sopenharmony_ci#define DP_SDP_VSC_EXT_VESA 0x20 /* DP 1.4 */ 12048c2ecf20Sopenharmony_ci#define DP_SDP_VSC_EXT_CEA 0x21 /* DP 1.4 */ 12058c2ecf20Sopenharmony_ci/* 0x80+ CEA-861 infoframe types */ 12068c2ecf20Sopenharmony_ci 12078c2ecf20Sopenharmony_ci/** 12088c2ecf20Sopenharmony_ci * struct dp_sdp_header - DP secondary data packet header 12098c2ecf20Sopenharmony_ci * @HB0: Secondary Data Packet ID 12108c2ecf20Sopenharmony_ci * @HB1: Secondary Data Packet Type 12118c2ecf20Sopenharmony_ci * @HB2: Secondary Data Packet Specific header, Byte 0 12128c2ecf20Sopenharmony_ci * @HB3: Secondary Data packet Specific header, Byte 1 12138c2ecf20Sopenharmony_ci */ 12148c2ecf20Sopenharmony_cistruct dp_sdp_header { 12158c2ecf20Sopenharmony_ci u8 HB0; 12168c2ecf20Sopenharmony_ci u8 HB1; 12178c2ecf20Sopenharmony_ci u8 HB2; 12188c2ecf20Sopenharmony_ci u8 HB3; 12198c2ecf20Sopenharmony_ci} __packed; 12208c2ecf20Sopenharmony_ci 12218c2ecf20Sopenharmony_ci#define EDP_SDP_HEADER_REVISION_MASK 0x1F 12228c2ecf20Sopenharmony_ci#define EDP_SDP_HEADER_VALID_PAYLOAD_BYTES 0x1F 12238c2ecf20Sopenharmony_ci#define DP_SDP_PPS_HEADER_PAYLOAD_BYTES_MINUS_1 0x7F 12248c2ecf20Sopenharmony_ci 12258c2ecf20Sopenharmony_ci/** 12268c2ecf20Sopenharmony_ci * struct dp_sdp - DP secondary data packet 12278c2ecf20Sopenharmony_ci * @sdp_header: DP secondary data packet header 12288c2ecf20Sopenharmony_ci * @db: DP secondaray data packet data blocks 12298c2ecf20Sopenharmony_ci * VSC SDP Payload for PSR 12308c2ecf20Sopenharmony_ci * db[0]: Stereo Interface 12318c2ecf20Sopenharmony_ci * db[1]: 0 - PSR State; 1 - Update RFB; 2 - CRC Valid 12328c2ecf20Sopenharmony_ci * db[2]: CRC value bits 7:0 of the R or Cr component 12338c2ecf20Sopenharmony_ci * db[3]: CRC value bits 15:8 of the R or Cr component 12348c2ecf20Sopenharmony_ci * db[4]: CRC value bits 7:0 of the G or Y component 12358c2ecf20Sopenharmony_ci * db[5]: CRC value bits 15:8 of the G or Y component 12368c2ecf20Sopenharmony_ci * db[6]: CRC value bits 7:0 of the B or Cb component 12378c2ecf20Sopenharmony_ci * db[7]: CRC value bits 15:8 of the B or Cb component 12388c2ecf20Sopenharmony_ci * db[8] - db[31]: Reserved 12398c2ecf20Sopenharmony_ci * VSC SDP Payload for Pixel Encoding/Colorimetry Format 12408c2ecf20Sopenharmony_ci * db[0] - db[15]: Reserved 12418c2ecf20Sopenharmony_ci * db[16]: Pixel Encoding and Colorimetry Formats 12428c2ecf20Sopenharmony_ci * db[17]: Dynamic Range and Component Bit Depth 12438c2ecf20Sopenharmony_ci * db[18]: Content Type 12448c2ecf20Sopenharmony_ci * db[19] - db[31]: Reserved 12458c2ecf20Sopenharmony_ci */ 12468c2ecf20Sopenharmony_cistruct dp_sdp { 12478c2ecf20Sopenharmony_ci struct dp_sdp_header sdp_header; 12488c2ecf20Sopenharmony_ci u8 db[32]; 12498c2ecf20Sopenharmony_ci} __packed; 12508c2ecf20Sopenharmony_ci 12518c2ecf20Sopenharmony_ci#define EDP_VSC_PSR_STATE_ACTIVE (1<<0) 12528c2ecf20Sopenharmony_ci#define EDP_VSC_PSR_UPDATE_RFB (1<<1) 12538c2ecf20Sopenharmony_ci#define EDP_VSC_PSR_CRC_VALUES_VALID (1<<2) 12548c2ecf20Sopenharmony_ci 12558c2ecf20Sopenharmony_ci/** 12568c2ecf20Sopenharmony_ci * enum dp_pixelformat - drm DP Pixel encoding formats 12578c2ecf20Sopenharmony_ci * 12588c2ecf20Sopenharmony_ci * This enum is used to indicate DP VSC SDP Pixel encoding formats. 12598c2ecf20Sopenharmony_ci * It is based on DP 1.4 spec [Table 2-117: VSC SDP Payload for DB16 through 12608c2ecf20Sopenharmony_ci * DB18] 12618c2ecf20Sopenharmony_ci * 12628c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_RGB: RGB pixel encoding format 12638c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_YUV444: YCbCr 4:4:4 pixel encoding format 12648c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_YUV422: YCbCr 4:2:2 pixel encoding format 12658c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_YUV420: YCbCr 4:2:0 pixel encoding format 12668c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_Y_ONLY: Y Only pixel encoding format 12678c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_RAW: RAW pixel encoding format 12688c2ecf20Sopenharmony_ci * @DP_PIXELFORMAT_RESERVED: Reserved pixel encoding format 12698c2ecf20Sopenharmony_ci */ 12708c2ecf20Sopenharmony_cienum dp_pixelformat { 12718c2ecf20Sopenharmony_ci DP_PIXELFORMAT_RGB = 0, 12728c2ecf20Sopenharmony_ci DP_PIXELFORMAT_YUV444 = 0x1, 12738c2ecf20Sopenharmony_ci DP_PIXELFORMAT_YUV422 = 0x2, 12748c2ecf20Sopenharmony_ci DP_PIXELFORMAT_YUV420 = 0x3, 12758c2ecf20Sopenharmony_ci DP_PIXELFORMAT_Y_ONLY = 0x4, 12768c2ecf20Sopenharmony_ci DP_PIXELFORMAT_RAW = 0x5, 12778c2ecf20Sopenharmony_ci DP_PIXELFORMAT_RESERVED = 0x6, 12788c2ecf20Sopenharmony_ci}; 12798c2ecf20Sopenharmony_ci 12808c2ecf20Sopenharmony_ci/** 12818c2ecf20Sopenharmony_ci * enum dp_colorimetry - drm DP Colorimetry formats 12828c2ecf20Sopenharmony_ci * 12838c2ecf20Sopenharmony_ci * This enum is used to indicate DP VSC SDP Colorimetry formats. 12848c2ecf20Sopenharmony_ci * It is based on DP 1.4 spec [Table 2-117: VSC SDP Payload for DB16 through 12858c2ecf20Sopenharmony_ci * DB18] and a name of enum member follows DRM_MODE_COLORIMETRY definition. 12868c2ecf20Sopenharmony_ci * 12878c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_DEFAULT: sRGB (IEC 61966-2-1) or 12888c2ecf20Sopenharmony_ci * ITU-R BT.601 colorimetry format 12898c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_RGB_WIDE_FIXED: RGB wide gamut fixed point colorimetry format 12908c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_BT709_YCC: ITU-R BT.709 colorimetry format 12918c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_RGB_WIDE_FLOAT: RGB wide gamut floating point 12928c2ecf20Sopenharmony_ci * (scRGB (IEC 61966-2-2)) colorimetry format 12938c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_XVYCC_601: xvYCC601 colorimetry format 12948c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_OPRGB: OpRGB colorimetry format 12958c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_XVYCC_709: xvYCC709 colorimetry format 12968c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_DCI_P3_RGB: DCI-P3 (SMPTE RP 431-2) colorimetry format 12978c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_SYCC_601: sYCC601 colorimetry format 12988c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_RGB_CUSTOM: RGB Custom Color Profile colorimetry format 12998c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_OPYCC_601: opYCC601 colorimetry format 13008c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_BT2020_RGB: ITU-R BT.2020 R' G' B' colorimetry format 13018c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_BT2020_CYCC: ITU-R BT.2020 Y'c C'bc C'rc colorimetry format 13028c2ecf20Sopenharmony_ci * @DP_COLORIMETRY_BT2020_YCC: ITU-R BT.2020 Y' C'b C'r colorimetry format 13038c2ecf20Sopenharmony_ci */ 13048c2ecf20Sopenharmony_cienum dp_colorimetry { 13058c2ecf20Sopenharmony_ci DP_COLORIMETRY_DEFAULT = 0, 13068c2ecf20Sopenharmony_ci DP_COLORIMETRY_RGB_WIDE_FIXED = 0x1, 13078c2ecf20Sopenharmony_ci DP_COLORIMETRY_BT709_YCC = 0x1, 13088c2ecf20Sopenharmony_ci DP_COLORIMETRY_RGB_WIDE_FLOAT = 0x2, 13098c2ecf20Sopenharmony_ci DP_COLORIMETRY_XVYCC_601 = 0x2, 13108c2ecf20Sopenharmony_ci DP_COLORIMETRY_OPRGB = 0x3, 13118c2ecf20Sopenharmony_ci DP_COLORIMETRY_XVYCC_709 = 0x3, 13128c2ecf20Sopenharmony_ci DP_COLORIMETRY_DCI_P3_RGB = 0x4, 13138c2ecf20Sopenharmony_ci DP_COLORIMETRY_SYCC_601 = 0x4, 13148c2ecf20Sopenharmony_ci DP_COLORIMETRY_RGB_CUSTOM = 0x5, 13158c2ecf20Sopenharmony_ci DP_COLORIMETRY_OPYCC_601 = 0x5, 13168c2ecf20Sopenharmony_ci DP_COLORIMETRY_BT2020_RGB = 0x6, 13178c2ecf20Sopenharmony_ci DP_COLORIMETRY_BT2020_CYCC = 0x6, 13188c2ecf20Sopenharmony_ci DP_COLORIMETRY_BT2020_YCC = 0x7, 13198c2ecf20Sopenharmony_ci}; 13208c2ecf20Sopenharmony_ci 13218c2ecf20Sopenharmony_ci/** 13228c2ecf20Sopenharmony_ci * enum dp_dynamic_range - drm DP Dynamic Range 13238c2ecf20Sopenharmony_ci * 13248c2ecf20Sopenharmony_ci * This enum is used to indicate DP VSC SDP Dynamic Range. 13258c2ecf20Sopenharmony_ci * It is based on DP 1.4 spec [Table 2-117: VSC SDP Payload for DB16 through 13268c2ecf20Sopenharmony_ci * DB18] 13278c2ecf20Sopenharmony_ci * 13288c2ecf20Sopenharmony_ci * @DP_DYNAMIC_RANGE_VESA: VESA range 13298c2ecf20Sopenharmony_ci * @DP_DYNAMIC_RANGE_CTA: CTA range 13308c2ecf20Sopenharmony_ci */ 13318c2ecf20Sopenharmony_cienum dp_dynamic_range { 13328c2ecf20Sopenharmony_ci DP_DYNAMIC_RANGE_VESA = 0, 13338c2ecf20Sopenharmony_ci DP_DYNAMIC_RANGE_CTA = 1, 13348c2ecf20Sopenharmony_ci}; 13358c2ecf20Sopenharmony_ci 13368c2ecf20Sopenharmony_ci/** 13378c2ecf20Sopenharmony_ci * enum dp_content_type - drm DP Content Type 13388c2ecf20Sopenharmony_ci * 13398c2ecf20Sopenharmony_ci * This enum is used to indicate DP VSC SDP Content Types. 13408c2ecf20Sopenharmony_ci * It is based on DP 1.4 spec [Table 2-117: VSC SDP Payload for DB16 through 13418c2ecf20Sopenharmony_ci * DB18] 13428c2ecf20Sopenharmony_ci * CTA-861-G defines content types and expected processing by a sink device 13438c2ecf20Sopenharmony_ci * 13448c2ecf20Sopenharmony_ci * @DP_CONTENT_TYPE_NOT_DEFINED: Not defined type 13458c2ecf20Sopenharmony_ci * @DP_CONTENT_TYPE_GRAPHICS: Graphics type 13468c2ecf20Sopenharmony_ci * @DP_CONTENT_TYPE_PHOTO: Photo type 13478c2ecf20Sopenharmony_ci * @DP_CONTENT_TYPE_VIDEO: Video type 13488c2ecf20Sopenharmony_ci * @DP_CONTENT_TYPE_GAME: Game type 13498c2ecf20Sopenharmony_ci */ 13508c2ecf20Sopenharmony_cienum dp_content_type { 13518c2ecf20Sopenharmony_ci DP_CONTENT_TYPE_NOT_DEFINED = 0x00, 13528c2ecf20Sopenharmony_ci DP_CONTENT_TYPE_GRAPHICS = 0x01, 13538c2ecf20Sopenharmony_ci DP_CONTENT_TYPE_PHOTO = 0x02, 13548c2ecf20Sopenharmony_ci DP_CONTENT_TYPE_VIDEO = 0x03, 13558c2ecf20Sopenharmony_ci DP_CONTENT_TYPE_GAME = 0x04, 13568c2ecf20Sopenharmony_ci}; 13578c2ecf20Sopenharmony_ci 13588c2ecf20Sopenharmony_ci/** 13598c2ecf20Sopenharmony_ci * struct drm_dp_vsc_sdp - drm DP VSC SDP 13608c2ecf20Sopenharmony_ci * 13618c2ecf20Sopenharmony_ci * This structure represents a DP VSC SDP of drm 13628c2ecf20Sopenharmony_ci * It is based on DP 1.4 spec [Table 2-116: VSC SDP Header Bytes] and 13638c2ecf20Sopenharmony_ci * [Table 2-117: VSC SDP Payload for DB16 through DB18] 13648c2ecf20Sopenharmony_ci * 13658c2ecf20Sopenharmony_ci * @sdp_type: secondary-data packet type 13668c2ecf20Sopenharmony_ci * @revision: revision number 13678c2ecf20Sopenharmony_ci * @length: number of valid data bytes 13688c2ecf20Sopenharmony_ci * @pixelformat: pixel encoding format 13698c2ecf20Sopenharmony_ci * @colorimetry: colorimetry format 13708c2ecf20Sopenharmony_ci * @bpc: bit per color 13718c2ecf20Sopenharmony_ci * @dynamic_range: dynamic range information 13728c2ecf20Sopenharmony_ci * @content_type: CTA-861-G defines content types and expected processing by a sink device 13738c2ecf20Sopenharmony_ci */ 13748c2ecf20Sopenharmony_cistruct drm_dp_vsc_sdp { 13758c2ecf20Sopenharmony_ci unsigned char sdp_type; 13768c2ecf20Sopenharmony_ci unsigned char revision; 13778c2ecf20Sopenharmony_ci unsigned char length; 13788c2ecf20Sopenharmony_ci enum dp_pixelformat pixelformat; 13798c2ecf20Sopenharmony_ci enum dp_colorimetry colorimetry; 13808c2ecf20Sopenharmony_ci int bpc; 13818c2ecf20Sopenharmony_ci enum dp_dynamic_range dynamic_range; 13828c2ecf20Sopenharmony_ci enum dp_content_type content_type; 13838c2ecf20Sopenharmony_ci}; 13848c2ecf20Sopenharmony_ci 13858c2ecf20Sopenharmony_civoid drm_dp_vsc_sdp_log(const char *level, struct device *dev, 13868c2ecf20Sopenharmony_ci const struct drm_dp_vsc_sdp *vsc); 13878c2ecf20Sopenharmony_ci 13888c2ecf20Sopenharmony_ciint drm_dp_psr_setup_time(const u8 psr_cap[EDP_PSR_RECEIVER_CAP_SIZE]); 13898c2ecf20Sopenharmony_ci 13908c2ecf20Sopenharmony_cistatic inline int 13918c2ecf20Sopenharmony_cidrm_dp_max_link_rate(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 13928c2ecf20Sopenharmony_ci{ 13938c2ecf20Sopenharmony_ci return drm_dp_bw_code_to_link_rate(dpcd[DP_MAX_LINK_RATE]); 13948c2ecf20Sopenharmony_ci} 13958c2ecf20Sopenharmony_ci 13968c2ecf20Sopenharmony_cistatic inline u8 13978c2ecf20Sopenharmony_cidrm_dp_max_lane_count(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 13988c2ecf20Sopenharmony_ci{ 13998c2ecf20Sopenharmony_ci return dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK; 14008c2ecf20Sopenharmony_ci} 14018c2ecf20Sopenharmony_ci 14028c2ecf20Sopenharmony_cistatic inline bool 14038c2ecf20Sopenharmony_cidrm_dp_enhanced_frame_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14048c2ecf20Sopenharmony_ci{ 14058c2ecf20Sopenharmony_ci return dpcd[DP_DPCD_REV] >= 0x11 && 14068c2ecf20Sopenharmony_ci (dpcd[DP_MAX_LANE_COUNT] & DP_ENHANCED_FRAME_CAP); 14078c2ecf20Sopenharmony_ci} 14088c2ecf20Sopenharmony_ci 14098c2ecf20Sopenharmony_cistatic inline bool 14108c2ecf20Sopenharmony_cidrm_dp_fast_training_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14118c2ecf20Sopenharmony_ci{ 14128c2ecf20Sopenharmony_ci return dpcd[DP_DPCD_REV] >= 0x11 && 14138c2ecf20Sopenharmony_ci (dpcd[DP_MAX_DOWNSPREAD] & DP_NO_AUX_HANDSHAKE_LINK_TRAINING); 14148c2ecf20Sopenharmony_ci} 14158c2ecf20Sopenharmony_ci 14168c2ecf20Sopenharmony_cistatic inline bool 14178c2ecf20Sopenharmony_cidrm_dp_tps3_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14188c2ecf20Sopenharmony_ci{ 14198c2ecf20Sopenharmony_ci return dpcd[DP_DPCD_REV] >= 0x12 && 14208c2ecf20Sopenharmony_ci dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED; 14218c2ecf20Sopenharmony_ci} 14228c2ecf20Sopenharmony_ci 14238c2ecf20Sopenharmony_cistatic inline bool 14248c2ecf20Sopenharmony_cidrm_dp_tps4_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14258c2ecf20Sopenharmony_ci{ 14268c2ecf20Sopenharmony_ci return dpcd[DP_DPCD_REV] >= 0x14 && 14278c2ecf20Sopenharmony_ci dpcd[DP_MAX_DOWNSPREAD] & DP_TPS4_SUPPORTED; 14288c2ecf20Sopenharmony_ci} 14298c2ecf20Sopenharmony_ci 14308c2ecf20Sopenharmony_cistatic inline u8 14318c2ecf20Sopenharmony_cidrm_dp_training_pattern_mask(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14328c2ecf20Sopenharmony_ci{ 14338c2ecf20Sopenharmony_ci return (dpcd[DP_DPCD_REV] >= 0x14) ? DP_TRAINING_PATTERN_MASK_1_4 : 14348c2ecf20Sopenharmony_ci DP_TRAINING_PATTERN_MASK; 14358c2ecf20Sopenharmony_ci} 14368c2ecf20Sopenharmony_ci 14378c2ecf20Sopenharmony_cistatic inline bool 14388c2ecf20Sopenharmony_cidrm_dp_is_branch(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14398c2ecf20Sopenharmony_ci{ 14408c2ecf20Sopenharmony_ci return dpcd[DP_DOWNSTREAMPORT_PRESENT] & DP_DWN_STRM_PORT_PRESENT; 14418c2ecf20Sopenharmony_ci} 14428c2ecf20Sopenharmony_ci 14438c2ecf20Sopenharmony_ci/* DP/eDP DSC support */ 14448c2ecf20Sopenharmony_ciu8 drm_dp_dsc_sink_max_slice_count(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE], 14458c2ecf20Sopenharmony_ci bool is_edp); 14468c2ecf20Sopenharmony_ciu8 drm_dp_dsc_sink_line_buf_depth(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]); 14478c2ecf20Sopenharmony_ciint drm_dp_dsc_sink_supported_input_bpcs(const u8 dsc_dpc[DP_DSC_RECEIVER_CAP_SIZE], 14488c2ecf20Sopenharmony_ci u8 dsc_bpc[3]); 14498c2ecf20Sopenharmony_ci 14508c2ecf20Sopenharmony_cistatic inline bool 14518c2ecf20Sopenharmony_cidrm_dp_sink_supports_dsc(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) 14528c2ecf20Sopenharmony_ci{ 14538c2ecf20Sopenharmony_ci return dsc_dpcd[DP_DSC_SUPPORT - DP_DSC_SUPPORT] & 14548c2ecf20Sopenharmony_ci DP_DSC_DECOMPRESSION_IS_SUPPORTED; 14558c2ecf20Sopenharmony_ci} 14568c2ecf20Sopenharmony_ci 14578c2ecf20Sopenharmony_cistatic inline u16 14588c2ecf20Sopenharmony_cidrm_edp_dsc_sink_output_bpp(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) 14598c2ecf20Sopenharmony_ci{ 14608c2ecf20Sopenharmony_ci return dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_LOW - DP_DSC_SUPPORT] | 14618c2ecf20Sopenharmony_ci (dsc_dpcd[DP_DSC_MAX_BITS_PER_PIXEL_HI - DP_DSC_SUPPORT] & 14628c2ecf20Sopenharmony_ci DP_DSC_MAX_BITS_PER_PIXEL_HI_MASK << 14638c2ecf20Sopenharmony_ci DP_DSC_MAX_BITS_PER_PIXEL_HI_SHIFT); 14648c2ecf20Sopenharmony_ci} 14658c2ecf20Sopenharmony_ci 14668c2ecf20Sopenharmony_cistatic inline u32 14678c2ecf20Sopenharmony_cidrm_dp_dsc_sink_max_slice_width(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) 14688c2ecf20Sopenharmony_ci{ 14698c2ecf20Sopenharmony_ci /* Max Slicewidth = Number of Pixels * 320 */ 14708c2ecf20Sopenharmony_ci return dsc_dpcd[DP_DSC_MAX_SLICE_WIDTH - DP_DSC_SUPPORT] * 14718c2ecf20Sopenharmony_ci DP_DSC_SLICE_WIDTH_MULTIPLIER; 14728c2ecf20Sopenharmony_ci} 14738c2ecf20Sopenharmony_ci 14748c2ecf20Sopenharmony_ci/* Forward Error Correction Support on DP 1.4 */ 14758c2ecf20Sopenharmony_cistatic inline bool 14768c2ecf20Sopenharmony_cidrm_dp_sink_supports_fec(const u8 fec_capable) 14778c2ecf20Sopenharmony_ci{ 14788c2ecf20Sopenharmony_ci return fec_capable & DP_FEC_CAPABLE; 14798c2ecf20Sopenharmony_ci} 14808c2ecf20Sopenharmony_ci 14818c2ecf20Sopenharmony_cistatic inline bool 14828c2ecf20Sopenharmony_cidrm_dp_channel_coding_supported(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14838c2ecf20Sopenharmony_ci{ 14848c2ecf20Sopenharmony_ci return dpcd[DP_MAIN_LINK_CHANNEL_CODING] & DP_CAP_ANSI_8B10B; 14858c2ecf20Sopenharmony_ci} 14868c2ecf20Sopenharmony_ci 14878c2ecf20Sopenharmony_cistatic inline bool 14888c2ecf20Sopenharmony_cidrm_dp_alternate_scrambler_reset_cap(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14898c2ecf20Sopenharmony_ci{ 14908c2ecf20Sopenharmony_ci return dpcd[DP_EDP_CONFIGURATION_CAP] & 14918c2ecf20Sopenharmony_ci DP_ALTERNATE_SCRAMBLER_RESET_CAP; 14928c2ecf20Sopenharmony_ci} 14938c2ecf20Sopenharmony_ci 14948c2ecf20Sopenharmony_ci/* Ignore MSA timing for Adaptive Sync support on DP 1.4 */ 14958c2ecf20Sopenharmony_cistatic inline bool 14968c2ecf20Sopenharmony_cidrm_dp_sink_can_do_video_without_timing_msa(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 14978c2ecf20Sopenharmony_ci{ 14988c2ecf20Sopenharmony_ci return dpcd[DP_DOWN_STREAM_PORT_COUNT] & 14998c2ecf20Sopenharmony_ci DP_MSA_TIMING_PAR_IGNORED; 15008c2ecf20Sopenharmony_ci} 15018c2ecf20Sopenharmony_ci 15028c2ecf20Sopenharmony_ci/* 15038c2ecf20Sopenharmony_ci * DisplayPort AUX channel 15048c2ecf20Sopenharmony_ci */ 15058c2ecf20Sopenharmony_ci 15068c2ecf20Sopenharmony_ci/** 15078c2ecf20Sopenharmony_ci * struct drm_dp_aux_msg - DisplayPort AUX channel transaction 15088c2ecf20Sopenharmony_ci * @address: address of the (first) register to access 15098c2ecf20Sopenharmony_ci * @request: contains the type of transaction (see DP_AUX_* macros) 15108c2ecf20Sopenharmony_ci * @reply: upon completion, contains the reply type of the transaction 15118c2ecf20Sopenharmony_ci * @buffer: pointer to a transmission or reception buffer 15128c2ecf20Sopenharmony_ci * @size: size of @buffer 15138c2ecf20Sopenharmony_ci */ 15148c2ecf20Sopenharmony_cistruct drm_dp_aux_msg { 15158c2ecf20Sopenharmony_ci unsigned int address; 15168c2ecf20Sopenharmony_ci u8 request; 15178c2ecf20Sopenharmony_ci u8 reply; 15188c2ecf20Sopenharmony_ci void *buffer; 15198c2ecf20Sopenharmony_ci size_t size; 15208c2ecf20Sopenharmony_ci}; 15218c2ecf20Sopenharmony_ci 15228c2ecf20Sopenharmony_cistruct cec_adapter; 15238c2ecf20Sopenharmony_cistruct edid; 15248c2ecf20Sopenharmony_cistruct drm_connector; 15258c2ecf20Sopenharmony_ci 15268c2ecf20Sopenharmony_ci/** 15278c2ecf20Sopenharmony_ci * struct drm_dp_aux_cec - DisplayPort CEC-Tunneling-over-AUX 15288c2ecf20Sopenharmony_ci * @lock: mutex protecting this struct 15298c2ecf20Sopenharmony_ci * @adap: the CEC adapter for CEC-Tunneling-over-AUX support. 15308c2ecf20Sopenharmony_ci * @connector: the connector this CEC adapter is associated with 15318c2ecf20Sopenharmony_ci * @unregister_work: unregister the CEC adapter 15328c2ecf20Sopenharmony_ci */ 15338c2ecf20Sopenharmony_cistruct drm_dp_aux_cec { 15348c2ecf20Sopenharmony_ci struct mutex lock; 15358c2ecf20Sopenharmony_ci struct cec_adapter *adap; 15368c2ecf20Sopenharmony_ci struct drm_connector *connector; 15378c2ecf20Sopenharmony_ci struct delayed_work unregister_work; 15388c2ecf20Sopenharmony_ci}; 15398c2ecf20Sopenharmony_ci 15408c2ecf20Sopenharmony_ci/** 15418c2ecf20Sopenharmony_ci * struct drm_dp_aux - DisplayPort AUX channel 15428c2ecf20Sopenharmony_ci * @name: user-visible name of this AUX channel and the I2C-over-AUX adapter 15438c2ecf20Sopenharmony_ci * @ddc: I2C adapter that can be used for I2C-over-AUX communication 15448c2ecf20Sopenharmony_ci * @dev: pointer to struct device that is the parent for this AUX channel 15458c2ecf20Sopenharmony_ci * @crtc: backpointer to the crtc that is currently using this AUX channel 15468c2ecf20Sopenharmony_ci * @hw_mutex: internal mutex used for locking transfers 15478c2ecf20Sopenharmony_ci * @crc_work: worker that captures CRCs for each frame 15488c2ecf20Sopenharmony_ci * @crc_count: counter of captured frame CRCs 15498c2ecf20Sopenharmony_ci * @transfer: transfers a message representing a single AUX transaction 15508c2ecf20Sopenharmony_ci * 15518c2ecf20Sopenharmony_ci * The .dev field should be set to a pointer to the device that implements 15528c2ecf20Sopenharmony_ci * the AUX channel. 15538c2ecf20Sopenharmony_ci * 15548c2ecf20Sopenharmony_ci * The .name field may be used to specify the name of the I2C adapter. If set to 15558c2ecf20Sopenharmony_ci * NULL, dev_name() of .dev will be used. 15568c2ecf20Sopenharmony_ci * 15578c2ecf20Sopenharmony_ci * Drivers provide a hardware-specific implementation of how transactions 15588c2ecf20Sopenharmony_ci * are executed via the .transfer() function. A pointer to a drm_dp_aux_msg 15598c2ecf20Sopenharmony_ci * structure describing the transaction is passed into this function. Upon 15608c2ecf20Sopenharmony_ci * success, the implementation should return the number of payload bytes 15618c2ecf20Sopenharmony_ci * that were transferred, or a negative error-code on failure. Helpers 15628c2ecf20Sopenharmony_ci * propagate errors from the .transfer() function, with the exception of 15638c2ecf20Sopenharmony_ci * the -EBUSY error, which causes a transaction to be retried. On a short, 15648c2ecf20Sopenharmony_ci * helpers will return -EPROTO to make it simpler to check for failure. 15658c2ecf20Sopenharmony_ci * 15668c2ecf20Sopenharmony_ci * An AUX channel can also be used to transport I2C messages to a sink. A 15678c2ecf20Sopenharmony_ci * typical application of that is to access an EDID that's present in the 15688c2ecf20Sopenharmony_ci * sink device. The .transfer() function can also be used to execute such 15698c2ecf20Sopenharmony_ci * transactions. The drm_dp_aux_register() function registers an I2C 15708c2ecf20Sopenharmony_ci * adapter that can be passed to drm_probe_ddc(). Upon removal, drivers 15718c2ecf20Sopenharmony_ci * should call drm_dp_aux_unregister() to remove the I2C adapter. 15728c2ecf20Sopenharmony_ci * The I2C adapter uses long transfers by default; if a partial response is 15738c2ecf20Sopenharmony_ci * received, the adapter will drop down to the size given by the partial 15748c2ecf20Sopenharmony_ci * response for this transaction only. 15758c2ecf20Sopenharmony_ci * 15768c2ecf20Sopenharmony_ci * Note that the aux helper code assumes that the .transfer() function 15778c2ecf20Sopenharmony_ci * only modifies the reply field of the drm_dp_aux_msg structure. The 15788c2ecf20Sopenharmony_ci * retry logic and i2c helpers assume this is the case. 15798c2ecf20Sopenharmony_ci */ 15808c2ecf20Sopenharmony_cistruct drm_dp_aux { 15818c2ecf20Sopenharmony_ci const char *name; 15828c2ecf20Sopenharmony_ci struct i2c_adapter ddc; 15838c2ecf20Sopenharmony_ci struct device *dev; 15848c2ecf20Sopenharmony_ci struct drm_crtc *crtc; 15858c2ecf20Sopenharmony_ci struct mutex hw_mutex; 15868c2ecf20Sopenharmony_ci struct work_struct crc_work; 15878c2ecf20Sopenharmony_ci u8 crc_count; 15888c2ecf20Sopenharmony_ci ssize_t (*transfer)(struct drm_dp_aux *aux, 15898c2ecf20Sopenharmony_ci struct drm_dp_aux_msg *msg); 15908c2ecf20Sopenharmony_ci /** 15918c2ecf20Sopenharmony_ci * @i2c_nack_count: Counts I2C NACKs, used for DP validation. 15928c2ecf20Sopenharmony_ci */ 15938c2ecf20Sopenharmony_ci unsigned i2c_nack_count; 15948c2ecf20Sopenharmony_ci /** 15958c2ecf20Sopenharmony_ci * @i2c_defer_count: Counts I2C DEFERs, used for DP validation. 15968c2ecf20Sopenharmony_ci */ 15978c2ecf20Sopenharmony_ci unsigned i2c_defer_count; 15988c2ecf20Sopenharmony_ci /** 15998c2ecf20Sopenharmony_ci * @cec: struct containing fields used for CEC-Tunneling-over-AUX. 16008c2ecf20Sopenharmony_ci */ 16018c2ecf20Sopenharmony_ci struct drm_dp_aux_cec cec; 16028c2ecf20Sopenharmony_ci /** 16038c2ecf20Sopenharmony_ci * @is_remote: Is this AUX CH actually using sideband messaging. 16048c2ecf20Sopenharmony_ci */ 16058c2ecf20Sopenharmony_ci bool is_remote; 16068c2ecf20Sopenharmony_ci}; 16078c2ecf20Sopenharmony_ci 16088c2ecf20Sopenharmony_cissize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset, 16098c2ecf20Sopenharmony_ci void *buffer, size_t size); 16108c2ecf20Sopenharmony_cissize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset, 16118c2ecf20Sopenharmony_ci void *buffer, size_t size); 16128c2ecf20Sopenharmony_ci 16138c2ecf20Sopenharmony_ci/** 16148c2ecf20Sopenharmony_ci * drm_dp_dpcd_readb() - read a single byte from the DPCD 16158c2ecf20Sopenharmony_ci * @aux: DisplayPort AUX channel 16168c2ecf20Sopenharmony_ci * @offset: address of the register to read 16178c2ecf20Sopenharmony_ci * @valuep: location where the value of the register will be stored 16188c2ecf20Sopenharmony_ci * 16198c2ecf20Sopenharmony_ci * Returns the number of bytes transferred (1) on success, or a negative 16208c2ecf20Sopenharmony_ci * error code on failure. 16218c2ecf20Sopenharmony_ci */ 16228c2ecf20Sopenharmony_cistatic inline ssize_t drm_dp_dpcd_readb(struct drm_dp_aux *aux, 16238c2ecf20Sopenharmony_ci unsigned int offset, u8 *valuep) 16248c2ecf20Sopenharmony_ci{ 16258c2ecf20Sopenharmony_ci return drm_dp_dpcd_read(aux, offset, valuep, 1); 16268c2ecf20Sopenharmony_ci} 16278c2ecf20Sopenharmony_ci 16288c2ecf20Sopenharmony_ci/** 16298c2ecf20Sopenharmony_ci * drm_dp_dpcd_writeb() - write a single byte to the DPCD 16308c2ecf20Sopenharmony_ci * @aux: DisplayPort AUX channel 16318c2ecf20Sopenharmony_ci * @offset: address of the register to write 16328c2ecf20Sopenharmony_ci * @value: value to write to the register 16338c2ecf20Sopenharmony_ci * 16348c2ecf20Sopenharmony_ci * Returns the number of bytes transferred (1) on success, or a negative 16358c2ecf20Sopenharmony_ci * error code on failure. 16368c2ecf20Sopenharmony_ci */ 16378c2ecf20Sopenharmony_cistatic inline ssize_t drm_dp_dpcd_writeb(struct drm_dp_aux *aux, 16388c2ecf20Sopenharmony_ci unsigned int offset, u8 value) 16398c2ecf20Sopenharmony_ci{ 16408c2ecf20Sopenharmony_ci return drm_dp_dpcd_write(aux, offset, &value, 1); 16418c2ecf20Sopenharmony_ci} 16428c2ecf20Sopenharmony_ci 16438c2ecf20Sopenharmony_ciint drm_dp_read_dpcd_caps(struct drm_dp_aux *aux, 16448c2ecf20Sopenharmony_ci u8 dpcd[DP_RECEIVER_CAP_SIZE]); 16458c2ecf20Sopenharmony_ci 16468c2ecf20Sopenharmony_ciint drm_dp_dpcd_read_link_status(struct drm_dp_aux *aux, 16478c2ecf20Sopenharmony_ci u8 status[DP_LINK_STATUS_SIZE]); 16488c2ecf20Sopenharmony_ci 16498c2ecf20Sopenharmony_cibool drm_dp_send_real_edid_checksum(struct drm_dp_aux *aux, 16508c2ecf20Sopenharmony_ci u8 real_edid_checksum); 16518c2ecf20Sopenharmony_ci 16528c2ecf20Sopenharmony_ciint drm_dp_read_downstream_info(struct drm_dp_aux *aux, 16538c2ecf20Sopenharmony_ci const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16548c2ecf20Sopenharmony_ci u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS]); 16558c2ecf20Sopenharmony_cibool drm_dp_downstream_is_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16568c2ecf20Sopenharmony_ci const u8 port_cap[4], u8 type); 16578c2ecf20Sopenharmony_cibool drm_dp_downstream_is_tmds(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16588c2ecf20Sopenharmony_ci const u8 port_cap[4], 16598c2ecf20Sopenharmony_ci const struct edid *edid); 16608c2ecf20Sopenharmony_ciint drm_dp_downstream_max_dotclock(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16618c2ecf20Sopenharmony_ci const u8 port_cap[4]); 16628c2ecf20Sopenharmony_ciint drm_dp_downstream_max_tmds_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16638c2ecf20Sopenharmony_ci const u8 port_cap[4], 16648c2ecf20Sopenharmony_ci const struct edid *edid); 16658c2ecf20Sopenharmony_ciint drm_dp_downstream_min_tmds_clock(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16668c2ecf20Sopenharmony_ci const u8 port_cap[4], 16678c2ecf20Sopenharmony_ci const struct edid *edid); 16688c2ecf20Sopenharmony_ciint drm_dp_downstream_max_bpc(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16698c2ecf20Sopenharmony_ci const u8 port_cap[4], 16708c2ecf20Sopenharmony_ci const struct edid *edid); 16718c2ecf20Sopenharmony_cibool drm_dp_downstream_420_passthrough(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16728c2ecf20Sopenharmony_ci const u8 port_cap[4]); 16738c2ecf20Sopenharmony_cibool drm_dp_downstream_444_to_420_conversion(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16748c2ecf20Sopenharmony_ci const u8 port_cap[4]); 16758c2ecf20Sopenharmony_cistruct drm_display_mode *drm_dp_downstream_mode(struct drm_device *dev, 16768c2ecf20Sopenharmony_ci const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16778c2ecf20Sopenharmony_ci const u8 port_cap[4]); 16788c2ecf20Sopenharmony_ciint drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]); 16798c2ecf20Sopenharmony_civoid drm_dp_downstream_debug(struct seq_file *m, 16808c2ecf20Sopenharmony_ci const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16818c2ecf20Sopenharmony_ci const u8 port_cap[4], 16828c2ecf20Sopenharmony_ci const struct edid *edid, 16838c2ecf20Sopenharmony_ci struct drm_dp_aux *aux); 16848c2ecf20Sopenharmony_cienum drm_mode_subconnector 16858c2ecf20Sopenharmony_cidrm_dp_subconnector_type(const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16868c2ecf20Sopenharmony_ci const u8 port_cap[4]); 16878c2ecf20Sopenharmony_civoid drm_dp_set_subconnector_property(struct drm_connector *connector, 16888c2ecf20Sopenharmony_ci enum drm_connector_status status, 16898c2ecf20Sopenharmony_ci const u8 *dpcd, 16908c2ecf20Sopenharmony_ci const u8 port_cap[4]); 16918c2ecf20Sopenharmony_ci 16928c2ecf20Sopenharmony_cistruct drm_dp_desc; 16938c2ecf20Sopenharmony_cibool drm_dp_read_sink_count_cap(struct drm_connector *connector, 16948c2ecf20Sopenharmony_ci const u8 dpcd[DP_RECEIVER_CAP_SIZE], 16958c2ecf20Sopenharmony_ci const struct drm_dp_desc *desc); 16968c2ecf20Sopenharmony_ciint drm_dp_read_sink_count(struct drm_dp_aux *aux); 16978c2ecf20Sopenharmony_ci 16988c2ecf20Sopenharmony_civoid drm_dp_remote_aux_init(struct drm_dp_aux *aux); 16998c2ecf20Sopenharmony_civoid drm_dp_aux_init(struct drm_dp_aux *aux); 17008c2ecf20Sopenharmony_ciint drm_dp_aux_register(struct drm_dp_aux *aux); 17018c2ecf20Sopenharmony_civoid drm_dp_aux_unregister(struct drm_dp_aux *aux); 17028c2ecf20Sopenharmony_ci 17038c2ecf20Sopenharmony_ciint drm_dp_start_crc(struct drm_dp_aux *aux, struct drm_crtc *crtc); 17048c2ecf20Sopenharmony_ciint drm_dp_stop_crc(struct drm_dp_aux *aux); 17058c2ecf20Sopenharmony_ci 17068c2ecf20Sopenharmony_cistruct drm_dp_dpcd_ident { 17078c2ecf20Sopenharmony_ci u8 oui[3]; 17088c2ecf20Sopenharmony_ci u8 device_id[6]; 17098c2ecf20Sopenharmony_ci u8 hw_rev; 17108c2ecf20Sopenharmony_ci u8 sw_major_rev; 17118c2ecf20Sopenharmony_ci u8 sw_minor_rev; 17128c2ecf20Sopenharmony_ci} __packed; 17138c2ecf20Sopenharmony_ci 17148c2ecf20Sopenharmony_ci/** 17158c2ecf20Sopenharmony_ci * struct drm_dp_desc - DP branch/sink device descriptor 17168c2ecf20Sopenharmony_ci * @ident: DP device identification from DPCD 0x400 (sink) or 0x500 (branch). 17178c2ecf20Sopenharmony_ci * @quirks: Quirks; use drm_dp_has_quirk() to query for the quirks. 17188c2ecf20Sopenharmony_ci */ 17198c2ecf20Sopenharmony_cistruct drm_dp_desc { 17208c2ecf20Sopenharmony_ci struct drm_dp_dpcd_ident ident; 17218c2ecf20Sopenharmony_ci u32 quirks; 17228c2ecf20Sopenharmony_ci}; 17238c2ecf20Sopenharmony_ci 17248c2ecf20Sopenharmony_ciint drm_dp_read_desc(struct drm_dp_aux *aux, struct drm_dp_desc *desc, 17258c2ecf20Sopenharmony_ci bool is_branch); 17268c2ecf20Sopenharmony_ciu32 drm_dp_get_edid_quirks(const struct edid *edid); 17278c2ecf20Sopenharmony_ci 17288c2ecf20Sopenharmony_ci/** 17298c2ecf20Sopenharmony_ci * enum drm_dp_quirk - Display Port sink/branch device specific quirks 17308c2ecf20Sopenharmony_ci * 17318c2ecf20Sopenharmony_ci * Display Port sink and branch devices in the wild have a variety of bugs, try 17328c2ecf20Sopenharmony_ci * to collect them here. The quirks are shared, but it's up to the drivers to 17338c2ecf20Sopenharmony_ci * implement workarounds for them. Note that because some devices have 17348c2ecf20Sopenharmony_ci * unreliable OUIDs, the EDID of sinks should also be checked for quirks using 17358c2ecf20Sopenharmony_ci * drm_dp_get_edid_quirks(). 17368c2ecf20Sopenharmony_ci */ 17378c2ecf20Sopenharmony_cienum drm_dp_quirk { 17388c2ecf20Sopenharmony_ci /** 17398c2ecf20Sopenharmony_ci * @DP_DPCD_QUIRK_CONSTANT_N: 17408c2ecf20Sopenharmony_ci * 17418c2ecf20Sopenharmony_ci * The device requires main link attributes Mvid and Nvid to be limited 17428c2ecf20Sopenharmony_ci * to 16 bits. So will give a constant value (0x8000) for compatability. 17438c2ecf20Sopenharmony_ci */ 17448c2ecf20Sopenharmony_ci DP_DPCD_QUIRK_CONSTANT_N, 17458c2ecf20Sopenharmony_ci /** 17468c2ecf20Sopenharmony_ci * @DP_DPCD_QUIRK_NO_PSR: 17478c2ecf20Sopenharmony_ci * 17488c2ecf20Sopenharmony_ci * The device does not support PSR even if reports that it supports or 17498c2ecf20Sopenharmony_ci * driver still need to implement proper handling for such device. 17508c2ecf20Sopenharmony_ci */ 17518c2ecf20Sopenharmony_ci DP_DPCD_QUIRK_NO_PSR, 17528c2ecf20Sopenharmony_ci /** 17538c2ecf20Sopenharmony_ci * @DP_DPCD_QUIRK_NO_SINK_COUNT: 17548c2ecf20Sopenharmony_ci * 17558c2ecf20Sopenharmony_ci * The device does not set SINK_COUNT to a non-zero value. 17568c2ecf20Sopenharmony_ci * The driver should ignore SINK_COUNT during detection. Note that 17578c2ecf20Sopenharmony_ci * drm_dp_read_sink_count_cap() automatically checks for this quirk. 17588c2ecf20Sopenharmony_ci */ 17598c2ecf20Sopenharmony_ci DP_DPCD_QUIRK_NO_SINK_COUNT, 17608c2ecf20Sopenharmony_ci /** 17618c2ecf20Sopenharmony_ci * @DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD: 17628c2ecf20Sopenharmony_ci * 17638c2ecf20Sopenharmony_ci * The device supports MST DSC despite not supporting Virtual DPCD. 17648c2ecf20Sopenharmony_ci * The DSC caps can be read from the physical aux instead. 17658c2ecf20Sopenharmony_ci */ 17668c2ecf20Sopenharmony_ci DP_DPCD_QUIRK_DSC_WITHOUT_VIRTUAL_DPCD, 17678c2ecf20Sopenharmony_ci /** 17688c2ecf20Sopenharmony_ci * @DP_QUIRK_FORCE_DPCD_BACKLIGHT: 17698c2ecf20Sopenharmony_ci * 17708c2ecf20Sopenharmony_ci * The device is telling the truth when it says that it uses DPCD 17718c2ecf20Sopenharmony_ci * backlight controls, even if the system's firmware disagrees. This 17728c2ecf20Sopenharmony_ci * quirk should be checked against both the ident and panel EDID. 17738c2ecf20Sopenharmony_ci * When present, the driver should honor the DPCD backlight 17748c2ecf20Sopenharmony_ci * capabilities advertised. 17758c2ecf20Sopenharmony_ci */ 17768c2ecf20Sopenharmony_ci DP_QUIRK_FORCE_DPCD_BACKLIGHT, 17778c2ecf20Sopenharmony_ci /** 17788c2ecf20Sopenharmony_ci * @DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS: 17798c2ecf20Sopenharmony_ci * 17808c2ecf20Sopenharmony_ci * The device supports a link rate of 3.24 Gbps (multiplier 0xc) despite 17818c2ecf20Sopenharmony_ci * the DP_MAX_LINK_RATE register reporting a lower max multiplier. 17828c2ecf20Sopenharmony_ci */ 17838c2ecf20Sopenharmony_ci DP_DPCD_QUIRK_CAN_DO_MAX_LINK_RATE_3_24_GBPS, 17848c2ecf20Sopenharmony_ci}; 17858c2ecf20Sopenharmony_ci 17868c2ecf20Sopenharmony_ci/** 17878c2ecf20Sopenharmony_ci * drm_dp_has_quirk() - does the DP device have a specific quirk 17888c2ecf20Sopenharmony_ci * @desc: Device descriptor filled by drm_dp_read_desc() 17898c2ecf20Sopenharmony_ci * @edid_quirks: Optional quirk bitmask filled by drm_dp_get_edid_quirks() 17908c2ecf20Sopenharmony_ci * @quirk: Quirk to query for 17918c2ecf20Sopenharmony_ci * 17928c2ecf20Sopenharmony_ci * Return true if DP device identified by @desc has @quirk. 17938c2ecf20Sopenharmony_ci */ 17948c2ecf20Sopenharmony_cistatic inline bool 17958c2ecf20Sopenharmony_cidrm_dp_has_quirk(const struct drm_dp_desc *desc, u32 edid_quirks, 17968c2ecf20Sopenharmony_ci enum drm_dp_quirk quirk) 17978c2ecf20Sopenharmony_ci{ 17988c2ecf20Sopenharmony_ci return (desc->quirks | edid_quirks) & BIT(quirk); 17998c2ecf20Sopenharmony_ci} 18008c2ecf20Sopenharmony_ci 18018c2ecf20Sopenharmony_ci#ifdef CONFIG_DRM_DP_CEC 18028c2ecf20Sopenharmony_civoid drm_dp_cec_irq(struct drm_dp_aux *aux); 18038c2ecf20Sopenharmony_civoid drm_dp_cec_register_connector(struct drm_dp_aux *aux, 18048c2ecf20Sopenharmony_ci struct drm_connector *connector); 18058c2ecf20Sopenharmony_civoid drm_dp_cec_unregister_connector(struct drm_dp_aux *aux); 18068c2ecf20Sopenharmony_civoid drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid); 18078c2ecf20Sopenharmony_civoid drm_dp_cec_unset_edid(struct drm_dp_aux *aux); 18088c2ecf20Sopenharmony_ci#else 18098c2ecf20Sopenharmony_cistatic inline void drm_dp_cec_irq(struct drm_dp_aux *aux) 18108c2ecf20Sopenharmony_ci{ 18118c2ecf20Sopenharmony_ci} 18128c2ecf20Sopenharmony_ci 18138c2ecf20Sopenharmony_cistatic inline void 18148c2ecf20Sopenharmony_cidrm_dp_cec_register_connector(struct drm_dp_aux *aux, 18158c2ecf20Sopenharmony_ci struct drm_connector *connector) 18168c2ecf20Sopenharmony_ci{ 18178c2ecf20Sopenharmony_ci} 18188c2ecf20Sopenharmony_ci 18198c2ecf20Sopenharmony_cistatic inline void drm_dp_cec_unregister_connector(struct drm_dp_aux *aux) 18208c2ecf20Sopenharmony_ci{ 18218c2ecf20Sopenharmony_ci} 18228c2ecf20Sopenharmony_ci 18238c2ecf20Sopenharmony_cistatic inline void drm_dp_cec_set_edid(struct drm_dp_aux *aux, 18248c2ecf20Sopenharmony_ci const struct edid *edid) 18258c2ecf20Sopenharmony_ci{ 18268c2ecf20Sopenharmony_ci} 18278c2ecf20Sopenharmony_ci 18288c2ecf20Sopenharmony_cistatic inline void drm_dp_cec_unset_edid(struct drm_dp_aux *aux) 18298c2ecf20Sopenharmony_ci{ 18308c2ecf20Sopenharmony_ci} 18318c2ecf20Sopenharmony_ci 18328c2ecf20Sopenharmony_ci#endif 18338c2ecf20Sopenharmony_ci 18348c2ecf20Sopenharmony_ci/** 18358c2ecf20Sopenharmony_ci * struct drm_dp_phy_test_params - DP Phy Compliance parameters 18368c2ecf20Sopenharmony_ci * @link_rate: Requested Link rate from DPCD 0x219 18378c2ecf20Sopenharmony_ci * @num_lanes: Number of lanes requested by sing through DPCD 0x220 18388c2ecf20Sopenharmony_ci * @phy_pattern: DP Phy test pattern from DPCD 0x248 18398c2ecf20Sopenharmony_ci * @hbr2_reset: DP HBR2_COMPLIANCE_SCRAMBLER_RESET from DCPD 0x24A and 0x24B 18408c2ecf20Sopenharmony_ci * @custom80: DP Test_80BIT_CUSTOM_PATTERN from DPCDs 0x250 through 0x259 18418c2ecf20Sopenharmony_ci * @enhanced_frame_cap: flag for enhanced frame capability. 18428c2ecf20Sopenharmony_ci */ 18438c2ecf20Sopenharmony_cistruct drm_dp_phy_test_params { 18448c2ecf20Sopenharmony_ci int link_rate; 18458c2ecf20Sopenharmony_ci u8 num_lanes; 18468c2ecf20Sopenharmony_ci u8 phy_pattern; 18478c2ecf20Sopenharmony_ci u8 hbr2_reset[2]; 18488c2ecf20Sopenharmony_ci u8 custom80[10]; 18498c2ecf20Sopenharmony_ci bool enhanced_frame_cap; 18508c2ecf20Sopenharmony_ci}; 18518c2ecf20Sopenharmony_ci 18528c2ecf20Sopenharmony_ciint drm_dp_get_phy_test_pattern(struct drm_dp_aux *aux, 18538c2ecf20Sopenharmony_ci struct drm_dp_phy_test_params *data); 18548c2ecf20Sopenharmony_ciint drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, 18558c2ecf20Sopenharmony_ci struct drm_dp_phy_test_params *data, u8 dp_rev); 18568c2ecf20Sopenharmony_ci#endif /* _DRM_DP_HELPER_H_ */ 1857