Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nv84.c
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 
25 #include <core/os.h>
26 #include <core/class.h>
27 #include <core/engctx.h>
28 
29 #include <subdev/vm.h>
30 #include <subdev/bar.h>
31 #include <subdev/timer.h>
32 
33 #include <engine/mpeg.h>
34 
37 };
38 
41 };
42 
43 /*******************************************************************************
44  * MPEG object classes
45  ******************************************************************************/
46 
47 static struct nouveau_oclass
48 nv84_mpeg_sclass[] = {
49  { 0x8274, &nv50_mpeg_ofuncs },
50  {}
51 };
52 
53 /*******************************************************************************
54  * PMPEG context
55  ******************************************************************************/
56 
57 static struct nouveau_oclass
58 nv84_mpeg_cclass = {
59  .handle = NV_ENGCTX(MPEG, 0x84),
60  .ofuncs = &(struct nouveau_ofuncs) {
61  .ctor = nv50_mpeg_context_ctor,
67  },
68 };
69 
70 /*******************************************************************************
71  * PMPEG engine/subdev functions
72  ******************************************************************************/
73 
74 static int
75 nv84_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
76  struct nouveau_oclass *oclass, void *data, u32 size,
77  struct nouveau_object **pobject)
78 {
79  struct nv84_mpeg_priv *priv;
80  int ret;
81 
82  ret = nouveau_mpeg_create(parent, engine, oclass, &priv);
83  *pobject = nv_object(priv);
84  if (ret)
85  return ret;
86 
87  nv_subdev(priv)->unit = 0x00000002;
88  nv_subdev(priv)->intr = nv50_mpeg_intr;
89  nv_engine(priv)->cclass = &nv84_mpeg_cclass;
90  nv_engine(priv)->sclass = nv84_mpeg_sclass;
91  nv_engine(priv)->tlb_flush = nv50_mpeg_tlb_flush;
92  return 0;
93 }
94 
95 struct nouveau_oclass
97  .handle = NV_ENGINE(MPEG, 0x84),
98  .ofuncs = &(struct nouveau_ofuncs) {
99  .ctor = nv84_mpeg_ctor,
100  .dtor = _nouveau_mpeg_dtor,
101  .init = nv50_mpeg_init,
102  .fini = _nouveau_mpeg_fini,
103  },
104 };