On platforms with a native DisplayPort connector using direct HPD
interrupts, DisplayPort initializes on cold boot, but physical cable
unplug and re-plug cycles leave the display blank even though link
training and stream enable callbacks report success. Platforms using an
external HPD bridge (such as USB Type-C AltMode or display-connector
with hpd-gpios) also fail link-rate/lane downshifting, EDID unplug
checks, AUX resets, and branch dongle disconnect checks because internal
HPD state registers remain disabled.
This series fixes the underlying PHY lane setup, DPCD link-info caching,
SST training-pattern handover, link maintenance completion/stream
handling, external-HPD state checks, and HPD / sink_count / runtime-PM /
PHY / EDID state tracking issues:
1. Configure PHY voltage swing and pre-emphasis across all active lanes
and refresh lanes/link_rate in msm_dp_ctrl_set_vx_px().
2. Zero out cached link_info in msm_dp_panel_read_dpcd() so re-plugging
a different sink does not reuse stale rate, use_rate_set, or
capability flags.
3. Avoid redundant back-to-back link training in
msm_dp_display_prepare_link() and keep DP_TRAINING_PATTERN_SET active
until msm_dp_ctrl_on_stream() is ready to switch REG_DP_STATE_CTRL to
DP_STATE_CTRL_SEND_VIDEO.
4. Guard msm_dp_ctrl_push_idle(), reinitialize ctrl->video_comp, keep
training pattern active until stream clocks are enabled in
msm_dp_ctrl_link_maintenance(), disable the stream pixel clock if
waiting for video ready fails in msm_dp_ctrl_on_stream(), and
serialize stream enable/disable under dp->plugged_lock.
5. Use asynchronous pm_runtime_put() on HPD unplug/notify paths called
from msm_dp_display_irq_thread() to avoid a synchronous disable_irq()
self-deadlock in msm_dp_pm_runtime_suspend().
6. Track drm_dp_read_sink_count_cap() in link->has_sink_count, keep
sink_count and prev_sink_count synchronized across plug and unplug,
and reset sink_count if msm_dp_display_process_hpd_high() fails.
7. Keep dp->plugged, AUX transfer enablement, and runtime PM references
balanced across plug, unplug, detect, prepare_link, and branch dongle
downstream plug/unplug notifications.
8. Track link preparation via dp->prepared under dp->plugged_lock and
keep the DP PHY initialized across msm_dp_display_unprepare() and
system sleep while a sink remains plugged in (removing now-unused
msm_dp_ctrl_reinit_phy()).
9. Re-read EDID on demand in msm_dp_display_get_modes() when
edid_blob_ptr is NULL (e.g. after DRM_FORCE_OFF).
10. Track internal HPD block enablement via msm_dp_aux_is_hpd_enabled()
so external-HPD platforms do not abort link-rate/lane downshifting,
EDID reads, AUX resets, or branch dongle disconnect checks on
disabled internal HPD status, while keeping msm_dp_bridge_detect()'s
!priv->plugged && !ret guard unconditional so USB Type-C connectors
using drm_aux_hpd_bridge stay disconnected until AltMode mux and
orientation setup notify HPD.
11. Dispatch DP_DP_IRQ_HPD_INT_MASK to msm_dp_irq_hpd_handle(), skipping
sink requests when mainlink clocks are off and emitting bridge HPD
notifications on branch DS_PORT_STATUS_CHANGED events (kept at the
end of the series so it can be dropped if superseded by in-flight
DRM_CONNECTOR_DP_IRQ_HPD changes).
Changes in v3:
- Patch 4: serialize msm_dp_display_enable(), msm_dp_display_disable(),
and msm_dp_display_atomic_disable() under dp->plugged_lock so stream
bring-up and teardown cannot race with msm_dp_ctrl_link_maintenance(),
and disable the stream pixel clock in msm_dp_ctrl_on_stream() if
msm_dp_ctrl_wait4video_ready() fails.
- Patch 6: reset dp->link->sink_count to 0 if
msm_dp_display_process_hpd_high() fails after reading link caps.
- Patch 7: re-run msm_dp_display_process_hpd_high() in
msm_dp_hpd_plug_handle() when dp->plugged is already set with
sink_count == 0, reset dp->link->has_sink_count on initial plug error
unwind, check dp->plugged and sink_count before
pm_runtime_resume_and_get() in msm_dp_display_prepare_link(), check
live drm_dp_read_sink_count() and clear downstream sink state in
msm_dp_display_is_dongle_plugged() when a downstream monitor is
unplugged from an attached branch dongle via external HPD or detect(),
and require dp->plugged in msm_dp_display_enable().
- Patch 8: track link preparation explicitly via dp->prepared under
dp->plugged_lock so msm_dp_display_unprepare() skips link teardown and
runtime PM put when prepare_link() did not bring up the link, and
msm_dp_hpd_unplug_handle() does not call phy_exit() while the PHY is
still powered on.
- Patch 10 (new): track msm_dp_aux_is_hpd_enabled() and check
drm_dp_dpcd_read_link_status() <= 0 in msm_dp_ctrl_on_link() so
external-HPD platforms (USB Type-C AltMode, display-connector with
hpd-gpios) properly downshift link rate/lanes, reset AUX, and handle
branch dongles without breaking USB-C cold-boot ordering in
msm_dp_bridge_detect().
- Patch 11 (was 10): reuse msm_dp_display_clear_downstream_sink() in
msm_dp_display_handle_ds_port_status().
- Link to v2:
https://lore.kernel.org/r/[email protected]
Changes in v2:
- Add Jens Glathe's Tested-by on unchanged patches 1, 3, and 5.
- Patch 1: clarify commit message regarding persistent ctrl->phy_opts
staleness on link maintenance and update Fixes tag to 937f941ca06f.
- Patch 2: zero out the entire link_info struct (rate, use_rate_set,
and capabilities) before parsing DPCD.
- Patch 4: drop redundant msm_dp_ctrl_configure_source_params() call,
guard msm_dp_ctrl_push_idle() and training-pattern clear with
stream_clks_on, and update Fixes tag to 8ede2ecc3e5e.
- Reorder and split HPD changes (was patch 7) into four focused patches
(patches 6-9).
- Patch 10 (was 5): move to end of series, guard with link_clks_on and
dp->plugged, and handle branch DS_PORT_STATUS_CHANGED with
non-reentrant drm_bridge_hpd_notify().
- Link to v1:
https://lore.kernel.org/r/[email protected]
Testing:
Hardware-tested across cold boot, unplug/re-plug, monitor swap (4K60
native DP and DP-to-HDMI branch adapters), connector DPMS/off cycles,
and IRQ_HPD link-retrain cycles on:
- QCS8275 (Monaco, SECO F86 SMARC): 4-lane native DisplayPort with
internal HPD.
- QCS6490 (SC7280, SECO E81 SMARC):
- Direct 2-lane DisplayPort + USB3 and direct 4-lane DisplayPort over
the QMP USB3+DP Combo PHY with internal HPD (dp_hot_plug_det) and
with external GPIO HPD (display-connector hpd-gpios).
- USB Type-C DisplayPort AltMode via pmic_glink_altmode
(drm_aux_hpd_bridge) and gpio-sbu-mux (SECO G15 carrier).
All tests were run on v6.18 + the FROMLIST DP HPD/MST series (Qualcomm
Linux / QLI 2.0), then forward-ported and build-tested against msm-next.
Signed-off-by: Gianfranco Mariotti <[email protected]>
Gianfranco Mariotti (11):
drm/msm/dp: configure voltage swing and pre-emphasis for all active
lanes
drm/msm/dp: reset cached link_info before reading DPCD capabilities
drm/msm/dp: keep training pattern active until stream video is ready
drm/msm/dp: reinit video_comp and guard stream state on link
maintenance
drm/msm/dp: avoid synchronous runtime PM put from HPD IRQ thread
drm/msm/dp: track DP_SINK_COUNT capability and sync prev_sink_count
drm/msm/dp: fix HPD plugged, AUX gate, and runtime PM tracking
drm/msm/dp: keep PHY initialized while plugged across link unprepare
drm/msm/dp: re-read EDID on demand in get_modes when blob is missing
drm/msm/dp: guard internal HPD state checks when external HPD is used
drm/msm/dp: dispatch native IRQ_HPD directly to
msm_dp_irq_hpd_handle()
drivers/gpu/drm/msm/dp/dp_aux.c | 13 +-
drivers/gpu/drm/msm/dp/dp_aux.h | 1 +
drivers/gpu/drm/msm/dp/dp_ctrl.c | 62 +++---
drivers/gpu/drm/msm/dp/dp_ctrl.h | 1 -
drivers/gpu/drm/msm/dp/dp_display.c | 299 +++++++++++++++++++++-------
drivers/gpu/drm/msm/dp/dp_link.c | 26 ++-
drivers/gpu/drm/msm/dp/dp_link.h | 2 +
drivers/gpu/drm/msm/dp/dp_panel.c | 20 +-
8 files changed, 310 insertions(+), 114 deletions(-)
base-commit: d024361c631b3f020a26c07d683e5103404b0fbf
--
2.25.1