]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Extend PSRSU residency mode
authorJack Chang <jack.chang@amd.com>
Fri, 10 May 2024 02:38:19 +0000 (10:38 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Jun 2024 19:20:40 +0000 (15:20 -0400)
1. To support multiple PSRSU residency measurement mode

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Jack Chang <jack.chang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.c
drivers/gpu/drm/amd/display/dc/dce/dmub_psr.h
drivers/gpu/drm/amd/display/dc/inc/link.h
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.h
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index 27d5c6077630134e6e9c4b08842a89c1a6eed242..8db75afa9fc997c26d8011b3122f21ba9f0dd0c2 100644 (file)
@@ -3074,7 +3074,7 @@ static int psr_read_residency(void *data, u64 *val)
        struct dc_link *link = connector->dc_link;
        u32 residency = 0;
 
-       link->dc->link_srv->edp_get_psr_residency(link, &residency);
+       link->dc->link_srv->edp_get_psr_residency(link, &residency, PSR_RESIDENCY_MODE_PHY);
 
        *val = (u64)residency;
 
index 3e243e407bb87ec6934eea4899baa78cc0992423..ccf153b7a4673c7e87fa4f749386ed4c47ef2a7f 100644 (file)
@@ -445,10 +445,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, uint8_t panel_inst)
+static void dmub_psr_get_residency(struct dmub_psr *dmub, uint32_t *residency,
+       uint8_t panel_inst, enum psr_residency_mode mode)
 {
        uint16_t param = (uint16_t)(panel_inst << 8);
 
+       param |= mode;
+
        /* Send gpint command and wait for ack */
        dc_wake_and_execute_gpint(dmub->ctx, DMUB_GPINT__PSR_RESIDENCY, param, residency,
                                  DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY);
index 289e42070ece9c9fe4b6eb1c4cd49dd6455020a7..a6e282d950c3563efbb1037fb9f1607c666c5d96 100644 (file)
@@ -27,6 +27,7 @@
 #define _DMUB_PSR_H_
 
 #include "dc_types.h"
+#include "dmub_cmd.h"
 struct dc_link;
 struct dmub_psr_funcs;
 
@@ -46,7 +47,7 @@ struct dmub_psr_funcs {
        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,
-       uint8_t panel_inst);
+       uint8_t panel_inst,  enum psr_residency_mode mode);
        void (*psr_set_sink_vtotal_in_psr_active)(struct dmub_psr *dmub,
        uint16_t psr_vtotal_idle, uint16_t psr_vtotal_su);
        void (*psr_set_power_opt)(struct dmub_psr *dmub, unsigned int power_opt, uint8_t panel_inst);
index 7ab8ba5e23ed32d5f39be78fdd2c31fe62f8ef7b..72a8479e1f2d739f20c8cfdb89d24d0869145b89 100644 (file)
@@ -272,7 +272,7 @@ struct link_service {
                        uint16_t psr_vtotal_idle,
                        uint16_t psr_vtotal_su);
        void (*edp_get_psr_residency)(
-                       const struct dc_link *link, uint32_t *residency);
+                       const struct dc_link *link, uint32_t *residency, enum psr_residency_mode mode);
 
        bool (*edp_get_replay_state)(
                        const struct dc_link *link, uint64_t *state);
index 89f66d88c3b078dad2e00db60804e83f56485cab..b0e17064a96070dd1f92a697aa19a96f7b2c9592 100644 (file)
@@ -853,7 +853,7 @@ bool edp_setup_psr(struct dc_link *link,
 
 }
 
-void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency)
+void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency, enum psr_residency_mode mode)
 {
        struct dc  *dc = link->ctx->dc;
        struct dmub_psr *psr = dc->res_pool->psr;
@@ -864,7 +864,7 @@ void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency)
 
        // PSR residency measurements only supported on DMCUB
        if (psr != NULL && link->psr_settings.psr_feature_enabled)
-               psr->funcs->psr_get_residency(psr, residency, panel_inst);
+               psr->funcs->psr_get_residency(psr, residency, panel_inst, mode);
        else
                *residency = 0;
 }
index cb6d95cc36e46f36a51a9833d7be8c2cc9113f47..8df8ac5bde5b164bf5fc9ebdca05e770b92cfc8e 100644 (file)
@@ -51,7 +51,7 @@ bool edp_setup_psr(struct dc_link *link,
                struct psr_context *psr_context);
 bool edp_set_sink_vtotal_in_psr_active(const struct dc_link *link,
        uint16_t psr_vtotal_idle, uint16_t psr_vtotal_su);
-void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency);
+void edp_get_psr_residency(const struct dc_link *link, uint32_t *residency, enum psr_residency_mode mode);
 bool edp_set_replay_allow_active(struct dc_link *dc_link, const bool *enable,
        bool wait, bool force_static, const unsigned int *power_opts);
 bool edp_setup_replay(struct dc_link *link,
index 7f08e95140ef6e9e1296c98e19df83f5e6e48680..d4d046ac82a41cac50571b65cc610eedbbd2d7b8 100644 (file)
@@ -3249,6 +3249,18 @@ struct dmub_rb_cmd_psr_set_power_opt {
        struct dmub_cmd_psr_set_power_opt_data psr_set_power_opt_data;
 };
 
+/**
+ * Different PSR residency modes.
+ * Different modes change the definition of PSR residency.
+ */
+enum psr_residency_mode {
+       PSR_RESIDENCY_MODE_PHY = 0,
+       PSR_RESIDENCY_MODE_ALPM,
+       PSR_RESIDENCY_MODE_ENABLEMENT_PERIOD,
+       /* Do not add below. */
+       PSR_RESIDENCY_MODE_LAST_ELEMENT,
+};
+
 /**
  * Definition of Replay Residency GPINT command.
  * Bit[0] - Residency mode for Revision 0