cherry-pick missed patches to msm-next-staging
cover cherry-pick missed patches to msm-next-staging
cherry-pick 3 patches at chromeos-5.4 to msm-next-staging
Kuogee Hsieh (2):
FROMLIST: drm/msm/dp: return correct connection status after suspend
FROMLIST: drm/msm/dp: fixes wrong connection state caused by failure
of link train
Stephen Boyd (1):
FIXUP: FROMLIST: drm/msm/dp: return correct connection status after
suspend
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 | 172 ++++++++++++++-------------- drivers/gpu/drm/msm/dp/dp_panel.c | 5 + drivers/gpu/drm/msm/dp/dp_reg.h | 2 + 6 files changed, 115 insertions(+), 83 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 1/3 FROMLIST: drm/msm/dp: return correct connection status after suspend
At dp_pm_resume, reinitialize both dp host controller and hpd block so that hpd connection can be detected at realtime by reading hpd state status register. Also hpd plug interrupt can be generated accordingly.
Changes in v2:
-- use container_of to cast correct dp_display_private pointer
at both dp_pm_suspend and dp_pm_resume.
(am from https://lore.kernel.org/patchwork/patch/1312265/)
(also found at https://lore.kernel.org/r/[email protected])
BUG=b:166844571, b:148864048
TEST=On lazor, suspend with DP connected, disconnect cable, resume, see
panel is gone from settings
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2429850
Commit-Queue: Rob Clark <[email protected]>
--- drivers/gpu/drm/msm/dp/dp_catalog.c | 13 ++++++ drivers/gpu/drm/msm/dp/dp_catalog.h | 1 + drivers/gpu/drm/msm/dp/dp_display.c | 67 ++++++++++++----------------- drivers/gpu/drm/msm/dp/dp_reg.h | 2 + 4 files changed, 43 insertions(+), 40 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 =0 ; + + 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_display.c +27 -40
122 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)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 2/3 FIXUP: FROMLIST: drm/msm/dp: return correct connection status after suspend
In reply to Kuogee HsiehFrom: Stephen Boyd <[email protected]>
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
(am from https://lore.kernel.org/patchwork/patch/1320895/)
(also found at https://lore.kernel.org/r/[email protected])
BUG=b:166844571, b:148864048, b:170279524
TEST=On lazor, suspend with DP connected, disconnect cable, resume see
panel is gone from settings
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2469808
Commit-Queue: Rob Clark <[email protected]>
--- drivers/gpu/drm/msm/dp/dp_catalog.c | 2 +- drivers/gpu/drm/msm/dp/dp_ctrl.c | 5 ++ drivers/gpu/drm/msm/dp/dp_display.c | 83 ++++++++++++++++++----------- 3 files changed, 58 insertions(+), 32 deletions(-)
drivers/gpu/drm/msm/dp/dp_catalog.c +1 -1
@@ -576,7 +576,7 @@ 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 =0 ; +u32 status; status =dp_read_aux (catalog,REG_DP_DP_HPD_INT_STATUS ); status >>=DP_DP_HPD_STATE_STATUS_BITS_SHIFT ;
drivers/gpu/drm/msm/dp/dp_ctrl.c +5 -0
@@ -1403,6 +1403,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" );
@@ -1410,8 +1412,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 +52 -31
215 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH 3/3 FROMLIST: drm/msm/dp: fixes wrong connection state caused by failure of link train
In reply to Kuogee HsiehConnection state is not set correctly happen when either failure of link train due to cable unplugged in the middle of aux channel reading or cable plugged in while in suspended state. This patch fixes these problems. This patch also replace ST_SUSPEND_PENDING with ST_DISPLAY_OFF.
Changes in V2:
-- Add more information to commit message.
Changes in V3:
-- change base
(am from https://lore.kernel.org/patchwork/patch/1320896/)
(also found at https://lore.kernel.org/r/[email protected])
BUG=b:166844571, b:148864048, b:170279524
TEST=Connect and disconnect DP cable quick and slow with USE="debug"
kernel on Lazor, see that the UI doesn't get confused and think it is connected when it isn't
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2447191
Commit-Queue: Rob Clark <[email protected]>
--- drivers/gpu/drm/msm/dp/dp_display.c | 40 ++++++++++++++--------------- drivers/gpu/drm/msm/dp/dp_panel.c | 5 ++++ 2 files changed, 24 insertions(+), 21 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +19 -21
@@ -45,7 +45,7 @@ enum {ST_CONNECT_PENDING ,ST_CONNECTED ,ST_DISCONNECT_PENDING , -ST_SUSPEND_PENDING , +ST_DISPLAY_OFF , ST_SUSPENDED, };
@@ -504,7 +504,7 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)mutex_lock (&dp->event_mutex); state = dp->hpd_state; -if (state ==ST_SUSPEND_PENDING ) { +if (state ==ST_DISPLAY_OFF || state ==ST_SUSPENDED ) {mutex_unlock (&dp->event_mutex);return 0 ; }
@@ -526,14 +526,14 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data) hpd->hpd_high =1 ; ret =dp_display_usbpd_configure_cb (&dp->pdev->dev); -if (ret) {/* failed */ +if (ret) {/* link train failed */ hpd->hpd_high =0 ; dp->hpd_state =ST_DISCONNECTED ; + }else { +/* start sentinel checking in case of missing uevent */ +dp_add_event (dp,EV_CONNECT_PENDING_TIMEOUT ,0 , tout); } -/* start sanity checking */ -dp_add_event (dp,EV_CONNECT_PENDING_TIMEOUT ,0 , tout); -mutex_unlock (&dp->event_mutex);/* uevent will complete connection part */
@@ -586,11 +586,6 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)mutex_lock (&dp->event_mutex); state = dp->hpd_state; -if (state ==ST_SUSPEND_PENDING ) { -mutex_unlock (&dp->event_mutex); -return 0 ; - } -if (state ==ST_DISCONNECT_PENDING || state ==ST_DISCONNECTED ) {mutex_unlock (&dp->event_mutex);return 0 ;
@@ -617,7 +612,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)*/ dp_display_usbpd_disconnect_cb (&dp->pdev->dev); -/* start sanity checking */ +/* start sentinel checking in case of missing uevent */ dp_add_event (dp,EV_DISCONNECT_PENDING_TIMEOUT ,0 ,DP_TIMEOUT_5_SECOND );/* signal the disconnect event early to ensure proper teardown */
@@ -657,7 +652,7 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)/* irq_hpd can happen at either connected or disconnected state */ state = dp->hpd_state; -if (state ==ST_SUSPEND_PENDING ) { +if (state ==ST_DISPLAY_OFF ) {mutex_unlock (&dp->event_mutex);return 0 ; }
@@ -1082,7 +1077,7 @@ static irqreturn_t dp_display_irq_handler(int irq, void *dev_id) }if (hpd_isr_status &DP_DP_IRQ_HPD_INT_MASK ) { -/* delete connect pending event first */ +/* stop sentinel connect pending checking */ dp_del_event (dp,EV_CONNECT_PENDING_TIMEOUT );dp_add_event (dp,EV_IRQ_HPD_INT ,0 ,0 ); }
@@ -1213,13 +1208,10 @@ static int dp_pm_resume(struct device *dev) status =dp_catalog_hpd_get_state_status (dp->catalog); -if (status) { +if (status) dp->dp_display.is_connected = true; - }else { +else dp->dp_display.is_connected = false; -/* make sure next resume host_init be called */ - dp->core_initialized = false; - }mutex_unlock (&dp->event_mutex);
@@ -1241,6 +1233,9 @@ static int dp_pm_suspend(struct device *dev) dp->hpd_state =ST_SUSPENDED ; +/* host_init will be called at pm_resume */ + dp->core_initialized = false; +mutex_unlock (&dp->event_mutex);return 0 ;
@@ -1370,6 +1365,7 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder)mutex_lock (&dp_display->event_mutex); +/* stop sentinel checking */ dp_del_event (dp_display,EV_CONNECT_PENDING_TIMEOUT ); rc =dp_display_set_mode (dp, &dp_display->dp_mode);
@@ -1400,7 +1396,8 @@ int msm_dp_display_enable(struct msm_dp *dp, struct drm_encoder *encoder)dp_display_unprepare (dp); } -if (state ==ST_SUSPEND_PENDING ) +/* manual kick off plug event to train link */ +if (state ==ST_DISPLAY_OFF )dp_add_event (dp_display,EV_IRQ_HPD_INT ,0 ,0 );/* completed connection */
@@ -1432,6 +1429,7 @@ int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder)mutex_lock (&dp_display->event_mutex); +/* stop sentinel checking */ dp_del_event (dp_display,EV_DISCONNECT_PENDING_TIMEOUT );dp_display_disable (dp_display,0 );
@@ -1445,7 +1443,7 @@ int msm_dp_display_disable(struct msm_dp *dp, struct drm_encoder *encoder)/* completed disconnection */ dp_display->hpd_state =ST_DISCONNECTED ; }else { - dp_display->hpd_state =ST_SUSPEND_PENDING ; + dp_display->hpd_state =ST_DISPLAY_OFF ; }mutex_unlock (&dp_display->event_mutex);
drivers/gpu/drm/msm/dp/dp_panel.c +5 -0
@@ -196,6 +196,11 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel, &panel->aux->ddc);if (!dp_panel->edid) {DRM_ERROR ("panel edid read failed\n" ); +/* check edid read fail is due to unplug */ +if (!dp_catalog_hpd_get_state_status (panel->catalog)) { + rc = -ETIMEDOUT ; + goto end; + }/* fail safe edid */ mutex_lock (&connector->dev->mode_config.mutex);
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project