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