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);
48 int (*power)(NV50_DISP_MTHD_V1);
53 struct nv50_disp_impl {
54 struct nouveau_disp_impl base;
56 const struct nv50_disp_mthd_chan *core;
57 const struct nv50_disp_mthd_chan *base;
58 const struct nv50_disp_mthd_chan *ovly;
62 int (*scanoutpos)(NV50_DISP_MTHD_V0);
66 int nv50_disp_base_scanoutpos(NV50_DISP_MTHD_V0);
67 int nv50_disp_base_mthd(struct nouveau_object *, u32, void *, u32);
69 int nvd0_disp_base_scanoutpos(NV50_DISP_MTHD_V0);
71 int nv50_dac_power(NV50_DISP_MTHD_V1);
72 int nv50_dac_sense(NV50_DISP_MTHD_V1);
74 int nva3_hda_eld(NV50_DISP_MTHD_V1);
75 int nvd0_hda_eld(NV50_DISP_MTHD_V1);
77 int nv84_hdmi_ctrl(NV50_DISP_MTHD_V1);
78 int nva3_hdmi_ctrl(NV50_DISP_MTHD_V1);
79 int nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1);
81 int nv50_sor_power(NV50_DISP_MTHD_V1);
83 int nv94_sor_dp_train_init(struct nv50_disp_priv *, int, int, int, u16, u16,
84 u32, struct dcb_output *);
85 int nv94_sor_dp_train_fini(struct nv50_disp_priv *, int, int, int, u16, u16,
86 u32, struct dcb_output *);
87 int nv94_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
89 int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
91 int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
94 int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
96 int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
98 int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
101 int nv50_pior_power(NV50_DISP_MTHD_V1);
103 struct nv50_disp_base {
104 struct nouveau_parent base;
105 struct nouveau_ramht *ramht;
109 struct nv50_disp_chan_impl {
110 struct nouveau_ofuncs base;
112 int (*attach)(struct nouveau_object *, struct nouveau_object *, u32);
113 void (*detach)(struct nouveau_object *, int);
116 struct nv50_disp_chan {
117 struct nouveau_namedb base;
121 int nv50_disp_chan_ntfy(struct nouveau_object *, u32, struct nvkm_event **);
122 int nv50_disp_chan_map(struct nouveau_object *, u64 *, u32 *);
123 u32 nv50_disp_chan_rd32(struct nouveau_object *, u64);
124 void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32);
125 extern const struct nvkm_event_func nv50_disp_chan_uevent;
126 int nv50_disp_chan_uevent_ctor(struct nouveau_object *, void *, u32,
127 struct nvkm_notify *);
128 void nv50_disp_chan_uevent_send(struct nv50_disp_priv *, int);
130 extern const struct nvkm_event_func nvd0_disp_chan_uevent;
132 #define nv50_disp_chan_init(a) \
133 nouveau_namedb_init(&(a)->base)
134 #define nv50_disp_chan_fini(a,b) \
135 nouveau_namedb_fini(&(a)->base, (b))
137 struct nv50_disp_dmac {
138 struct nv50_disp_chan base;
139 struct nouveau_dmaobj *pushdma;
143 void nv50_disp_dmac_dtor(struct nouveau_object *);
145 struct nv50_disp_pioc {
146 struct nv50_disp_chan base;
149 void nv50_disp_pioc_dtor(struct nouveau_object *);
151 struct nv50_disp_mthd_list {
161 struct nv50_disp_mthd_chan {
167 const struct nv50_disp_mthd_list *mthd;
171 extern struct nv50_disp_chan_impl nv50_disp_mast_ofuncs;
172 int nv50_disp_mast_ctor(struct nouveau_object *, struct nouveau_object *,
173 struct nouveau_oclass *, void *, u32,
174 struct nouveau_object **);
175 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_base;
176 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_sor;
177 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_pior;
178 extern struct nv50_disp_chan_impl nv50_disp_sync_ofuncs;
179 int nv50_disp_sync_ctor(struct nouveau_object *, struct nouveau_object *,
180 struct nouveau_oclass *, void *, u32,
181 struct nouveau_object **);
182 extern const struct nv50_disp_mthd_list nv50_disp_sync_mthd_image;
183 extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs;
184 int nv50_disp_ovly_ctor(struct nouveau_object *, struct nouveau_object *,
185 struct nouveau_oclass *, void *, u32,
186 struct nouveau_object **);
187 extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base;
188 extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs;
189 int nv50_disp_oimm_ctor(struct nouveau_object *, struct nouveau_object *,
190 struct nouveau_oclass *, void *, u32,
191 struct nouveau_object **);
192 extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs;
193 int nv50_disp_curs_ctor(struct nouveau_object *, struct nouveau_object *,
194 struct nouveau_oclass *, void *, u32,
195 struct nouveau_object **);
196 extern struct nouveau_ofuncs nv50_disp_base_ofuncs;
197 int nv50_disp_base_ctor(struct nouveau_object *, struct nouveau_object *,
198 struct nouveau_oclass *, void *, u32,
199 struct nouveau_object **);
200 void nv50_disp_base_dtor(struct nouveau_object *);
201 extern struct nouveau_omthds nv50_disp_base_omthds[];
202 extern struct nouveau_oclass nv50_disp_cclass;
203 void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head,
204 const struct nv50_disp_mthd_chan *);
205 void nv50_disp_intr_supervisor(struct work_struct *);
206 void nv50_disp_intr(struct nouveau_subdev *);
207 extern const struct nvkm_event_func nv50_disp_vblank_func;
209 extern const struct nv50_disp_mthd_chan nv84_disp_mast_mthd_chan;
210 extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_dac;
211 extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_head;
212 extern const struct nv50_disp_mthd_chan nv84_disp_sync_mthd_chan;
213 extern const struct nv50_disp_mthd_chan nv84_disp_ovly_mthd_chan;
215 extern const struct nv50_disp_mthd_chan nv94_disp_mast_mthd_chan;
217 extern struct nv50_disp_chan_impl nvd0_disp_mast_ofuncs;
218 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_base;
219 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_dac;
220 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_sor;
221 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_pior;
222 extern struct nv50_disp_chan_impl nvd0_disp_sync_ofuncs;
223 extern struct nv50_disp_chan_impl nvd0_disp_ovly_ofuncs;
224 extern const struct nv50_disp_mthd_chan nvd0_disp_sync_mthd_chan;
225 extern struct nv50_disp_chan_impl nvd0_disp_oimm_ofuncs;
226 extern struct nv50_disp_chan_impl nvd0_disp_curs_ofuncs;
227 extern struct nouveau_ofuncs nvd0_disp_base_ofuncs;
228 extern struct nouveau_oclass nvd0_disp_cclass;
229 void nvd0_disp_intr_supervisor(struct work_struct *);
230 void nvd0_disp_intr(struct nouveau_subdev *);
231 extern const struct nvkm_event_func nvd0_disp_vblank_func;
233 extern const struct nv50_disp_mthd_chan nve0_disp_mast_mthd_chan;
234 extern const struct nv50_disp_mthd_chan nve0_disp_ovly_mthd_chan;
236 extern struct nvkm_output_dp_impl nv50_pior_dp_impl;
237 extern struct nouveau_oclass *nv50_disp_outp_sclass[];
239 extern struct nvkm_output_dp_impl nv94_sor_dp_impl;
240 int nv94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int);
241 extern struct nouveau_oclass *nv94_disp_outp_sclass[];
243 extern struct nvkm_output_dp_impl nvd0_sor_dp_impl;
244 extern struct nouveau_oclass *nvd0_disp_outp_sclass[];