xref: /linux/drivers/gpu/drm/amd/display/dc/dc_bios_types.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1 /*
2  * Copyright 2016 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_BIOS_TYPES_H
27 #define DC_BIOS_TYPES_H
28 
29 /******************************************************************************
30  * Interface file for VBIOS implementations.
31  *
32  * The default implementation is inside DC.
33  * Display Manager (which instantiates DC) has the option to supply it's own
34  * (external to DC) implementation of VBIOS, which will be called by DC, using
35  * this interface.
36  * (The intended use is Diagnostics, but other uses may appear.)
37  *****************************************************************************/
38 
39 #include "include/bios_parser_types.h"
40 
41 struct dc_vbios_funcs {
42 	uint8_t (*get_connectors_number)(struct dc_bios *bios);
43 
44 	struct graphics_object_id (*get_connector_id)(
45 		struct dc_bios *bios,
46 		uint8_t connector_index);
47 	enum bp_result (*get_src_obj)(
48 		struct dc_bios *bios,
49 		struct graphics_object_id object_id, uint32_t index,
50 		struct graphics_object_id *src_object_id);
51 	enum bp_result (*get_i2c_info)(
52 		struct dc_bios *dcb,
53 		struct graphics_object_id id,
54 		struct graphics_object_i2c_info *info);
55 	enum bp_result (*get_hpd_info)(
56 		struct dc_bios *bios,
57 		struct graphics_object_id id,
58 		struct graphics_object_hpd_info *info);
59 	enum bp_result (*get_device_tag)(
60 		struct dc_bios *bios,
61 		struct graphics_object_id connector_object_id,
62 		uint32_t device_tag_index,
63 		struct connector_device_tag_info *info);
64 	enum bp_result (*get_spread_spectrum_info)(
65 		struct dc_bios *bios,
66 		enum as_signal_type signal,
67 		uint32_t index,
68 		struct spread_spectrum_info *ss_info);
69 	uint32_t (*get_ss_entry_number)(
70 		struct dc_bios *bios,
71 		enum as_signal_type signal);
72 	enum bp_result (*get_embedded_panel_info)(
73 		struct dc_bios *bios,
74 		struct embedded_panel_info *info);
75 	enum bp_result (*get_gpio_pin_info)(
76 		struct dc_bios *bios,
77 		uint32_t gpio_id,
78 		struct gpio_pin_info *info);
79 	enum bp_result (*get_encoder_cap_info)(
80 		struct dc_bios *bios,
81 		struct graphics_object_id object_id,
82 		struct bp_encoder_cap_info *info);
83 
84 	bool (*is_accelerated_mode)(
85 		struct dc_bios *bios);
86 	void (*set_scratch_critical_state)(
87 		struct dc_bios *bios,
88 		bool state);
89 	bool (*is_device_id_supported)(
90 		struct dc_bios *bios,
91 		struct device_id id);
92 	/* COMMANDS */
93 
94 	enum bp_result (*encoder_control)(
95 		struct dc_bios *bios,
96 		struct bp_encoder_control *cntl);
97 	enum bp_result (*transmitter_control)(
98 		struct dc_bios *bios,
99 		struct bp_transmitter_control *cntl);
100 	enum bp_result (*enable_crtc)(
101 		struct dc_bios *bios,
102 		enum controller_id id,
103 		bool enable);
104 	enum bp_result (*adjust_pixel_clock)(
105 		struct dc_bios *bios,
106 		struct bp_adjust_pixel_clock_parameters *bp_params);
107 	enum bp_result (*set_pixel_clock)(
108 		struct dc_bios *bios,
109 		struct bp_pixel_clock_parameters *bp_params);
110 	enum bp_result (*set_dce_clock)(
111 		struct dc_bios *bios,
112 		struct bp_set_dce_clock_parameters *bp_params);
113 	enum bp_result (*enable_spread_spectrum_on_ppll)(
114 		struct dc_bios *bios,
115 		struct bp_spread_spectrum_parameters *bp_params,
116 		bool enable);
117 	enum bp_result (*program_crtc_timing)(
118 		struct dc_bios *bios,
119 		struct bp_hw_crtc_timing_parameters *bp_params);
120 	enum bp_result (*program_display_engine_pll)(
121 		struct dc_bios *bios,
122 		struct bp_pixel_clock_parameters *bp_params);
123 	enum bp_result (*enable_disp_power_gating)(
124 		struct dc_bios *bios,
125 		enum controller_id controller_id,
126 		enum bp_pipe_control_action action);
127 
128 	void (*bios_parser_destroy)(struct dc_bios **dcb);
129 
130 	enum bp_result (*get_board_layout_info)(
131 		struct dc_bios *dcb,
132 		struct board_layout_info *board_layout_info);
133 	uint16_t (*pack_data_tables)(
134 		struct dc_bios *dcb,
135 		void *dst);
136 
137 	enum bp_result (*get_atom_dc_golden_table)(
138 			struct dc_bios *dcb);
139 
140 	enum bp_result (*enable_lvtma_control)(
141 		struct dc_bios *bios,
142 		uint8_t uc_pwr_on,
143 		uint8_t pwrseq_instance,
144 		uint8_t bypass_panel_control_wait);
145 
146 	enum bp_result (*get_soc_bb_info)(
147 		struct dc_bios *dcb,
148 		struct bp_soc_bb_info *soc_bb_info);
149 
150 	enum bp_result (*get_disp_connector_caps_info)(
151 			struct dc_bios *dcb,
152 			struct graphics_object_id object_id,
153 			struct bp_disp_connector_caps_info *info);
154 	enum bp_result (*get_lttpr_caps)(
155 			struct dc_bios *dcb,
156 			uint8_t *dce_caps);
157 	enum bp_result (*get_lttpr_interop)(
158 			struct dc_bios *dcb,
159 			uint8_t *dce_caps);
160 
161 	enum bp_result (*get_connector_speed_cap_info)(
162 		struct dc_bios *bios,
163 		struct graphics_object_id object_id,
164 		struct bp_connector_speed_cap_info *info);
165 };
166 
167 struct bios_registers {
168 	uint32_t BIOS_SCRATCH_3;
169 	uint32_t BIOS_SCRATCH_6;
170 };
171 
172 struct dc_bios {
173 	const struct dc_vbios_funcs *funcs;
174 
175 	uint8_t *bios;
176 	uint32_t bios_size;
177 
178 	uint8_t *bios_local_image;
179 
180 	struct dc_context *ctx;
181 	const struct bios_registers *regs;
182 	struct integrated_info *integrated_info;
183 	struct dc_firmware_info fw_info;
184 	bool fw_info_valid;
185 	struct dc_vram_info vram_info;
186 	struct bp_soc_bb_info bb_info;
187 	struct dc_golden_table golden_table;
188 };
189 
190 #endif /* DC_BIOS_TYPES_H */
191