diff mbox series

[PATCH/RFC] staging: board: armadillo800eva: Add DRM support

Message ID f7874a9da4bcb20fbc9cd133147b67862ebcf0b9.1687418281.git.geert+renesas@glider.be (mailing list archive)
State RFC
Delegated to: Geert Uytterhoeven
Headers show
Series [PATCH/RFC] staging: board: armadillo800eva: Add DRM support | expand

Commit Message

Geert Uytterhoeven June 22, 2023, 9:23 a.m. UTC
Add support for using the SH-Mobile DRM driver instead of the SH-Mobile
LCDC framebuffer driver.

Based on old kzm9g conversion prototype code by Laurent Pinchart.

Note that the new timings are slightly different, as they are based on
the AMPIRE AM-800480L1TMQW-T00H-L datasheet.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/c03d4edbd650836bf6a96504df82338ec6d800ff.1680272980.git.geert+renesas@glider.be
---
Not intended for upstream merge.
The final solution will be DT-based, and will include removal of this
file.

For proper operation, this depends on patch series "[PATCH 00/39] drm:
renesas: shmobile: Atomic conversion + DT support"
https://lore.kernel.org/r/cover.1687423204.git.geert+renesas@glider.be

v2:
  - Use struct videomode in platform data,
  - Use media bus formats in platform data.
---
 drivers/staging/board/armadillo800eva.c | 42 +++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
diff mbox series

Patch

diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
index 0225234dd7aa6b1c..d1605ca73316b92c 100644
--- a/drivers/staging/board/armadillo800eva.c
+++ b/drivers/staging/board/armadillo800eva.c
@@ -12,6 +12,8 @@ 
 #include <linux/dma-mapping.h>
 #include <linux/fb.h>
 #include <linux/kernel.h>
+#include <linux/media-bus-format.h>
+#include <linux/platform_data/shmob_drm.h>
 #include <linux/platform_device.h>
 #include <linux/videodev2.h>
 
@@ -19,6 +21,37 @@ 
 
 #include "board.h"
 
+#ifdef CONFIG_DRM_SHMOBILE
+static struct shmob_drm_platform_data lcdc0_info = {
+	.clk_source = SHMOB_DRM_CLK_BUS,
+	.iface = {
+		.bus_fmt = MEDIA_BUS_FMT_RGB888_1X24,
+		.clk_div = 5,
+	},
+	.panel = {
+		.width_mm = 111,
+		.height_mm = 67,
+		.mode = {
+			// Timings based on AMPIRE AM-800480L1TMQW-T00H-L
+			// datasheet
+			.pixelclock = 33264000,
+			.hactive = 800,
+			.hfront_porch = 40,
+			.hback_porch = 88,
+			.hsync_len = 128,
+			.vactive = 480,
+			.vfront_porch = 35,
+			.vback_porch = 8,
+			.vsync_len = 2,
+			.flags = DISPLAY_FLAGS_HSYNC_LOW |
+				 DISPLAY_FLAGS_VSYNC_LOW |
+				 DISPLAY_FLAGS_DE_HIGH |
+				 DISPLAY_FLAGS_PIXDATA_POSEDGE |
+				 DISPLAY_FLAGS_SYNC_POSEDGE,
+		},
+	},
+};
+#else
 static struct fb_videomode lcdc0_mode = {
 	.name		= "AMPIER/AM-800480",
 	.xres		= 800,
@@ -48,6 +81,7 @@  static struct sh_mobile_lcdc_info lcdc0_info = {
 		},
 	},
 };
+#endif
 
 static struct resource lcdc0_resources[] = {
 	DEFINE_RES_MEM_NAMED(0xfe940000, 0x4000, "LCD0"),
@@ -55,7 +89,11 @@  static struct resource lcdc0_resources[] = {
 };
 
 static struct platform_device lcdc0_device = {
+#ifdef CONFIG_DRM_SHMOBILE
+	.name		= "shmob-drm",
+#else
 	.name		= "sh_mobile_lcdc_fb",
+#endif
 	.num_resources	= ARRAY_SIZE(lcdc0_resources),
 	.resource	= lcdc0_resources,
 	.id		= 0,
@@ -66,7 +104,11 @@  static struct platform_device lcdc0_device = {
 };
 
 static const struct board_staging_clk lcdc0_clocks[] __initconst = {
+#ifdef CONFIG_DRM_SHMOBILE
+	{ "lcdc0", NULL, "shmob-drm.0" },
+#else
 	{ "lcdc0", NULL, "sh_mobile_lcdc_fb.0" },
+#endif
 };
 
 static const struct board_staging_dev armadillo800eva_devices[] __initconst = {