OSDN Git Service

drm/amd/display: Hook up PSR residency command to DSAT
authorWyatt Wood <wyatt.wood@amd.com>
Wed, 21 Oct 2020 12:36:51 +0000 (08:36 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 16 Nov 2020 17:18:38 +0000 (12:18 -0500)
[Why]
Use GPINT command to get PSR residency from FW.

[How]
Hook up PSR residency command to DSAT.
Since PSR Count Request is deprecated, we will use this.

Signed-off-by: Wyatt Wood <wyatt.wood@amd.com>
Acked-by: Bindu Ramamurthy <bindu.r@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_link.c
drivers/gpu/drm/amd/display/dc/dc_link.h
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h

index ee2a51b..858acd3 100644 (file)
@@ -2783,6 +2783,18 @@ bool dc_link_setup_psr(struct dc_link *link,
 
 }
 
+void dc_link_get_psr_residency(const struct dc_link *link, uint32_t *residency)
+{
+       struct dc  *dc = link->ctx->dc;
+       struct dmub_psr *psr = dc->res_pool->psr;
+
+       // PSR residency measurements only supported on DMCUB
+       if (psr != NULL && link->psr_settings.psr_feature_enabled)
+               psr->funcs->psr_get_residency(psr, residency);
+       else
+               *residency = 0;
+}
+
 const struct dc_link_status *dc_link_get_status(const struct dc_link *link)
 {
        return &link->link_status;
index 39277aa..65b083e 100644 (file)
@@ -228,6 +228,8 @@ bool dc_link_setup_psr(struct dc_link *dc_link,
                const struct dc_stream_state *stream, struct psr_config *psr_config,
                struct psr_context *psr_context);
 
+void dc_link_get_psr_residency(const struct dc_link *link, uint32_t *residency);
+
 /* Request DC to detect if there is a Panel connected.
  * boot - If this call is during initial boot.
  * Return false for any type of detection failure or MST detection
index df3879c..0d6fe7c 100644 (file)
@@ -293,12 +293,26 @@ static void dmub_psr_force_static(struct dmub_psr *dmub)
        dc_dmub_srv_wait_idle(dc->dmub_srv);
 }
 
+/**
+ * Get PSR residency from firmware.
+ */
+static void dmub_psr_get_residency(struct dmub_psr *dmub, uint32_t *residency)
+{
+       struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub;
+
+       // Send gpint command and wait for ack
+       dmub_srv_send_gpint_command(srv, DMUB_GPINT__PSR_RESIDENCY, 0, 30);
+
+       dmub_srv_get_gpint_response(srv, residency);
+}
+
 static const struct dmub_psr_funcs psr_funcs = {
        .psr_copy_settings              = dmub_psr_copy_settings,
        .psr_enable                     = dmub_psr_enable,
        .psr_get_state                  = dmub_psr_get_state,
        .psr_set_level                  = dmub_psr_set_level,
        .psr_force_static               = dmub_psr_force_static,
+       .psr_get_residency              = dmub_psr_get_residency,
 };
 
 /**
index 4e113ac..fe747c2 100644 (file)
@@ -40,6 +40,7 @@ struct dmub_psr_funcs {
        void (*psr_get_state)(struct dmub_psr *dmub, enum dc_psr_state *dc_psr_state);
        void (*psr_set_level)(struct dmub_psr *dmub, uint16_t psr_level);
        void (*psr_force_static)(struct dmub_psr *dmub);
+       void (*psr_get_residency)(struct dmub_psr *dmub, uint32_t *residency);
 };
 
 struct dmub_psr *dmub_psr_create(struct dc_context *ctx);