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 Chipone ICNA35XX based panels
Date: Sat, 16 May 2026 10:22:33 +1000	[thread overview]
Message-ID: <review-patch2-20260514-icna35xx-v3-2-c304f04c32c4@gmail.com> (raw)
In-Reply-To: <20260514-icna35xx-v3-2-c304f04c32c4@gmail.com>

Patch Review

This is the main driver patch. It follows current conventions well but has several issues:

**1. Likely bug: `width_mm` / `height_mm` are swapped (both descriptors)**

Both panels have a native resolution of 1080x1920 (portrait). The physical dimensions should have `width_mm < height_mm` to match:

```c
static struct panel_desc odin2portal_desc = {
	...
	.width_mm = 160,
	.height_mm = 89,
```

For 1080x1920 at ~7", computing from pixel density: width should be ~87-89mm and height ~155-160mm. These values are transposed. It should be:

```c
	.width_mm = 89,
	.height_mm = 160,
```

Same for `thor_top_desc`:
```c
	.width_mm = 136,
	.height_mm = 68,
```
Should likely be `.width_mm = 68, .height_mm = 136`. As-is, userspace DPI calculations will be incorrect.

**2. `panel_desc` structs should be `const`**

```c
static struct panel_desc odin2portal_desc = {
```

These are never modified after initialization and should be `static const struct panel_desc`. The `pinfo->desc` member should then become `const struct panel_desc *desc`. The one complication is `pinfo->dsi->dsc = &pinfo->desc->dsc` assigning to a non-const pointer, which can be addressed with a cast or by copying the DSC config into `panel_info` (as `panel-novatek-nt35950` does).

**3. Use `devm_mipi_dsi_attach()` to eliminate the remove callback**

There are now 18+ panel drivers in-tree using `devm_mipi_dsi_attach()`. Since the driver already uses `devm_drm_panel_alloc()`, switching to `devm_mipi_dsi_attach()` would allow removing the `icna35xx_remove()` function entirely:

```c
static void icna35xx_remove(struct mipi_dsi_device *dsi)
{
	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
	int ret;

	ret = mipi_dsi_detach(pinfo->dsi);
	if (ret < 0)
		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);

	drm_panel_remove(&pinfo->panel);
}
```

This entire function can be deleted if `mipi_dsi_attach()` is replaced with `devm_mipi_dsi_attach()` in probe, and the `drm_panel_remove()` error path becomes `return dev_err_probe(...)` since devm handles cleanup.

**4. Unnecessary include**

```c
#include <linux/of_graph.h>
```

No `of_graph_*` functions are used in this driver. This include should be removed.

**5. `__typeof` usage is non-idiomatic**

```c
	pinfo = devm_drm_panel_alloc(dev, __typeof(*pinfo), panel,
```

All other in-tree callers pass the struct type directly:

```c
	pinfo = devm_drm_panel_alloc(dev, struct panel_info, panel,
```

**6. Indentation issue in `devm_regulator_bulk_get_const` call**

```c
	ret = devm_regulator_bulk_get_const(dev, ARRAY_SIZE(panel_supplies),
	panel_supplies, &pinfo->supplies);
```

The continuation line should be aligned with the opening parenthesis or at least indented further:

```c
	ret = devm_regulator_bulk_get_const(dev, ARRAY_SIZE(panel_supplies),
					    panel_supplies, &pinfo->supplies);
```

**7. `of_device_get_match_data()` cast**

```c
	pinfo->desc = (struct panel_desc *)of_device_get_match_data(dev);
```

The preferred modern API is `device_get_match_data(dev)` which works with both OF and ACPI and returns `const void *`. Using it would also reinforce the constness issue from point 2.

**8. `icna35xx_disable` never restores `MIPI_DSI_MODE_LPM`**

```c
static int icna35xx_disable(struct drm_panel *panel)
{
	...
	pinfo->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
	...
}
```

The LPM flag is cleared but never restored. In practice this is fine because `prepare()` calls `init_sequence()` which re-sets it via `pinfo->dsi->mode_flags |= MIPI_DSI_MODE_LPM`, and the full mode_flags are reset from `pinfo->desc->mode_flags` in a new attach cycle. But it would be cleaner to restore it at the end of disable, matching the pattern in the backlight ops.

**9. Minor: `init_sequence` register naming could benefit from defines**

The init sequences use raw vendor register addresses (`0x9F`, `0x48`, `0xB3`, etc.) without any symbolic names. This is common for vendor-derived init sequences and not a blocker, but adding at least a comment for the page-select register (`0x9F`) would help future maintainability.

**10. DSC config completeness**

The DSC configs only populate basic fields (version, slice dimensions, bpc, bpp, block_pred_enable). This matches the pattern in `panel-visionox-r66451.c` and is acceptable for panels where the DDIC handles decompression internally, so this is fine.

**Summary:** The main actionable items are the swapped `width_mm`/`height_mm` (likely bug), switching to `devm_mipi_dsi_attach`, making descriptors `const`, removing the unused `of_graph.h` include, and fixing the indentation/style nits. The overall driver structure and approach are correct.

---
Generated by Claude Code Patch Reviewer

  reply	other threads:[~2026-05-16  0:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 21:29 [PATCH v3 0/2] drm/panel: Add panel driver for Chipone ICNA35XX based panels Aaron Kling via B4 Relay
2026-05-14 21:29 ` [PATCH v3 1/2] dt-bindings: display: panel: Add Chipone ICNA3512 OLED driver bindings Aaron Kling via B4 Relay
2026-05-16  0:22   ` Claude review: " Claude Code Review Bot
2026-05-14 21:29 ` [PATCH v3 2/2] drm/panel: Add panel driver for Chipone ICNA35XX based panels Aaron Kling via B4 Relay
2026-05-16  0:22   ` Claude Code Review Bot [this message]
2026-05-16  0:22 ` Claude review: " Claude Code Review Bot
  -- strict thread matches above, loose matches on Subject: below --
2026-05-14 17:24 [PATCH v2 0/2] " Aaron Kling via B4 Relay
2026-05-14 17:24 ` [PATCH v2 2/2] " Aaron Kling via B4 Relay
2026-05-16  0:37   ` Claude review: " Claude Code Review Bot
2026-05-16  0:36 ` 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-20260514-icna35xx-v3-2-c304f04c32c4@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