596d543acd30288f521bee4164d8bfafc9344ac2
[sfrench/cifs-2.6.git] / drivers / gpu / drm / nouveau / include / nvif / outp.h
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVIF_OUTP_H__
3 #define __NVIF_OUTP_H__
4 #include <nvif/object.h>
5 #include <nvif/if0012.h>
6 #include <drm/display/drm_dp.h>
7 struct nvif_disp;
8
9 struct nvif_outp {
10         struct nvif_object object;
11
12         struct {
13                 int id;
14                 int link;
15         } or;
16 };
17
18 int nvif_outp_ctor(struct nvif_disp *, const char *name, int id, struct nvif_outp *);
19 void nvif_outp_dtor(struct nvif_outp *);
20
21 enum nvif_outp_detect_status {
22         NOT_PRESENT,
23         PRESENT,
24         UNKNOWN,
25 };
26
27 enum nvif_outp_detect_status nvif_outp_detect(struct nvif_outp *);
28 int nvif_outp_edid_get(struct nvif_outp *, u8 **pedid);
29
30 int nvif_outp_load_detect(struct nvif_outp *, u32 loadval);
31 int nvif_outp_acquire_dac(struct nvif_outp *);
32 int nvif_outp_acquire_sor(struct nvif_outp *, bool hda);
33 int nvif_outp_acquire_pior(struct nvif_outp *);
34 int nvif_outp_acquire_dp(struct nvif_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
35                          int link_nr, int link_bw, bool hda, bool mst);
36 int nvif_outp_inherit_rgb_crt(struct nvif_outp *outp, u8 *proto_out);
37 int nvif_outp_inherit_lvds(struct nvif_outp *outp, u8 *proto_out);
38 int nvif_outp_inherit_tmds(struct nvif_outp *outp, u8 *proto_out);
39 int nvif_outp_inherit_dp(struct nvif_outp *outp, u8 *proto_out);
40
41 void nvif_outp_release(struct nvif_outp *);
42
43 static inline bool
44 nvif_outp_acquired(struct nvif_outp *outp)
45 {
46         return outp->or.id >= 0;
47 }
48
49 int nvif_outp_bl_get(struct nvif_outp *);
50 int nvif_outp_bl_set(struct nvif_outp *, int level);
51
52 int nvif_outp_lvds(struct nvif_outp *, bool dual, bool bpc8);
53
54 int nvif_outp_hdmi(struct nvif_outp *, int head, bool enable, u8 max_ac_packet, u8 rekey, u32 khz,
55                    bool scdc, bool scdc_scrambling, bool scdc_low_rates);
56
57 int nvif_outp_infoframe(struct nvif_outp *, u8 type, struct nvif_outp_infoframe_v0 *, u32 size);
58 int nvif_outp_hda_eld(struct nvif_outp *, int head, void *data, u32 size);
59
60 int nvif_outp_dp_aux_pwr(struct nvif_outp *, bool enable);
61 int nvif_outp_dp_aux_xfer(struct nvif_outp *, u8 type, u8 *size, u32 addr, u8 *data);
62
63 struct nvif_outp_dp_rate {
64         int dpcd; /* -1 for non-indexed rates */
65         u32 rate;
66 };
67
68 int nvif_outp_dp_rates(struct nvif_outp *, struct nvif_outp_dp_rate *rate, int rate_nr);
69
70 int nvif_outp_dp_retrain(struct nvif_outp *);
71 int nvif_outp_dp_mst_vcpi(struct nvif_outp *, int head,
72                           u8 start_slot, u8 num_slots, u16 pbn, u16 aligned_pbn);
73 #endif