Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/tgl: Add HBR and HBR2+ voltage swing table

As latest update we have now 2 voltage swing tables for DP over DKL
PHY with only one difference in Level 0 pre-emphasis 3.
So with 2 tables for DP is time to have one single function to return
all DKL voltage swing tables.

BSpec: 49292
Cc: Khaled Almahallawy <khaled.almahallawy@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Tested-by: Khaled Almahallawy <khaled.almahallawy@intel.com>
Reviewed-by: Khaled Almahallawy<khaled.almahallawy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200602205424.138143-1-jose.souza@intel.com

+42 -8
+42 -8
drivers/gpu/drm/i915/display/intel_ddi.c
··· 641 641 { 0x7, 0x0, 0x00 }, /* 0 0 400mV 0 dB */ 642 642 { 0x5, 0x0, 0x05 }, /* 0 1 400mV 3.5 dB */ 643 643 { 0x2, 0x0, 0x0B }, /* 0 2 400mV 6 dB */ 644 + { 0x0, 0x0, 0x18 }, /* 0 3 400mV 9.5 dB */ 645 + { 0x5, 0x0, 0x00 }, /* 1 0 600mV 0 dB */ 646 + { 0x2, 0x0, 0x08 }, /* 1 1 600mV 3.5 dB */ 647 + { 0x0, 0x0, 0x14 }, /* 1 2 600mV 6 dB */ 648 + { 0x2, 0x0, 0x00 }, /* 2 0 800mV 0 dB */ 649 + { 0x0, 0x0, 0x0B }, /* 2 1 800mV 3.5 dB */ 650 + { 0x0, 0x0, 0x00 }, /* 3 0 1200mV 0 dB HDMI default */ 651 + }; 652 + 653 + static const struct tgl_dkl_phy_ddi_buf_trans tgl_dkl_phy_dp_ddi_trans_hbr2[] = { 654 + /* VS pre-emp Non-trans mV Pre-emph dB */ 655 + { 0x7, 0x0, 0x00 }, /* 0 0 400mV 0 dB */ 656 + { 0x5, 0x0, 0x05 }, /* 0 1 400mV 3.5 dB */ 657 + { 0x2, 0x0, 0x0B }, /* 0 2 400mV 6 dB */ 644 658 { 0x0, 0x0, 0x19 }, /* 0 3 400mV 9.5 dB */ 645 659 { 0x5, 0x0, 0x00 }, /* 1 0 600mV 0 dB */ 646 660 { 0x2, 0x0, 0x08 }, /* 1 1 600mV 3.5 dB */ ··· 1042 1028 return tgl_combo_phy_ddi_translations_dp_hbr; 1043 1029 } 1044 1030 1031 + static const struct tgl_dkl_phy_ddi_buf_trans * 1032 + tgl_get_dkl_buf_trans(struct drm_i915_private *dev_priv, int type, int rate, 1033 + int *n_entries) 1034 + { 1035 + if (type == INTEL_OUTPUT_HDMI) { 1036 + *n_entries = ARRAY_SIZE(tgl_dkl_phy_hdmi_ddi_trans); 1037 + return tgl_dkl_phy_hdmi_ddi_trans; 1038 + } else if (rate > 270000) { 1039 + *n_entries = ARRAY_SIZE(tgl_dkl_phy_dp_ddi_trans_hbr2); 1040 + return tgl_dkl_phy_dp_ddi_trans_hbr2; 1041 + } 1042 + 1043 + *n_entries = ARRAY_SIZE(tgl_dkl_phy_dp_ddi_trans); 1044 + return tgl_dkl_phy_dp_ddi_trans; 1045 + } 1046 + 1045 1047 static int intel_ddi_hdmi_level(struct intel_encoder *encoder) 1046 1048 { 1047 1049 struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); ··· 1069 1039 tgl_get_combo_buf_trans(dev_priv, INTEL_OUTPUT_HDMI, 1070 1040 0, &n_entries); 1071 1041 else 1072 - n_entries = ARRAY_SIZE(tgl_dkl_phy_hdmi_ddi_trans); 1042 + tgl_get_dkl_buf_trans(dev_priv, INTEL_OUTPUT_HDMI, 0, 1043 + &n_entries); 1073 1044 default_entry = n_entries - 1; 1074 1045 } else if (INTEL_GEN(dev_priv) == 11) { 1075 1046 if (intel_phy_is_combo(dev_priv, phy)) ··· 2153 2122 tgl_get_combo_buf_trans(dev_priv, encoder->type, 2154 2123 intel_dp->link_rate, &n_entries); 2155 2124 else 2156 - n_entries = ARRAY_SIZE(tgl_dkl_phy_dp_ddi_trans); 2125 + tgl_get_dkl_buf_trans(dev_priv, encoder->type, 2126 + intel_dp->link_rate, &n_entries); 2157 2127 } else if (INTEL_GEN(dev_priv) == 11) { 2158 2128 if (IS_ELKHARTLAKE(dev_priv)) 2159 2129 ehl_get_combo_buf_trans(dev_priv, encoder->type, ··· 2621 2589 enum tc_port tc_port = intel_port_to_tc(dev_priv, encoder->port); 2622 2590 const struct tgl_dkl_phy_ddi_buf_trans *ddi_translations; 2623 2591 u32 n_entries, val, ln, dpcnt_mask, dpcnt_val; 2592 + int rate = 0; 2624 2593 2625 - if (encoder->type == INTEL_OUTPUT_HDMI) { 2626 - n_entries = ARRAY_SIZE(tgl_dkl_phy_hdmi_ddi_trans); 2627 - ddi_translations = tgl_dkl_phy_hdmi_ddi_trans; 2628 - } else { 2629 - n_entries = ARRAY_SIZE(tgl_dkl_phy_dp_ddi_trans); 2630 - ddi_translations = tgl_dkl_phy_dp_ddi_trans; 2594 + if (encoder->type != INTEL_OUTPUT_HDMI) { 2595 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 2596 + 2597 + rate = intel_dp->link_rate; 2631 2598 } 2599 + 2600 + ddi_translations = tgl_get_dkl_buf_trans(dev_priv, encoder->type, rate, 2601 + &n_entries); 2632 2602 2633 2603 if (level >= n_entries) 2634 2604 level = n_entries - 1;