drm/msm/mdp4: only use lut_clk on mdp4.2+
authorJonathan Marek <jonathan@marek.ca>
Thu, 22 Nov 2018 01:52:27 +0000 (20:52 -0500)
committerRob Clark <robdclark@gmail.com>
Tue, 11 Dec 2018 18:07:05 +0000 (13:07 -0500)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c

index 934a49818ea4c0e68b1cd2606ddd16a9bd567bdc..ab3938f24522badb35b825cfa3c5c081bbf4f76b 100644 (file)
@@ -206,7 +206,8 @@ int mdp4_disable(struct mdp4_kms *mdp4_kms)
        clk_disable_unprepare(mdp4_kms->clk);
        if (mdp4_kms->pclk)
                clk_disable_unprepare(mdp4_kms->pclk);
-       clk_disable_unprepare(mdp4_kms->lut_clk);
+       if (mdp4_kms->lut_clk)
+               clk_disable_unprepare(mdp4_kms->lut_clk);
        if (mdp4_kms->axi_clk)
                clk_disable_unprepare(mdp4_kms->axi_clk);
 
@@ -220,7 +221,8 @@ int mdp4_enable(struct mdp4_kms *mdp4_kms)
        clk_prepare_enable(mdp4_kms->clk);
        if (mdp4_kms->pclk)
                clk_prepare_enable(mdp4_kms->pclk);
-       clk_prepare_enable(mdp4_kms->lut_clk);
+       if (mdp4_kms->lut_clk)
+               clk_prepare_enable(mdp4_kms->lut_clk);
        if (mdp4_kms->axi_clk)
                clk_prepare_enable(mdp4_kms->axi_clk);
 
@@ -472,12 +474,13 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev)
        if (IS_ERR(mdp4_kms->pclk))
                mdp4_kms->pclk = NULL;
 
-       // XXX if (rev >= MDP_REV_42) { ???
-       mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk");
-       if (IS_ERR(mdp4_kms->lut_clk)) {
-               DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n");
-               ret = PTR_ERR(mdp4_kms->lut_clk);
-               goto fail;
+       if (mdp4_kms->rev >= 2) {
+               mdp4_kms->lut_clk = devm_clk_get(&pdev->dev, "lut_clk");
+               if (IS_ERR(mdp4_kms->lut_clk)) {
+                       DRM_DEV_ERROR(dev->dev, "failed to get lut_clk\n");
+                       ret = PTR_ERR(mdp4_kms->lut_clk);
+                       goto fail;
+               }
        }
 
        mdp4_kms->axi_clk = devm_clk_get(&pdev->dev, "bus_clk");
@@ -488,7 +491,8 @@ struct msm_kms *mdp4_kms_init(struct drm_device *dev)
        }
 
        clk_set_rate(mdp4_kms->clk, config->max_clk);
-       clk_set_rate(mdp4_kms->lut_clk, config->max_clk);
+       if (mdp4_kms->lut_clk)
+               clk_set_rate(mdp4_kms->lut_clk, config->max_clk);
 
        pm_runtime_enable(dev->dev);
        mdp4_kms->rpm_enabled = true;