[04/19] clk: print the base clocks

Submitted by Karol Herbst on March 17, 2016, 11:03 p.m.

Details

Message ID 1458255836-3878-5-git-send-email-nouveau@karolherbst.de
State New
Headers show
Series "Volting/Clocking improvements for Fermi and newer" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst March 17, 2016, 11:03 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 889cce2..4928668 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>
@@ -561,10 +562,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;

Comments

On 18/03/16 01:03, Karol Herbst wrote:
> Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
> ---
>   drm/nouveau/nvkm/subdev/clk/base.c | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
> index 889cce2..4928668 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>
> @@ -561,10 +562,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;
>

I would rather have you report this information in debugfs, if you don't 
mind.

This is really out of place, especially since we do not show the clocks 
anymore apparently.