2 * Copyright 2017 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.
26 * Created on: Oct 6, 2015
30 #ifndef LINK_ENCODER_H_
31 #define LINK_ENCODER_H_
33 #include "grph_object_defs.h"
34 #include "signal_types.h"
38 struct encoder_set_dp_phy_pattern_param;
39 struct link_mst_stream_allocation_table;
40 struct dc_link_settings;
41 struct link_training_settings;
44 struct encoder_init_data {
45 enum channel_id channel;
46 struct graphics_object_id connector;
47 enum hpd_source_id hpd_source;
48 /* TODO: in DAL2, here was pointer to EventManagerInterface */
49 struct graphics_object_id encoder;
50 struct dc_context *ctx;
51 enum transmitter transmitter;
54 struct encoder_feature_support {
57 uint32_t IS_HBR2_CAPABLE:1;
58 uint32_t IS_HBR3_CAPABLE:1;
59 uint32_t IS_TPS3_CAPABLE:1;
60 uint32_t IS_TPS4_CAPABLE:1;
61 uint32_t HDMI_6GB_EN:1;
66 enum dc_color_depth max_hdmi_deep_color;
67 unsigned int max_hdmi_pixel_clock;
68 bool ycbcr420_supported;
71 union dpcd_psr_configuration {
73 unsigned char ENABLE : 1;
74 unsigned char TRANSMITTER_ACTIVE_IN_PSR : 1;
75 unsigned char CRC_VERIFICATION : 1;
76 unsigned char FRAME_CAPTURE_INDICATION : 1;
77 /* For eDP 1.4, PSR v2*/
78 unsigned char LINE_CAPTURE_INDICATION : 1;
79 /* For eDP 1.4, PSR v2*/
80 unsigned char IRQ_HPD_WITH_CRC_ERROR : 1;
81 unsigned char RESERVED : 2;
86 union psr_error_status {
88 unsigned char LINK_CRC_ERROR :1;
89 unsigned char RFB_STORAGE_ERROR :1;
90 unsigned char RESERVED :6;
95 union psr_sink_psr_status {
97 unsigned char SINK_SELF_REFRESH_STATUS :3;
98 unsigned char RESERVED :5;
103 struct link_encoder {
104 const struct link_encoder_funcs *funcs;
105 int32_t aux_channel_offset;
106 struct dc_context *ctx;
107 struct graphics_object_id id;
108 struct graphics_object_id connector;
109 uint32_t output_signals;
110 enum engine_id preferred_engine;
111 struct encoder_feature_support features;
112 enum transmitter transmitter;
113 enum hpd_source_id hpd_source;
116 struct link_encoder_funcs {
117 bool (*validate_output_with_stream)(
118 struct link_encoder *enc, const struct dc_stream_state *stream);
119 void (*hw_init)(struct link_encoder *enc);
120 void (*setup)(struct link_encoder *enc,
121 enum signal_type signal);
122 void (*enable_tmds_output)(struct link_encoder *enc,
123 enum clock_source_id clock_source,
124 enum dc_color_depth color_depth,
125 enum signal_type signal,
126 uint32_t pixel_clock);
127 void (*enable_dp_output)(struct link_encoder *enc,
128 const struct dc_link_settings *link_settings,
129 enum clock_source_id clock_source);
130 void (*enable_dp_mst_output)(struct link_encoder *enc,
131 const struct dc_link_settings *link_settings,
132 enum clock_source_id clock_source);
133 void (*enable_lvds_output)(struct link_encoder *enc,
134 enum clock_source_id clock_source,
135 uint32_t pixel_clock);
136 void (*disable_output)(struct link_encoder *link_enc,
137 enum signal_type signal);
138 void (*dp_set_lane_settings)(struct link_encoder *enc,
139 const struct link_training_settings *link_settings);
140 void (*dp_set_phy_pattern)(struct link_encoder *enc,
141 const struct encoder_set_dp_phy_pattern_param *para);
142 void (*update_mst_stream_allocation_table)(
143 struct link_encoder *enc,
144 const struct link_mst_stream_allocation_table *table);
145 void (*psr_program_dp_dphy_fast_training)(struct link_encoder *enc,
146 bool exit_link_training_required);
147 void (*psr_program_secondary_packet)(struct link_encoder *enc,
148 unsigned int sdp_transmit_line_num_deadline);
149 void (*connect_dig_be_to_fe)(struct link_encoder *enc,
150 enum engine_id engine,
152 void (*enable_hpd)(struct link_encoder *enc);
153 void (*disable_hpd)(struct link_encoder *enc);
154 bool (*is_dig_enabled)(struct link_encoder *enc);
155 void (*destroy)(struct link_encoder **enc);
158 #endif /* LINK_ENCODER_H_ */