xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h (revision 546b928da0427b0d6c663cbb992bd7bfa9ac7971)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_DISP_PRIV_H__
3 #define __NVKM_DISP_PRIV_H__
4 #define nvkm_udisp(p) container_of((p), struct nvkm_disp, client.object)
5 #include <engine/disp.h>
6 #include <core/enum.h>
7 struct nvkm_head;
8 struct nvkm_head_func;
9 struct nvkm_ior;
10 struct nvkm_outp;
11 struct dcb_output;
12 
13 int r535_disp_new(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
14 		  struct nvkm_disp **);
15 
16 int nvkm_disp_ctor(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
17 		   struct nvkm_disp *);
18 int nvkm_disp_new_(const struct nvkm_disp_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
19 		   struct nvkm_disp **);
20 void nvkm_disp_vblank(struct nvkm_disp *, int head);
21 
22 struct nvkm_disp_func {
23 	void (*dtor)(struct nvkm_disp *);
24 	int (*oneinit)(struct nvkm_disp *);
25 	int (*init)(struct nvkm_disp *);
26 	void (*fini)(struct nvkm_disp *, bool suspend);
27 	void (*intr)(struct nvkm_disp *);
28 	void (*intr_error)(struct nvkm_disp *, int chid);
29 
30 	void (*super)(struct work_struct *);
31 
32 	const struct nvkm_event_func *uevent;
33 
34 	struct {
35 		int (*cnt)(struct nvkm_disp *, unsigned long *mask);
36 		int (*new)(struct nvkm_disp *, int id);
37 	} wndw, head, dac, sor, pior;
38 
39 	/* Register programming that the GSP-RM display path (rm/r535) needs from
40 	 * the chip, everything else on that path goes through RM. The hooks are
41 	 * called unconditionally and the head table is handed to nvkm_head_new_().
42 	 */
43 	struct {
44 		irqreturn_t (*intr)(struct nvkm_inth *);
45 		/* Head-timing interrupts arrive on a second DISP vector. */
46 		bool intr_low_latency;
47 		const struct nvkm_head_func *head;
48 		void (*hdmi_gcp)(struct nvkm_ior *, int head, bool enable);
49 		void (*hdmi_infoframe_avi)(struct nvkm_ior *, int head, void *data, u32 size);
50 		void (*hdmi_infoframe_vsi)(struct nvkm_ior *, int head, void *data, u32 size);
51 	} gsp;
52 
53 	u16 ramht_size;
54 
55 	struct nvkm_sclass root;
56 
57 	struct nvkm_disp_user {
58 		struct nvkm_sclass base;
59 		int (*ctor)(const struct nvkm_oclass *, void *argv, u32 argc,
60 			    struct nvkm_object **);
61 		const struct nvkm_disp_chan_user *chan;
62 	} user[];
63 };
64 
65 int nv50_disp_oneinit(struct nvkm_disp *);
66 int nv50_disp_init(struct nvkm_disp *);
67 void nv50_disp_fini(struct nvkm_disp *, bool suspend);
68 void nv50_disp_intr(struct nvkm_disp *);
69 extern const struct nvkm_enum nv50_disp_intr_error_type[];
70 void nv50_disp_super(struct work_struct *);
71 void nv50_disp_super_1(struct nvkm_disp *);
72 void nv50_disp_super_1_0(struct nvkm_disp *, struct nvkm_head *);
73 void nv50_disp_super_2_0(struct nvkm_disp *, struct nvkm_head *);
74 void nv50_disp_super_2_1(struct nvkm_disp *, struct nvkm_head *);
75 void nv50_disp_super_2_2(struct nvkm_disp *, struct nvkm_head *);
76 void nv50_disp_super_3_0(struct nvkm_disp *, struct nvkm_head *);
77 
78 int gf119_disp_init(struct nvkm_disp *);
79 void gf119_disp_fini(struct nvkm_disp *, bool suspend);
80 void gf119_disp_intr(struct nvkm_disp *);
81 void gf119_disp_super(struct work_struct *);
82 void gf119_disp_intr_error(struct nvkm_disp *, int);
83 
84 void gv100_disp_fini(struct nvkm_disp *, bool suspend);
85 void gv100_disp_intr(struct nvkm_disp *);
86 void gv100_disp_super(struct work_struct *);
87 int gv100_disp_wndw_cnt(struct nvkm_disp *, unsigned long *);
88 int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
89 
90 int tu102_disp_init(struct nvkm_disp *);
91 irqreturn_t tu102_disp_intr(struct nvkm_inth *);
92 
93 void nv50_disp_dptmds_war_2(struct nvkm_disp *, struct dcb_output *);
94 void nv50_disp_dptmds_war_3(struct nvkm_disp *, struct dcb_output *);
95 void nv50_disp_update_sppll1(struct nvkm_disp *);
96 
97 extern const struct nvkm_event_func nv50_disp_chan_uevent;
98 void nv50_disp_chan_uevent_send(struct nvkm_disp *, int);
99 
100 extern const struct nvkm_event_func gf119_disp_chan_uevent;
101 extern const struct nvkm_event_func gv100_disp_chan_uevent;
102 
103 int nvkm_udisp_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
104 int nvkm_uconn_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
105 int nvkm_uoutp_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
106 int nvkm_uhead_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **);
107 #endif
108