Skip to contentSkip to conversation

Support Anbernic RG351V Panel

PATCH Superseded Chris Morgan 2 participants 4 messages Aug 4, 2023 – Aug 5, 2023

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Support Anbernic RG351V Panel

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG351V panel. This panel is mostly identical to the one used in the 353 series, except it has a different panel ID when queried (0x4000 for the 351V, 0x3052 for the 353 panel) and will not work without the inclusion of the MIPI_DSI_CLOCK_NON_CONTINUOUS flag.

Chris Morgan (2):
dt-bindings: display: newvision,nv3051d: Add Anbernic 351V Support drm/panel: nv3051d: Add Support for Anbernic 351V

 .../display/panel/newvision,nv3051d.yaml       | 18 +++++++++++-------
 .../gpu/drm/panel/panel-newvision-nv3051d.c    | 18 ++++++++++++++++--
 2 files changed, 27 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 dt-bindings: display: newvision, nv3051d: Add Anbernic 351V Support

From: Chris Morgan <[email protected]>

Document the Anbernic RG351V panel, which appears to be identical to the panel used in their 353 series except for in inclusion of an additional DSI format flag.

---
 .../display/panel/newvision,nv3051d.yaml       | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml +11 -7
index 116c1b6030a2..1226db3613e6 100644
@@ -8,8 +8,8 @@ title: NewVision NV3051D based LCD panel
 
 description: |
   The NewVision NV3051D is a driver chip used to drive DSI panels. For now,
-  this driver only supports the 640x480 panels found in the Anbernic RG353
-  based devices.
+  this driver only supports the 640x480 panels found in the Anbernic RG351
+  and 353 based devices.
 
 maintainers:
   - Chris Morgan <[email protected]>
@@ -19,11 +19,15 @@ allOf:
 
 properties:
   compatible:
-    items:
-      - enum:
-          - anbernic,rg353p-panel
-          - anbernic,rg353v-panel
-      - const: newvision,nv3051d
+    oneOf:
+      - items:
+          - enum:
+              - anbernic,rg353p-panel
+              - anbernic,rg353v-panel
+          - const: newvision,nv3051d
+
+      - items:
+          - const: anbernic,rg351v-panel
 
   reg: true
   backlight: true
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: display: newvision, nv3051d: Add Anbernic 351V Support

Quoted 16 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Document the Anbernic RG351V panel, which appears to be identical to the panel used in their 353 series except for in inclusion of an additional DSI format flag.

---
 .../display/panel/newvision,nv3051d.yaml       | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml +0 -0
index 116c1b6030a2..1226db3613e6 100644

Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml title: NewVision NV3051D based LCD panel · line 12

Quoted 7 lines
Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml +2 -2
@@ -8,8 +8,8 @@ title: NewVision NV3051D based LCD panel
 
 description: |
   The NewVision NV3051D is a driver chip used to drive DSI panels. For now,
-  this driver only supports the 640x480 panels found in the Anbernic RG353
-  based devices.
+  this driver only supports the 640x480 panels found in the Anbernic RG351
+  and 353 based devices.

I would prefer to drop the reference to driver entirely. It's not related to the bindings. If driver changes (e.g. supports 1024x768), then binding changes as well?

Quoted 11 lines
Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml +0 -4
 maintainers:
   - Chris Morgan <[email protected]>
@@ -19,11 +19,15 @@ allOf:
 
 properties:
   compatible:
-    items:
-      - enum:
-          - anbernic,rg353p-panel
-          - anbernic,rg353v-panel

Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml allOf: · line 30

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/newvision,nv3051d.yaml +9 -1
-      - const: newvision,nv3051d
+    oneOf:
+      - items:
+          - enum:
+              - anbernic,rg353p-panel
+              - anbernic,rg353v-panel
+          - const: newvision,nv3051d
+
+      - items:
+          - const: anbernic,rg351v-panel

This part is good, so with adjusting description:

Best regards,
Krzysztof

#3 lore raw

PATCH 2/2 drm/panel: nv3051d: Add Support for Anbernic 351V

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Anbernic 351V. Just like the 353 series the underlying vendor is unknown/unmarked (at least not visible in a non-destructive manner). The panel had slightly different init sequences and timings in the BSP kernel, but works fine with the same ones used in the existing driver. The panel will not work without the inclusion of the MIPI_DSI_CLOCK_NON_CONTINUOUS flag, and this flag prevents the 353 series from working correctly, so a new compatible string is added.

Tested colors and timings using modetest and all seem to work identical to the 353 otherwise.

---
 .../gpu/drm/panel/panel-newvision-nv3051d.c    | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-newvision-nv3051d.c +16 -2
index a07958038ffd..dc0d6dcca683 100644
@@ -28,6 +28,7 @@ struct nv3051d_panel_info {
 	unsigned int num_modes;
 	u16 width_mm, height_mm;
 	u32 bus_flags;
+	unsigned long mode_flags;
 };
 
 struct panel_nv3051d {
@@ -385,8 +386,7 @@ static int panel_nv3051d_probe(struct mipi_dsi_device *dsi)
 
 	dsi->lanes = 4;
 	dsi->format = MIPI_DSI_FMT_RGB888;
-	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
-			  MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET;
+	dsi->mode_flags = ctx->panel_info->mode_flags;
 
 	drm_panel_init(&ctx->panel, &dsi->dev, &panel_nv3051d_funcs,
 		       DRM_MODE_CONNECTOR_DSI);
@@ -480,10 +480,24 @@ static const struct nv3051d_panel_info nv3051d_rgxx3_info = {
 	.width_mm = 70,
 	.height_mm = 57,
 	.bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+		      MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET,
+};
+
+static const struct nv3051d_panel_info nv3051d_rg351v_info = {
+	.display_modes = nv3051d_rgxx3_modes,
+	.num_modes = ARRAY_SIZE(nv3051d_rgxx3_modes),
+	.width_mm = 70,
+	.height_mm = 57,
+	.bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
+	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
+		      MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET |
+		      MIPI_DSI_CLOCK_NON_CONTINUOUS,
 };
 
 static const struct of_device_id newvision_nv3051d_of_match[] = {
 	{ .compatible = "newvision,nv3051d", .data = &nv3051d_rgxx3_info },
+	{ .compatible = "anbernic,rg351v-panel", .data = &nv3051d_rg351v_info },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, newvision_nv3051d_of_match);
Signature · 1 line
2.34.1