From mboxrd@z Thu Jan 1 00:00:00 1970 From: weitway@gmail.com (weitway at gmail.com) Date: Wed, 13 Apr 2011 23:53:30 +0800 Subject: [PATCH 1/7] Add a mfd IPUv3 driver Message-ID: <1302710016-3569-1-git-send-email-weitway@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org From: Jason Chen The IPU is the Image Processing Unit found on i.MX51/53 SoCs. It features several units for image processing, this patch adds support for the units needed for Framebuffer support, namely: - Display Controller (dc) - Display Interface (di) - Display Multi Fifo Controller (dmfc) - Display Processor (dp) - Image DMA Controller (idmac) This patch is based on the Freescale driver, but follows a different approach. The Freescale code implements logical idmac channels and the handling of the subunits is hidden in common idmac code pathes in big switch/case statements. This patch instead just provides code and resource management for the different subunits. The user, in this case the framebuffer driver, decides how the different units play together. The IPU has other units missing in this patch: - CMOS Sensor Interface (csi) - Video Deinterlacer (vdi) - Sensor Multi FIFO Controler (smfc) - Image Converter (ic) - Image Rotator (irt) So expect more files to come in this directory. Signed-off-by: Sascha Hauer Signed-off-by: Jason Chen --- arch/arm/plat-mxc/include/mach/ipu-v3.h | 52 ++ drivers/video/Kconfig | 2 + drivers/video/Makefile | 1 + drivers/video/imx-ipu-v3/Kconfig | 10 + drivers/video/imx-ipu-v3/Makefile | 3 + drivers/video/imx-ipu-v3/ipu-common.c | 1257 +++++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dc.c | 442 +++++++++++ drivers/video/imx-ipu-v3/ipu-di.c | 572 ++++++++++++++ drivers/video/imx-ipu-v3/ipu-dmfc.c | 376 +++++++++ drivers/video/imx-ipu-v3/ipu-dp.c | 507 +++++++++++++ drivers/video/imx-ipu-v3/ipu-prv.h | 288 +++++++ include/video/imx-ipu-v3.h | 226 ++++++ 12 files changed, 3736 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-mxc/include/mach/ipu-v3.h b/arch/arm/plat-mxc/include/mach/ipu-v3.h new file mode 100644 index 0000000..184dfe5 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/ipu-v3.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2010 Sascha Hauer + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#ifndef __MACH_IPU_V3_H_ +#define __MACH_IPU_V3_H_ + +/* IPU specific extensions to struct fb_videomode flag field */ +#define FB_SYNC_OE_LOW_ACT (1 << 8) +#define FB_SYNC_CLK_LAT_FALL (1 << 9) +#define FB_SYNC_DATA_INVERT (1 << 10) +#define FB_SYNC_CLK_IDLE_EN (1 << 11) +#define FB_SYNC_SHARP_MODE (1 << 12) +#define FB_SYNC_SWAP_RGB (1 << 13) + +struct ipuv3_fb_platform_data { + const struct fb_videomode *modes; + int num_modes; + char *mode_str; + u32 interface_pix_fmt; + +#define IMX_IPU_FB_USE_MODEDB (1 << 0) +#define IMX_IPU_FB_USE_OVERLAY (1 << 1) + unsigned long flags; + + int ipu_channel_bg; + int ipu_channel_fg; + int dc_channel; + int dp_channel; + int display; + + void *ipu; +}; + +struct imx_ipuv3_platform_data { + int rev; + int (*init) (struct platform_device *); + struct ipuv3_fb_platform_data *fb_head0_platform_data; + struct ipuv3_fb_platform_data *fb_head1_platform_data; +}; + +#endif /* __MACH_IPU_V3_H_ */ diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index e0ea23f..9698c00 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -26,6 +26,8 @@ source "drivers/gpu/drm/Kconfig" source "drivers/gpu/stub/Kconfig" +source "drivers/video/imx-ipu-v3/Kconfig" + config VGASTATE tristate default n diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 9a096ae..f6f15fd 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -154,6 +154,7 @@ obj-$(CONFIG_FB_BFIN_7393) += bfin_adv7393fb.o obj-$(CONFIG_FB_MX3) += mx3fb.o obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o obj-$(CONFIG_FB_MXS) += mxsfb.o +obj-$(CONFIG_FB_IMX_IPU_V3) += imx-ipu-v3/ # the test framebuffer is last obj-$(CONFIG_FB_VIRTUAL) += vfb.o diff --git a/drivers/video/imx-ipu-v3/Kconfig b/drivers/video/imx-ipu-v3/Kconfig new file mode 100644 index 0000000..75aa483 --- /dev/null +++ b/drivers/video/imx-ipu-v3/Kconfig @@ -0,0 +1,10 @@ + +config FB_IMX_IPU_V3 + tristate "Support the Image Processing Unit (IPU) found on the i.MX5x" + depends on ARCH_MX51 || ARCH_MX53 + select MFD_SUPPORT + select MFD_CORE + help + Say yes here to support the IPU on i.MX5x. This is used by the fb + driver and also by the i.MX5x camera support. + diff --git a/drivers/video/imx-ipu-v3/Makefile b/drivers/video/imx-ipu-v3/Makefile new file mode 100644 index 0000000..65b6153 --- /dev/null +++ b/drivers/video/imx-ipu-v3/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_FB_IMX_IPU_V3) += imx-ipu-v3.o + +imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o diff --git a/drivers/video/imx-ipu-v3/ipu-common.c b/drivers/video/imx-ipu-v3/ipu-common.c new file mode 100644 index 0000000..082a5af --- /dev/null +++ b/drivers/video/imx-ipu-v3/ipu-common.c @@ -0,0 +1,1257 @@ +/* + * Copyright (c) 2010 Sascha Hauer + * Copyright (C) 2005-2009 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include