1 | /* $NetBSD: nouveau_engine_mpeg_nv84.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $ */ |
2 | |
3 | /* |
4 | * Copyright 2012 Red Hat Inc. |
5 | * |
6 | * Permission is hereby granted, free of charge, to any person obtaining a |
7 | * copy of this software and associated documentation files (the "Software"), |
8 | * to deal in the Software without restriction, including without limitation |
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 | * and/or sell copies of the Software, and to permit persons to whom the |
11 | * Software is furnished to do so, subject to the following conditions: |
12 | * |
13 | * The above copyright notice and this permission notice shall be included in |
14 | * all copies or substantial portions of the Software. |
15 | * |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
22 | * OTHER DEALINGS IN THE SOFTWARE. |
23 | * |
24 | * Authors: Ben Skeggs |
25 | */ |
26 | |
27 | #include <sys/cdefs.h> |
28 | __KERNEL_RCSID(0, "$NetBSD: nouveau_engine_mpeg_nv84.c,v 1.1.1.1 2014/08/06 12:36:27 riastradh Exp $" ); |
29 | |
30 | #include <core/os.h> |
31 | #include <core/class.h> |
32 | #include <core/engctx.h> |
33 | |
34 | #include <subdev/vm.h> |
35 | #include <subdev/bar.h> |
36 | #include <subdev/timer.h> |
37 | |
38 | #include <engine/mpeg.h> |
39 | |
40 | struct nv84_mpeg_priv { |
41 | struct nouveau_mpeg base; |
42 | }; |
43 | |
44 | struct nv84_mpeg_chan { |
45 | struct nouveau_mpeg_chan base; |
46 | }; |
47 | |
48 | /******************************************************************************* |
49 | * MPEG object classes |
50 | ******************************************************************************/ |
51 | |
52 | static struct nouveau_oclass |
53 | nv84_mpeg_sclass[] = { |
54 | { 0x8274, &nv50_mpeg_ofuncs }, |
55 | {} |
56 | }; |
57 | |
58 | /******************************************************************************* |
59 | * PMPEG context |
60 | ******************************************************************************/ |
61 | |
62 | static struct nouveau_oclass |
63 | nv84_mpeg_cclass = { |
64 | .handle = NV_ENGCTX(MPEG, 0x84), |
65 | .ofuncs = &(struct nouveau_ofuncs) { |
66 | .ctor = nv50_mpeg_context_ctor, |
67 | .dtor = _nouveau_mpeg_context_dtor, |
68 | .init = _nouveau_mpeg_context_init, |
69 | .fini = _nouveau_mpeg_context_fini, |
70 | .rd32 = _nouveau_mpeg_context_rd32, |
71 | .wr32 = _nouveau_mpeg_context_wr32, |
72 | }, |
73 | }; |
74 | |
75 | /******************************************************************************* |
76 | * PMPEG engine/subdev functions |
77 | ******************************************************************************/ |
78 | |
79 | static int |
80 | nv84_mpeg_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
81 | struct nouveau_oclass *oclass, void *data, u32 size, |
82 | struct nouveau_object **pobject) |
83 | { |
84 | struct nv84_mpeg_priv *priv; |
85 | int ret; |
86 | |
87 | ret = nouveau_mpeg_create(parent, engine, oclass, &priv); |
88 | *pobject = nv_object(priv); |
89 | if (ret) |
90 | return ret; |
91 | |
92 | nv_subdev(priv)->unit = 0x00000002; |
93 | nv_subdev(priv)->intr = nv50_mpeg_intr; |
94 | nv_engine(priv)->cclass = &nv84_mpeg_cclass; |
95 | nv_engine(priv)->sclass = nv84_mpeg_sclass; |
96 | return 0; |
97 | } |
98 | |
99 | struct nouveau_oclass |
100 | nv84_mpeg_oclass = { |
101 | .handle = NV_ENGINE(MPEG, 0x84), |
102 | .ofuncs = &(struct nouveau_ofuncs) { |
103 | .ctor = nv84_mpeg_ctor, |
104 | .dtor = _nouveau_mpeg_dtor, |
105 | .init = nv50_mpeg_init, |
106 | .fini = _nouveau_mpeg_fini, |
107 | }, |
108 | }; |
109 | |