]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/gpu/drm/sun4i/sun6i_drc.c
drm/sun4i: drc: Make sure we enforce the clock rate
[linux.git] / drivers / gpu / drm / sun4i / sun6i_drc.c
index 442094a4af7a90eb64e8246f19c26e3a33902569..4fbe9a6b5182c48c9c0f0870706ca801df5d34c1 100644 (file)
@@ -1,12 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (C) 2016 Free Electrons
  *
  * Maxime Ripard <maxime.ripard@free-electrons.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
  */
 
 #include <linux/clk.h>
@@ -60,6 +56,13 @@ static int sun6i_drc_bind(struct device *dev, struct device *master,
                ret = PTR_ERR(drc->mod_clk);
                goto err_disable_bus_clk;
        }
+
+       ret = clk_set_rate_exclusive(drc->mod_clk, 300000000);
+       if (ret) {
+               dev_err(dev, "Couldn't set the module clock frequency\n");
+               goto err_disable_bus_clk;
+       }
+
        clk_prepare_enable(drc->mod_clk);
 
        return 0;
@@ -76,6 +79,7 @@ static void sun6i_drc_unbind(struct device *dev, struct device *master,
 {
        struct sun6i_drc *drc = dev_get_drvdata(dev);
 
+       clk_rate_exclusive_put(drc->mod_clk);
        clk_disable_unprepare(drc->mod_clk);
        clk_disable_unprepare(drc->bus_clk);
        reset_control_assert(drc->reset);