drivers/video: use strings to specify the Freescale DIU monitor port
Subsystems (4)
PATCH 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 | 73 +++++++++++++++++++------ 5 files changed, 128 insertions(+), 94 deletions(-)
arch/powerpc/platforms/512x/mpc512x_shared.c +9 -13
@@ -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
@@ -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 -17
132 lines not on this page · raw message
Signature · 1 line
1.7.3.4
Re: [PATCH] drivers/video: use strings to specify the Freescale DIU
Quoted 8 lines · On Thu, 7 Jul 2011 11:51:06 -0500 Timur Tabi <[email protected]> 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.
Quoted 8 lines
Signed-off-by Timur Tabi <[email protected]>--- 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 | 73 +++++++++++++++++++------ 5 files changed, 128 insertions(+), 94 deletions(-)
It mostly looks okay to me, please see one comment below. Otherwise
...
Quoted 4 lines
drivers/video/fsl-diu-fb.c +0
-0
...
drivers/video/fsl-diu-fb.c static int fsl_diu_set_par(struct fb_info *info) · line 866
Quoted 7 lines
drivers/video/fsl-diu-fb.c +2
-1@@ -832,8 +862,8 @@ static int fsl_diu_set_par(struct fb_info *info) } ad->pix_fmt > - diu_ops.get_pixel_format (var->bits_per_pixel, - machine_data->monitor_port); +cpu_to_be32 (diu_ops.get_pixel_format (machine_data->monitor_port, + var->bits_per_pixel));
I think you can drop cpu_to_be32 here, it is somehow confusing. The descriptor fields are LE32, get_pixel_format() returns LE32 value.
drivers/video/fsl-diu-fb.c static int fsl_diu_set_par(struct fb_info *info) · line 867
Quoted 1 line
drivers/video/fsl-diu-fb.c +0
-0ad->addr =cpu_to_le32 (info->fix.smem_start);
Thanks,
Anatolij
Re: [PATCH] drivers/video: use strings to specify the Freescale DIU
Quoted 7 lines · Anatolij Gustschin
Quoted 4 lines
Quoted 4 lines
ad->pix_fmt >> > - diu_ops.get_pixel_format(var->bits_per_pixel,-
machine_data->monitor_port);
+ cpu_to_be32(diu_ops.get_pixel_format(machine_data->monitor_port,
+var->bits_per_pixel));I think you can drop
cpu_to_be32here, it is somehow confusing. The descriptor fields are LE32,
Not according to the structure definition:
struct diu_ad {
/* Word 0(32-bit) in DDR memory *//* __u16 comp; */
/* __u16 pixel_s:2; */
/* __u16 pallete:1; */
/* __u16 red_c:2; */
/* __u16 green_c:2; */
/* __u16 blue_c:2; */
/* __u16 alpha_c:3; */
/* __u16 byte_f:1; */
/* __u16 res0:3; */
__be32 pix_fmt; /* hard coding pixel format */
I see other places where the endianness of pix_fmt is assumed. I'll have to fix those later.
When I look at the 5121 and 1022 reference manuals, it says that the area descriptor is little-endian. I think York made this register big-endian so that it matches the endianness of get_pixel_format(), which doesn't make much sense. I'll have to fix the whole endianness thing with pix_fmt in another patch.
Quoted 1 line
get_pixel_format()returns LE32 value.
I don't think the endianness of get_pixel_format() is fixed. It's whatever the CPU native endiannes is. That's why I added a cpu_to_be32().
Anyway, I'm not quite sure what the right answer is, but it seems obvious that cpu_to_be32() is wrong. I'll post another patch which removes it.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale