1 From fa76cd6f0ed305fb2870083842b1ff7bcf027655 Mon Sep 17 00:00:00 2001
2 From: Sandor Yu <Sandor.yu@nxp.com>
3 Date: Mon, 9 Dec 2019 17:52:35 +0800
4 Subject: [PATCH] LF-323-1: drm/bridge/cdns: move link training to bridge
7 Move link training and video enable functions from mode_set to
8 bridge_enable. it is more reasonable.
9 cdns_dp_mode_set don't needed in HPD thread, DP link training will
10 resetup in bridge_enable when cable connecting.
12 Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
13 Reviewed-by: Robby Cai <robby.cai@nxp.com>
15 drivers/gpu/drm/bridge/cadence/cdns-dp-core.c | 34 +++++++++++++--------------
16 1 file changed, 16 insertions(+), 18 deletions(-)
18 --- a/drivers/gpu/drm/bridge/cadence/cdns-dp-core.c
19 +++ b/drivers/gpu/drm/bridge/cadence/cdns-dp-core.c
20 @@ -178,19 +178,6 @@ static void cdns_dp_mode_set(struct cdns
24 - /* Link trainning */
25 - ret = cdns_mhdp_train_link(mhdp);
27 - DRM_DEV_ERROR(mhdp->dev, "Failed link train %d\n", ret);
31 - ret = cdns_mhdp_set_video_status(mhdp, CONTROL_VIDEO_VALID);
33 - DRM_DEV_ERROR(mhdp->dev, "Failed to valid video %d\n", ret);
40 @@ -339,6 +326,21 @@ static void cdns_dp_bridge_mode_set(stru
42 static void cdn_hdp_bridge_enable(struct drm_bridge *bridge)
44 + struct cdns_mhdp_device *mhdp = bridge->driver_private;
47 + /* Link trainning */
48 + ret = cdns_mhdp_train_link(mhdp);
50 + DRM_DEV_ERROR(mhdp->dev, "Failed link train %d\n", ret);
54 + ret = cdns_mhdp_set_video_status(mhdp, CONTROL_VIDEO_VALID);
56 + DRM_DEV_ERROR(mhdp->dev, "Failed to valid video %d\n", ret);
61 static void cdn_hdp_bridge_disable(struct drm_bridge *bridge)
62 @@ -366,11 +368,7 @@ static void hotplug_work_func(struct wor
63 drm_helper_hpd_irq_event(connector->dev);
65 if (connector->status == connector_status_connected) {
66 - /* reset video mode after cable plugin */
67 - mutex_lock(&mhdp->lock);
68 - cdns_dp_mode_set(mhdp);
69 - mutex_unlock(&mhdp->lock);
71 + /* Cable connedted */
72 DRM_INFO("HDMI/DP Cable Plug In\n");
73 enable_irq(mhdp->irq[IRQ_OUT]);
74 } else if (connector->status == connector_status_disconnected) {