1#ifndef __NV50_DISP_H__
2#define __NV50_DISP_H__
3#include "priv.h"
4struct nvkm_output;
5struct nvkm_output_dp;
6
7#define NV50_DISP_MTHD_ struct nvkm_object *object,                            \
8	struct nv50_disp_priv *priv, void *data, u32 size
9#define NV50_DISP_MTHD_V0 NV50_DISP_MTHD_, int head
10#define NV50_DISP_MTHD_V1 NV50_DISP_MTHD_, int head, struct nvkm_output *outp
11
12struct nv50_disp_priv {
13	struct nvkm_disp base;
14	struct nvkm_oclass *sclass;
15
16	struct work_struct supervisor;
17	u32 super;
18
19	struct nvkm_event uevent;
20
21	struct {
22		int nr;
23	} head;
24	struct {
25		int nr;
26		int (*power)(NV50_DISP_MTHD_V1);
27		int (*sense)(NV50_DISP_MTHD_V1);
28	} dac;
29	struct {
30		int nr;
31		int (*power)(NV50_DISP_MTHD_V1);
32		int (*hda_eld)(NV50_DISP_MTHD_V1);
33		int (*hdmi)(NV50_DISP_MTHD_V1);
34		u32 lvdsconf;
35		void (*magic)(struct nvkm_output *);
36	} sor;
37	struct {
38		int nr;
39		int (*power)(NV50_DISP_MTHD_V1);
40		u8 type[3];
41	} pior;
42};
43
44struct nv50_disp_impl {
45	struct nvkm_disp_impl base;
46	struct {
47		const struct nv50_disp_mthd_chan *core;
48		const struct nv50_disp_mthd_chan *base;
49		const struct nv50_disp_mthd_chan *ovly;
50		int prev;
51	} mthd;
52	struct {
53		int (*scanoutpos)(NV50_DISP_MTHD_V0);
54	} head;
55};
56
57int nv50_disp_main_scanoutpos(NV50_DISP_MTHD_V0);
58int nv50_disp_main_mthd(struct nvkm_object *, u32, void *, u32);
59
60int gf110_disp_main_scanoutpos(NV50_DISP_MTHD_V0);
61
62int nv50_dac_power(NV50_DISP_MTHD_V1);
63int nv50_dac_sense(NV50_DISP_MTHD_V1);
64
65int gt215_hda_eld(NV50_DISP_MTHD_V1);
66int gf110_hda_eld(NV50_DISP_MTHD_V1);
67
68int g84_hdmi_ctrl(NV50_DISP_MTHD_V1);
69int gt215_hdmi_ctrl(NV50_DISP_MTHD_V1);
70int gf110_hdmi_ctrl(NV50_DISP_MTHD_V1);
71int gk104_hdmi_ctrl(NV50_DISP_MTHD_V1);
72
73int nv50_sor_power(NV50_DISP_MTHD_V1);
74int nv50_pior_power(NV50_DISP_MTHD_V1);
75
76#include <core/parent.h>
77
78struct nv50_disp_base {
79	struct nvkm_parent base;
80	struct nvkm_ramht *ramht;
81	u32 chan;
82};
83
84struct nv50_disp_chan_impl {
85	struct nvkm_ofuncs base;
86	int chid;
87	int  (*attach)(struct nvkm_object *, struct nvkm_object *, u32);
88	void (*detach)(struct nvkm_object *, int);
89};
90
91#include <core/namedb.h>
92
93struct nv50_disp_chan {
94	struct nvkm_namedb base;
95	int chid;
96};
97
98int  nv50_disp_chan_ntfy(struct nvkm_object *, u32, struct nvkm_event **);
99int  nv50_disp_chan_map(struct nvkm_object *, u64 *, u32 *);
100u32  nv50_disp_chan_rd32(struct nvkm_object *, u64);
101void nv50_disp_chan_wr32(struct nvkm_object *, u64, u32);
102extern const struct nvkm_event_func nv50_disp_chan_uevent;
103int  nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32,
104				struct nvkm_notify *);
105void nv50_disp_chan_uevent_send(struct nv50_disp_priv *, int);
106
107extern const struct nvkm_event_func gf110_disp_chan_uevent;
108
109#define nv50_disp_chan_init(a)                                                 \
110	nvkm_namedb_init(&(a)->base)
111#define nv50_disp_chan_fini(a,b)                                               \
112	nvkm_namedb_fini(&(a)->base, (b))
113
114struct nv50_disp_dmac {
115	struct nv50_disp_chan base;
116	struct nvkm_dmaobj *pushdma;
117	u32 push;
118};
119
120void nv50_disp_dmac_dtor(struct nvkm_object *);
121
122struct nv50_disp_pioc {
123	struct nv50_disp_chan base;
124};
125
126void nv50_disp_pioc_dtor(struct nvkm_object *);
127
128struct nv50_disp_mthd_list {
129	u32 mthd;
130	u32 addr;
131	struct {
132		u32 mthd;
133		u32 addr;
134		const char *name;
135	} data[];
136};
137
138struct nv50_disp_mthd_chan {
139	const char *name;
140	u32 addr;
141	struct {
142		const char *name;
143		int nr;
144		const struct nv50_disp_mthd_list *mthd;
145	} data[];
146};
147
148extern struct nv50_disp_chan_impl nv50_disp_core_ofuncs;
149int nv50_disp_core_ctor(struct nvkm_object *, struct nvkm_object *,
150			struct nvkm_oclass *, void *, u32,
151			struct nvkm_object **);
152extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base;
153extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor;
154extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior;
155extern struct nv50_disp_chan_impl nv50_disp_base_ofuncs;
156int nv50_disp_base_ctor(struct nvkm_object *, struct nvkm_object *,
157			struct nvkm_oclass *, void *, u32,
158			struct nvkm_object **);
159extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image;
160extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs;
161int nv50_disp_ovly_ctor(struct nvkm_object *, struct nvkm_object *,
162			struct nvkm_oclass *, void *, u32,
163			struct nvkm_object **);
164extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base;
165extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs;
166int nv50_disp_oimm_ctor(struct nvkm_object *, struct nvkm_object *,
167			struct nvkm_oclass *, void *, u32,
168			struct nvkm_object **);
169extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs;
170int nv50_disp_curs_ctor(struct nvkm_object *, struct nvkm_object *,
171			struct nvkm_oclass *, void *, u32,
172			struct nvkm_object **);
173extern struct nvkm_ofuncs nv50_disp_main_ofuncs;
174int  nv50_disp_main_ctor(struct nvkm_object *, struct nvkm_object *,
175			 struct nvkm_oclass *, void *, u32,
176			 struct nvkm_object **);
177void nv50_disp_main_dtor(struct nvkm_object *);
178extern struct nvkm_omthds nv50_disp_main_omthds[];
179extern struct nvkm_oclass nv50_disp_cclass;
180void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head,
181			 const struct nv50_disp_mthd_chan *);
182void nv50_disp_intr_supervisor(struct work_struct *);
183void nv50_disp_intr(struct nvkm_subdev *);
184extern const struct nvkm_event_func nv50_disp_vblank_func;
185
186extern const struct nv50_disp_mthd_chan g84_disp_core_mthd_chan;
187extern const struct nv50_disp_mthd_list g84_disp_core_mthd_dac;
188extern const struct nv50_disp_mthd_list g84_disp_core_mthd_head;
189extern const struct nv50_disp_mthd_chan g84_disp_base_mthd_chan;
190extern const struct nv50_disp_mthd_chan g84_disp_ovly_mthd_chan;
191
192extern const struct nv50_disp_mthd_chan g94_disp_core_mthd_chan;
193
194extern struct nv50_disp_chan_impl gf110_disp_core_ofuncs;
195extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_base;
196extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_dac;
197extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_sor;
198extern const struct nv50_disp_mthd_list gf110_disp_core_mthd_pior;
199extern struct nv50_disp_chan_impl gf110_disp_base_ofuncs;
200extern struct nv50_disp_chan_impl gf110_disp_ovly_ofuncs;
201extern const struct nv50_disp_mthd_chan gf110_disp_base_mthd_chan;
202extern struct nv50_disp_chan_impl gf110_disp_oimm_ofuncs;
203extern struct nv50_disp_chan_impl gf110_disp_curs_ofuncs;
204extern struct nvkm_ofuncs gf110_disp_main_ofuncs;
205extern struct nvkm_oclass gf110_disp_cclass;
206void gf110_disp_intr_supervisor(struct work_struct *);
207void gf110_disp_intr(struct nvkm_subdev *);
208extern const struct nvkm_event_func gf110_disp_vblank_func;
209
210extern const struct nv50_disp_mthd_chan gk104_disp_core_mthd_chan;
211extern const struct nv50_disp_mthd_chan gk104_disp_ovly_mthd_chan;
212
213extern struct nvkm_output_dp_impl nv50_pior_dp_impl;
214extern struct nvkm_oclass *nv50_disp_outp_sclass[];
215
216extern struct nvkm_output_dp_impl g94_sor_dp_impl;
217int g94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int);
218extern struct nvkm_oclass *g94_disp_outp_sclass[];
219
220extern struct nvkm_output_dp_impl gf110_sor_dp_impl;
221int gf110_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool);
222extern struct nvkm_oclass *gf110_disp_outp_sclass[];
223
224void gm204_sor_magic(struct nvkm_output *outp);
225extern struct nvkm_output_dp_impl gm204_sor_dp_impl;
226#endif
227