1 #ifndef __NV50_DISP_H__
2 #define __NV50_DISP_H__
4 #include <core/parent.h>
5 #include <core/namedb.h>
6 #include <core/engctx.h>
7 #include <core/ramht.h>
8 #include <core/event.h>
10 #include <engine/dmaobj.h>
17 #define NV50_DISP_MTHD_ struct nouveau_object *object, \
18 struct nv50_disp_priv *priv, void *data, u32 size
19 #define NV50_DISP_MTHD_V0 NV50_DISP_MTHD_, int head
20 #define NV50_DISP_MTHD_V1 NV50_DISP_MTHD_, int head, struct nvkm_output *outp
22 struct nv50_disp_priv {
23 struct nouveau_disp base;
24 struct nouveau_oclass *sclass;
26 struct work_struct supervisor;
29 struct nvkm_event uevent;
36 int (*power)(NV50_DISP_MTHD_V1);
37 int (*sense)(NV50_DISP_MTHD_V1);
41 int (*power)(NV50_DISP_MTHD_V1);
42 int (*hda_eld)(NV50_DISP_MTHD_V1);
43 int (*hdmi)(NV50_DISP_MTHD_V1);
45 void (*magic)(struct nvkm_output *);
49 int (*power)(NV50_DISP_MTHD_V1);
54 struct nv50_disp_impl {
55 struct nouveau_disp_impl base;
57 const struct nv50_disp_mthd_chan *core;
58 const struct nv50_disp_mthd_chan *base;
59 const struct nv50_disp_mthd_chan *ovly;
63 int (*scanoutpos)(NV50_DISP_MTHD_V0);
67 int nv50_disp_main_scanoutpos(NV50_DISP_MTHD_V0);
68 int nv50_disp_main_mthd(struct nouveau_object *, u32, void *, u32);
70 int nvd0_disp_main_scanoutpos(NV50_DISP_MTHD_V0);
72 int nv50_dac_power(NV50_DISP_MTHD_V1);
73 int nv50_dac_sense(NV50_DISP_MTHD_V1);
75 int nva3_hda_eld(NV50_DISP_MTHD_V1);
76 int nvd0_hda_eld(NV50_DISP_MTHD_V1);
78 int nv84_hdmi_ctrl(NV50_DISP_MTHD_V1);
79 int nva3_hdmi_ctrl(NV50_DISP_MTHD_V1);
80 int nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1);
81 int nve0_hdmi_ctrl(NV50_DISP_MTHD_V1);
83 int nv50_sor_power(NV50_DISP_MTHD_V1);
85 int nv94_sor_dp_train_init(struct nv50_disp_priv *, int, int, int, u16, u16,
86 u32, struct dcb_output *);
87 int nv94_sor_dp_train_fini(struct nv50_disp_priv *, int, int, int, u16, u16,
88 u32, struct dcb_output *);
89 int nv94_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
91 int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
93 int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
96 int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
98 int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
100 int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
101 struct dcb_output *);
103 int nv50_pior_power(NV50_DISP_MTHD_V1);
105 struct nv50_disp_base {
106 struct nouveau_parent base;
107 struct nouveau_ramht *ramht;
111 struct nv50_disp_chan_impl {
112 struct nouveau_ofuncs base;
114 int (*attach)(struct nouveau_object *, struct nouveau_object *, u32);
115 void (*detach)(struct nouveau_object *, int);
118 struct nv50_disp_chan {
119 struct nouveau_namedb base;
123 int nv50_disp_chan_ntfy(struct nouveau_object *, u32, struct nvkm_event **);
124 int nv50_disp_chan_map(struct nouveau_object *, u64 *, u32 *);
125 u32 nv50_disp_chan_rd32(struct nouveau_object *, u64);
126 void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32);
127 extern const struct nvkm_event_func nv50_disp_chan_uevent;
128 int nv50_disp_chan_uevent_ctor(struct nouveau_object *, void *, u32,
129 struct nvkm_notify *);
130 void nv50_disp_chan_uevent_send(struct nv50_disp_priv *, int);
132 extern const struct nvkm_event_func nvd0_disp_chan_uevent;
134 #define nv50_disp_chan_init(a) \
135 nouveau_namedb_init(&(a)->base)
136 #define nv50_disp_chan_fini(a,b) \
137 nouveau_namedb_fini(&(a)->base, (b))
139 struct nv50_disp_dmac {
140 struct nv50_disp_chan base;
141 struct nouveau_dmaobj *pushdma;
145 void nv50_disp_dmac_dtor(struct nouveau_object *);
147 struct nv50_disp_pioc {
148 struct nv50_disp_chan base;
151 void nv50_disp_pioc_dtor(struct nouveau_object *);
153 struct nv50_disp_mthd_list {
163 struct nv50_disp_mthd_chan {
169 const struct nv50_disp_mthd_list *mthd;
173 extern struct nv50_disp_chan_impl nv50_disp_core_ofuncs;
174 int nv50_disp_core_ctor(struct nouveau_object *, struct nouveau_object *,
175 struct nouveau_oclass *, void *, u32,
176 struct nouveau_object **);
177 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_base;
178 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_sor;
179 extern const struct nv50_disp_mthd_list nv50_disp_core_mthd_pior;
180 extern struct nv50_disp_chan_impl nv50_disp_base_ofuncs;
181 int nv50_disp_base_ctor(struct nouveau_object *, struct nouveau_object *,
182 struct nouveau_oclass *, void *, u32,
183 struct nouveau_object **);
184 extern const struct nv50_disp_mthd_list nv50_disp_base_mthd_image;
185 extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs;
186 int nv50_disp_ovly_ctor(struct nouveau_object *, struct nouveau_object *,
187 struct nouveau_oclass *, void *, u32,
188 struct nouveau_object **);
189 extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base;
190 extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs;
191 int nv50_disp_oimm_ctor(struct nouveau_object *, struct nouveau_object *,
192 struct nouveau_oclass *, void *, u32,
193 struct nouveau_object **);
194 extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs;
195 int nv50_disp_curs_ctor(struct nouveau_object *, struct nouveau_object *,
196 struct nouveau_oclass *, void *, u32,
197 struct nouveau_object **);
198 extern struct nouveau_ofuncs nv50_disp_main_ofuncs;
199 int nv50_disp_main_ctor(struct nouveau_object *, struct nouveau_object *,
200 struct nouveau_oclass *, void *, u32,
201 struct nouveau_object **);
202 void nv50_disp_main_dtor(struct nouveau_object *);
203 extern struct nouveau_omthds nv50_disp_main_omthds[];
204 extern struct nouveau_oclass nv50_disp_cclass;
205 void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head,
206 const struct nv50_disp_mthd_chan *);
207 void nv50_disp_intr_supervisor(struct work_struct *);
208 void nv50_disp_intr(struct nouveau_subdev *);
209 extern const struct nvkm_event_func nv50_disp_vblank_func;
211 extern const struct nv50_disp_mthd_chan nv84_disp_core_mthd_chan;
212 extern const struct nv50_disp_mthd_list nv84_disp_core_mthd_dac;
213 extern const struct nv50_disp_mthd_list nv84_disp_core_mthd_head;
214 extern const struct nv50_disp_mthd_chan nv84_disp_base_mthd_chan;
215 extern const struct nv50_disp_mthd_chan nv84_disp_ovly_mthd_chan;
217 extern const struct nv50_disp_mthd_chan nv94_disp_core_mthd_chan;
219 extern struct nv50_disp_chan_impl nvd0_disp_core_ofuncs;
220 extern const struct nv50_disp_mthd_list nvd0_disp_core_mthd_base;
221 extern const struct nv50_disp_mthd_list nvd0_disp_core_mthd_dac;
222 extern const struct nv50_disp_mthd_list nvd0_disp_core_mthd_sor;
223 extern const struct nv50_disp_mthd_list nvd0_disp_core_mthd_pior;
224 extern struct nv50_disp_chan_impl nvd0_disp_base_ofuncs;
225 extern struct nv50_disp_chan_impl nvd0_disp_ovly_ofuncs;
226 extern const struct nv50_disp_mthd_chan nvd0_disp_base_mthd_chan;
227 extern struct nv50_disp_chan_impl nvd0_disp_oimm_ofuncs;
228 extern struct nv50_disp_chan_impl nvd0_disp_curs_ofuncs;
229 extern struct nouveau_ofuncs nvd0_disp_main_ofuncs;
230 extern struct nouveau_oclass nvd0_disp_cclass;
231 void nvd0_disp_intr_supervisor(struct work_struct *);
232 void nvd0_disp_intr(struct nouveau_subdev *);
233 extern const struct nvkm_event_func nvd0_disp_vblank_func;
235 extern const struct nv50_disp_mthd_chan nve0_disp_core_mthd_chan;
236 extern const struct nv50_disp_mthd_chan nve0_disp_ovly_mthd_chan;
238 extern struct nvkm_output_dp_impl nv50_pior_dp_impl;
239 extern struct nouveau_oclass *nv50_disp_outp_sclass[];
241 extern struct nvkm_output_dp_impl nv94_sor_dp_impl;
242 int nv94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int);
243 extern struct nouveau_oclass *nv94_disp_outp_sclass[];
245 extern struct nvkm_output_dp_impl nvd0_sor_dp_impl;
246 int nvd0_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool);
247 extern struct nouveau_oclass *nvd0_disp_outp_sclass[];
249 void gm204_sor_magic(struct nvkm_output *outp);
250 extern struct nvkm_output_dp_impl gm204_sor_dp_impl;