diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-05-25 08:33:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-11 14:55:04 -0400 |
commit | 96d62ae2dced8ec29d3fc985ff15505a65256906 (patch) | |
tree | bc4bd511c5652a27fa46103e8d67a74ceaa0deff /drivers/media | |
parent | be9a1b98f4796532c77babe211a6980e81e47b20 (diff) |
[media] omap3isp: Configure HS/VS interrupt source before enabling interrupts
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>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | 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 2e1f32248f10..36805ca72688 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) | |||
252 | } | 252 | } |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * isp_power_settings - Sysconfig settings, for Power Management. | 255 | * isp_core_init - ISP core settings |
256 | * @isp: OMAP3 ISP device | 256 | * @isp: OMAP3 ISP device |
257 | * @idle: Consider idle state. | 257 | * @idle: Consider idle state. |
258 | * | 258 | * |
259 | * Sets the power settings for the ISP, and SBL bus. | 259 | * Set the power settings for the ISP and SBL bus and cConfigure the HS/VS |
260 | * interrupt source. | ||
261 | * | ||
262 | * We need to configure the HS/VS interrupt source before interrupts get | ||
263 | * enabled, as the sensor might be free-running and the ISP default setting | ||
264 | * (HS edge) would put an unnecessary burden on the CPU. | ||
260 | */ | 265 | */ |
261 | static void isp_power_settings(struct isp_device *isp, int idle) | 266 | static void isp_core_init(struct isp_device *isp, int idle) |
262 | { | 267 | { |
263 | isp_reg_writel(isp, | 268 | isp_reg_writel(isp, |
264 | ((idle ? ISP_SYSCONFIG_MIDLEMODE_SMARTSTANDBY : | 269 | ((idle ? ISP_SYSCONFIG_MIDLEMODE_SMARTSTANDBY : |
@@ -268,9 +273,10 @@ static void isp_power_settings(struct isp_device *isp, int idle) | |||
268 | ISP_SYSCONFIG_AUTOIDLE : 0), | 273 | ISP_SYSCONFIG_AUTOIDLE : 0), |
269 | OMAP3_ISP_IOMEM_MAIN, ISP_SYSCONFIG); | 274 | OMAP3_ISP_IOMEM_MAIN, ISP_SYSCONFIG); |
270 | 275 | ||
271 | if (isp->autoidle) | 276 | isp_reg_writel(isp, |
272 | isp_reg_writel(isp, ISPCTRL_SBL_AUTOIDLE, OMAP3_ISP_IOMEM_MAIN, | 277 | (isp->autoidle ? ISPCTRL_SBL_AUTOIDLE : 0) | |
273 | ISP_CTRL); | 278 | ISPCTRL_SYNC_DETECT_VSRISE, |
279 | OMAP3_ISP_IOMEM_MAIN, ISP_CTRL); | ||
274 | } | 280 | } |
275 | 281 | ||
276 | /* | 282 | /* |
@@ -323,9 +329,6 @@ void omap3isp_configure_bridge(struct isp_device *isp, | |||
323 | 329 | ||
324 | ispctrl_val |= ((shift/2) << ISPCTRL_SHIFT_SHIFT) & ISPCTRL_SHIFT_MASK; | 330 | ispctrl_val |= ((shift/2) << ISPCTRL_SHIFT_SHIFT) & ISPCTRL_SHIFT_MASK; |
325 | 331 | ||
326 | ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK; | ||
327 | ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE; | ||
328 | |||
329 | isp_reg_writel(isp, ispctrl_val, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL); | 332 | isp_reg_writel(isp, ispctrl_val, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL); |
330 | } | 333 | } |
331 | 334 | ||
@@ -1443,7 +1446,7 @@ static int isp_get_clocks(struct isp_device *isp) | |||
1443 | * | 1446 | * |
1444 | * Return a pointer to the ISP device structure, or NULL if an error occurred. | 1447 | * Return a pointer to the ISP device structure, or NULL if an error occurred. |
1445 | */ | 1448 | */ |
1446 | struct isp_device *omap3isp_get(struct isp_device *isp) | 1449 | static struct isp_device *__omap3isp_get(struct isp_device *isp, bool irq) |
1447 | { | 1450 | { |
1448 | struct isp_device *__isp = isp; | 1451 | struct isp_device *__isp = isp; |
1449 | 1452 | ||
@@ -1462,10 +1465,9 @@ struct isp_device *omap3isp_get(struct isp_device *isp) | |||
1462 | /* We don't want to restore context before saving it! */ | 1465 | /* We don't want to restore context before saving it! */ |
1463 | if (isp->has_context) | 1466 | if (isp->has_context) |
1464 | isp_restore_ctx(isp); | 1467 | isp_restore_ctx(isp); |
1465 | else | ||
1466 | isp->has_context = 1; | ||
1467 | 1468 | ||
1468 | isp_enable_interrupts(isp); | 1469 | if (irq) |
1470 | isp_enable_interrupts(isp); | ||
1469 | 1471 | ||
1470 | out: | 1472 | out: |
1471 | if (__isp != NULL) | 1473 | if (__isp != NULL) |
@@ -1475,6 +1477,11 @@ out: | |||
1475 | return __isp; | 1477 | return __isp; |
1476 | } | 1478 | } |
1477 | 1479 | ||
1480 | struct isp_device *omap3isp_get(struct isp_device *isp) | ||
1481 | { | ||
1482 | return __omap3isp_get(isp, true); | ||
1483 | } | ||
1484 | |||
1478 | /* | 1485 | /* |
1479 | * omap3isp_put - Release the ISP | 1486 | * omap3isp_put - Release the ISP |
1480 | * | 1487 | * |
@@ -1490,8 +1497,10 @@ void omap3isp_put(struct isp_device *isp) | |||
1490 | BUG_ON(isp->ref_count == 0); | 1497 | BUG_ON(isp->ref_count == 0); |
1491 | if (--isp->ref_count == 0) { | 1498 | if (--isp->ref_count == 0) { |
1492 | isp_disable_interrupts(isp); | 1499 | isp_disable_interrupts(isp); |
1493 | if (isp->domain) | 1500 | if (isp->domain) { |
1494 | isp_save_ctx(isp); | 1501 | isp_save_ctx(isp); |
1502 | isp->has_context = 1; | ||
1503 | } | ||
1495 | /* Reset the ISP if an entity has failed to stop. This is the | 1504 | /* Reset the ISP if an entity has failed to stop. This is the |
1496 | * only way to recover from such conditions. | 1505 | * only way to recover from such conditions. |
1497 | */ | 1506 | */ |
@@ -1975,7 +1984,7 @@ static int __devexit isp_remove(struct platform_device *pdev) | |||
1975 | isp_unregister_entities(isp); | 1984 | isp_unregister_entities(isp); |
1976 | isp_cleanup_modules(isp); | 1985 | isp_cleanup_modules(isp); |
1977 | 1986 | ||
1978 | omap3isp_get(isp); | 1987 | __omap3isp_get(isp, false); |
1979 | iommu_detach_device(isp->domain, &pdev->dev); | 1988 | iommu_detach_device(isp->domain, &pdev->dev); |
1980 | iommu_domain_free(isp->domain); | 1989 | iommu_domain_free(isp->domain); |
1981 | isp->domain = NULL; | 1990 | isp->domain = NULL; |
@@ -2093,7 +2102,7 @@ static int __devinit isp_probe(struct platform_device *pdev) | |||
2093 | if (ret < 0) | 2102 | if (ret < 0) |
2094 | goto error; | 2103 | goto error; |
2095 | 2104 | ||
2096 | if (omap3isp_get(isp) == NULL) | 2105 | if (__omap3isp_get(isp, false) == NULL) |
2097 | goto error; | 2106 | goto error; |
2098 | 2107 | ||
2099 | ret = isp_reset(isp); | 2108 | ret = isp_reset(isp); |
@@ -2160,7 +2169,7 @@ static int __devinit isp_probe(struct platform_device *pdev) | |||
2160 | if (ret < 0) | 2169 | if (ret < 0) |
2161 | goto error_modules; | 2170 | goto error_modules; |
2162 | 2171 | ||
2163 | isp_power_settings(isp, 1); | 2172 | isp_core_init(isp, 1); |
2164 | omap3isp_put(isp); | 2173 | omap3isp_put(isp); |
2165 | 2174 | ||
2166 | return 0; | 2175 | return 0; |