]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/core/engine/disp/nv50.h
drm/nv50-/disp: audit and version SOR_DP_PWR method
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / core / engine / disp / nv50.h
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 "dport.h"
13 #include "priv.h"
14 #include "outp.h"
15 #include "outpdp.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 #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
32 struct nv50_disp_priv {
33         struct nouveau_disp base;
34         struct nouveau_oclass *sclass;
35
36         struct work_struct supervisor;
37         u32 super;
38
39         struct {
40                 int nr;
41         } head;
42         struct {
43                 int nr;
44                 int (*power)(NV50_DISP_MTHD_V1);
45                 int (*sense)(NV50_DISP_MTHD_V1);
46         } dac;
47         struct {
48                 int nr;
49                 int (*power)(NV50_DISP_MTHD_V1);
50                 int (*hda_eld)(NV50_DISP_MTHD_V1);
51                 int (*hdmi)(NV50_DISP_MTHD_V1);
52                 u32 lvdsconf;
53         } sor;
54         struct {
55                 int nr;
56                 int (*power)(struct nv50_disp_priv *, int ext, u32 data);
57                 u8 type[3];
58         } pior;
59 };
60
61 #define HEAD_MTHD(n) (n), (n) + 0x03
62
63 int nv50_disp_base_scanoutpos(struct nouveau_object *, u32, void *, u32);
64 int nv50_disp_base_mthd(struct nouveau_object *, u32, void *, u32);
65
66 #define DAC_MTHD(n) (n), (n) + 0x03
67
68 int nv50_dac_power(NV50_DISP_MTHD_V1);
69 int nv50_dac_sense(NV50_DISP_MTHD_V1);
70
71 #define SOR_MTHD(n) (n), (n) + 0x3f
72
73 int nva3_hda_eld(NV50_DISP_MTHD_V1);
74 int nvd0_hda_eld(NV50_DISP_MTHD_V1);
75
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);
79
80 int nv50_sor_power(NV50_DISP_MTHD_V1);
81
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,
87                       struct dcb_output *);
88 int nv94_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
89                        struct dcb_output *);
90 int nv94_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
91                        struct dcb_output *);
92
93 int nvd0_sor_dp_train(struct nv50_disp_priv *, int, int, u16, u16, u32,
94                       struct dcb_output *);
95 int nvd0_sor_dp_lnkctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
96                        struct dcb_output *);
97 int nvd0_sor_dp_drvctl(struct nv50_disp_priv *, int, int, int, u16, u16, u32,
98                        struct dcb_output *);
99
100 #define PIOR_MTHD(n) (n), (n) + 0x03
101
102 int nv50_pior_mthd(struct nouveau_object *, u32, void *, u32);
103 int nv50_pior_power(struct nv50_disp_priv *, int, u32);
104
105 struct nv50_disp_base {
106         struct nouveau_parent base;
107         struct nouveau_ramht *ramht;
108         u32 chan;
109 };
110
111 struct nv50_disp_chan_impl {
112         struct nouveau_ofuncs base;
113         int chid;
114         int  (*attach)(struct nouveau_object *, struct nouveau_object *, u32);
115         void (*detach)(struct nouveau_object *, int);
116 };
117
118 struct nv50_disp_chan {
119         struct nouveau_namedb base;
120         int chid;
121 };
122
123 u32  nv50_disp_chan_rd32(struct nouveau_object *, u64);
124 void nv50_disp_chan_wr32(struct nouveau_object *, u64, u32);
125
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))
130
131 struct nv50_disp_dmac {
132         struct nv50_disp_chan base;
133         struct nouveau_dmaobj *pushdma;
134         u32 push;
135 };
136
137 void nv50_disp_dmac_dtor(struct nouveau_object *);
138
139 struct nv50_disp_pioc {
140         struct nv50_disp_chan base;
141 };
142
143 void nv50_disp_pioc_dtor(struct nouveau_object *);
144
145 struct nv50_disp_mthd_list {
146         u32 mthd;
147         u32 addr;
148         struct {
149                 u32 mthd;
150                 u32 addr;
151                 const char *name;
152         } data[];
153 };
154
155 struct nv50_disp_mthd_chan {
156         const char *name;
157         u32 addr;
158         struct {
159                 const char *name;
160                 int nr;
161                 const struct nv50_disp_mthd_list *mthd;
162         } data[];
163 };
164
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;
201
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[];
208
209 extern const struct nv50_disp_mthd_chan nv94_disp_mast_mthd_chan;
210
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;
227
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;
230
231 extern struct nvkm_output_dp_impl nv50_pior_dp_impl;
232 extern struct nouveau_oclass *nv50_disp_outp_sclass[];
233
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[];
237
238 extern struct nvkm_output_dp_impl nvd0_sor_dp_impl;
239 extern struct nouveau_oclass *nvd0_disp_outp_sclass[];
240
241 #endif