[Nouveau] [PATCH v3 12/29] clk: fixup cstate selection
Karol Herbst
nouveau at karolherbst.de
Thu Apr 7 21:24:02 UTC 2016
now the cstatei parameter can be used of the nvkm_cstate_prog function to
select a specific cstate.
-1 is a magic value, which will always select the highest currently possible
cstate
Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
---
drm/nouveau/nvkm/subdev/clk/base.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drm/nouveau/nvkm/subdev/clk/base.c b/drm/nouveau/nvkm/subdev/clk/base.c
index 720434f..29478c7 100644
--- a/drm/nouveau/nvkm/subdev/clk/base.c
+++ b/drm/nouveau/nvkm/subdev/clk/base.c
@@ -85,7 +85,15 @@ nvkm_cstate_prog(struct nvkm_clk *clk, struct nvkm_pstate *pstate, int cstatei)
int ret;
if (!list_empty(&pstate->list)) {
- cstate = list_entry(pstate->list.prev, typeof(*cstate), head);
+ if (cstatei == -1)
+ cstate = list_entry(pstate->list.prev, typeof(*cstate),
+ head);
+ else {
+ list_for_each_entry(cstate, &pstate->list, head) {
+ if (cstate->cstate == cstatei)
+ break;
+ }
+ }
} else {
cstate = &pstate->base;
}
@@ -207,7 +215,7 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstatei)
ram->func->tidy(ram);
}
- return nvkm_cstate_prog(clk, pstate, 0);
+ return nvkm_cstate_prog(clk, pstate, -1);
}
static void
--
2.8.1
More information about the Nouveau
mailing list