Commit | Line | Data |
---|---|---|
70cabe4a BS |
1 | #ifndef __NV50_DISP_H__ |
2 | #define __NV50_DISP_H__ | |
3 | ||
4 | #include <core/parent.h> | |
370c00f9 | 5 | #include <core/namedb.h> |
1d7c71a3 | 6 | #include <core/engctx.h> |
370c00f9 | 7 | #include <core/ramht.h> |
1d7c71a3 | 8 | #include <core/event.h> |
370c00f9 BS |
9 | |
10 | #include <engine/dmaobj.h> | |
70cabe4a | 11 | |
0a0afd28 | 12 | #include "dport.h" |
a8f8b489 | 13 | #include "priv.h" |
7a014a87 | 14 | #include "outp.h" |
b8407c9e | 15 | #include "outpdp.h" |
a8f8b489 BS |
16 | |
17 | struct nv50_disp_impl { | |
18 | struct nouveau_disp_impl base; | |
d67d92c0 BS |
19 | struct { |
20 | const struct nv50_disp_mthd_chan *core; | |
21 | const struct nv50_disp_mthd_chan *base; | |
22 | const struct nv50_disp_mthd_chan *ovly; | |
23 | int prev; | |
24 | } mthd; | |
a8f8b489 | 25 | }; |
6c5a0424 | 26 | |
bf0eb898 BS |
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 | |
31 | ||
70cabe4a BS |
32 | struct nv50_disp_priv { |
33 | struct nouveau_disp base; | |
34 | struct nouveau_oclass *sclass; | |
5cc027f6 BS |
35 | |
36 | struct work_struct supervisor; | |
37 | u32 super; | |
38 | ||
70cabe4a BS |
39 | struct { |
40 | int nr; | |
41 | } head; | |
42 | struct { | |
43 | int nr; | |
bf0eb898 | 44 | int (*power)(NV50_DISP_MTHD_V1); |
c4abd317 | 45 | int (*sense)(NV50_DISP_MTHD_V1); |
70cabe4a BS |
46 | } dac; |
47 | struct { | |
48 | int nr; | |
74b66850 | 49 | int (*power)(struct nv50_disp_priv *, int sor, u32 data); |
0a9e2b95 | 50 | int (*hda_eld)(struct nv50_disp_priv *, int sor, u8 *, u32); |
1c30cd09 | 51 | int (*hdmi)(struct nv50_disp_priv *, int head, int sor, u32); |
4a230fa6 | 52 | u32 lvdsconf; |
70cabe4a | 53 | } sor; |
a2bc283f BS |
54 | struct { |
55 | int nr; | |
56 | int (*power)(struct nv50_disp_priv *, int ext, u32 data); | |
57 | u8 type[3]; | |
a2bc283f | 58 | } pior; |
70cabe4a BS |
59 | }; |
60 | ||
d2fa7d32 BS |
61 | #define HEAD_MTHD(n) (n), (n) + 0x03 |
62 | ||
63 | int nv50_disp_base_scanoutpos(struct nouveau_object *, u32, void *, u32); | |
bf0eb898 | 64 | int nv50_disp_base_mthd(struct nouveau_object *, u32, void *, u32); |
d2fa7d32 | 65 | |
35b21d39 BS |
66 | #define DAC_MTHD(n) (n), (n) + 0x03 |
67 | ||
bf0eb898 | 68 | int nv50_dac_power(NV50_DISP_MTHD_V1); |
c4abd317 | 69 | int nv50_dac_sense(NV50_DISP_MTHD_V1); |
35b21d39 | 70 | |
6c5a0424 BS |
71 | #define SOR_MTHD(n) (n), (n) + 0x3f |
72 | ||
a4feaf4e BS |
73 | int nva3_hda_eld(struct nv50_disp_priv *, int, u8 *, u32); |
74 | int nvd0_hda_eld(struct nv50_disp_priv *, int, u8 *, u32); | |
75 | ||
8e9e3d2d BS |
76 | int nv84_hdmi_ctrl(struct nv50_disp_priv *, int, int, u32); |
77 | int nva3_hdmi_ctrl(struct nv50_disp_priv *, int, int, u32); | |
a4feaf4e BS |
78 | int nvd0_hdmi_ctrl(struct nv50_disp_priv *, int, int, u32); |
79 | ||
6c5a0424 | 80 | int nv50_sor_mthd(struct nouveau_object *, u32, void *, u32); |
74b66850 | 81 | int nv50_sor_power(struct nv50_disp_priv *, int, u32); |
6c5a0424 | 82 | |
8f2abc25 BS |
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 *); | |
f7960736 BS |
87 | int nv94_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32, |
88 | struct dcb_output *); | |
89 | int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, | |
90 | struct dcb_output *); | |
91 | int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, | |
92 | struct dcb_output *); | |
93 | ||
6c5a0424 BS |
94 | int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32, |
95 | struct dcb_output *); | |
96 | int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, | |
97 | struct dcb_output *); | |
98 | int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, | |
99 | struct dcb_output *); | |
100 | ||
a2bc283f BS |
101 | #define PIOR_MTHD(n) (n), (n) + 0x03 |
102 | ||
103 | int nv50_pior_mthd(struct nouveau_object *, u32, void *, u32); | |
104 | int nv50_pior_power(struct nv50_disp_priv *, int, u32); | |
105 | ||
70cabe4a BS |
106 | struct nv50_disp_base { |
107 | struct nouveau_parent base; | |
370c00f9 BS |
108 | struct nouveau_ramht *ramht; |
109 | u32 chan; | |
70cabe4a BS |
110 | }; |
111 | ||
2c04ae01 BS |
112 | struct nv50_disp_chan_impl { |
113 | struct nouveau_ofuncs base; | |
114 | int chid; | |
115 | int (*attach)(struct nouveau_object *, struct nouveau_object *, u32); | |
116 | void (*detach)(struct nouveau_object *, int); | |
117 | }; | |
118 | ||
70cabe4a | 119 | struct nv50_disp_chan { |
370c00f9 BS |
120 | struct nouveau_namedb base; |
121 | int chid; | |
122 | }; | |
123 | ||
370c00f9 BS |
124 | u32 nv50_disp_chan_rd32(struct nouveau_object *, u64); |
125 | void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32); | |
126 | ||
127 | #define nv50_disp_chan_init(a) \ | |
128 | nouveau_namedb_init(&(a)->base) | |
129 | #define nv50_disp_chan_fini(a,b) \ | |
130 | nouveau_namedb_fini(&(a)->base, (b)) | |
131 | ||
370c00f9 BS |
132 | struct nv50_disp_dmac { |
133 | struct nv50_disp_chan base; | |
134 | struct nouveau_dmaobj *pushdma; | |
135 | u32 push; | |
136 | }; | |
137 | ||
2c04ae01 BS |
138 | void nv50_disp_dmac_dtor(struct nouveau_object *); |
139 | ||
370c00f9 BS |
140 | struct nv50_disp_pioc { |
141 | struct nv50_disp_chan base; | |
70cabe4a BS |
142 | }; |
143 | ||
2c04ae01 BS |
144 | void nv50_disp_pioc_dtor(struct nouveau_object *); |
145 | ||
d67d92c0 BS |
146 | struct nv50_disp_mthd_list { |
147 | u32 mthd; | |
148 | u32 addr; | |
149 | struct { | |
150 | u32 mthd; | |
151 | u32 addr; | |
152 | const char *name; | |
153 | } data[]; | |
154 | }; | |
155 | ||
156 | struct nv50_disp_mthd_chan { | |
157 | const char *name; | |
158 | u32 addr; | |
159 | struct { | |
160 | const char *name; | |
161 | int nr; | |
162 | const struct nv50_disp_mthd_list *mthd; | |
163 | } data[]; | |
164 | }; | |
165 | ||
2c04ae01 BS |
166 | extern struct nv50_disp_chan_impl nv50_disp_mast_ofuncs; |
167 | int nv50_disp_mast_ctor(struct nouveau_object *, struct nouveau_object *, | |
168 | struct nouveau_oclass *, void *, u32, | |
169 | struct nouveau_object **); | |
d67d92c0 BS |
170 | extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_base; |
171 | extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_sor; | |
172 | extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_pior; | |
2c04ae01 BS |
173 | extern struct nv50_disp_chan_impl nv50_disp_sync_ofuncs; |
174 | int nv50_disp_sync_ctor(struct nouveau_object *, struct nouveau_object *, | |
175 | struct nouveau_oclass *, void *, u32, | |
176 | struct nouveau_object **); | |
d67d92c0 | 177 | extern const struct nv50_disp_mthd_list nv50_disp_sync_mthd_image; |
2c04ae01 BS |
178 | extern struct nv50_disp_chan_impl nv50_disp_ovly_ofuncs; |
179 | int nv50_disp_ovly_ctor(struct nouveau_object *, struct nouveau_object *, | |
180 | struct nouveau_oclass *, void *, u32, | |
181 | struct nouveau_object **); | |
d67d92c0 | 182 | extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base; |
2c04ae01 BS |
183 | extern struct nv50_disp_chan_impl nv50_disp_oimm_ofuncs; |
184 | int nv50_disp_oimm_ctor(struct nouveau_object *, struct nouveau_object *, | |
185 | struct nouveau_oclass *, void *, u32, | |
186 | struct nouveau_object **); | |
187 | extern struct nv50_disp_chan_impl nv50_disp_curs_ofuncs; | |
188 | int nv50_disp_curs_ctor(struct nouveau_object *, struct nouveau_object *, | |
189 | struct nouveau_oclass *, void *, u32, | |
190 | struct nouveau_object **); | |
70cabe4a | 191 | extern struct nouveau_ofuncs nv50_disp_base_ofuncs; |
79ca2770 BS |
192 | int nv50_disp_base_ctor(struct nouveau_object *, struct nouveau_object *, |
193 | struct nouveau_oclass *, void *, u32, | |
194 | struct nouveau_object **); | |
195 | void nv50_disp_base_dtor(struct nouveau_object *); | |
70cabe4a | 196 | extern struct nouveau_oclass nv50_disp_cclass; |
d67d92c0 BS |
197 | void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head, |
198 | const struct nv50_disp_mthd_chan *); | |
5cc027f6 | 199 | void nv50_disp_intr_supervisor(struct work_struct *); |
70cabe4a | 200 | void nv50_disp_intr(struct nouveau_subdev *); |
79ca2770 | 201 | extern const struct nvkm_event_func nv50_disp_vblank_func; |
70cabe4a | 202 | |
d67d92c0 BS |
203 | extern const struct nv50_disp_mthd_chan nv84_disp_mast_mthd_chan; |
204 | extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_dac; | |
205 | extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_head; | |
206 | extern const struct nv50_disp_mthd_chan nv84_disp_sync_mthd_chan; | |
207 | extern const struct nv50_disp_mthd_chan nv84_disp_ovly_mthd_chan; | |
ef22c8bb BS |
208 | extern struct nouveau_omthds nv84_disp_base_omthds[]; |
209 | ||
d67d92c0 BS |
210 | extern const struct nv50_disp_mthd_chan nv94_disp_mast_mthd_chan; |
211 | ||
2c04ae01 | 212 | extern struct nv50_disp_chan_impl nvd0_disp_mast_ofuncs; |
d67d92c0 BS |
213 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_base; |
214 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_dac; | |
215 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_sor; | |
216 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_pior; | |
2c04ae01 BS |
217 | extern struct nv50_disp_chan_impl nvd0_disp_sync_ofuncs; |
218 | extern struct nv50_disp_chan_impl nvd0_disp_ovly_ofuncs; | |
d67d92c0 | 219 | extern const struct nv50_disp_mthd_chan nvd0_disp_sync_mthd_chan; |
2c04ae01 BS |
220 | extern struct nv50_disp_chan_impl nvd0_disp_oimm_ofuncs; |
221 | extern struct nv50_disp_chan_impl nvd0_disp_curs_ofuncs; | |
d2fa7d32 | 222 | extern struct nouveau_omthds nvd0_disp_base_omthds[]; |
46654061 BS |
223 | extern struct nouveau_ofuncs nvd0_disp_base_ofuncs; |
224 | extern struct nouveau_oclass nvd0_disp_cclass; | |
5cc027f6 | 225 | void nvd0_disp_intr_supervisor(struct work_struct *); |
46654061 | 226 | void nvd0_disp_intr(struct nouveau_subdev *); |
79ca2770 | 227 | extern const struct nvkm_event_func nvd0_disp_vblank_func; |
46654061 | 228 | |
d67d92c0 BS |
229 | extern const struct nv50_disp_mthd_chan nve0_disp_mast_mthd_chan; |
230 | extern const struct nv50_disp_mthd_chan nve0_disp_ovly_mthd_chan; | |
231 | ||
b8407c9e BS |
232 | extern struct nvkm_output_dp_impl nv50_pior_dp_impl; |
233 | extern struct nouveau_oclass *nv50_disp_outp_sclass[]; | |
234 | ||
235 | extern struct nvkm_output_dp_impl nv94_sor_dp_impl; | |
1ecee1cd | 236 | int nv94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int); |
b8407c9e BS |
237 | extern struct nouveau_oclass *nv94_disp_outp_sclass[]; |
238 | ||
239 | extern struct nvkm_output_dp_impl nvd0_sor_dp_impl; | |
240 | extern struct nouveau_oclass *nvd0_disp_outp_sclass[]; | |
241 | ||
70cabe4a | 242 | #endif |