]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/msm/dp: postpone irq_hpd event during connection pending state
authorKuogee Hsieh <khsieh@codeaurora.org>
Fri, 18 Dec 2020 17:53:40 +0000 (09:53 -0800)
committerRob Clark <robdclark@chromium.org>
Thu, 7 Jan 2021 17:11:02 +0000 (09:11 -0800)
irq_hpd event can only be executed at connected state. Therefore
irq_hpd event should be postponed if it happened at connection
pending state. This patch also make sure both link rate and lane
are valid before start link training.

Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/dp/dp_display.c
drivers/gpu/drm/msm/dp/dp_panel.c

index 6e971d552911f67f8a091286156fec05eb5cb623..3bc7ed21de2863823b1800b89bddf8d60cf54e7d 100644 (file)
@@ -693,6 +693,13 @@ static int dp_irq_hpd_handle(struct dp_display_private *dp, u32 data)
                return 0;
        }
 
+       if (state == ST_CONNECT_PENDING) {
+               /* wait until ST_CONNECTED */
+               dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */
+               mutex_unlock(&dp->event_mutex);
+               return 0;
+       }
+
        ret = dp_display_usbpd_attention_cb(&dp->pdev->dev);
        if (ret == -ECONNRESET) { /* cable unplugged */
                dp->core_initialized = false;
index 97dca3e378b7bf841d7d8103b9172c19ce5ec6a9..d1780bcac8cc8a49a59e750b2025c450d906077b 100644 (file)
@@ -167,12 +167,18 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
        panel = container_of(dp_panel, struct dp_panel_private, dp_panel);
 
        rc = dp_panel_read_dpcd(dp_panel);
+       if (rc) {
+               DRM_ERROR("read dpcd failed %d\n", rc);
+               return rc;
+       }
+
        bw_code = drm_dp_link_rate_to_bw_code(dp_panel->link_info.rate);
-       if (rc || !is_link_rate_valid(bw_code) ||
+       if (!is_link_rate_valid(bw_code) ||
                        !is_lane_count_valid(dp_panel->link_info.num_lanes) ||
                        (bw_code > dp_panel->max_bw_code)) {
-               DRM_ERROR("read dpcd failed %d\n", rc);
-               return rc;
+               DRM_ERROR("Illegal link rate=%d lane=%d\n", dp_panel->link_info.rate,
+                               dp_panel->link_info.num_lanes);
+               return -EINVAL;
        }
 
        if (dp_panel->dfp_present) {