* [PATCH v2] drm/nouveau/clk: fix tstate to pstate calculation
@ 2015-06-16 9:35 Wei Ni
[not found] ` <1434447312-2218-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Wei Ni @ 2015-06-16 9:35 UTC (permalink / raw)
To: bskeggs-H+wXaHxf7aLQT0dZR+AlfA
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Wei Ni
According to the tstate calculation in nvkm_clk_tstate(),
the range of tstate is from -(clk->state_nr - 1) to 0,
it mean the tstate is negative value. But in nvkm_pstate_work(),
it use (clk->state_nr - 1 - clk->tstate) to limit pstate,
it's not correct.
This patch fix it to use (clk->state_nr - 1 + clk->tstate) to
limit pstate.
Signed-off-by: Wei Ni <wni@nvidia.com>
---
v2: create patch based on http://cgit.freedesktop.org/~darktama/nouveau/
drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
index 39a83d82e0cd..77a0ab5ca3b0 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -214,7 +214,7 @@ nvkm_pstate_work(struct work_struct *work)
pstate = clk->pwrsrc ? clk->ustate_ac : clk->ustate_dc;
if (clk->state_nr && pstate != -1) {
pstate = (pstate < 0) ? clk->astate : pstate;
- pstate = min(pstate, clk->state_nr - 1 - clk->tstate);
+ pstate = min(pstate, clk->state_nr - 1 + clk->tstate);
pstate = max(pstate, clk->dstate);
} else {
pstate = clk->pstate = -1;
--
1.9.1
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] drm/nouveau/clk: fix tstate to pstate calculation
[not found] ` <1434447312-2218-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2015-06-17 9:53 ` Ben Skeggs
0 siblings, 0 replies; 2+ messages in thread
From: Ben Skeggs @ 2015-06-17 9:53 UTC (permalink / raw)
To: Wei Ni; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Ben Skeggs
On 16 June 2015 at 19:35, Wei Ni <wni@nvidia.com> wrote:
> According to the tstate calculation in nvkm_clk_tstate(),
> the range of tstate is from -(clk->state_nr - 1) to 0,
> it mean the tstate is negative value. But in nvkm_pstate_work(),
> it use (clk->state_nr - 1 - clk->tstate) to limit pstate,
> it's not correct.
> This patch fix it to use (clk->state_nr - 1 + clk->tstate) to
> limit pstate.
>
> Signed-off-by: Wei Ni <wni@nvidia.com>
> ---
> v2: create patch based on http://cgit.freedesktop.org/~darktama/nouveau/
For future reference, it doesn't matter to me which tree it's based
on, theres a script in that repo under scripts/ that can apply either
form easily. So, use whichever is easiest for you :)
I've merged the patch.
Thanks,
Ben.
>
> drm/nouveau/nvkm/subdev/clk/base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
> index 39a83d82e0cd..77a0ab5ca3b0 100644
> --- a/drm/nouveau/nvkm/subdev/clk/base.c
> +++ b/drm/nouveau/nvkm/subdev/clk/base.c
> @@ -214,7 +214,7 @@ nvkm_pstate_work(struct work_struct *work)
> pstate = clk->pwrsrc ? clk->ustate_ac : clk->ustate_dc;
> if (clk->state_nr && pstate != -1) {
> pstate = (pstate < 0) ? clk->astate : pstate;
> - pstate = min(pstate, clk->state_nr - 1 - clk->tstate);
> + pstate = min(pstate, clk->state_nr - 1 + clk->tstate);
> pstate = max(pstate, clk->dstate);
> } else {
> pstate = clk->pstate = -1;
> --
> 1.9.1
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-17 9:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16 9:35 [PATCH v2] drm/nouveau/clk: fix tstate to pstate calculation Wei Ni
[not found] ` <1434447312-2218-1-git-send-email-wni-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-06-17 9:53 ` Ben Skeggs
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.