aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorHarry Wentland <harry.wentland@amd.com>2017-11-08 14:59:48 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-12-06 12:47:44 -0500
commit2e5fa5ba50b045500fceea1ef1d0fdc13a7e0e1f (patch)
treebe5b6838b9892a099f3c35960b94530a4dfaf49c /drivers/gpu/drm
parent7c0c967209591433f31e4992fc58f5e30a16febb (diff)
drm/amd/display: Move dc_link interface to separate header
Signed-off-by: Harry Wentland <harry.wentland@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc.h175
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc_link.h207
2 files changed, 208 insertions, 174 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 170cdcb5a027..5c509707ccd6 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -653,171 +653,7 @@ struct dpcd_caps {
653 bool dpcd_display_control_capable; 653 bool dpcd_display_control_capable;
654}; 654};
655 655
656struct dc_link_status { 656#include "dc_link.h"
657 struct dpcd_caps *dpcd_caps;
658};
659
660/* DP MST stream allocation (payload bandwidth number) */
661struct link_mst_stream_allocation {
662 /* DIG front */
663 const struct stream_encoder *stream_enc;
664 /* associate DRM payload table with DC stream encoder */
665 uint8_t vcp_id;
666 /* number of slots required for the DP stream in transport packet */
667 uint8_t slot_count;
668};
669
670/* DP MST stream allocation table */
671struct link_mst_stream_allocation_table {
672 /* number of DP video streams */
673 int stream_count;
674 /* array of stream allocations */
675 struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
676};
677
678/*
679 * A link contains one or more sinks and their connected status.
680 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
681 */
682struct dc_link {
683 struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
684 unsigned int sink_count;
685 struct dc_sink *local_sink;
686 unsigned int link_index;
687 enum dc_connection_type type;
688 enum signal_type connector_signal;
689 enum dc_irq_source irq_source_hpd;
690 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
691 /* caps is the same as reported_link_cap. link_traing use
692 * reported_link_cap. Will clean up. TODO
693 */
694 struct dc_link_settings reported_link_cap;
695 struct dc_link_settings verified_link_cap;
696 struct dc_link_settings cur_link_settings;
697 struct dc_lane_settings cur_lane_setting;
698 struct dc_link_settings preferred_link_setting;
699
700 uint8_t ddc_hw_inst;
701
702 uint8_t hpd_src;
703
704 uint8_t link_enc_hw_inst;
705
706 bool test_pattern_enabled;
707 union compliance_test_state compliance_test_state;
708
709 void *priv;
710
711 struct ddc_service *ddc;
712
713 bool aux_mode;
714
715 /* Private to DC core */
716
717 const struct dc *dc;
718
719 struct dc_context *ctx;
720
721 struct link_encoder *link_enc;
722 struct graphics_object_id link_id;
723 union ddi_channel_mapping ddi_channel_mapping;
724 struct connector_device_tag_info device_tag;
725 struct dpcd_caps dpcd_caps;
726 unsigned short chip_caps;
727 unsigned int dpcd_sink_count;
728 enum edp_revision edp_revision;
729 bool psr_enabled;
730
731 /* MST record stream using this link */
732 struct link_flags {
733 bool dp_keep_receiver_powered;
734 } wa_flags;
735 struct link_mst_stream_allocation_table mst_stream_alloc_table;
736
737 struct dc_link_status link_status;
738
739};
740
741const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
742
743/*
744 * Return an enumerated dc_link. dc_link order is constant and determined at
745 * boot time. They cannot be created or destroyed.
746 * Use dc_get_caps() to get number of links.
747 */
748static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index)
749{
750 return dc->links[link_index];
751}
752
753/* Set backlight level of an embedded panel (eDP, LVDS). */
754bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
755 uint32_t frame_ramp, const struct dc_stream_state *stream);
756
757bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable, bool wait);
758
759bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state);
760
761bool dc_link_setup_psr(struct dc_link *dc_link,
762 const struct dc_stream_state *stream, struct psr_config *psr_config,
763 struct psr_context *psr_context);
764
765/* Request DC to detect if there is a Panel connected.
766 * boot - If this call is during initial boot.
767 * Return false for any type of detection failure or MST detection
768 * true otherwise. True meaning further action is required (status update
769 * and OS notification).
770 */
771enum dc_detect_reason {
772 DETECT_REASON_BOOT,
773 DETECT_REASON_HPD,
774 DETECT_REASON_HPDRX,
775};
776
777bool dc_link_detect(struct dc_link *dc_link, enum dc_detect_reason reason);
778
779/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
780 * Return:
781 * true - Downstream port status changed. DM should call DC to do the
782 * detection.
783 * false - no change in Downstream port status. No further action required
784 * from DM. */
785bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,
786 union hpd_irq_data *hpd_irq_dpcd_data);
787
788struct dc_sink_init_data;
789
790struct dc_sink *dc_link_add_remote_sink(
791 struct dc_link *dc_link,
792 const uint8_t *edid,
793 int len,
794 struct dc_sink_init_data *init_data);
795
796void dc_link_remove_remote_sink(
797 struct dc_link *link,
798 struct dc_sink *sink);
799
800/* Used by diagnostics for virtual link at the moment */
801
802void dc_link_dp_set_drive_settings(
803 struct dc_link *link,
804 struct link_training_settings *lt_settings);
805
806enum link_training_result dc_link_dp_perform_link_training(
807 struct dc_link *link,
808 const struct dc_link_settings *link_setting,
809 bool skip_video_pattern);
810
811void dc_link_dp_enable_hpd(const struct dc_link *link);
812
813void dc_link_dp_disable_hpd(const struct dc_link *link);
814
815bool dc_link_dp_set_test_pattern(
816 struct dc_link *link,
817 enum dp_test_pattern test_pattern,
818 const struct link_training_settings *p_link_settings,
819 const unsigned char *p_custom_pattern,
820 unsigned int cust_pattern_size);
821 657
822/******************************************************************************* 658/*******************************************************************************
823 * Sink Interfaces - A sink corresponds to a display output device 659 * Sink Interfaces - A sink corresponds to a display output device
@@ -897,13 +733,4 @@ void dc_set_power_state(
897 enum dc_acpi_cm_power_state power_state); 733 enum dc_acpi_cm_power_state power_state);
898void dc_resume(struct dc *dc); 734void dc_resume(struct dc *dc);
899 735
900/*
901 * DPCD access interfaces
902 */
903
904bool dc_submit_i2c(
905 struct dc *dc,
906 uint32_t link_index,
907 struct i2c_command *cmd);
908
909#endif /* DC_INTERFACE_H_ */ 736#endif /* DC_INTERFACE_H_ */
diff --git a/drivers/gpu/drm/amd/display/dc/dc_link.h b/drivers/gpu/drm/amd/display/dc/dc_link.h
new file mode 100644
index 000000000000..f11a734da1db
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/dc_link.h
@@ -0,0 +1,207 @@
1/*
2 * Copyright 2012-14 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_H_
27#define DC_LINK_H_
28
29#include "dc_types.h"
30#include "grph_object_defs.h"
31
32struct dc_link_status {
33 struct dpcd_caps *dpcd_caps;
34};
35
36/* DP MST stream allocation (payload bandwidth number) */
37struct link_mst_stream_allocation {
38 /* DIG front */
39 const struct stream_encoder *stream_enc;
40 /* associate DRM payload table with DC stream encoder */
41 uint8_t vcp_id;
42 /* number of slots required for the DP stream in transport packet */
43 uint8_t slot_count;
44};
45
46/* DP MST stream allocation table */
47struct link_mst_stream_allocation_table {
48 /* number of DP video streams */
49 int stream_count;
50 /* array of stream allocations */
51 struct link_mst_stream_allocation stream_allocations[MAX_CONTROLLER_NUM];
52};
53
54/*
55 * A link contains one or more sinks and their connected status.
56 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
57 */
58struct dc_link {
59 struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
60 unsigned int sink_count;
61 struct dc_sink *local_sink;
62 unsigned int link_index;
63 enum dc_connection_type type;
64 enum signal_type connector_signal;
65 enum dc_irq_source irq_source_hpd;
66 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
67 /* caps is the same as reported_link_cap. link_traing use
68 * reported_link_cap. Will clean up. TODO
69 */
70 struct dc_link_settings reported_link_cap;
71 struct dc_link_settings verified_link_cap;
72 struct dc_link_settings cur_link_settings;
73 struct dc_lane_settings cur_lane_setting;
74 struct dc_link_settings preferred_link_setting;
75
76 uint8_t ddc_hw_inst;
77
78 uint8_t hpd_src;
79
80 uint8_t link_enc_hw_inst;
81
82 bool test_pattern_enabled;
83 union compliance_test_state compliance_test_state;
84
85 void *priv;
86
87 struct ddc_service *ddc;
88
89 bool aux_mode;
90
91 /* Private to DC core */
92
93 const struct dc *dc;
94
95 struct dc_context *ctx;
96
97 struct link_encoder *link_enc;
98 struct graphics_object_id link_id;
99 union ddi_channel_mapping ddi_channel_mapping;
100 struct connector_device_tag_info device_tag;
101 struct dpcd_caps dpcd_caps;
102 unsigned short chip_caps;
103 unsigned int dpcd_sink_count;
104 enum edp_revision edp_revision;
105 bool psr_enabled;
106
107 /* MST record stream using this link */
108 struct link_flags {
109 bool dp_keep_receiver_powered;
110 } wa_flags;
111 struct link_mst_stream_allocation_table mst_stream_alloc_table;
112
113 struct dc_link_status link_status;
114
115};
116
117const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
118
119/*
120 * Return an enumerated dc_link. dc_link order is constant and determined at
121 * boot time. They cannot be created or destroyed.
122 * Use dc_get_caps() to get number of links.
123 */
124static inline struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index)
125{
126 return dc->links[link_index];
127}
128
129/* Set backlight level of an embedded panel (eDP, LVDS). */
130bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
131 uint32_t frame_ramp, const struct dc_stream_state *stream);
132
133bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable, bool wait);
134
135bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state);
136
137bool dc_link_setup_psr(struct dc_link *dc_link,
138 const struct dc_stream_state *stream, struct psr_config *psr_config,
139 struct psr_context *psr_context);
140
141/* Request DC to detect if there is a Panel connected.
142 * boot - If this call is during initial boot.
143 * Return false for any type of detection failure or MST detection
144 * true otherwise. True meaning further action is required (status update
145 * and OS notification).
146 */
147enum dc_detect_reason {
148 DETECT_REASON_BOOT,
149 DETECT_REASON_HPD,
150 DETECT_REASON_HPDRX,
151};
152
153bool dc_link_detect(struct dc_link *dc_link, enum dc_detect_reason reason);
154
155/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
156 * Return:
157 * true - Downstream port status changed. DM should call DC to do the
158 * detection.
159 * false - no change in Downstream port status. No further action required
160 * from DM. */
161bool dc_link_handle_hpd_rx_irq(struct dc_link *dc_link,
162 union hpd_irq_data *hpd_irq_dpcd_data);
163
164struct dc_sink_init_data;
165
166struct dc_sink *dc_link_add_remote_sink(
167 struct dc_link *dc_link,
168 const uint8_t *edid,
169 int len,
170 struct dc_sink_init_data *init_data);
171
172void dc_link_remove_remote_sink(
173 struct dc_link *link,
174 struct dc_sink *sink);
175
176/* Used by diagnostics for virtual link at the moment */
177
178void dc_link_dp_set_drive_settings(
179 struct dc_link *link,
180 struct link_training_settings *lt_settings);
181
182enum link_training_result dc_link_dp_perform_link_training(
183 struct dc_link *link,
184 const struct dc_link_settings *link_setting,
185 bool skip_video_pattern);
186
187void dc_link_dp_enable_hpd(const struct dc_link *link);
188
189void dc_link_dp_disable_hpd(const struct dc_link *link);
190
191bool dc_link_dp_set_test_pattern(
192 struct dc_link *link,
193 enum dp_test_pattern test_pattern,
194 const struct link_training_settings *p_link_settings,
195 const unsigned char *p_custom_pattern,
196 unsigned int cust_pattern_size);
197
198/*
199 * DPCD access interfaces
200 */
201
202bool dc_submit_i2c(
203 struct dc *dc,
204 uint32_t link_index,
205 struct i2c_command *cmd);
206
207#endif /* DC_LINK_H_ */