]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk20a.c
drm/nouveau/devinit: convert to new-style nvkm_subdev
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / nouveau / nvkm / subdev / fb / gk20a.c
CommitLineData
fef94f62
AC
1/*
2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
639c308e 22#include "gf100.h"
fef94f62 23
b2c19870 24static int
639c308e 25gk20a_fb_init(struct nvkm_object *object)
b2c19870 26{
b1e4553c 27 struct nvkm_fb *fb = (void *)object;
6758745b 28 struct nvkm_device *device = fb->subdev.device;
b2c19870
AC
29 int ret;
30
b1e4553c 31 ret = nvkm_fb_init(fb);
b2c19870
AC
32 if (ret)
33 return ret;
34
6758745b 35 nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */
b2c19870
AC
36 return 0;
37}
38
fef94f62 39static int
639c308e
BS
40gk20a_fb_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
41 struct nvkm_oclass *oclass, void *data, u32 size,
42 struct nvkm_object **pobject)
fef94f62 43{
b1e4553c 44 struct nvkm_fb *fb;
fef94f62
AC
45 int ret;
46
b1e4553c
BS
47 ret = nvkm_fb_create(parent, engine, oclass, &fb);
48 *pobject = nv_object(fb);
fef94f62
AC
49 if (ret)
50 return ret;
51
52 return 0;
53}
54
639c308e
BS
55struct nvkm_oclass *
56gk20a_fb_oclass = &(struct nvkm_fb_impl) {
fef94f62 57 .base.handle = NV_SUBDEV(FB, 0xea),
639c308e 58 .base.ofuncs = &(struct nvkm_ofuncs) {
fef94f62 59 .ctor = gk20a_fb_ctor,
639c308e 60 .dtor = _nvkm_fb_dtor,
b2c19870 61 .init = gk20a_fb_init,
639c308e 62 .fini = _nvkm_fb_fini,
fef94f62 63 },
639c308e 64 .memtype = gf100_fb_memtype_valid,
fef94f62 65}.base;