drm/msm/dp: return correct connection status after suspend
PATCH v4 1/1 drm/msm/dp: return correct connection status after suspend
During suspend, dp host controller and hpd block are disabled due to both ahb and aux clock are disabled. Therefore hpd plug/unplug interrupts will not be generated. At dp_pm_resume(), reinitialize both dp host controller and hpd block so that hpd plug/unplug interrupts will be generated and handled by driver so that hpd connection state is updated correctly. This patch will fix link training flaky issues.
Changes in v2:
-- use container_of to cast correct dp_display_private pointer
at both dp_pm_suspend() and dp_pm_resume().
Changes in v3:
-- replace hpd_state atomic_t with u32
Changes in v4
-- call dp_display_host_deinit() at dp_pm_suspend()
-- call dp_display_host_init() at msm_dp_display_enable() -- fix phy->init_count unbalance which causes link training failed
--- drivers/gpu/drm/msm/dp/dp_catalog.c | 13 +++ drivers/gpu/drm/msm/dp/dp_catalog.h | 1 + drivers/gpu/drm/msm/dp/dp_ctrl.c | 5 + drivers/gpu/drm/msm/dp/dp_display.c | 144 +++++++++++++++------------- drivers/gpu/drm/msm/dp/dp_reg.h | 2 + 5 files changed, 97 insertions(+), 68 deletions(-)
drivers/gpu/drm/msm/dp/dp_catalog.c +13 -0
@@ -572,6 +572,19 @@ void dp_catalog_ctrl_hpd_config(struct dp_catalog *dp_catalog)dp_write_aux (catalog,REG_DP_DP_HPD_CTRL ,DP_DP_HPD_CTRL_HPD_EN ); } +u32 dp_catalog_hpd_get_state_status (struct dp_catalog *dp_catalog) +{ +struct dp_catalog_private *catalog =container_of (dp_catalog, + struct dp_catalog_private, dp_catalog); +u32 status; + + status =dp_read_aux (catalog,REG_DP_DP_HPD_INT_STATUS ); + status >>=DP_DP_HPD_STATE_STATUS_BITS_SHIFT ; + status &=DP_DP_HPD_STATE_STATUS_BITS_MASK ; + +return status; +} +u32 dp_catalog_hpd_get_intr_status (struct dp_catalog *dp_catalog) { struct dp_catalog_private *catalog = container_of(dp_catalog,
drivers/gpu/drm/msm/dp/dp_catalog.h +1 -0
@@ -97,6 +97,7 @@ void dp_catalog_ctrl_enable_irq(struct dp_catalog *dp_catalog, bool enable);void dp_catalog_hpd_config_intr (struct dp_catalog *dp_catalog,u32 intr_mask,bool en);void dp_catalog_ctrl_hpd_config (struct dp_catalog *dp_catalog); +u32 dp_catalog_hpd_get_state_status (struct dp_catalog *dp_catalog);u32 dp_catalog_hpd_get_intr_status (struct dp_catalog *dp_catalog);void dp_catalog_ctrl_phy_reset (struct dp_catalog *dp_catalog); int dp_catalog_ctrl_update_vx_px(struct dp_catalog *dp_catalog, u8 v_level,
drivers/gpu/drm/msm/dp/dp_ctrl.c +5 -0
@@ -1400,6 +1400,8 @@ int dp_ctrl_host_init(struct dp_ctrl *dp_ctrl, bool flip)void dp_ctrl_host_deinit (struct dp_ctrl *dp_ctrl) {struct dp_ctrl_private *ctrl; +struct dp_io *dp_io; +struct phy *phy;if (!dp_ctrl) {DRM_ERROR ("Invalid input data\n" );
@@ -1407,8 +1409,11 @@ void dp_ctrl_host_deinit(struct dp_ctrl *dp_ctrl) } ctrl = container_of(dp_ctrl, struct dp_ctrl_private, dp_ctrl); + dp_io = &ctrl->parser->io; + phy = dp_io->phy;dp_catalog_ctrl_enable_irq (ctrl->catalog, false); +phy_exit (phy);DRM_DEBUG_DP ("Host deinitialized successfully\n" ); }
drivers/gpu/drm/msm/dp/dp_display.c +76 -68
297 lines not on this page · raw message
drivers/gpu/drm/msm/dp/dp_reg.h +2 -0
@@ -32,6 +32,8 @@#define DP_DP_IRQ_HPD_INT_ACK (0x00000002)#define DP_DP_HPD_REPLUG_INT_ACK (0x00000004)#define DP_DP_HPD_UNPLUG_INT_ACK (0x00000008) +#define DP_DP_HPD_STATE_STATUS_BITS_MASK (0x0000000F) +#define DP_DP_HPD_STATE_STATUS_BITS_SHIFT (0x1C)#define REG_DP_DP_HPD_INT_MASK (0x0000000C)#define DP_DP_HPD_PLUG_INT_MASK (0x00000001)
base-commit: d1ea914925856d397b0b3241428f20b945e31434
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Kuogee,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on d1ea914925856d397b0b3241428f20b945e31434]
url: https://github.com/0day-ci/linux/commits/Kuogee-Hsieh/drm-msm-dp-return-correct-connection-status-after-suspend/20201014-073608 base: d1ea914925856d397b0b3241428f20b945e31434 config: arm-defconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/8f18f61416789c76c57982b9c730c2a69518203d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kuogee-Hsieh/drm-msm-dp-return-correct-connection-status-after-suspend/20201014-073608 git checkout 8f18f61416789c76c57982b9c730c2a69518203d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/gpu/drm/msm/dp/dp_display.c: In function 'msm_dp_display_enable':
>> drivers/gpu/drm/msm/dp/dp_display.c:1382:15: error: 'ST_DISPLAY_OFF' undeclared (first use in this function)
1382 | if (state == ST_DISPLAY_OFF)
| ^~~~~~~~~~~~~~ drivers/gpu/drm/msm/dp/dp_display.c:1382:15: note: each undeclared identifier is reported only once for each function it appears in
vim +/ST_DISPLAY_OFF +1382 drivers/gpu/drm/msm/dp/dp_display.c
1349
1350 int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder)
1351 {
1352 int rc = 0;
1353 struct dp_display_private *dp_display;
1354 u32 state;
1355
1356 dp_display = container_of(dp, struct dp_display_private, dp_display);
1357 if (!dp_display->dp_mode.drm_mode.clock) {
1358 DRM_ERROR("invalid params\n");
1359 return -EINVAL;
1360 }
1361
1362 mutex_lock(&dp_display->event_mutex);
1363
1364 dp_del_event(dp_display, EV_CONNECT_PENDING_TIMEOUT);
1365
1366 rc = dp_display_set_mode(dp, &dp_display->dp_mode);
1367 if (rc) {
1368 DRM_ERROR("Failed to perform a mode set, rc=%d\n", rc);
1369 mutex_unlock(&dp_display->event_mutex);
1370 return rc;
1371 }
1372
1373 rc = dp_display_prepare(dp);
1374 if (rc) {
1375 DRM_ERROR("DP display prepare failed, rc=%d\n", rc);
1376 mutex_unlock(&dp_display->event_mutex);
1377 return rc;
1378 }
1379
1380 state = dp_display->hpd_state;
1381
> 1382 if (state == ST_DISPLAY_OFF)
1383 dp_display_host_init(dp_display);
1384
1385 dp_display_enable(dp_display, 0);
1386
1387 rc = dp_display_post_enable(dp);
1388 if (rc) {
1389 DRM_ERROR("DP display post enable failed, rc=%d\n", rc);
1390 dp_display_disable(dp_display, 0);
1391 dp_display_unprepare(dp);
1392 }
1393
1394 if (state == ST_SUSPEND_PENDING)
1395 dp_add_event(dp_display, EV_IRQ_HPD_INT, 0, 0);
1396
1397 /* completed connection */
1398 dp_display->hpd_state = ST_CONNECTED;
1399
1400 mutex_unlock(&dp_display->event_mutex);
1401
1402 return rc;
1403 }
1404
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoting Kuogee Hsieh (2020-10-13 16:35:22)
Quoted 14 lines
During suspend, dp host controller and hpd block are disabled due to both ahb and aux clock are disabled. Therefore hpd plug/unplug interrupts will not be generated. At
dp_pm_resume(), reinitialize both dp host controller and hpd block so that hpd plug/unplug interrupts will be generated and handled by driver so that hpd connection state is updated correctly. This patch will fix link training flaky issues.Changes in v2:
-- usecontainer_ofto cast correctdp_display_privatepointer
at bothdp_pm_suspend()anddp_pm_resume().Changes in v3:
-- replacehpd_stateatomic_twith u32
Quoted 7 lines
Changes in v4
-- calldp_display_host_deinit()atdp_pm_suspend()
-- calldp_display_host_init()atmsm_dp_display_enable()-- fixphy->init_countunbalance which causes link training failedSigned-off-by Kuogee Hsieh <[email protected]>---
Can we add some sort of Fixes tag? Maybe the beginning of this DP driver support?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel