xref: /linux/drivers/gpu/drm/i915/display/intel_bios.h (revision 07fdad3a93756b872da7b53647715c48d0f4a2d0)
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 bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata);
77 bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata);
78 bool intel_bios_encoder_supports_dp(const struct intel_bios_encoder_data *devdata);
79 bool intel_bios_encoder_supports_edp(const struct intel_bios_encoder_data *devdata);
80 bool intel_bios_encoder_supports_typec_usb(const struct intel_bios_encoder_data *devdata);
81 bool intel_bios_encoder_supports_tbt(const struct intel_bios_encoder_data *devdata);
82 bool intel_bios_encoder_supports_dsi(const struct intel_bios_encoder_data *devdata);
83 bool intel_bios_encoder_supports_dp_dual_mode(const struct intel_bios_encoder_data *devdata);
84 bool intel_bios_encoder_is_lspcon(const struct intel_bios_encoder_data *devdata);
85 bool intel_bios_encoder_lane_reversal(const struct intel_bios_encoder_data *devdata);
86 bool intel_bios_encoder_hpd_invert(const struct intel_bios_encoder_data *devdata);
87 enum port intel_bios_encoder_port(const struct intel_bios_encoder_data *devdata);
88 bool intel_bios_encoder_reject_edp_rate(const struct intel_bios_encoder_data *devdata,
89 					int rate);
90 enum aux_ch intel_bios_dp_aux_ch(const struct intel_bios_encoder_data *devdata);
91 int intel_bios_dp_boost_level(const struct intel_bios_encoder_data *devdata);
92 int intel_bios_dp_max_lane_count(const struct intel_bios_encoder_data *devdata);
93 int intel_bios_dp_max_link_rate(const struct intel_bios_encoder_data *devdata);
94 bool intel_bios_dp_has_shared_aux_ch(const struct intel_bios_encoder_data *devdata);
95 int intel_bios_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
96 int intel_bios_hdmi_ddc_pin(const struct intel_bios_encoder_data *devdata);
97 int intel_bios_hdmi_level_shift(const struct intel_bios_encoder_data *devdata);
98 int intel_bios_hdmi_max_tmds_clock(const struct intel_bios_encoder_data *devdata);
99 
100 void intel_bios_for_each_encoder(struct intel_display *display,
101 				 void (*func)(struct intel_display *display,
102 					      const struct intel_bios_encoder_data *devdata));
103 
104 void intel_bios_debugfs_register(struct intel_display *display);
105 
106 #endif /* _INTEL_BIOS_H_ */
107