UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/
[linux-2.6-block.git] / drivers / gpu / drm / nouveau / nv84_vp.c
CommitLineData
8f27c543
BS
1/*
2 * Copyright 2011 Red Hat Inc.
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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24
760285e7 25#include <drm/drmP.h>
8f27c543
BS
26#include "nouveau_drv.h"
27#include "nouveau_util.h"
28#include "nouveau_vm.h"
29#include "nouveau_ramht.h"
30
31/*XXX: This stub is currently used on NV98+ also, as soon as this becomes
32 * more than just an enable/disable stub this needs to be split out to
33 * nv98_vp.c...
34 */
35
36struct nv84_vp_engine {
37 struct nouveau_exec_engine base;
38};
39
40static int
41nv84_vp_fini(struct drm_device *dev, int engine, bool suspend)
42{
43 if (!(nv_rd32(dev, 0x000200) & 0x00020000))
44 return 0;
45
46 nv_mask(dev, 0x000200, 0x00020000, 0x00000000);
47 return 0;
48}
49
50static int
51nv84_vp_init(struct drm_device *dev, int engine)
52{
53 nv_mask(dev, 0x000200, 0x00020000, 0x00000000);
54 nv_mask(dev, 0x000200, 0x00020000, 0x00020000);
55 return 0;
56}
57
58static void
59nv84_vp_destroy(struct drm_device *dev, int engine)
60{
61 struct nv84_vp_engine *pvp = nv_engine(dev, engine);
62
63 NVOBJ_ENGINE_DEL(dev, VP);
64
65 kfree(pvp);
66}
67
68int
69nv84_vp_create(struct drm_device *dev)
70{
71 struct nv84_vp_engine *pvp;
72
73 pvp = kzalloc(sizeof(*pvp), GFP_KERNEL);
74 if (!pvp)
75 return -ENOMEM;
76
77 pvp->base.destroy = nv84_vp_destroy;
78 pvp->base.init = nv84_vp_init;
79 pvp->base.fini = nv84_vp_fini;
80
81 NVOBJ_ENGINE_ADD(dev, VP, &pvp->base);
82 return 0;
83}