xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1 #ifndef __NVKM_DISP_OUTP_H__
2 #define __NVKM_DISP_OUTP_H__
3 #include <core/object.h>
4 
5 #include <subdev/bios.h>
6 #include <subdev/bios/dcb.h>
7 
8 struct nvkm_output {
9 	struct nvkm_object base;
10 	struct list_head head;
11 
12 	struct dcb_output info;
13 	int index;
14 	int or;
15 
16 	struct nvkm_i2c_port *port;
17 	struct nvkm_i2c_port *edid;
18 
19 	struct nvkm_connector *conn;
20 };
21 
22 #define nvkm_output_create(p,e,c,b,i,d)                                        \
23 	nvkm_output_create_((p), (e), (c), (b), (i), sizeof(**d), (void **)d)
24 #define nvkm_output_destroy(d) ({                                              \
25 	struct nvkm_output *_outp = (d);                                       \
26 	_nvkm_output_dtor(nv_object(_outp));                                   \
27 })
28 #define nvkm_output_init(d) ({                                                 \
29 	struct nvkm_output *_outp = (d);                                       \
30 	_nvkm_output_init(nv_object(_outp));                                   \
31 })
32 #define nvkm_output_fini(d,s) ({                                               \
33 	struct nvkm_output *_outp = (d);                                       \
34 	_nvkm_output_fini(nv_object(_outp), (s));                              \
35 })
36 
37 int nvkm_output_create_(struct nvkm_object *, struct nvkm_object *,
38 			struct nvkm_oclass *, struct dcb_output *,
39 			int, int, void **);
40 
41 int  _nvkm_output_ctor(struct nvkm_object *, struct nvkm_object *,
42 		       struct nvkm_oclass *, void *, u32,
43 		       struct nvkm_object **);
44 void _nvkm_output_dtor(struct nvkm_object *);
45 int  _nvkm_output_init(struct nvkm_object *);
46 int  _nvkm_output_fini(struct nvkm_object *, bool);
47 
48 struct nvkm_output_impl {
49 	struct nvkm_oclass base;
50 };
51 
52 #ifndef MSG
53 #define MSG(l,f,a...) do {                                                     \
54 	struct nvkm_output *_outp = (void *)outp;                              \
55 	nv_##l(_outp, "%02x:%04x:%04x: "f, _outp->index,                       \
56 	       _outp->info.hasht, _outp->info.hashm, ##a);                     \
57 } while(0)
58 #define DBG(f,a...) MSG(debug, f, ##a)
59 #define ERR(f,a...) MSG(error, f, ##a)
60 #endif
61 #endif
62