drm/panel: Support Retroid Pocket 6 panel
Subsystems (4)
v2 cover drm/panel: Support Retroid Pocket 6 panel
This panel uses a Visionox VTDR6130 DDIC. There is an existing driver for this ddic, however it is currently hardcoded for a panel used on several Qualcomm devkits. This series sets up the driver to support multiple panels, then adds the RP6 panel. It also adds support for rotation as the RP6 panel is mounted sideways.
This depends on the Retroid Pocket dt series [0] for the vendor prefix patch. That series depends on the AYN dt series [1] to apply cleanly.
[0] https://lore.kernel.org/linux-arm-msm/[email protected]/
[1] https://lore.kernel.org/linux-arm-msm/[email protected]/
---
Changes in v2:
- Drop unused struct member in patch 3
- Undo width/height changes in patch 3
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Aaron Kling (4):
dt-bindings: display: visionox,vtdr6130: Add Retroid Pocket 6 panel drm/panel: visionox-vtdr6130: Add panel orientation support drm/panel: visionox-vtdr6130: Modularize panel config drm/panel: visionox-vtdr6130: Add Retroid Pocket 6 panel
.../bindings/display/panel/visionox,vtdr6130.yaml | 8 +- drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 221 ++++++++++++++++++--- 2 files changed, 197 insertions(+), 32 deletions(-)
---
base-commit: 4c253ac4b29b8c6cc6fdef8f92d4facde62e63b9
change-id: 20260318-rp6-panel-861840540616
prerequisite-change-id: 20260217-ayn-qcs8550-16c07b63de26:v9
prerequisite-patch-id: 17ba304f7a8a08cc78f98e198db9c51f4786a22c
prerequisite-patch-id: 21873631f5dcdb9bbbdb5c20c3f5e9816cc405f9
prerequisite-patch-id: bf7b5dea0097cbbdf04929a4246d1fc65c607ea8
prerequisite-patch-id: d7f546eddc96a4f31a1e681abddbc96bd68abb32
prerequisite-patch-id: d40d784ad8efbb1204c024408be2067725a06cf2
prerequisite-patch-id: 25bbd55199a8250a912ef542b31f43dd5ccdbc90
prerequisite-change-id: 20260808-rp-qcs8550-85c84760f6f3:v3
prerequisite-patch-id: 17ba304f7a8a08cc78f98e198db9c51f4786a22c
prerequisite-patch-id: 21873631f5dcdb9bbbdb5c20c3f5e9816cc405f9
prerequisite-patch-id: bf7b5dea0097cbbdf04929a4246d1fc65c607ea8
prerequisite-patch-id: d7f546eddc96a4f31a1e681abddbc96bd68abb32
prerequisite-patch-id: d40d784ad8efbb1204c024408be2067725a06cf2
prerequisite-patch-id: 25bbd55199a8250a912ef542b31f43dd5ccdbc90
prerequisite-patch-id: c79dacb2a8ca1298387bc9bc4a543de97c670a50
prerequisite-patch-id: 471c39ef6ce532e349e1f787b67ef1286b51f683
prerequisite-patch-id: 08107f621a4feffc1e5d644f714159a2d4b1f794
prerequisite-patch-id: 7e40351a859141256b0aa30afe259be3c03ec487
Best regards,
Signature · 1 line
Aaron Kling <[email protected]>
PATCH v2 1/4 dt-bindings: display: visionox,vtdr6130: Add Retroid Pocket 6 panel
The vtdr6130 is a display driver integrated circuit, a common chip used for various panels. One such panel is used in the Retroid Pocket 6.
The RP6 panel only lists the regulators vddio and vci, so drop vdd as a required property. The panel is rotated 270 degrees to natural, so also add rotation as an allowed property.
--- .../devicetree/bindings/display/panel/visionox,vtdr6130.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml +6 -2
@@ -14,7 +14,11 @@ allOf: properties: compatible: - const: visionox,vtdr6130 + oneOf: + - const: visionox,vtdr6130 + - items: + - const: retroidpocket,rp6-panel + - const: visionox,vtdr6130 reg: maxItems: 1
@@ -25,13 +29,13 @@ properties: vdd-supply: true port: true reset-gpios: true + rotation: true required: - compatible - reg - vddio-supply - vci-supply - - vdd-supply - reset-gpios - port
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 1/4] dt-bindings: display: visionox,vtdr6130: Add Retroid Pocket 6 panel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dt-bindings: vdd-supply validation dropped for visionox,vtdr6130 --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: vdd-supply validation dropped for visionox,vtdr6130 --
commit a3a48cee05612d79cd6eb27b26e83813b38aff64
Author: Aaron Kling <[email protected]>
dt-bindings: display: visionox,vtdr6130: Add Retroid Pocket 6 panel
The vtdr6130 is a display driver integrated circuit, a common chip used for various panels. One such panel is used in the Retroid Pocket 6.
Quoted 4 lines
Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml +0
-0
[ ... ]
Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml properties: · line 34
Quoted 12 lines
Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml +1
-1@@ -25,13 +29,13 @@ properties: vdd-supply: true port: true reset-gpios: true + rotation: true required: - compatible - reg - vddio-supply - vci-supply - - vdd-supply
[Severity: Medium]
By dropping vdd-supply globally from the required list, does this cause incomplete schema validation for the original visionox,vtdr6130 hardware?
Device trees using compatible = "visionox,vtdr6130" might now erroneously omit the previously required vdd-supply property and silently pass schema validation.
Should this be solved using an allOf and if-then block to conditionally require vdd-supply only for the original hardware?
Quoted 3 lines
Documentation/devicetree/bindings/display/panel/visionox,vtdr6130.yaml +0
-0- reset-gpios - port
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v2 2/4 drm/panel: visionox-vtdr6130: Add panel orientation support
In reply to Aaron KlingFetch orientation from the device tree if provided.
--- drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +16 -0
@@ -11,6 +11,7 @@#include <drm/display/drm_dsc.h> #include <drm/display/drm_dsc_helper.h> #include <drm/drm_mipi_dsi.h> +#include <drm/drm_of.h> #include <drm/drm_modes.h> #include <drm/drm_panel.h>
@@ -22,6 +23,7 @@ struct visionox_vtdr6130 {struct mipi_dsi_device *dsi;struct gpio_desc *reset_gpio;struct regulator_bulk_data *supplies; +enum drm_panel_orientation orientation; };static const struct regulator_bulk_data visionox_vtdr6130_supplies[] = {
@@ -218,10 +220,18 @@ static int visionox_vtdr6130_get_modes(struct drm_panel *panel,return 1 ; } +static enum drm_panel_orientation visionox_vtdr6130_get_orientation (struct drm_panel *panel) +{ +struct visionox_vtdr6130 *ctx =to_visionox_vtdr6130 (panel); + +return ctx->orientation; +} +static const struct drm_panel_funcs visionox_vtdr6130_panel_funcs = { .prepare = visionox_vtdr6130_prepare, .unprepare = visionox_vtdr6130_unprepare, .get_modes = visionox_vtdr6130_get_modes, + .get_orientation = visionox_vtdr6130_get_orientation, };static int visionox_vtdr6130_bl_update_status (struct backlight_device *bl)
@@ -293,6 +303,12 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)MIPI_DSI_CLOCK_NON_CONTINUOUS ; ctx->panel.prepare_prev_first = true; + ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation); +if (ret <0 ) { +dev_err (dev,"Failed to get orientation %d\n" , ret); +return ret; + } + ctx->panel.backlight =visionox_vtdr6130_create_backlight (dsi);if (IS_ERR (ctx->panel.backlight)) return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight),
Signature · 1 line
2.54.0
PATCH v2 3/4 drm/panel: visionox-vtdr6130: Modularize panel config
In reply to Aaron KlingThe vtdr6130 is a DDIC, a common chip that is used by multiple panels. Prepare the driver for more panels.
--- drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 91 +++++++++++++++++-------- 1 file changed, 61 insertions(+), 30 deletions(-)
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +61 -30
@@ -19,11 +19,24 @@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;enum drm_panel_orientation orientation; +struct visionox_vtdr6130_desc *desc; +}; + +struct visionox_vtdr6130_desc { +unsigned int bpc; +unsigned int lanes; +unsigned long mode_flags; +enum mipi_dsi_pixel_format format; + +const struct drm_display_mode *modes; +unsigned int num_modes; +int (*init_sequence)(struct visionox_vtdr6130 *ctx); + +struct drm_dsc_config dsc; };static const struct regulator_bulk_data visionox_vtdr6130_supplies[] = {
@@ -162,7 +175,7 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel)visionox_vtdr6130_reset (ctx); - ret =visionox_vtdr6130_on (ctx); + ret = ctx->desc->init_sequence (ctx);if (ret <0 ) {gpiod_set_value_cansleep (ctx->reset_gpio,1 ); regulator_bulk_disable(ARRAY_SIZE(visionox_vtdr6130_supplies),
@@ -187,26 +200,50 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)return 0 ; } -static const struct drm_display_mode visionox_vtdr6130_mode = { - .clock = (1080 +20 +2 +20 ) * (2400 +20 +2 +18 ) *144 /1000 , - .hdisplay =1080 , - .hsync_start =1080 +20 , - .hsync_end =1080 +20 +2 , - .htotal =1080 +20 +2 +20 , - .vdisplay =2400 , - .vsync_start =2400 +20 , - .vsync_end =2400 +20 +2 , - .vtotal =2400 +20 +2 +18 , - .width_mm =71 , - .height_mm =157 , +static const struct drm_display_mode visionox_vtdr6130_modes[] = { + { + .clock = (1080 +20 +2 +20 ) * (2400 +20 +2 +18 ) *144 /1000 , + .hdisplay =1080 , + .hsync_start =1080 +20 , + .hsync_end =1080 +20 +2 , + .htotal =1080 +20 +2 +20 , + .vdisplay =2400 , + .vsync_start =2400 +20 , + .vsync_end =2400 +20 +2 , + .vtotal =2400 +20 +2 +18 , + .width_mm =71 , + .height_mm =157 , + }, +}; + +static struct visionox_vtdr6130_desc visionox_vtdr6130_panel_desc = { + .modes = visionox_vtdr6130_modes, + .num_modes =ARRAY_SIZE (visionox_vtdr6130_modes), + .bpc =8 , + .lanes =4 , + .format =MIPI_DSI_FMT_RGB888 , + .mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_NO_EOT_PACKET | +MIPI_DSI_CLOCK_NON_CONTINUOUS , + .init_sequence = visionox_vtdr6130_on, + .dsc = { + .dsc_version_major =0x1 , + .dsc_version_minor =0x2 , + .slice_height =40 , + .slice_width =540 , + .slice_count =2 , + .bits_per_component =8 , + .bits_per_pixel =8 <<4 , + .block_pred_enable = true, + }, };static int visionox_vtdr6130_get_modes (struct drm_panel *panel,struct drm_connector *connector) { +struct visionox_vtdr6130 *ctx =to_visionox_vtdr6130 (panel);struct drm_display_mode *mode; - mode =drm_mode_duplicate (connector->dev, &visionox_vtdr6130_mode); + mode =drm_mode_duplicate (connector->dev, ctx->desc->modes);if (!mode)return -ENOMEM ;
@@ -284,23 +321,17 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset-gpios\n" ); + ctx->desc = (struct visionox_vtdr6130_desc *)of_device_get_match_data (dev); +if (!ctx->desc) +return -ENODEV ; + 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 | -MIPI_DSI_CLOCK_NON_CONTINUOUS ; + dsi->dsc = &ctx->desc->dsc; + dsi->lanes = ctx->desc->lanes; + dsi->format = ctx->desc->format; + dsi->mode_flags = ctx->desc->mode_flags; ctx->panel.prepare_prev_first = true; ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation);
@@ -322,7 +353,7 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) }static const struct of_device_id visionox_vtdr6130_of_match[] = { - { .compatible ="visionox,vtdr6130" }, + { .compatible ="visionox,vtdr6130" , .data = &visionox_vtdr6130_panel_desc }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, visionox_vtdr6130_of_match);
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 3/4] drm/panel: visionox-vtdr6130: Modularize panel config
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] drm/panel: shared global state mutation in DSC config - [Medium] drm/panel: ignores num_modes and…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] drm/panel: shared global state mutation in DSC config
- [Medium] drm/panel: ignores num_modes and drops all but first display mode
- [Low] drm/panel: unused bpc field in panel descriptor
--
commit 9e3a1ea8fd3c45699472995a794b6b527ce2a3ff
Author: Aaron Kling <[email protected]>
drm/panel: visionox-vtdr6130: Modularize panel config
The vtdr6130 is a DDIC, a common chip that is used by multiple panels. Prepare the driver for more panels.
Quoted 4 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +0
-0
[ ... ]
Quoted 1 line
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +0
-0@@ -200,24 +213,48 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)
[ ... ]
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c static int visionox_vtdr6130_unprepare(struct drm_panel *panel) · line 222
Quoted 4 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +4
-0+static struct visionox_vtdr6130_desc visionox_vtdr6130_panel_desc = { + .modes = visionox_vtdr6130_modes, + .num_modes =ARRAY_SIZE (visionox_vtdr6130_modes), + .bpc =8 ,
[Severity: Low]
Does this code forget to propagate the bpc field? It looks like this field is initialized here but never assigned to connector->display_info.bpc in the visionox_vtdr6130_get_modes() callback.
Quoted 15 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +15
-0+ .lanes = 4, + .format = MIPI_DSI_FMT_RGB888, + .mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_NO_EOT_PACKET | + MIPI_DSI_CLOCK_NON_CONTINUOUS, + .init_sequence = visionox_vtdr6130_on, + .dsc = { + .dsc_version_major = 0x1, + .dsc_version_minor = 0x2, + .slice_height = 40, + .slice_width = 540, + .slice_count = 2, + .bits_per_component = 8, + .bits_per_pixel = 8 << 4, + .block_pred_enable = true, + },
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c static int visionox_vtdr6130_unprepare(struct drm_panel *panel) · line 246
Quoted 10 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +2
-1};static int visionox_vtdr6130_get_modes (struct drm_panel *panel,struct drm_connector *connector) { +struct visionox_vtdr6130 *ctx =to_visionox_vtdr6130 (panel);struct drm_display_mode *mode; - mode =drm_mode_duplicate (connector->dev, &visionox_vtdr6130_mode); + mode =drm_mode_duplicate (connector->dev, ctx->desc->modes);
[Severity: Medium]
Will this silently drop display modes if the panel has more than one? Calling drm_mode_duplicate() directly on ctx->desc->modes without a loop ignores ctx->desc->num_modes, which means only the first mode in the array gets registered.
Quoted 3 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +0
-0if (!mode)return -ENOMEM ;
[ ... ]
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) · line 361
Quoted 5 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +1
-0@@ -321,17 +358,11 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset-gpios\n" ); + ctx->desc = (struct visionox_vtdr6130_desc *)of_device_get_match_data (dev);
[Severity: High]
Does casting away const from of_device_get_match_data() create a risk of global state corruption?
By embedding the dsc configuration in a static global struct and pointing dsi->dsc to it:
dsi->dsc = &ctx->desc->dsc;
it gets passed to the DSI host controller. Later, the drm_dsc_compute_rc_parameters() function mutates dsi->dsc in-place. Because it's a shared global struct, this can lead to data races and corruption if multiple panels exist.
Should the dsc config be copied into per-instance data instead, and the descriptor be made static const?
Quoted 25 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +7
-14+if (!ctx->desc) +return -ENODEV ; + 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 | -MIPI_DSI_CLOCK_NON_CONTINUOUS ; + dsi->dsc = &ctx->desc->dsc; + dsi->lanes = ctx->desc->lanes; + dsi->format = ctx->desc->format; + dsi->mode_flags = ctx->desc->mode_flags; ctx->panel.prepare_prev_first = true;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v2 3/4] drm/panel: visionox-vtdr6130: Modularize panel config
In reply to Aaron KlingQuoted 147 lines · On 9/25/26 09:08, Aaron Kling via B4 Relay wrote:
From: Aaron Kling <[email protected]>
The vtdr6130 is a DDIC, a common chip that is used by multiple panels. Prepare the driver for more panels.
Signed-off-by Aaron Kling <[email protected]>--- drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 91 +++++++++++++++++-------- 1 file changed, 61 insertions(+), 30 deletions(-)drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +60
-29@@ -19,11 +19,24 @@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;enum drm_panel_orientation orientation; +struct visionox_vtdr6130_desc *desc; +}; + +struct visionox_vtdr6130_desc { +unsigned int bpc; +unsigned int lanes; +unsigned long mode_flags; +enum mipi_dsi_pixel_format format; + +const struct drm_display_mode *modes; +unsigned int num_modes; +int (*init_sequence)(struct visionox_vtdr6130 *ctx); + +struct drm_dsc_config dsc; };static const struct regulator_bulk_data visionox_vtdr6130_supplies[] = {@@ -162,7 +175,7 @@ static int visionox_vtdr6130_prepare(struct drm_panel *panel)visionox_vtdr6130_reset (ctx); - ret =visionox_vtdr6130_on (ctx); + ret = ctx->desc->init_sequence (ctx);if (ret <0 ) {gpiod_set_value_cansleep (ctx->reset_gpio,1 ); regulator_bulk_disable(ARRAY_SIZE(visionox_vtdr6130_supplies),@@ -187,26 +200,50 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)return 0 ; } -static const struct drm_display_mode visionox_vtdr6130_mode = { - .clock = (1080 +20 +2 +20 ) * (2400 +20 +2 +18 ) *144 /1000 , - .hdisplay =1080 , - .hsync_start =1080 +20 , - .hsync_end =1080 +20 +2 , - .htotal =1080 +20 +2 +20 , - .vdisplay =2400 , - .vsync_start =2400 +20 , - .vsync_end =2400 +20 +2 , - .vtotal =2400 +20 +2 +18 , - .width_mm =71 , - .height_mm =157 , +static const struct drm_display_mode visionox_vtdr6130_modes[] = { + { + .clock = (1080 +20 +2 +20 ) * (2400 +20 +2 +18 ) *144 /1000 , + .hdisplay =1080 , + .hsync_start =1080 +20 , + .hsync_end =1080 +20 +2 , + .htotal =1080 +20 +2 +20 , + .vdisplay =2400 , + .vsync_start =2400 +20 , + .vsync_end =2400 +20 +2 , + .vtotal =2400 +20 +2 +18 , + .width_mm =71 , + .height_mm =157 , + }, +}; + +static struct visionox_vtdr6130_desc visionox_vtdr6130_panel_desc = { + .modes = visionox_vtdr6130_modes, + .num_modes =ARRAY_SIZE (visionox_vtdr6130_modes), + .bpc =8 , + .lanes =4 , + .format =MIPI_DSI_FMT_RGB888 , + .mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_NO_EOT_PACKET | +MIPI_DSI_CLOCK_NON_CONTINUOUS , + .init_sequence = visionox_vtdr6130_on, + .dsc = { + .dsc_version_major =0x1 , + .dsc_version_minor =0x2 , + .slice_height =40 , + .slice_width =540 , + .slice_count =2 , + .bits_per_component =8 , + .bits_per_pixel =8 <<4 , + .block_pred_enable = true, + }, };static int visionox_vtdr6130_get_modes (struct drm_panel *panel,struct drm_connector *connector) { +struct visionox_vtdr6130 *ctx =to_visionox_vtdr6130 (panel);struct drm_display_mode *mode; - mode =drm_mode_duplicate (connector->dev, &visionox_vtdr6130_mode); + mode =drm_mode_duplicate (connector->dev, ctx->desc->modes);if (!mode)return -ENOMEM ;@@ -284,23 +321,17 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi)return dev_err_probe (dev,PTR_ERR (ctx->reset_gpio),"Failed to get reset-gpios\n" ); + ctx->desc = (struct visionox_vtdr6130_desc *)of_device_get_match_data (dev); +if (!ctx->desc) +return -ENODEV ; + 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 | -MIPI_DSI_CLOCK_NON_CONTINUOUS ; + dsi->dsc = &ctx->desc->dsc; + dsi->lanes = ctx->desc->lanes; + dsi->format = ctx->desc->format; + dsi->mode_flags = ctx->desc->mode_flags; ctx->panel.prepare_prev_first = true; ret =drm_of_get_panel_orientation (dev->of_node, &ctx->orientation);
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) · line 359
Quoted 8 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +1
-1@@ -322,7 +353,7 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) }static const struct of_device_id visionox_vtdr6130_of_match[] = { - { .compatible ="visionox,vtdr6130" }, + { .compatible ="visionox,vtdr6130" , .data = &visionox_vtdr6130_panel_desc }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, visionox_vtdr6130_of_match);
Thanks,
Neil
PATCH v2 4/4 drm/panel: visionox-vtdr6130: Add Retroid Pocket 6 panel
In reply to Aaron KlingAdd support for the 1080x1920 panel used in the Retroid Pocket 6.
--- drivers/gpu/drm/panel/panel-visionox-vtdr6130.c | 114 ++++++++++++++++++++++++ 1 file changed, 114 insertions(+)
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +114 -0
@@ -60,6 +60,82 @@ static void visionox_vtdr6130_reset(struct visionox_vtdr6130 *ctx)usleep_range (10000 ,11000 ); } +static int retroidpocket_rp6_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, +MIPI_DCS_WRITE_CONTROL_DISPLAY ,0x20 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xff07 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_ADDRESS_MODE ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x59 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6c ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6d ,0x00 ); + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x70 ,0x11 ,0x00 ,0x00 ,0x89 , +0x30 ,0x80 ,0x07 ,0x80 ,0x04 ,0x38 ,0x00 , +0x14 ,0x02 ,0x1c ,0x02 ,0x1c ,0x02 ,0x00 , +0x02 ,0x25 ,0x00 ,0x20 ,0x01 ,0xd5 ,0x00 , +0x07 ,0x00 ,0x0d ,0x05 ,0x7a ,0x05 ,0x16 , +0x18 ,0x00 ,0x10 ,0xf0 ,0x03 ,0x0c ,0x20 , +0x00 ,0x06 ,0x0b ,0x0b ,0x33 ,0x0e ,0x1c , +0x2a ,0x38 ,0x46 ,0x54 ,0x62 ,0x69 ,0x70 , +0x77 ,0x79 ,0x7b ,0x7d ,0x7e ,0x01 ,0x02 , +0x01 ,0x00 ,0x09 ,0x40 ,0x09 ,0xbe ,0x19 , +0xfc ,0x19 ,0xfa ,0x19 ,0xf8 ,0x1a ,0x38 , +0x1a ,0x78 ,0x1a ,0xb6 ,0x2a ,0xb6 ,0x2a , +0xf4 ,0x2a ,0xf4 ,0x4b ,0x34 ,0x63 ,0x74 , +0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ); + +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 ,0xaa ,0x10 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb1 ,0x02 ,0x15 ,0x00 ,0x14 , +0x00 ,0x20 ,0x00 ,0x02 ,0x16 ,0x00 ,0x14 , +0x07 ,0xb4 ,0x00 ,0x02 ,0x16 ,0x00 ,0x14 , +0x00 ,0x10 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 ,0xaa ,0x14 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb2 ,0x03 ,0x33 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb4 ,0x0a ,0x72 ,0x00 ,0x00 , +0x0a ,0x72 ,0x00 ,0x00 ,0x0a ,0x72 ,0x00 , +0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb5 ,0x00 ,0x1e ,0x1e ,0x1e , +0x1e ,0x1e ,0x1e ,0x06 ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xb9 ,0x00 ,0x00 ,0x08 ,0x1e , +0x1e ,0x1e ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xbc ,0x10 ,0x00 ,0x00 ,0x08 , +0x11 ,0x1e ,0x7c ,0x1e ,0x7c ,0x1e ,0x7c ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xbe ,0x10 ,0x10 ,0x00 ,0x0c , +0x22 ,0x1e ,0x62 ,0x1e ,0x62 ,0x1e ,0x62 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0x5a ,0x80 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x65 ,0x13 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xfd ,0x01 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0x5a ,0x81 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf9 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0x5a ,0x83 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x65 ,0x04 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf8 ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xf0 ,0xaa ,0x00 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0xff ,0x5a ,0x00 ); + +mipi_dsi_dcs_exit_sleep_mode_multi (&dsi_ctx); +mipi_dsi_msleep (&dsi_ctx,150 ); + +mipi_dsi_dcs_set_display_on_multi (&dsi_ctx); +mipi_dsi_msleep (&dsi_ctx,50 ); + +drm_dsc_pps_payload_pack (&pps, dsi->dsc); +mipi_dsi_picture_parameter_set_multi (&dsi_ctx, &pps); +mipi_dsi_compression_mode_multi (&dsi_ctx, true); + +return dsi_ctx.accum_err; +} +static int visionox_vtdr6130_on (struct visionox_vtdr6130 *ctx) {struct mipi_dsi_device *dsi = ctx->dsi;
@@ -200,6 +276,43 @@ static int visionox_vtdr6130_unprepare(struct drm_panel *panel)return 0 ; } +static const struct drm_display_mode retroidpocket_rp6_modes[] = { + { + .clock = (1080 +22 +2 +16 ) * (1920 +16 +2 +20 ) *120 /1000 , + .hdisplay =1080 , + .hsync_start =1080 +22 , + .hsync_end =1080 +22 +2 , + .htotal =1080 +22 +2 +16 , + .vdisplay =1920 , + .vsync_start =1920 +16 , + .vsync_end =1920 +16 +2 , + .vtotal =1920 +16 +2 +20 , + .width_mm =69 , + .height_mm =122 , + }, +}; + +static struct visionox_vtdr6130_desc retroidpocket_rp6_panel_desc = { + .modes = retroidpocket_rp6_modes, + .num_modes =ARRAY_SIZE (retroidpocket_rp6_modes), + .bpc =8 , + .lanes =4 , + .format =MIPI_DSI_FMT_RGB888 , + .mode_flags =MIPI_DSI_MODE_NO_EOT_PACKET | +MIPI_DSI_CLOCK_NON_CONTINUOUS , + .init_sequence = retroidpocket_rp6_on, + .dsc = { + .dsc_version_major =0x1 , + .dsc_version_minor =0x1 , + .slice_height =12 , + .slice_width =540 , + .slice_count =2 , + .bits_per_component =8 , + .bits_per_pixel =8 <<4 , + .block_pred_enable = true, + }, +}; +static const struct drm_display_mode visionox_vtdr6130_modes[] = { { .clock = (1080 +20 +2 +20 ) * (2400 +20 +2 +18 ) *144 /1000 ,
@@ -353,6 +466,7 @@ static int visionox_vtdr6130_probe(struct mipi_dsi_device *dsi) }static const struct of_device_id visionox_vtdr6130_of_match[] = { + { .compatible ="retroidpocket,rp6-panel" , .data = &retroidpocket_rp6_panel_desc }, { .compatible ="visionox,vtdr6130" , .data = &visionox_vtdr6130_panel_desc }, {/* sentinel */ } };
Signature · 1 line
2.54.0
[email protected]
AI reviewRe: [PATCH v2 4/4] drm/panel: visionox-vtdr6130: Add Retroid Pocket 6 panel
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] drm/panel: API misuse by passing byte-swapped brightness value --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] drm/panel: API misuse by passing byte-swapped brightness value --
commit fdce0322736a51a627625ddf135b072aa86e11bd
Author: Aaron Kling <[email protected]>
drm/panel: visionox-vtdr6130: Add Retroid Pocket 6 panel
Add support for the 1080x1920 panel used in the Retroid Pocket 6.
Quoted 4 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +0
-0
[ ... ]
Quoted 7 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +3
-0@@ -60,6 +60,82 @@ static void visionox_vtdr6130_reset(struct visionox_vtdr6130 *ctx)usleep_range (10000 ,11000 ); } +static int retroidpocket_rp6_on (struct visionox_vtdr6130 *ctx) +{ +struct mipi_dsi_device *dsi = ctx->dsi;
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c static void visionox_vtdr6130_reset(struct visionox_vtdr6130 *ctx) · line 75
Quoted 10 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +10
-0+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, +MIPI_DCS_WRITE_CONTROL_DISPLAY ,0x20 ); +mipi_dsi_dcs_set_display_brightness_multi (&dsi_ctx,0xff07 );
[Severity: Medium]
Is this intentionally passing a byte-swapped value (0xff07) to work around the core helper's LSB-first transmission?
The mipi_dsi_dcs_set_display_brightness_multi API expects a logical brightness value, not a pre-swapped payload. If the core helper is ever updated to correctly follow the DCS spec and transmit MSB-first, could this panel silently break and apply a brightness of 65287 instead of the intended 0x07ff (2047)?
Quoted 3 lines
drivers/gpu/drm/panel/panel-visionox-vtdr6130.c +3
-0+mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x6f ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_SET_ADDRESS_MODE ,0x02 ); +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,0x59 ,0x00 );
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Hi,
Quoted 10 lines · Aaron Kling
This panel uses a Visionox VTDR6130 DDIC. There is an existing driver for this ddic, however it is currently hardcoded for a panel used on several Qualcomm devkits. This series sets up the driver to support multiple panels, then adds the RP6 panel. It also adds support for rotation as the RP6 panel is mounted sideways.
This depends on the Retroid Pocket dt series [0] for the vendor prefix patch. That series depends on the AYN dt series [1] to apply cleanly.
[...]
Thanks, Applied to https://gitlab.freedesktop.org/drm/misc/kernel.git (drm-misc-next)
[1/4] dt-bindings: display: visionox,vtdr6130: Add Retroid Pocket 6 panel
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/4cfc23733f15d75a787bcb370c6739cd954e74d5 [2/4] drm/panel: visionox-vtdr6130: Add panel orientation support https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/0de9104a85cb6efb624e6afacfc252855fdde8b0 [3/4] drm/panel: visionox-vtdr6130: Modularize panel config https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/628e7bff43c7ee3234a309fc58741eeecf2477eb [4/4] drm/panel: visionox-vtdr6130: Add Retroid Pocket 6 panel https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/74b7c75f7d442cc00fa759c22f746abaa70f264f
Signature · 1 line
Neil