<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Jani Nikula <jani.nikula@linux.intel.com><br>
<b>Sent:</b> Monday, September 28, 2020 7:13 PM<br>
<b>To:</b> Surendrakumar Upadhyay, TejaskumarX <tejaskumarx.surendrakumar.upadhyay@intel.com>; Vivi, Rodrigo <rodrigo.vivi@intel.com>; airlied@linux.ie <airlied@linux.ie>; daniel@ffwll.ch <daniel@ffwll.ch>; intel-gfx@lists.freedesktop.org <intel-gfx@lists.freedesktop.org>;
 dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; Ausmus, James <james.ausmus@intel.com>; Roper, Matthew D <matthew.d.roper@intel.com>; Souza, Jose <jose.souza@intel.com>; ville.syrjala@linux.intel.com
 <ville.syrjala@linux.intel.com>; De Marchi, Lucas <lucas.demarchi@intel.com>; Pandey, Hariom <hariom.pandey@intel.com><br>
<b>Subject:</b> Re: [Intel-gfx] [PATCH 2/2] drm/i915/edp/jsl: Update vswing table for HBR and HBR2</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">On Mon, 28 Sep 2020, Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com> wrote:<br>
> JSL has update in vswing table for eDP<br>
<br>
I've thought the TLA for Jasper Lake is JSP, not JSL. At least we have<br>
PCH_JSP for Jasper Lake PCH.<br>
<br>
><br>
> BSpec: 21257<br>
> Signed-off-by: Tejas Upadhyay <tejaskumarx.surendrakumar.upadhyay@intel.com><br>
> ---<br>
>  drivers/gpu/drm/i915/display/intel_ddi.c | 67 ++++++++++++++++++++++--<br>
>  1 file changed, 64 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c<br>
> index 4d06178cd76c..fa08463bcf2e 100644<br>
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c<br>
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c<br>
> @@ -582,6 +582,34 @@ static const struct cnl_ddi_buf_trans ehl_combo_phy_ddi_translations_dp[] = {<br>
>        { 0x6, 0x7F, 0x3F, 0x00, 0x00 },        /* 900   900      0.0   */<br>
>  };<br>
>  <br>
> +static const struct cnl_ddi_buf_trans jsl_combo_phy_ddi_translations_edp_hbr[] = {<br>
> +                                             /* NT mV Trans mV db    */<br>
> +     { 0x8, 0x7F, 0x3F, 0x00, 0x00 },        /* 200   200      0.0   */<br>
> +     { 0x8, 0x7F, 0x38, 0x00, 0x07 },        /* 200   250      1.9   */<br>
> +     { 0x1, 0x7F, 0x33, 0x00, 0x0C },        /* 200   300      3.5   */<br>
> +     { 0xA, 0x35, 0x36, 0x00, 0x09 },        /* 200   350      4.9   */<br>
> +     { 0x8, 0x7F, 0x3F, 0x00, 0x00 },        /* 250   250      0.0   */<br>
> +     { 0x1, 0x7F, 0x38, 0x00, 0x07 },        /* 250   300      1.6   */<br>
> +     { 0xA, 0x35, 0x35, 0x00, 0x0A },        /* 250   350      2.9   */<br>
> +     { 0x1, 0x7F, 0x3F, 0x00, 0x00 },        /* 300   300      0.0   */<br>
> +     { 0xA, 0x35, 0x38, 0x00, 0x07 },        /* 300   350      1.3   */<br>
> +     { 0xA, 0x35, 0x3F, 0x00, 0x00 },        /* 350   350      0.0   */<br>
> +};<br>
> +<br>
> +static const struct cnl_ddi_buf_trans jsl_combo_phy_ddi_translations_edp_hbr2[] = {<br>
> +                                             /* NT mV Trans mV db    */<br>
> +     { 0x8, 0x7F, 0x3F, 0x00, 0x00 },        /* 200   200      0.0   */<br>
> +     { 0x8, 0x7F, 0x3F, 0x00, 0x00 },        /* 200   250      1.9   */<br>
> +     { 0x1, 0x7F, 0x3D, 0x00, 0x02 },        /* 200   300      3.5   */<br>
> +     { 0xA, 0x35, 0x38, 0x00, 0x07 },        /* 200   350      4.9   */<br>
> +     { 0x8, 0x7F, 0x3F, 0x00, 0x00 },        /* 250   250      0.0   */<br>
> +     { 0x1, 0x7F, 0x3F, 0x00, 0x00 },        /* 250   300      1.6   */<br>
> +     { 0xA, 0x35, 0x3A, 0x00, 0x05 },        /* 250   350      2.9   */<br>
> +     { 0x1, 0x7F, 0x3F, 0x00, 0x00 },        /* 300   300      0.0   */<br>
> +     { 0xA, 0x35, 0x38, 0x00, 0x07 },        /* 300   350      1.3   */<br>
> +     { 0xA, 0x35, 0x3F, 0x00, 0x00 },        /* 350   350      0.0   */<br>
> +};<br>
> +<br>
>  struct icl_mg_phy_ddi_buf_trans {<br>
>        u32 cri_txdeemph_override_11_6;<br>
>        u32 cri_txdeemph_override_5_0;<br>
> @@ -1069,7 +1097,6 @@ icl_get_mg_buf_trans(struct intel_encoder *encoder, int type, int rate,<br>
>        *n_entries = ARRAY_SIZE(icl_mg_phy_ddi_translations_rbr_hbr);<br>
>        return icl_mg_phy_ddi_translations_rbr_hbr;<br>
>  }<br>
> -<br>
>  static const struct cnl_ddi_buf_trans *<br>
>  ehl_get_combo_buf_trans(struct intel_encoder *encoder, int type, int rate,<br>
>                        int *n_entries)<br>
> @@ -1098,6 +1125,34 @@ ehl_get_combo_buf_trans(struct intel_encoder *encoder, int type, int rate,<br>
>        }<br>
>  }<br>
>  <br>
> +static const struct cnl_ddi_buf_trans *<br>
> +jsl_get_combo_buf_trans(struct intel_encoder *encoder, int type, int rate,<br>
> +                     int *n_entries)<br>
> +{<br>
> +     struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);<br>
> +<br>
> +     switch (type) {<br>
> +     case INTEL_OUTPUT_HDMI:<br>
> +             *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_hdmi);<br>
> +             return icl_combo_phy_ddi_translations_hdmi;<br>
> +     case INTEL_OUTPUT_EDP:<br>
> +             if (dev_priv->vbt.edp.low_vswing) {<br>
> +                     if (rate > 270000) {<br>
> +                             *n_entries = ARRAY_SIZE(jsl_combo_phy_ddi_translations_edp_hbr2);<br>
> +                             return jsl_combo_phy_ddi_translations_edp_hbr2;<br>
> +                     } else {<br>
> +                             *n_entries = ARRAY_SIZE(jsl_combo_phy_ddi_translations_edp_hbr);<br>
> +                             return jsl_combo_phy_ddi_translations_edp_hbr;<br>
> +                     }<br>
> +             }<br>
> +             /* fall through */<br>
> +     default:<br>
> +             /* All combo DP and eDP ports that do not support low_vswing */<br>
> +             *n_entries = ARRAY_SIZE(icl_combo_phy_ddi_translations_dp_hbr2);<br>
> +             return icl_combo_phy_ddi_translations_dp_hbr2;<br>
> +     }<br>
> +}<br>
> +<br>
>  static const struct cnl_ddi_buf_trans *<br>
>  tgl_get_combo_buf_trans(struct intel_encoder *encoder, int type, int rate,<br>
>                        int *n_entries)<br>
> @@ -2265,9 +2320,12 @@ static u8 intel_ddi_dp_voltage_max(struct intel_dp *intel_dp)<br>
>                        tgl_get_dkl_buf_trans(encoder, encoder->type,<br>
>                                              intel_dp->link_rate, &n_entries);<br>
>        } else if (INTEL_GEN(dev_priv) == 11) {<br>
> -             if (IS_ELKHARTLAKE(dev_priv))<br>
> +             if (IS_JASPERLAKE(dev_priv))<br>
> +                     jsl_get_combo_buf_trans(encoder, encoder->type,<br>
> +                                     intel_dp->link_rate, &n_entries);<br>
> +             else if (IS_ELKHARTLAKE(dev_priv))<br>
>                        ehl_get_combo_buf_trans(encoder, encoder->type,<br>
> -                                             intel_dp->link_rate, &n_entries);<br>
> +                                     intel_dp->link_rate, &n_entries);<br>
<br>
This is a good example of a potential trap that having IS_ELKHARTLAKE()<br>
cover both ELK and JSP creates. An unsuspecting coder might change the<br>
if ladder to have IS_ELKHARTLAKE() first, and the subsequent<br>
IS_JASPERLAKE() branch would never be taken.<br>
<br>
BR,<br>
Jani.<br>
<br>
Tejas : In that case I will put attention note in comment about platform checks such that ladder distrubance can be avoided. What you suggest?</div>
<div class="PlainText"> <br>
>                else if (intel_phy_is_combo(dev_priv, phy))<br>
>                        icl_get_combo_buf_trans(encoder, encoder->type,<br>
>                                                intel_dp->link_rate, &n_entries);<br>
> @@ -2454,6 +2512,9 @@ static void icl_ddi_combo_vswing_program(struct intel_encoder *encoder,<br>
>        if (INTEL_GEN(dev_priv) >= 12)<br>
>                ddi_translations = tgl_get_combo_buf_trans(encoder, type, rate,<br>
>                                                           &n_entries);<br>
> +     else if (IS_JASPERLAKE(dev_priv))<br>
> +             ddi_translations = jsl_get_combo_buf_trans(encoder, type, rate,<br>
> +                                                        &n_entries);<br>
>        else if (IS_ELKHARTLAKE(dev_priv))<br>
>                ddi_translations = ehl_get_combo_buf_trans(encoder, type, rate,<br>
>                                                           &n_entries);<br>
<br>
-- <br>
Jani Nikula, Intel Open Source Graphics Center<br>
</div>
</span></font></div>
</body>
</html>