1 | #ifndef __NV50_DISP_H__ |
2 | #define __NV50_DISP_H__ |
3 | |
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> |
9 | |
10 | #include <engine/dmaobj.h> |
11 | |
12 | #include <linux/workqueue.h> /* XXX */ |
13 | |
14 | #include "dport.h" |
15 | #include "priv.h" |
16 | |
17 | struct nv50_disp_impl { |
18 | struct nouveau_disp_impl base; |
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; |
25 | }; |
26 | |
27 | struct nv50_disp_priv { |
28 | struct nouveau_disp base; |
29 | struct nouveau_oclass *sclass; |
30 | |
31 | struct work_struct supervisor; |
32 | u32 super; |
33 | |
34 | struct { |
35 | int nr; |
36 | } head; |
37 | struct { |
38 | int nr; |
39 | int (*power)(struct nv50_disp_priv *, int dac, u32 data); |
40 | int (*sense)(struct nv50_disp_priv *, int dac, u32 load); |
41 | } dac; |
42 | struct { |
43 | int nr; |
44 | int (*power)(struct nv50_disp_priv *, int sor, u32 data); |
45 | int (*hda_eld)(struct nv50_disp_priv *, int sor, u8 *, u32); |
46 | int (*hdmi)(struct nv50_disp_priv *, int head, int sor, u32); |
47 | u32 lvdsconf; |
48 | const struct nouveau_dp_func *dp; |
49 | } sor; |
50 | struct { |
51 | int nr; |
52 | int (*power)(struct nv50_disp_priv *, int ext, u32 data); |
53 | u8 type[3]; |
54 | const struct nouveau_dp_func *dp; |
55 | } pior; |
56 | }; |
57 | |
58 | #define HEAD_MTHD(n) (n), (n) + 0x03 |
59 | |
60 | int nv50_disp_base_scanoutpos(struct nouveau_object *, u32, void *, u32); |
61 | |
62 | #define DAC_MTHD(n) (n), (n) + 0x03 |
63 | |
64 | int nv50_dac_mthd(struct nouveau_object *, u32, void *, u32); |
65 | int nv50_dac_power(struct nv50_disp_priv *, int, u32); |
66 | int nv50_dac_sense(struct nv50_disp_priv *, int, u32); |
67 | |
68 | #define SOR_MTHD(n) (n), (n) + 0x3f |
69 | |
70 | int nva3_hda_eld(struct nv50_disp_priv *, int, u8 *, u32); |
71 | int nvd0_hda_eld(struct nv50_disp_priv *, int, u8 *, u32); |
72 | |
73 | int nv84_hdmi_ctrl(struct nv50_disp_priv *, int, int, u32); |
74 | int nva3_hdmi_ctrl(struct nv50_disp_priv *, int, int, u32); |
75 | int nvd0_hdmi_ctrl(struct nv50_disp_priv *, int, int, u32); |
76 | |
77 | int nv50_sor_mthd(struct nouveau_object *, u32, void *, u32); |
78 | int nv50_sor_power(struct nv50_disp_priv *, int, u32); |
79 | |
80 | int nv94_sor_dp_train_init(struct nv50_disp_priv *, int, int, int, u16, u16, |
81 | u32, struct dcb_output *); |
82 | int nv94_sor_dp_train_fini(struct nv50_disp_priv *, int, int, int, u16, u16, |
83 | u32, struct dcb_output *); |
84 | int nv94_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32, |
85 | struct dcb_output *); |
86 | int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, |
87 | struct dcb_output *); |
88 | int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, |
89 | struct dcb_output *); |
90 | |
91 | int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32, |
92 | struct dcb_output *); |
93 | int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, |
94 | struct dcb_output *); |
95 | int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32, |
96 | struct dcb_output *); |
97 | |
98 | #define PIOR_MTHD(n) (n), (n) + 0x03 |
99 | |
100 | int nv50_pior_mthd(struct nouveau_object *, u32, void *, u32); |
101 | int nv50_pior_power(struct nv50_disp_priv *, int, u32); |
102 | |
103 | struct nv50_disp_base { |
104 | struct nouveau_parent base; |
105 | struct nouveau_ramht *ramht; |
106 | u32 chan; |
107 | }; |
108 | |
109 | struct nv50_disp_chan { |
110 | struct nouveau_namedb base; |
111 | int chid; |
112 | }; |
113 | |
114 | int nv50_disp_chan_create_(struct nouveau_object *, struct nouveau_object *, |
115 | struct nouveau_oclass *, int, int, void **); |
116 | void nv50_disp_chan_destroy(struct nv50_disp_chan *); |
117 | u32 nv50_disp_chan_rd32(struct nouveau_object *, u64); |
118 | void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32); |
119 | |
120 | #define nv50_disp_chan_init(a) \ |
121 | nouveau_namedb_init(&(a)->base) |
122 | #define nv50_disp_chan_fini(a,b) \ |
123 | nouveau_namedb_fini(&(a)->base, (b)) |
124 | |
125 | int nv50_disp_dmac_create_(struct nouveau_object *, struct nouveau_object *, |
126 | struct nouveau_oclass *, u32, int, int, void **); |
127 | void nv50_disp_dmac_dtor(struct nouveau_object *); |
128 | |
129 | struct nv50_disp_dmac { |
130 | struct nv50_disp_chan base; |
131 | struct nouveau_dmaobj *pushdma; |
132 | u32 push; |
133 | }; |
134 | |
135 | struct nv50_disp_pioc { |
136 | struct nv50_disp_chan base; |
137 | }; |
138 | |
139 | struct nv50_disp_mthd_list { |
140 | u32 mthd; |
141 | u32 addr; |
142 | struct { |
143 | u32 mthd; |
144 | u32 addr; |
145 | const char *name; |
146 | } data[]; |
147 | }; |
148 | |
149 | struct nv50_disp_mthd_chan { |
150 | const char *name; |
151 | u32 addr; |
152 | struct { |
153 | const char *name; |
154 | int nr; |
155 | const struct nv50_disp_mthd_list *mthd; |
156 | } data[]; |
157 | }; |
158 | |
159 | extern struct nouveau_ofuncs nv50_disp_mast_ofuncs; |
160 | extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_base; |
161 | extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_sor; |
162 | extern const struct nv50_disp_mthd_list nv50_disp_mast_mthd_pior; |
163 | extern struct nouveau_ofuncs nv50_disp_sync_ofuncs; |
164 | extern const struct nv50_disp_mthd_list nv50_disp_sync_mthd_image; |
165 | extern struct nouveau_ofuncs nv50_disp_ovly_ofuncs; |
166 | extern const struct nv50_disp_mthd_list nv50_disp_ovly_mthd_base; |
167 | extern struct nouveau_ofuncs nv50_disp_oimm_ofuncs; |
168 | extern struct nouveau_ofuncs nv50_disp_curs_ofuncs; |
169 | extern struct nouveau_ofuncs nv50_disp_base_ofuncs; |
170 | extern struct nouveau_oclass nv50_disp_cclass; |
171 | void nv50_disp_mthd_chan(struct nv50_disp_priv *, int debug, int head, |
172 | const struct nv50_disp_mthd_chan *); |
173 | void nv50_disp_intr_supervisor(struct work_struct *); |
174 | void nv50_disp_intr(struct nouveau_subdev *); |
175 | |
176 | extern const struct nv50_disp_mthd_chan nv84_disp_mast_mthd_chan; |
177 | extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_dac; |
178 | extern const struct nv50_disp_mthd_list nv84_disp_mast_mthd_head; |
179 | extern const struct nv50_disp_mthd_chan nv84_disp_sync_mthd_chan; |
180 | extern const struct nv50_disp_mthd_chan nv84_disp_ovly_mthd_chan; |
181 | extern struct nouveau_omthds nv84_disp_base_omthds[]; |
182 | |
183 | extern const struct nv50_disp_mthd_chan nv94_disp_mast_mthd_chan; |
184 | |
185 | extern struct nouveau_ofuncs nvd0_disp_mast_ofuncs; |
186 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_base; |
187 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_dac; |
188 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_sor; |
189 | extern const struct nv50_disp_mthd_list nvd0_disp_mast_mthd_pior; |
190 | extern struct nouveau_ofuncs nvd0_disp_sync_ofuncs; |
191 | extern struct nouveau_ofuncs nvd0_disp_ovly_ofuncs; |
192 | extern const struct nv50_disp_mthd_chan nvd0_disp_sync_mthd_chan; |
193 | extern struct nouveau_ofuncs nvd0_disp_oimm_ofuncs; |
194 | extern struct nouveau_ofuncs nvd0_disp_curs_ofuncs; |
195 | extern struct nouveau_omthds nvd0_disp_base_omthds[]; |
196 | extern struct nouveau_ofuncs nvd0_disp_base_ofuncs; |
197 | extern struct nouveau_oclass nvd0_disp_cclass; |
198 | void nvd0_disp_intr_supervisor(struct work_struct *); |
199 | void nvd0_disp_intr(struct nouveau_subdev *); |
200 | |
201 | extern const struct nv50_disp_mthd_chan nve0_disp_mast_mthd_chan; |
202 | extern const struct nv50_disp_mthd_chan nve0_disp_ovly_mthd_chan; |
203 | |
204 | #endif |
205 | |