diff mbox series

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

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

Commit Message

Geert Uytterhoeven March 31, 2023, 2:49 p.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>
---
Not intended for upstream merge.
The final solution should be DT-based, and include removal of this file.

proper operation, this depends on "[PATCH 0/5] drm: shmobile: Fixes and
enhancements"
https://lore.kernel.org/r/cover.1680273039.git.geert+renesas@glider.be
---
 drivers/staging/board/armadillo800eva.c | 37 +++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
diff mbox series

Patch

diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
index 0225234dd7aa6b1c..e5ce61b54b1ca3fb 100644
--- a/drivers/staging/board/armadillo800eva.c
+++ b/drivers/staging/board/armadillo800eva.c
@@ -12,6 +12,7 @@ 
 #include <linux/dma-mapping.h>
 #include <linux/fb.h>
 #include <linux/kernel.h>
+#include <linux/platform_data/shmob_drm.h>
 #include <linux/platform_device.h>
 #include <linux/videodev2.h>
 
@@ -19,6 +20,33 @@ 
 
 #include "board.h"
 
+#ifdef CONFIG_DRM_SHMOBILE
+static struct shmob_drm_platform_data lcdc0_info = {
+	.clk_source = SHMOB_DRM_CLK_BUS,
+	.iface = {
+		.interface = SHMOB_DRM_IFACE_RGB24,
+		.clk_div = 5,
+	},
+	.panel = {
+		.width_mm = 111,
+		.height_mm = 68,
+		.mode = {
+			// Timings based on AMPIRE AM-800480L1TMQW-T00H-L
+			// datasheet
+			.name		= "AMPIRE/AM-800480",
+			.clock		= 33264,
+			.hdisplay	= 800,
+			.hsync_start	= 840,
+			.hsync_end	= 968,
+			.htotal		= 1056,
+			.vdisplay	= 480,
+			.vsync_start	= 515,
+			.vsync_end	= 517,
+			.vtotal		= 525,
+		},
+	},
+};
+#else
 static struct fb_videomode lcdc0_mode = {
 	.name		= "AMPIER/AM-800480",
 	.xres		= 800,
@@ -48,6 +76,7 @@  static struct sh_mobile_lcdc_info lcdc0_info = {
 		},
 	},
 };
+#endif
 
 static struct resource lcdc0_resources[] = {
 	DEFINE_RES_MEM_NAMED(0xfe940000, 0x4000, "LCD0"),
@@ -55,7 +84,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 +99,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 = {