xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/mcp89.c (revision 03c11eb3b16dc0058589751dfd91f254be2be613)
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 
299a4514fbSBen Skeggs static const struct nvkm_ior_func_dp
309a4514fbSBen Skeggs mcp89_sor_dp = {
31acbe9ecfSBen Skeggs 	.lanes = { 3, 2, 1, 0 },
32acbe9ecfSBen Skeggs 	.links = g94_sor_dp_links,
33acbe9ecfSBen Skeggs 	.power = g94_sor_dp_power,
34acbe9ecfSBen Skeggs 	.pattern = g94_sor_dp_pattern,
35acbe9ecfSBen Skeggs 	.drive = g94_sor_dp_drive,
36acbe9ecfSBen Skeggs 	.audio = gt215_sor_dp_audio,
37acbe9ecfSBen Skeggs 	.audio_sym = g94_sor_dp_audio_sym,
38acbe9ecfSBen Skeggs 	.activesym = g94_sor_dp_activesym,
39acbe9ecfSBen Skeggs 	.watermark = g94_sor_dp_watermark,
409a4514fbSBen Skeggs };
419a4514fbSBen Skeggs 
429a4514fbSBen Skeggs static const struct nvkm_ior_func
439a4514fbSBen Skeggs mcp89_sor = {
449a4514fbSBen Skeggs 	.state = g94_sor_state,
459a4514fbSBen Skeggs 	.power = nv50_sor_power,
469a4514fbSBen Skeggs 	.clock = nv50_sor_clock,
47*2274ce7eSBen Skeggs 	.bl = &gt215_sor_bl,
48f530bc60SBen Skeggs 	.hdmi = &gt215_sor_hdmi,
499a4514fbSBen Skeggs 	.dp = &mcp89_sor_dp,
507bcf89eeSBen Skeggs 	.hda = &gt215_sor_hda,
51acbe9ecfSBen Skeggs };
52acbe9ecfSBen Skeggs 
53acbe9ecfSBen Skeggs static int
mcp89_sor_new(struct nvkm_disp * disp,int id)54acbe9ecfSBen Skeggs mcp89_sor_new(struct nvkm_disp *disp, int id)
55acbe9ecfSBen Skeggs {
5679c453afSBen Skeggs 	return nvkm_ior_new_(&mcp89_sor, disp, SOR, id, true);
57acbe9ecfSBen Skeggs }
58acbe9ecfSBen Skeggs 
590407b33fSBen Skeggs static const struct nvkm_disp_func
60b3c9c022SBen Skeggs mcp89_disp = {
61acbe9ecfSBen Skeggs 	.oneinit = nv50_disp_oneinit,
6292fba5d3SBen Skeggs 	.init = nv50_disp_init,
6392fba5d3SBen Skeggs 	.fini = nv50_disp_fini,
6492fba5d3SBen Skeggs 	.intr = nv50_disp_intr,
65b3c9c022SBen Skeggs 	.super = nv50_disp_super,
6692fba5d3SBen Skeggs 	.uevent = &nv50_disp_chan_uevent,
67f7b2ece3SBen Skeggs 	.head = { .cnt = nv50_head_cnt, .new = nv50_head_new },
68bf5d1a6bSBen Skeggs 	.dac = { .cnt = nv50_dac_cnt, .new = nv50_dac_new },
699fe4e177SBen Skeggs 	.sor = { .cnt = g94_sor_cnt, .new = mcp89_sor_new },
70f5e088d6SBen Skeggs 	.pior = { .cnt = nv50_pior_cnt, .new = nv50_pior_new },
71168c0299SBen Skeggs 	.root = { 0,0,GT214_DISP },
72168c0299SBen Skeggs 	.user = {
73889fcbe9SBen Skeggs 		{{0,0,GT214_DISP_CURSOR             }, nvkm_disp_chan_new, &nv50_disp_curs },
74889fcbe9SBen Skeggs 		{{0,0,GT214_DISP_OVERLAY            }, nvkm_disp_chan_new, &nv50_disp_oimm },
75889fcbe9SBen Skeggs 		{{0,0,GT214_DISP_BASE_CHANNEL_DMA   }, nvkm_disp_chan_new, & g84_disp_base },
76889fcbe9SBen Skeggs 		{{0,0,GT214_DISP_CORE_CHANNEL_DMA   }, nvkm_disp_core_new, & g94_disp_core },
77889fcbe9SBen Skeggs 		{{0,0,GT214_DISP_OVERLAY_CHANNEL_DMA}, nvkm_disp_chan_new, & g84_disp_ovly },
78168c0299SBen Skeggs 		{}
79168c0299SBen Skeggs 	},
80b3c9c022SBen Skeggs };
81b3c9c022SBen Skeggs 
82b3c9c022SBen Skeggs int
mcp89_disp_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_disp ** pdisp)83a7f000ecSBen Skeggs mcp89_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
84a7f000ecSBen Skeggs 	       struct nvkm_disp **pdisp)
85b3c9c022SBen Skeggs {
861c6aab75SBen Skeggs 	return nvkm_disp_new_(&mcp89_disp, device, type, inst, pdisp);
87b3c9c022SBen Skeggs }
88