xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/disp/conn.h (revision e0bf6c5ca2d3281f231c5f0c9bf145e9513644de)
1 #ifndef __NVKM_DISP_CONN_H__
2 #define __NVKM_DISP_CONN_H__
3 #include <core/object.h>
4 #include <core/notify.h>
5 
6 #include <subdev/bios.h>
7 #include <subdev/bios/conn.h>
8 
9 struct nvkm_connector {
10 	struct nvkm_object base;
11 	struct list_head head;
12 
13 	struct nvbios_connE info;
14 	int index;
15 
16 	struct nvkm_notify hpd;
17 };
18 
19 #define nvkm_connector_create(p,e,c,b,i,d)                                     \
20 	nvkm_connector_create_((p), (e), (c), (b), (i), sizeof(**d), (void **)d)
21 #define nvkm_connector_destroy(d) ({                                           \
22 	struct nvkm_connector *disp = (d);                                     \
23 	_nvkm_connector_dtor(nv_object(disp));                                 \
24 })
25 #define nvkm_connector_init(d) ({                                              \
26 	struct nvkm_connector *disp = (d);                                     \
27 	_nvkm_connector_init(nv_object(disp));                                 \
28 })
29 #define nvkm_connector_fini(d,s) ({                                            \
30 	struct nvkm_connector *disp = (d);                                     \
31 	_nvkm_connector_fini(nv_object(disp), (s));                            \
32 })
33 
34 int nvkm_connector_create_(struct nvkm_object *, struct nvkm_object *,
35 			   struct nvkm_oclass *, struct nvbios_connE *,
36 			   int, int, void **);
37 
38 int  _nvkm_connector_ctor(struct nvkm_object *, struct nvkm_object *,
39 			  struct nvkm_oclass *, void *, u32,
40 			  struct nvkm_object **);
41 void _nvkm_connector_dtor(struct nvkm_object *);
42 int  _nvkm_connector_init(struct nvkm_object *);
43 int  _nvkm_connector_fini(struct nvkm_object *, bool);
44 
45 struct nvkm_connector_impl {
46 	struct nvkm_oclass base;
47 };
48 
49 #ifndef MSG
50 #define MSG(l,f,a...) do {                                                     \
51 	struct nvkm_connector *_conn = (void *)conn;                           \
52 	nv_##l(_conn, "%02x:%02x%02x: "f, _conn->index,                        \
53 	       _conn->info.location, _conn->info.type, ##a);                   \
54 } while(0)
55 #define DBG(f,a...) MSG(debug, f, ##a)
56 #define ERR(f,a...) MSG(error, f, ##a)
57 #endif
58 #endif
59