All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Hefei <3066883572@qq.com>, dri-devel@lists.freedesktop.org
Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel
Date: Wed, 25 Nov 2026 02:29:57 +0000	[thread overview]
Message-ID: <sashiko-outbox-232411@kernel.org> (raw)
In-Reply-To: <tencent_66628D1B7EAC58017C1F10DA3CFDFC1EA30A@qq.com>

Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] drm/panel: jd9365tx_probe() calls static drm_panel_init() with
  devm_kzalloc()
- [High] drm/panel: jd9365tx_probe() calls removed
  of_drm_get_panel_orientation()
- [Low] drm/panel: jd9365tx_get_modes() misuses
  drm_connector_set_panel_orientation()
- [Low] drm/panel: jd9365tx_send_cmds() duplicates
  mipi_dsi_dcs_write_seq_multi()
- [Low] drm/panel: undocumented jadard,jd9365tx-7kf82 compatible and
  unsorted Kconfig
--

commit 3ecc9eb3ae7d4c1cce585568afbec867631fedbb
Author: Hefei <3066883572@qq.com>

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
> 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
> @@ -0,0 +1,353 @@

[ ... ]

> +struct jd9365tx_cmd {
> +	u8 len;
> +	u8 data[64];
> +	u16 delay_ms;
> +};
> +
> +#define JD_CMD(...) {					\
> +	.len = sizeof((u8[]){ __VA_ARGS__ }),		\
> +	.data = { __VA_ARGS__ },			\
> +	.delay_ms = 0,					\
> +}
> +
> +#define JD_CMD_DELAY(ms, ...) {				\
> +	.len = sizeof((u8[]){ __VA_ARGS__ }),		\
> +	.data = { __VA_ARGS__ },			\
> +	.delay_ms = (ms),				\
> +}

[ ... ]

> +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;
> +}

[Severity: Low]
Can the init sequence use mipi_dsi_dcs_write_seq_multi() and
mipi_dsi_msleep() instead of a custom struct jd9365tx_cmd table and
jd9365tx_send_cmds() loop?  jd9365tx_prepare() already sets up a struct
mipi_dsi_multi_context, and using the standard _multi() helpers avoids
duplicating mipi_dsi_dcs_write_buffer_multi() and allocating a fixed
64-byte buffer per command entry.

[ ... ]

> +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;
> +}
> +
> +static enum drm_panel_orientation
> +jd9365tx_get_orientation(struct drm_panel *panel)
> +{
> +	struct jd9365tx_panel *ctx = to_jd9365tx(panel);
> +
> +	return ctx->orientation;
> +}
> +
> +static const struct drm_panel_funcs jd9365tx_funcs = {
> +	.prepare = jd9365tx_prepare,
> +	.disable = jd9365tx_disable,
> +	.unprepare = jd9365tx_unprepare,
> +	.get_modes = jd9365tx_get_modes,
> +	.get_orientation = jd9365tx_get_orientation,
> +};

[Severity: Low]
Should jd9365tx_get_modes() delegate to
drm_connector_helper_get_modes_fixed(connector, &jd9365tx_7kf82_mode) and
drop the drm_connector_set_panel_orientation() call?

jd9365tx_funcs already provides .get_orientation, so panel-bridge helpers
configure the panel orientation property before drm_dev_register().  Calling
drm_connector_set_panel_orientation() inside .get_modes runs after
drm_dev_register(), which can trigger a WARN_ON in
drm_object_attach_property() if orientation has not already been attached.

> +
> +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;

[ ... ]

> +	ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation);
> +	if (ret)
> +		return ret;

[Severity: High]
Does calling of_drm_get_panel_orientation() break the build?

Commit b5a8b1f2a973 ("drm/panel: Use drm_of_get_panel_orientation()")
removed of_drm_get_panel_orientation() in favor of
drm_of_get_panel_orientation() from <drm/drm_of.h>, which is also not
included here.

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

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

Commit fe417df954a9 ("drm/panel: Make drm_panel_init() static") made
drm_panel_init() private to drivers/gpu/drm/drm_panel.c.  Panel drivers
must allocate and initialize their container struct with
devm_drm_panel_alloc(), which also initializes the embedded struct
drm_bridge required by drm_panel_add().

[ ... ]

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

[Severity: Low]
Is "jadard,jd9365tx-7kf82" documented in the DT binding schema?
Documentation/devicetree/bindings/display/panel/viewe,jd9365tx.yaml in
commit "dt-bindings: display: add VIEWE JD9365TX panel binding" only lists
"viewe,7kf82".

Also, DRM_PANEL_VIEWE_JD9365TX and panel-viewe-jd9365tx.o are inserted
between INNOLUX and JADARD in drivers/gpu/drm/panel/Kconfig and
drivers/gpu/drm/panel/Makefile rather than in alphabetical order, and the
commit message has an empty body.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_EE81D0ED29E97716D56BDCF1A3C5AAE35B05@qq.com?part=4

  reply	other threads:[~2026-11-25  2:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261125020944.137-1-3066883572@qq.com>
2026-11-25  2:09 ` [PATCH v2 1/6] dt-bindings: display: add VIEWE JD9365TX panel binding Hefei
2026-11-25  2:20   ` sashiko-bot
2026-11-25  2:09 ` [PATCH v2 2/6] dt-bindings: input: add Jadard JD9365TX touchscreen binding Hefei
2026-11-25  2:18   ` sashiko-bot
2026-11-25  2:09 ` [PATCH v2 3/6] dt-bindings: backlight: add VIEWE I2C backlight binding Hefei
2026-11-25  2:17   ` sashiko-bot
2026-11-25  2:09 ` [PATCH v2 4/6] drm/panel: add VIEWE JD9365TX 7 inch DSI panel Hefei
2026-11-25  2:29   ` sashiko-bot [this message]
2026-11-25  2:09 ` [PATCH v2 5/6] Input: add Jadard JD9365TX in-cell touchscreen driver Hefei
2026-11-25  2:21   ` sashiko-bot
2026-11-25  2:09 ` [PATCH v2 6/6] backlight: add VIEWE I2C backlight driver Hefei
2026-11-25  2:19   ` sashiko-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=sashiko-outbox-232411@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=3066883572@qq.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-input@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.