aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0081-drm-amd-powerplay-refine-the-logic-of-whether-need-t.patch
blob: 08dbb4866d7e99e9167923cf87df296eb5b54137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 5b1f18ef440591637603496b299e942278ca17b3 Mon Sep 17 00:00:00 2001
From: Rex Zhu <Rex.Zhu@amd.com>
Date: Wed, 4 Nov 2015 14:56:56 +0800
Subject: [PATCH 0081/1110] drm/amd/powerplay: refine the logic of whether need
 to update power state.

Better handle power state changes.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
---
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.c | 13 ++++++++++---
 drivers/gpu/drm/amd/powerplay/eventmgr/psm.h |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c b/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c
index 08b75bd..82774ac 100644
--- a/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c
+++ b/drivers/gpu/drm/amd/powerplay/eventmgr/psm.c
@@ -86,9 +86,10 @@ int psm_set_performance_states(struct pp_eventmgr *eventmgr, unsigned long *stat
 int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
 {
 
-	const struct pp_power_state  *pcurrent;
-	struct pp_power_state  *requested;
+	struct pp_power_state *pcurrent;
+	struct pp_power_state *requested;
 	struct pp_hwmgr *hwmgr;
+	bool equal;
 
 	if (skip)
 		return 0;
@@ -97,7 +98,13 @@ int psm_adjust_power_state_dynamic(struct pp_eventmgr *eventmgr, bool skip)
 	pcurrent = hwmgr->current_ps;
 	requested = hwmgr->request_ps;
 
-	if ((pcurrent != NULL || requested != NULL) && (pcurrent != requested)) {
+	if (requested == NULL)
+		return 0;
+
+	if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr, &pcurrent->hardware, &requested->hardware, &equal)))
+		equal = false;
+
+	if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {
 		phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);
 		phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);
 		hwmgr->current_ps = requested;
diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/psm.h b/drivers/gpu/drm/amd/powerplay/eventmgr/psm.h
index 15abfac..1380470 100644
--- a/drivers/gpu/drm/amd/powerplay/eventmgr/psm.h
+++ b/drivers/gpu/drm/amd/powerplay/eventmgr/psm.h
@@ -25,6 +25,7 @@
 #include "eventmanagement.h"
 #include "eventmanager.h"
 #include "power_state.h"
+#include "hardwaremanager.h"
 
 int psm_get_ui_state(struct pp_eventmgr *eventmgr, enum PP_StateUILabel ui_label, unsigned long *state_id);
 
-- 
2.7.4