[5/9] clk: print the base clocks

Submitted by Karol Herbst on Feb. 29, 2016, 12:42 p.m.

Details

Message ID 1456749738-5145-6-git-send-email-nouveau@karolherbst.de
State New
Headers show
Series "Groundwork for clocking fixes" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst Feb. 29, 2016, 12:42 p.m.
Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
---
 drm/nouveau/nvkm/subdev/clk/base.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
index 0ef371b..0f9b8c5 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -24,6 +24,7 @@ 
 #include "priv.h"
 
 #include <subdev/bios.h>
+#include <subdev/bios/baseclock.h>
 #include <subdev/bios/boost.h>
 #include <subdev/bios/cstep.h>
 #include <subdev/bios/perf.h>
@@ -562,10 +563,24 @@  int
 nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device,
 	      int index, bool allow_reclock, struct nvkm_clk *clk)
 {
+	struct nvkm_subdev *subdev = &clk->subdev;
+	struct nvkm_bios *bios = device->bios;
 	int ret, idx, arglen;
 	const char *mode;
+	struct nvbios_baseclk_header h;
+
+	nvkm_subdev_ctor(&nvkm_clk, device, index, 0, subdev);
+
+	if (bios && !nvbios_baseclock_parse(bios, &h)) {
+		struct nvbios_baseclk_entry base, boost;
+		if (!nvbios_baseclock_entry(bios, &h, h.boost, &boost))
+			nvkm_info(subdev, "boost: %i MHz\n",
+				  boost.clock_mhz / 2);
+		if (!nvbios_baseclock_entry(bios, &h, h.base, &base))
+			nvkm_info(subdev, "base: %i MHz\n",
+				  base.clock_mhz / 2);
+	}
 
-	nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev);
 	clk->func = func;
 	INIT_LIST_HEAD(&clk->states);
 	clk->domains = func->domains;