• Kuogee Hsieh's avatar
    drm/msm/dp: tear down main link at unplug handle immediately · 375a1260
    Kuogee Hsieh authored
    Two stages are required to setup up main link to be ready to transmit
    video stream.
    Stage 1: dp_hpd_plug_handle() perform link training to set up main link
    stage 2: user space framework (msm_dp_display_enable()) to enable pixel
    clock and transfer main link to video ready state.
    
    At current implementation, when dongle unplugged dp_hdp_unplug_handle()
    has to wait until stage 2 completed before it can send link down uevent
    to user space framework to disable pixel clock followed by tearing down
    main link.  This introduce unnecessary latency if dongle unplugged happen
    after stage 1 and before stage 2. It also has possibility leave main link
    stay at ready state after dongle unplugged if framework does not response
    to link down uevent notification. This will prevent next dongle plug in
    from working. This scenario could possibly happen when dongle unplug while
    system in the middle of suspending.
    
    This patch allow unplug handle to tear down main link and notify
    framework link down immediately if dongle unplugged happen after
    stage 1 and before stage 2. With this approach, dp driver is much
    more resilient to any different scenarios. Also redundant both
    dp_connect_pending_timeout() and dp_disconnect_pending_timeout()
    are removed to reduce logic complexity.
    
    Changes in V2:
    -- return -EINVAL at msm_dp_display_enable() if not in correct state
    -- replace ST_CONNECT_PENDING with ST_MAINLINK_READY
    
    Fixes: 8ede2ecc ("drm/msm/dp: Add DP compliance tests on Snapdragon Chipsets")
    Signed-off-by: default avatarKuogee Hsieh <quic_khsieh@quicinc.com>
    Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
    Patchwork: https://patchwork.freedesktop.org/patch/483391/
    Link: https://lore.kernel.org/r/1650927382-22461-1-git-send-email-quic_khsieh@quicinc.com
    [DB: fixed return values due to conversion to function merge]
    Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
    375a1260
dp_ctrl.h 1.2 KB