1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5 
6 #ifndef __INTEL_HDMI_H__
7 #define __INTEL_HDMI_H__
8 
9 #include <linux/types.h>
10 
11 enum hdmi_infoframe_type;
12 enum intel_output_format;
13 enum port;
14 struct drm_connector;
15 struct drm_connector_state;
16 struct drm_encoder;
17 struct drm_i915_private;
18 struct intel_connector;
19 struct intel_crtc_state;
20 struct intel_digital_port;
21 struct intel_encoder;
22 struct intel_hdmi;
23 union hdmi_infoframe;
24 
25 void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
26 			       struct intel_connector *intel_connector);
27 bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder,
28 				      const struct intel_crtc_state *crtc_state,
29 				      const struct drm_connector_state *conn_state);
30 int intel_hdmi_compute_config(struct intel_encoder *encoder,
31 			      struct intel_crtc_state *pipe_config,
32 			      struct drm_connector_state *conn_state);
33 void intel_hdmi_encoder_shutdown(struct intel_encoder *encoder);
34 bool intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
35 				       struct drm_connector *connector,
36 				       bool high_tmds_clock_ratio,
37 				       bool scrambling);
38 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
39 void intel_infoframe_init(struct intel_digital_port *dig_port);
40 u32 intel_hdmi_infoframes_enabled(struct intel_encoder *encoder,
41 				  const struct intel_crtc_state *crtc_state);
42 u32 intel_hdmi_infoframe_enable(unsigned int type);
43 void intel_hdmi_read_gcp_infoframe(struct intel_encoder *encoder,
44 				   struct intel_crtc_state *crtc_state);
45 void intel_read_infoframe(struct intel_encoder *encoder,
46 			  const struct intel_crtc_state *crtc_state,
47 			  enum hdmi_infoframe_type type,
48 			  union hdmi_infoframe *frame);
49 bool intel_hdmi_limited_color_range(const struct intel_crtc_state *crtc_state,
50 				    const struct drm_connector_state *conn_state);
51 bool intel_hdmi_bpc_possible(const struct intel_crtc_state *crtc_state,
52 			     int bpc, bool has_hdmi_sink);
53 int intel_hdmi_tmds_clock(int clock, int bpc, enum intel_output_format sink_format);
54 int intel_hdmi_dsc_get_bpp(int src_fractional_bpp, int slice_width,
55 			   int num_slices, int output_format, bool hdmi_all_bpp,
56 			   int hdmi_max_chunk_bytes);
57 int intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state,
58 				  int src_max_slices, int src_max_slice_width,
59 				  int hdmi_max_slices, int hdmi_throughput);
60 int intel_hdmi_dsc_get_slice_height(int vactive);
61 struct drm_i915_private *intel_hdmi_to_i915(struct intel_hdmi *intel_hdmi);
62 
63 #endif /* __INTEL_HDMI_H__ */
64