From 35d1482625205a11742814f53390fcc7057435ec Mon Sep 17 00:00:00 2001 From: Guochun Huang Date: Tue, 17 Nov 2020 11:17:58 +0800 Subject: [PATCH] drm/rockchip: dsi: enable hclk before pclk There is a risk of access failure, if pclk is enabled without enabling hclk in rk3568. Change-Id: I02c2a0d8ad6c0d2c6649ee16ab50dda0da542aac Signed-off-by: Guochun Huang --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index f5d8ae9bf85c..b246e6016c83 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -262,6 +262,7 @@ struct dw_mipi_dsi { struct device_node *client; struct regmap *grf; struct clk *pclk; + struct clk *hclk; struct mipi_dphy dphy; struct regmap *regmap; struct reset_control *rst; @@ -1701,6 +1702,13 @@ static int dw_mipi_dsi_probe(struct platform_device *pdev) return ret; } + dsi->hclk = devm_clk_get_optional(dev, "hclk"); + if (IS_ERR(dsi->hclk)) { + ret = PTR_ERR(dsi->hclk); + DRM_DEV_ERROR(dev, "Unable to get hclk: %d\n", ret); + return ret; + } + dsi->regmap = devm_regmap_init_mmio(dev, regs, &dw_mipi_dsi_regmap_config); if (IS_ERR(dsi->regmap)) { @@ -1762,6 +1770,7 @@ static int __maybe_unused dw_mipi_dsi_runtime_suspend(struct device *dev) struct dw_mipi_dsi *dsi = dev_get_drvdata(dev); clk_disable_unprepare(dsi->pclk); + clk_disable_unprepare(dsi->hclk); clk_disable_unprepare(dsi->dphy.hs_clk); clk_disable_unprepare(dsi->dphy.ref_clk); clk_disable_unprepare(dsi->dphy.cfg_clk); @@ -1776,6 +1785,7 @@ static int __maybe_unused dw_mipi_dsi_runtime_resume(struct device *dev) clk_prepare_enable(dsi->dphy.cfg_clk); clk_prepare_enable(dsi->dphy.ref_clk); clk_prepare_enable(dsi->dphy.hs_clk); + clk_prepare_enable(dsi->hclk); clk_prepare_enable(dsi->pclk); return 0;