drm/amd/display: Display does not light up after S4 resume
authorMeenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Fri, 30 Sep 2022 03:55:41 +0000 (23:55 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 10 Oct 2022 21:32:55 +0000 (17:32 -0400)
[Why]
Dpia hpd interrupt processing is disabled when entering S4/S0i3 and
would be reenabled after detection completes during resuming. Because,
keeping hpd interrupts enabled during detection leads to multiple
detections for the same hpd transition. There is a S4 case where dpia
hpd interrupt is missed when driver is in transitioning from hpd
interrupt processing disable to enable and the display does not light
up.

[How]
- Added dmub inbox command DMUB_CMD__DPIA_HPD_INT_ENABLE to explicitly
control dmub to issue dpia hpd interrupt or not. If dpia hpd interrupt
is disabled, dmub will keep the hpd pending and post it once driver
reenables dpia hpd interrupt or when querying with
DMUB_CMD__QUERY_HPD_STATE.
- Added dmub boot option dpia_hpd_int_enable_supported to notify dmub
about whether DMUB_CMD__DPIA_HPD_INT_ENABLE command would be used.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Mustapha Ghaddar <Mustapha.Ghaddar@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dmub/dmub_srv.h
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c

index b5058a2ce7e88c0b6725a28fdab324d9933c0b61..660316a536f723324eb6a71b7e5ef1db18a1f9f5 100644 (file)
@@ -4656,6 +4656,37 @@ enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc,
        return DC_OK;
 }
 
+/**
+ *****************************************************************************
+ *  Function: dc_process_dmub_dpia_hpd_int_enable
+ *
+ *  @brief
+ *             Submits dpia hpd int enable command to dmub via inbox message
+ *
+ *  @param
+ *             [in] dc: dc structure
+ *             [in] hpd_int_enable: 1 for hpd int enable, 0 to disable
+ *
+ *     @return
+ *             None
+ *****************************************************************************
+ */
+void dc_process_dmub_dpia_hpd_int_enable(const struct dc *dc,
+                               uint32_t hpd_int_enable)
+{
+       union dmub_rb_cmd cmd = {0};
+       struct dc_dmub_srv *dmub_srv = dc->ctx->dmub_srv;
+
+       cmd.dpia_hpd_int_enable.header.type = DMUB_CMD__DPIA_HPD_INT_ENABLE;
+       cmd.dpia_hpd_int_enable.enable = hpd_int_enable;
+
+       dc_dmub_srv_cmd_queue(dmub_srv, &cmd);
+       dc_dmub_srv_cmd_execute(dmub_srv);
+       dc_dmub_srv_wait_idle(dmub_srv);
+
+       DC_LOG_DEBUG("%s: hpd_int_enable(%d)\n", __func__, hpd_int_enable);
+}
+
 /**
  * dc_disable_accelerated_mode - disable accelerated mode
  * @dc: dc structure
index b0afcff94591a067ed4598dc51e9ac2ad155bf18..5d0103e20412cfe20ab747282c1b295f53e5f9a7 100644 (file)
@@ -1612,6 +1612,9 @@ enum dc_status dc_process_dmub_set_mst_slots(const struct dc *dc,
                                uint8_t mst_alloc_slots,
                                uint8_t *mst_slots_in_use);
 
+void dc_process_dmub_dpia_hpd_int_enable(const struct dc *dc,
+                               uint32_t hpd_int_enable);
+
 /*******************************************************************************
  * DSC Interfaces
  ******************************************************************************/
index f34c45b19fcb2c04c078637668fc00283518eca6..eb5b7eb292ef30afe2757bad0bd6c63797ebe512 100644 (file)
@@ -248,6 +248,7 @@ struct dmub_srv_hw_params {
        bool disable_dpia;
        bool usb4_cm_version;
        bool fw_in_system_memory;
+       bool dpia_hpd_int_enable_supported;
 };
 
 /**
index 834707dfc1895d13213b9d9d19de33996a4e786c..1d36f0fceb3e7ae6676d7ee13619fd72384cadca 100644 (file)
@@ -400,8 +400,9 @@ union dmub_fw_boot_options {
                uint32_t diag_env: 1; /* 1 if diagnostic environment */
                uint32_t gpint_scratch8: 1; /* 1 if GPINT is in scratch8*/
                uint32_t usb4_cm_version: 1; /**< 1 CM support */
+               uint32_t dpia_hpd_int_enable_supported: 1; /* 1 if dpia hpd int enable supported */
 
-               uint32_t reserved : 17; /**< reserved */
+               uint32_t reserved : 16; /**< reserved */
        } bits; /**< boot bits */
        uint32_t all; /**< 32-bit access to bits */
 };
@@ -728,6 +729,12 @@ enum dmub_cmd_type {
        /**
         * Command type used for all VBIOS interface commands.
         */
+
+       /**
+        * Command type used to set DPIA HPD interrupt state
+        */
+       DMUB_CMD__DPIA_HPD_INT_ENABLE = 86,
+
        DMUB_CMD__VBIOS = 128,
 };
 
@@ -1255,6 +1262,14 @@ struct dmub_rb_cmd_set_mst_alloc_slots {
        struct dmub_cmd_mst_alloc_slots_control_data mst_slots_control; /* mst slots control */
 };
 
+/**
+ * DMUB command structure for DPIA HPD int enable control.
+ */
+struct dmub_rb_cmd_dpia_hpd_int_enable {
+       struct dmub_cmd_header header; /* header */
+       uint32_t enable; /* dpia hpd interrupt enable */
+};
+
 /**
  * struct dmub_rb_cmd_dpphy_init - DPPHY init.
  */
@@ -3336,6 +3351,10 @@ union dmub_rb_cmd {
         * Definition of a DMUB_CMD__QUERY_HPD_STATE command.
         */
        struct dmub_rb_cmd_query_hpd_state query_hpd;
+       /**
+        * Definition of a DMUB_CMD__DPIA_HPD_INT_ENABLE command.
+        */
+       struct dmub_rb_cmd_dpia_hpd_int_enable dpia_hpd_int_enable;
 };
 
 /**
index c7bd7e216710944ab3786a17a31ed68a5c4c66b7..c90b9ee42e126d67b225eed32b759e0287c8e704 100644 (file)
@@ -350,6 +350,7 @@ void dmub_dcn31_enable_dmub_boot_options(struct dmub_srv *dmub, const struct dmu
        boot_options.bits.dpia_supported = params->dpia_supported;
        boot_options.bits.enable_dpia = params->disable_dpia ? 0 : 1;
        boot_options.bits.usb4_cm_version = params->usb4_cm_version;
+       boot_options.bits.dpia_hpd_int_enable_supported = params->dpia_hpd_int_enable_supported;
        boot_options.bits.power_optimization = params->power_optimization;
 
        boot_options.bits.sel_mux_phy_c_d_phy_f_g = (dmub->asic == DMUB_ASIC_DCN31B) ? 1 : 0;