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 "dc.h"
0027 #include "core_types.h"
0028 #include "clk_mgr.h"
0029 #include "dce100_hw_sequencer.h"
0030 #include "resource.h"
0031
0032 #include "dce110/dce110_hw_sequencer.h"
0033
0034
0035 #include "dce/dce_10_0_d.h"
0036 #include "dce/dce_10_0_sh_mask.h"
0037
0038 struct dce100_hw_seq_reg_offsets {
0039 uint32_t blnd;
0040 uint32_t crtc;
0041 };
0042
0043 static const struct dce100_hw_seq_reg_offsets reg_offsets[] = {
0044 {
0045 .crtc = (mmCRTC0_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
0046 },
0047 {
0048 .crtc = (mmCRTC1_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
0049 },
0050 {
0051 .crtc = (mmCRTC2_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
0052 },
0053 {
0054 .crtc = (mmCRTC3_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
0055 },
0056 {
0057 .crtc = (mmCRTC4_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
0058 },
0059 {
0060 .crtc = (mmCRTC5_CRTC_GSL_CONTROL - mmCRTC_GSL_CONTROL),
0061 }
0062 };
0063
0064 #define HW_REG_CRTC(reg, id)\
0065 (reg + reg_offsets[id].crtc)
0066
0067
0068
0069
0070
0071
0072 bool dce100_enable_display_power_gating(
0073 struct dc *dc,
0074 uint8_t controller_id,
0075 struct dc_bios *dcb,
0076 enum pipe_gating_control power_gating)
0077 {
0078 enum bp_result bp_result = BP_RESULT_OK;
0079 enum bp_pipe_control_action cntl;
0080 struct dc_context *ctx = dc->ctx;
0081
0082 if (power_gating == PIPE_GATING_CONTROL_INIT)
0083 cntl = ASIC_PIPE_INIT;
0084 else if (power_gating == PIPE_GATING_CONTROL_ENABLE)
0085 cntl = ASIC_PIPE_ENABLE;
0086 else
0087 cntl = ASIC_PIPE_DISABLE;
0088
0089 if (!(power_gating == PIPE_GATING_CONTROL_INIT && controller_id != 0)){
0090
0091 bp_result = dcb->funcs->enable_disp_power_gating(
0092 dcb, controller_id + 1, cntl);
0093
0094
0095
0096
0097 dm_write_reg(ctx,
0098 HW_REG_CRTC(mmMASTER_UPDATE_MODE, controller_id),
0099 0);
0100 }
0101
0102 if (bp_result == BP_RESULT_OK)
0103 return true;
0104 else
0105 return false;
0106 }
0107
0108 void dce100_prepare_bandwidth(
0109 struct dc *dc,
0110 struct dc_state *context)
0111 {
0112 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
0113
0114 dc->clk_mgr->funcs->update_clocks(
0115 dc->clk_mgr,
0116 context,
0117 false);
0118 }
0119
0120 void dce100_optimize_bandwidth(
0121 struct dc *dc,
0122 struct dc_state *context)
0123 {
0124 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
0125
0126 dc->clk_mgr->funcs->update_clocks(
0127 dc->clk_mgr,
0128 context,
0129 true);
0130 }
0131
0132
0133
0134 void dce100_hw_sequencer_construct(struct dc *dc)
0135 {
0136 dce110_hw_sequencer_construct(dc);
0137
0138 dc->hwseq->funcs.enable_display_power_gating = dce100_enable_display_power_gating;
0139 dc->hwss.prepare_bandwidth = dce100_prepare_bandwidth;
0140 dc->hwss.optimize_bandwidth = dce100_optimize_bandwidth;
0141 }
0142