Skip to contentSkip to conversation

drivers/video: use strings to specify the Freescale DIU monitor port

PATCH Applied Timur Tabi 2 participants 2 messages Jul 9, 2011 – Jul 13, 2011

Subsystems (4)
lore
Share & tools
lore

Timur Tabi

author
#0 lore raw

PATCH v2 1/1 drivers/video: use strings to specify the Freescale DIU monitor port

Instead of using ill-defined numbers (0, 1, and 2) for the monitor port, allow the user to specify the port by name ("dvi", "lvds", or "dlvds"). This works on the kernel command line, the module command-line, and the sysfs "monitor" device.

Note that changing the monitor port does not currently work on the P1022DS, because the code that talks to the PIXIS FPGA is broken.

---
 arch/powerpc/platforms/512x/mpc512x_shared.c |   22 +++-----
 arch/powerpc/platforms/85xx/p1022_ds.c       |   47 ++++++++---------
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c   |   55 +++++++++----------
 arch/powerpc/sysdev/fsl_soc.h                |   25 ++++++---
 drivers/video/fsl-diu-fb.c                   |   74 +++++++++++++++++++-------
 5 files changed, 128 insertions(+), 95 deletions(-)
arch/powerpc/platforms/512x/mpc512x_shared.c +9 -13
index e41ebbd..3dc62f9 100644
@@ -66,8 +66,8 @@ struct fsl_diu_shared_fb {
 	bool		in_use;
 };
 
-unsigned int mpc512x_get_pixel_format(unsigned int bits_per_pixel,
-				      int monitor_port)
+u32 mpc512x_get_pixel_format(enum fsl_diu_monitor_port port,
+			     unsigned int bits_per_pixel)
 {
 	switch (bits_per_pixel) {
 	case 32:
@@ -80,11 +80,12 @@ unsigned int mpc512x_get_pixel_format(unsigned int bits_per_pixel,
 	return 0x00000400;
 }
 
-void mpc512x_set_gamma_table(int monitor_port, char *gamma_table_base)
+void mpc512x_set_gamma_table(enum fsl_diu_monitor_port port,
+			     char *gamma_table_base)
 {
 }
 
-void mpc512x_set_monitor_port(int monitor_port)
+void mpc512x_set_monitor_port(enum fsl_diu_monitor_port port)
 {
 }
 
@@ -182,14 +183,10 @@ void mpc512x_set_pixel_clock(unsigned int pixclock)
 	iounmap(ccm);
 }
 
-ssize_t mpc512x_show_monitor_port(int monitor_port, char *buf)
+enum fsl_diu_monitor_port
+mpc512x_valid_monitor_port(enum fsl_diu_monitor_port port)
 {
-	return sprintf(buf, "0 - 5121 LCD\n");
-}
-
-int mpc512x_set_sysfs_monitor_port(int val)
-{
-	return 0;
+	return FSL_DIU_PORT_DVI;
 }
 
 static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb;
@@ -332,8 +329,7 @@ void __init mpc512x_setup_diu(void)
 	diu_ops.set_gamma_table		= mpc512x_set_gamma_table;
 	diu_ops.set_monitor_port	= mpc512x_set_monitor_port;
 	diu_ops.set_pixel_clock		= mpc512x_set_pixel_clock;
-	diu_ops.show_monitor_port	= mpc512x_show_monitor_port;
-	diu_ops.set_sysfs_monitor_port	= mpc512x_set_sysfs_monitor_port;
+	diu_ops.valid_monitor_port	= mpc512x_valid_monitor_port;
 	diu_ops.release_bootmem		= mpc512x_release_bootmem;
 #endif
 }
arch/powerpc/platforms/85xx/p1022_ds.c +22 -25

94 lines not on this page · raw message

arch/powerpc/platforms/86xx/mpc8610_hpcd.c +24 -30

96 lines not on this page · raw message

arch/powerpc/sysdev/fsl_soc.h +17 -8
index 2ece02b..c6d0073 100644
@@ -22,15 +22,24 @@ struct device_node;
 extern void fsl_rstcr_restart(char *cmd);
 
 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
+
+/* The different ports that the DIU can be connected to */
+enum fsl_diu_monitor_port {
+	FSL_DIU_PORT_DVI,	/* DVI */
+	FSL_DIU_PORT_LVDS,	/* Single-link LVDS */
+	FSL_DIU_PORT_DLVDS	/* Dual-link LVDS */
+};
+
 struct platform_diu_data_ops {
-	unsigned int (*get_pixel_format) (unsigned int bits_per_pixel,
-		int monitor_port);
-	void (*set_gamma_table) (int monitor_port, char *gamma_table_base);
-	void (*set_monitor_port) (int monitor_port);
-	void (*set_pixel_clock) (unsigned int pixclock);
-	ssize_t (*show_monitor_port) (int monitor_port, char *buf);
-	int (*set_sysfs_monitor_port) (int val);
-	void (*release_bootmem) (void);
+	u32 (*get_pixel_format)(enum fsl_diu_monitor_port port,
+		unsigned int bpp);
+	void (*set_gamma_table)(enum fsl_diu_monitor_port port,
+		char *gamma_table_base);
+	void (*set_monitor_port)(enum fsl_diu_monitor_port port);
+	void (*set_pixel_clock)(unsigned int pixclock);
+	enum fsl_diu_monitor_port (*valid_monitor_port)
+		(enum fsl_diu_monitor_port port);
+	void (*release_bootmem)(void);
 };
 
 extern struct platform_diu_data_ops diu_ops;
drivers/video/fsl-diu-fb.c +55 -18

133 lines not on this page · raw message

Signature · 1 line
1.7.4.4
Applied
#1 lore raw
Quoted 10 lines · Timur Tabi

Instead of using ill-defined numbers (0, 1, and 2) for the monitor port, allow the user to specify the port by name ("dvi", "lvds", or "dlvds"). This works on the kernel command line, the module command-line, and the sysfs "monitor" device.

Note that changing the monitor port does not currently work on the P1022DS, because the code that talks to the PIXIS FPGA is broken.

Quoted 8 lines
---
 arch/powerpc/platforms/512x/mpc512x_shared.c |   22 +++-----
 arch/powerpc/platforms/85xx/p1022_ds.c       |   47 ++++++++---------
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c   |   55 +++++++++----------
 arch/powerpc/sysdev/fsl_soc.h                |   25 ++++++---
 drivers/video/fsl-diu-fb.c                   |   74 +++++++++++++++++++-------
 5 files changed, 128 insertions(+), 95 deletions(-)

Applied, thanks.