From patchwork Fri Nov 19 23:23:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aguirre Rodriguez, Sergio Alberto" X-Patchwork-Id: 4982 Return-path: Envelope-to: mchehab@gaivota Delivery-date: Fri, 19 Nov 2010 23:34:13 -0200 Received: from mchehab by gaivota with local (Exim 4.72) (envelope-from ) id 1PJcLF-0003jh-AZ for mchehab@gaivota; Fri, 19 Nov 2010 23:34:13 -0200 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.17) for (single-drop); Fri, 19 Nov 2010 23:34:13 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PJaJd-00032l-Pz; Fri, 19 Nov 2010 23:24:26 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757306Ab0KSXYG (ORCPT + 1 other); Fri, 19 Nov 2010 18:24:06 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:52313 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754300Ab0KSXYB (ORCPT ); Fri, 19 Nov 2010 18:24:01 -0500 Received: from dlep34.itg.ti.com ([157.170.170.115]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id oAJNNxqQ011855 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Nov 2010 17:23:59 -0600 Received: from legion.dal.design.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id oAJNNvuB013616; Fri, 19 Nov 2010 17:23:58 -0600 (CST) Received: from localhost (dtx0091359-ubuntu-1.am.dhcp.ti.com [128.247.79.64]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id oAJNNvf11888; Fri, 19 Nov 2010 17:23:57 -0600 (CST) From: Sergio Aguirre To: Laurent Pinchart Cc: linux-media@vger.kernel.org, Sergio Aguirre Subject: [omap3isp RFC][PATCH 2/4] omap3isp: Move CCDC LSC prefetch wait to main isp code Date: Fri, 19 Nov 2010 17:23:49 -0600 Message-Id: <1290209031-12817-3-git-send-email-saaguirre@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1290209031-12817-1-git-send-email-saaguirre@ti.com> References: <1290209031-12817-1-git-send-email-saaguirre@ti.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab Since this sequence strictly touches ISP global registers, it's not really part of the same register address space than the CCDC. Do this check in main isp code instead. Signed-off-by: Sergio Aguirre --- drivers/media/video/isp/isp.c | 24 ++++++++++++++++++++++++ drivers/media/video/isp/isp.h | 2 ++ drivers/media/video/isp/ispccdc.c | 26 +------------------------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/drivers/media/video/isp/isp.c b/drivers/media/video/isp/isp.c index 2e5030f..ee45eb6 100644 --- a/drivers/media/video/isp/isp.c +++ b/drivers/media/video/isp/isp.c @@ -339,6 +339,30 @@ void isphist_dma_done(struct isp_device *isp) } } +int ispccdc_lsc_wait_prefetch(struct isp_device *isp) +{ + unsigned int wait; + + isp_reg_writel(isp, IRQ0STATUS_CCDC_LSC_PREF_COMP_IRQ, + OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); + + /* timeout 1 ms */ + for (wait = 0; wait < 1000; wait++) { + if (isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS) & + IRQ0STATUS_CCDC_LSC_PREF_COMP_IRQ) { + isp_reg_writel(isp, IRQ0STATUS_CCDC_LSC_PREF_COMP_IRQ, + OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); + return 0; + } + + rmb(); + udelay(1); + } + + return -ETIMEDOUT; +} + + static inline void isp_isr_dbg(struct isp_device *isp, u32 irqstatus) { static const char *name[] = { diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h index 1260e9f..d0b7b0f 100644 --- a/drivers/media/video/isp/isp.h +++ b/drivers/media/video/isp/isp.h @@ -280,6 +280,8 @@ struct isp_device { void isphist_dma_done(struct isp_device *isp); +int ispccdc_lsc_wait_prefetch(struct isp_device *isp); + void isp_flush(struct isp_device *isp); int isp_pipeline_set_stream(struct isp_pipeline *pipe, diff --git a/drivers/media/video/isp/ispccdc.c b/drivers/media/video/isp/ispccdc.c index 4244edf..b039bce 100644 --- a/drivers/media/video/isp/ispccdc.c +++ b/drivers/media/video/isp/ispccdc.c @@ -223,30 +223,6 @@ static void ispccdc_lsc_setup_regs(struct isp_ccdc_device *ccdc, ISPCCDC_LSC_INITIAL); } -static int ispccdc_lsc_wait_prefetch(struct isp_ccdc_device *ccdc) -{ - struct isp_device *isp = to_isp_device(ccdc); - unsigned int wait; - - isp_reg_writel(isp, IRQ0STATUS_CCDC_LSC_PREF_COMP_IRQ, - OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); - - /* timeout 1 ms */ - for (wait = 0; wait < 1000; wait++) { - if (isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS) & - IRQ0STATUS_CCDC_LSC_PREF_COMP_IRQ) { - isp_reg_writel(isp, IRQ0STATUS_CCDC_LSC_PREF_COMP_IRQ, - OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); - return 0; - } - - rmb(); - udelay(1); - } - - return -ETIMEDOUT; -} - /* * __ispccdc_lsc_enable - Enables/Disables the Lens Shading Compensation module. * @ccdc: Pointer to ISP CCDC device. @@ -272,7 +248,7 @@ static int __ispccdc_lsc_enable(struct isp_ccdc_device *ccdc, int enable) ISPCCDC_LSC_ENABLE, enable ? ISPCCDC_LSC_ENABLE : 0); if (enable) { - if (ispccdc_lsc_wait_prefetch(ccdc) < 0) { + if (ispccdc_lsc_wait_prefetch(isp) < 0) { isp_reg_clr(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_LSC_CONFIG, ISPCCDC_LSC_ENABLE); ccdc->lsc.state = LSC_STATE_STOPPED;