1 #ifndef __NVKM_DISP_OUTP_H__
2 #define __NVKM_DISP_OUTP_H__
3 #include <engine/disp.h>
4 
5 #include <subdev/bios.h>
6 #include <subdev/bios/dcb.h>
7 
8 struct nvkm_outp {
9 	const struct nvkm_outp_func *func;
10 	struct nvkm_disp *disp;
11 	int index;
12 	struct dcb_output info;
13 
14 	struct nvkm_i2c_bus *i2c;
15 	int or;
16 
17 	struct list_head head;
18 	struct nvkm_conn *conn;
19 
20 	/* Assembly state. */
21 #define NVKM_OUTP_PRIV 1
22 #define NVKM_OUTP_USER 2
23 	u8 acquired:2;
24 	struct nvkm_ior *ior;
25 };
26 
27 int nvkm_outp_ctor(const struct nvkm_outp_func *, struct nvkm_disp *,
28 		   int index, struct dcb_output *, struct nvkm_outp *);
29 int nvkm_outp_new(struct nvkm_disp *, int index, struct dcb_output *,
30 		  struct nvkm_outp **);
31 void nvkm_outp_del(struct nvkm_outp **);
32 void nvkm_outp_init(struct nvkm_outp *);
33 void nvkm_outp_fini(struct nvkm_outp *);
34 int nvkm_outp_acquire(struct nvkm_outp *, u8 user);
35 void nvkm_outp_release(struct nvkm_outp *, u8 user);
36 void nvkm_outp_route(struct nvkm_disp *);
37 
38 struct nvkm_outp_func {
39 	void *(*dtor)(struct nvkm_outp *);
40 	void (*init)(struct nvkm_outp *);
41 	void (*fini)(struct nvkm_outp *);
42 	int (*acquire)(struct nvkm_outp *);
43 	void (*release)(struct nvkm_outp *, struct nvkm_ior *);
44 };
45 
46 #define OUTP_MSG(o,l,f,a...) do {                                              \
47 	struct nvkm_outp *_outp = (o);                                         \
48 	nvkm_##l(&_outp->disp->engine.subdev, "outp %02x:%04x:%04x: "f"\n",    \
49 		 _outp->index, _outp->info.hasht, _outp->info.hashm, ##a);     \
50 } while(0)
51 #define OUTP_ERR(o,f,a...) OUTP_MSG((o), error, f, ##a)
52 #define OUTP_DBG(o,f,a...) OUTP_MSG((o), debug, f, ##a)
53 #define OUTP_TRACE(o,f,a...) OUTP_MSG((o), trace, f, ##a)
54 #endif
55