aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2015-03-25 18:57:28 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 15:38:03 -0400
commit64904b574e33f897cc425fcbe64cebab92b3c6fb (patch)
treed0cfcecb0958e60d7522ad0d3c2e56faa8ca2c22
parent703e6f625bd9400e76fd9dcda56011b67b954a10 (diff)
[media] omap3isp: DT support for clocks
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/platform/omap3isp/isp.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index f694615f32c4..82499cd7c3d7 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -279,9 +279,21 @@ static const struct clk_init_data isp_xclk_init_data = {
279 .num_parents = 1, 279 .num_parents = 1,
280}; 280};
281 281
282static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
283{
284 unsigned int idx = clkspec->args[0];
285 struct isp_device *isp = data;
286
287 if (idx >= ARRAY_SIZE(isp->xclks))
288 return ERR_PTR(-ENOENT);
289
290 return isp->xclks[idx].clk;
291}
292
282static int isp_xclk_init(struct isp_device *isp) 293static int isp_xclk_init(struct isp_device *isp)
283{ 294{
284 struct isp_platform_data *pdata = isp->pdata; 295 struct isp_platform_data *pdata = isp->pdata;
296 struct device_node *np = isp->dev->of_node;
285 struct clk_init_data init; 297 struct clk_init_data init;
286 unsigned int i; 298 unsigned int i;
287 299
@@ -312,6 +324,12 @@ static int isp_xclk_init(struct isp_device *isp)
312 if (IS_ERR(xclk->clk)) 324 if (IS_ERR(xclk->clk))
313 return PTR_ERR(xclk->clk); 325 return PTR_ERR(xclk->clk);
314 326
327 /* When instantiated from DT we don't need to register clock
328 * aliases.
329 */
330 if (np)
331 continue;
332
315 if (pdata->xclks[i].con_id == NULL && 333 if (pdata->xclks[i].con_id == NULL &&
316 pdata->xclks[i].dev_id == NULL) 334 pdata->xclks[i].dev_id == NULL)
317 continue; 335 continue;
@@ -327,13 +345,20 @@ static int isp_xclk_init(struct isp_device *isp)
327 clkdev_add(xclk->lookup); 345 clkdev_add(xclk->lookup);
328 } 346 }
329 347
348 if (np)
349 of_clk_add_provider(np, isp_xclk_src_get, isp);
350
330 return 0; 351 return 0;
331} 352}
332 353
333static void isp_xclk_cleanup(struct isp_device *isp) 354static void isp_xclk_cleanup(struct isp_device *isp)
334{ 355{
356 struct device_node *np = isp->dev->of_node;
335 unsigned int i; 357 unsigned int i;
336 358
359 if (np)
360 of_clk_del_provider(np);
361
337 for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) { 362 for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) {
338 struct isp_xclk *xclk = &isp->xclks[i]; 363 struct isp_xclk *xclk = &isp->xclks[i];
339 364