mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v7 00/20] Add HPD support for Rockchip Analogix DP
@ 2026-11-25 11:21 Damon Ding
  2026-11-25 11:21 ` [PATCH v7 01/20] drm/bridge: Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE Damon Ding
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: Damon Ding @ 2026-11-25 11:21 UTC (permalink / raw)
  To: Andrzej Hajda, Neil Armstrong, Robert Foss, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, David Airlie, Simona Vetter,
	Jingoo Han, Inki Dae, Seung-Woo Kim, Kyungmin Park,
	Krzysztof Kozlowski, Peter Griffin, Alim Akhtar, Heiko Stuebner,
	Sandy Huang, Andy Yan
  Cc: Laurent Pinchart, Jonas Karlman, Jernej Skrabec, Luca Ceresoli,
	Dmitry Baryshkov, Marek Szyprowski, linux-kernel, dri-devel,
	linux-arm-kernel, linux-samsung-soc, linux-rockchip, Damon Ding

This series improves the HPD (Hotplug Detect) interrupt handling in
the Analogix DP driver to enable reliable native HPD pin detection on
Rockchip platforms, and introduces platform-specific HPD detection
schemes with fine-grained interrupt control.

On Rockchip platforms, the Analogix DP native HPD pin IRQ requires the
DP controller to remain powered, clocked and initialized to generate
plug/unplug interrupts. The previous driver enabled/disabled IRQ during
bridge enable/disable, which left no HPD detection when the display
pipeline was inactive. Additionally, the interrupt mute/unmute/clear
routines operated on all HPD interrupt bits unconditionally, lacking
the granularity needed for per-event control.

The series reorganizes IRQ and pm_runtime management into bind/unbind,
adds IRQF_ONESHOT to eliminate read-modify-write races on interrupt
mask registers between hardirq and threaded handlers, converts the
interrupt type detection to a bitmask-based scheme for fine-grained
mute/unmute/clear operations, and configures Rockchip platforms to use
the HOTPLUG_CHG interrupt with a 2ms HPD deglitch setting for better
stability.

Furthermore, the next bridge is now resolved into bridge->next_bridge
instead of the platform data field, the forced connected-status logic
is restricted to panel endpoints based on the bridge chain, and HPD
events from downstream bridges (e.g. display-connector with hpd-gpios)
are handled through the .hpd_notify callback. The DRM_BRIDGE_OP_HPD
capability and the hotplug IRQ are only enabled for the platforms
which actually support hotplug detection, and the fixed panels are
excluded from the hotplug reporting.

Tested on RK3576 with both native HPD pin and GPIO HPD configurations.

Case 1: No display-connector mode (native HPD pin):

  &edp {
      status = "okay";
      pinctrl-names = "default";
      pinctrl-0 = <&edp_txm0_pins>;
  };

Case 2: No display-connector mode (HPD GPIO):

  &edp {
      status = "okay";
      pinctrl-names = "default";
      pinctrl-0 = <&edp0_hpd>;
      hpd-gpios = <&gpio4 RK_PC1 GPIO_ACTIVE_HIGH>;
  };

  &pinctrl {
      edp {
          edp0_hpd: edp0-hpd {
              rockchip,pins = <4 RK_PC1 0 &pcfg_pull_none>;
          };
      };
  };

Case 3: Display-connector mode (native HPD pin, the &edp node as in case 1):

  dp-con {
      compatible = "dp-connector";
      label = "DP OUT";
      type = "full-size";

      port {
          dp_con_in: endpoint {
              remote-endpoint = <&edp_out_conn>;
          };
      };
  };

Case 4: Display-connector mode (HPD GPIO on the eDP node, the &edp node
as in case 2):

  dp-con {
      compatible = "dp-connector";
      label = "DP OUT";
      type = "full-size";

      port {
          dp_con_in: endpoint {
              remote-endpoint = <&edp_out_conn>;
          };
      };
  };

Case 5: Display-connector mode (HPD GPIO on the connector):

  dp-con {
      compatible = "dp-connector";
      label = "DP OUT";
      type = "full-size";
      pinctrl-0 = <&edp0_hpd>;
      pinctrl-names = "default";
      hpd-gpios = <&gpio4 RK_PC1 GPIO_ACTIVE_HIGH>;

      port {
          dp_con_in: endpoint {
              remote-endpoint = <&edp_out_conn>;
          };
      };
  };

All five configurations detect cable plug/unplug events correctly.

Damon Ding (20):
  drm/bridge: Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE
  drm/bridge: analogix_dp: Drop the redundant
    pm_runtime_mark_last_busy() calls
  drm/bridge: analogix_dp: Use bridge->next_bridge instead of plat_data
    field
  drm/bridge: analogix_dp: Restrict forced connected status to panel
    endpoints
  drm/bridge: analogix_dp: Take a runtime PM reference in bridge detect
  drm/bridge: analogix_dp: Return bitmask from
    analogix_dp_get_irq_type()
  drm/bridge: analogix_dp: Check all negative return values for
    &analogix_dp_device.irq
  drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling
  drm/bridge: analogix_dp: Extend clear_hotplug_interrupts to accept IRQ
    bitmask
  drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept
    irq bitmask
  drm/bridge: analogix_dp: Simplify analogix_dp_config_interrupt()
  drm/bridge: analogix_dp: Use platform-specific HPD detection scheme
  drm/bridge: analogix_dp: Skip native HPD interrupt ops for GPIO HPD
  drm/rockchip: analogix_dp: Unbind bridge when connector init fails
  drm/exynos: exynos_dp: Unbind bridge when connector init fails
  drm/bridge: analogix_dp: Move IRQ enable/disable to bind/unbind
  drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin
    detection
  drm/bridge: analogix_dp: Declare DRM_BRIDGE_OP_HPD for hotplug
    reporting
  drm/bridge: analogix_dp: Handle HPD notification from downstream
    bridge
  MAINTAINERS: Add entry for Analogix DP controller bridge

 MAINTAINERS                                   |  11 +
 drivers/gpu/drm/bridge/Kconfig                |   1 +
 drivers/gpu/drm/bridge/analogix/Kconfig       |   1 +
 .../drm/bridge/analogix/analogix_dp_core.c    | 277 ++++++++++++++----
 .../drm/bridge/analogix/analogix_dp_core.h    |  16 +-
 .../gpu/drm/bridge/analogix/analogix_dp_reg.c | 167 +++++++----
 drivers/gpu/drm/exynos/Kconfig                |   1 -
 drivers/gpu/drm/exynos/exynos_dp.c            |  16 +-
 .../gpu/drm/rockchip/analogix_dp-rockchip.c   |   1 +
 include/drm/bridge/analogix_dp.h              |   1 -
 10 files changed, 352 insertions(+), 140 deletions(-)

---

Changes in v2:
- Split IRQ enable/disable logic, handle native HPD pin and
  GPIO/force-HPD modes separately to avoid unbalanced enable_irq()
  calls. (Sashiko)
- Add separate patch for IRQF_ONESHOT to resolve interrupt mask issues
  triggered by interrupt preemption. (Sashiko)
- Update commit messages to align with newly added IRQF_ONESHOT related
  commit.
- Move ANALOGIX_DP_HPD_DEGLITCH_L/ANALOGIX_DP_HPD_DEGLITCH_H configs to
  analogix_dp_reset().
- Add new patch to restrict the forced connected-status shortcut to
  panel endpoints only, allowing DP connector bridges to rely on HPD
  detection. (Reported by Heiko Stuebner)
- Add new patch to handle HPD notification from downstream bridges
  (e.g., display-connector with hpd-gpios).

Changes in v3:
- Reorder the series: convert the IRQ handling to a bitmask and add
  IRQF_ONESHOT before moving IRQ enable/disable to bind/unbind.
- Add new patch to check all negative return values for
  &analogix_dp_device.irq and propagate the actual error code. (Sashiko)
- Rename macro HPD_IRQ to HPD_IRQ_ALL to avoid confusion with the
  DP specification IRQ_HPD, extract the irq_type-to-register bit
  mapping into a shared helper, and drop the unused
  COMMON_INT_4_HPD_IRQ macro.
- Simplify commit messages across the series.
- Add new patch to use bridge->next_bridge instead of the plat_data
  field, resolving the next bridge in
  analogix_dp_aux_done_probing(). (Suggested by Heiko Stuebner)
- Report panel endpoints as always connected from
  analogix_dp_get_plug_in_status() via force_connected_mode, computed
  from the bridge chain at attach time.
- Determine the hpd notify mode from DRM_BRIDGE_OP_HPD on downstream
  bridges that lack DRM_BRIDGE_OP_DETECT.
- Add a MAINTAINERS entry for the Analogix DP controller bridge.

Changes in v4:
- Add Tested-by tag from Heiko.
- Rebase onto latest tree, picking up the two related patch series [0][1].

[0] https://lore.kernel.org/all/20260915-drm-bridge-drm_panel-cleanup-v4-0-30401d9406f3@bootlin.com/
[1] https://lore.kernel.org/all/20260916-drm-bridge-every-panel-v3-0-83afb4f1a707@bootlin.com/

Changes in v5:
- Add four new patches:
  - Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE to fix
    the undefined references for non-Exynos users.
  - Unbind the bridge when drm_bridge_connector_init() fails on the
    Rockchip and Exynos platforms.
  - Declare DRM_BRIDGE_OP_HPD on the Analogix DP bridge and report
    the hotplug events via drm_bridge_hpd_notify().
- Move the next_bridge resolving patch and the forced connected
  status restriction to the front of the series.
- Use a pure threaded IRQ handler and hold runtime PM references in
  the IRQ thread and the detect paths. (Sashiko)
- Limit the runtime PM holding to the RK3576/RK3588 platforms and
  exclude the boards with a fixed panel. (Sashiko)
- Fix the display timings leak in analogix_dp_aux_done_probing().
  (Sashiko)
- Change the type of &analogix_dp_device.irq to int to fix the dead
  dp->irq < 0 check. (Sashiko)
- Rebase onto the latest drm-misc-next.

Changes in v6:
- Skip the runtime PM reference in the IRQ thread for the GPIO HPD
  mode, since it only reads the GPIO level. (Sashiko)
- Enable the hotplug IRQ only for the platforms which support hotplug
  detection (the GPIO HPD mode, or the native HPD mode on RK3576 and
  RK3588). (Sashiko)
- Exclude the force-connected and force-HPD modes from the hotplug
  detection support check. (Sashiko)
- Declare DRM_BRIDGE_OP_HPD only for the platforms which support
  hotplug detection, since the drm core stops polling the connector
  once DRM_BRIDGE_OP_HPD is declared. (Sashiko)
- Return the cached connection status instead of connector->status
  from analogix_dp_bridge_detect(), as connector->status may still be
  unknown before the first HPD notification or stale after the sysfs
  state forcing. (Sashiko)
- Add Tested-by tags from Heiko and Marek.

Changes in v7:
- Add a patch to drop the redundant pm_runtime_mark_last_busy()
  calls, as pm_runtime_put_autosuspend() updates the last busy stamp
  since commit b3db492e8335.
- Move the runtime PM reference handling in
  analogix_dp_bridge_detect() to a separate patch, and add the Fixes
  and Reported-by tags for it.
- Derive analogix_dp_require_pm_for_hpd_irq() from
  analogix_dp_supports_hpd(), so that the runtime PM reference is
  explicitly a subset of the platforms which support hotplug
  detection.
- Track the hotplug IRQ enable state for an idempotent enable/disable,
  and gate the IRQ around the runtime PM transitions only for the
  platforms which hold the runtime PM reference, so that the GPIO HPD
  mode keeps detecting the plug events while the display is off.
  (Sashiko)
- Set the bridge ops after the chain is attached, as the
  DRM_BRIDGE_OP_HPD declaration previously preceded the
  force_connected_mode initialization, leaving the hotplug detection
  broken on fixed panels with a wired HPD GPIO. (Sashiko)
- Probe the sink over the AUX channel in the hpd notify mode instead
  of relying on the notified status, and skip the HPD polling and the
  AUX probe where they are not needed. (Sashiko)
- Exclude the hpd notify mode from analogix_dp_supports_hpd(), so
  that neither DRM_BRIDGE_OP_HPD is declared nor the hotplug IRQ is
  enabled for the muted native interrupts. (Sashiko)
- Drop the Tested-by tags of the patches whose design changed
  significantly in this version.
- Add Fixes tags to the two unbind fixes.
- Rebase onto the latest drm-misc-next.

-- 
2.34.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-11-25 11:22 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 11:21 [PATCH v7 00/20] Add HPD support for Rockchip Analogix DP Damon Ding
2026-11-25 11:21 ` [PATCH v7 01/20] drm/bridge: Select VIDEOMODE_HELPERS for DRM_OF_DISPLAY_MODE_BRIDGE Damon Ding
2026-11-25 11:21 ` [PATCH v7 02/20] drm/bridge: analogix_dp: Drop the redundant pm_runtime_mark_last_busy() calls Damon Ding
2026-11-25 11:21 ` [PATCH v7 03/20] drm/bridge: analogix_dp: Use bridge->next_bridge instead of plat_data field Damon Ding
2026-11-25 11:21 ` [PATCH v7 04/20] drm/bridge: analogix_dp: Restrict forced connected status to panel endpoints Damon Ding
2026-11-25 11:21 ` [PATCH v7 05/20] drm/bridge: analogix_dp: Take a runtime PM reference in bridge detect Damon Ding
2026-11-25 11:21 ` [PATCH v7 06/20] drm/bridge: analogix_dp: Return bitmask from analogix_dp_get_irq_type() Damon Ding
2026-11-25 11:21 ` [PATCH v7 07/20] drm/bridge: analogix_dp: Check all negative return values for &analogix_dp_device.irq Damon Ding
2026-11-25 11:21 ` [PATCH v7 08/20] drm/bridge: analogix_dp: Add IRQF_ONESHOT and simplify IRQ handling Damon Ding
2026-11-25 11:21 ` [PATCH v7 09/20] drm/bridge: analogix_dp: Extend clear_hotplug_interrupts to accept IRQ bitmask Damon Ding
2026-11-25 11:21 ` [PATCH v7 10/20] drm/bridge: analogix_dp: Extend mute/unmute HPD interrupts to accept irq bitmask Damon Ding
2026-11-25 11:21 ` [PATCH v7 11/20] drm/bridge: analogix_dp: Simplify analogix_dp_config_interrupt() Damon Ding
2026-11-25 11:21 ` [PATCH v7 12/20] drm/bridge: analogix_dp: Use platform-specific HPD detection scheme Damon Ding
2026-11-25 11:21 ` [PATCH v7 13/20] drm/bridge: analogix_dp: Skip native HPD interrupt ops for GPIO HPD Damon Ding
2026-11-25 11:21 ` [PATCH v7 14/20] drm/rockchip: analogix_dp: Unbind bridge when connector init fails Damon Ding
2026-11-25 11:21 ` [PATCH v7 15/20] drm/exynos: exynos_dp: " Damon Ding
2026-11-25 11:21 ` [PATCH v7 16/20] drm/bridge: analogix_dp: Move IRQ enable/disable to bind/unbind Damon Ding
2026-11-25 11:21 ` [PATCH v7 17/20] drm/bridge: analogix_dp: Manage pm runtime and IRQ for native HPD pin detection Damon Ding
2026-11-25 11:21 ` [PATCH v7 18/20] drm/bridge: analogix_dp: Declare DRM_BRIDGE_OP_HPD for hotplug reporting Damon Ding
2026-11-25 11:21 ` [PATCH v7 19/20] drm/bridge: analogix_dp: Handle HPD notification from downstream bridge Damon Ding
2026-11-25 11:21 ` [PATCH v7 20/20] MAINTAINERS: Add entry for Analogix DP controller bridge Damon Ding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®