From be9a1b98f4796532c77babe211a6980e81e47b20 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 25 May 2012 08:35:10 -0300 Subject: [media] omap3isp: Don't access ISP_CTRL directly in the statistics modules Use the existing omap3isp_subclk_enable() and omap3isp_subclk_disable() functions instead. Signed-off-by: Laurent Pinchart Acked-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/omap3isp/isp.c | 4 +++- drivers/media/video/omap3isp/isp.h | 9 +++++---- drivers/media/video/omap3isp/isph3a_aewb.c | 10 ++-------- drivers/media/video/omap3isp/isph3a_af.c | 10 ++-------- drivers/media/video/omap3isp/isphist.c | 6 ++---- 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index 1c347633e66..2e1f32248f1 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c @@ -1281,7 +1281,9 @@ static void __isp_subclk_update(struct isp_device *isp) { u32 clk = 0; - if (isp->subclk_resources & OMAP3_ISP_SUBCLK_H3A) + /* AEWB and AF share the same clock. */ + if (isp->subclk_resources & + (OMAP3_ISP_SUBCLK_AEWB | OMAP3_ISP_SUBCLK_AF)) clk |= ISPCTRL_H3A_CLK_EN; if (isp->subclk_resources & OMAP3_ISP_SUBCLK_HIST) diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index fc7af3e32ef..ba2159b20b0 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h @@ -90,10 +90,11 @@ enum isp_sbl_resource { enum isp_subclk_resource { OMAP3_ISP_SUBCLK_CCDC = (1 << 0), - OMAP3_ISP_SUBCLK_H3A = (1 << 1), - OMAP3_ISP_SUBCLK_HIST = (1 << 2), - OMAP3_ISP_SUBCLK_PREVIEW = (1 << 3), - OMAP3_ISP_SUBCLK_RESIZER = (1 << 4), + OMAP3_ISP_SUBCLK_AEWB = (1 << 1), + OMAP3_ISP_SUBCLK_AF = (1 << 2), + OMAP3_ISP_SUBCLK_HIST = (1 << 3), + OMAP3_ISP_SUBCLK_PREVIEW = (1 << 4), + OMAP3_ISP_SUBCLK_RESIZER = (1 << 5), }; /* ISP: OMAP 34xx ES 1.0 */ diff --git a/drivers/media/video/omap3isp/isph3a_aewb.c b/drivers/media/video/omap3isp/isph3a_aewb.c index a3c76bf1817..036e9961d02 100644 --- a/drivers/media/video/omap3isp/isph3a_aewb.c +++ b/drivers/media/video/omap3isp/isph3a_aewb.c @@ -93,17 +93,11 @@ static void h3a_aewb_enable(struct ispstat *aewb, int enable) if (enable) { isp_reg_set(aewb->isp, OMAP3_ISP_IOMEM_H3A, ISPH3A_PCR, ISPH3A_PCR_AEW_EN); - /* This bit is already set if AF is enabled */ - if (aewb->isp->isp_af.state != ISPSTAT_ENABLED) - isp_reg_set(aewb->isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, - ISPCTRL_H3A_CLK_EN); + omap3isp_subclk_enable(aewb->isp, OMAP3_ISP_SUBCLK_AEWB); } else { isp_reg_clr(aewb->isp, OMAP3_ISP_IOMEM_H3A, ISPH3A_PCR, ISPH3A_PCR_AEW_EN); - /* This bit can't be cleared if AF is enabled */ - if (aewb->isp->isp_af.state != ISPSTAT_ENABLED) - isp_reg_clr(aewb->isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, - ISPCTRL_H3A_CLK_EN); + omap3isp_subclk_disable(aewb->isp, OMAP3_ISP_SUBCLK_AEWB); } } diff --git a/drivers/media/video/omap3isp/isph3a_af.c b/drivers/media/video/omap3isp/isph3a_af.c index 58e0bc41489..42ccce318d5 100644 --- a/drivers/media/video/omap3isp/isph3a_af.c +++ b/drivers/media/video/omap3isp/isph3a_af.c @@ -143,17 +143,11 @@ static void h3a_af_enable(struct ispstat *af, int enable) if (enable) { isp_reg_set(af->isp, OMAP3_ISP_IOMEM_H3A, ISPH3A_PCR, ISPH3A_PCR_AF_EN); - /* This bit is already set if AEWB is enabled */ - if (af->isp->isp_aewb.state != ISPSTAT_ENABLED) - isp_reg_set(af->isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, - ISPCTRL_H3A_CLK_EN); + omap3isp_subclk_enable(af->isp, OMAP3_ISP_SUBCLK_AF); } else { isp_reg_clr(af->isp, OMAP3_ISP_IOMEM_H3A, ISPH3A_PCR, ISPH3A_PCR_AF_EN); - /* This bit can't be cleared if AEWB is enabled */ - if (af->isp->isp_aewb.state != ISPSTAT_ENABLED) - isp_reg_clr(af->isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, - ISPCTRL_H3A_CLK_EN); + omap3isp_subclk_disable(af->isp, OMAP3_ISP_SUBCLK_AF); } } diff --git a/drivers/media/video/omap3isp/isphist.c b/drivers/media/video/omap3isp/isphist.c index 1163907bcdd..d1a8dee5e1c 100644 --- a/drivers/media/video/omap3isp/isphist.c +++ b/drivers/media/video/omap3isp/isphist.c @@ -167,13 +167,11 @@ static void hist_enable(struct ispstat *hist, int enable) if (enable) { isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, ISPHIST_PCR_ENABLE); - isp_reg_set(hist->isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, - ISPCTRL_HIST_CLK_EN); + omap3isp_subclk_enable(hist->isp, OMAP3_ISP_SUBCLK_HIST); } else { isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_HIST, ISPHIST_PCR, ISPHIST_PCR_ENABLE); - isp_reg_clr(hist->isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, - ISPCTRL_HIST_CLK_EN); + omap3isp_subclk_disable(hist->isp, OMAP3_ISP_SUBCLK_HIST); } } -- cgit v1.2.3-18-g5258