1 #ifndef __NVKM_DISP_OUTP_DP_H__
2 #define __NVKM_DISP_OUTP_DP_H__
3 #include "outp.h"
4 
5 #include <core/notify.h>
6 #include <subdev/bios.h>
7 #include <subdev/bios/dp.h>
8 
9 struct nvkm_output_dp {
10 	struct nvkm_output base;
11 
12 	struct nvbios_dpout info;
13 	u8 version;
14 
15 	struct nvkm_notify irq;
16 	bool present;
17 	u8 dpcd[16];
18 
19 	struct {
20 		struct work_struct work;
21 		wait_queue_head_t wait;
22 		atomic_t done;
23 	} lt;
24 };
25 
26 #define nvkm_output_dp_create(p,e,c,b,i,d)                                     \
27 	nvkm_output_dp_create_((p), (e), (c), (b), (i), sizeof(**d), (void **)d)
28 #define nvkm_output_dp_destroy(d) ({                                           \
29 	struct nvkm_output_dp *_outp = (d);                                    \
30 	_nvkm_output_dp_dtor(nv_object(_outp));                                \
31 })
32 #define nvkm_output_dp_init(d) ({                                              \
33 	struct nvkm_output_dp *_outp = (d);                                    \
34 	_nvkm_output_dp_init(nv_object(_outp));                                \
35 })
36 #define nvkm_output_dp_fini(d,s) ({                                            \
37 	struct nvkm_output_dp *_outp = (d);                                    \
38 	_nvkm_output_dp_fini(nv_object(_outp), (s));                           \
39 })
40 
41 int nvkm_output_dp_create_(struct nvkm_object *, struct nvkm_object *,
42 			   struct nvkm_oclass *, struct dcb_output *,
43 			   int, int, void **);
44 
45 int  _nvkm_output_dp_ctor(struct nvkm_object *, struct nvkm_object *,
46 			  struct nvkm_oclass *, void *, u32,
47 			  struct nvkm_object **);
48 void _nvkm_output_dp_dtor(struct nvkm_object *);
49 int  _nvkm_output_dp_init(struct nvkm_object *);
50 int  _nvkm_output_dp_fini(struct nvkm_object *, bool);
51 
52 struct nvkm_output_dp_impl {
53 	struct nvkm_output_impl base;
54 	int (*pattern)(struct nvkm_output_dp *, int);
55 	int (*lnk_pwr)(struct nvkm_output_dp *, int nr);
56 	int (*lnk_ctl)(struct nvkm_output_dp *, int nr, int bw, bool ef);
57 	int (*drv_ctl)(struct nvkm_output_dp *, int ln, int vs, int pe, int pc);
58 };
59 
60 int nvkm_output_dp_train(struct nvkm_output *, u32 rate, bool wait);
61 #endif
62