aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorTom St Denis <tom.stdenis@amd.com>2016-08-03 10:15:24 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-08-08 11:33:14 -0400
commit6f906814a5a8045874910f9c21c3ffd758a22f65 (patch)
tree1003b781960e009ca4e9a9bfa0ff23dbe2e0075e /drivers/gpu/drm/amd/amdgpu
parentf16fe6d303855b609618d5db8705a8ee4634e4bf (diff)
drm/amd/amdgpu: Fix VCE CG order and resume defaults
CG was being enabled in reverse sense from dpm/powerplay. Also fix the default CLK_EN signal to enable all of the blocks. Signed-off-by: Tom St Denis <tom.stdenis@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v3_0.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 26fb606e2d3e..a9db5cbb622d 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
@@ -130,40 +130,35 @@ static void vce_v3_0_set_vce_sw_clock_gating(struct amdgpu_device *adev,
130 /* Set Override to disable Clock Gating */ 130 /* Set Override to disable Clock Gating */
131 vce_v3_0_override_vce_clock_gating(adev, true); 131 vce_v3_0_override_vce_clock_gating(adev, true);
132 132
133 if (!gated) { 133 /* This function enables MGCG which is controlled by firmware.
134 /* Force CLOCK ON for VCE_CLOCK_GATING_B, 134 With the clocks in the gated state the core is still
135 * {*_FORCE_ON, *_FORCE_OFF} = {1, 0} 135 accessible but the firmware will throttle the clocks on the
136 * VREG can be FORCE ON or set to Dynamic, but can't be OFF 136 fly as necessary.
137 */ 137 */
138 if (gated) {
138 tmp = data = RREG32(mmVCE_CLOCK_GATING_B); 139 tmp = data = RREG32(mmVCE_CLOCK_GATING_B);
139 data |= 0x1ff; 140 data |= 0x1ff;
140 data &= ~0xef0000; 141 data &= ~0xef0000;
141 if (tmp != data) 142 if (tmp != data)
142 WREG32(mmVCE_CLOCK_GATING_B, data); 143 WREG32(mmVCE_CLOCK_GATING_B, data);
143 144
144 /* Force CLOCK ON for VCE_UENC_CLOCK_GATING,
145 * {*_FORCE_ON, *_FORCE_OFF} = {1, 0}
146 */
147 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING); 145 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING);
148 data |= 0x3ff000; 146 data |= 0x3ff000;
149 data &= ~0xffc00000; 147 data &= ~0xffc00000;
150 if (tmp != data) 148 if (tmp != data)
151 WREG32(mmVCE_UENC_CLOCK_GATING, data); 149 WREG32(mmVCE_UENC_CLOCK_GATING, data);
152 150
153 /* set VCE_UENC_CLOCK_GATING_2 */
154 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING_2); 151 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING_2);
155 data |= 0x2; 152 data |= 0x2;
156 data &= ~0x2; 153 data &= ~0x00010000;
157 if (tmp != data) 154 if (tmp != data)
158 WREG32(mmVCE_UENC_CLOCK_GATING_2, data); 155 WREG32(mmVCE_UENC_CLOCK_GATING_2, data);
159 156
160 /* Force CLOCK ON for VCE_UENC_REG_CLOCK_GATING */
161 tmp = data = RREG32(mmVCE_UENC_REG_CLOCK_GATING); 157 tmp = data = RREG32(mmVCE_UENC_REG_CLOCK_GATING);
162 data |= 0x37f; 158 data |= 0x37f;
163 if (tmp != data) 159 if (tmp != data)
164 WREG32(mmVCE_UENC_REG_CLOCK_GATING, data); 160 WREG32(mmVCE_UENC_REG_CLOCK_GATING, data);
165 161
166 /* Force VCE_UENC_DMA_DCLK_CTRL Clock ON */
167 tmp = data = RREG32(mmVCE_UENC_DMA_DCLK_CTRL); 162 tmp = data = RREG32(mmVCE_UENC_DMA_DCLK_CTRL);
168 data |= VCE_UENC_DMA_DCLK_CTRL__WRDMCLK_FORCEON_MASK | 163 data |= VCE_UENC_DMA_DCLK_CTRL__WRDMCLK_FORCEON_MASK |
169 VCE_UENC_DMA_DCLK_CTRL__RDDMCLK_FORCEON_MASK | 164 VCE_UENC_DMA_DCLK_CTRL__RDDMCLK_FORCEON_MASK |
@@ -172,34 +167,27 @@ static void vce_v3_0_set_vce_sw_clock_gating(struct amdgpu_device *adev,
172 if (tmp != data) 167 if (tmp != data)
173 WREG32(mmVCE_UENC_DMA_DCLK_CTRL, data); 168 WREG32(mmVCE_UENC_DMA_DCLK_CTRL, data);
174 } else { 169 } else {
175 /* Force CLOCK OFF for VCE_CLOCK_GATING_B,
176 * {*, *_FORCE_OFF} = {*, 1}
177 * set VREG to Dynamic, as it can't be OFF
178 */
179 tmp = data = RREG32(mmVCE_CLOCK_GATING_B); 170 tmp = data = RREG32(mmVCE_CLOCK_GATING_B);
180 data &= ~0x80010; 171 data &= ~0x80010;
181 data |= 0xe70008; 172 data |= 0xe70008;
182 if (tmp != data) 173 if (tmp != data)
183 WREG32(mmVCE_CLOCK_GATING_B, data); 174 WREG32(mmVCE_CLOCK_GATING_B, data);
184 /* Force CLOCK OFF for VCE_UENC_CLOCK_GATING, 175
185 * Force ClOCK OFF takes precedent over Force CLOCK ON setting.
186 * {*_FORCE_ON, *_FORCE_OFF} = {*, 1}
187 */
188 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING); 176 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING);
189 data |= 0xffc00000; 177 data |= 0xffc00000;
190 if (tmp != data) 178 if (tmp != data)
191 WREG32(mmVCE_UENC_CLOCK_GATING, data); 179 WREG32(mmVCE_UENC_CLOCK_GATING, data);
192 /* Set VCE_UENC_CLOCK_GATING_2 */ 180
193 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING_2); 181 tmp = data = RREG32(mmVCE_UENC_CLOCK_GATING_2);
194 data |= 0x10000; 182 data |= 0x10000;
195 if (tmp != data) 183 if (tmp != data)
196 WREG32(mmVCE_UENC_CLOCK_GATING_2, data); 184 WREG32(mmVCE_UENC_CLOCK_GATING_2, data);
197 /* Set VCE_UENC_REG_CLOCK_GATING to dynamic */ 185
198 tmp = data = RREG32(mmVCE_UENC_REG_CLOCK_GATING); 186 tmp = data = RREG32(mmVCE_UENC_REG_CLOCK_GATING);
199 data &= ~0xffc00000; 187 data &= ~0xffc00000;
200 if (tmp != data) 188 if (tmp != data)
201 WREG32(mmVCE_UENC_REG_CLOCK_GATING, data); 189 WREG32(mmVCE_UENC_REG_CLOCK_GATING, data);
202 /* Set VCE_UENC_DMA_DCLK_CTRL CG always in dynamic mode */ 190
203 tmp = data = RREG32(mmVCE_UENC_DMA_DCLK_CTRL); 191 tmp = data = RREG32(mmVCE_UENC_DMA_DCLK_CTRL);
204 data &= ~(VCE_UENC_DMA_DCLK_CTRL__WRDMCLK_FORCEON_MASK | 192 data &= ~(VCE_UENC_DMA_DCLK_CTRL__WRDMCLK_FORCEON_MASK |
205 VCE_UENC_DMA_DCLK_CTRL__RDDMCLK_FORCEON_MASK | 193 VCE_UENC_DMA_DCLK_CTRL__RDDMCLK_FORCEON_MASK |
@@ -538,7 +526,7 @@ static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx)
538 WREG32_P(mmVCE_CLOCK_GATING_A, 0, ~(1 << 16)); 526 WREG32_P(mmVCE_CLOCK_GATING_A, 0, ~(1 << 16));
539 WREG32_P(mmVCE_UENC_CLOCK_GATING, 0x1FF000, ~0xFF9FF000); 527 WREG32_P(mmVCE_UENC_CLOCK_GATING, 0x1FF000, ~0xFF9FF000);
540 WREG32_P(mmVCE_UENC_REG_CLOCK_GATING, 0x3F, ~0x3F); 528 WREG32_P(mmVCE_UENC_REG_CLOCK_GATING, 0x3F, ~0x3F);
541 WREG32(mmVCE_CLOCK_GATING_B, 0xf7); 529 WREG32(mmVCE_CLOCK_GATING_B, 0x1FF);
542 530
543 WREG32(mmVCE_LMI_CTRL, 0x00398000); 531 WREG32(mmVCE_LMI_CTRL, 0x00398000);
544 WREG32_P(mmVCE_LMI_CACHE_CTRL, 0x0, ~0x1); 532 WREG32_P(mmVCE_LMI_CACHE_CTRL, 0x0, ~0x1);