From mboxrd@z Thu Jan 1 00:00:00 1970 From: s.hauer@pengutronix.de (Sascha Hauer) Date: Mon, 28 Feb 2011 11:00:24 +0100 Subject: [PATCH 3/8] Add a mfd IPUv3 driver In-Reply-To: <1298887229-7987-1-git-send-email-s.hauer@pengutronix.de> References: <1298887229-7987-1-git-send-email-s.hauer@pengutronix.de> Message-ID: <1298887229-7987-4-git-send-email-s.hauer@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 Cc: linux-kernel at vger.kernel.org Cc: linux-fbdev at vger.kernel.org Cc: Paul Mundt Cc: Samuel Ortiz --- arch/arm/plat-mxc/include/mach/ipu-v3.h | 49 +++ 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 | 666 +++++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-cpmem.c | 612 ++++++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dc.c | 364 +++++++++++++++++ drivers/video/imx-ipu-v3/ipu-di.c | 550 +++++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dmfc.c | 355 ++++++++++++++++ drivers/video/imx-ipu-v3/ipu-dp.c | 476 ++++++++++++++++++++++ drivers/video/imx-ipu-v3/ipu-prv.h | 216 ++++++++++ include/video/imx-ipu-v3.h | 219 ++++++++++ 13 files changed, 3523 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-mxc/include/mach/ipu-v3.h create mode 100644 drivers/video/imx-ipu-v3/Kconfig create mode 100644 drivers/video/imx-ipu-v3/Makefile create mode 100644 drivers/video/imx-ipu-v3/ipu-common.c create mode 100644 drivers/video/imx-ipu-v3/ipu-cpmem.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dc.c create mode 100644 drivers/video/imx-ipu-v3/ipu-di.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dmfc.c create mode 100644 drivers/video/imx-ipu-v3/ipu-dp.c create mode 100644 drivers/video/imx-ipu-v3/ipu-prv.h create mode 100644 include/video/imx-ipu-v3.h 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..f8900b9 --- /dev/null +++ b/arch/arm/plat-mxc/include/mach/ipu-v3.h @@ -0,0 +1,49 @@ +/* + * 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; +}; + +struct imx_ipuv3_platform_data { + int rev; + 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 6bafb51b..ffdb37a 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 8c8fabd..dd76680 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -153,6 +153,7 @@ obj-$(CONFIG_FB_BFIN_T350MCQB) += bfin-t350mcqb-fb.o obj-$(CONFIG_FB_BFIN_7393) += bfin_adv7393fb.o obj-$(CONFIG_FB_MX3) += mx3fb.o obj-$(CONFIG_FB_DA8XX) += da8xx-fb.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..15e4214 --- /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.MX51" + depends on ARCH_MX51 + select MFD_SUPPORT + select MFD_CORE + help + Say yes here to support the IPU on i.MX51. This is used by the fb + driver and also by the i.MX51 camera support. + diff --git a/drivers/video/imx-ipu-v3/Makefile b/drivers/video/imx-ipu-v3/Makefile new file mode 100644 index 0000000..a44d303 --- /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 ipu-cpmem.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..3136eea --- /dev/null +++ b/drivers/video/imx-ipu-v3/ipu-common.c @@ -0,0 +1,666 @@ +/* + * 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