diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-06-13 14:17:09 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 05:11:08 +1000 |
commit | 7238eca4cf18a5bba8679afc8c71a274e264f82e (patch) | |
tree | 96014d6d02c4c8c6db819e36a70bbf4d8d986f78 /drivers/gpu/drm/nouveau/core/engine/device | |
parent | 7e1ee6333c32a4b83aad430a4bcb8a7057f36194 (diff) | |
download | op-kernel-dev-7238eca4cf18a5bba8679afc8c71a274e264f82e.zip op-kernel-dev-7238eca4cf18a5bba8679afc8c71a274e264f82e.tar.gz |
drm/nouveau: expose pstate selection per-power source in sysfs
echo ac:id >> pstate # select mode when on mains power
echo dc:id >> pstate # select mode when on battery
echo id >> pstate # select mode for both
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/core/engine/device')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/device/ctrl.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/ctrl.c b/drivers/gpu/drm/nouveau/core/engine/device/ctrl.c index 754fc1d..fb546f3 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/ctrl.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/ctrl.c @@ -40,15 +40,16 @@ nouveau_control_mthd_pstate_info(struct nouveau_object *object, u32 mthd, return -EINVAL; if (clk) { - args->count = clk->state_nr; - if (clk->pwrsrc) - args->ustate = clk->ustate_ac; - else - args->ustate = clk->ustate_dc; + args->count = clk->state_nr; + args->ustate_ac = clk->ustate_ac; + args->ustate_dc = clk->ustate_dc; + args->pwrsrc = clk->pwrsrc; args->pstate = clk->pstate; } else { - args->count = 0; - args->ustate = NV_CONTROL_PSTATE_INFO_USTATE_DISABLE; + args->count = 0; + args->ustate_ac = NV_CONTROL_PSTATE_INFO_USTATE_DISABLE; + args->ustate_dc = NV_CONTROL_PSTATE_INFO_USTATE_DISABLE; + args->pwrsrc = -ENOSYS; args->pstate = NV_CONTROL_PSTATE_INFO_PSTATE_UNKNOWN; } @@ -122,11 +123,19 @@ nouveau_control_mthd_pstate_user(struct nouveau_object *object, u32 mthd, { struct nouveau_clock *clk = nouveau_clock(object); struct nv_control_pstate_user *args = data; + int ret = 0; if (size < sizeof(*args) || !clk) return -EINVAL; - return nouveau_clock_ustate(clk, args->state, clk->pwrsrc); + if (args->pwrsrc >= 0) { + ret |= nouveau_clock_ustate(clk, args->ustate, args->pwrsrc); + } else { + ret |= nouveau_clock_ustate(clk, args->ustate, 0); + ret |= nouveau_clock_ustate(clk, args->ustate, 1); + } + + return ret; } struct nouveau_oclass |