]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/display: Enable PSR Residency for multiple panels
authorMikita Lipski <mikita.lipski@amd.com>
Wed, 19 May 2021 21:32:16 +0000 (17:32 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 8 Jun 2021 16:20:20 +0000 (12:20 -0400)
[why]
Allow specifying which panel to take PSR Residency
measurements from.
[how]
Pass panel instance to DMUB through GPINT in the upper
8 bits of the parameter.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@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/dce/dmub_psr.c
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h

index 89dab6a42ded23fccebfd5dbf2318c807c1e6011..befce5909f0bfb51470a744b73265abb82fe9a07 100644 (file)
@@ -2940,10 +2940,14 @@ 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;
+       unsigned int panel_inst;
+
+       if (!dc_get_edp_link_panel_inst(dc, link, &panel_inst))
+               return;
 
-       // PSR residency measurements only supported on DMCUB
+       /* PSR residency measurements only supported on DMCUB */
        if (psr != NULL && link->psr_settings.psr_feature_enabled)
-               psr->funcs->psr_get_residency(psr, residency);
+               psr->funcs->psr_get_residency(psr, residency, panel_inst);
        else
                *residency = 0;
 }
index c41db6d4e7942047181e0d4a9625afca086a1cf0..10d42ae0cffefd42b09d8955ccbecbd031380f79 100644 (file)
@@ -327,12 +327,13 @@ static void dmub_psr_force_static(struct dmub_psr *dmub, uint8_t panel_inst)
 /*
  * Get PSR residency from firmware.
  */
-static void dmub_psr_get_residency(struct dmub_psr *dmub, uint32_t *residency)
+static void dmub_psr_get_residency(struct dmub_psr *dmub, uint32_t *residency, uint8_t panel_inst)
 {
        struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub;
+       uint16_t param = (uint16_t)(panel_inst << 8);
 
-       // Send gpint command and wait for ack
-       dmub_srv_send_gpint_command(srv, DMUB_GPINT__PSR_RESIDENCY, 0, 30);
+       /* Send gpint command and wait for ack */
+       dmub_srv_send_gpint_command(srv, DMUB_GPINT__PSR_RESIDENCY, param, 30);
 
        dmub_srv_get_gpint_response(srv, residency);
 }
index bf73c7edbd9e0560afbb142c211f6e1d8de466e7..9675c269e649d18c7614f07c49bee25d68b4d58d 100644 (file)
@@ -44,7 +44,8 @@ struct dmub_psr_funcs {
        void (*psr_set_level)(struct dmub_psr *dmub, uint16_t psr_level,
        uint8_t panel_inst);
        void (*psr_force_static)(struct dmub_psr *dmub, uint8_t panel_inst);
-       void (*psr_get_residency)(struct dmub_psr *dmub, uint32_t *residency);
+       void (*psr_get_residency)(struct dmub_psr *dmub, uint32_t *residency,
+       uint8_t panel_inst);
 };
 
 struct dmub_psr *dmub_psr_create(struct dc_context *ctx);