diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-10-25 05:29:24 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-28 07:53:07 -0500 |
commit | b057c3c32229c0db914c03eefb2579d877612926 (patch) | |
tree | 9b93bbe906d3c42d05ea49cc65ac1d1b06d3cea2 /drivers | |
parent | e023a11342b6624cc019c8cecfc488882f0721f9 (diff) |
[media] omap3isp: Prepare/unprepare clocks before/after enable/disable
Clock enable (disable) is split in two operations, prepare and enable
(disable and unprepare). Perform both when enabling/disabling the ISP
clocks.
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')
-rw-r--r-- | drivers/media/platform/omap3isp/isp.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index e8e724e2b4b1..7da622ed86ed 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c | |||
@@ -1332,7 +1332,8 @@ void omap3isp_subclk_disable(struct isp_device *isp, | |||
1332 | * isp_enable_clocks - Enable ISP clocks | 1332 | * isp_enable_clocks - Enable ISP clocks |
1333 | * @isp: OMAP3 ISP device | 1333 | * @isp: OMAP3 ISP device |
1334 | * | 1334 | * |
1335 | * Return 0 if successful, or clk_enable return value if any of tthem fails. | 1335 | * Return 0 if successful, or clk_prepare_enable return value if any of them |
1336 | * fails. | ||
1336 | */ | 1337 | */ |
1337 | static int isp_enable_clocks(struct isp_device *isp) | 1338 | static int isp_enable_clocks(struct isp_device *isp) |
1338 | { | 1339 | { |
@@ -1354,9 +1355,9 @@ static int isp_enable_clocks(struct isp_device *isp) | |||
1354 | else | 1355 | else |
1355 | divisor = 2; | 1356 | divisor = 2; |
1356 | 1357 | ||
1357 | r = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); | 1358 | r = clk_prepare_enable(isp->clock[ISP_CLK_CAM_ICK]); |
1358 | if (r) { | 1359 | if (r) { |
1359 | dev_err(isp->dev, "clk_enable cam_ick failed\n"); | 1360 | dev_err(isp->dev, "failed to enable cam_ick clock\n"); |
1360 | goto out_clk_enable_ick; | 1361 | goto out_clk_enable_ick; |
1361 | } | 1362 | } |
1362 | r = clk_set_rate(isp->clock[ISP_CLK_DPLL4_M5_CK], | 1363 | r = clk_set_rate(isp->clock[ISP_CLK_DPLL4_M5_CK], |
@@ -1365,9 +1366,9 @@ static int isp_enable_clocks(struct isp_device *isp) | |||
1365 | dev_err(isp->dev, "clk_set_rate for dpll4_m5_ck failed\n"); | 1366 | dev_err(isp->dev, "clk_set_rate for dpll4_m5_ck failed\n"); |
1366 | goto out_clk_enable_mclk; | 1367 | goto out_clk_enable_mclk; |
1367 | } | 1368 | } |
1368 | r = clk_enable(isp->clock[ISP_CLK_CAM_MCLK]); | 1369 | r = clk_prepare_enable(isp->clock[ISP_CLK_CAM_MCLK]); |
1369 | if (r) { | 1370 | if (r) { |
1370 | dev_err(isp->dev, "clk_enable cam_mclk failed\n"); | 1371 | dev_err(isp->dev, "failed to enable cam_mclk clock\n"); |
1371 | goto out_clk_enable_mclk; | 1372 | goto out_clk_enable_mclk; |
1372 | } | 1373 | } |
1373 | rate = clk_get_rate(isp->clock[ISP_CLK_CAM_MCLK]); | 1374 | rate = clk_get_rate(isp->clock[ISP_CLK_CAM_MCLK]); |
@@ -1375,17 +1376,17 @@ static int isp_enable_clocks(struct isp_device *isp) | |||
1375 | dev_warn(isp->dev, "unexpected cam_mclk rate:\n" | 1376 | dev_warn(isp->dev, "unexpected cam_mclk rate:\n" |
1376 | " expected : %d\n" | 1377 | " expected : %d\n" |
1377 | " actual : %ld\n", CM_CAM_MCLK_HZ, rate); | 1378 | " actual : %ld\n", CM_CAM_MCLK_HZ, rate); |
1378 | r = clk_enable(isp->clock[ISP_CLK_CSI2_FCK]); | 1379 | r = clk_prepare_enable(isp->clock[ISP_CLK_CSI2_FCK]); |
1379 | if (r) { | 1380 | if (r) { |
1380 | dev_err(isp->dev, "clk_enable csi2_fck failed\n"); | 1381 | dev_err(isp->dev, "failed to enable csi2_fck clock\n"); |
1381 | goto out_clk_enable_csi2_fclk; | 1382 | goto out_clk_enable_csi2_fclk; |
1382 | } | 1383 | } |
1383 | return 0; | 1384 | return 0; |
1384 | 1385 | ||
1385 | out_clk_enable_csi2_fclk: | 1386 | out_clk_enable_csi2_fclk: |
1386 | clk_disable(isp->clock[ISP_CLK_CAM_MCLK]); | 1387 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_MCLK]); |
1387 | out_clk_enable_mclk: | 1388 | out_clk_enable_mclk: |
1388 | clk_disable(isp->clock[ISP_CLK_CAM_ICK]); | 1389 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_ICK]); |
1389 | out_clk_enable_ick: | 1390 | out_clk_enable_ick: |
1390 | return r; | 1391 | return r; |
1391 | } | 1392 | } |
@@ -1396,9 +1397,9 @@ out_clk_enable_ick: | |||
1396 | */ | 1397 | */ |
1397 | static void isp_disable_clocks(struct isp_device *isp) | 1398 | static void isp_disable_clocks(struct isp_device *isp) |
1398 | { | 1399 | { |
1399 | clk_disable(isp->clock[ISP_CLK_CAM_ICK]); | 1400 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_ICK]); |
1400 | clk_disable(isp->clock[ISP_CLK_CAM_MCLK]); | 1401 | clk_disable_unprepare(isp->clock[ISP_CLK_CAM_MCLK]); |
1401 | clk_disable(isp->clock[ISP_CLK_CSI2_FCK]); | 1402 | clk_disable_unprepare(isp->clock[ISP_CLK_CSI2_FCK]); |
1402 | } | 1403 | } |
1403 | 1404 | ||
1404 | static const char *isp_clocks[] = { | 1405 | static const char *isp_clocks[] = { |