linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/sun4i: backend: Make sure we enforce the clock rate
@ 2019-12-19  9:19 Maxime Ripard
  2019-12-19  9:20 ` [PATCH 2/2] drm/sun4i: drc: " Maxime Ripard
  2020-01-07 13:37 ` [PATCH 1/2] drm/sun4i: backend: " Chen-Yu Tsai
  0 siblings, 2 replies; 5+ messages in thread
From: Maxime Ripard @ 2019-12-19  9:19 UTC (permalink / raw)
  To: Chen-Yu Tsai, Maxime Ripard
  Cc: Paul Kocialkowski, linux-arm-kernel, dri-devel, Maxime Ripard

The backend needs to run at 300MHz to be functional. This was done so far
using assigned-clocks in the device tree, but that is easy to forget, and
dosen't provide any other guarantee than the rate is going to be roughly
the one requested at probe time.

Therefore it's pretty fragile, so let's just use the exclusive clock API to
enforce it.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/sun4i/sun4i_backend.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index 4e29f4fe4a05..aa55eaeb8823 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -857,6 +857,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
 		goto err_disable_bus_clk;
 	}
 	clk_prepare_enable(backend->mod_clk);
+	clk_set_rate_exclusive(backend->mod_clk, 300000000);
 
 	backend->ram_clk = devm_clk_get(dev, "ram");
 	if (IS_ERR(backend->ram_clk)) {
@@ -932,6 +933,7 @@ static int sun4i_backend_bind(struct device *dev, struct device *master,
 err_disable_ram_clk:
 	clk_disable_unprepare(backend->ram_clk);
 err_disable_mod_clk:
+	clk_rate_exclusive_put(backend->mod_clk);
 	clk_disable_unprepare(backend->mod_clk);
 err_disable_bus_clk:
 	clk_disable_unprepare(backend->bus_clk);
@@ -952,6 +954,7 @@ static void sun4i_backend_unbind(struct device *dev, struct device *master,
 		sun4i_backend_free_sat(dev);
 
 	clk_disable_unprepare(backend->ram_clk);
+	clk_rate_exclusive_put(backend->mod_clk);
 	clk_disable_unprepare(backend->mod_clk);
 	clk_disable_unprepare(backend->bus_clk);
 	reset_control_assert(backend->reset);
-- 
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-07 14:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-19  9:19 [PATCH 1/2] drm/sun4i: backend: Make sure we enforce the clock rate Maxime Ripard
2019-12-19  9:20 ` [PATCH 2/2] drm/sun4i: drc: " Maxime Ripard
2020-01-07 13:40   ` Chen-Yu Tsai
2020-01-07 14:12   ` Chen-Yu Tsai
2020-01-07 13:37 ` [PATCH 1/2] drm/sun4i: backend: " Chen-Yu Tsai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).