1*08ab88f5SBen Skeggs /*
2*08ab88f5SBen Skeggs * Copyright 2023 Red Hat Inc.
3*08ab88f5SBen Skeggs *
4*08ab88f5SBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining a
5*08ab88f5SBen Skeggs * copy of this software and associated documentation files (the "Software"),
6*08ab88f5SBen Skeggs * to deal in the Software without restriction, including without limitation
7*08ab88f5SBen Skeggs * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*08ab88f5SBen Skeggs * and/or sell copies of the Software, and to permit persons to whom the
9*08ab88f5SBen Skeggs * Software is furnished to do so, subject to the following conditions:
10*08ab88f5SBen Skeggs *
11*08ab88f5SBen Skeggs * The above copyright notice and this permission notice shall be included in
12*08ab88f5SBen Skeggs * all copies or substantial portions of the Software.
13*08ab88f5SBen Skeggs *
14*08ab88f5SBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*08ab88f5SBen Skeggs * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*08ab88f5SBen Skeggs * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17*08ab88f5SBen Skeggs * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*08ab88f5SBen Skeggs * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*08ab88f5SBen Skeggs * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*08ab88f5SBen Skeggs * OTHER DEALINGS IN THE SOFTWARE.
21*08ab88f5SBen Skeggs */
22*08ab88f5SBen Skeggs #include "priv.h"
23*08ab88f5SBen Skeggs
24*08ab88f5SBen Skeggs #include <subdev/gsp.h>
25*08ab88f5SBen Skeggs
26*08ab88f5SBen Skeggs #include <nvif/class.h>
27*08ab88f5SBen Skeggs
28*08ab88f5SBen Skeggs static const struct nvkm_engine_func
29*08ab88f5SBen Skeggs ad102_nvenc = {
30*08ab88f5SBen Skeggs .sclass = {
31*08ab88f5SBen Skeggs { -1, -1, NVC9B7_VIDEO_ENCODER },
32*08ab88f5SBen Skeggs {}
33*08ab88f5SBen Skeggs }
34*08ab88f5SBen Skeggs };
35*08ab88f5SBen Skeggs
36*08ab88f5SBen Skeggs int
ad102_nvenc_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_nvenc ** pnvenc)37*08ab88f5SBen Skeggs ad102_nvenc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
38*08ab88f5SBen Skeggs struct nvkm_nvenc **pnvenc)
39*08ab88f5SBen Skeggs {
40*08ab88f5SBen Skeggs if (nvkm_gsp_rm(device->gsp))
41*08ab88f5SBen Skeggs return r535_nvenc_new(&ad102_nvenc, device, type, inst, pnvenc);
42*08ab88f5SBen Skeggs
43*08ab88f5SBen Skeggs return -ENODEV;
44*08ab88f5SBen Skeggs }
45