aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/s5p-fimc
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2012-01-30 09:39:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-08 05:37:27 -0500
commitbd7d8888e99d67f778f4ee272346322c0b9cb378 (patch)
tree36f4a66fe272de536d702d1c440d3047c36fb2de /drivers/media/video/s5p-fimc
parent479e3492a262196631d69a9245a45420a354bec5 (diff)
[media] s5p-fimc: convert to clk_prepare()/clk_unprepare()
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/s5p-fimc')
-rw-r--r--drivers/media/video/s5p-fimc/fimc-core.c29
-rw-r--r--drivers/media/video/s5p-fimc/mipi-csis.c28
2 files changed, 39 insertions, 18 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c
index 81bcbb9492ea..a6b4580edd77 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1602,24 +1602,35 @@ static void fimc_clk_put(struct fimc_dev *fimc)
1602{ 1602{
1603 int i; 1603 int i;
1604 for (i = 0; i < fimc->num_clocks; i++) { 1604 for (i = 0; i < fimc->num_clocks; i++) {
1605 if (fimc->clock[i]) 1605 if (IS_ERR_OR_NULL(fimc->clock[i]))
1606 clk_put(fimc->clock[i]); 1606 continue;
1607 clk_unprepare(fimc->clock[i]);
1608 clk_put(fimc->clock[i]);
1609 fimc->clock[i] = NULL;
1607 } 1610 }
1608} 1611}
1609 1612
1610static int fimc_clk_get(struct fimc_dev *fimc) 1613static int fimc_clk_get(struct fimc_dev *fimc)
1611{ 1614{
1612 int i; 1615 int i, ret;
1616
1613 for (i = 0; i < fimc->num_clocks; i++) { 1617 for (i = 0; i < fimc->num_clocks; i++) {
1614 fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]); 1618 fimc->clock[i] = clk_get(&fimc->pdev->dev, fimc_clocks[i]);
1615 if (!IS_ERR_OR_NULL(fimc->clock[i])) 1619 if (IS_ERR(fimc->clock[i]))
1616 continue; 1620 goto err;
1617 dev_err(&fimc->pdev->dev, "failed to get fimc clock: %s\n", 1621 ret = clk_prepare(fimc->clock[i]);
1618 fimc_clocks[i]); 1622 if (ret < 0) {
1619 return -ENXIO; 1623 clk_put(fimc->clock[i]);
1624 fimc->clock[i] = NULL;
1625 goto err;
1626 }
1620 } 1627 }
1621
1622 return 0; 1628 return 0;
1629err:
1630 fimc_clk_put(fimc);
1631 dev_err(&fimc->pdev->dev, "failed to get clock: %s\n",
1632 fimc_clocks[i]);
1633 return -ENXIO;
1623} 1634}
1624 1635
1625static int fimc_m2m_suspend(struct fimc_dev *fimc) 1636static int fimc_m2m_suspend(struct fimc_dev *fimc)
diff --git a/drivers/media/video/s5p-fimc/mipi-csis.c b/drivers/media/video/s5p-fimc/mipi-csis.c
index 130335cf62fd..58c40750abc2 100644
--- a/drivers/media/video/s5p-fimc/mipi-csis.c
+++ b/drivers/media/video/s5p-fimc/mipi-csis.c
@@ -258,26 +258,36 @@ static void s5pcsis_clk_put(struct csis_state *state)
258{ 258{
259 int i; 259 int i;
260 260
261 for (i = 0; i < NUM_CSIS_CLOCKS; i++) 261 for (i = 0; i < NUM_CSIS_CLOCKS; i++) {
262 if (!IS_ERR_OR_NULL(state->clock[i])) 262 if (IS_ERR_OR_NULL(state->clock[i]))
263 clk_put(state->clock[i]); 263 continue;
264 clk_unprepare(state->clock[i]);
265 clk_put(state->clock[i]);
266 state->clock[i] = NULL;
267 }
264} 268}
265 269
266static int s5pcsis_clk_get(struct csis_state *state) 270static int s5pcsis_clk_get(struct csis_state *state)
267{ 271{
268 struct device *dev = &state->pdev->dev; 272 struct device *dev = &state->pdev->dev;
269 int i; 273 int i, ret;
270 274
271 for (i = 0; i < NUM_CSIS_CLOCKS; i++) { 275 for (i = 0; i < NUM_CSIS_CLOCKS; i++) {
272 state->clock[i] = clk_get(dev, csi_clock_name[i]); 276 state->clock[i] = clk_get(dev, csi_clock_name[i]);
273 if (IS_ERR(state->clock[i])) { 277 if (IS_ERR(state->clock[i]))
274 s5pcsis_clk_put(state); 278 goto err;
275 dev_err(dev, "failed to get clock: %s\n", 279 ret = clk_prepare(state->clock[i]);
276 csi_clock_name[i]); 280 if (ret < 0) {
277 return -ENXIO; 281 clk_put(state->clock[i]);
282 state->clock[i] = NULL;
283 goto err;
278 } 284 }
279 } 285 }
280 return 0; 286 return 0;
287err:
288 s5pcsis_clk_put(state);
289 dev_err(dev, "failed to get clock: %s\n", csi_clock_name[i]);
290 return -ENXIO;
281} 291}
282 292
283static int s5pcsis_s_power(struct v4l2_subdev *sd, int on) 293static int s5pcsis_s_power(struct v4l2_subdev *sd, int on)