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 #include "dm_services.h"
0026 #include "dcn20/dcn20_hubbub.h"
0027 #include "dcn201_hubbub.h"
0028 #include "reg_helper.h"
0029
0030 #define REG(reg)\
0031 hubbub1->regs->reg
0032
0033 #define DC_LOGGER \
0034 hubbub1->base.ctx->logger
0035
0036 #define CTX \
0037 hubbub1->base.ctx
0038
0039 #undef FN
0040 #define FN(reg_name, field_name) \
0041 hubbub1->shifts->field_name, hubbub1->masks->field_name
0042
0043 #define REG(reg)\
0044 hubbub1->regs->reg
0045
0046 #define CTX \
0047 hubbub1->base.ctx
0048
0049 #undef FN
0050 #define FN(reg_name, field_name) \
0051 hubbub1->shifts->field_name, hubbub1->masks->field_name
0052
0053 static bool hubbub201_program_watermarks(
0054 struct hubbub *hubbub,
0055 struct dcn_watermark_set *watermarks,
0056 unsigned int refclk_mhz,
0057 bool safe_to_lower)
0058 {
0059 struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub);
0060 bool wm_pending = false;
0061
0062 if (hubbub1_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
0063 wm_pending = true;
0064
0065 if (hubbub1_program_pstate_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
0066 wm_pending = true;
0067
0068 REG_SET(DCHUBBUB_ARB_SAT_LEVEL, 0,
0069 DCHUBBUB_ARB_SAT_LEVEL, 60 * refclk_mhz);
0070 REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
0071 DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 68);
0072
0073 hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
0074
0075 return wm_pending;
0076 }
0077
0078 static const struct hubbub_funcs hubbub201_funcs = {
0079 .update_dchub = hubbub2_update_dchub,
0080 .init_dchub_sys_ctx = NULL,
0081 .init_vm_ctx = NULL,
0082 .dcc_support_swizzle = hubbub2_dcc_support_swizzle,
0083 .dcc_support_pixel_format = hubbub2_dcc_support_pixel_format,
0084 .get_dcc_compression_cap = hubbub2_get_dcc_compression_cap,
0085 .wm_read_state = hubbub2_wm_read_state,
0086 .get_dchub_ref_freq = hubbub2_get_dchub_ref_freq,
0087 .program_watermarks = hubbub201_program_watermarks,
0088 .hubbub_read_state = hubbub2_read_state,
0089 };
0090
0091 void hubbub201_construct(struct dcn20_hubbub *hubbub,
0092 struct dc_context *ctx,
0093 const struct dcn_hubbub_registers *hubbub_regs,
0094 const struct dcn_hubbub_shift *hubbub_shift,
0095 const struct dcn_hubbub_mask *hubbub_mask)
0096 {
0097 hubbub->base.ctx = ctx;
0098
0099 hubbub->base.funcs = &hubbub201_funcs;
0100
0101 hubbub->regs = hubbub_regs;
0102 hubbub->shifts = hubbub_shift;
0103 hubbub->masks = hubbub_mask;
0104
0105 hubbub->debug_test_index_pstate = 0xB;
0106 hubbub->detile_buf_size = 164 * 1024;
0107 }