Get clock info from DT and enable it during initialization. Also changed name of the driver to "kmb,display" to match other entries in the DT. v2: fixed error in clk_disable Signed-off-by: Anitha Chrisanthus <anitha.chrisanthus@xxxxxxxxx> Reviewed-by: Bob Paauwe <bob.j.paauwe@xxxxxxxxx> --- drivers/gpu/drm/kmb/kmb_drv.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/kmb/kmb_drv.c b/drivers/gpu/drm/kmb/kmb_drv.c index 5a2ff9d..71fdb94 100644 --- a/drivers/gpu/drm/kmb/kmb_drv.c +++ b/drivers/gpu/drm/kmb/kmb_drv.c @@ -32,6 +32,25 @@ /*IRQ handler*/ static irqreturn_t kmb_isr(int irq, void *arg); +static struct clk *clk_lcd; +static struct clk *clk_mipi; + +static int kmb_display_clk_enable(void) +{ + clk_prepare_enable(clk_lcd); + clk_prepare_enable(clk_mipi); + return 0; +} + +static int kmb_display_clk_disable(void) +{ + if (clk_lcd) + clk_disable_unprepare(clk_lcd); + if (clk_mipi) + clk_disable_unprepare(clk_mipi); + return 0; +} + static int kmb_load(struct drm_device *drm, unsigned long flags) { struct kmb_drm_private *dev_p = to_kmb(drm); @@ -153,6 +172,19 @@ static int kmb_load(struct drm_device *drm, unsigned long flags) goto setup_fail; } + /* enable display clocks*/ + clk_lcd = clk_get(&pdev->dev, "clk_lcd"); + if (!clk_lcd) { + DRM_ERROR("clk_get() failed clk_lcd\n"); + goto setup_fail; + } + clk_mipi = clk_get(&pdev->dev, "clk_mipi"); + if (!clk_mipi) { + DRM_ERROR("clk_get() failed clk_mipi\n"); + goto setup_fail; + } + kmb_display_clk_enable(); + ret = drm_irq_install(drm, platform_get_irq(pdev, 0)); if (ret < 0) { DRM_ERROR("failed to install IRQ handler\n"); @@ -382,6 +414,11 @@ static void kmb_drm_unbind(struct device *dev) of_reserved_mem_device_release(drm->dev); drm_mode_config_cleanup(drm); + /*release clks */ + kmb_display_clk_disable(); + clk_put(clk_lcd); + clk_put(clk_mipi); + drm_dev_put(drm); drm->dev_private = NULL; dev_set_drvdata(dev, NULL); @@ -420,8 +457,8 @@ static int kmb_remove(struct platform_device *pdev) return 0; } -static const struct of_device_id kmb_of_match[] = { - {.compatible = "lcd"}, +static const struct of_device_id kmb_of_match[] = { + {.compatible = "kmb,display"}, {}, }; -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx