[v4,21/37] clk: save the max clock we can set

Submitted by Karol Herbst on April 18, 2016, 7:13 p.m.

Details

Message ID 1461006851-5007-22-git-send-email-nouveau@karolherbst.de
State New
Headers show
Series "Volting/Clocking improvements for Fermi and newer" ( rev: 4 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst April 18, 2016, 7:13 p.m.
Signed-off-by: Karol Herbst <nouveau@karolherbst.de>
---
 drm/nouveau/include/nvkm/subdev/clk.h | 1 +
 drm/nouveau/nvkm/subdev/clk/base.c    | 2 ++
 2 files changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/include/nvkm/subdev/clk.h b/drm/nouveau/include/nvkm/subdev/clk.h
index 99ee05c..61d99fd 100644
--- a/drm/nouveau/include/nvkm/subdev/clk.h
+++ b/drm/nouveau/include/nvkm/subdev/clk.h
@@ -105,6 +105,7 @@  struct nvkm_clk {
 	u8  boost_mode;
 	u32 base_khz;
 	u32 boost_khz;
+	u32 max_khz;
 
 	/*XXX: die, these are here *only* to support the completely
 	 *     bat-shit insane what-was-nouveau_hw.c code
diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
index a9a3666..1ca25dd 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -257,6 +257,8 @@  nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
 			u32 freq = nvkm_clk_adjust(clk, true, pstate->pstate,
 						   domain->bios, cstepX.freq);
 			cstate->domain[domain->name] = freq;
+			if (domain->flags & NVKM_CLK_DOM_FLAG_BASECLK)
+				clk->max_khz = max(clk->max_khz, freq);
 		}
 		domain++;
 	}

Comments

On 18/04/16 22:13, Karol Herbst wrote:
> Signed-off-by: Karol Herbst <nouveau@karolherbst.de>

Reviewed-by: Martin Peres <martin.peres@free.fr>
> ---
>   drm/nouveau/include/nvkm/subdev/clk.h | 1 +
>   drm/nouveau/nvkm/subdev/clk/base.c    | 2 ++
>   2 files changed, 3 insertions(+)
>
> diff --git a/drm/nouveau/include/nvkm/subdev/clk.h b/drm/nouveau/include/nvkm/subdev/clk.h
> index 99ee05c..61d99fd 100644
> --- a/drm/nouveau/include/nvkm/subdev/clk.h
> +++ b/drm/nouveau/include/nvkm/subdev/clk.h
> @@ -105,6 +105,7 @@ struct nvkm_clk {
>   	u8  boost_mode;
>   	u32 base_khz;
>   	u32 boost_khz;
> +	u32 max_khz;
>   
>   	/*XXX: die, these are here *only* to support the completely
>   	 *     bat-shit insane what-was-nouveau_hw.c code
> diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
> index a9a3666..1ca25dd 100644
> --- a/drm/nouveau/nvkm/subdev/clk/base.c
> +++ b/drm/nouveau/nvkm/subdev/clk/base.c
> @@ -257,6 +257,8 @@ nvkm_cstate_new(struct nvkm_clk *clk, int idx, struct nvkm_pstate *pstate)
>   			u32 freq = nvkm_clk_adjust(clk, true, pstate->pstate,
>   						   domain->bios, cstepX.freq);
>   			cstate->domain[domain->name] = freq;
> +			if (domain->flags & NVKM_CLK_DOM_FLAG_BASECLK)
> +				clk->max_khz = max(clk->max_khz, freq);
>   		}
>   		domain++;
>   	}