Commit 2cfd22f4 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Ben Skeggs

drm/nouveau/clk: make therm and volt devices optional

Allow the clock subsystem to operate even if voltage and thermal devices
are not set for the device (for people with watercooling! ;))
Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent cbb4cf8b
...@@ -90,17 +90,21 @@ nouveau_cstate_prog(struct nouveau_clock *clk, ...@@ -90,17 +90,21 @@ nouveau_cstate_prog(struct nouveau_clock *clk,
cstate = &pstate->base; cstate = &pstate->base;
} }
if (ptherm) {
ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, +1); ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, +1);
if (ret && ret != -ENODEV) { if (ret && ret != -ENODEV) {
nv_error(clk, "failed to raise fan speed: %d\n", ret); nv_error(clk, "failed to raise fan speed: %d\n", ret);
return ret; return ret;
} }
}
if (volt) {
ret = volt->set_id(volt, cstate->voltage, +1); ret = volt->set_id(volt, cstate->voltage, +1);
if (ret && ret != -ENODEV) { if (ret && ret != -ENODEV) {
nv_error(clk, "failed to raise voltage: %d\n", ret); nv_error(clk, "failed to raise voltage: %d\n", ret);
return ret; return ret;
} }
}
ret = clk->calc(clk, cstate); ret = clk->calc(clk, cstate);
if (ret == 0) { if (ret == 0) {
...@@ -108,13 +112,17 @@ nouveau_cstate_prog(struct nouveau_clock *clk, ...@@ -108,13 +112,17 @@ nouveau_cstate_prog(struct nouveau_clock *clk,
clk->tidy(clk); clk->tidy(clk);
} }
if (volt) {
ret = volt->set_id(volt, cstate->voltage, -1); ret = volt->set_id(volt, cstate->voltage, -1);
if (ret && ret != -ENODEV) if (ret && ret != -ENODEV)
nv_error(clk, "failed to lower voltage: %d\n", ret); nv_error(clk, "failed to lower voltage: %d\n", ret);
}
if (ptherm) {
ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, -1); ret = nouveau_therm_cstate(ptherm, pstate->fanspeed, -1);
if (ret && ret != -ENODEV) if (ret && ret != -ENODEV)
nv_error(clk, "failed to lower fan speed: %d\n", ret); nv_error(clk, "failed to lower fan speed: %d\n", ret);
}
return 0; return 0;
} }
......
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