public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: drm/bridge: ite-it66121: Switch to the HDMI connector helpers
Date: Mon, 25 May 2026 17:50:13 +1000	[thread overview]
Message-ID: <review-patch1-20260523-it66121-fix-dvi-mode-v5-v5-1-33b4468162f9@redhat.com> (raw)
In-Reply-To: <20260523-it66121-fix-dvi-mode-v5-v5-1-33b4468162f9@redhat.com>

Patch Review

**Build error — undefined symbol:**

The `it66121_bridge_hdmi_tmds_char_rate_valid()` function uses `HDMI_TMDS_CHAR_RATE_MIN_HZ`:
```c
if (tmds_rate < HDMI_TMDS_CHAR_RATE_MIN_HZ)
    return MODE_CLOCK_LOW;
```
This macro is not defined anywhere in the kernel tree. The original code used `mode->clock < 25000` (25 MHz in kHz). This needs to be either defined locally (e.g., `#define HDMI_TMDS_CHAR_RATE_MIN_HZ 25000000ULL`) or replaced with a literal `25000000ULL`. The sister driver `ite-it6263.c` defines its own `MAX_HDMI_TMDS_CHAR_RATE_HZ` locally, suggesting local definition is the expected pattern.

**VSIF write — no length bounds check:**

The VSIF write function writes the full buffer directly to registers starting at `IT66121_PKT_NULL_HB(0)` (0x138):
```c
ret = regmap_bulk_write(ctx->regmap, IT66121_PKT_NULL_HB(0), buffer, len);
```
There is no validation that `len` fits within the available null packet register space. The AVI infoframe write is careful to write exactly `HDMI_AVI_INFOFRAME_SIZE` bytes, and the audio infoframe uses `min_t(size_t, len - HDMI_INFOFRAME_HEADER_SIZE, 5)` to clamp. The VSIF write should have similar protection, or at least a comment documenting the maximum supported size. In practice the framework sends well-formed packets, so this is a minor robustness concern rather than a functional bug.

**Locking asymmetry between clear and write callbacks:**

The `write_*` callbacks all acquire `ctx->lock`, but the `clear_*` callbacks do not:
```c
static int it66121_bridge_hdmi_clear_avi_infoframe(struct drm_bridge *bridge)
{
    struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);
    return regmap_write(ctx->regmap, IT66121_AVI_INFO_PKT_REG, 0);
}
```
Since these are all called from the serialized atomic commit path, this is safe in practice. However, the inconsistency is worth noting — if `ctx->lock` protects register access, the clears should arguably also take it for defensive consistency.

**Rate conversion correctness:**

The max rate conversion from kHz to Hz is correct:
- Old: `max_clock = (ctx->bus_width == 12) ? 74250 : 148500` (kHz, compared against `mode->clock`)
- New: `max_rate = (ctx->bus_width == 12) ? 74250000ULL : 148500000ULL` (Hz, compared against `tmds_rate`)

**Audio infoframe data clamped to 5 bytes:**
```c
min_t(size_t, len - HDMI_INFOFRAME_HEADER_SIZE, 5)
```
This is correct for the IT66121 register layout where `IT66121_AUD_INFO_DB1_REG` (0x168) through 0x16C provides 5 data registers, with the checksum at 0x16D.

**Bridge configuration in probe looks correct:**
```c
ctx->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |
                  DRM_BRIDGE_OP_HDMI;
ctx->bridge.vendor = "ITE";
ctx->bridge.product = "IT66121";
```
Adding `DRM_BRIDGE_OP_HDMI` and the vendor/product strings are required for the HDMI helper framework.

**Calling `drm_atomic_helper_connector_hdmi_update_audio_infoframe` outside the lock in audio_prepare:**
```c
out:
    mutex_unlock(&ctx->lock);

    if (!ret)
        ret = drm_atomic_helper_connector_hdmi_update_audio_infoframe(connector,
                                                                      &params->cea);
    return ret;
```
This is correct — the helper will call back into `hdmi_write_audio_infoframe` which acquires the lock itself, so calling it outside the outer lock avoids deadlock.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-25  7:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-23 10:40 [PATCH v5 0/3] drm/bridge: ite-it66121: Switch to HDMI helpers and fix DVI output Javier Martinez Canillas
2026-05-23 10:40 ` [PATCH v5 1/3] drm/bridge: ite-it66121: Switch to the HDMI connector helpers Javier Martinez Canillas
2026-05-25  7:50   ` Claude Code Review Bot [this message]
2026-05-23 10:40 ` [PATCH v5 2/3] drm/bridge: ite-it66121: Move .mode_set logic to .atomic_enable Javier Martinez Canillas
2026-05-25  7:50   ` Claude review: " Claude Code Review Bot
2026-05-23 10:41 ` [PATCH v5 3/3] drm/bridge: ite-it66121: Select HDMI or DVI mode based on sink type Javier Martinez Canillas
2026-05-25  7:50   ` Claude review: " Claude Code Review Bot
2026-05-25  7:50 ` Claude review: drm/bridge: ite-it66121: Switch to HDMI helpers and fix DVI output Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-15  9:02 [PATCH v4 0/3] drm/bridge: ite-it66121: Fix display output for DVI monitors Javier Martinez Canillas
2026-05-15  9:02 ` [PATCH v4 1/3] drm/bridge: ite-it66121: Switch to the HDMI connector helpers Javier Martinez Canillas
2026-05-15 23:32   ` Claude review: " Claude Code Review Bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=review-patch1-20260523-it66121-fix-dvi-mode-v5-v5-1-33b4468162f9@redhat.com \
    --to=claude-review@example.com \
    --cc=dri-devel-reviews@example.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox