Re: [PATCH] [v2] drivers/video: use strings to specify the Freescale DIU monitor port

2011-07-13 Thread Paul Mundt
On Sat, Jul 09, 2011 at 03:38:14PM -0500, Timur Tabi wrote:
 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.
 
 Signed-off-by: Timur Tabi ti...@freescale.com
 Acked-by: Anatolij Gustschin ag...@denx.de
 ---
  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.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


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

2011-07-09 Thread 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.

Signed-off-by: Timur Tabi ti...@freescale.com
Acked-by: Anatolij Gustschin ag...@denx.de
---
 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(-)

diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c 
b/arch/powerpc/platforms/512x/mpc512x_shared.c
index e41ebbd..3dc62f9 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -66,8 +66,8 @@ struct fsl_diu_shared_fb {
boolin_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 0x0400;
 }
 
-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
 }
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c 
b/arch/powerpc/platforms/85xx/p1022_ds.c
index 266b3aa..c01c727 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -93,8 +93,8 @@
  * The Area Descriptor is a 32-bit value that determine which bits in each
  * pixel are to be used for each color.
  */
-static unsigned int p1022ds_get_pixel_format(unsigned int bits_per_pixel,
-   int monitor_port)
+static u32 p1022ds_get_pixel_format(enum fsl_diu_monitor_port port,
+   unsigned int bits_per_pixel)
 {
switch (bits_per_pixel) {
case 32:
@@ -118,7 +118,8 @@ static unsigned int p1022ds_get_pixel_format(unsigned int 
bits_per_pixel,
  * On some boards, the gamma table for some ports may need to be modified.
  * This is not the case on the P1022DS, so we do nothing.
 */
-static void p1022ds_set_gamma_table(int monitor_port, char *gamma_table_base)
+static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port,
+   char *gamma_table_base)
 {
 }
 
@@ -126,7 +127,7 @@ static void p1022ds_set_gamma_table(int monitor_port, char 
*gamma_table_base)
  * p1022ds_set_monitor_port: switch the output to a different monitor port
  *
  */
-static void p1022ds_set_monitor_port(int monitor_port)
+static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port)
 {
struct device_node *pixis_node;
void __iomem *pixis;
@@ -145,19 +146,21 @@ static void p1022ds_set_monitor_port(int monitor_port)
}
brdcfg1 = pixis + 9;/* BRDCFG1 is at offset 9 in the ngPIXIS */
 
-   switch (monitor_port) {
-   case 0: /* DVI */
+   switch (port) {
+   case FSL_DIU_PORT_DVI:
+   printk(KERN_INFO %s:%u\n, __func__, __LINE__);
/* Enable the DVI port, disable the DFP and the backlight */
clrsetbits_8(brdcfg1, PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT,
 PX_BRDCFG1_DVIEN);