aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2016-06-01 12:42:35 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-07-07 14:51:00 -0400
commit8d45f80ed08b1909988f38c094e5ace6d879ca10 (patch)
tree01f6ed2502ae1521e77bddf09dfc8f32e94f0270 /drivers/gpu/drm/amd/amdgpu
parent5c614792474bf80b87d6cd915d9db14406c9c779 (diff)
drm/amdgpu: clean up atpx power control handling
The presence of the power control method should be determined via the presence of the method in function 0. However, some sbioses only set the appropriate bits in function 1 so use then to override a missing power control function. Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Acked-by: Christian König <christian.koenig@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/amdgpu_atpx_handler.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
index 3af1c3aceab3..1be2ce46921b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
@@ -142,18 +142,12 @@ static void amdgpu_atpx_parse_functions(struct amdgpu_atpx_functions *f, u32 mas
142 */ 142 */
143static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx) 143static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
144{ 144{
145 /* make sure required functions are enabled */ 145 u32 valid_bits = 0;
146 /* dGPU power control is required */
147 if (atpx->functions.power_cntl == false) {
148 printk("ATPX dGPU power cntl not present, forcing\n");
149 atpx->functions.power_cntl = true;
150 }
151 146
152 if (atpx->functions.px_params) { 147 if (atpx->functions.px_params) {
153 union acpi_object *info; 148 union acpi_object *info;
154 struct atpx_px_params output; 149 struct atpx_px_params output;
155 size_t size; 150 size_t size;
156 u32 valid_bits;
157 151
158 info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL); 152 info = amdgpu_atpx_call(atpx->handle, ATPX_FUNCTION_GET_PX_PARAMETERS, NULL);
159 if (!info) 153 if (!info)
@@ -172,24 +166,37 @@ static int amdgpu_atpx_validate(struct amdgpu_atpx *atpx)
172 memcpy(&output, info->buffer.pointer, size); 166 memcpy(&output, info->buffer.pointer, size);
173 167
174 valid_bits = output.flags & output.valid_flags; 168 valid_bits = output.flags & output.valid_flags;
175 /* if separate mux flag is set, mux controls are required */
176 if (valid_bits & ATPX_SEPARATE_MUX_FOR_I2C) {
177 atpx->functions.i2c_mux_cntl = true;
178 atpx->functions.disp_mux_cntl = true;
179 }
180 /* if any outputs are muxed, mux controls are required */
181 if (valid_bits & (ATPX_CRT1_RGB_SIGNAL_MUXED |
182 ATPX_TV_SIGNAL_MUXED |
183 ATPX_DFP_SIGNAL_MUXED))
184 atpx->functions.disp_mux_cntl = true;
185
186 if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
187 printk("Hybrid Graphics, ATPX dGPU power cntl disabled\n");
188 atpx->functions.power_cntl = false;
189 }
190 169
191 kfree(info); 170 kfree(info);
192 } 171 }
172
173 /* if separate mux flag is set, mux controls are required */
174 if (valid_bits & ATPX_SEPARATE_MUX_FOR_I2C) {
175 atpx->functions.i2c_mux_cntl = true;
176 atpx->functions.disp_mux_cntl = true;
177 }
178 /* if any outputs are muxed, mux controls are required */
179 if (valid_bits & (ATPX_CRT1_RGB_SIGNAL_MUXED |
180 ATPX_TV_SIGNAL_MUXED |
181 ATPX_DFP_SIGNAL_MUXED))
182 atpx->functions.disp_mux_cntl = true;
183
184
185 /* some bioses set these bits rather than flagging power_cntl as supported */
186 if (valid_bits & (ATPX_DYNAMIC_PX_SUPPORTED |
187 ATPX_DYNAMIC_DGPU_POWER_OFF_SUPPORTED))
188 atpx->functions.power_cntl = true;
189
190 if (valid_bits & ATPX_MS_HYBRID_GFX_SUPPORTED) {
191 printk("Hybrid Graphics, ATPX dGPU power cntl disabled\n");
192 atpx->functions.power_cntl = false;
193 } else if (atpx->functions.power_cntl == false) {
194 /* make sure required functions are enabled */
195 /* dGPU power control is required */
196 printk("ATPX dGPU power cntl not present, forcing\n");
197 atpx->functions.power_cntl = true;
198 }
199
193 return 0; 200 return 0;
194} 201}
195 202