[Nouveau] [PATCH v4 35/37] clk: set clocks to pre suspend state after suspend

Martin Peres martin.peres at free.fr
Wed Apr 20 22:23:17 UTC 2016


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

Reviewed-by: Martin Peres <martin.peres at free.fr>
> ---
>   drm/nouveau/nvkm/subdev/clk/base.c  | 19 +++++++++++--------
>   drm/nouveau/nvkm/subdev/clk/gf100.c |  4 ++--
>   drm/nouveau/nvkm/subdev/clk/nv40.c  |  2 +-
>   drm/nouveau/nvkm/subdev/clk/priv.h  |  6 +++---
>   4 files changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
> index 2776d79..d5440a9 100644
> --- a/drm/nouveau/nvkm/subdev/clk/base.c
> +++ b/drm/nouveau/nvkm/subdev/clk/base.c
> @@ -324,7 +324,7 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstateid)
>   }
>   
>   static void
> -nvkm_clk_update_impl(struct nvkm_clk *clk)
> +nvkm_clk_update_impl(struct nvkm_clk *clk, bool force)
>   {
>   	struct nvkm_subdev *subdev = &clk->subdev;
>   	int pstate;
> @@ -349,7 +349,7 @@ nvkm_clk_update_impl(struct nvkm_clk *clk)
>   		pstate = -1;
>   	}
>   
> -	clk->func->update(clk, pstate);
> +	clk->func->update(clk, pstate, force);
>   }
>   
>   static void
> @@ -360,7 +360,7 @@ nvkm_clk_update_work(struct work_struct *work)
>   	if (!atomic_xchg(&clk->waiting, 0))
>   		return;
>   
> -	nvkm_clk_update_impl(clk);
> +	nvkm_clk_update_impl(clk, false);
>   
>   	wake_up_all(&clk->wait);
>   	nvkm_notify_get(&clk->pwrsrc_ntfy);
> @@ -613,11 +613,7 @@ nvkm_clk_init(struct nvkm_subdev *subdev)
>   	if (clk->func->init)
>   		return clk->func->init(clk);
>   
> -	clk->astate = -1;
> -	clk->pstate = NULL;
> -	clk->exp_cstate = NVKM_CLK_CSTATE_DEFAULT;
> -	clk->set_cstate = NULL;
> -	nvkm_clk_update(clk, true);
> +	nvkm_clk_update_impl(clk, true);
>   	return 0;
>   }
>   
> @@ -672,8 +668,15 @@ nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device,
>   	clk->func = func;
>   	INIT_LIST_HEAD(&clk->states);
>   	clk->domains = func->domains;
> +
> +	clk->pstate = NULL;
> +	clk->astate = -1;
>   	clk->ustate_ac = -1;
>   	clk->ustate_dc = -1;
> +
> +	clk->exp_cstate = NVKM_CLK_CSTATE_DEFAULT;
> +	clk->set_cstate = NULL;
> +
>   	clk->allow_reclock = allow_reclock;
>   
>   	INIT_WORK(&clk->work, nvkm_clk_update_work);
> diff --git a/drm/nouveau/nvkm/subdev/clk/gf100.c b/drm/nouveau/nvkm/subdev/clk/gf100.c
> index 5025dcc..5621daf 100644
> --- a/drm/nouveau/nvkm/subdev/clk/gf100.c
> +++ b/drm/nouveau/nvkm/subdev/clk/gf100.c
> @@ -447,12 +447,12 @@ gf100_clk_update_volt(struct nvkm_clk *clk)
>   }
>   
>   void
> -gf100_clk_update(struct nvkm_clk *clk, int pstate)
> +gf100_clk_update(struct nvkm_clk *clk, int pstate, bool force)
>   {
>   	struct nvkm_subdev *subdev = &clk->subdev;
>   	int ret;
>   
> -	if (!clk->pstate || clk->pstate->pstate != pstate) {
> +	if (!clk->pstate || clk->pstate->pstate != pstate || force) {
>   		nvkm_trace(subdev, "-> P %d\n", pstate);
>   		ret = nvkm_pstate_prog(clk, pstate);
>   		if (ret) {
> diff --git a/drm/nouveau/nvkm/subdev/clk/nv40.c b/drm/nouveau/nvkm/subdev/clk/nv40.c
> index 5b10ee2..055063a 100644
> --- a/drm/nouveau/nvkm/subdev/clk/nv40.c
> +++ b/drm/nouveau/nvkm/subdev/clk/nv40.c
> @@ -202,7 +202,7 @@ nv40_clk_tidy(struct nvkm_clk *obj)
>   }
>   
>   void
> -nv40_clk_update(struct nvkm_clk *clk, int pstate)
> +nv40_clk_update(struct nvkm_clk *clk, int pstate, bool force)
>   {
>   	struct nvkm_subdev *subdev = &clk->subdev;
>   	int ret;
> diff --git a/drm/nouveau/nvkm/subdev/clk/priv.h b/drm/nouveau/nvkm/subdev/clk/priv.h
> index e2f15c4..06a78a2 100644
> --- a/drm/nouveau/nvkm/subdev/clk/priv.h
> +++ b/drm/nouveau/nvkm/subdev/clk/priv.h
> @@ -10,7 +10,7 @@ struct nvkm_clk_func {
>   	int (*calc)(struct nvkm_clk *, struct nvkm_cstate *);
>   	int (*prog)(struct nvkm_clk *);
>   	void (*tidy)(struct nvkm_clk *);
> -	void (*update)(struct nvkm_clk *, int pstate);
> +	void (*update)(struct nvkm_clk *, int pstate, bool force);
>   	struct nvkm_pstate *pstates;
>   	int nr_pstates;
>   	struct nvkm_domain domains[];
> @@ -30,6 +30,6 @@ int nv04_clk_pll_calc(struct nvkm_clk *, struct nvbios_pll *, int clk,
>   		      struct nvkm_pll_vals *);
>   int nv04_clk_pll_prog(struct nvkm_clk *, u32 reg1, struct nvkm_pll_vals *);
>   
> -void nv40_clk_update(struct nvkm_clk *, int pstate);
> -void gf100_clk_update(struct nvkm_clk *, int pstate);
> +void nv40_clk_update(struct nvkm_clk *, int pstate, bool force);
> +void gf100_clk_update(struct nvkm_clk *, int pstate, bool force);
>   #endif



More information about the Nouveau mailing list