Commit f8a85461 authored by Vince Hsu's avatar Vince Hsu Committed by Ben Skeggs

drm/nouveau/clk: allow non-blocking for nouveau_clock_astate()

There might be some callers of nouveau_clock_astate(), and they are from
inetrrupt context. So we must ensure that this function can be atomic in
that condition. This patch adds one parameter which is subsequently passed
to nouveau_pstate_calc(). Therefore we can choose whether we want to wait
for the pstate work's completion or not.
Signed-off-by: default avatarVince Hsu <vinceh@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 9509ff75
...@@ -159,7 +159,7 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *, ...@@ -159,7 +159,7 @@ int nva3_clock_pll_calc(struct nouveau_clock *, struct nvbios_pll *,
int clk, struct nouveau_pll_vals *); int clk, struct nouveau_pll_vals *);
int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr); int nouveau_clock_ustate(struct nouveau_clock *, int req, int pwr);
int nouveau_clock_astate(struct nouveau_clock *, int req, int rel); int nouveau_clock_astate(struct nouveau_clock *, int req, int rel, bool wait);
int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel); int nouveau_clock_dstate(struct nouveau_clock *, int req, int rel);
int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel); int nouveau_clock_tstate(struct nouveau_clock *, int req, int rel);
......
...@@ -430,13 +430,13 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req, int pwr) ...@@ -430,13 +430,13 @@ nouveau_clock_ustate(struct nouveau_clock *clk, int req, int pwr)
} }
int int
nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel) nouveau_clock_astate(struct nouveau_clock *clk, int req, int rel, bool wait)
{ {
if (!rel) clk->astate = req; if (!rel) clk->astate = req;
if ( rel) clk->astate += rel; if ( rel) clk->astate += rel;
clk->astate = min(clk->astate, clk->state_nr - 1); clk->astate = min(clk->astate, clk->state_nr - 1);
clk->astate = max(clk->astate, 0); clk->astate = max(clk->astate, 0);
return nouveau_pstate_calc(clk, true); return nouveau_pstate_calc(clk, wait);
} }
int int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment