]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.h
drm/nouveau/disp: introduce object to track per-head functions/state
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / nvkm / engine / disp / nv50.h
1 #ifndef __NV50_DISP_H__
2 #define __NV50_DISP_H__
3 #define nv50_disp(p) container_of((p), struct nv50_disp, base)
4 #include "priv.h"
5 #include "dp.h"
6
7 #define NV50_DISP_MTHD_ struct nvkm_object *object,                            \
8         struct nv50_disp *disp, void *data, u32 size
9 #define NV50_DISP_MTHD_V0 NV50_DISP_MTHD_, int head
10 #define NV50_DISP_MTHD_V1 NV50_DISP_MTHD_, int head, struct nvkm_output *outp
11
12 struct nv50_disp {
13         const struct nv50_disp_func *func;
14         struct nvkm_disp base;
15
16         struct work_struct supervisor;
17         u32 super;
18
19         struct nvkm_event uevent;
20
21         struct {
22                 u32 lvdsconf;
23         } sor;
24
25         struct {
26                 u8 type[3];
27         } pior;
28
29         struct nv50_disp_chan *chan[17];
30 };
31
32 int nv50_disp_root_scanoutpos(NV50_DISP_MTHD_V0);
33
34 int gf119_disp_root_scanoutpos(NV50_DISP_MTHD_V0);
35
36 int nv50_dac_power(NV50_DISP_MTHD_V1);
37 int nv50_dac_sense(NV50_DISP_MTHD_V1);
38
39 int gt215_hda_eld(NV50_DISP_MTHD_V1);
40 int gf119_hda_eld(NV50_DISP_MTHD_V1);
41
42 int g84_hdmi_ctrl(NV50_DISP_MTHD_V1);
43 int gt215_hdmi_ctrl(NV50_DISP_MTHD_V1);
44 int gf119_hdmi_ctrl(NV50_DISP_MTHD_V1);
45 int gk104_hdmi_ctrl(NV50_DISP_MTHD_V1);
46
47 int nv50_sor_power(NV50_DISP_MTHD_V1);
48 int nv50_pior_power(NV50_DISP_MTHD_V1);
49
50 int nv50_disp_new_(const struct nv50_disp_func *, struct nvkm_device *,
51                    int index, int heads, struct nvkm_disp **);
52 int gf119_disp_new_(const struct nv50_disp_func *, struct nvkm_device *,
53                     int index, struct nvkm_disp **);
54
55 struct nv50_disp_func_outp {
56         int (* crt)(struct nvkm_disp *, int index, struct dcb_output *,
57                     struct nvkm_output **);
58         int (*  tv)(struct nvkm_disp *, int index, struct dcb_output *,
59                     struct nvkm_output **);
60         int (*tmds)(struct nvkm_disp *, int index, struct dcb_output *,
61                     struct nvkm_output **);
62         int (*lvds)(struct nvkm_disp *, int index, struct dcb_output *,
63                     struct nvkm_output **);
64         int (*  dp)(struct nvkm_disp *, int index, struct dcb_output *,
65                     struct nvkm_output **);
66 };
67
68 struct nv50_disp_func {
69         void (*intr)(struct nv50_disp *);
70         void (*intr_error)(struct nv50_disp *, int chid);
71
72         const struct nvkm_event_func *uevent;
73         void (*super)(struct work_struct *);
74
75         const struct nvkm_disp_oclass *root;
76
77         struct {
78                 int (*new)(struct nvkm_disp *, int id);
79                 void (*vblank_init)(struct nv50_disp *, int head);
80                 void (*vblank_fini)(struct nv50_disp *, int head);
81                 int (*scanoutpos)(NV50_DISP_MTHD_V0);
82         } head;
83
84         struct {
85                 const struct nv50_disp_func_outp internal;
86                 const struct nv50_disp_func_outp external;
87         } outp;
88
89         struct {
90                 int nr;
91                 int (*power)(NV50_DISP_MTHD_V1);
92                 int (*sense)(NV50_DISP_MTHD_V1);
93         } dac;
94
95         struct {
96                 int nr;
97                 int (*power)(NV50_DISP_MTHD_V1);
98                 int (*hda_eld)(NV50_DISP_MTHD_V1);
99                 int (*hdmi)(NV50_DISP_MTHD_V1);
100                 void (*magic)(struct nvkm_output *);
101         } sor;
102
103         struct {
104                 int nr;
105                 int (*power)(NV50_DISP_MTHD_V1);
106         } pior;
107 };
108
109 void nv50_disp_vblank_init(struct nv50_disp *, int);
110 void nv50_disp_vblank_fini(struct nv50_disp *, int);
111 void nv50_disp_intr(struct nv50_disp *);
112 void nv50_disp_super(struct work_struct *);
113
114 void gf119_disp_vblank_init(struct nv50_disp *, int);
115 void gf119_disp_vblank_fini(struct nv50_disp *, int);
116 void gf119_disp_intr(struct nv50_disp *);
117 void gf119_disp_super(struct work_struct *);
118 void gf119_disp_intr_error(struct nv50_disp *, int);
119
120 void nv50_disp_dptmds_war_2(struct nv50_disp *, struct dcb_output *);
121 void nv50_disp_dptmds_war_3(struct nv50_disp *, struct dcb_output *);
122 void nv50_disp_update_sppll1(struct nv50_disp *);
123 #endif