1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef __NOUVEAU_ENCODER_H__
28#define __NOUVEAU_ENCODER_H__
29
30#include <subdev/bios/dcb.h>
31
32#include <drm/drm_encoder_slave.h>
33#include <drm/drm_dp_mst_helper.h>
34#include "dispnv04/disp.h"
35struct nv50_head_atom;
36struct nouveau_connector;
37
38#define NV_DPMS_CLEARED 0x80
39
40struct nvkm_i2c_port;
41
42struct nouveau_encoder {
43 struct drm_encoder_slave base;
44
45 struct dcb_output *dcb;
46 int or;
47 int link;
48
49 struct i2c_adapter *i2c;
50 struct nvkm_i2c_aux *aux;
51
52
53
54 struct drm_crtc *crtc;
55 u32 ctrl;
56 bool audio;
57
58 struct drm_display_mode mode;
59 int last_dpms;
60
61 struct nv04_output_reg restore;
62
63 union {
64 struct {
65 struct nv50_mstm *mstm;
66 int link_nr;
67 int link_bw;
68
69
70
71
72 struct mutex hpd_irq_lock;
73
74 u8 dpcd[DP_RECEIVER_CAP_SIZE];
75 u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
76 struct drm_dp_desc desc;
77
78 u8 sink_count;
79 } dp;
80 };
81
82 struct {
83 bool dp_interlace : 1;
84 } caps;
85
86 void (*enc_save)(struct drm_encoder *encoder);
87 void (*enc_restore)(struct drm_encoder *encoder);
88 void (*update)(struct nouveau_encoder *, u8 head,
89 struct nv50_head_atom *, u8 proto, u8 depth);
90};
91
92struct nv50_mstm {
93 struct nouveau_encoder *outp;
94
95 struct drm_dp_mst_topology_mgr mgr;
96
97
98 bool can_mst;
99 bool is_mst;
100 bool suspended;
101
102 bool modified;
103 bool disabled;
104 int links;
105};
106
107struct nouveau_encoder *
108find_encoder(struct drm_connector *connector, int type);
109
110static inline struct nouveau_encoder *nouveau_encoder(struct drm_encoder *enc)
111{
112 struct drm_encoder_slave *slave = to_encoder_slave(enc);
113
114 return container_of(slave, struct nouveau_encoder, base);
115}
116
117static inline struct drm_encoder *to_drm_encoder(struct nouveau_encoder *enc)
118{
119 return &enc->base.base;
120}
121
122static inline const struct drm_encoder_slave_funcs *
123get_slave_funcs(struct drm_encoder *enc)
124{
125 return to_encoder_slave(enc)->slave_funcs;
126}
127
128
129enum nouveau_dp_status {
130 NOUVEAU_DP_NONE,
131 NOUVEAU_DP_SST,
132 NOUVEAU_DP_MST,
133};
134
135int nouveau_dp_detect(struct nouveau_connector *, struct nouveau_encoder *);
136void nouveau_dp_irq(struct nouveau_drm *drm,
137 struct nouveau_connector *nv_connector);
138enum drm_mode_status nv50_dp_mode_valid(struct drm_connector *,
139 struct nouveau_encoder *,
140 const struct drm_display_mode *,
141 unsigned *clock);
142
143struct nouveau_connector *
144nv50_outp_get_new_connector(struct nouveau_encoder *outp,
145 struct drm_atomic_state *state);
146struct nouveau_connector *
147nv50_outp_get_old_connector(struct nouveau_encoder *outp,
148 struct drm_atomic_state *state);
149
150int nv50_mstm_detect(struct nouveau_encoder *encoder);
151void nv50_mstm_remove(struct nv50_mstm *mstm);
152bool nv50_mstm_service(struct nouveau_drm *drm,
153 struct nouveau_connector *nv_connector,
154 struct nv50_mstm *mstm);
155#endif
156