1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2020 Intel Corporation
4  */
5 
6 #ifndef _INTEL_DDI_BUF_TRANS_H_
7 #define _INTEL_DDI_BUF_TRANS_H_
8 
9 #include <linux/types.h>
10 
11 struct drm_i915_private;
12 struct intel_encoder;
13 struct intel_crtc_state;
14 
15 struct ddi_buf_trans {
16 	u32 trans1;	/* balance leg enable, de-emph level */
17 	u32 trans2;	/* vref sel, vswing */
18 	u8 i_boost;	/* SKL: I_boost; valid: 0x0, 0x1, 0x3, 0x7 */
19 };
20 
21 struct bxt_ddi_buf_trans {
22 	u8 margin;	/* swing value */
23 	u8 scale;	/* scale value */
24 	u8 enable;	/* scale enable */
25 	u8 deemphasis;
26 };
27 
28 struct cnl_ddi_buf_trans {
29 	u8 dw2_swing_sel;
30 	u8 dw7_n_scalar;
31 	u8 dw4_cursor_coeff;
32 	u8 dw4_post_cursor_2;
33 	u8 dw4_post_cursor_1;
34 };
35 
36 struct icl_mg_phy_ddi_buf_trans {
37 	u32 cri_txdeemph_override_11_6;
38 	u32 cri_txdeemph_override_5_0;
39 	u32 cri_txdeemph_override_17_12;
40 };
41 
42 struct tgl_dkl_phy_ddi_buf_trans {
43 	u32 dkl_vswing_control;
44 	u32 dkl_preshoot_control;
45 	u32 dkl_de_emphasis_control;
46 };
47 
48 bool is_hobl_buf_trans(const struct cnl_ddi_buf_trans *table);
49 
50 int intel_ddi_hdmi_num_entries(struct intel_encoder *encoder,
51 			       const struct intel_crtc_state *crtc_state,
52 			       int *default_entry);
53 
54 const struct ddi_buf_trans *
55 intel_ddi_get_buf_trans_edp(struct intel_encoder *encoder, int *n_entries);
56 const struct ddi_buf_trans *
57 intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv,
58 			    int *n_entries);
59 const struct ddi_buf_trans *
60 intel_ddi_get_buf_trans_hdmi(struct intel_encoder *encoder,
61 			     int *n_entries);
62 const struct ddi_buf_trans *
63 intel_ddi_get_buf_trans_dp(struct intel_encoder *encoder, int *n_entries);
64 
65 const struct bxt_ddi_buf_trans *
66 bxt_get_buf_trans(struct intel_encoder *encoder,
67 		  const struct intel_crtc_state *crtc_state,
68 		  int *n_entries);
69 
70 const struct tgl_dkl_phy_ddi_buf_trans *
71 adlp_get_dkl_buf_trans(struct intel_encoder *encoder,
72 		       const struct intel_crtc_state *crtc_state,
73 		       int *n_entries);
74 const struct cnl_ddi_buf_trans *
75 tgl_get_combo_buf_trans(struct intel_encoder *encoder,
76 			const struct intel_crtc_state *crtc_state,
77 			int *n_entries);
78 const struct tgl_dkl_phy_ddi_buf_trans *
79 tgl_get_dkl_buf_trans(struct intel_encoder *encoder,
80 		      const struct intel_crtc_state *crtc_state,
81 		      int *n_entries);
82 const struct cnl_ddi_buf_trans *
83 jsl_get_combo_buf_trans(struct intel_encoder *encoder,
84 			const struct intel_crtc_state *crtc_state,
85 			int *n_entries);
86 const struct cnl_ddi_buf_trans *
87 ehl_get_combo_buf_trans(struct intel_encoder *encoder,
88 			const struct intel_crtc_state *crtc_state,
89 			int *n_entries);
90 const struct cnl_ddi_buf_trans *
91 icl_get_combo_buf_trans(struct intel_encoder *encoder,
92 			const struct intel_crtc_state *crtc_state,
93 			int *n_entries);
94 const struct icl_mg_phy_ddi_buf_trans *
95 icl_get_mg_buf_trans(struct intel_encoder *encoder,
96 		     const struct intel_crtc_state *crtc_state,
97 		     int *n_entries);
98 
99 const struct cnl_ddi_buf_trans *
100 cnl_get_buf_trans(struct intel_encoder *encoder,
101 		  const struct intel_crtc_state *crtc_state,
102 		  int *n_entries);
103 
104 #endif
105