aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 14:54:20 +1000
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 12:40:43 +1000
commitc5fcafa528463b207108cd606e0d41741fb7dc50 (patch)
tree0211a957a7d0db373d2e3b00df0e40d0b7a1388f /drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c
parentdrm/nouveau/fb: convert to new-style nvkm_subdev (diff)
downloadlinux-dev-c5fcafa528463b207108cd606e0d41741fb7dc50.tar.xz
linux-dev-c5fcafa528463b207108cd606e0d41741fb7dc50.zip
drm/nouveau/fuse: convert to new-style nvkm_subdev
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c52
1 files changed, 11 insertions, 41 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c
index ee76268ae702..514c193db25d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/nv50.c
@@ -23,59 +23,29 @@
*/
#include "priv.h"
-struct nv50_fuse {
- struct nvkm_fuse base;
-
- spinlock_t fuse_enable_lock;
-};
-
static u32
-nv50_fuse_read(struct nvkm_fuse *obj, u32 addr)
+nv50_fuse_read(struct nvkm_fuse *fuse, u32 addr)
{
- struct nv50_fuse *fuse = container_of(obj, typeof(*fuse), base);
- struct nvkm_device *device = fuse->base.subdev.device;
+ struct nvkm_device *device = fuse->subdev.device;
unsigned long flags;
u32 fuse_enable, val;
/* racy if another part of nvkm start writing to this reg */
- spin_lock_irqsave(&fuse->fuse_enable_lock, flags);
- fuse_enable = nvkm_mask(device, 0x1084, 0x800, 0x800);
- val = nvkm_rd32(device, 0x21000 + addr);
- nvkm_wr32(device, 0x1084, fuse_enable);
- spin_unlock_irqrestore(&fuse->fuse_enable_lock, flags);
+ spin_lock_irqsave(&fuse->lock, flags);
+ fuse_enable = nvkm_mask(device, 0x001084, 0x800, 0x800);
+ val = nvkm_rd32(device, 0x021000 + addr);
+ nvkm_wr32(device, 0x001084, fuse_enable);
+ spin_unlock_irqrestore(&fuse->lock, flags);
return val;
}
static const struct nvkm_fuse_func
-nv50_fuse_func = {
+nv50_fuse = {
.read = &nv50_fuse_read,
};
-static int
-nv50_fuse_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
- struct nvkm_oclass *oclass, void *data, u32 size,
- struct nvkm_object **pobject)
+int
+nv50_fuse_new(struct nvkm_device *device, int index, struct nvkm_fuse **pfuse)
{
- struct nv50_fuse *fuse;
- int ret;
-
- ret = nvkm_fuse_create(parent, engine, oclass, &fuse);
- *pobject = nv_object(fuse);
- if (ret)
- return ret;
-
- spin_lock_init(&fuse->fuse_enable_lock);
- fuse->base.func = &nv50_fuse_func;
- return 0;
+ return nvkm_fuse_new_(&nv50_fuse, device, index, pfuse);
}
-
-struct nvkm_oclass
-nv50_fuse_oclass = {
- .handle = NV_SUBDEV(FUSE, 0x50),
- .ofuncs = &(struct nvkm_ofuncs) {
- .ctor = nv50_fuse_ctor,
- .dtor = _nvkm_fuse_dtor,
- .init = _nvkm_fuse_init,
- .fini = _nvkm_fuse_fini,
- },
-};