public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jie Gan <jie.gan@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Cong Yang <yangcong5@huaqin.corp-partner.google.com>,
	Ondrej Jirman <megi@xff.cz>,
	Javier Martinez Canillas <javierm@redhat.com>,
	Jagan Teki <jagan@edgeble.ai>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	Riccardo Mereu <r.mereu@arduino.cc>
Subject: Re: [PATCH v2 12/21] drm/panel: jadard-jd9365da-h3: support variable DSI configuration
Date: Sun, 12 Apr 2026 08:55:55 +0800	[thread overview]
Message-ID: <d62614ae-53dd-4925-b185-6834dc8a63ac@oss.qualcomm.com> (raw)
In-Reply-To: <20260411-waveshare-dsi-touch-v2-12-75cdbeac5156@oss.qualcomm.com>



On 4/11/2026 8:10 PM, Dmitry Baryshkov wrote:
> Several panels support attachment either using 4 DSI lanes or just 2. In
> some cases, this requires a different panel mode to fulfill clock
> requirements. Extend the driver to handle such cases by letting the
> panel description to omit lanes specification and parsing number of
> lanes from the DT.
> 
> Reviewed-by: Linus Walleij <linusw@kernel.org>
> Tested-by: Riccardo Mereu <r.mereu@arduino.cc>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> ---
>   drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c | 32 +++++++++++++++++-------
>   1 file changed, 23 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> index 1884ad2404cd..5d9db2e1f28f 100644
> --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c
> @@ -10,6 +10,7 @@
>   
>   #include <drm/drm_mipi_dsi.h>
>   #include <drm/drm_modes.h>
> +#include <drm/drm_of.h>
>   #include <drm/drm_panel.h>
>   #include <drm/drm_print.h>
>   #include <drm/drm_probe_helper.h>
> @@ -23,7 +24,8 @@
>   struct jadard;
>   
>   struct jadard_panel_desc {
> -	const struct drm_display_mode mode;
> +	const struct drm_display_mode *mode_4ln;
> +	const struct drm_display_mode *mode_2ln;
>   	unsigned int lanes;
>   	enum mipi_dsi_pixel_format format;
>   	int (*init)(struct jadard *jadard);
> @@ -57,7 +59,10 @@ static void jadard_enable_standard_cmds(struct mipi_dsi_multi_context *dsi_ctx)
>   	mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xe1, 0x93);
>   	mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xe2, 0x65);
>   	mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0xe3, 0xf8);
> -	mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x80, 0x03);
> +	if (dsi_ctx->dsi->lanes == 2)
> +		mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x80, 0x01);
> +	else
> +		mipi_dsi_dcs_write_seq_multi(dsi_ctx, 0x80, 0x03);
>   }
>   
>   static inline struct jadard *panel_to_jadard(struct drm_panel *panel)
> @@ -151,7 +156,10 @@ static int jadard_get_modes(struct drm_panel *panel,
>   {
>   	struct jadard *jadard = panel_to_jadard(panel);
>   
> -	return drm_connector_helper_get_modes_fixed(connector, &jadard->desc->mode);
> +	if (jadard->dsi->lanes == 2)

Worth to add a check here:
if (jadard->dsi->lanes == 2 && jadard->desc->mode_2ln)

Some pre-existing panel desc(e.g. radxa_display_8hd_ad002_desc) only set 
mode_4ln, leaving mode_2ln = NULL. So if such a panel attaches to a 
2-lane DSI host, the NULL pointer dereference causes a kernel oops.

Thanks,
Jie

> +		return drm_connector_helper_get_modes_fixed(connector, jadard->desc->mode_2ln);
> +	else
> +		return drm_connector_helper_get_modes_fixed(connector, jadard->desc->mode_4ln);
>   }
>   
>   static enum drm_panel_orientation jadard_panel_get_orientation(struct drm_panel *panel)
> @@ -354,7 +362,7 @@ static int radxa_display_8hd_ad002_init_cmds(struct jadard *jadard)
>   };
>   
>   static const struct jadard_panel_desc radxa_display_8hd_ad002_desc = {
> -	.mode = {
> +	.mode_4ln = &(const struct drm_display_mode) {
>   		.clock		= 70000,
>   
>   		.hdisplay	= 800,
> @@ -586,7 +594,7 @@ static int cz101b4001_init_cmds(struct jadard *jadard)
>   };
>   
>   static const struct jadard_panel_desc cz101b4001_desc = {
> -	.mode = {
> +	.mode_4ln = &(const struct drm_display_mode) {
>   		.clock		= 70000,
>   
>   		.hdisplay	= 800,
> @@ -819,7 +827,7 @@ static int kingdisplay_kd101ne3_init_cmds(struct jadard *jadard)
>   };
>   
>   static const struct jadard_panel_desc kingdisplay_kd101ne3_40ti_desc = {
> -	.mode = {
> +	.mode_4ln = &(const struct drm_display_mode) {
>   		.clock		= (800 + 24 + 24 + 24) * (1280 + 30 + 4 + 8) * 60 / 1000,
>   
>   		.hdisplay	= 800,
> @@ -1070,7 +1078,7 @@ static int melfas_lmfbx101117480_init_cmds(struct jadard *jadard)
>   };
>   
>   static const struct jadard_panel_desc melfas_lmfbx101117480_desc = {
> -	.mode = {
> +	.mode_4ln = &(const struct drm_display_mode) {
>   		.clock		= (800 + 24 + 24 + 24) * (1280 + 30 + 4 + 8) * 60 / 1000,
>   
>   		.hdisplay	= 800,
> @@ -1326,7 +1334,7 @@ static int anbernic_rgds_init_cmds(struct jadard *jadard)
>   };
>   
>   static const struct jadard_panel_desc anbernic_rgds_display_desc = {
> -	.mode = {
> +	.mode_4ln = &(const struct drm_display_mode) {
>   		.clock		= (640 + 260 + 220 + 260) * (480 + 10 + 2 + 16) * 60 / 1000,
>   
>   		.hdisplay	= 640,
> @@ -1562,7 +1570,7 @@ static int taiguan_xti05101_01a_init_cmds(struct jadard *jadard)
>   };
>   
>   static const struct jadard_panel_desc taiguan_xti05101_01a_desc = {
> -	.mode = {
> +	.mode_4ln = &(const struct drm_display_mode) {
>   		.clock		= (800 + 24 + 24 + 24) * (1280 + 30 + 4 + 8) * 60 / 1000,
>   
>   		.hdisplay	= 800,
> @@ -1614,6 +1622,12 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi)
>   
>   	dsi->format = desc->format;
>   	dsi->lanes = desc->lanes;
> +	if (!dsi->lanes) {
> +		dsi->lanes = drm_of_get_data_lanes_count_remote(dsi->dev.of_node, 0, -1, 2, 4);
> +		if (dsi->lanes < 0)
> +			return dsi->lanes;
> +	}
> +	dev_dbg(&dsi->dev, "lanes: %d\n", dsi->lanes);
>   
>   	jadard->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
>   	if (IS_ERR(jadard->reset))
> 


  reply	other threads:[~2026-04-12  0:56 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-11 12:10 [PATCH v2 00/21] drm/panel: support Waveshare DSI TOUCH kits Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 01/21] dt-bindings: display/panel: himax,hx83102: describe Waveshare panel Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 02/21] dt-bindings: display/panel: himax,hx8394: " Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 03/21] dt-bindings: display/panel: jadard,jd9365da-h3: " Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 04/21] dt-bindings: display/panel: ilitek,ili9881c: " Dmitry Baryshkov
2026-04-12  9:46   ` Krzysztof Kozlowski
2026-04-11 12:10 ` [PATCH v2 05/21] dt-bindings: dipslay/panel: describe panels using Focaltech OTA7290B Dmitry Baryshkov
2026-04-11 14:02   ` Rob Herring (Arm)
2026-04-12  0:44   ` Jie Gan
2026-04-11 12:10 ` [PATCH v2 06/21] drm/of: add helper to count data-lanes on a remote endpoint Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 07/21] drm/panel: himax-hx83102: support Waveshare 12.3" DSI panel Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 08/21] drm/panel: himax-hx8394: set prepare_prev_first Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 09/21] drm/panel: himax-hx8394: simplify hx8394_enable() Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 10/21] drm/panel: himax-hx8394: support Waveshare DSI panels Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 11/21] drm/panel: jadard-jd9365da-h3: use drm_connector_helper_get_modes_fixed Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 12/21] drm/panel: jadard-jd9365da-h3: support variable DSI configuration Dmitry Baryshkov
2026-04-12  0:55   ` Jie Gan [this message]
2026-04-11 12:10 ` [PATCH v2 13/21] drm/panel: jadard-jd9365da-h3: set prepare_prev_first Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 14/21] drm/panel: jadard-jd9365da-h3: support Waveshare round DSI panels Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 15/21] drm/panel: jadard-jd9365da-h3: support Waveshare WXGA " Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 16/21] drm/panel: jadard-jd9365da-h3: support Waveshare 720p " Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 17/21] drm/panel: ilitek-ili9881c: support Waveshare 7.0" DSI panel Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 18/21] drm/panel: add devm_drm_panel_add() helper Dmitry Baryshkov
2026-04-11 12:10 ` [PATCH v2 19/21] drm/panel: add driver for Waveshare 8.8" DSI TOUCH-A panel Dmitry Baryshkov
2026-04-12  1:09   ` Jie Gan
2026-04-11 12:10 ` [PATCH v2 20/21] dt-bindings: gpio: describe Waveshare GPIO controller Dmitry Baryshkov
2026-04-12  9:48   ` Krzysztof Kozlowski
2026-04-11 12:10 ` [PATCH v2 21/21] gpio: add GPIO controller found on Waveshare DSI TOUCH panels Dmitry Baryshkov
2026-04-12  1:06   ` Jie Gan

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=d62614ae-53dd-4925-b185-6834dc8a63ac@oss.qualcomm.com \
    --to=jie.gan@oss.qualcomm.com \
    --cc=airlied@gmail.com \
    --cc=brgl@kernel.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@edgeble.ai \
    --cc=javierm@redhat.com \
    --cc=jesszhan0024@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=megi@xff.cz \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=r.mereu@arduino.cc \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=yangcong5@huaqin.corp-partner.google.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