0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef __DC_TIMING_GENERATOR_DCE110_H__
0027 #define __DC_TIMING_GENERATOR_DCE110_H__
0028
0029 #include "timing_generator.h"
0030 #include "../include/grph_object_id.h"
0031
0032
0033
0034
0035
0036 #define VFLIP_READY_DELAY 4
0037
0038
0039 #define HFLIP_READY_DELAY 2
0040
0041 #define HFLIP_CHECK_DELAY 6
0042
0043 #define FLIP_READY_BACK_LOOKUP 3
0044
0045
0046
0047 enum trigger_source_select {
0048 TRIGGER_SOURCE_SELECT_LOGIC_ZERO = 0,
0049 TRIGGER_SOURCE_SELECT_CRTC_VSYNCA = 1,
0050 TRIGGER_SOURCE_SELECT_CRTC_HSYNCA = 2,
0051 TRIGGER_SOURCE_SELECT_CRTC_VSYNCB = 3,
0052 TRIGGER_SOURCE_SELECT_CRTC_HSYNCB = 4,
0053 TRIGGER_SOURCE_SELECT_GENERICF = 5,
0054 TRIGGER_SOURCE_SELECT_GENERICE = 6,
0055 TRIGGER_SOURCE_SELECT_VSYNCA = 7,
0056 TRIGGER_SOURCE_SELECT_HSYNCA = 8,
0057 TRIGGER_SOURCE_SELECT_VSYNCB = 9,
0058 TRIGGER_SOURCE_SELECT_HSYNCB = 10,
0059 TRIGGER_SOURCE_SELECT_HPD1 = 11,
0060 TRIGGER_SOURCE_SELECT_HPD2 = 12,
0061 TRIGGER_SOURCE_SELECT_GENERICD = 13,
0062 TRIGGER_SOURCE_SELECT_GENERICC = 14,
0063 TRIGGER_SOURCE_SELECT_VIDEO_CAPTURE = 15,
0064 TRIGGER_SOURCE_SELECT_GSL_GROUP0 = 16,
0065 TRIGGER_SOURCE_SELECT_GSL_GROUP1 = 17,
0066 TRIGGER_SOURCE_SELECT_GSL_GROUP2 = 18,
0067 TRIGGER_SOURCE_SELECT_BLONY = 19,
0068 TRIGGER_SOURCE_SELECT_GENERICA = 20,
0069 TRIGGER_SOURCE_SELECT_GENERICB = 21,
0070 TRIGGER_SOURCE_SELECT_GSL_ALLOW_FLIP = 22,
0071 TRIGGER_SOURCE_SELECT_MANUAL_TRIGGER = 23
0072 };
0073
0074
0075
0076 enum trigger_polarity_select {
0077 TRIGGER_POLARITY_SELECT_LOGIC_ZERO = 0,
0078 TRIGGER_POLARITY_SELECT_CRTC = 1,
0079 TRIGGER_POLARITY_SELECT_GENERICA = 2,
0080 TRIGGER_POLARITY_SELECT_GENERICB = 3,
0081 TRIGGER_POLARITY_SELECT_HSYNCA = 4,
0082 TRIGGER_POLARITY_SELECT_HSYNCB = 5,
0083 TRIGGER_POLARITY_SELECT_VIDEO_CAPTURE = 6,
0084 TRIGGER_POLARITY_SELECT_GENERICC = 7
0085 };
0086
0087
0088 struct dce110_timing_generator_offsets {
0089 int32_t crtc;
0090 int32_t dcp;
0091
0092
0093 int32_t dmif;
0094 };
0095
0096 struct dce110_timing_generator {
0097 struct timing_generator base;
0098 struct dce110_timing_generator_offsets offsets;
0099 struct dce110_timing_generator_offsets derived_offsets;
0100
0101 enum controller_id controller_id;
0102
0103 uint32_t max_h_total;
0104 uint32_t max_v_total;
0105
0106 uint32_t min_h_blank;
0107 uint32_t min_h_front_porch;
0108 uint32_t min_h_back_porch;
0109
0110
0111 uint32_t min_h_sync_width;
0112 uint32_t min_v_sync_width;
0113 uint32_t min_v_blank;
0114
0115 };
0116
0117 #define DCE110TG_FROM_TG(tg)\
0118 container_of(tg, struct dce110_timing_generator, base)
0119
0120 void dce110_timing_generator_construct(
0121 struct dce110_timing_generator *tg,
0122 struct dc_context *ctx,
0123 uint32_t instance,
0124 const struct dce110_timing_generator_offsets *offsets);
0125
0126
0127 bool dce110_timing_generator_validate_timing(
0128 struct timing_generator *tg,
0129 const struct dc_crtc_timing *timing,
0130 enum signal_type signal);
0131
0132
0133
0134
0135 bool dce110_timing_generator_program_timing_generator(
0136 struct timing_generator *tg,
0137 const struct dc_crtc_timing *dc_crtc_timing);
0138
0139
0140 bool dce110_timing_generator_enable_crtc(struct timing_generator *tg);
0141 bool dce110_timing_generator_disable_crtc(struct timing_generator *tg);
0142
0143 void dce110_timing_generator_set_early_control(
0144 struct timing_generator *tg,
0145 uint32_t early_cntl);
0146
0147
0148
0149
0150 uint32_t dce110_timing_generator_get_vblank_counter(
0151 struct timing_generator *tg);
0152
0153 void dce110_timing_generator_get_position(
0154 struct timing_generator *tg,
0155 struct crtc_position *position);
0156
0157
0158 bool dce110_timing_generator_is_counter_moving(struct timing_generator *tg);
0159
0160
0161 void dce110_timing_generator_wait_for_vblank(struct timing_generator *tg);
0162
0163
0164 void dce110_timing_generator_wait_for_vactive(struct timing_generator *tg);
0165
0166
0167
0168
0169 void dce110_timing_generator_setup_global_swap_lock(
0170 struct timing_generator *tg,
0171 const struct dcp_gsl_params *gsl_params);
0172
0173
0174 void dce110_timing_generator_tear_down_global_swap_lock(
0175 struct timing_generator *tg);
0176
0177
0178 void dce110_timing_generator_enable_crtc_reset(
0179 struct timing_generator *tg,
0180 int source,
0181 struct crtc_trigger_info *crtc_tp);
0182
0183
0184 void dce110_timing_generator_enable_reset_trigger(
0185 struct timing_generator *tg,
0186 int source);
0187
0188
0189 void dce110_timing_generator_disable_reset_trigger(
0190 struct timing_generator *tg);
0191
0192
0193 bool dce110_timing_generator_did_triggered_reset_occur(
0194 struct timing_generator *tg);
0195
0196
0197
0198 void dce110_timing_generator_disable_vga(struct timing_generator *tg);
0199
0200
0201 void dce110_timing_generator_program_blanking(
0202 struct timing_generator *tg,
0203 const struct dc_crtc_timing *timing);
0204
0205
0206
0207 void dce110_timing_generator_program_blank_color(
0208 struct timing_generator *tg,
0209 const struct tg_color *black_color);
0210
0211 void dce110_timing_generator_set_overscan_color_black(
0212 struct timing_generator *tg,
0213 const struct tg_color *color);
0214 void dce110_timing_generator_color_space_to_black_color(
0215 enum dc_color_space colorspace,
0216 struct tg_color *black_color);
0217
0218
0219
0220 void dce110_timing_generator_set_test_pattern(
0221 struct timing_generator *tg,
0222
0223
0224
0225 enum controller_dp_test_pattern test_pattern,
0226 enum dc_color_depth color_depth);
0227
0228 void dce110_timing_generator_set_drr(
0229 struct timing_generator *tg,
0230 const struct drr_params *params);
0231
0232 void dce110_timing_generator_set_static_screen_control(
0233 struct timing_generator *tg,
0234 uint32_t event_triggers,
0235 uint32_t num_frames);
0236
0237 void dce110_timing_generator_get_crtc_scanoutpos(
0238 struct timing_generator *tg,
0239 uint32_t *v_blank_start,
0240 uint32_t *v_blank_end,
0241 uint32_t *h_position,
0242 uint32_t *v_position);
0243
0244 void dce110_timing_generator_enable_advanced_request(
0245 struct timing_generator *tg,
0246 bool enable,
0247 const struct dc_crtc_timing *timing);
0248
0249 void dce110_timing_generator_set_lock_master(struct timing_generator *tg,
0250 bool lock);
0251
0252 void dce110_tg_program_blank_color(struct timing_generator *tg,
0253 const struct tg_color *black_color);
0254
0255 void dce110_tg_set_overscan_color(struct timing_generator *tg,
0256 const struct tg_color *overscan_color);
0257
0258 void dce110_tg_program_timing(struct timing_generator *tg,
0259 const struct dc_crtc_timing *timing,
0260 int vready_offset,
0261 int vstartup_start,
0262 int vupdate_offset,
0263 int vupdate_width,
0264 const enum signal_type signal,
0265 bool use_vbios);
0266
0267 bool dce110_tg_is_blanked(struct timing_generator *tg);
0268
0269 void dce110_tg_set_blank(struct timing_generator *tg,
0270 bool enable_blanking);
0271
0272 bool dce110_tg_validate_timing(struct timing_generator *tg,
0273 const struct dc_crtc_timing *timing);
0274
0275 void dce110_tg_wait_for_state(struct timing_generator *tg,
0276 enum crtc_state state);
0277
0278 void dce110_tg_set_colors(struct timing_generator *tg,
0279 const struct tg_color *blank_color,
0280 const struct tg_color *overscan_color);
0281
0282 bool dce110_arm_vert_intr(
0283 struct timing_generator *tg, uint8_t width);
0284
0285 bool dce110_configure_crc(struct timing_generator *tg,
0286 const struct crc_params *params);
0287
0288 bool dce110_get_crc(struct timing_generator *tg,
0289 uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb);
0290
0291 #endif