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/panel: Add panel driver for ChipWealth CH13726A based panels
Date: Thu, 23 Apr 2026 08:00:15 +1000	[thread overview]
Message-ID: <review-patch2-20260422-ch13726a-v6-2-03680d6673ff@gmail.com> (raw)
In-Reply-To: <20260422-ch13726a-v6-2-03680d6673ff@gmail.com>

Patch Review

**Issue 1 (bug): Incorrect Kconfig selects**

```
+config DRM_PANEL_CHIPWEALTH_CH13726A
+	tristate "CHIPWEALTH CH13726A-based DSI panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	select DRM_DISPLAY_DP_HELPER
+	select DRM_DISPLAY_HELPER
```

`DRM_DISPLAY_DP_HELPER` is for DisplayPort/eDP panels only. In the entire panel Kconfig, the only entries selecting it are `DRM_PANEL_SAMSUNG_ATNA33XC20` (an eDP panel) and `DRM_PANEL_EDP` (the generic eDP panel driver). This DSI panel driver does not use any DP or display helpers — it only uses `drm_mipi_dsi.h`, `drm_panel.h`, and `drm_modes.h`. Both `select` lines should be removed.

**Issue 2 (minor): `thor_bottom_desc` should be `const`**

```c
+static struct ch13726a_desc thor_bottom_desc = {
```

This should be `static const struct ch13726a_desc thor_bottom_desc`. The data is never modified at runtime, and the `of_match_table` `.data` field is `const void *`. This also ties into Issue 3 below.

**Issue 3 (minor): const-correctness for `desc` field**

```c
+struct ch13726a_panel {
+	...
+	struct ch13726a_desc *desc;
+	...
+};
```

The `desc` pointer should be `const struct ch13726a_desc *desc`, since the descriptor data pointed to (from the match table) should never be modified. The assignment in probe:

```c
+	ctx->desc = (struct ch13726a_desc *)of_device_get_match_data(dev);
```

currently casts away the `const` returned by `of_device_get_match_data()` (which returns `const void *`). With a `const` field, the explicit cast would be unnecessary:

```c
	ctx->desc = of_device_get_match_data(dev);
```

**Issue 4 (style): `uint8_t` loop variable**

```c
+	for (uint8_t i = 0; i < ctx->desc->num_modes; i++) {
```

The kernel convention is to use `unsigned int` for loop counters, not fixed-width types like `uint8_t`. A `uint8_t` counter is also fragile — it would silently wrap if `num_modes` ever exceeded 255, though that's admittedly unlikely for display modes.

**Issue 5 (nit): `of_device_get_match_data` vs `device_get_match_data`**

```c
+	ctx->desc = (struct ch13726a_desc *)of_device_get_match_data(dev);
```

Newer panel drivers are moving to the bus-agnostic `device_get_match_data(dev)`. While `of_device_get_match_data` still works, reviewers may prefer the newer API since the driver already `depends on OF` anyway and the function is equivalent for OF-based matching.

**Issue 6 (observation): LPM toggling in disable**

```c
+static int ch13726a_disable(struct drm_panel *panel)
+{
+	...
+	ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+
+	mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
+	mipi_dsi_msleep(&dsi_ctx, 50);
+	mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
```

The disable path clears `MIPI_DSI_MODE_LPM` before sending DCS commands, meaning display-off and enter-sleep are sent in HS mode. Meanwhile `ch13726a_on()` sets `MIPI_DSI_MODE_LPM` to send init commands in LP mode. This asymmetry is present in some other drivers (e.g., `panel-jdi-fhd-r63452.c`), so it may be correct per the panel datasheet, but it's worth confirming that the CH13726A actually requires HS-mode for shutdown commands. If LP mode works for both init and shutdown, the mode_flags manipulation could be simplified.

**Non-issues / things done well:**
- Correct use of `devm_drm_panel_alloc()` (modern allocation pattern)
- Correct use of `devm_regulator_bulk_get_const()` with a static const supply array
- Proper use of `mipi_dsi_multi_context` for init sequence error accumulation
- `prepare_prev_first = true` is appropriate for a DSI video mode panel
- The 120Hz/60Hz mode clock calculations look correct: `(1080+28+4+36) * (1240+16+4+8) * rate / 1000` = `1148 * 1268 * 120 / 1000` = 174,614 for 120Hz
- Backlight via DCS brightness is standard
- Error cleanup paths in prepare and probe are correct

---
Generated by Claude Code Patch Reviewer

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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22  7:43 [PATCH v6 0/2] drm/panel: Add panel driver for ChipWealth CH13726A based panels Aaron Kling via B4 Relay
2026-04-22  7:43 ` [PATCH v6 1/2] dt-bindings: display: panel: Add ChipWealth CH13726A AMOLED driver Aaron Kling via B4 Relay
2026-04-22 22:00   ` Claude review: " Claude Code Review Bot
2026-04-22  7:43 ` [PATCH v6 2/2] drm/panel: Add panel driver for ChipWealth CH13726A based panels Aaron Kling via B4 Relay
2026-04-22 18:50   ` Dmitry Baryshkov
2026-04-22 22:00   ` Claude Code Review Bot [this message]
2026-04-22 22:00 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-04-27  4:39 [PATCH v7 0/2] " Aaron Kling via B4 Relay
2026-04-27  4:39 ` [PATCH v7 2/2] " Aaron Kling via B4 Relay
2026-04-28  5:10   ` Claude review: " Claude Code Review Bot
2026-04-28  5:10 ` Claude Code Review Bot
2026-04-21 17:38 [PATCH v5 0/2] " Aaron Kling via B4 Relay
2026-04-21 17:38 ` [PATCH v5 2/2] " Aaron Kling via B4 Relay
2026-04-22 22:16   ` Claude review: " Claude Code Review Bot
2026-04-22 22:16 ` Claude Code Review Bot
2026-04-08  5:32 [PATCH v4 0/2] " Aaron Kling via B4 Relay
2026-04-08  5:32 ` [PATCH v4 2/2] " Aaron Kling via B4 Relay
2026-04-12  3:10   ` Claude review: " Claude Code Review Bot
2026-04-12  3:10 ` Claude Code Review Bot
2026-03-23 17:08 [PATCH v3 0/2] " Aaron Kling via B4 Relay
2026-03-23 17:08 ` [PATCH v3 2/2] " Aaron Kling via B4 Relay
2026-03-24 21:40   ` Claude review: " Claude Code Review Bot
2026-03-24 21:40 ` 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-patch2-20260422-ch13726a-v6-2-03680d6673ff@gmail.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