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-it6263: Support power cycle in runtime
Date: Thu, 23 Apr 2026 08:33:49 +1000	[thread overview]
Message-ID: <review-patch1-20260421105334.43411-1-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20260421105334.43411-1-biju.das.jz@bp.renesas.com>

Patch Review

**1. Regmap cache stale after power cycle (bug)**

Both the HDMI and LVDS regmaps are configured with `REGCACHE_MAPLE` (lines 305, 344 of the original). After `it6263_hw_reset()` resets the chip in `atomic_enable`, all hardware registers return to their default values, but the regmap caches still hold the values from the previous enable cycle.

This is a problem because `it6263_lvds_config()` → `it6263_lvds_reset()`, `it6263_lvds_set_interface()`, `it6263_lvds_set_afe()`, and `it6263_lvds_sys_cfg()` all use `regmap_write_bits()`, which performs read-modify-write against the cached value. For example:

```c
/* it6263_lvds_set_interface */
regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, REG_COL_DEP, BIT8);
regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, OUT_MAP, fmt);
regmap_write_bits(it->lvds_regmap, LVDS_REG_2C, DMODE, DISO);
```

On the second `atomic_enable` (after resume), `LVDS_REG_2C` cache holds the value written during the first enable. The actual hardware has its power-on-reset default. The `write_bits` call will preserve the non-masked bits from the stale cache, which may differ from the actual hardware default. The same applies to `LVDS_REG_0B`, `LVDS_REG_52`, and `HDMI_REG_GCP`.

After `it6263_hw_reset()`, the patch should add:
```c
regcache_mark_dirty(it->hdmi_regmap);
regcache_mark_dirty(it->lvds_regmap);
```

This ensures the cache knows it's out of sync with hardware, so subsequent `regmap_write_bits()` reads will go to the actual device rather than returning stale cached values.

**2. Error handling after `it6263_lvds_set_i2c_addr` failure (minor)**

```c
+	ret = it6263_lvds_set_i2c_addr(it);
+	if (ret)
+		dev_err(it->dev, "failed to set I2C addr\n");
+
+	it6263_lvds_config(it);
+	it6263_hdmi_config(it);
```

If `it6263_lvds_set_i2c_addr()` fails, execution continues into `it6263_lvds_config()` which writes to the LVDS regmap. Since the I2C address routing hasn't been configured, those writes will go to an unrouted address — either silently failing or potentially hitting another device on the I2C bus. While `atomic_enable` returns void and can't propagate an error, it should `return` early after this failure to avoid cascading I2C writes to a misconfigured address.

**3. Probe no longer validates hardware presence (design consideration)**

By removing `it6263_hw_reset()` and `it6263_lvds_set_i2c_addr()` from probe, the driver no longer verifies during probe that the chip is physically present and responding over I2C. In the original code, `it6263_lvds_set_i2c_addr()` writes to HDMI registers — a failure there would cause probe to fail, giving early indication of a hardware problem. With this patch, a missing or broken chip won't be detected until the first `atomic_enable`, which changes error semantics. This is acceptable but worth noting.

**4. The structural changes themselves look correct**

The addition of `reset_gpio` to the struct:
```c
+	struct gpio_desc *reset_gpio;
```

and the probe-side change from local to struct member:
```c
-	reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
-	if (IS_ERR(reset_gpio))
-		return dev_err_probe(dev, PTR_ERR(reset_gpio),
+	it->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(it->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(it->reset_gpio),
```

are straightforward and correct. The placement of the new init calls at the top of `atomic_enable` (before the mode/connector lookups) is the right ordering.

---
Generated by Claude Code Patch Reviewer

      parent reply	other threads:[~2026-04-22 22:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 10:53 [PATCH v3] drm/bridge: ite-it6263: Support power cycle in runtime Biju
2026-04-22  6:04 ` Liu Ying
2026-04-22  7:16   ` Biju Das
2026-04-22 22:33 ` Claude review: " Claude Code Review Bot
2026-04-22 22:33 ` Claude Code Review Bot [this message]

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-20260421105334.43411-1-biju.das.jz@bp.renesas.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