diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-03-25 23:57:28 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-02 21:38:03 +0200 |
commit | 64904b574e33f897cc425fcbe64cebab92b3c6fb (patch) | |
tree | d0cfcecb0958e60d7522ad0d3c2e56faa8ca2c22 /drivers/media/platform/omap3isp | |
parent | [media] omap3isp: Separate external link creation from platform data parsing (diff) | |
download | linux-64904b574e33f897cc425fcbe64cebab92b3c6fb.tar.xz linux-64904b574e33f897cc425fcbe64cebab92b3c6fb.zip |
[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>
Diffstat (limited to 'drivers/media/platform/omap3isp')
-rw-r--r-- | drivers/media/platform/omap3isp/isp.c | 25 |
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 = { .num_parents = 1, }; +static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data) +{ + unsigned int idx = clkspec->args[0]; + struct isp_device *isp = data; + + if (idx >= ARRAY_SIZE(isp->xclks)) + return ERR_PTR(-ENOENT); + + return isp->xclks[idx].clk; +} + static int isp_xclk_init(struct isp_device *isp) { struct isp_platform_data *pdata = isp->pdata; + struct device_node *np = isp->dev->of_node; struct clk_init_data init; unsigned int i; @@ -312,6 +324,12 @@ static int isp_xclk_init(struct isp_device *isp) if (IS_ERR(xclk->clk)) return PTR_ERR(xclk->clk); + /* When instantiated from DT we don't need to register clock + * aliases. + */ + if (np) + continue; + if (pdata->xclks[i].con_id == NULL && pdata->xclks[i].dev_id == NULL) continue; @@ -327,13 +345,20 @@ static int isp_xclk_init(struct isp_device *isp) clkdev_add(xclk->lookup); } + if (np) + of_clk_add_provider(np, isp_xclk_src_get, isp); + return 0; } static void isp_xclk_cleanup(struct isp_device *isp) { + struct device_node *np = isp->dev->of_node; unsigned int i; + if (np) + of_clk_del_provider(np); + for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) { struct isp_xclk *xclk = &isp->xclks[i]; |