From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot 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 Message-ID: In-Reply-To: <20260422-ch13726a-v6-2-03680d6673ff@gmail.com> References: <20260422-ch13726a-v6-0-03680d6673ff@gmail.com> <20260422-ch13726a-v6-2-03680d6673ff@gmail.com> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 p= anel Kconfig, the only entries selecting it are `DRM_PANEL_SAMSUNG_ATNA33XC= 20` (an eDP panel) and `DRM_PANEL_EDP` (the generic eDP panel driver). This= DSI panel driver does not use any DP or display helpers =E2=80=94 it only = uses `drm_mipi_dsi.h`, `drm_panel.h`, and `drm_modes.h`. Both `select` line= s should be removed. **Issue 2 (minor): `thor_bottom_desc` should be `const`** ```c +static struct ch13726a_desc thor_bottom_desc =3D { ``` This should be `static const struct ch13726a_desc thor_bottom_desc`. The da= ta 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 =3D (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 woul= d be unnecessary: ```c ctx->desc =3D of_device_get_match_data(dev); ``` **Issue 4 (style): `uint8_t` loop variable** ```c + for (uint8_t i =3D 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 =E2=80=94 = it would silently wrap if `num_modes` ever exceeded 255, though that's admi= ttedly unlikely for display modes. **Issue 5 (nit): `of_device_get_match_data` vs `device_get_match_data`** ```c + ctx->desc =3D (struct ch13726a_desc *)of_device_get_match_data(dev); ``` Newer panel drivers are moving to the bus-agnostic `device_get_match_data(d= ev)`. While `of_device_get_match_data` still works, reviewers may prefer th= e newer API since the driver already `depends on OF` anyway and the functio= n 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 &=3D ~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, me= aning 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 asymm= etry 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 t= he CH13726A actually requires HS-mode for shutdown commands. If LP mode wor= ks for both init and shutdown, the mode_flags manipulation could be simplif= ied. **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 supp= ly array - Proper use of `mipi_dsi_multi_context` for init sequence error accumulati= on - `prepare_prev_first =3D true` is appropriate for a DSI video mode panel - The 120Hz/60Hz mode clock calculations look correct: `(1080+28+4+36) * (1= 240+16+4+8) * rate / 1000` =3D `1148 * 1268 * 120 / 1000` =3D 174,614 for 1= 20Hz - Backlight via DCS brightness is standard - Error cleanup paths in prepare and probe are correct --- Generated by Claude Code Patch Reviewer