xref: /openbmc/linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp77.c (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
1b3c9c022SBen Skeggs /*
2b3c9c022SBen Skeggs  * Copyright 2017 Red Hat Inc.
3b3c9c022SBen Skeggs  *
4b3c9c022SBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5b3c9c022SBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6b3c9c022SBen Skeggs  * to deal in the Software without restriction, including without limitation
7b3c9c022SBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b3c9c022SBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9b3c9c022SBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10b3c9c022SBen Skeggs  *
11b3c9c022SBen Skeggs  * The above copyright notice and this permission notice shall be included in
12b3c9c022SBen Skeggs  * all copies or substantial portions of the Software.
13b3c9c022SBen Skeggs  *
14b3c9c022SBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15b3c9c022SBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16b3c9c022SBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17b3c9c022SBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18b3c9c022SBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19b3c9c022SBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20b3c9c022SBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21b3c9c022SBen Skeggs  */
2292fba5d3SBen Skeggs #include "priv.h"
23acbe9ecfSBen Skeggs #include "chan.h"
24b3c9c022SBen Skeggs #include "head.h"
25b3c9c022SBen Skeggs #include "ior.h"
26168c0299SBen Skeggs 
27168c0299SBen Skeggs #include <nvif/class.h>
28b3c9c022SBen Skeggs 
29acbe9ecfSBen Skeggs static const struct nvkm_ior_func
30acbe9ecfSBen Skeggs mcp77_sor = {
31acbe9ecfSBen Skeggs 	.state = g94_sor_state,
32acbe9ecfSBen Skeggs 	.power = nv50_sor_power,
33acbe9ecfSBen Skeggs 	.clock = nv50_sor_clock,
34*f530bc60SBen Skeggs 	.hdmi = &g84_sor_hdmi,
359a4514fbSBen Skeggs 	.dp = &g94_sor_dp,
36acbe9ecfSBen Skeggs };
37acbe9ecfSBen Skeggs 
38acbe9ecfSBen Skeggs static int
mcp77_sor_new(struct nvkm_disp * disp,int id)39acbe9ecfSBen Skeggs mcp77_sor_new(struct nvkm_disp *disp, int id)
40acbe9ecfSBen Skeggs {
4179c453afSBen Skeggs 	return nvkm_ior_new_(&mcp77_sor, disp, SOR, id, false);
42acbe9ecfSBen Skeggs }
43acbe9ecfSBen Skeggs 
440407b33fSBen Skeggs static const struct nvkm_disp_func
45b3c9c022SBen Skeggs mcp77_disp = {
46acbe9ecfSBen Skeggs 	.oneinit = nv50_disp_oneinit,
4792fba5d3SBen Skeggs 	.init = nv50_disp_init,
4892fba5d3SBen Skeggs 	.fini = nv50_disp_fini,
4992fba5d3SBen Skeggs 	.intr = nv50_disp_intr,
50b3c9c022SBen Skeggs 	.super = nv50_disp_super,
5192fba5d3SBen Skeggs 	.uevent = &nv50_disp_chan_uevent,
52f7b2ece3SBen Skeggs 	.head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
53bf5d1a6bSBen Skeggs 	.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
549fe4e177SBen Skeggs 	.sor = { .cnt = g94_sor_cnt, .new = mcp77_sor_new },
55f5e088d6SBen Skeggs 	.pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
56168c0299SBen Skeggs 	.root = { 0,0,GT206_DISP },
57168c0299SBen Skeggs 	.user = {
58889fcbe9SBen Skeggs 		{{0,0,  G82_DISP_CURSOR             }, nvkm_disp_chan_new, & nv50_disp_curs },
59889fcbe9SBen Skeggs 		{{0,0,  G82_DISP_OVERLAY            }, nvkm_disp_chan_new, & nv50_disp_oimm },
60889fcbe9SBen Skeggs 		{{0,0,GT200_DISP_BASE_CHANNEL_DMA   }, nvkm_disp_chan_new, &  g84_disp_base },
61889fcbe9SBen Skeggs 		{{0,0,GT206_DISP_CORE_CHANNEL_DMA   }, nvkm_disp_core_new, &  g94_disp_core },
62889fcbe9SBen Skeggs 		{{0,0,GT200_DISP_OVERLAY_CHANNEL_DMA}, nvkm_disp_chan_new, &gt200_disp_ovly },
63168c0299SBen Skeggs 		{}
64168c0299SBen Skeggs 	},
65b3c9c022SBen Skeggs };
66b3c9c022SBen Skeggs 
67b3c9c022SBen Skeggs int
mcp77_disp_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_disp ** pdisp)68a7f000ecSBen Skeggs mcp77_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
69a7f000ecSBen Skeggs 	       struct nvkm_disp **pdisp)
70b3c9c022SBen Skeggs {
711c6aab75SBen Skeggs 	return nvkm_disp_new_(&mcp77_disp, device, type, inst, pdisp);
72b3c9c022SBen Skeggs }
73