xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/ad102.c (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1*9e994444SBen Skeggs /*
2*9e994444SBen Skeggs  * Copyright 2023 Red Hat Inc.
3*9e994444SBen Skeggs  *
4*9e994444SBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5*9e994444SBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6*9e994444SBen Skeggs  * to deal in the Software without restriction, including without limitation
7*9e994444SBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*9e994444SBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9*9e994444SBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10*9e994444SBen Skeggs  *
11*9e994444SBen Skeggs  * The above copyright notice and this permission notice shall be included in
12*9e994444SBen Skeggs  * all copies or substantial portions of the Software.
13*9e994444SBen Skeggs  *
14*9e994444SBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*9e994444SBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*9e994444SBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*9e994444SBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*9e994444SBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*9e994444SBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*9e994444SBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21*9e994444SBen Skeggs  */
22*9e994444SBen Skeggs #include "priv.h"
23*9e994444SBen Skeggs #include "chan.h"
24*9e994444SBen Skeggs 
25*9e994444SBen Skeggs #include <subdev/gsp.h>
26*9e994444SBen Skeggs 
27*9e994444SBen Skeggs #include <nvif/class.h>
28*9e994444SBen Skeggs 
29*9e994444SBen Skeggs static const struct nvkm_disp_func
30*9e994444SBen Skeggs ad102_disp = {
31*9e994444SBen Skeggs 	.uevent = &gv100_disp_chan_uevent,
32*9e994444SBen Skeggs 	.ramht_size = 0x2000,
33*9e994444SBen Skeggs 	.root = {  0, 0,AD102_DISP },
34*9e994444SBen Skeggs 	.user = {
35*9e994444SBen Skeggs 		{{-1,-1,GV100_DISP_CAPS                  }, gv100_disp_caps_new },
36*9e994444SBen Skeggs 		{{ 0, 0,GA102_DISP_CURSOR                }, nvkm_disp_chan_new, &gv100_disp_curs },
37*9e994444SBen Skeggs 		{{ 0, 0,GA102_DISP_WINDOW_IMM_CHANNEL_DMA}, nvkm_disp_wndw_new, &gv100_disp_wimm },
38*9e994444SBen Skeggs 		{{ 0, 0,AD102_DISP_CORE_CHANNEL_DMA      }, nvkm_disp_core_new, &gv100_disp_core },
39*9e994444SBen Skeggs 		{{ 0, 0,GA102_DISP_WINDOW_CHANNEL_DMA    }, nvkm_disp_wndw_new, &gv100_disp_wndw },
40*9e994444SBen Skeggs 		{}
41*9e994444SBen Skeggs 	},
42*9e994444SBen Skeggs };
43*9e994444SBen Skeggs 
44*9e994444SBen Skeggs int
ad102_disp_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_disp ** pdisp)45*9e994444SBen Skeggs ad102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
46*9e994444SBen Skeggs 	       struct nvkm_disp **pdisp)
47*9e994444SBen Skeggs {
48*9e994444SBen Skeggs 	if (nvkm_gsp_rm(device->gsp))
49*9e994444SBen Skeggs 		return r535_disp_new(&ad102_disp, device, type, inst, pdisp);
50*9e994444SBen Skeggs 
51*9e994444SBen Skeggs 	return -ENODEV;
52*9e994444SBen Skeggs }
53