• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_DISP_OUTP_H__
3 #define __NVKM_DISP_OUTP_H__
4 #include "priv.h"
5 #include <core/notify.h>
6 
7 #include <subdev/bios.h>
8 #include <subdev/bios/dcb.h>
9 #include <subdev/bios/dp.h>
10 
11 struct nvkm_outp {
12 	const struct nvkm_outp_func *func;
13 	struct nvkm_disp *disp;
14 	int index;
15 	struct dcb_output info;
16 
17 	struct nvkm_i2c_bus *i2c;
18 
19 	struct list_head head;
20 	struct nvkm_conn *conn;
21 	bool identity;
22 
23 	/* Assembly state. */
24 #define NVKM_OUTP_PRIV 1
25 #define NVKM_OUTP_USER 2
26 	u8 acquired:2;
27 	struct nvkm_ior *ior;
28 
29 	union {
30 		struct {
31 			struct nvbios_dpout info;
32 			u8 version;
33 
34 			struct nvkm_i2c_aux *aux;
35 
36 			struct nvkm_notify hpd;
37 			bool present;
38 			u8 lttpr[6];
39 			u8 lttprs;
40 			u8 dpcd[16];
41 
42 			struct {
43 				int dpcd; /* -1, or index into SUPPORTED_LINK_RATES table */
44 				u32 rate;
45 			} rate[8];
46 			int rates;
47 			int links;
48 
49 			struct mutex mutex;
50 			struct {
51 				atomic_t done;
52 				bool mst;
53 			} lt;
54 		} dp;
55 	};
56 
57 	struct nvkm_object object;
58 };
59 
60 int nvkm_outp_new_(const struct nvkm_outp_func *, struct nvkm_disp *, int index,
61 		   struct dcb_output *, struct nvkm_outp **);
62 int nvkm_outp_new(struct nvkm_disp *, int index, struct dcb_output *, struct nvkm_outp **);
63 void nvkm_outp_del(struct nvkm_outp **);
64 void nvkm_outp_init(struct nvkm_outp *);
65 void nvkm_outp_fini(struct nvkm_outp *);
66 int nvkm_outp_acquire(struct nvkm_outp *, u8 user, bool hda);
67 void nvkm_outp_release(struct nvkm_outp *, u8 user);
68 void nvkm_outp_route(struct nvkm_disp *);
69 
70 struct nvkm_outp_func {
71 	void *(*dtor)(struct nvkm_outp *);
72 	void (*init)(struct nvkm_outp *);
73 	void (*fini)(struct nvkm_outp *);
74 	int (*acquire)(struct nvkm_outp *);
75 	void (*release)(struct nvkm_outp *);
76 	void (*disable)(struct nvkm_outp *, struct nvkm_ior *);
77 };
78 
79 #define OUTP_MSG(o,l,f,a...) do {                                              \
80 	struct nvkm_outp *_outp = (o);                                         \
81 	nvkm_##l(&_outp->disp->engine.subdev, "outp %02x:%04x:%04x: "f"\n",    \
82 		 _outp->index, _outp->info.hasht, _outp->info.hashm, ##a);     \
83 } while(0)
84 #define OUTP_ERR(o,f,a...) OUTP_MSG((o), error, f, ##a)
85 #define OUTP_DBG(o,f,a...) OUTP_MSG((o), debug, f, ##a)
86 #define OUTP_TRACE(o,f,a...) OUTP_MSG((o), trace, f, ##a)
87 #endif
88