Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] drm/panel: call to removed of_drm_get_panel_orientation() in
  jd9365tx_probe()
- [High] drm/panel: call to static drm_panel_init() in jd9365tx_probe()
- [Low] drm/panel: undocumented compatible jadard,jd9365tx-7kf82 in
  jd9365tx_of_match
- [Low] drm/panel: open-coded DSI command sender and helpers in
  panel-viewe-jd9365tx
- [Low] drm/panel: non-alphabetical Kconfig and Makefile order for
  VIEWE_JD9365TX
--

commit 0ea4165795cc39804999640f1fa6be9c2c2143db
Author: Hefei <[email protected]>

drm/panel: add VIEWE JD9365TX 7 inch DSI panel

This commit adds a DRM panel driver for the VIEWE 7" 720x1280 Jadard
JD9365TX (7KF82) 2-lane MIPI-DSI panel.

> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 26ffa2378f55c..9a3038bf60987 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -427,6 +427,17 @@ config DRM_PANEL_INNOLUX_P079ZCA
>         24 bit RGB per pixel. It provides a MIPI DSI interface to
>         the host and has a built-in LED backlight.
>  
> +config DRM_PANEL_VIEWE_JD9365TX
> +     tristate "VIEWE 7\" JD9365TX DSI panel"
> +     depends on OF
> +     depends on DRM_MIPI_DSI
> +     depends on BACKLIGHT_CLASS_DEVICE
> +     help
> +       Say Y here to enable the VIEWE 7" 720x1280 Jadard JD9365TX
> +       MIPI-DSI panel.
> +
> +       If unsure, say N.
> +
>  config DRM_PANEL_JADARD_JD9365DA_H3
>       tristate "Jadard JD9365DA-H3 WXGA DSI panel"
>       depends on OF
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 365f2e73f6b45..84ed0891a40d1 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += 
> panel-ilitek-ili9881c.o
>  obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9882T) += panel-ilitek-ili9882t.o
>  obj-$(CONFIG_DRM_PANEL_INNOLUX_EJ030NA) += panel-innolux-ej030na.o
>  obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
> +obj-$(CONFIG_DRM_PANEL_VIEWE_JD9365TX) += panel-viewe-jd9365tx.o
>  obj-$(CONFIG_DRM_PANEL_JADARD_JD9365DA_H3) += panel-jadard-jd9365da-h3.o
>  obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
>  obj-$(CONFIG_DRM_PANEL_JDI_LPM102A188A) += panel-jdi-lpm102a188a.o

[Severity: Low]
This isn't a bug, but DRM_PANEL_VIEWE_JD9365TX is placed between the
INNOLUX and JADARD entries instead of in alphabetical order in both
Kconfig and Makefile.

> diff --git a/drivers/gpu/drm/panel/panel-viewe-jd9365tx.c 
> b/drivers/gpu/drm/panel/panel-viewe-jd9365tx.c
> new file mode 100644
> index 0000000000000..b511dd6bfed96
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-viewe-jd9365tx.c

[ ... ]

> +static int jd9365tx_send_cmds(struct mipi_dsi_device *dsi,
> +                           const struct jd9365tx_cmd *cmds,
> +                           unsigned int count)
> +{
> +     unsigned int i;
> +     int ret;
> +
> +     for (i = 0; i < count; i++) {
> +             const struct jd9365tx_cmd *cmd = &cmds[i];
> +
> +             if (cmd->len) {
> +                     ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, 
> cmd->len);
> +                     if (ret < 0) {
> +                             dev_err(&dsi->dev,
> +                                     "DCS write 0x%02x failed: %d\n",
> +                                     cmd->data[0], ret);
> +                             return ret;
> +                     }
> +             }
> +             if (cmd->delay_ms)
> +                     msleep(cmd->delay_ms);
> +     }
> +     return 0;
> +}

[ ... ]

> +static int jd9365tx_get_modes(struct drm_panel *panel,
> +                           struct drm_connector *connector)
> +{
> +     struct jd9365tx_panel *ctx = to_jd9365tx(panel);
> +     struct drm_display_mode *mode;
> +
> +     mode = drm_mode_duplicate(connector->dev, &jd9365tx_7kf82_mode);
> +     if (!mode)
> +             return -ENOMEM;
> +
> +     drm_mode_set_name(mode);
> +     mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
> +     drm_mode_probed_add(connector, mode);
> +
> +     connector->display_info.width_mm = mode->width_mm;
> +     connector->display_info.height_mm = mode->height_mm;
> +     drm_connector_set_panel_orientation(connector, ctx->orientation);
> +     return 1;
> +}

[Severity: Low]
Can this driver use the existing DRM and MIPI-DSI helpers instead of
open-coding them?

Since jd9365tx_prepare() already sets up a struct mipi_dsi_multi_context,
using mipi_dsi_dcs_write_seq_multi() and mipi_dsi_msleep() avoids the
custom struct jd9365tx_cmd table and jd9365tx_send_cmds() loop.

In jd9365tx_get_modes(), using drm_connector_helper_get_modes_fixed()
avoids returning a negative errno from .get_modes on allocation failure and
drops the redundant drm_connector_set_panel_orientation() call (which
panel_bridge_attach() already handles via .get_orientation).  Using
devm_drm_panel_add() and devm_mipi_dsi_attach() in jd9365tx_probe() would
also allow dropping jd9365tx_remove(), and a brief commit message body
describing the panel hardware would be helpful.

[ ... ]

> +static int jd9365tx_probe(struct mipi_dsi_device *dsi)
> +{
> +     struct device *dev = &dsi->dev;
> +     struct jd9365tx_panel *ctx;
> +     int ret;
> +
> +     ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> +     if (!ctx)
> +             return -ENOMEM;
> +
> +     ctx->dsi = dsi;
> +     mipi_dsi_set_drvdata(dsi, ctx);
> +
> +     dsi->lanes = 2;
> +     dsi->format = MIPI_DSI_FMT_RGB888;
> +     dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
> +                       MIPI_DSI_MODE_LPM;
> +
> +     ctx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> +     if (IS_ERR(ctx->reset))
> +             return PTR_ERR(ctx->reset);
> +
> +     ctx->vdd = devm_regulator_get(dev, "vdd");
> +     if (IS_ERR(ctx->vdd))
> +             return PTR_ERR(ctx->vdd);
> +
> +     ctx->iovcc = devm_regulator_get(dev, "iovcc");
> +     if (IS_ERR(ctx->iovcc))
> +             return PTR_ERR(ctx->iovcc);
> +
> +     ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +     if (ret)
> +             return ret;

[Severity: High]
Does calling of_drm_get_panel_orientation() fail to compile when
CONFIG_DRM_PANEL_VIEWE_JD9365TX is enabled?

Commit b5a8b1f2a973 ("drm/panel: Use drm_of_get_panel_orientation()")
removed of_drm_get_panel_orientation() in favor of
drm_of_get_panel_orientation() declared in include/drm/drm_of.h.

> +
> +     drm_panel_init(&ctx->panel, dev, &jd9365tx_funcs, 
> DRM_MODE_CONNECTOR_DSI);

[Severity: High]
Does calling drm_panel_init() here also break the build and leave
ctx->panel.bridge uninitialized?

Commit fe417df954a9 ("drm/panel: Make drm_panel_init() static") made
drm_panel_init() static to drivers/gpu/drm/drm_panel.c.  Allocating ctx
with devm_kzalloc() instead of devm_drm_panel_alloc() also skips
initializing the embedded refcounted struct drm_bridge that
drm_panel_add() registers.

[ ... ]

> +static const struct of_device_id jd9365tx_of_match[] = {
> +     { .compatible = "viewe,7kf82" },
> +     { .compatible = "jadard,jd9365tx-7kf82" },
> +     { }
> +};

[Severity: Low]
Is "jadard,jd9365tx-7kf82" documented in the Device Tree bindings?
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml only
documents "viewe,7kf82".

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=4

Reply via email to