All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] drm/panel: couple of visionox vtdr6140 driver enhancements
@ 2026-07-02  9:36 Neil Armstrong
  2026-07-02  9:36 ` [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel Neil Armstrong
  2026-07-02  9:36 ` [PATCH v3 2/2] drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove Neil Armstrong
  0 siblings, 2 replies; 6+ messages in thread
From: Neil Armstrong @ 2026-07-02  9:36 UTC (permalink / raw)
  To: Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: linux-arm-msm, Dmitry Baryshkov, Doug Anderson, dri-devel,
	linux-kernel, Neil Armstrong, Jun Nie

Enable DSC and switch to devm_calls in probe.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
Changes in v3:
- add missing CONFIG_DRM_DISPLAY_HELPER
- Link to v2: https://patch.msgid.link/20260625-topic-sm8x50-vtdr6130-dsc-v2-0-cd375ef0e0ce@linaro.org

Changes in v2:
- select CONFIG_DRM_DISPLAY_DSC_HELPER
- Link to v1: https://patch.msgid.link/20260604-topic-sm8x50-vtdr6130-dsc-v1-0-09bcd1dff1fb@linaro.org

---
Jun Nie (1):
      drm/panel: Enable DSC for Visionox VTDR6130 panel

Neil Armstrong (1):
      drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove

 drivers/gpu/drm/panel/Kconfig                   |  2 ++
 drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 42 ++++++++++++-------------
 2 files changed, 23 insertions(+), 21 deletions(-)
---
base-commit: cdeb2ccd993ed8647adbbda2c3b103aa717fd6f7
change-id: 20260604-topic-sm8x50-vtdr6130-dsc-16c7697a65ac

Best regards,
--  
Neil Armstrong <neil.armstrong@linaro.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel
  2026-07-02  9:36 [PATCH v3 0/2] drm/panel: couple of visionox vtdr6140 driver enhancements Neil Armstrong
@ 2026-07-02  9:36 ` Neil Armstrong
  2026-07-02  9:51   ` sashiko-bot
  2026-07-02 12:36   ` Dmitry Baryshkov
  2026-07-02  9:36 ` [PATCH v3 2/2] drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove Neil Armstrong
  1 sibling, 2 replies; 6+ messages in thread
From: Neil Armstrong @ 2026-07-02  9:36 UTC (permalink / raw)
  To: Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: linux-arm-msm, Dmitry Baryshkov, Doug Anderson, dri-devel,
	linux-kernel, Neil Armstrong, Jun Nie

From: Jun Nie <jun.nie@linaro.org>

Enable display compression (DSC v1.2) for 1080x2400 Visionox
VTDR6130 AMOLED DSI panel.

This panel is the default panel for the following devices:
- SM8550-QRD
- SM8550-HDK
- SM8650-QRD
- SM8650-HDK

Enable DSC since now functional in the MSM/DPU/DSI driver.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/gpu/drm/panel/Kconfig                   |  2 ++
 drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index c0cc2bb4a3eb..d4e6535f3595 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -1352,6 +1352,8 @@ config DRM_PANEL_VISIONOX_VTDR6130
 	depends on OF
 	depends on DRM_MIPI_DSI
 	depends on BACKLIGHT_CLASS_DEVICE
+	select DRM_DISPLAY_DSC_HELPER
+	selecy DRM_DISPLAY_HELPER
 	help
 	  Say Y here if you want to enable support for Visionox
 	  VTDR6130 1080x2400 AMOLED DSI panel.
diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
index 97a79411e1ec..0cdcdbbc766d 100644
--- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
+++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
@@ -9,6 +9,7 @@
 #include <linux/of.h>
 
 #include <drm/display/drm_dsc.h>
+#include <drm/display/drm_dsc_helper.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
@@ -17,6 +18,7 @@
 
 struct visionox_vtdr6130 {
 	struct drm_panel panel;
+	struct drm_dsc_config dsc;
 	struct mipi_dsi_device *dsi;
 	struct gpio_desc *reset_gpio;
 	struct regulator_bulk_data *supplies;
@@ -47,9 +49,12 @@ static int visionox_vtdr6130_on(struct visionox_vtdr6130 *ctx)
 {
 	struct mipi_dsi_device *dsi = ctx->dsi;
 	struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi };
+	struct drm_dsc_picture_parameter_set pps;
 
 	dsi->mode_flags |= MIPI_DSI_MODE_LPM;
 
+	mipi_dsi_dcs_write_seq_multi(&dsi_ctx, 0x03, 0x01);
+
 	mipi_dsi_dcs_set_tear_on_multi(&dsi_ctx, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
 
 	mipi_dsi_dcs_write_seq_multi(&dsi_ctx,
@@ -123,6 +128,9 @@ static int visionox_vtdr6130_on(struct visionox_vtdr6130 *ctx)
 	mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
 	mipi_dsi_msleep(&dsi_ctx, 20);
 
+	drm_dsc_pps_payload_pack(&pps, dsi->dsc);
+	mipi_dsi_picture_parameter_set_multi(&dsi_ctx, &pps);
+
 	return dsi_ctx.accum_err;
 }
 
@@ -269,6 +277,16 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)
 	ctx->dsi = dsi;
 	mipi_dsi_set_drvdata(dsi, ctx);
 
+	ctx->dsc.dsc_version_major = 0x1;
+	ctx->dsc.dsc_version_minor = 0x2;
+	ctx->dsc.slice_height = 40;
+	ctx->dsc.slice_width = 540;
+	ctx->dsc.slice_count = 2;
+	ctx->dsc.bits_per_component = 8;
+	ctx->dsc.bits_per_pixel = 8 << 4;
+	ctx->dsc.block_pred_enable = true;
+
+	dsi->dsc = &ctx->dsc;
 	dsi->lanes = 4;
 	dsi->format = MIPI_DSI_FMT_RGB888;
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET |

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/2] drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove
  2026-07-02  9:36 [PATCH v3 0/2] drm/panel: couple of visionox vtdr6140 driver enhancements Neil Armstrong
  2026-07-02  9:36 ` [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel Neil Armstrong
@ 2026-07-02  9:36 ` Neil Armstrong
  2026-07-02 12:37   ` Dmitry Baryshkov
  1 sibling, 1 reply; 6+ messages in thread
From: Neil Armstrong @ 2026-07-02  9:36 UTC (permalink / raw)
  To: Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter
  Cc: linux-arm-msm, Dmitry Baryshkov, Doug Anderson, dri-devel,
	linux-kernel, Neil Armstrong

Switch to devm_drm_panel_add() and devm_mipi_dsi_attach() and drop
the remove() callback.

Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
index 0cdcdbbc766d..6733e0e1d061 100644
--- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
+++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
@@ -298,28 +298,11 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
 				     "Failed to create backlight\n");
 
-	drm_panel_add(&ctx->panel);
-
-	ret = mipi_dsi_attach(dsi);
-	if (ret < 0) {
-		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
-		drm_panel_remove(&ctx->panel);
+	ret = devm_drm_panel_add(dev, &ctx->panel);
+	if (ret)
 		return ret;
-	}
-
-	return 0;
-}
-
-static void visionox_vtdr6130_remove(struct mipi_dsi_device *dsi)
-{
-	struct visionox_vtdr6130 *ctx = mipi_dsi_get_drvdata(dsi);
-	int ret;
-
-	ret = mipi_dsi_detach(dsi);
-	if (ret < 0)
-		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
 
-	drm_panel_remove(&ctx->panel);
+	return devm_mipi_dsi_attach(dev, dsi);
 }
 
 static const struct of_device_id visionox_vtdr6130_of_match[] = {
@@ -330,7 +313,6 @@ MODULE_DEVICE_TABLE(of, visionox_vtdr6130_of_match);
 
 static struct mipi_dsi_driver visionox_vtdr6130_driver = {
 	.probe = visionox_vtdr6130_probe,
-	.remove = visionox_vtdr6130_remove,
 	.driver = {
 		.name = "panel-visionox-vtdr6130",
 		.of_match_table = visionox_vtdr6130_of_match,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel
  2026-07-02  9:36 ` [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel Neil Armstrong
@ 2026-07-02  9:51   ` sashiko-bot
  2026-07-02 12:36   ` Dmitry Baryshkov
  1 sibling, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-07-02  9:51 UTC (permalink / raw)
  To: Neil Armstrong; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Dangling pointer `dsi->dsc` causes a Use-After-Free if the panel is unbound or fails to probe.
- [Low] Typo in Kconfig keyword (`selecy` instead of `select`) causes Kconfig syntax errors and unmet dependencies.
--

commit e86a9d725d9bec9f842cd9809e7110af265ae958
Author: Jun Nie <jun.nie@linaro.org>
Subject: drm/panel: Enable DSC for Visionox VTDR6130 panel

This commit enables display compression (DSC v1.2) for the 1080x2400 Visionox
VTDR6130 AMOLED DSI panel. It configures the DSC parameters during probe and
sends the PPS payload when turning on the display.

> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index c0cc2bb4a3eb7..d4e6535f35957 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -1352,6 +1352,8 @@ config DRM_PANEL_VISIONOX_VTDR6130
>  	depends on OF
>  	depends on DRM_MIPI_DSI
>  	depends on BACKLIGHT_CLASS_DEVICE
> +	select DRM_DISPLAY_DSC_HELPER
> +	selecy DRM_DISPLAY_HELPER

[Severity: Low]
This isn't a bug, but is there a typo here with "selecy" instead of "select"?
This will cause a Kconfig syntax error and leave dependencies unmet.

[ ... ]

> diff --git a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
> index 97a79411e1ecd..0cdcdbbc766da 100644
> --- a/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c
> +++ b/drivers/gpu/drm/panel/panel-visionox-vtdr6130.c

[ ... ]

> @@ -269,6 +277,16 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)
>  	ctx->dsi = dsi;
>  	mipi_dsi_set_drvdata(dsi, ctx);
>  
> +	ctx->dsc.dsc_version_major = 0x1;
> +	ctx->dsc.dsc_version_minor = 0x2;
> +	ctx->dsc.slice_height = 40;
> +	ctx->dsc.slice_width = 540;
> +	ctx->dsc.slice_count = 2;
> +	ctx->dsc.bits_per_component = 8;
> +	ctx->dsc.bits_per_pixel = 8 << 4;
> +	ctx->dsc.block_pred_enable = true;
> +
> +	dsi->dsc = &ctx->dsc;

[Severity: High]
Does this code leave a dangling pointer if the probe function fails later or 
if the driver is unbound?

In visionox_vtdr6130_probe(), dsi->dsc is assigned to &ctx->dsc, where ctx
is allocated using devm_drm_panel_alloc(). If devm_drm_panel_add() or
devm_mipi_dsi_attach() fail later in the probe function, or if the panel
driver is unbound via sysfs, devres will automatically free ctx.

However, since the mipi_dsi_device outlives the panel driver binding, dsi->dsc
is never cleared and becomes a dangling pointer. If the DSI subsystem or host
driver attempts to use it, it could result in a use-after-free.

Should dsi->dsc be explicitly cleared in the probe error paths and in a
driver remove callback?

>  	dsi->lanes = 4;
>  	dsi->format = MIPI_DSI_FMT_RGB888;
>  	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_NO_EOT_PACKET |

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260702-topic-sm8x50-vtdr6130-dsc-v3-0-db881a3fc026@linaro.org?part=1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel
  2026-07-02  9:36 ` [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel Neil Armstrong
  2026-07-02  9:51   ` sashiko-bot
@ 2026-07-02 12:36   ` Dmitry Baryshkov
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2026-07-02 12:36 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-arm-msm,
	Doug Anderson, dri-devel, linux-kernel, Jun Nie

On Thu, Jul 02, 2026 at 11:36:09AM +0200, Neil Armstrong wrote:
> From: Jun Nie <jun.nie@linaro.org>
> 
> Enable display compression (DSC v1.2) for 1080x2400 Visionox
> VTDR6130 AMOLED DSI panel.
> 
> This panel is the default panel for the following devices:
> - SM8550-QRD
> - SM8550-HDK
> - SM8650-QRD
> - SM8650-HDK
> 
> Enable DSC since now functional in the MSM/DPU/DSI driver.
> 
> Signed-off-by: Jun Nie <jun.nie@linaro.org>
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
>  drivers/gpu/drm/panel/Kconfig                   |  2 ++
>  drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 18 ++++++++++++++++++
>  2 files changed, 20 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index c0cc2bb4a3eb..d4e6535f3595 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -1352,6 +1352,8 @@ config DRM_PANEL_VISIONOX_VTDR6130
>  	depends on OF
>  	depends on DRM_MIPI_DSI
>  	depends on BACKLIGHT_CLASS_DEVICE
> +	select DRM_DISPLAY_DSC_HELPER
> +	selecy DRM_DISPLAY_HELPER

With this fixed:


Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>



>  	help
>  	  Say Y here if you want to enable support for Visionox
>  	  VTDR6130 1080x2400 AMOLED DSI panel.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 2/2] drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove
  2026-07-02  9:36 ` [PATCH v3 2/2] drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove Neil Armstrong
@ 2026-07-02 12:37   ` Dmitry Baryshkov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Baryshkov @ 2026-07-02 12:37 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Jessica Zhang, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, David Airlie, Simona Vetter, linux-arm-msm,
	Doug Anderson, dri-devel, linux-kernel

On Thu, Jul 02, 2026 at 11:36:10AM +0200, Neil Armstrong wrote:
> Switch to devm_drm_panel_add() and devm_mipi_dsi_attach() and drop
> the remove() callback.
> 
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
> ---
>  drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 24 +++---------------------
>  1 file changed, 3 insertions(+), 21 deletions(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-02 12:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02  9:36 [PATCH v3 0/2] drm/panel: couple of visionox vtdr6140 driver enhancements Neil Armstrong
2026-07-02  9:36 ` [PATCH v3 1/2] drm/panel: Enable DSC for Visionox VTDR6130 panel Neil Armstrong
2026-07-02  9:51   ` sashiko-bot
2026-07-02 12:36   ` Dmitry Baryshkov
2026-07-02  9:36 ` [PATCH v3 2/2] drm/panel: visionox-vtdr6130: switch to devm panel calls and drop remove Neil Armstrong
2026-07-02 12:37   ` Dmitry Baryshkov

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.