Merge tag 'amd-drm-next-5.14-2021-05-21' of https://gitlab.freedesktop.org/agd5f...
[linux-block.git] / drivers / gpu / drm / amd / display / dc / inc / dc_link_dp.h
CommitLineData
4562236b
HW
1/*
2 * Copyright 2015 Advanced Micro Devices, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: AMD
23 *
24 */
25
26#ifndef __DC_LINK_DP_H__
27#define __DC_LINK_DP_H__
28
29#define LINK_TRAINING_ATTEMPTS 4
30#define LINK_TRAINING_RETRY_DELAY 50 /* ms */
c797ede0 31#define LINK_AUX_DEFAULT_LTTPR_TIMEOUT_PERIOD 3200 /*us*/
61aa7a6f 32#define LINK_AUX_DEFAULT_TIMEOUT_PERIOD 552 /*us*/
4562236b 33
d0778ebf 34struct dc_link;
0971c40e 35struct dc_stream_state;
4562236b
HW
36struct dc_link_settings;
37
aafded88 38bool dp_verify_link_cap(
d0778ebf 39 struct dc_link *link,
824474ba
BL
40 struct dc_link_settings *known_limit_link_setting,
41 int *fail_count);
4562236b 42
e7f2c80c
WL
43bool dp_verify_link_cap_with_retries(
44 struct dc_link *link,
45 struct dc_link_settings *known_limit_link_setting,
46 int attempts);
47
f537d474
LH
48bool dp_verify_mst_link_cap(
49 struct dc_link *link);
50
4562236b 51bool dp_validate_mode_timing(
d0778ebf 52 struct dc_link *link,
4562236b
HW
53 const struct dc_crtc_timing *timing);
54
8efd0f5a
MS
55bool decide_edp_link_settings(struct dc_link *link,
56 struct dc_link_settings *link_setting,
57 uint32_t req_bw);
58
4562236b 59void decide_link_settings(
0971c40e 60 struct dc_stream_state *stream,
4562236b
HW
61 struct dc_link_settings *link_setting);
62
63bool perform_link_training_with_retries(
4562236b
HW
64 const struct dc_link_settings *link_setting,
65 bool skip_video_pattern,
832aa63b
PH
66 int attempts,
67 struct pipe_ctx *pipe_ctx,
82253671
JK
68 enum signal_type signal,
69 bool do_fallback);
4562236b 70
d0778ebf 71bool is_mst_supported(struct dc_link *link);
4562236b 72
cdb39798 73bool detect_dp_sink_caps(struct dc_link *link);
4562236b 74
4654a2f7
RL
75void detect_edp_sink_caps(struct dc_link *link);
76
d0778ebf 77bool is_dp_active_dongle(const struct dc_link *link);
4562236b 78
36c9137b
DZ
79bool is_dp_branch_device(const struct dc_link *link);
80
f9fc6f39
MS
81bool is_edp_ilr_optimization_required(struct dc_link *link, struct dc_crtc_timing *crtc_timing);
82
d0778ebf 83void dp_enable_mst_on_sink(struct dc_link *link, bool enable);
07c84c7a 84
0b226322
DG
85enum dp_panel_mode dp_get_panel_mode(struct dc_link *link);
86void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode);
87
8547058b
LH
88bool dp_overwrite_extended_receiver_cap(struct dc_link *link);
89
96577cf8
HW
90void dpcd_set_source_specific_data(struct dc_link *link);
91
97bda032
HW
92void dp_set_fec_ready(struct dc_link *link, bool ready);
93void dp_set_fec_enable(struct dc_link *link, bool enable);
94bool dp_set_dsc_enable(struct pipe_ctx *pipe_ctx, bool enable);
1a9e3d45
NC
95bool dp_set_dsc_pps_sdp(struct pipe_ctx *pipe_ctx, bool enable);
96void dp_set_dsc_on_stream(struct pipe_ctx *pipe_ctx, bool enable);
ba32c50f 97bool dp_update_dsc_config(struct pipe_ctx *pipe_ctx);
8cf9575d
MH
98bool dp_set_dsc_on_rx(struct pipe_ctx *pipe_ctx, bool enable);
99
573a0a03
JK
100/* Convert PHY repeater count read from DPCD uint8_t. */
101uint8_t dp_convert_to_count(uint8_t lttpr_repeater_count);
102
103/* Check DPCD training status registers to detect link loss. */
104enum link_training_result dp_check_link_loss_status(
105 struct dc_link *link,
106 const struct link_training_settings *link_training_setting);
97bda032 107
55bac4a7 108enum dp_link_encoding dp_get_link_encoding_format(const struct dc_link_settings *link_settings);
4562236b 109#endif /* __DC_LINK_DP_H__ */