From patchwork Wed Apr 13 15:53:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weitway@gmail.com X-Patchwork-Id: 1003 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:48:11 -0000 Delivered-To: patches@linaro.org Received: by 10.68.59.138 with SMTP id z10cs327012pbq; Wed, 13 Apr 2011 08:54:51 -0700 (PDT) Received: by 10.42.135.200 with SMTP id q8mr9098453ict.198.1302710089484; Wed, 13 Apr 2011 08:54:49 -0700 (PDT) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id xm13si2037935icb.54.2011.04.13.08.54.49 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 08:54:49 -0700 (PDT) Received-SPF: pass (google.com: domain of weitway@gmail.com designates 209.85.210.178 as permitted sender) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of weitway@gmail.com designates 209.85.210.178 as permitted sender) smtp.mail=weitway@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by iyi12 with SMTP id 12so1650842iyi.37 for ; Wed, 13 Apr 2011 08:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=kHUfRx33MzfIQXMWh5u3Qs/hEIfvyGMNTrZa3ZI+/rE=; b=bwAONbymwydZRSDK5z+qb3n2cCSXajJRW3dPORULWNgJObRFS2dN1k5bCwWMt5HPC4 z3jw9llNaqQ4WdgA5sHv52kdhIHXUnx8bqWgv17shIevH9z6ouLfy5FdoqSVgwqYRCxa /T7FE+YHdFqUmDK58E/s4XaI50JAV05pE/NOo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=h3JVdlR6Enu5GZYLW25XX/lyAD3fBf8R+BLbG5txMD9tersfadDLqEH5IKOwPcfkIu RPBCpCfJpcf85CCBug0fpkQl/0M1I/a+sFzdcriXZ/ZSorYRgNHXmY3bsl8ZcsN7q2KT h7JDVorP/7ywjHAeijgPPG1MxdfT5CLzxUs7Y= Received: by 10.43.69.19 with SMTP id ya19mr2030492icb.324.1302710088300; Wed, 13 Apr 2011 08:54:48 -0700 (PDT) Received: from localhost.localdomain ([116.235.131.170]) by mx.google.com with ESMTPS id f28sm513868ibh.50.2011.04.13.08.54.24 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 08:54:43 -0700 (PDT) From: weitway@gmail.com To: linux-arm-kernel@lists.infradead.org Cc: u.kleine-koenig@pengutronix.de, s.hauer@pengutronix.de, eric.miao@linaro.org, Jason Chen , Jason Chen Subject: [PATCH 1/7] Add a mfd IPUv3 driver Date: Wed, 13 Apr 2011 23:53:30 +0800 Message-Id: <1302710016-3569-1-git-send-email-weitway@gmail.com> X-Mailer: git-send-email 1.7.1 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