summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-03-06 02:34:54 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-03-06 02:34:54 +0000
commitb65f6f8281c16b5d1369a200c9f9768e43a2e69f (patch)
tree43d18f58e57aa3eae4167de2091e31e02c9b585d
parente708a13915a3edd96e2fbdcc4af5fe861e57b7fe (diff)
drm/amd/display: Move DCN314 DOMAIN power control to DMCUB
From Nicholas Kazlauskas 4da108082a3290804ebbd42d70ce8535c00e4637 in linux-6.1.y/6.1.15 e383b12709e32d6494c948422070c2464b637e44 in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.c24
-rw-r--r--sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.h2
-rw-r--r--sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_init.c2
-rw-r--r--sys/dev/pci/drm/amd/display/dmub/inc/dmub_cmd.h25
4 files changed, 52 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.c b/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.c
index a0741794db6..8e824dc81de 100644
--- a/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.c
+++ b/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.c
@@ -391,3 +391,27 @@ void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx)
pipe_ctx->stream_res.stream_enc->funcs->set_input_mode(pipe_ctx->stream_res.stream_enc,
pix_per_cycle);
}
+
+void dcn314_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on)
+{
+ struct dc_context *ctx = hws->ctx;
+ union dmub_rb_cmd cmd;
+
+ if (hws->ctx->dc->debug.disable_hubp_power_gate)
+ return;
+
+ PERF_TRACE();
+
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.domain_control.header.type = DMUB_CMD__VBIOS;
+ cmd.domain_control.header.sub_type = DMUB_CMD__VBIOS_DOMAIN_CONTROL;
+ cmd.domain_control.header.payload_bytes = sizeof(cmd.domain_control.data);
+ cmd.domain_control.data.inst = hubp_inst;
+ cmd.domain_control.data.power_gate = !power_on;
+
+ dc_dmub_srv_cmd_queue(ctx->dmub_srv, &cmd);
+ dc_dmub_srv_cmd_execute(ctx->dmub_srv);
+ dc_dmub_srv_wait_idle(ctx->dmub_srv);
+
+ PERF_TRACE();
+}
diff --git a/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.h b/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.h
index 24428029821..c419d3dbdfe 100644
--- a/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.h
+++ b/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_hwseq.h
@@ -41,4 +41,6 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx);
+void dcn314_hubp_pg_control(struct dce_hwseq *hws, unsigned int hubp_inst, bool power_on);
+
#endif /* __DC_HWSS_DCN314_H__ */
diff --git a/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_init.c b/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_init.c
index 5b6c2d94ec7..343f4d9dd5e 100644
--- a/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_init.c
+++ b/sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_init.c
@@ -137,7 +137,7 @@ static const struct hwseq_private_funcs dcn314_private_funcs = {
.plane_atomic_disable = dcn20_plane_atomic_disable,
.plane_atomic_power_down = dcn10_plane_atomic_power_down,
.enable_power_gating_plane = dcn314_enable_power_gating_plane,
- .hubp_pg_control = dcn31_hubp_pg_control,
+ .hubp_pg_control = dcn314_hubp_pg_control,
.program_all_writeback_pipes_in_tree = dcn30_program_all_writeback_pipes_in_tree,
.update_odm = dcn314_update_odm,
.dsc_pg_control = dcn314_dsc_pg_control,
diff --git a/sys/dev/pci/drm/amd/display/dmub/inc/dmub_cmd.h b/sys/dev/pci/drm/amd/display/dmub/inc/dmub_cmd.h
index 1bc2832a71d..bb5f2ba6c76 100644
--- a/sys/dev/pci/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/sys/dev/pci/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -452,6 +452,10 @@ enum dmub_cmd_vbios_type {
* Query DP alt status on a transmitter.
*/
DMUB_CMD__VBIOS_TRANSMITTER_QUERY_DP_ALT = 26,
+ /**
+ * Controls domain power gating
+ */
+ DMUB_CMD__VBIOS_DOMAIN_CONTROL = 28,
};
//==============================================================================
@@ -1194,6 +1198,23 @@ struct dmub_rb_cmd_dig1_transmitter_control {
};
/**
+ * struct dmub_rb_cmd_domain_control_data - Data for DOMAIN power control
+ */
+struct dmub_rb_cmd_domain_control_data {
+ uint8_t inst : 6; /**< DOMAIN instance to control */
+ uint8_t power_gate : 1; /**< 1=power gate, 0=power up */
+ uint8_t reserved[3]; /**< Reserved for future use */
+};
+
+/**
+ * struct dmub_rb_cmd_domain_control - Controls DOMAIN power gating
+ */
+struct dmub_rb_cmd_domain_control {
+ struct dmub_cmd_header header; /**< header */
+ struct dmub_rb_cmd_domain_control_data data; /**< payload */
+};
+
+/**
* DPIA tunnel command parameters.
*/
struct dmub_cmd_dig_dpia_control_data {
@@ -3190,6 +3211,10 @@ union dmub_rb_cmd {
*/
struct dmub_rb_cmd_dig1_transmitter_control dig1_transmitter_control;
/**
+ * Definition of a DMUB_CMD__VBIOS_DOMAIN_CONTROL command.
+ */
+ struct dmub_rb_cmd_domain_control domain_control;
+ /**
* Definition of a DMUB_CMD__PSR_SET_VERSION command.
*/
struct dmub_rb_cmd_psr_set_version psr_set_version;