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 #include "dc_bios_types.h"
0027 #include "dcn30/dcn30_vpg.h"
0028 #include "dcn31_vpg.h"
0029 #include "reg_helper.h"
0030 #include "dc/dc.h"
0031
0032 #define DC_LOGGER \
0033 vpg31->base.ctx->logger
0034
0035 #define REG(reg)\
0036 (vpg31->regs->reg)
0037
0038 #undef FN
0039 #define FN(reg_name, field_name) \
0040 vpg31->vpg_shift->field_name, vpg31->vpg_mask->field_name
0041
0042
0043 #define CTX \
0044 vpg31->base.ctx
0045
0046 static struct vpg_funcs dcn31_vpg_funcs = {
0047 .update_generic_info_packet = vpg3_update_generic_info_packet,
0048 .vpg_poweron = vpg31_poweron,
0049 .vpg_powerdown = vpg31_powerdown,
0050 };
0051
0052 void vpg31_powerdown(struct vpg *vpg)
0053 {
0054 struct dcn31_vpg *vpg31 = DCN31_VPG_FROM_VPG(vpg);
0055
0056 if (vpg->ctx->dc->debug.enable_mem_low_power.bits.vpg == false)
0057 return;
0058
0059 REG_UPDATE_2(VPG_MEM_PWR, VPG_GSP_MEM_LIGHT_SLEEP_DIS, 0, VPG_GSP_LIGHT_SLEEP_FORCE, 1);
0060 }
0061
0062 void vpg31_poweron(struct vpg *vpg)
0063 {
0064 struct dcn31_vpg *vpg31 = DCN31_VPG_FROM_VPG(vpg);
0065
0066 if (vpg->ctx->dc->debug.enable_mem_low_power.bits.vpg == false)
0067 return;
0068
0069 REG_UPDATE_2(VPG_MEM_PWR, VPG_GSP_MEM_LIGHT_SLEEP_DIS, 1, VPG_GSP_LIGHT_SLEEP_FORCE, 0);
0070 }
0071
0072 void vpg31_construct(struct dcn31_vpg *vpg31,
0073 struct dc_context *ctx,
0074 uint32_t inst,
0075 const struct dcn31_vpg_registers *vpg_regs,
0076 const struct dcn31_vpg_shift *vpg_shift,
0077 const struct dcn31_vpg_mask *vpg_mask)
0078 {
0079 vpg31->base.ctx = ctx;
0080
0081 vpg31->base.inst = inst;
0082 vpg31->base.funcs = &dcn31_vpg_funcs;
0083
0084 vpg31->regs = vpg_regs;
0085 vpg31->vpg_shift = vpg_shift;
0086 vpg31->vpg_mask = vpg_mask;
0087 }