From 4a64e49df282d55754f9bbb5f14ca4d783128df4 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Thu, 15 Sep 2011 16:44:48 -0500 Subject: drivers/video: fsl-diu-fb: remove unused ioctls Remove some unused ioctl commands, and treat those commands as unsupported instead of ignored. Also remove struct mfb_alpha, which isn't used by any ioctl. It may have been once intended for MFB_SET_ALPHA, but that ioctl uses a different data structure. Signed-off-by: Timur Tabi Signed-off-by: Florian Tobias Schandinat --- include/linux/fsl-diu-fb.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include/linux/fsl-diu-fb.h') diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index daa9952d2174..5ebffa69a0f6 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -27,11 +27,6 @@ #include -struct mfb_alpha { - int enable; - int alpha; -}; - struct mfb_chroma_key { int enable; __u8 red_max; -- cgit v1.2.3 From 251b9b0d403f61f507155697a459038b2ee3336c Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Thu, 15 Sep 2011 16:44:57 -0500 Subject: drivers/video: fsl-diu-fb: the video buffer is not I/O memory The video buffer is not uncached memory-mapped I/O, so don't tag the virtual address as __iomem. It's also not a u8*. Signed-off-by: Timur Tabi Signed-off-by: Florian Tobias Schandinat --- include/linux/fsl-diu-fb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux/fsl-diu-fb.h') diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index 5ebffa69a0f6..35ac0c53975c 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -162,7 +162,7 @@ struct diu_hw { }; struct diu_addr { - __u8 __iomem *vaddr; /* Virtual address */ + void *vaddr; /* Virtual address */ dma_addr_t paddr; /* Physical address */ __u32 offset; }; -- cgit v1.2.3 From 2b7a905dd0d24d14a1099653ba63b7113a82fc54 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Thu, 15 Sep 2011 16:44:58 -0500 Subject: drivers/video: fsl-diu-fb: remove unusued MEM_ALLOC_THRESHOLD If there was ever any code that used MEM_ALLOC_THRESHOLD, it was removed a long time ago. Signed-off-by: Timur Tabi Signed-off-by: Florian Tobias Schandinat --- include/linux/fsl-diu-fb.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include/linux/fsl-diu-fb.h') diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index 35ac0c53975c..df23f599f5db 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -20,11 +20,6 @@ #ifndef __FSL_DIU_FB_H__ #define __FSL_DIU_FB_H__ -/* Arbitrary threshold to determine the allocation method - * See mpc8610fb_set_par(), map_video_memory(), and unmap_video_memory() - */ -#define MEM_ALLOC_THRESHOLD (1024*768*4+32) - #include struct mfb_chroma_key { -- cgit v1.2.3 From 36b0b1d41541fc3b25faf38aa53c34cede357421 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Tue, 4 Oct 2011 19:36:44 -0500 Subject: drivers/video: fsl-diu-fb: fix some ioctls Use the _IOx macros to define the ioctl commands, instead of hard-coded numbers. Unfortunately, the original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the wrong value for the size, so these macros have new values now. To avoid breaking binary compatibility with older applications, we retain support for the original values, but the driver displays a warning message if they're used. Also remove the FBIOGET_GWINFO and FBIOPUT_GWINFO ioctls. FBIOPUT_GWINFO was never implemented, and FBIOGET_GWINFO was never used by any application. Signed-off-by: Timur Tabi Signed-off-by: Florian Tobias Schandinat --- drivers/video/fsl-diu-fb.c | 16 ++++++++-------- include/linux/fsl-diu-fb.h | 27 ++++++++++++++++----------- 2 files changed, 24 insertions(+), 19 deletions(-) (limited to 'include/linux/fsl-diu-fb.h') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 5137fbb6295f..9a1f6d276ee3 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -966,11 +966,19 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, if (!arg) return -EINVAL; switch (cmd) { + case MFB_SET_PIXFMT_OLD: + dev_warn(info->dev, + "MFB_SET_PIXFMT value of 0x%08x is deprecated.\n", + MFB_SET_PIXFMT_OLD); case MFB_SET_PIXFMT: if (copy_from_user(&pix_fmt, buf, sizeof(pix_fmt))) return -EFAULT; ad->pix_fmt = pix_fmt; break; + case MFB_GET_PIXFMT_OLD: + dev_warn(info->dev, + "MFB_GET_PIXFMT value of 0x%08x is deprecated.\n", + MFB_GET_PIXFMT_OLD); case MFB_GET_PIXFMT: pix_fmt = ad->pix_fmt; if (copy_to_user(buf, &pix_fmt, sizeof(pix_fmt))) @@ -1030,14 +1038,6 @@ static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd, ad->ckmin_b = ck.blue_min; } break; - case FBIOGET_GWINFO: - if (mfbi->type == MFB_TYPE_OFF) - return -ENODEV; - /* get graphic window information */ - if (copy_to_user(buf, ad, sizeof(*ad))) - return -EFAULT; - break; - default: dev_err(info->dev, "unknown ioctl command (0x%08X)\n", cmd); return -ENOIOCTLCMD; diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index df23f599f5db..e19c531be065 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -33,22 +33,27 @@ struct mfb_chroma_key { }; struct aoi_display_offset { - int x_aoi_d; - int y_aoi_d; + __s32 x_aoi_d; + __s32 y_aoi_d; }; #define MFB_SET_CHROMA_KEY _IOW('M', 1, struct mfb_chroma_key) #define MFB_SET_BRIGHTNESS _IOW('M', 3, __u8) +#define MFB_SET_ALPHA _IOW('M', 0, __u8) +#define MFB_GET_ALPHA _IOR('M', 0, __u8) +#define MFB_SET_AOID _IOW('M', 4, struct aoi_display_offset) +#define MFB_GET_AOID _IOR('M', 4, struct aoi_display_offset) +#define MFB_SET_PIXFMT _IOW('M', 8, __u32) +#define MFB_GET_PIXFMT _IOR('M', 8, __u32) -#define MFB_SET_ALPHA 0x80014d00 -#define MFB_GET_ALPHA 0x40014d00 -#define MFB_SET_AOID 0x80084d04 -#define MFB_GET_AOID 0x40084d04 -#define MFB_SET_PIXFMT 0x80014d08 -#define MFB_GET_PIXFMT 0x40014d08 - -#define FBIOGET_GWINFO 0x46E0 -#define FBIOPUT_GWINFO 0x46E1 +/* + * The original definitions of MFB_SET_PIXFMT and MFB_GET_PIXFMT used the + * wrong value for 'size' field of the ioctl. The current macros above use the + * right size, but we still need to provide backwards compatibility, at least + * for a while. +*/ +#define MFB_SET_PIXFMT_OLD 0x80014d08 +#define MFB_GET_PIXFMT_OLD 0x40014d08 #ifdef __KERNEL__ #include -- cgit v1.2.3 From b715f9f04c85382e9ac824ba49465fc15cf67418 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Wed, 28 Sep 2011 16:19:48 -0500 Subject: drivers/video: fsl-diu-fb: move some definitions out of the header file Move several macros and structures from the Freescale DIU driver's header file into the source file, because they're only used by that file. Also delete a few unused macros. The diu and diu_ad structures cannot be moved because they're being used by the MPC5121 platform file. A future patch eliminate the need for the platform file to access these structs, so they'll be moved also. Signed-off-by: Timur Tabi Signed-off-by: Florian Tobias Schandinat --- drivers/video/fsl-diu-fb.c | 39 ++++++++++++++++++++++++++++++++++++++ include/linux/fsl-diu-fb.h | 47 ---------------------------------------------- 2 files changed, 39 insertions(+), 47 deletions(-) (limited to 'include/linux/fsl-diu-fb.h') diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 9a1f6d276ee3..9b3891a6a187 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -30,11 +30,50 @@ #include #include #include +#include #include #include #include "edid.h" +#define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */ + /* 1 for plane 0, 2 for plane 1&2 each */ + +/* HW cursor parameters */ +#define MAX_CURS 32 + +/* INT_STATUS/INT_MASK field descriptions */ +#define INT_VSYNC 0x01 /* Vsync interrupt */ +#define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */ +#define INT_UNDRUN 0x04 /* Under run exception interrupt */ +#define INT_PARERR 0x08 /* Display parameters error interrupt */ +#define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */ + +/* Panels'operation modes */ +#define MFB_TYPE_OUTPUT 0 /* Panel output to display */ +#define MFB_TYPE_OFF 1 /* Panel off */ +#define MFB_TYPE_WB 2 /* Panel written back to memory */ +#define MFB_TYPE_TEST 3 /* Panel generate color bar */ + +struct diu_hw { + struct diu __iomem *diu_reg; + spinlock_t reg_lock; + unsigned int mode; /* DIU operation mode */ +}; + +struct diu_addr { + void *vaddr; /* Virtual address */ + dma_addr_t paddr; /* Physical address */ + __u32 offset; +}; + +struct diu_pool { + struct diu_addr ad; + struct diu_addr gamma; + struct diu_addr pallete; + struct diu_addr cursor; +}; + /* * List of supported video modes * diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index e19c531be065..363d5e290cad 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -56,7 +56,6 @@ struct aoi_display_offset { #define MFB_GET_PIXFMT_OLD 0x40014d08 #ifdef __KERNEL__ -#include /* * These are the fields of area descriptor(in DDR memory) for every plane @@ -154,39 +153,6 @@ struct diu { __be32 plut; } __attribute__ ((packed)); -struct diu_hw { - struct diu *diu_reg; - spinlock_t reg_lock; - - __u32 mode; /* DIU operation mode */ -}; - -struct diu_addr { - void *vaddr; /* Virtual address */ - dma_addr_t paddr; /* Physical address */ - __u32 offset; -}; - -struct diu_pool { - struct diu_addr ad; - struct diu_addr gamma; - struct diu_addr pallete; - struct diu_addr cursor; -}; - -#define FSL_DIU_BASE_OFFSET 0x2C000 /* Offset of DIU */ -#define INT_LCDC 64 /* DIU interrupt number */ - -#define FSL_AOI_NUM 6 /* 5 AOIs and one dummy AOI */ - /* 1 for plane 0, 2 for plane 1&2 each */ - -/* Minimum X and Y resolutions */ -#define MIN_XRES 64 -#define MIN_YRES 64 - -/* HW cursor parameters */ -#define MAX_CURS 32 - /* Modes of operation of DIU */ #define MFB_MODE0 0 /* DIU off */ #define MFB_MODE1 1 /* All three planes output to display */ @@ -194,18 +160,5 @@ struct diu_pool { #define MFB_MODE3 3 /* All three planes written back to memory */ #define MFB_MODE4 4 /* Color bar generation */ -/* INT_STATUS/INT_MASK field descriptions */ -#define INT_VSYNC 0x01 /* Vsync interrupt */ -#define INT_VSYNC_WB 0x02 /* Vsync interrupt for write back operation */ -#define INT_UNDRUN 0x04 /* Under run exception interrupt */ -#define INT_PARERR 0x08 /* Display parameters error interrupt */ -#define INT_LS_BF_VS 0x10 /* Lines before vsync. interrupt */ - -/* Panels'operation modes */ -#define MFB_TYPE_OUTPUT 0 /* Panel output to display */ -#define MFB_TYPE_OFF 1 /* Panel off */ -#define MFB_TYPE_WB 2 /* Panel written back to memory */ -#define MFB_TYPE_TEST 3 /* Panel generate color bar */ - #endif /* __KERNEL__ */ #endif /* __FSL_DIU_FB_H__ */ -- cgit v1.2.3 From c4e5a0232763db22d6c60c391ed5816b2b2ac063 Mon Sep 17 00:00:00 2001 From: Timur Tabi Date: Wed, 28 Sep 2011 16:19:53 -0500 Subject: drivers/video: fsl-diu-fb: only DIU modes 0 and 1 are supported The Freescale DIU video controller supports five video "modes", but only the first two are used by the driver. The other three are special modes that don't make sense for a framebuffer driver. Therefore, there's no point in keeping a global variable that indicates which mode we're supposed to use. Signed-off-by: Timur Tabi Signed-off-by: Florian Tobias Schandinat --- arch/powerpc/platforms/512x/mpc512x_shared.c | 2 +- drivers/video/fsl-diu-fb.c | 11 +++-------- include/linux/fsl-diu-fb.h | 8 ++++---- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'include/linux/fsl-diu-fb.h') diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c index 3dc62f907a1e..cfe958e94e1e 100644 --- a/arch/powerpc/platforms/512x/mpc512x_shared.c +++ b/arch/powerpc/platforms/512x/mpc512x_shared.c @@ -253,7 +253,7 @@ void __init mpc512x_init_diu(void) } mode = in_be32(&diu_reg->diu_mode); - if (mode != MFB_MODE1) { + if (mode == MFB_MODE0) { pr_info("%s: DIU OFF\n", __func__); goto out; } diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 0fd4c784f8df..6539e70cb59a 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c @@ -52,7 +52,6 @@ struct diu_hw { struct diu __iomem *diu_reg; spinlock_t reg_lock; - unsigned int mode; /* DIU operation mode */ }; struct diu_addr { @@ -426,7 +425,6 @@ static struct mfb_info mfb_template[] = { }; static struct diu_hw dr = { - .mode = MFB_MODE1, .reg_lock = __SPIN_LOCK_UNLOCKED(diu_hw.reg_lock), }; @@ -620,7 +618,7 @@ static void enable_lcdc(struct fb_info *info) struct fsl_diu_data *machine_data = mfbi->parent; if (!machine_data->fb_enabled) { - out_be32(&hw->diu_mode, dr.mode); + out_be32(&hw->diu_mode, MFB_MODE1); machine_data->fb_enabled++; } } @@ -1390,9 +1388,6 @@ static int request_irq_local(int irq) ints |= INT_VSYNC; #endif - if (dr.mode == MFB_MODE2 || dr.mode == MFB_MODE3) - ints |= INT_VSYNC_WB; - /* Read to clear the status */ in_be32(&hw->int_status); out_be32(&hw->int_mask, ints); @@ -1558,7 +1553,7 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) } diu_mode = in_be32(&dr.diu_reg->diu_mode); - if (diu_mode != MFB_MODE1) + if (diu_mode == MFB_MODE0) out_be32(&dr.diu_reg->diu_mode, 0); /* disable DIU */ /* Get the IRQ of the DIU */ @@ -1611,7 +1606,7 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) * Let DIU display splash screen if it was pre-initialized * by the bootloader, set dummy area descriptor otherwise. */ - if (diu_mode != MFB_MODE1) + if (diu_mode == MFB_MODE0) out_be32(&dr.diu_reg->desc[0], machine_data->dummy_ad->paddr); out_be32(&dr.diu_reg->desc[1], machine_data->dummy_ad->paddr); diff --git a/include/linux/fsl-diu-fb.h b/include/linux/fsl-diu-fb.h index 363d5e290cad..11c16a1fb9e3 100644 --- a/include/linux/fsl-diu-fb.h +++ b/include/linux/fsl-diu-fb.h @@ -153,12 +153,12 @@ struct diu { __be32 plut; } __attribute__ ((packed)); -/* Modes of operation of DIU */ +/* + * Modes of operation of DIU. The DIU supports five different modes, but + * the driver only supports modes 0 and 1. + */ #define MFB_MODE0 0 /* DIU off */ #define MFB_MODE1 1 /* All three planes output to display */ -#define MFB_MODE2 2 /* Plane 1 to display, planes 2+3 written back*/ -#define MFB_MODE3 3 /* All three planes written back to memory */ -#define MFB_MODE4 4 /* Color bar generation */ #endif /* __KERNEL__ */ #endif /* __FSL_DIU_FB_H__ */ -- cgit v1.2.3