aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/3257-drm-amd-display-fix-backlight-not-off-at-resume-from.patch
blob: e1ff074bac0d40ceef4be9839c7ed1f7120d722a (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 175d8b1b5391be3686d218d400c37af79b202a18 Mon Sep 17 00:00:00 2001
From: Charlene Liu <charlene.liu@amd.com>
Date: Mon, 8 Jan 2018 16:47:39 -0500
Subject: [PATCH 3257/4131] drm/amd/display: fix backlight not off at resume
 from S4

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 33 ++++++++++++++++++----
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index d036d1d..f982f23 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -914,6 +914,7 @@ void hwss_edp_backlight_control(
 	/*todo: unhardcode*/
 	cntl.lanes_number = LANE_COUNT_FOUR;
 	cntl.hpd_sel = link->link_enc->hpd_source;
+	cntl.signal = SIGNAL_TYPE_EDP;
 
 	/* For eDP, the following delays might need to be considered
 	 * after link training completed:
@@ -1407,7 +1408,24 @@ static void disable_vga_and_power_gate_all_controllers(
 	}
 }
 
-static struct dc_link *get_link_for_eDP_not_in_use(
+static struct dc_link *get_link_for_edp(
+		struct dc *dc)
+{
+	int i;
+	struct dc_link *link = NULL;
+
+	/* check if there is an eDP panel not in use */
+	for (i = 0; i < dc->link_count; i++) {
+		if (dc->links[i]->local_sink &&
+			dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) {
+			link = dc->links[i];
+			break;
+		}
+	}
+
+	return link;
+}
+static struct dc_link *get_link_for_edp_not_in_use(
 		struct dc *dc,
 		struct dc_state *context)
 {
@@ -1441,16 +1459,19 @@ static struct dc_link *get_link_for_eDP_not_in_use(
  */
 void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 {
-	struct dc_link *eDP_link_to_turnoff = get_link_for_eDP_not_in_use(dc, context);
+	struct dc_link *edp_link_to_turnoff = get_link_for_edp_not_in_use(dc, context);
+
+	struct dc_link *edp_link = get_link_for_edp(dc);
 
-	if (eDP_link_to_turnoff)
-		dc->hwss.edp_backlight_control(eDP_link_to_turnoff, false);
+	if (edp_link)
+		/*we need turn off backlight before DP_blank and encoder powered down*/
+		dc->hwss.edp_backlight_control(edp_link, false);
 
 	power_down_all_hw_blocks(dc);
 	disable_vga_and_power_gate_all_controllers(dc);
 
-	if (eDP_link_to_turnoff)
-		dc->hwss.edp_power_control(eDP_link_to_turnoff, false);
+	if (edp_link_to_turnoff)
+		dc->hwss.edp_power_control(edp_link_to_turnoff, false);
 
 	bios_set_scratch_acc_mode_change(dc->ctx->dc_bios);
 }
-- 
2.7.4