[PATCH] drm/panel: simple: Support simple VGA panels

Linus Walleij linus.walleij at linaro.org
Mon Jul 16 09:23:39 UTC 2018


The need to support some straight-forward VGA panels that are
not adhering to any standard like DPI arise in the ARM RTSM VE
Real-Time Systems Model Virtual Executive. This emulator (which
is not QEMU) does not model any bridge or panel other than
displaying whatever the user defines that they have.

Currently a fake "DPI panel" is used for this with the old
FBDEV driver, but this is wrong as it is not conforming to any
MIPI DPI standards. However the resolution chosen there is
standard VGA, and we can cover this with the simple panel
by simply adding the most common VGA resolutions as a kind
of "simple panel".

In difference from other cases where "simple panel" might be
hiding something more complex (such as a panel driver or bridge)
this case is actually applicable, since we are running inside
a simulation with no real hardware on the output.

Cc: devicetree at vger.kernel.org
Cc: Sudeep Holla <sudeep.holla at arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi at arm.com>
Cc: Liviu Dudau <liviu.dudau at arm.com>
Cc: Robin Murphy <robin.murphy at arm.com>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
---
 .../display/panel/video-graphics-array.txt    | 21 ++++++
 drivers/gpu/drm/panel/panel-simple.c          | 66 +++++++++++++++++++
 2 files changed, 87 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/video-graphics-array.txt

diff --git a/Documentation/devicetree/bindings/display/panel/video-graphics-array.txt b/Documentation/devicetree/bindings/display/panel/video-graphics-array.txt
new file mode 100644
index 000000000000..193d24ebe052
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/video-graphics-array.txt
@@ -0,0 +1,21 @@
+Video Graphics Array
+
+This binding is for simple panels using the standardized VGA resolutions
+defined by de facto standards beginning with the IBM PS/2 in 1987.
+
+Required properties:
+- compatible: should be "video-graphics-array"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
+
+Example:
+
+panel {
+	compatible = "video-graphics-array";
+	port {
+		vga_panel_in: endpoint {
+			remote-endpoint = <&foo>;
+		};
+	};
+};
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index cbf1ab404ee7..db4db5a3f75e 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -2069,6 +2069,69 @@ static const struct panel_desc winstar_wf35ltiacd = {
 	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
 };
 
+static const struct drm_display_mode video_graphics_array_modes[] = {
+	{
+		/*
+		 * This is the most standardized "vanilla" VGA mode there is:
+		 * 640x480 @ 60 Hz
+		 */
+		.clock = 27175,
+		.hdisplay = 640,
+		.hsync_start = 640 + 16,
+		.hsync_end = 640 + 16 + 96,
+		.htotal = 640 + 16 + 96 + 48,
+		.vdisplay = 480,
+		.vsync_start = 480 + 10,
+		.vsync_end = 480 + 10 + 2,
+		.vtotal = 480 + 10 + 2 + 33,
+		.vrefresh = 60,
+		.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+	},
+	{
+		/* SVGA 800x600 @60 Hz */
+		.clock = 40000,
+		.hdisplay = 800,
+		.hsync_start = 800 + 40,
+		.hsync_end = 800 + 40 + 128,
+		.htotal = 800 + 40 + 128 + 88,
+		.vdisplay = 600,
+		.vsync_start = 600 + 1,
+		.vsync_end = 600 + 1 + 4,
+		.vtotal = 600 + 1 + 4 + 23,
+		.vrefresh = 60,
+		.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+	},
+	{
+		/* XGA 1024x768 @60 Hz */
+		.clock = 65000,
+		.hdisplay = 1024,
+		.hsync_start = 1024 + 24,
+		.hsync_end = 1024 + 24 + 136,
+		.htotal = 1024 + 24 + 136 + 160,
+		.vdisplay = 768,
+		.vsync_start = 768 + 3,
+		.vsync_end = 768 + 3 + 6,
+		.vtotal = 768 + 3 + 6 + 29,
+		.vrefresh = 60,
+		.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
+	},
+};
+
+static const struct panel_desc video_graphics_array = {
+	.modes = video_graphics_array_modes,
+	.num_modes = ARRAY_SIZE(video_graphics_array_modes),
+	.bpc = 8,
+	/*
+	 * Some typical 4:3 aspect ratio VGA monitor surely has these dimensions
+	 * of 40x30 mm.
+	 */
+	.size = {
+		.width = 400,
+		.height = 300,
+	},
+	.bus_format = MEDIA_BUS_FMT_RGB888_1X24,
+};
+
 static const struct of_device_id platform_of_match[] = {
 	{
 		.compatible = "ampire,am-480272h3tmqw-t01h",
@@ -2286,6 +2349,9 @@ static const struct of_device_id platform_of_match[] = {
 	}, {
 		.compatible = "winstar,wf35ltiacd",
 		.data = &winstar_wf35ltiacd,
+	}, {
+		.compatible = "video-graphics-array",
+		.data = &video_graphics_array,
 	}, {
 		/* sentinel */
 	}
-- 
2.17.0



More information about the dri-devel mailing list