* [PATCH 0/2] Miscellaneous OMAP3 ISP fixes
@ 2012-06-26 1:34 Laurent Pinchart
2012-06-26 1:34 ` [PATCH 1/2] omap3isp: Don't access ISP_CTRL directly in the statistics modules Laurent Pinchart
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Laurent Pinchart @ 2012-06-26 1:34 UTC (permalink / raw)
To: linux-media; +Cc: sakari.ailus
Hi everybody,
Not much to be said here. The first patch is needed by the second, which is
described in its commit message. I'd like to get this into v3.6.
Laurent Pinchart (2):
omap3isp: Don't access ISP_CTRL directly in the statistics modules
omap3isp: Configure HS/VS interrupt source before enabling interrupts
drivers/media/video/omap3isp/isp.c | 47 +++++++++++++++++----------
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, 40 insertions(+), 42 deletions(-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] omap3isp: Don't access ISP_CTRL directly in the statistics modules
2012-06-26 1:34 [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Laurent Pinchart
@ 2012-06-26 1:34 ` Laurent Pinchart
2012-06-26 1:34 ` [PATCH 2/2] omap3isp: Configure HS/VS interrupt source before enabling interrupts Laurent Pinchart
2012-06-27 10:42 ` [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Sakari Ailus
2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2012-06-26 1:34 UTC (permalink / raw)
To: linux-media; +Cc: sakari.ailus
Use the existing omap3isp_subclk_enable() and omap3isp_subclk_disable()
functions instead.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
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 1c34763..2e1f322 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 fc7af3e..ba2159b 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 a3c76bf..036e996 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 58e0bc4..42ccce3 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 1163907..d1a8dee 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);
}
}
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] omap3isp: Configure HS/VS interrupt source before enabling interrupts
2012-06-26 1:34 [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Laurent Pinchart
2012-06-26 1:34 ` [PATCH 1/2] omap3isp: Don't access ISP_CTRL directly in the statistics modules Laurent Pinchart
@ 2012-06-26 1:34 ` Laurent Pinchart
2012-06-27 10:42 ` [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Sakari Ailus
2 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2012-06-26 1:34 UTC (permalink / raw)
To: linux-media; +Cc: sakari.ailus
This needs to be performed before enabling interrupts as the sensor
might be free-running and the ISP default setting (HS edge) would put an
unnecessary burden on the CPU.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
drivers/media/video/omap3isp/isp.c | 43 +++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c
index 2e1f322..36805ca 100644
--- a/drivers/media/video/omap3isp/isp.c
+++ b/drivers/media/video/omap3isp/isp.c
@@ -252,13 +252,18 @@ static u32 isp_set_xclk(struct isp_device *isp, u32 xclk, u8 xclksel)
}
/*
- * isp_power_settings - Sysconfig settings, for Power Management.
+ * isp_core_init - ISP core settings
* @isp: OMAP3 ISP device
* @idle: Consider idle state.
*
- * Sets the power settings for the ISP, and SBL bus.
+ * Set the power settings for the ISP and SBL bus and cConfigure the HS/VS
+ * interrupt source.
+ *
+ * We need to configure the HS/VS interrupt source before interrupts get
+ * enabled, as the sensor might be free-running and the ISP default setting
+ * (HS edge) would put an unnecessary burden on the CPU.
*/
-static void isp_power_settings(struct isp_device *isp, int idle)
+static void isp_core_init(struct isp_device *isp, int idle)
{
isp_reg_writel(isp,
((idle ? ISP_SYSCONFIG_MIDLEMODE_SMARTSTANDBY :
@@ -268,9 +273,10 @@ static void isp_power_settings(struct isp_device *isp, int idle)
ISP_SYSCONFIG_AUTOIDLE : 0),
OMAP3_ISP_IOMEM_MAIN, ISP_SYSCONFIG);
- if (isp->autoidle)
- isp_reg_writel(isp, ISPCTRL_SBL_AUTOIDLE, OMAP3_ISP_IOMEM_MAIN,
- ISP_CTRL);
+ isp_reg_writel(isp,
+ (isp->autoidle ? ISPCTRL_SBL_AUTOIDLE : 0) |
+ ISPCTRL_SYNC_DETECT_VSRISE,
+ OMAP3_ISP_IOMEM_MAIN, ISP_CTRL);
}
/*
@@ -323,9 +329,6 @@ void omap3isp_configure_bridge(struct isp_device *isp,
ispctrl_val |= ((shift/2) << ISPCTRL_SHIFT_SHIFT) & ISPCTRL_SHIFT_MASK;
- ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK;
- ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE;
-
isp_reg_writel(isp, ispctrl_val, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL);
}
@@ -1443,7 +1446,7 @@ static int isp_get_clocks(struct isp_device *isp)
*
* Return a pointer to the ISP device structure, or NULL if an error occurred.
*/
-struct isp_device *omap3isp_get(struct isp_device *isp)
+static struct isp_device *__omap3isp_get(struct isp_device *isp, bool irq)
{
struct isp_device *__isp = isp;
@@ -1462,10 +1465,9 @@ struct isp_device *omap3isp_get(struct isp_device *isp)
/* We don't want to restore context before saving it! */
if (isp->has_context)
isp_restore_ctx(isp);
- else
- isp->has_context = 1;
- isp_enable_interrupts(isp);
+ if (irq)
+ isp_enable_interrupts(isp);
out:
if (__isp != NULL)
@@ -1475,6 +1477,11 @@ out:
return __isp;
}
+struct isp_device *omap3isp_get(struct isp_device *isp)
+{
+ return __omap3isp_get(isp, true);
+}
+
/*
* omap3isp_put - Release the ISP
*
@@ -1490,8 +1497,10 @@ void omap3isp_put(struct isp_device *isp)
BUG_ON(isp->ref_count == 0);
if (--isp->ref_count == 0) {
isp_disable_interrupts(isp);
- if (isp->domain)
+ if (isp->domain) {
isp_save_ctx(isp);
+ isp->has_context = 1;
+ }
/* Reset the ISP if an entity has failed to stop. This is the
* only way to recover from such conditions.
*/
@@ -1975,7 +1984,7 @@ static int __devexit isp_remove(struct platform_device *pdev)
isp_unregister_entities(isp);
isp_cleanup_modules(isp);
- omap3isp_get(isp);
+ __omap3isp_get(isp, false);
iommu_detach_device(isp->domain, &pdev->dev);
iommu_domain_free(isp->domain);
isp->domain = NULL;
@@ -2093,7 +2102,7 @@ static int __devinit isp_probe(struct platform_device *pdev)
if (ret < 0)
goto error;
- if (omap3isp_get(isp) == NULL)
+ if (__omap3isp_get(isp, false) == NULL)
goto error;
ret = isp_reset(isp);
@@ -2160,7 +2169,7 @@ static int __devinit isp_probe(struct platform_device *pdev)
if (ret < 0)
goto error_modules;
- isp_power_settings(isp, 1);
+ isp_core_init(isp, 1);
omap3isp_put(isp);
return 0;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Miscellaneous OMAP3 ISP fixes
2012-06-26 1:34 [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Laurent Pinchart
2012-06-26 1:34 ` [PATCH 1/2] omap3isp: Don't access ISP_CTRL directly in the statistics modules Laurent Pinchart
2012-06-26 1:34 ` [PATCH 2/2] omap3isp: Configure HS/VS interrupt source before enabling interrupts Laurent Pinchart
@ 2012-06-27 10:42 ` Sakari Ailus
2 siblings, 0 replies; 4+ messages in thread
From: Sakari Ailus @ 2012-06-27 10:42 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media
Laurent Pinchart wrote:
> Hi everybody,
>
> Not much to be said here. The first patch is needed by the second, which is
> described in its commit message. I'd like to get this into v3.6.
>
> Laurent Pinchart (2):
> omap3isp: Don't access ISP_CTRL directly in the statistics modules
> omap3isp: Configure HS/VS interrupt source before enabling interrupts
>
> drivers/media/video/omap3isp/isp.c | 47 +++++++++++++++++----------
> 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, 40 insertions(+), 42 deletions(-)
Thanks!
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
--
Sakari Ailus
sakari.ailus@iki.fi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-27 10:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-26 1:34 [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Laurent Pinchart
2012-06-26 1:34 ` [PATCH 1/2] omap3isp: Don't access ISP_CTRL directly in the statistics modules Laurent Pinchart
2012-06-26 1:34 ` [PATCH 2/2] omap3isp: Configure HS/VS interrupt source before enabling interrupts Laurent Pinchart
2012-06-27 10:42 ` [PATCH 0/2] Miscellaneous OMAP3 ISP fixes Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).