diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2017-05-19 16:59:35 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2017-06-16 07:04:53 +0300 |
commit | 9c5753bc708da0c2c544fcfe1e94afb399c2b3f6 (patch) | |
tree | 5a61e96fa15a282349dbef9f714d4fe052787910 /drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c | |
parent | 29c0ca7389ce8e259516d14397890bfe0ab462c8 (diff) | |
download | linux-9c5753bc708da0c2c544fcfe1e94afb399c2b3f6.tar.xz |
drm/nouveau/disp/nv50-: port OR power state control to nvkm_ior
Also removes the user-facing methods to these controls, as they're not
currently utilised by the DD anyway.
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c index a1327e8fead1..543b6d0ee74c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sornv50.c @@ -22,15 +22,10 @@ * Authors: Ben Skeggs */ #include "ior.h" -#include "nv50.h" #include "outp.h" -#include <core/client.h> #include <subdev/timer.h> -#include <nvif/cl5070.h> -#include <nvif/unpack.h> - static const struct nvkm_output_func nv50_sor_output_func = { }; @@ -43,40 +38,33 @@ nv50_sor_output_new(struct nvkm_disp *disp, int index, index, dcbE, poutp); } -int -nv50_sor_power(NV50_DISP_MTHD_V1) +static void +nv50_sor_power_wait(struct nvkm_device *device, u32 soff) { - struct nvkm_device *device = disp->base.engine.subdev.device; - union { - struct nv50_disp_sor_pwr_v0 v0; - } *args = data; - const u32 soff = outp->or * 0x800; - u32 stat; - int ret = -ENOSYS; - - nvif_ioctl(object, "disp sor pwr size %d\n", size); - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { - nvif_ioctl(object, "disp sor pwr vers %d state %d\n", - args->v0.version, args->v0.state); - stat = !!args->v0.state; - } else - return ret; - - - nvkm_msec(device, 2000, - if (!(nvkm_rd32(device, 0x61c004 + soff) & 0x80000000)) - break; - ); - nvkm_mask(device, 0x61c004 + soff, 0x80000001, 0x80000000 | stat); nvkm_msec(device, 2000, if (!(nvkm_rd32(device, 0x61c004 + soff) & 0x80000000)) break; ); +} + +void +nv50_sor_power(struct nvkm_ior *sor, bool normal, bool pu, + bool data, bool vsync, bool hsync) +{ + struct nvkm_device *device = sor->disp->engine.subdev.device; + const u32 soff = nv50_ior_base(sor); + const u32 shift = normal ? 0 : 16; + const u32 state = 0x80000000 | (0x00000001 * !!pu) << shift; + const u32 field = 0x80000000 | (0x00000001 << shift); + + nv50_sor_power_wait(device, soff); + nvkm_mask(device, 0x61c004 + soff, field, state); + nv50_sor_power_wait(device, soff); + nvkm_msec(device, 2000, if (!(nvkm_rd32(device, 0x61c030 + soff) & 0x10000000)) break; ); - return 0; } void @@ -103,6 +91,7 @@ nv50_sor_state(struct nvkm_ior *sor, struct nvkm_ior_state *state) static const struct nvkm_ior_func nv50_sor = { .state = nv50_sor_state, + .power = nv50_sor_power, }; int |