2 * Copyright 2016 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
30 #include "dc_ddc_types.h"
33 LANE_COUNT_UNKNOWN = 0,
38 LANE_COUNT_DP_MAX = LANE_COUNT_FOUR
41 /* This is actually a reference clock (27MHz) multiplier
42 * 162MBps bandwidth for 1.62GHz like rate,
43 * 270MBps for 2.70GHz,
44 * 324MBps for 3.24Ghz,
49 LINK_RATE_UNKNOWN = 0,
50 LINK_RATE_LOW = 0x06, // Rate_1 (RBR) - 1.62 Gbps/Lane
51 LINK_RATE_RATE_2 = 0x08, // Rate_2 - 2.16 Gbps/Lane
52 LINK_RATE_RATE_3 = 0x09, // Rate_3 - 2.43 Gbps/Lane
53 LINK_RATE_HIGH = 0x0A, // Rate_4 (HBR) - 2.70 Gbps/Lane
54 LINK_RATE_RBR2 = 0x0C, // Rate_5 (RBR2) - 3.24 Gbps/Lane
55 LINK_RATE_RATE_6 = 0x10, // Rate_6 - 4.32 Gbps/Lane
56 LINK_RATE_HIGH2 = 0x14, // Rate_7 (HBR2) - 5.40 Gbps/Lane
57 LINK_RATE_RATE_8 = 0x19, // Rate_8 - 6.75 Gbps/Lane
58 LINK_RATE_HIGH3 = 0x1E, // Rate_9 (HBR3) - 8.10 Gbps/Lane
59 /* Starting from DP2.0 link rate enum directly represents actual
60 * link rate value in unit of 10 mbps
62 LINK_RATE_UHBR10 = 1000, // UHBR10 - 10.0 Gbps/Lane
63 LINK_RATE_UHBR13_5 = 1350, // UHBR13.5 - 13.5 Gbps/Lane
64 LINK_RATE_UHBR20 = 2000, // UHBR10 - 20.0 Gbps/Lane
68 LINK_SPREAD_DISABLED = 0x00,
69 /* 0.5 % downspread 30 kHz */
70 LINK_SPREAD_05_DOWNSPREAD_30KHZ = 0x10,
71 /* 0.5 % downspread 33 kHz */
72 LINK_SPREAD_05_DOWNSPREAD_33KHZ = 0x11
75 enum dc_voltage_swing {
76 VOLTAGE_SWING_LEVEL0 = 0, /* direct HW translation! */
80 VOLTAGE_SWING_MAX_LEVEL = VOLTAGE_SWING_LEVEL3
83 enum dc_pre_emphasis {
84 PRE_EMPHASIS_DISABLED = 0, /* direct HW translation! */
88 PRE_EMPHASIS_MAX_LEVEL = PRE_EMPHASIS_LEVEL3
90 /* Post Cursor 2 is optional for transmitter
91 * and it applies only to the main link operating at HBR2
93 enum dc_post_cursor2 {
94 POST_CURSOR2_DISABLED = 0, /* direct HW translation! */
98 POST_CURSOR2_MAX_LEVEL = POST_CURSOR2_LEVEL3,
101 enum dc_dp_ffe_preset_level {
102 DP_FFE_PRESET_LEVEL0 = 0,
103 DP_FFE_PRESET_LEVEL1,
104 DP_FFE_PRESET_LEVEL2,
105 DP_FFE_PRESET_LEVEL3,
106 DP_FFE_PRESET_LEVEL4,
107 DP_FFE_PRESET_LEVEL5,
108 DP_FFE_PRESET_LEVEL6,
109 DP_FFE_PRESET_LEVEL7,
110 DP_FFE_PRESET_LEVEL8,
111 DP_FFE_PRESET_LEVEL9,
112 DP_FFE_PRESET_LEVEL10,
113 DP_FFE_PRESET_LEVEL11,
114 DP_FFE_PRESET_LEVEL12,
115 DP_FFE_PRESET_LEVEL13,
116 DP_FFE_PRESET_LEVEL14,
117 DP_FFE_PRESET_LEVEL15,
118 DP_FFE_PRESET_MAX_LEVEL = DP_FFE_PRESET_LEVEL15,
121 enum dc_dp_training_pattern {
122 DP_TRAINING_PATTERN_SEQUENCE_1 = 0,
123 DP_TRAINING_PATTERN_SEQUENCE_2,
124 DP_TRAINING_PATTERN_SEQUENCE_3,
125 DP_TRAINING_PATTERN_SEQUENCE_4,
126 DP_TRAINING_PATTERN_VIDEOIDLE,
129 DP_128b_132b_TPS2_CDS,
132 enum dp_link_encoding {
133 DP_UNKNOWN_ENCODING = 0,
134 DP_8b_10b_ENCODING = 1,
135 DP_128b_132b_ENCODING = 2,
138 enum dp_test_link_rate {
139 DP_TEST_LINK_RATE_RBR = 0x06,
140 DP_TEST_LINK_RATE_HBR = 0x0A,
141 DP_TEST_LINK_RATE_HBR2 = 0x14,
142 DP_TEST_LINK_RATE_HBR3 = 0x1E,
143 DP_TEST_LINK_RATE_UHBR10 = 0x01,
144 DP_TEST_LINK_RATE_UHBR20 = 0x02,
145 DP_TEST_LINK_RATE_UHBR13_5 = 0x03,
148 struct dc_link_settings {
149 enum dc_lane_count lane_count;
150 enum dc_link_rate link_rate;
151 enum dc_link_spread link_spread;
152 bool use_link_rate_set;
153 uint8_t link_rate_set;
156 union dc_dp_ffe_preset {
159 uint8_t reserved : 1;
160 uint8_t no_preshoot : 1;
161 uint8_t no_deemphasis : 1;
167 struct dc_lane_settings {
168 enum dc_voltage_swing VOLTAGE_SWING;
169 enum dc_pre_emphasis PRE_EMPHASIS;
170 enum dc_post_cursor2 POST_CURSOR2;
171 union dc_dp_ffe_preset FFE_PRESET;
174 struct dc_link_training_overrides {
175 enum dc_voltage_swing *voltage_swing;
176 enum dc_pre_emphasis *pre_emphasis;
177 enum dc_post_cursor2 *post_cursor2;
178 union dc_dp_ffe_preset *ffe_preset;
180 uint16_t *cr_pattern_time;
181 uint16_t *eq_pattern_time;
182 enum dc_dp_training_pattern *pattern_for_cr;
183 enum dc_dp_training_pattern *pattern_for_eq;
185 enum dc_link_spread *downspread;
186 bool *alternate_scrambler_reset;
187 bool *enhanced_framing;
192 union payload_table_update_status {
194 uint8_t VC_PAYLOAD_TABLE_UPDATED:1;
195 uint8_t ACT_HANDLED:1;
208 union max_lane_count {
210 uint8_t MAX_LANE_COUNT:5;
211 uint8_t POST_LT_ADJ_REQ_SUPPORTED:1;
212 uint8_t TPS3_SUPPORTED:1;
213 uint8_t ENHANCED_FRAME_CAP:1;
218 union max_down_spread {
220 uint8_t MAX_DOWN_SPREAD:1;
222 uint8_t NO_AUX_HANDSHAKE_LINK_TRAINING:1;
223 uint8_t TPS4_SUPPORTED:1;
236 union lane_count_set {
238 uint8_t LANE_COUNT_SET:5;
239 uint8_t POST_LT_ADJ_REQ_GRANTED:1;
241 uint8_t ENHANCED_FRAMING:1;
249 uint8_t CHANNEL_EQ_DONE_0:1;
250 uint8_t SYMBOL_LOCKED_0:1;
253 uint8_t CHANNEL_EQ_DONE_1:1;
254 uint8_t SYMBOL_LOCKED_1:1;
255 uint8_t RESERVED_1:1;
260 union device_service_irq {
262 uint8_t REMOTE_CONTROL_CMD_PENDING:1;
263 uint8_t AUTOMATED_TEST:1;
266 uint8_t DOWN_REP_MSG_RDY:1;
267 uint8_t UP_REQ_MSG_RDY:1;
268 uint8_t SINK_SPECIFIC:1;
276 uint8_t SINK_COUNT:6;
283 union lane_align_status_updated {
285 uint8_t INTERLANE_ALIGN_DONE:1;
286 uint8_t POST_LT_ADJ_REQ_IN_PROGRESS:1;
287 uint8_t EQ_INTERLANE_ALIGN_DONE_128b_132b:1;
288 uint8_t CDS_INTERLANE_ALIGN_DONE_128b_132b:1;
289 uint8_t LT_FAILED_128b_132b:1;
291 uint8_t DOWNSTREAM_PORT_STATUS_CHANGED:1;
292 uint8_t LINK_STATUS_UPDATED:1;
299 uint8_t VOLTAGE_SWING_LANE:2;
300 uint8_t PRE_EMPHASIS_LANE:2;
304 uint8_t PRESET_VALUE :4;
310 union dpcd_training_pattern {
312 uint8_t TRAINING_PATTERN_SET:4;
313 uint8_t RECOVERED_CLOCK_OUT_EN:1;
314 uint8_t SCRAMBLING_DISABLE:1;
315 uint8_t SYMBOL_ERROR_COUNT_SEL:2;
318 uint8_t TRAINING_PATTERN_SET:2;
319 uint8_t LINK_QUAL_PATTERN_SET:2;
325 /* Training Lane is used to configure downstream DP device's voltage swing
326 and pre-emphasis levels*/
327 /* The DPCD addresses are from 0x103 to 0x106*/
328 union dpcd_training_lane {
330 uint8_t VOLTAGE_SWING_SET:2;
331 uint8_t MAX_SWING_REACHED:1;
332 uint8_t PRE_EMPHASIS_SET:2;
333 uint8_t MAX_PRE_EMPHASIS_REACHED:1;
337 uint8_t PRESET_VALUE :4;
343 /* TMDS-converter related */
344 union dwnstream_port_caps_byte0 {
346 uint8_t DWN_STRM_PORTX_TYPE:3;
347 uint8_t DWN_STRM_PORTX_HPD:1;
353 /* these are the detailed types stored at DWN_STRM_PORTX_CAP (00080h)*/
354 enum dpcd_downstream_port_detailed_type {
355 DOWN_STREAM_DETAILED_DP = 0,
356 DOWN_STREAM_DETAILED_VGA,
357 DOWN_STREAM_DETAILED_DVI,
358 DOWN_STREAM_DETAILED_HDMI,
359 DOWN_STREAM_DETAILED_NONDDC,/* has no EDID (TV,CV)*/
360 DOWN_STREAM_DETAILED_DP_PLUS_PLUS
363 union dwnstream_port_caps_byte2 {
365 uint8_t MAX_BITS_PER_COLOR_COMPONENT:2;
366 uint8_t MAX_ENCODED_LINK_BW_SUPPORT:3;
367 uint8_t SOURCE_CONTROL_MODE_SUPPORT:1;
368 uint8_t CONCURRENT_LINK_BRING_UP_SEQ_SUPPORT:1;
374 union dp_downstream_port_present {
377 uint8_t PORT_PRESENT:1;
379 uint8_t FMT_CONVERSION:1;
380 uint8_t DETAILED_CAPS:1;
385 union dwnstream_port_caps_byte3_dvi {
389 uint8_t HIGH_COLOR_DEPTH:1;
395 union dwnstream_port_caps_byte3_hdmi {
397 uint8_t FRAME_SEQ_TO_FRAME_PACK:1;
398 uint8_t YCrCr422_PASS_THROUGH:1;
399 uint8_t YCrCr420_PASS_THROUGH:1;
400 uint8_t YCrCr422_CONVERSION:1;
401 uint8_t YCrCr420_CONVERSION:1;
407 union hdmi_sink_encoded_link_bw_support {
409 uint8_t HDMI_SINK_ENCODED_LINK_BW_SUPPORT:3;
415 union hdmi_encoded_link_bw {
417 uint8_t FRL_MODE:1; // Bit 0
424 uint8_t RESERVED:1; // Bit 7
429 /*4-byte structure for detailed capabilities of a down-stream port
430 (DP-to-TMDS converter).*/
431 union dwnstream_portxcaps {
433 union dwnstream_port_caps_byte0 byte0;
434 unsigned char max_TMDS_clock; //byte1
435 union dwnstream_port_caps_byte2 byte2;
438 union dwnstream_port_caps_byte3_dvi byteDVI;
439 union dwnstream_port_caps_byte3_hdmi byteHDMI;
443 unsigned char raw[4];
446 union downstream_port {
448 unsigned char present:1;
449 unsigned char type:2;
450 unsigned char format_conv:1;
451 unsigned char detailed_caps:1;
452 unsigned char reserved:3;
460 uint8_t RX_PORT0_STATUS:1;
461 uint8_t RX_PORT1_STATUS:1;
467 /*6-byte structure corresponding to 6 registers (200h-205h)
468 read during handling of HPD-IRQ*/
471 union sink_count sink_cnt;/* 200h */
472 union device_service_irq device_service_irq;/* 201h */
473 union lane_status lane01_status;/* 202h */
474 union lane_status lane23_status;/* 203h */
475 union lane_align_status_updated lane_status_updated;/* 204h */
476 union sink_status sink_status;
481 union down_stream_port_count {
483 uint8_t DOWN_STR_PORT_COUNT:4;
484 uint8_t RESERVED:2; /*Bits 5:4 = RESERVED. Read all 0s.*/
485 /*Bit 6 = MSA_TIMING_PAR_IGNORED
486 0 = Sink device requires the MSA timing parameters
487 1 = Sink device is capable of rendering incoming video
488 stream without MSA timing parameters*/
489 uint8_t IGNORE_MSA_TIMING_PARAM:1;
490 /*Bit 7 = OUI Support
491 0 = OUI not supported
493 (OUI and Device Identification mandatory for DP 1.2)*/
494 uint8_t OUI_SUPPORT:1;
499 union down_spread_ctrl {
501 uint8_t RESERVED1:4;/* Bit 3:0 = RESERVED. Read all 0s*/
502 /* Bits 4 = SPREAD_AMP. Spreading amplitude
503 0 = Main link signal is not downspread
504 1 = Main link signal is downspread <= 0.5%
505 with frequency in the range of 30kHz ~ 33kHz*/
506 uint8_t SPREAD_AMP:1;
507 uint8_t RESERVED2:1;/*Bit 5 = RESERVED. Read all 0s*/
508 /* Bit 6 = FIXED_VTOTAL_AS_SDP_EN_IN_PR_ACTIVE.
509 0 = FIXED_VTOTAL_AS_SDP_EN_IN_PR_ACTIVE is not enabled by the Source device (default)
510 1 = FIXED_VTOTAL_AS_SDP_EN_IN_PR_ACTIVE is enabled by Source device */
511 uint8_t FIXED_VTOTAL_AS_SDP_EN_IN_PR_ACTIVE:1;
512 /*Bit 7 = MSA_TIMING_PAR_IGNORE_EN
513 0 = Source device will send valid data for the MSA Timing Params
514 1 = Source device may send invalid data for these MSA Timing Params*/
515 uint8_t IGNORE_MSA_TIMING_PARAM:1;
520 union dpcd_edp_config {
522 uint8_t PANEL_MODE_EDP:1;
523 uint8_t FRAMING_CHANGE_ENABLE:1;
525 uint8_t PANEL_SELF_TEST_ENABLE:1;
530 struct dp_device_vendor_id {
531 uint8_t ieee_oui[3];/*24-bit IEEE OUI*/
532 uint8_t ieee_device_id[6];/*usually 6-byte ASCII name*/
535 struct dp_sink_hw_fw_revision {
537 uint8_t ieee_fw_rev[2];
540 struct dpcd_vendor_signature {
543 union dpcd_ieee_vendor_signature {
545 uint8_t ieee_oui[3];/*24-bit IEEE OUI*/
546 uint8_t ieee_device_id[6];/*usually 6-byte ASCII name*/
548 uint8_t ieee_fw_rev[2];
554 struct dpcd_amd_signature {
555 uint8_t AMD_IEEE_TxSignature_byte1;
556 uint8_t AMD_IEEE_TxSignature_byte2;
557 uint8_t AMD_IEEE_TxSignature_byte3;
560 struct dpcd_amd_device_id {
561 uint8_t device_id_byte1;
562 uint8_t device_id_byte2;
565 uint8_t dal_version_byte1;
566 uint8_t dal_version_byte2;
569 struct dpcd_source_backlight_set {
575 } backlight_level_millinits;
580 } backlight_transition_time_ms;
583 union dpcd_source_backlight_get {
585 uint32_t backlight_millinits_peak; /* 326h */
586 uint32_t backlight_millinits_avg; /* 32Ah */
591 /*DPCD register of DP receiver capability field bits-*/
592 union edp_configuration_cap {
594 uint8_t ALT_SCRAMBLER_RESET:1;
595 uint8_t FRAMING_CHANGE:1;
597 uint8_t DPCD_DISPLAY_CONTROL_CAPABLE:1;
605 uint8_t GTC_CAP:1; // bit 0: DP 1.3+
606 uint8_t SST_SPLIT_SDP_CAP:1; // bit 1: DP 1.4
607 uint8_t AV_SYNC_CAP:1; // bit 2: DP 1.3+
608 uint8_t VSC_SDP_COLORIMETRY_SUPPORTED:1; // bit 3: DP 1.3+
609 uint8_t VSC_EXT_VESA_SDP_SUPPORTED:1; // bit 4: DP 1.4
610 uint8_t VSC_EXT_VESA_SDP_CHAINING_SUPPORTED:1; // bit 5: DP 1.4
611 uint8_t VSC_EXT_CEA_SDP_SUPPORTED:1; // bit 6: DP 1.4
612 uint8_t VSC_EXT_CEA_SDP_CHAINING_SUPPORTED:1; // bit 7: DP 1.4
617 union training_aux_rd_interval {
619 uint8_t TRAINIG_AUX_RD_INTERVAL:7;
620 uint8_t EXT_RECEIVER_CAP_FIELD_PRESENT:1;
625 /* Automated test structures */
628 uint8_t LINK_TRAINING :1;
629 uint8_t LINK_TEST_PATTRN :1;
630 uint8_t EDID_READ :1;
631 uint8_t PHY_TEST_PATTERN :1;
632 uint8_t PHY_TEST_CHANNEL_CODING_TYPE :2;
633 uint8_t AUDIO_TEST_PATTERN :1;
634 uint8_t TEST_AUDIO_DISABLED_VIDEO :1;
639 union test_response {
643 uint8_t EDID_CHECKSUM_WRITE:1;
649 union phy_test_pattern {
651 /* This field is 7 bits for DP2.0 */
658 /* States of Compliance Test Specification (CTS DP1.2). */
659 union compliance_test_state {
661 unsigned char STEREO_3D_RUNNING : 1;
662 unsigned char RESERVED : 7;
667 union link_test_pattern {
669 /* dpcd_link_test_patterns */
670 unsigned char PATTERN :2;
671 unsigned char RESERVED:6;
677 struct dpcd_test_misc_bits {
678 unsigned char SYNC_CLOCK :1;
679 /* dpcd_test_color_format */
680 unsigned char CLR_FORMAT :2;
681 /* dpcd_test_dyn_range */
682 unsigned char DYN_RANGE :1;
683 unsigned char YCBCR_COEFS :1;
684 /* dpcd_test_bit_depth */
685 unsigned char BPC :3;
690 union audio_test_mode {
692 unsigned char sampling_rate :4;
693 unsigned char channel_count :4;
698 union audio_test_pattern_period {
700 unsigned char pattern_period :4;
701 unsigned char reserved :4;
706 struct audio_test_pattern_type {
710 struct dp_audio_test_data_flags {
711 uint8_t test_requested :1;
712 uint8_t disable_video :1;
715 struct dp_audio_test_data {
717 struct dp_audio_test_data_flags flags;
718 uint8_t sampling_rate;
719 uint8_t channel_count;
720 uint8_t pattern_type;
721 uint8_t pattern_period[8];
724 /* FEC capability DPCD register field bits-*/
725 union dpcd_fec_capability {
727 uint8_t FEC_CAPABLE:1;
728 uint8_t UNCORRECTED_BLOCK_ERROR_COUNT_CAPABLE:1;
729 uint8_t CORRECTED_BLOCK_ERROR_COUNT_CAPABLE:1;
730 uint8_t BIT_ERROR_COUNT_CAPABLE:1;
731 uint8_t PARITY_BLOCK_ERROR_COUNT_CAPABLE:1;
732 uint8_t ARITY_BIT_ERROR_COUNT_CAPABLE:1;
733 uint8_t FEC_RUNNING_INDICATOR_SUPPORTED:1;
734 uint8_t FEC_ERROR_REPORTING_POLICY_SUPPORTED:1;
739 /* DSC capability DPCD register field bits-*/
740 struct dpcd_dsc_support {
741 uint8_t DSC_SUPPORT :1;
742 uint8_t DSC_PASSTHROUGH_SUPPORT :1;
746 struct dpcd_dsc_algorithm_revision {
747 uint8_t DSC_VERSION_MAJOR :4;
748 uint8_t DSC_VERSION_MINOR :4;
751 struct dpcd_dsc_rc_buffer_block_size {
752 uint8_t RC_BLOCK_BUFFER_SIZE :2;
756 struct dpcd_dsc_slice_capability1 {
757 uint8_t ONE_SLICE_PER_DP_DSC_SINK_DEVICE :1;
758 uint8_t TWO_SLICES_PER_DP_DSC_SINK_DEVICE :1;
760 uint8_t FOUR_SLICES_PER_DP_DSC_SINK_DEVICE :1;
761 uint8_t SIX_SLICES_PER_DP_DSC_SINK_DEVICE :1;
762 uint8_t EIGHT_SLICES_PER_DP_DSC_SINK_DEVICE :1;
763 uint8_t TEN_SLICES_PER_DP_DSC_SINK_DEVICE :1;
764 uint8_t TWELVE_SLICES_PER_DP_DSC_SINK_DEVICE :1;
767 struct dpcd_dsc_line_buffer_bit_depth {
768 uint8_t LINE_BUFFER_BIT_DEPTH :4;
772 struct dpcd_dsc_block_prediction_support {
773 uint8_t BLOCK_PREDICTION_SUPPORT:1;
777 struct dpcd_maximum_bits_per_pixel_supported_by_the_decompressor {
778 uint8_t MAXIMUM_BITS_PER_PIXEL_SUPPORTED_BY_THE_DECOMPRESSOR_LOW :7;
779 uint8_t MAXIMUM_BITS_PER_PIXEL_SUPPORTED_BY_THE_DECOMPRESSOR_HIGH :7;
783 struct dpcd_dsc_decoder_color_format_capabilities {
784 uint8_t RGB_SUPPORT :1;
785 uint8_t Y_CB_CR_444_SUPPORT :1;
786 uint8_t Y_CB_CR_SIMPLE_422_SUPPORT :1;
787 uint8_t Y_CB_CR_NATIVE_422_SUPPORT :1;
788 uint8_t Y_CB_CR_NATIVE_420_SUPPORT :1;
792 struct dpcd_dsc_decoder_color_depth_capabilities {
793 uint8_t RESERVED0 :1;
794 uint8_t EIGHT_BITS_PER_COLOR_SUPPORT :1;
795 uint8_t TEN_BITS_PER_COLOR_SUPPORT :1;
796 uint8_t TWELVE_BITS_PER_COLOR_SUPPORT :1;
797 uint8_t RESERVED1 :4;
800 struct dpcd_peak_dsc_throughput_dsc_sink {
801 uint8_t THROUGHPUT_MODE_0:4;
802 uint8_t THROUGHPUT_MODE_1:4;
805 struct dpcd_dsc_slice_capabilities_2 {
806 uint8_t SIXTEEN_SLICES_PER_DSC_SINK_DEVICE :1;
807 uint8_t TWENTY_SLICES_PER_DSC_SINK_DEVICE :1;
808 uint8_t TWENTYFOUR_SLICES_PER_DSC_SINK_DEVICE :1;
812 struct dpcd_bits_per_pixel_increment{
813 uint8_t INCREMENT_OF_BITS_PER_PIXEL_SUPPORTED :3;
816 union dpcd_dsc_basic_capabilities {
818 struct dpcd_dsc_support dsc_support;
819 struct dpcd_dsc_algorithm_revision dsc_algorithm_revision;
820 struct dpcd_dsc_rc_buffer_block_size dsc_rc_buffer_block_size;
821 uint8_t dsc_rc_buffer_size;
822 struct dpcd_dsc_slice_capability1 dsc_slice_capabilities_1;
823 struct dpcd_dsc_line_buffer_bit_depth dsc_line_buffer_bit_depth;
824 struct dpcd_dsc_block_prediction_support dsc_block_prediction_support;
825 struct dpcd_maximum_bits_per_pixel_supported_by_the_decompressor maximum_bits_per_pixel_supported_by_the_decompressor;
826 struct dpcd_dsc_decoder_color_format_capabilities dsc_decoder_color_format_capabilities;
827 struct dpcd_dsc_decoder_color_depth_capabilities dsc_decoder_color_depth_capabilities;
828 struct dpcd_peak_dsc_throughput_dsc_sink peak_dsc_throughput_dsc_sink;
829 uint8_t dsc_maximum_slice_width;
830 struct dpcd_dsc_slice_capabilities_2 dsc_slice_capabilities_2;
832 struct dpcd_bits_per_pixel_increment bits_per_pixel_increment;
837 union dpcd_dsc_branch_decoder_capabilities {
839 uint8_t BRANCH_OVERALL_THROUGHPUT_0;
840 uint8_t BRANCH_OVERALL_THROUGHPUT_1;
841 uint8_t BRANCH_MAX_LINE_WIDTH;
846 struct dpcd_dsc_capabilities {
847 union dpcd_dsc_basic_capabilities dsc_basic_caps;
848 union dpcd_dsc_branch_decoder_capabilities dsc_branch_decoder_caps;
851 /* These parameters are from PSR capabilities reported by Sink DPCD */
853 unsigned char psr_version;
854 unsigned int psr_rfb_setup_time;
855 bool psr_exit_link_training_required;
856 unsigned char edp_revision;
857 unsigned char support_ver;
858 bool su_granularity_required;
859 bool y_coordinate_required;
860 uint8_t su_y_granularity;
862 bool standby_support;
863 uint8_t rate_control_caps;
864 unsigned int psr_power_opt_flag;
867 union dpcd_dprx_feature_enumeration_list_cont_1 {
869 uint8_t ADAPTIVE_SYNC_SDP_SUPPORT:1;
870 uint8_t AS_SDP_FIRST_HALF_LINE_OR_3840_PIXEL_CYCLE_WINDOW_NOT_SUPPORTED: 1;
871 uint8_t RESERVED0: 2;
872 uint8_t VSC_EXT_SDP_VER1_SUPPORT: 1;
873 uint8_t RESERVED1: 3;
878 struct adaptive_sync_caps {
879 union dpcd_dprx_feature_enumeration_list_cont_1 dp_adap_sync_caps;
882 /* Length of router topology ID read from DPCD in bytes. */
883 #define DPCD_USB4_TOPOLOGY_ID_LEN 5
885 /* DPCD[0xE000D] DP_TUNNELING_CAPABILITIES SUPPORT register. */
886 union dp_tun_cap_support {
888 uint8_t dp_tunneling :1;
890 uint8_t panel_replay_tun_opt :1;
891 uint8_t dpia_bw_alloc :1;
896 /* DPCD[0xE000E] DP_IN_ADAPTER_INFO register. */
905 /* DP Tunneling over USB4 */
906 struct dpcd_usb4_dp_tunneling_info {
907 union dp_tun_cap_support dp_tun_cap;
908 union dpia_info dpia_info;
909 uint8_t usb4_driver_id;
910 uint8_t usb4_topology_id[DPCD_USB4_TOPOLOGY_ID_LEN];
913 #ifndef DP_MAIN_LINK_CHANNEL_CODING_CAP
914 #define DP_MAIN_LINK_CHANNEL_CODING_CAP 0x006
916 #ifndef DP_SINK_VIDEO_FALLBACK_FORMATS
917 #define DP_SINK_VIDEO_FALLBACK_FORMATS 0x020
919 #ifndef DP_FEC_CAPABILITY_1
920 #define DP_FEC_CAPABILITY_1 0x091
922 #ifndef DP_DFP_CAPABILITY_EXTENSION_SUPPORT
923 #define DP_DFP_CAPABILITY_EXTENSION_SUPPORT 0x0A3
925 #ifndef DP_DSC_CONFIGURATION
926 #define DP_DSC_CONFIGURATION 0x161
928 #ifndef DP_PHY_SQUARE_PATTERN
929 #define DP_PHY_SQUARE_PATTERN 0x249
931 #ifndef DP_128b_132b_SUPPORTED_LINK_RATES
932 #define DP_128b_132b_SUPPORTED_LINK_RATES 0x2215
934 #ifndef DP_128b_132b_TRAINING_AUX_RD_INTERVAL
935 #define DP_128b_132b_TRAINING_AUX_RD_INTERVAL 0x2216
937 #ifndef DP_TEST_264BIT_CUSTOM_PATTERN_7_0
938 #define DP_TEST_264BIT_CUSTOM_PATTERN_7_0 0X2230
940 #ifndef DP_TEST_264BIT_CUSTOM_PATTERN_263_256
941 #define DP_TEST_264BIT_CUSTOM_PATTERN_263_256 0X2250
943 #ifndef DP_DSC_SUPPORT_AND_DECODER_COUNT
944 #define DP_DSC_SUPPORT_AND_DECODER_COUNT 0x2260
946 #ifndef DP_DSC_MAX_SLICE_COUNT_AND_AGGREGATION_0
947 #define DP_DSC_MAX_SLICE_COUNT_AND_AGGREGATION_0 0x2270
949 #ifndef DP_DSC_DECODER_0_MAXIMUM_SLICE_COUNT_MASK
950 #define DP_DSC_DECODER_0_MAXIMUM_SLICE_COUNT_MASK (1 << 0)
952 #ifndef DP_DSC_DECODER_0_AGGREGATION_SUPPORT_MASK
953 #define DP_DSC_DECODER_0_AGGREGATION_SUPPORT_MASK (0b111 << 1)
955 #ifndef DP_DSC_DECODER_0_AGGREGATION_SUPPORT_SHIFT
956 #define DP_DSC_DECODER_0_AGGREGATION_SUPPORT_SHIFT 1
958 #ifndef DP_DSC_DECODER_COUNT_MASK
959 #define DP_DSC_DECODER_COUNT_MASK (0b111 << 5)
961 #ifndef DP_DSC_DECODER_COUNT_SHIFT
962 #define DP_DSC_DECODER_COUNT_SHIFT 5
964 #ifndef DP_MAIN_LINK_CHANNEL_CODING_SET
965 #define DP_MAIN_LINK_CHANNEL_CODING_SET 0x108
967 #ifndef DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER
968 #define DP_MAIN_LINK_CHANNEL_CODING_PHY_REPEATER 0xF0006
970 #ifndef DP_PHY_REPEATER_128b_132b_RATES
971 #define DP_PHY_REPEATER_128b_132b_RATES 0xF0007
973 #ifndef DP_128b_132b_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1
974 #define DP_128b_132b_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 0xF0022
976 #ifndef DP_INTRA_HOP_AUX_REPLY_INDICATION
977 #define DP_INTRA_HOP_AUX_REPLY_INDICATION (1 << 3)
978 /* TODO - Use DRM header to replace above once available */
979 #endif // DP_INTRA_HOP_AUX_REPLY_INDICATION
980 union dp_main_line_channel_coding_cap {
982 uint8_t DP_8b_10b_SUPPORTED :1;
983 uint8_t DP_128b_132b_SUPPORTED :1;
989 union dp_main_link_channel_coding_lttpr_cap {
991 uint8_t DP_128b_132b_SUPPORTED :1;
997 union dp_128b_132b_supported_link_rates {
1007 union dp_128b_132b_supported_lttpr_link_rates {
1017 union dp_sink_video_fallback_formats {
1019 uint8_t dp_1024x768_60Hz_24bpp_support :1;
1020 uint8_t dp_1280x720_60Hz_24bpp_support :1;
1021 uint8_t dp_1920x1080_60Hz_24bpp_support :1;
1022 uint8_t RESERVED :5;
1027 union dp_fec_capability1 {
1029 uint8_t AGGREGATED_ERROR_COUNTERS_CAPABLE :1;
1030 uint8_t RESERVED :7;
1037 uint8_t UHBR10_20_CAPABILITY :2;
1038 uint8_t UHBR13_5_CAPABILITY :1;
1039 uint8_t CABLE_TYPE :3;
1040 uint8_t RESERVED :2;
1045 struct dp_color_depth_caps {
1046 uint8_t support_6bpc :1;
1047 uint8_t support_8bpc :1;
1048 uint8_t support_10bpc :1;
1049 uint8_t support_12bpc :1;
1050 uint8_t support_16bpc :1;
1051 uint8_t RESERVED :3;
1054 struct dp_encoding_format_caps {
1055 uint8_t support_rgb :1;
1056 uint8_t support_ycbcr444:1;
1057 uint8_t support_ycbcr422:1;
1058 uint8_t support_ycbcr420:1;
1059 uint8_t RESERVED :4;
1062 union dp_dfp_cap_ext {
1065 uint8_t max_pixel_rate_in_mps[2];
1066 uint8_t max_video_h_active_width[2];
1067 uint8_t max_video_v_active_height[2];
1068 struct dp_encoding_format_caps encoding_format_caps;
1069 struct dp_color_depth_caps rgb_color_depth_caps;
1070 struct dp_color_depth_caps ycbcr444_color_depth_caps;
1071 struct dp_color_depth_caps ycbcr422_color_depth_caps;
1072 struct dp_color_depth_caps ycbcr420_color_depth_caps;
1077 union dp_128b_132b_training_aux_rd_interval {
1085 union edp_alpm_caps {
1087 uint8_t AUX_WAKE_ALPM_CAP :1;
1088 uint8_t PM_STATE_2A_SUPPORT :1;
1089 uint8_t AUX_LESS_ALPM_CAP :1;
1090 uint8_t RESERVED :5;
1095 union edp_psr_dpcd_caps {
1097 uint8_t LINK_TRAINING_ON_EXIT_NOT_REQUIRED :1;
1098 uint8_t PSR_SETUP_TIME :3;
1099 uint8_t Y_COORDINATE_REQUIRED :1;
1100 uint8_t SU_GRANULARITY_REQUIRED :1;
1101 uint8_t FRAME_SYNC_IS_NOT_NEEDED_FOR_SU :1;
1102 uint8_t RESERVED :1;
1107 struct edp_psr_info {
1108 uint8_t psr_version;
1109 union edp_psr_dpcd_caps psr_dpcd_caps;
1110 uint8_t psr2_su_y_granularity_cap;
1111 uint8_t force_psrsu_cap;
1114 struct dprx_states {
1115 bool cable_id_written;
1118 enum dpcd_downstream_port_max_bpc {
1119 DOWN_STREAM_MAX_8BPC = 0,
1120 DOWN_STREAM_MAX_10BPC,
1121 DOWN_STREAM_MAX_12BPC,
1122 DOWN_STREAM_MAX_16BPC
1125 enum link_training_offset {
1127 LTTPR_PHY_REPEATER1 = 1,
1128 LTTPR_PHY_REPEATER2 = 2,
1129 LTTPR_PHY_REPEATER3 = 3,
1130 LTTPR_PHY_REPEATER4 = 4,
1131 LTTPR_PHY_REPEATER5 = 5,
1132 LTTPR_PHY_REPEATER6 = 6,
1133 LTTPR_PHY_REPEATER7 = 7,
1134 LTTPR_PHY_REPEATER8 = 8
1137 #define MAX_REPEATER_CNT 8
1139 struct dc_lttpr_caps {
1140 union dpcd_rev revision;
1142 uint8_t max_lane_count;
1143 uint8_t max_link_rate;
1144 uint8_t phy_repeater_cnt;
1145 uint8_t max_ext_timeout;
1146 union dp_main_link_channel_coding_lttpr_cap main_link_channel_coding;
1147 union dp_128b_132b_supported_lttpr_link_rates supported_128b_132b_rates;
1148 uint8_t aux_rd_interval[MAX_REPEATER_CNT - 1];
1151 struct dc_dongle_dfp_cap_ext {
1153 uint16_t max_pixel_rate_in_mps;
1154 uint16_t max_video_h_active_width;
1155 uint16_t max_video_v_active_height;
1156 struct dp_encoding_format_caps encoding_format_caps;
1157 struct dp_color_depth_caps rgb_color_depth_caps;
1158 struct dp_color_depth_caps ycbcr444_color_depth_caps;
1159 struct dp_color_depth_caps ycbcr422_color_depth_caps;
1160 struct dp_color_depth_caps ycbcr420_color_depth_caps;
1163 struct dc_dongle_caps {
1164 /* dongle type (DP converter, CV smart dongle) */
1165 enum display_dongle_type dongle_type;
1166 bool extendedCapValid;
1167 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
1168 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
1169 bool is_dp_hdmi_s3d_converter;
1170 bool is_dp_hdmi_ycbcr422_pass_through;
1171 bool is_dp_hdmi_ycbcr420_pass_through;
1172 bool is_dp_hdmi_ycbcr422_converter;
1173 bool is_dp_hdmi_ycbcr420_converter;
1174 uint32_t dp_hdmi_max_bpc;
1175 uint32_t dp_hdmi_max_pixel_clk_in_khz;
1176 uint32_t dp_hdmi_frl_max_link_bw_in_kbps;
1177 struct dc_dongle_dfp_cap_ext dfp_cap_ext;
1181 union dpcd_rev dpcd_rev;
1182 union max_lane_count max_ln_count;
1183 union max_down_spread max_down_spread;
1184 union dprx_feature dprx_feature;
1186 /* valid only for eDP v1.4 or higher*/
1187 uint8_t edp_supported_link_rates_count;
1188 enum dc_link_rate edp_supported_link_rates[8];
1190 /* dongle type (DP converter, CV smart dongle) */
1191 enum display_dongle_type dongle_type;
1192 bool is_dongle_type_one;
1193 /* branch device or sink device */
1195 /* Dongle's downstream count. */
1196 union sink_count sink_count;
1197 bool is_mst_capable;
1198 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
1199 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
1200 struct dc_dongle_caps dongle_caps;
1202 uint32_t sink_dev_id;
1203 int8_t sink_dev_id_str[6];
1204 int8_t sink_hw_revision;
1205 int8_t sink_fw_revision[2];
1207 uint32_t branch_dev_id;
1208 int8_t branch_dev_name[6];
1209 int8_t branch_hw_revision;
1210 int8_t branch_fw_revision[2];
1212 bool allow_invalid_MSA_timing_param;
1213 bool panel_mode_edp;
1214 bool dpcd_display_control_capable;
1215 bool ext_receiver_cap_field_present;
1216 bool set_power_state_capable_edp;
1217 bool dynamic_backlight_capable_edp;
1218 union dpcd_fec_capability fec_cap;
1219 struct dpcd_dsc_capabilities dsc_caps;
1220 struct dc_lttpr_caps lttpr_caps;
1221 struct adaptive_sync_caps adaptive_sync_caps;
1222 struct dpcd_usb4_dp_tunneling_info usb4_dp_tun_info;
1224 union dp_128b_132b_supported_link_rates dp_128b_132b_supported_link_rates;
1225 union dp_main_line_channel_coding_cap channel_coding_cap;
1226 union dp_sink_video_fallback_formats fallback_formats;
1227 union dp_fec_capability1 fec_cap1;
1228 union dp_cable_id cable_id;
1230 union edp_alpm_caps alpm_caps;
1231 struct edp_psr_info psr_info;
1234 union dpcd_sink_ext_caps {
1236 /* 0 - Sink supports backlight adjust via PWM during SDR/HDR mode
1237 * 1 - Sink supports backlight adjust via AUX during SDR/HDR mode.
1239 uint8_t sdr_aux_backlight_control : 1;
1240 uint8_t hdr_aux_backlight_control : 1;
1241 uint8_t reserved_1 : 2;
1243 uint8_t reserved_2 : 1;
1244 uint8_t miniled : 1;
1245 uint8_t reserved : 1;
1250 enum dc_link_fec_state {
1251 dc_link_fec_not_ready,
1256 union dpcd_psr_configuration {
1258 unsigned char ENABLE : 1;
1259 unsigned char TRANSMITTER_ACTIVE_IN_PSR : 1;
1260 unsigned char CRC_VERIFICATION : 1;
1261 unsigned char FRAME_CAPTURE_INDICATION : 1;
1262 /* For eDP 1.4, PSR v2*/
1263 unsigned char LINE_CAPTURE_INDICATION : 1;
1264 /* For eDP 1.4, PSR v2*/
1265 unsigned char IRQ_HPD_WITH_CRC_ERROR : 1;
1266 unsigned char ENABLE_PSR2 : 1;
1267 unsigned char EARLY_TRANSPORT_ENABLE : 1;
1272 union dpcd_alpm_configuration {
1274 unsigned char ENABLE : 1;
1275 unsigned char IRQ_HPD_ENABLE : 1;
1276 unsigned char RESERVED : 6;
1281 union dpcd_sink_active_vtotal_control_mode {
1283 unsigned char ENABLE : 1;
1284 unsigned char RESERVED : 7;
1289 union psr_error_status {
1291 unsigned char LINK_CRC_ERROR :1;
1292 unsigned char RFB_STORAGE_ERROR :1;
1293 unsigned char VSC_SDP_ERROR :1;
1294 unsigned char RESERVED :5;
1299 union psr_sink_psr_status {
1301 unsigned char SINK_SELF_REFRESH_STATUS :3;
1302 unsigned char RESERVED :5;
1307 struct edp_trace_power_timestamps {
1312 struct dp_trace_lt_counts {
1317 enum link_training_result {
1318 LINK_TRAINING_SUCCESS,
1319 LINK_TRAINING_CR_FAIL_LANE0,
1320 LINK_TRAINING_CR_FAIL_LANE1,
1321 LINK_TRAINING_CR_FAIL_LANE23,
1322 /* CR DONE bit is cleared during EQ step */
1323 LINK_TRAINING_EQ_FAIL_CR,
1324 /* CR DONE bit is cleared but LANE0_CR_DONE is set during EQ step */
1325 LINK_TRAINING_EQ_FAIL_CR_PARTIAL,
1326 /* other failure during EQ step */
1327 LINK_TRAINING_EQ_FAIL_EQ,
1328 LINK_TRAINING_LQA_FAIL,
1329 /* one of the CR,EQ or symbol lock is dropped */
1330 LINK_TRAINING_LINK_LOSS,
1331 /* Abort link training (because sink unplugged) */
1332 LINK_TRAINING_ABORT,
1333 DP_128b_132b_LT_FAILED,
1334 DP_128b_132b_MAX_LOOP_COUNT_REACHED,
1335 DP_128b_132b_CHANNEL_EQ_DONE_TIMEOUT,
1336 DP_128b_132b_CDS_DONE_TIMEOUT,
1339 struct dp_trace_lt {
1340 struct dp_trace_lt_counts counts;
1341 struct dp_trace_timestamps {
1342 unsigned long long start;
1343 unsigned long long end;
1345 enum link_training_result result;
1350 struct dp_trace_lt detect_lt_trace;
1351 struct dp_trace_lt commit_lt_trace;
1352 unsigned int link_loss_count;
1353 bool is_initialized;
1354 struct edp_trace_power_timestamps edp_trace_power_timestamps;
1357 /* TODO - This is a temporary location for any new DPCD definitions.
1358 * We should move these to drm_dp header.
1360 #ifndef DP_LINK_SQUARE_PATTERN
1361 #define DP_LINK_SQUARE_PATTERN 0x10F
1363 #ifndef DP_CABLE_ATTRIBUTES_UPDATED_BY_DPRX
1364 #define DP_CABLE_ATTRIBUTES_UPDATED_BY_DPRX 0x2217
1366 #ifndef DP_CABLE_ATTRIBUTES_UPDATED_BY_DPTX
1367 #define DP_CABLE_ATTRIBUTES_UPDATED_BY_DPTX 0x110
1369 #ifndef DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE
1370 #define DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE 0x50
1372 #ifndef DP_TUNNELING_IRQ
1373 #define DP_TUNNELING_IRQ (1 << 5)
1375 /** USB4 DPCD BW Allocation Registers Chapter 10.7 **/
1376 #ifndef DP_TUNNELING_CAPABILITIES
1377 #define DP_TUNNELING_CAPABILITIES 0xE000D /* 1.4a */
1379 #ifndef USB4_DRIVER_ID
1380 #define USB4_DRIVER_ID 0xE000F /* 1.4a */
1382 #ifndef USB4_DRIVER_BW_CAPABILITY
1383 #define USB4_DRIVER_BW_CAPABILITY 0xE0020 /* 1.4a */
1385 #ifndef DP_IN_ADAPTER_TUNNEL_INFO
1386 #define DP_IN_ADAPTER_TUNNEL_INFO 0xE0021 /* 1.4a */
1388 #ifndef DP_BW_GRANULALITY
1389 #define DP_BW_GRANULALITY 0xE0022 /* 1.4a */
1391 #ifndef ESTIMATED_BW
1392 #define ESTIMATED_BW 0xE0023 /* 1.4a */
1394 #ifndef ALLOCATED_BW
1395 #define ALLOCATED_BW 0xE0024 /* 1.4a */
1397 #ifndef DP_TUNNELING_STATUS
1398 #define DP_TUNNELING_STATUS 0xE0025 /* 1.4a */
1400 #ifndef DPTX_BW_ALLOCATION_MODE_CONTROL
1401 #define DPTX_BW_ALLOCATION_MODE_CONTROL 0xE0030 /* 1.4a */
1403 #ifndef REQUESTED_BW
1404 #define REQUESTED_BW 0xE0031 /* 1.4a */
1406 #endif /* DC_DP_TYPES_H */