]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
drm/nouveau/disp/g94-: port OR DP lane mapping to nvkm_ior
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / nvkm / engine / disp / ior.h
1 #ifndef __NVKM_DISP_IOR_H__
2 #define __NVKM_DISP_IOR_H__
3 #include "priv.h"
4
5 struct nvkm_ior {
6         const struct nvkm_ior_func *func;
7         struct nvkm_disp *disp;
8         enum nvkm_ior_type {
9                 DAC,
10                 SOR,
11                 PIOR,
12         } type;
13         int id;
14         char name[8];
15
16         struct list_head head;
17
18         struct nvkm_ior_state {
19                 unsigned rgdiv;
20                 unsigned proto_evo:4;
21                 enum nvkm_ior_proto {
22                         CRT,
23                         TMDS,
24                         LVDS,
25                         DP,
26                         UNKNOWN
27                 } proto:3;
28                 unsigned link:2;
29                 unsigned head:4;
30         } arm, asy;
31
32         /* Armed DP state. */
33         struct {
34                 bool mst;
35                 bool ef;
36                 u8 nr;
37                 u8 bw;
38         } dp;
39 };
40
41 struct nvkm_ior_func {
42         void (*state)(struct nvkm_ior *, struct nvkm_ior_state *);
43         void (*power)(struct nvkm_ior *, bool normal, bool pu,
44                       bool data, bool vsync, bool hsync);
45         int (*sense)(struct nvkm_ior *, u32 loadval);
46
47         struct {
48                 void (*ctrl)(struct nvkm_ior *, int head, bool enable,
49                              u8 max_ac_packet, u8 rekey, u8 *avi, u8 avi_size,
50                              u8 *vendor, u8 vendor_size);
51         } hdmi;
52
53         struct {
54                 u8 lanes[4];
55         } dp;
56 };
57
58 int nvkm_ior_new_(const struct nvkm_ior_func *func, struct nvkm_disp *,
59                   enum nvkm_ior_type type, int id);
60 void nvkm_ior_del(struct nvkm_ior **);
61 struct nvkm_ior *nvkm_ior_find(struct nvkm_disp *, enum nvkm_ior_type, int id);
62
63 static inline u32
64 nv50_ior_base(struct nvkm_ior *ior)
65 {
66         return ior->id * 0x800;
67 }
68
69 void nv50_dac_power(struct nvkm_ior *, bool, bool, bool, bool, bool);
70 int nv50_dac_sense(struct nvkm_ior *, u32);
71
72 void nv50_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
73 void nv50_sor_power(struct nvkm_ior *, bool, bool, bool, bool, bool);
74
75 void g94_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
76 void gf119_sor_state(struct nvkm_ior *, struct nvkm_ior_state *);
77
78 void g84_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8);
79 void gt215_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8);
80 void gf119_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8);
81 void gk104_hdmi_ctrl(struct nvkm_ior *, int, bool, u8, u8, u8 *, u8 , u8 *, u8);
82
83 #define IOR_MSG(i,l,f,a...) do {                                               \
84         struct nvkm_ior *_ior = (i);                                           \
85         nvkm_##l(&_ior->disp->engine.subdev, "%s: "f, _ior->name, ##a);        \
86 } while(0)
87 #define IOR_WARN(i,f,a...) IOR_MSG((i), warn, f, ##a)
88 #define IOR_DBG(i,f,a...) IOR_MSG((i), debug, f, ##a)
89
90 int nv50_dac_new(struct nvkm_disp *, int);
91 int gf119_dac_new(struct nvkm_disp *, int);
92
93 int nv50_pior_new(struct nvkm_disp *, int);
94
95 int nv50_sor_new(struct nvkm_disp *, int);
96 int g84_sor_new(struct nvkm_disp *, int);
97 int g94_sor_new(struct nvkm_disp *, int);
98 int mcp77_sor_new(struct nvkm_disp *, int);
99 int gt215_sor_new(struct nvkm_disp *, int);
100 int mcp89_sor_new(struct nvkm_disp *, int);
101 int gf119_sor_new(struct nvkm_disp *, int);
102 int gk104_sor_new(struct nvkm_disp *, int);
103 int gm107_sor_new(struct nvkm_disp *, int);
104 int gm200_sor_new(struct nvkm_disp *, int);
105 #endif