From patchwork Thu Apr 14 02:04:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jason.chen@freescale.com X-Patchwork-Id: 1013 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:17 -0000 Delivered-To: patches@linaro.org Received: by 10.68.59.138 with SMTP id z10cs888pbq; Wed, 13 Apr 2011 19:05:23 -0700 (PDT) Received: by 10.236.181.228 with SMTP id l64mr193348yhm.305.1302746721795; Wed, 13 Apr 2011 19:05:21 -0700 (PDT) Received: from VA3EHSOBE001.bigfish.com (va3ehsobe001.messaging.microsoft.com [216.32.180.11]) by mx.google.com with ESMTPS id x41si2820713yhc.90.2011.04.13.19.05.19 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 19:05:20 -0700 (PDT) Received-SPF: neutral (google.com: 216.32.180.11 is neither permitted nor denied by best guess record for domain of B02280@freescale.com) client-ip=216.32.180.11; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.180.11 is neither permitted nor denied by best guess record for domain of B02280@freescale.com) smtp.mail=B02280@freescale.com Received: from mail175-va3-R.bigfish.com (10.7.14.237) by VA3EHSOBE001.bigfish.com (10.7.40.21) with Microsoft SMTP Server id 14.1.225.8; Thu, 14 Apr 2011 02:05:17 +0000 Received: from mail175-va3 (localhost.localdomain [127.0.0.1]) by mail175-va3-R.bigfish.com (Postfix) with ESMTP id AF84EC9011F; Thu, 14 Apr 2011 02:05:17 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzbb2cKc8kzz1202hzz8275bh8275dh84d07hz2dh2a8h668h839h66h) X-Spam-TCS-SCL: 5:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail175-va3 (localhost.localdomain [127.0.0.1]) by mail175-va3 (MessageSwitch) id 1302746713765947_9088; Thu, 14 Apr 2011 02:05:13 +0000 (UTC) Received: from VA3EHSMHS009.bigfish.com (unknown [10.7.14.254]) by mail175-va3.bigfish.com (Postfix) with ESMTP id A9FE677804E; Thu, 14 Apr 2011 02:05:13 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS009.bigfish.com (10.7.99.19) with Microsoft SMTP Server (TLS) id 14.1.225.8; Thu, 14 Apr 2011 02:05:04 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server id 14.1.270.2; Wed, 13 Apr 2011 21:05:03 -0500 Received: from weitway.ap.freescale.net ([10.192.242.83]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p3E24xKx006397; Wed, 13 Apr 2011 21:04:59 -0500 (CDT) From: To: CC: , , Jason Chen , Jason Chen Subject: [PATCH 1/7] Add a mfd IPUv3 driver Date: Thu, 14 Apr 2011 10:04:56 +0800 Message-ID: <1302746696-2666-1-git-send-email-jason.chen@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com 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