1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30#ifndef LINK_ENCODER_H_
31#define LINK_ENCODER_H_
32
33#include "grph_object_defs.h"
34#include "signal_types.h"
35#include "dc_types.h"
36
37struct dc_context;
38struct encoder_set_dp_phy_pattern_param;
39struct link_mst_stream_allocation_table;
40struct dc_link_settings;
41struct link_training_settings;
42struct pipe_ctx;
43
44struct encoder_init_data {
45 enum channel_id channel;
46 struct graphics_object_id connector;
47 enum hpd_source_id hpd_source;
48
49 struct graphics_object_id encoder;
50 struct dc_context *ctx;
51 enum transmitter transmitter;
52};
53
54struct encoder_feature_support {
55 union {
56 struct {
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;
62 uint32_t DP_IS_USB_C:1;
63 } bits;
64 uint32_t raw;
65 } flags;
66
67 enum dc_color_depth max_hdmi_deep_color;
68 unsigned int max_hdmi_pixel_clock;
69 bool hdmi_ycbcr420_supported;
70 bool dp_ycbcr420_supported;
71};
72
73union dpcd_psr_configuration {
74 struct {
75 unsigned char ENABLE : 1;
76 unsigned char TRANSMITTER_ACTIVE_IN_PSR : 1;
77 unsigned char CRC_VERIFICATION : 1;
78 unsigned char FRAME_CAPTURE_INDICATION : 1;
79
80 unsigned char LINE_CAPTURE_INDICATION : 1;
81
82 unsigned char IRQ_HPD_WITH_CRC_ERROR : 1;
83 unsigned char RESERVED : 2;
84 } bits;
85 unsigned char raw;
86};
87
88union psr_error_status {
89 struct {
90 unsigned char LINK_CRC_ERROR :1;
91 unsigned char RFB_STORAGE_ERROR :1;
92 unsigned char RESERVED :6;
93 } bits;
94 unsigned char raw;
95};
96
97union psr_sink_psr_status {
98 struct {
99 unsigned char SINK_SELF_REFRESH_STATUS :3;
100 unsigned char RESERVED :5;
101 } bits;
102 unsigned char raw;
103};
104
105struct link_encoder {
106 const struct link_encoder_funcs *funcs;
107 int32_t aux_channel_offset;
108 struct dc_context *ctx;
109 struct graphics_object_id id;
110 struct graphics_object_id connector;
111 uint32_t output_signals;
112 enum engine_id preferred_engine;
113 struct encoder_feature_support features;
114 enum transmitter transmitter;
115 enum hpd_source_id hpd_source;
116 bool usbc_combo_phy;
117};
118
119struct link_enc_state {
120
121 uint32_t dphy_fec_en;
122 uint32_t dphy_fec_ready_shadow;
123 uint32_t dphy_fec_active_status;
124 uint32_t dp_link_training_complete;
125
126};
127
128struct link_encoder_funcs {
129 void (*read_state)(
130 struct link_encoder *enc, struct link_enc_state *s);
131 bool (*validate_output_with_stream)(
132 struct link_encoder *enc, const struct dc_stream_state *stream);
133 void (*hw_init)(struct link_encoder *enc);
134 void (*setup)(struct link_encoder *enc,
135 enum signal_type signal);
136 void (*enable_tmds_output)(struct link_encoder *enc,
137 enum clock_source_id clock_source,
138 enum dc_color_depth color_depth,
139 enum signal_type signal,
140 uint32_t pixel_clock);
141 void (*enable_dp_output)(struct link_encoder *enc,
142 const struct dc_link_settings *link_settings,
143 enum clock_source_id clock_source);
144 void (*enable_dp_mst_output)(struct link_encoder *enc,
145 const struct dc_link_settings *link_settings,
146 enum clock_source_id clock_source);
147 void (*enable_lvds_output)(struct link_encoder *enc,
148 enum clock_source_id clock_source,
149 uint32_t pixel_clock);
150 void (*disable_output)(struct link_encoder *link_enc,
151 enum signal_type signal);
152 void (*dp_set_lane_settings)(struct link_encoder *enc,
153 const struct link_training_settings *link_settings);
154 void (*dp_set_phy_pattern)(struct link_encoder *enc,
155 const struct encoder_set_dp_phy_pattern_param *para);
156 void (*update_mst_stream_allocation_table)(
157 struct link_encoder *enc,
158 const struct link_mst_stream_allocation_table *table);
159 void (*psr_program_dp_dphy_fast_training)(struct link_encoder *enc,
160 bool exit_link_training_required);
161 void (*psr_program_secondary_packet)(struct link_encoder *enc,
162 unsigned int sdp_transmit_line_num_deadline);
163 void (*connect_dig_be_to_fe)(struct link_encoder *enc,
164 enum engine_id engine,
165 bool connect);
166 void (*enable_hpd)(struct link_encoder *enc);
167 void (*disable_hpd)(struct link_encoder *enc);
168 bool (*is_dig_enabled)(struct link_encoder *enc);
169 unsigned int (*get_dig_frontend)(struct link_encoder *enc);
170 void (*destroy)(struct link_encoder **enc);
171
172 void (*fec_set_enable)(struct link_encoder *enc,
173 bool enable);
174
175 void (*fec_set_ready)(struct link_encoder *enc,
176 bool ready);
177
178 bool (*fec_is_active)(struct link_encoder *enc);
179 bool (*is_in_alt_mode) (struct link_encoder *enc);
180
181 void (*get_max_link_cap)(struct link_encoder *enc,
182 struct dc_link_settings *link_settings);
183
184 enum signal_type (*get_dig_mode)(
185 struct link_encoder *enc);
186};
187
188#endif
189