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 struct nv50_disp_impl {
18 struct nouveau_disp_impl base;
20 const struct nv50_disp_mthd_chan *core;
21 const struct nv50_disp_mthd_chan *base;
22 const struct nv50_disp_mthd_chan *ovly;
27 #define NV50_DISP_MTHD_ struct nouveau_object *object, \
28 struct nv50_disp_priv *priv, void *data, u32 size
29 #define NV50_DISP_MTHD_V0 NV50_DISP_MTHD_, int head
30 #define NV50_DISP_MTHD_V1 NV50_DISP_MTHD_, int head, struct nvkm_output *outp
32 struct nv50_disp_priv {
33 struct nouveau_disp base;
34 struct nouveau_oclass *sclass;
36 struct work_struct supervisor;
44 int (*power)(NV50_DISP_MTHD_V1);
45 int (*sense)(NV50_DISP_MTHD_V1);
49 int (*power)(NV50_DISP_MTHD_V1);
50 int (*hda_eld)(NV50_DISP_MTHD_V1);
51 int (*hdmi)(NV50_DISP_MTHD_V1);
56 int (*power)(struct nv50_disp_priv *, int ext, u32 data);
61 #define HEAD_MTHD(n) (n), (n) + 0x03
63 int nv50_disp_base_scanoutpos(struct nouveau_object *, u32, void *, u32);
64 int nv50_disp_base_mthd(struct nouveau_object *, u32, void *, u32);
66 #define DAC_MTHD(n) (n), (n) + 0x03
68 int nv50_dac_power(NV50_DISP_MTHD_V1);
69 int nv50_dac_sense(NV50_DISP_MTHD_V1);
71 #define SOR_MTHD(n) (n), (n) + 0x3f
73 int nva3_hda_eld(NV50_DISP_MTHD_V1);
74 int nvd0_hda_eld(NV50_DISP_MTHD_V1);
76 int nv84_hdmi_ctrl(NV50_DISP_MTHD_V1);
77 int nva3_hdmi_ctrl(NV50_DISP_MTHD_V1);
78 int nvd0_hdmi_ctrl(NV50_DISP_MTHD_V1);
80 int nv50_sor_power(NV50_DISP_MTHD_V1);
82 int nv94_sor_dp_train_init(struct nv50_disp_priv *, int, int, int, u16, u16,
83 u32, struct dcb_output *);
84 int nv94_sor_dp_train_fini(struct nv50_disp_priv *, int, int, int, u16, u16,
85 u32, struct dcb_output *);
86 int nv94_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
88 int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
90 int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
93 int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
95 int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
97 int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
100 #define PIOR_MTHD(n) (n), (n) + 0x03
102 int nv50_pior_mthd(struct nouveau_object *, u32, void *, u32);
103 int nv50_pior_power(struct nv50_disp_priv *, int, u32);
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 u32 nv50_disp_chan_rd32(struct nouveau_object *, u64);
124 void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32);
126 #define nv50_disp_chan_init(a) \
127 nouveau_namedb_init(&(a)->base)
128 #define nv50_disp_chan_fini(a,b) \
129 nouveau_namedb_fini(&(a)->base, (b))
131 struct nv50_disp_dmac {
132 struct nv50_disp_chan base;
133 struct nouveau_dmaobj *pushdma;
137 void nv50_disp_dmac_dtor(struct nouveau_object *);
139 struct nv50_disp_pioc {
140 struct nv50_disp_chan base;
143 void nv50_disp_pioc_dtor(struct nouveau_object *);
145 struct nv50_disp_mthd_list {
155 struct nv50_disp_mthd_chan {
161 const struct nv50_disp_mthd_list *mthd;
165 extern struct nv50_disp_chan_impl nv50_disp_mast_ofuncs;
166 int nv50_disp_mast_ctor(struct nouveau_object *, struct nouveau_object *,
167 struct nouveau_oclass *, void *, u32,
168 struct nouveau_object **);
169 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_base;
170 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_sor;
171 extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_pior;
172 extern struct nv50_disp_chan_impl nv50_disp_sync_ofuncs;
173 int nv50_disp_sync_ctor(struct nouveau_object *, struct nouveau_object *,
174 struct nouveau_oclass *, void *, u32,
175 struct nouveau_object **);
176 extern const struct nv50_disp_mthd_list nv50_disp_sync_mthd_image;
177 extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs;
178 int nv50_disp_ovly_ctor(struct nouveau_object *, struct nouveau_object *,
179 struct nouveau_oclass *, void *, u32,
180 struct nouveau_object **);
181 extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base;
182 extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs;
183 int nv50_disp_oimm_ctor(struct nouveau_object *, struct nouveau_object *,
184 struct nouveau_oclass *, void *, u32,
185 struct nouveau_object **);
186 extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs;
187 int nv50_disp_curs_ctor(struct nouveau_object *, struct nouveau_object *,
188 struct nouveau_oclass *, void *, u32,
189 struct nouveau_object **);
190 extern struct nouveau_ofuncs nv50_disp_base_ofuncs;
191 int nv50_disp_base_ctor(struct nouveau_object *, struct nouveau_object *,
192 struct nouveau_oclass *, void *, u32,
193 struct nouveau_object **);
194 void nv50_disp_base_dtor(struct nouveau_object *);
195 extern struct nouveau_oclass nv50_disp_cclass;
196 void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head,
197 const struct nv50_disp_mthd_chan *);
198 void nv50_disp_intr_supervisor(struct work_struct *);
199 void nv50_disp_intr(struct nouveau_subdev *);
200 extern const struct nvkm_event_func nv50_disp_vblank_func;
202 extern const struct nv50_disp_mthd_chan nv84_disp_mast_mthd_chan;
203 extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_dac;
204 extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_head;
205 extern const struct nv50_disp_mthd_chan nv84_disp_sync_mthd_chan;
206 extern const struct nv50_disp_mthd_chan nv84_disp_ovly_mthd_chan;
207 extern struct nouveau_omthds nv84_disp_base_omthds[];
209 extern const struct nv50_disp_mthd_chan nv94_disp_mast_mthd_chan;
211 extern struct nv50_disp_chan_impl nvd0_disp_mast_ofuncs;
212 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_base;
213 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_dac;
214 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_sor;
215 extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_pior;
216 extern struct nv50_disp_chan_impl nvd0_disp_sync_ofuncs;
217 extern struct nv50_disp_chan_impl nvd0_disp_ovly_ofuncs;
218 extern const struct nv50_disp_mthd_chan nvd0_disp_sync_mthd_chan;
219 extern struct nv50_disp_chan_impl nvd0_disp_oimm_ofuncs;
220 extern struct nv50_disp_chan_impl nvd0_disp_curs_ofuncs;
221 extern struct nouveau_omthds nvd0_disp_base_omthds[];
222 extern struct nouveau_ofuncs nvd0_disp_base_ofuncs;
223 extern struct nouveau_oclass nvd0_disp_cclass;
224 void nvd0_disp_intr_supervisor(struct work_struct *);
225 void nvd0_disp_intr(struct nouveau_subdev *);
226 extern const struct nvkm_event_func nvd0_disp_vblank_func;
228 extern const struct nv50_disp_mthd_chan nve0_disp_mast_mthd_chan;
229 extern const struct nv50_disp_mthd_chan nve0_disp_ovly_mthd_chan;
231 extern struct nvkm_output_dp_impl nv50_pior_dp_impl;
232 extern struct nouveau_oclass *nv50_disp_outp_sclass[];
234 extern struct nvkm_output_dp_impl nv94_sor_dp_impl;
235 int nv94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int);
236 extern struct nouveau_oclass *nv94_disp_outp_sclass[];
238 extern struct nvkm_output_dp_impl nvd0_sor_dp_impl;
239 extern struct nouveau_oclass *nvd0_disp_outp_sclass[];