xref: /linux/drivers/gpu/drm/i915/display/intel_bios.h (revision 20bed0d6ff62d985fe8222958825504b8aad4e88)
1 /*
2  * Copyright © 2016-2019 Intel Corporation
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 (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  */
23 
24 /*
25  * Please use intel_vbt_defs.h for VBT private data, to hide and abstract away
26  * the VBT from the rest of the driver. Add the parsed, clean data to struct
27  * intel_vbt_data within struct intel_display.
28  */
29 
30 #ifndef _INTEL_BIOS_H_
31 #define _INTEL_BIOS_H_
32 
33 #include <linux/types.h>
34 
35 struct drm_edid;
36 struct intel_bios_encoder_data;
37 struct intel_crtc_state;
38 struct intel_display;
39 struct intel_encoder;
40 struct intel_panel;
41 enum aux_ch;
42 enum port;
43 
44 enum intel_backlight_type {
45 	INTEL_BACKLIGHT_PMIC,
46 	INTEL_BACKLIGHT_LPSS,
47 	INTEL_BACKLIGHT_DISPLAY_DDI,
48 	INTEL_BACKLIGHT_DSI_DCS,
49 	INTEL_BACKLIGHT_PANEL_DRIVER_INTERFACE,
50 	INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE,
51 };
52 
53 void intel_bios_init(struct intel_display *display);
54 void intel_bios_init_panel_early(struct intel_display *display,
55 				 struct intel_panel *panel,
56 				 const struct intel_bios_encoder_data *devdata);
57 void intel_bios_init_panel_late(struct intel_display *display,
58 				struct intel_panel *panel,
59 				const struct intel_bios_encoder_data *devdata,
60 				const struct drm_edid *drm_edid);
61 void intel_bios_fini_panel(struct intel_panel *panel);
62 void intel_bios_driver_remove(struct intel_display *display);
63 bool intel_bios_is_valid_vbt(struct intel_display *display,
64 			     const void *buf, size_t size);
65 bool intel_bios_is_tv_present(struct intel_display *display);
66 bool intel_bios_is_lvds_present(struct intel_display *display, u8 *i2c_pin);
67 bool intel_bios_is_port_present(struct intel_display *display, enum port port);
68 bool intel_bios_is_dsi_present(struct intel_display *display, enum port *port);
69 bool intel_bios_get_dsc_params(struct intel_encoder *encoder,
70 			       struct intel_crtc_state *crtc_state,
71 			       int dsc_max_bpc);
72 
73 const struct intel_bios_encoder_data *
74 intel_bios_encoder_data_lookup(struct intel_display *display, enum port port);
75 
76 const struct intel_ddi_buf_trans *
77 intel_bios_get_c20_vspeo(const struct intel_bios_encoder_data *devdata,
78 			 bool has_dp, bool is_uhbr);
79 const struct intel_ddi_buf_trans *
80 intel_bios_get_c10_vspeo(const struct intel_bios_encoder_data *devdata,
81 			 bool has_dp, int port_clock, bool has_edp);
82 const struct intel_ddi_buf_trans *
83 intel_bios_get_ehl_combo_vspeo(const struct intel_bios_encoder_data *devdata,
84 			       bool has_dp, int port_clock, bool low_vswing_edp);
85 const struct intel_ddi_buf_trans *
86 intel_bios_get_jsl_combo_vspeo(const struct intel_bios_encoder_data *devdata,
87 			       bool has_dp, int port_clock, bool low_vswing_edp);
88 
89 bool intel_bios_encoder_requests_vspeo(const struct intel_bios_encoder_data *devdata);
90 bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
91 bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
92 bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
93 bool intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata);
94 bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata);
95 bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata);
96 bool intel_bios_encoder_is_dedicated_external(const struct intel_bios_encoder_data *devdata);
97 bool intel_bios_encoder_supports_dyn_port_over_tc(const struct intel_bios_encoder_data *devdata);
98 bool intel_bios_encoder_supports_dsi(const struct intel_bios_encoder_data *devdata);
99 bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata);
100 bool intel_bios_encoder_is_lspcon(const struct intel_bios_encoder_data *devdata);
101 bool intel_bios_encoder_lane_reversal(const struct intel_bios_encoder_data *devdata);
102 bool intel_bios_encoder_hpd_invert(const struct intel_bios_encoder_data *devdata);
103 enum port intel_bios_encoder_port(const struct intel_bios_encoder_data *devdata);
104 bool intel_bios_encoder_reject_edp_rate(const struct intel_bios_encoder_data *devdata,
105 					int rate);
106 enum aux_ch intel_bios_dp_aux_ch(const struct intel_bios_encoder_data *devdata);
107 int intel_bios_dp_boost_level(const struct intel_bios_encoder_data *devdata);
108 int intel_bios_dp_max_lane_count(const struct intel_bios_encoder_data *devdata);
109 int intel_bios_dp_max_link_rate(const struct intel_bios_encoder_data *devdata);
110 bool intel_bios_dp_has_shared_aux_ch(const struct intel_bios_encoder_data *devdata);
111 int intel_bios_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
112 int intel_bios_hdmi_ddc_pin(const struct intel_bios_encoder_data *devdata);
113 int intel_bios_hdmi_level_shift(const struct intel_bios_encoder_data *devdata);
114 int intel_bios_hdmi_max_tmds_clock(const struct intel_bios_encoder_data *devdata);
115 
116 void intel_bios_for_each_encoder(struct intel_display *display,
117 				 void (*func)(struct intel_display *display,
118 					      const struct intel_bios_encoder_data *devdata));
119 
120 void intel_bios_debugfs_register(struct intel_display *display);
121 
122 #endif /* _INTEL_BIOS_H_ */
123