aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/1015-drm-amd-dal-avoid-extra-interfaces-for-scratch_criti.patch
blob: 3683fdfe2175a33ea6ce1912252427295ef6b1bf (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
From 17345dc54501820d82995be29b161a8f69564129 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Mon, 11 Apr 2016 17:37:17 +1000
Subject: [PATCH 1015/1110] drm/amd/dal: avoid extra interfaces for
 scratch_critical_state.

This is just an example of an over abstracted interface.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c      | 26 ----------------------
 .../gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h   |  6 +++++
 .../dal/dc/bios/dce110/bios_parser_helper_dce110.c |  6 ++---
 drivers/gpu/drm/amd/dal/dc/dc_bios_types.h         |  2 --
 .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c    | 17 +++++++-------
 5 files changed, 16 insertions(+), 41 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h

diff --git a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
index ddb5fc8..fe3cc60 100644
--- a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
@@ -4139,32 +4139,6 @@ bool dc_bios_is_accelerated_mode(struct dc_bios *dcb)
 #endif
 }
 
-/**
- * bios_parser_set_scratch_critical_state
- *
- * @brief
- *  update critical state bit in VBIOS scratch register
- *
- * @param
- *  bool - to set or reset state
- */
-void dc_bios_set_scratch_critical_state(
-	struct dc_bios *dcb,
-	bool state)
-{
-	struct bios_parser *bp = BP_FROM_DCB(dcb);
-
-#ifdef CONFIG_DRM_AMD_DAL_VBIOS_PRESENT
-	bp->bios_helper->set_scratch_critical_state(
-			bp->ctx, state);
-#else
-	dal_logger_write(bp->ctx->logger,
-			LOG_MAJOR_BIOS,
-			LOG_MINOR_BIOS_CMD_TABLE,
-			"%s: VBIOS is not supported", __func__);
-#endif
-}
-
 void dc_bios_set_scratch_acc_mode_change(struct dc_bios *dcb)
 {
 	struct bios_parser *bp = BP_FROM_DCB(dcb);
diff --git a/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h
new file mode 100644
index 0000000..a994d81
--- /dev/null
+++ b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h
@@ -0,0 +1,6 @@
+#ifndef BIOS_DCE110_H
+#define BIOS_DCE110_H
+void dce110_set_scratch_critical_state(struct dc_context *ctx,
+				       bool state);
+
+#endif
diff --git a/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c
index 924957e..442e2a3 100644
--- a/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c
+++ b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c
@@ -312,9 +312,8 @@ static enum signal_type detect_sink(
 	return SIGNAL_TYPE_NONE;
 }
 
-static void set_scratch_critical_state(
-	struct dc_context *ctx,
-	bool state)
+void dce110_set_scratch_critical_state(struct dc_context *ctx,
+				       bool state)
 {
 	uint32_t addr = mmBIOS_SCRATCH_6;
 	uint32_t value = dm_read_reg(ctx, addr);
@@ -372,7 +371,6 @@ static const struct bios_parser_helper bios_parser_helper_funcs = {
 			prepare_scratch_active_and_requested,
 	.set_scratch_acc_mode_change = set_scratch_acc_mode_change,
 	.set_scratch_active_and_requested = set_scratch_active_and_requested,
-	.set_scratch_critical_state = set_scratch_critical_state,
 	.set_scratch_lcd_scale = set_scratch_lcd_scale,
 	.take_backlight_control = NULL,
 	.update_requested_backlight_level = NULL,
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
index 458dcac..7e37a72 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
@@ -152,8 +152,6 @@ void dc_bios_prepare_scratch_active_and_requested(struct dc_bios *bios,
 						  enum signal_type signal,
 						  const struct connector_device_tag_info *device_tag);
 void dc_bios_set_scratch_active_and_requested(struct dc_bios *bios);
-void dc_bios_set_scratch_critical_state(struct dc_bios *bios,
-					bool state);
 void dc_bios_set_scratch_acc_mode_change(struct dc_bios *bios);
 
 /* COMMANDS */
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
index 73c576e..fbb9f63 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c
@@ -34,6 +34,7 @@
 
 #include "gpu/dce110/dc_clock_gating_dce110.h"
 
+#include "bios/dce110/bios_dce110.h"
 #include "timing_generator.h"
 #include "mem_input.h"
 #include "opp.h"
@@ -514,12 +515,12 @@ static void program_fmt(
 	return;
 }
 
-static void update_bios_scratch_critical_state(struct adapter_service *as,
-		bool state)
+static void update_bios_scratch_critical_state(struct core_dc *dc,
+					       bool state)
 {
-	struct dc_bios *dcb = dal_adapter_service_get_bios_parser(as);
-
-	dc_bios_set_scratch_critical_state(dcb, state);
+#ifdef CONFIG_DRM_AMD_DAL_VBIOS_PRESENT
+	dce110_set_scratch_critical_state(dc->ctx, state);
+#endif
 }
 
 static void update_info_frame(struct pipe_ctx *pipe_ctx)
@@ -1206,8 +1207,7 @@ static enum dc_status apply_ctx_to_hw(
 		return DC_OK;
 
 	/* Apply new context */
-	update_bios_scratch_critical_state(context->res_ctx.pool.adapter_srv,
-			true);
+	update_bios_scratch_critical_state(dc, true);
 
 	for (i = 0; i < MAX_PIPES; i++) {
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
@@ -1275,8 +1275,7 @@ static enum dc_status apply_ctx_to_hw(
 
 	dc->hwss.set_displaymarks(dc, context);
 
-	update_bios_scratch_critical_state(context->res_ctx.pool.adapter_srv,
-			false);
+	update_bios_scratch_critical_state(dc, false);
 
 	switch_dp_clock_sources(dc, &context->res_ctx);
 
-- 
2.7.4