GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / gpu / drm / nouveau / nvkm / engine / disp / nv50.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __NV50_DISP_H__
3 #define __NV50_DISP_H__
4 #define nv50_disp(p) container_of((p), struct nv50_disp, base)
5 #include "priv.h"
6 struct nvkm_head;
7
8 struct nv50_disp {
9         const struct nv50_disp_func *func;
10         struct nvkm_disp base;
11
12         struct workqueue_struct *wq;
13         struct work_struct supervisor;
14         u32 super;
15
16         struct nvkm_event uevent;
17
18         struct {
19                 unsigned long mask;
20                 int nr;
21         } wndw, head, dac;
22
23         struct {
24                 unsigned long mask;
25                 int nr;
26                 u32 lvdsconf;
27         } sor;
28
29         struct {
30                 unsigned long mask;
31                 int nr;
32                 u8 type[3];
33         } pior;
34
35         struct nvkm_gpuobj *inst;
36         struct nvkm_ramht *ramht;
37
38         struct nv50_disp_chan *chan[81];
39 };
40
41 void nv50_disp_super_1(struct nv50_disp *);
42 void nv50_disp_super_1_0(struct nv50_disp *, struct nvkm_head *);
43 void nv50_disp_super_2_0(struct nv50_disp *, struct nvkm_head *);
44 void nv50_disp_super_2_1(struct nv50_disp *, struct nvkm_head *);
45 void nv50_disp_super_2_2(struct nv50_disp *, struct nvkm_head *);
46 void nv50_disp_super_3_0(struct nv50_disp *, struct nvkm_head *);
47
48 int nv50_disp_new_(const struct nv50_disp_func *, struct nvkm_device *,
49                    int index, struct nvkm_disp **);
50
51 struct nv50_disp_func {
52         int (*init)(struct nv50_disp *);
53         void (*fini)(struct nv50_disp *);
54         void (*intr)(struct nv50_disp *);
55         void (*intr_error)(struct nv50_disp *, int chid);
56
57         const struct nvkm_event_func *uevent;
58         void (*super)(struct work_struct *);
59
60         const struct nvkm_disp_oclass *root;
61
62         struct {
63                 int (*cnt)(struct nvkm_disp *, unsigned long *mask);
64                 int (*new)(struct nvkm_disp *, int id);
65         } wndw, head, dac, sor, pior;
66
67         u16 ramht_size;
68 };
69
70 int nv50_disp_init(struct nv50_disp *);
71 void nv50_disp_fini(struct nv50_disp *);
72 void nv50_disp_intr(struct nv50_disp *);
73 void nv50_disp_super(struct work_struct *);
74
75 int gf119_disp_init(struct nv50_disp *);
76 void gf119_disp_fini(struct nv50_disp *);
77 void gf119_disp_intr(struct nv50_disp *);
78 void gf119_disp_super(struct work_struct *);
79 void gf119_disp_intr_error(struct nv50_disp *, int);
80
81 void nv50_disp_dptmds_war_2(struct nv50_disp *, struct dcb_output *);
82 void nv50_disp_dptmds_war_3(struct nv50_disp *, struct dcb_output *);
83 void nv50_disp_update_sppll1(struct nv50_disp *);
84
85 extern const struct nvkm_event_func nv50_disp_chan_uevent;
86 int  nv50_disp_chan_uevent_ctor(struct nvkm_object *, void *, u32,
87                                 struct nvkm_notify *);
88 void nv50_disp_chan_uevent_send(struct nv50_disp *, int);
89
90 extern const struct nvkm_event_func gf119_disp_chan_uevent;
91 extern const struct nvkm_event_func gv100_disp_chan_uevent;
92 #endif