aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4216-drm-amd-display-Check-SCRATCH-reg-to-determine-S3-re.patch
blob: dea707bdcb478b3ca553896c3b19dacdbde155b8 (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
From f2d21896f604143f0ffef1bdb8d138d9e0f22642 Mon Sep 17 00:00:00 2001
From: Yongqiang Sun <yongqiang.sun@amd.com>
Date: Fri, 6 Apr 2018 21:38:10 -0400
Subject: [PATCH 4216/5725] drm/amd/display: Check SCRATCH reg to determine S3
 resume.

Use lid state only to determine fast boot optimization is not enough.
For S3/Resume, due to bios isn't involved in boot, eDP wasn't
light up, while lid state is open, if do fast boot optimization,
eDP panel will skip enable link and result in black screen after boot.
And becasue of bios isn't involved, no matter UEFI or Legacy boot,
BIOS_SCRATCH_3 value should be 0, use this to determine the case.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 33 ++++++++++++++++++----
 1 file changed, 28 insertions(+), 5 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 430d67b..3920310 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
@@ -1526,18 +1526,41 @@ static struct dc_link *get_link_for_edp_not_in_use(
  */
 void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 {
-	/* check eDP lid state:
-	 * If lid is open, vbios already light up eDP, so we can leverage vbios and skip eDP
-	 * programming
+	/* check eDP lid state and BIOS_SCRATCH_3 to determine fast boot optimization
+	 * UEFI boot
+	 *				edp_active_status_from_scratch		fast boot optimization
+	 * S4/S5 resume:
+	 * Lid Open		true								true
+	 * Lid Close	false								false
+	 *
+	 * S3/ resume:
+	 * Lid Open		false								false
+	 * Lid Close	false								false
+	 *
+	 * Legacy boot:
+	 *				edp_active_status_from_scratch		fast boot optimization
+	 * S4/S resume:
+	 * Lid Open		true								true
+	 * Lid Close	true								false
+	 *
+	 * S3/ resume:
+	 * Lid Open		false								false
+	 * Lid Close	false								false
 	 */
+	struct dc_bios *dcb = dc->ctx->dc_bios;
 	bool lid_state_closed = is_eDP_lid_closed(context);
 	struct dc_link *edp_link_to_turnoff = NULL;
+	bool edp_active_status_from_scratch =
+			(dcb->funcs->get_vga_enabled_displays(dc->ctx->dc_bios) == ATOM_DISPLAY_LCD1_ACTIVE);
 
+	/*Lid open*/
 	if (!lid_state_closed) {
 		edp_link_to_turnoff = get_link_for_edp_not_in_use(dc, context);
 
-		/* if OS doesn't light up eDP and eDP link is available, we want to disable */
-		if (!edp_link_to_turnoff)
+		/* if OS doesn't light up eDP and eDP link is available, we want to disable
+		 * If resume from S4/S5, should optimization.
+		 */
+		if (!edp_link_to_turnoff && edp_active_status_from_scratch)
 			dc->apply_edp_fast_boot_optimization = true;
 	}
 
-- 
2.7.4