Skip to content

drm/bridge: dw-hdmi-qp: limit DDC i2c retries on NACK#513

Merged
SuperKali merged 1 commit into
armbian:rk-6.1-rkr5.1from
OpenSource-YYT:dw-hdmi-qp-nack-retry
Jul 8, 2026
Merged

drm/bridge: dw-hdmi-qp: limit DDC i2c retries on NACK#513
SuperKali merged 1 commit into
armbian:rk-6.1-rkr5.1from
OpenSource-YYT:dw-hdmi-qp-nack-retry

Conversation

@SuperKali

Copy link
Copy Markdown
Member

On a YY3588 driving a 1080p120 sink the boot log fills with over a hundred lines during the first modeset:

dwhdmi-rockchip fde80000.hdmi: i2c write nack!
dwhdmi-rockchip fde80000.hdmi: ddc write failed

The controller writes SCDC (I2C slave 0x54) while setting up the mode. The monitor advertises SCDC in its HF-VSDB but does not answer that slave, so every access is NACKed. The i2c read and write paths treated a NACK like a transient error and retried it 100 times with a 10ms sleep each, which both floods the log and stalls the modeset for about a second per transfer.

A NACK means no device answered at that address, so this caps the retries at three and demotes the per-attempt message to debug. The single "ddc read/write failed" error is kept, since a genuine DDC failure (a real EDID read on hotplug) still deserves a line.

Tested on a YY3588 (EVB7 V11, vendor kernel 6.1.115): the "i2c write nack" flood drops from 113 lines to 0, leaving a couple of "ddc write failed" lines, and the display still comes up at 1080p120.

A NACK on the DDC bus means no device answered at that address, which is
definitive rather than transient, but the i2c read and write paths retried
it 100 times with a 10ms sleep each. A sink that advertises SCDC in its
HF-VSDB yet does not answer its 0x54 slave then produced ~100 error lines
per transfer and stalled the modeset for about a second. Cap NACK retries
at three and demote the per-attempt message to debug, keeping the single
"ddc read/write failed" error.

Signed-off-by: SuperKali <hello@superkali.me>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This change modifies the dw-hdmi-qp DRM bridge driver's DDC I2C transaction handling. A new DW_HDMI_QP_I2C_NACK_RETRIES constant is introduced to cap retries specifically for I2C NACK responses. Both dw_hdmi_i2c_read() and dw_hdmi_i2c_write() now use a separate nack_retry counter, decremented on I2CM_NACK_RCVD_IRQ events, distinct from the general retry counter. Once nack_retry is exhausted, the retry loop is forcibly terminated by setting retry to 0 and breaking. Timeout-based retry logic remains unchanged.

Estimated code review effort: 2 (Simple) | ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: limiting dw-hdmi-qp DDC I2C retries on NACK.
Description check ✅ Passed The description directly matches the changeset and explains the NACK retry reduction clearly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c`:
- Around line 1198-1206: The NACK retry path in the DDC/I2C write flow is
advancing the target register too early, so a transient retry can write to the
next address instead of the original one. Update the write logic around the
`dw_hdmi_qp` DDC transfer path to preserve the current `i2c->slave_reg` across
retries, and only advance the register after a successful byte write in the loop
that uses `hdmi_writel`, `hdmi_modb`, and the NACK `continue` branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82e09cb0-6a82-4c1e-96ea-77d4f7245f3a

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd878b and 9d905f8.

📒 Files selected for processing (1)
  • drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c

Comment thread drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c
@SuperKali SuperKali merged commit bb8f02b into armbian:rk-6.1-rkr5.1 Jul 8, 2026
2 checks passed
@SuperKali SuperKali deleted the dw-hdmi-qp-nack-retry branch July 8, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant