drm/tegra: hdmi - Clean up clock usage
authorThierry Reding <treding@nvidia.com>
Wed, 16 Apr 2014 08:43:41 +0000 (10:43 +0200)
committerThierry Reding <treding@nvidia.com>
Thu, 5 Jun 2014 21:09:23 +0000 (23:09 +0200)
Clocks are never enabled or disabled in atomic context, so we can use
the clk_prepare_enable() and clk_disable_unprepare() helpers instead.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/hdmi.c

index 96fa838d60a415edc872ef041a514e32678ff3e7..5bc26590ab327b265d1cf7746c8fa222a1b5454a 100644 (file)
@@ -727,7 +727,7 @@ static int tegra_output_hdmi_enable(struct tegra_output *output)
        if (err < 0)
                return err;
 
-       err = clk_enable(hdmi->clk);
+       err = clk_prepare_enable(hdmi->clk);
        if (err < 0) {
                dev_err(hdmi->dev, "failed to enable clock: %d\n", err);
                return err;
@@ -944,8 +944,8 @@ static int tegra_output_hdmi_disable(struct tegra_output *output)
                tegra_dc_writel(dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL);
        }
 
+       clk_disable_unprepare(hdmi->clk);
        reset_control_assert(hdmi->rst);
-       clk_disable(hdmi->clk);
        regulator_disable(hdmi->vdd);
        regulator_disable(hdmi->pll);
 
@@ -1015,7 +1015,7 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)
        struct tegra_hdmi *hdmi = node->info_ent->data;
        int err;
 
-       err = clk_enable(hdmi->clk);
+       err = clk_prepare_enable(hdmi->clk);
        if (err)
                return err;
 
@@ -1184,7 +1184,7 @@ static int tegra_hdmi_show_regs(struct seq_file *s, void *data)
 
 #undef DUMP_REG
 
-       clk_disable(hdmi->clk);
+       clk_disable_unprepare(hdmi->clk);
 
        return 0;
 }
@@ -1379,18 +1379,10 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
                return PTR_ERR(hdmi->rst);
        }
 
-       err = clk_prepare(hdmi->clk);
-       if (err < 0)
-               return err;
-
        hdmi->clk_parent = devm_clk_get(&pdev->dev, "parent");
        if (IS_ERR(hdmi->clk_parent))
                return PTR_ERR(hdmi->clk_parent);
 
-       err = clk_prepare(hdmi->clk_parent);
-       if (err < 0)
-               return err;
-
        err = clk_set_parent(hdmi->clk, hdmi->clk_parent);
        if (err < 0) {
                dev_err(&pdev->dev, "failed to setup clocks: %d\n", err);
@@ -1466,8 +1458,8 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
                return err;
        }
 
-       clk_unprepare(hdmi->clk_parent);
-       clk_unprepare(hdmi->clk);
+       clk_disable_unprepare(hdmi->clk_parent);
+       clk_disable_unprepare(hdmi->clk);
 
        return 0;
 }