<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.contentpasted2
        {mso-style-name:contentpasted2;}
span.contentpasted1
        {mso-style-name:contentpasted1;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-IE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> Taylor, Clinton A <clinton.a.taylor@intel.com>
<br>
<b>Sent:</b> Monday, October 31, 2022 10:29 PM<br>
<b>To:</b> Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Sripada, Radhakrishna <radhakrishna.sripada@intel.com>; Deak, Imre <imre.deak@intel.com>; Shankar, Uma <uma.shankar@intel.com><br>
<b>Subject:</b> Re: [PATCH 06/20] drm/i915/mtl: Add vswing programming for C10 phys<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">to fix the FIXME in i<span class="contentpasted2"><span style="background:white">ntel_cx0_phy_set_signal_levels() </span></span>we need the following patch snipet to be
 incorporated into this patch.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">@@ -331,18 +331,14 @@ void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,
<o:p></o:p></span></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">            }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">      }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-     intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-                 C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">+     intel_cx0_write(i915, encoder->port, !master_lane, PHY_C10_VDR_CONTROL(1),<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">+                 C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">                  MB_WRITE_COMMITTED);<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-#if 0<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-     /*<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-      * FIXME: Revisit this code to see why we can't update<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-      * config on Lane 1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-      */<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-     intel_cx0_rmw(i915, encoder->port, !master_lane, PHY_C10_VDR_CONTROL(1),<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-                 C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG, C10_VDR_CTRL_UPDATE_CFG,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">+<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">+     intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">+                 C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">                  MB_WRITE_COMMITTED);<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">-#endif<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">+<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black">      intel_cx0_phy_transaction_end(encoder, wakeref);<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black"> }<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span class="contentpasted1"><span style="font-size:12.0pt;color:black;background:white">Sorry for the top post - webmail </span></span><span style="font-size:12.0pt;color:black"><o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span class="contentpasted1"><span style="font-size:12.0pt;color:black;background:white">-Clint<o:p></o:p></span></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks Clint! I will add this snippet into v2 version of the C10/C20/TBT patch series.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Cheers,<o:p></o:p></p>
<p class="MsoNormal">Mika<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> Kahola, Mika <<a href="mailto:mika.kahola@intel.com">mika.kahola@intel.com</a>><br>
<b>Sent:</b> Friday, October 14, 2022 5:47 AM<br>
<b>To:</b> <a href="mailto:intel-gfx@lists.freedesktop.org">intel-gfx@lists.freedesktop.org</a> <<a href="mailto:intel-gfx@lists.freedesktop.org">intel-gfx@lists.freedesktop.org</a>><br>
<b>Cc:</b> Kahola, Mika <<a href="mailto:mika.kahola@intel.com">mika.kahola@intel.com</a>>; Sripada, Radhakrishna <<a href="mailto:radhakrishna.sripada@intel.com">radhakrishna.sripada@intel.com</a>>; Deak, Imre <<a href="mailto:imre.deak@intel.com">imre.deak@intel.com</a>>;
 Shankar, Uma <<a href="mailto:uma.shankar@intel.com">uma.shankar@intel.com</a>>; Taylor, Clinton A <<a href="mailto:clinton.a.taylor@intel.com">clinton.a.taylor@intel.com</a>><br>
<b>Subject:</b> [PATCH 06/20] drm/i915/mtl: Add vswing programming for C10 phys</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">From: Radhakrishna Sripada <<a href="mailto:radhakrishna.sripada@intel.com">radhakrishna.sripada@intel.com</a>><br>
<br>
C10 phys uses direct mapping internally for voltage and pre-emphasis levels.<br>
Program the levels directly to the fields in the VDR Registers.<br>
<br>
Bspec: 65449<br>
<br>
Cc: Imre Deak <<a href="mailto:imre.deak@intel.com">imre.deak@intel.com</a>><br>
Cc: Uma Shankar <<a href="mailto:uma.shankar@intel.com">uma.shankar@intel.com</a>><br>
Signed-off-by: Clint Taylor <<a href="mailto:Clinton.A.Taylor@intel.com">Clinton.A.Taylor@intel.com</a>><br>
Signed-off-by: Radhakrishna Sripada <<a href="mailto:radhakrishna.sripada@intel.com">radhakrishna.sripada@intel.com</a>><br>
Signed-off-by: Mika Kahola <<a href="mailto:mika.kahola@intel.com">mika.kahola@intel.com</a>><br>
---<br>
 drivers/gpu/drm/i915/display/intel_cx0_phy.c  | 143 ++++++++++++++++--<br>
 drivers/gpu/drm/i915/display/intel_cx0_phy.h  |   2 +<br>
 .../gpu/drm/i915/display/intel_cx0_reg_defs.h |   6 +<br>
 drivers/gpu/drm/i915/display/intel_ddi.c      |   4 +-<br>
 .../drm/i915/display/intel_ddi_buf_trans.c    |  36 ++++-<br>
 .../drm/i915/display/intel_ddi_buf_trans.h    |   6 +<br>
 .../i915/display/intel_display_power_map.c    |   1 +<br>
 7 files changed, 185 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c<br>
index dc033174c9c0..ef874986940d 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c<br>
@@ -6,10 +6,14 @@<br>
 #include "i915_reg_defs.h"<br>
 #include "intel_cx0_phy.h"<br>
 #include "intel_cx0_reg_defs.h"<br>
+#include "intel_ddi.h"<br>
+#include "intel_ddi_buf_trans.h"<br>
 #include "intel_de.h"<br>
 #include "intel_display_types.h"<br>
 #include "intel_dp.h"<br>
 #include "intel_panel.h"<br>
+#include "intel_psr.h"<br>
+#include "intel_uncore.h"<br>
 <br>
 bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)<br>
 {<br>
@@ -19,6 +23,15 @@ bool intel_is_c10phy(struct drm_i915_private *dev_priv, enum phy phy)<br>
         return false;<br>
 }<br>
 <br>
+static void<br>
+assert_dc_off(struct drm_i915_private *i915)<br>
+{<br>
+       bool enabled;<br>
+<br>
+       enabled = intel_display_power_is_enabled(i915, POWER_DOMAIN_DC_OFF);<br>
+       drm_WARN_ON(&i915->drm, !enabled);<br>
+}<br>
+<br>
 static void intel_cx0_bus_reset(struct drm_i915_private *i915, enum port port, int lane)<br>
 {<br>
         enum phy phy = intel_port_to_phy(i915, port);<br>
@@ -108,6 +121,8 @@ static u8 intel_cx0_read(struct drm_i915_private *i915, enum port port,<br>
         int i, status;<br>
         u32 val;<br>
 <br>
+       assert_dc_off(i915);<br>
+<br>
         for (i = 0; i < 3; i++) {<br>
                 status = __intel_cx0_read(i915, port, lane, addr, &val);<br>
 <br>
@@ -191,6 +206,8 @@ static void __intel_cx0_write(struct drm_i915_private *i915, enum port port,<br>
         enum phy phy = intel_port_to_phy(i915, port);<br>
         int i, status;<br>
 <br>
+       assert_dc_off(i915);<br>
+<br>
         for (i = 0; i < 3; i++) {<br>
                 status = __intel_cx0_write_once(i915, port, lane, addr, data, committed);<br>
 <br>
@@ -240,6 +257,84 @@ static void intel_cx0_rmw(struct drm_i915_private *i915, enum port port,<br>
         }<br>
 }<br>
 <br>
+/*<br>
+ * Prepare HW for CX0 phy transactions.<br>
+ *<br>
+ * It is required that PSR and DC5/6 are disabled before any CX0 message<br>
+ * bus transaction is executed.<br>
+ */<br>
+static intel_wakeref_t intel_cx0_phy_transaction_begin(struct intel_encoder *encoder)<br>
+{<br>
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);<br>
+       struct intel_dp *intel_dp = enc_to_intel_dp(encoder);<br>
+<br>
+       intel_psr_pause(intel_dp);<br>
+       return intel_display_power_get(i915, POWER_DOMAIN_DC_OFF);<br>
+}<br>
+<br>
+static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wakeref_t wakeref)<br>
+{<br>
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);<br>
+       struct intel_dp *intel_dp = enc_to_intel_dp(encoder);<br>
+<br>
+       intel_psr_resume(intel_dp);<br>
+       intel_display_power_put(i915, POWER_DOMAIN_DC_OFF, wakeref);<br>
+}<br>
+<br>
+void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,<br>
+                                    const struct intel_crtc_state *crtc_state)<br>
+{<br>
+       struct drm_i915_private *i915 = to_i915(encoder->base.dev);<br>
+       struct intel_digital_port *dig_port = enc_to_dig_port(encoder);<br>
+       bool lane_reversal = dig_port->saved_port_bits & DDI_BUF_PORT_REVERSAL;<br>
+       u8 master_lane = lane_reversal ? INTEL_CX0_LANE1 :<br>
+                                        INTEL_CX0_LANE0;<br>
+       const struct intel_ddi_buf_trans *trans;<br>
+       intel_wakeref_t wakeref;<br>
+       int n_entries, ln;<br>
+<br>
+       wakeref = intel_cx0_phy_transaction_begin(encoder);<br>
+<br>
+       trans = encoder->get_buf_trans(encoder, crtc_state, &n_entries);<br>
+       if (drm_WARN_ON_ONCE(&i915->drm, !trans))<br>
+               return;<br>
+<br>
+       intel_cx0_rmw(i915, encoder->port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),<br>
+                     0, C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);<br>
+<br>
+       for (ln = 0; ln < 4; ln++) {<br>
+               int level = intel_ddi_level(encoder, crtc_state, ln);<br>
+               int lane, tx;<br>
+<br>
+               lane = ln / 2;<br>
+               tx = ln % 2 + 1;<br>
+<br>
+               intel_cx0_rmw(i915, encoder->port, lane, PHY_CX0_TX_CONTROL(tx, 2),<br>
+                             C10_PHY_VSWING_PREEMPH_MASK,<br>
+                             C10_PHY_VSWING_PREEMPH(trans->entries[level].direct.preemph),<br>
+                             MB_WRITE_COMMITTED);<br>
+               intel_cx0_rmw(i915, encoder->port, lane, PHY_CX0_TX_CONTROL(tx, 8),<br>
+                             C10_PHY_VSWING_LEVEL_MASK,<br>
+                             C10_PHY_VSWING_LEVEL(trans->entries[level].direct.level),<br>
+                             MB_WRITE_COMMITTED);<br>
+       }<br>
+<br>
+       intel_cx0_write(i915, encoder->port, master_lane, PHY_C10_VDR_CONTROL(1),<br>
+                       C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG,<br>
+                       MB_WRITE_COMMITTED);<br>
+#if 0<br>
+       /*<br>
+        * FIXME: Revisit this code to see why we can't update<br>
+        * config on Lane 1<br>
+        */<br>
+       intel_cx0_rmw(i915, encoder->port, !master_lane, PHY_C10_VDR_CONTROL(1),<br>
+                       C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG, C10_VDR_CTRL_UPDATE_CFG,<br>
+                       MB_WRITE_COMMITTED);<br>
+#endif<br>
+<br>
+       intel_cx0_phy_transaction_end(encoder, wakeref);<br>
+}<br>
+<br>
 /*<br>
  * Basic DP link rates with 38.4 MHz reference clock.<br>
  * Note: The tables below are with SSC. In non-ssc<br>
@@ -698,9 +793,12 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,<br>
         u8 lane = lane_reversal ? INTEL_CX0_LANE1 :<br>
                                   INTEL_CX0_LANE0;<br>
         enum phy phy = intel_port_to_phy(i915, encoder->port);<br>
+       intel_wakeref_t wakeref;<br>
         int i;<br>
         u8 cmn, tx0;<br>
 <br>
+       wakeref = intel_cx0_phy_transaction_begin(encoder);<br>
+<br>
         /*<br>
          * According to C10 VDR Register programming Sequence we need<br>
          * to do this to read PHY internal registers from MsgBus.<br>
@@ -719,6 +817,8 @@ void intel_c10mpllb_readout_hw_state(struct intel_encoder *encoder,<br>
                                           C10_CMN0_DP_VAL : C10_CMN0_HDMI_VAL))<br>
                 drm_warn(&i915->drm, "Unexpected tx: %x or cmn: %x for phy: %c.\n",<br>
                          tx0, cmn, phy_name(phy));<br>
+<br>
+       intel_cx0_phy_transaction_end(encoder, wakeref);<br>
 }<br>
 <br>
 static void intel_c10_pll_program(struct drm_i915_private *i915,<br>
@@ -849,17 +949,20 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,<br>
 <br>
         if (intel_crtc_has_dp_encoder(crtc_state)) {<br>
                 intel_dp = enc_to_intel_dp(encoder);<br>
-               ssc_enabled = intel_dp->dpcd[DP_MAX_DOWNSPREAD] &<br>
-                             DP_MAX_DOWNSPREAD_0_5;<br>
+               ssc_enabled = (intel_dp->dpcd[DP_MAX_DOWNSPREAD] &<br>
+                             DP_MAX_DOWNSPREAD_0_5);<br>
+<br>
+               if (intel_dp_is_edp(intel_dp) && !intel_panel_use_ssc(i915))<br>
+                       ssc_enabled = false;<br>
 <br>
                 /* TODO: DP2.0 10G and 20G rates enable MPLLA*/<br>
                 val |= ssc_enabled ? XELPDP_SSC_ENABLE_PLLB : 0;<br>
         }<br>
+<br>
         intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),<br>
-                    XELPDP_LANE1_PHY_CLOCK_SELECT |<br>
-                    XELPDP_FORWARD_CLOCK_UNGATE |<br>
+                    XELPDP_LANE1_PHY_CLOCK_SELECT | XELPDP_FORWARD_CLOCK_UNGATE |<br>
                      XELPDP_DDI_CLOCK_SELECT_MASK |<br>
-                    XELPDP_SSC_ENABLE_PLLB, val);<br>
+                    XELPDP_SSC_ENABLE_PLLA | XELPDP_SSC_ENABLE_PLLB, val);<br>
 }<br>
 <br>
 static u32 intel_cx0_get_powerdown_update(u8 lane)<br>
@@ -986,9 +1089,12 @@ static void intel_c10_program_phy_lane(struct drm_i915_private *i915,<br>
 {<br>
         u8 l0t1, l0t2, l1t1, l1t2;<br>
 <br>
-       intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),<br>
-                     C10_VDR_CTRL_MSGBUS_ACCESS, C10_VDR_CTRL_MSGBUS_ACCESS,<br>
-                     MB_WRITE_COMMITTED);<br>
+       intel_cx0_rmw(i915, port, 1, PHY_C10_VDR_CONTROL(1),<br>
+                     C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,<br>
+                     C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);<br>
+       intel_cx0_rmw(i915, port, 0, PHY_C10_VDR_CONTROL(1),<br>
+                     C10_VDR_CTRL_MSGBUS_ACCESS | C10_VDR_CTRL_UPDATE_CFG,<br>
+                     C10_VDR_CTRL_MASTER_LANE  | C10_VDR_CTRL_MSGBUS_ACCESS, MB_WRITE_COMMITTED);<br>
 <br>
         l0t1 = intel_cx0_read(i915, port, 0, PHY_CX0_TX_CONTROL(1, 2));<br>
         l0t2 = intel_cx0_read(i915, port, 0, PHY_CX0_TX_CONTROL(2, 2));<br>
@@ -1039,8 +1145,12 @@ static void intel_c10_program_phy_lane(struct drm_i915_private *i915,<br>
                 }<br>
         }<br>
 <br>
-       intel_cx0_rmw(i915, port, INTEL_CX0_BOTH_LANES, PHY_C10_VDR_CONTROL(1),<br>
-                     C10_VDR_CTRL_UPDATE_CFG, C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);<br>
+       intel_cx0_rmw(i915, port, 1, PHY_C10_VDR_CONTROL(1),<br>
+                     C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS,<br>
+                     C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);<br>
+       intel_cx0_rmw(i915, port, 0, PHY_C10_VDR_CONTROL(1),<br>
+                     C10_VDR_CTRL_UPDATE_CFG | C10_VDR_CTRL_MSGBUS_ACCESS,<br>
+                     C10_VDR_CTRL_MASTER_LANE | C10_VDR_CTRL_UPDATE_CFG, MB_WRITE_COMMITTED);<br>
 }<br>
 <br>
 static u32 intel_cx0_get_pclk_pll_request(u8 lane)<br>
@@ -1138,9 +1248,14 @@ void intel_cx0pll_enable(struct intel_encoder *encoder,<br>
 {<br>
         struct drm_i915_private *i915 = to_i915(encoder->base.dev);<br>
         enum phy phy = intel_port_to_phy(i915, encoder->port);<br>
+       intel_wakeref_t wakeref;<br>
+<br>
+       wakeref = intel_cx0_phy_transaction_begin(encoder);<br>
 <br>
         drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));<br>
         intel_c10pll_enable(encoder, crtc_state);<br>
+<br>
+       intel_cx0_phy_transaction_end(encoder, wakeref);<br>
 }<br>
 <br>
 static void intel_c10pll_disable(struct intel_encoder *encoder)<br>
@@ -1185,7 +1300,8 @@ static void intel_c10pll_disable(struct intel_encoder *encoder)<br>
 <br>
         /* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */<br>
         intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),<br>
-                    XELPDP_DDI_CLOCK_SELECT_MASK |<br>
+                    XELPDP_DDI_CLOCK_SELECT_MASK, 0);<br>
+       intel_de_rmw(i915, XELPDP_PORT_CLOCK_CTL(encoder->port),<br>
                      XELPDP_FORWARD_CLOCK_UNGATE, 0);<br>
 }<br>
 <br>
@@ -1193,9 +1309,14 @@ void intel_cx0pll_disable(struct intel_encoder *encoder)<br>
 {<br>
         struct drm_i915_private *i915 = to_i915(encoder->base.dev);<br>
         enum phy phy = intel_port_to_phy(i915, encoder->port);<br>
+       intel_wakeref_t wakeref;<br>
+<br>
+       wakeref = intel_cx0_phy_transaction_begin(encoder);<br>
 <br>
         drm_WARN_ON(&i915->drm, !intel_is_c10phy(i915, phy));<br>
         intel_c10pll_disable(encoder);<br>
+<br>
+       intel_cx0_phy_transaction_end(encoder, wakeref);<br>
 }<br>
 <br>
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,<br>
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.h b/drivers/gpu/drm/i915/display/intel_cx0_phy.h<br>
index f8023f240727..952c7deeffaa 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_cx0_phy.h<br>
+++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.h<br>
@@ -40,5 +40,7 @@ int intel_c10mpllb_calc_port_clock(struct intel_encoder *encoder,<br>
 void intel_c10mpllb_state_verify(struct intel_atomic_state *state,<br>
                                  struct intel_crtc_state *new_crtc_state);<br>
 int intel_c10_phy_check_hdmi_link_rate(int clock);<br>
+void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder,<br>
+                                    const struct intel_crtc_state *crtc_state);<br>
 <br>
 #endif /* __INTEL_CX0_PHY_H__ */<br>
diff --git a/drivers/gpu/drm/i915/display/intel_cx0_reg_defs.h b/drivers/gpu/drm/i915/display/intel_cx0_reg_defs.h<br>
index b394f5c23acb..fad6308bbf77 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_cx0_reg_defs.h<br>
+++ b/drivers/gpu/drm/i915/display/intel_cx0_reg_defs.h<br>
@@ -164,4 +164,10 @@<br>
 #define PHY_CX0_TX_CONTROL(tx, control) (0x400 + ((tx) - 1) * 0x200 + (control))<br>
 #define CONTROL2_DISABLE_SINGLE_TX      REG_BIT(6)<br>
 <br>
+/* C10 Phy VSWING Masks */<br>
+#define C10_PHY_VSWING_LEVEL_MASK               REG_GENMASK8(2, 0)<br>
+#define C10_PHY_VSWING_LEVEL(val)               REG_FIELD_PREP8(C10_PHY_VSWING_LEVEL_MASK, val)<br>
+#define C10_PHY_VSWING_PREEMPH_MASK             REG_GENMASK8(1, 0)<br>
+#define C10_PHY_VSWING_PREEMPH(val)             REG_FIELD_PREP8(C10_PHY_VSWING_PREEMPH_MASK, val)<br>
+<br>
 #endif /* __INTEL_CX0_REG_DEFS_H__ */<br>
diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c<br>
index 639ec604babf..1380ed2221ad 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_ddi.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c<br>
@@ -4445,7 +4445,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)<br>
                 encoder->get_config = hsw_ddi_get_config;<br>
         }<br>
 <br>
-       if (IS_DG2(dev_priv)) {<br>
+       if (DISPLAY_VER(dev_priv) >= 14) {<br>
+               encoder->set_signal_levels = intel_cx0_phy_set_signal_levels;<br>
+       } else if (IS_DG2(dev_priv)) {<br>
                 encoder->set_signal_levels = intel_snps_phy_set_signal_levels;<br>
         } else if (DISPLAY_VER(dev_priv) >= 12) {<br>
                 if (intel_phy_is_combo(dev_priv, phy))<br>
diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c<br>
index 006a2e979000..49f8a0a6593b 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c<br>
@@ -1035,6 +1035,30 @@ static const struct intel_ddi_buf_trans dg2_snps_trans_uhbr = {<br>
         .num_entries = ARRAY_SIZE(_dg2_snps_trans_uhbr),<br>
 };<br>
 <br>
+/*<br>
+ * Some platforms don't need a mapping table and only expect us to<br>
+ * to program the vswing + preemphasis levels directly since the<br>
+ * hardware will do its own mapping to tuning values internally.<br>
+ */<br>
+static const union intel_ddi_buf_trans_entry direct_map_trans[] = {<br>
+    { .direct = { .level = 0, .preemph = 0 } },<br>
+    { .direct = { .level = 0, .preemph = 1 } },<br>
+    { .direct = { .level = 0, .preemph = 2 } },<br>
+    { .direct = { .level = 0, .preemph = 3 } },<br>
+    { .direct = { .level = 1, .preemph = 0 } },<br>
+    { .direct = { .level = 1, .preemph = 0 } },<br>
+    { .direct = { .level = 1, .preemph = 2 } },<br>
+    { .direct = { .level = 2, .preemph = 0 } },<br>
+    { .direct = { .level = 2, .preemph = 1 } },<br>
+    { .direct = { .level = 3, .preemph = 0 } },<br>
+};<br>
+<br>
+static const struct intel_ddi_buf_trans mtl_cx0c10_trans = {<br>
+       .entries = direct_map_trans,<br>
+       .num_entries = ARRAY_SIZE(direct_map_trans),<br>
+       .hdmi_default_entry = ARRAY_SIZE(direct_map_trans) - 1,<br>
+};<br>
+<br>
 bool is_hobl_buf_trans(const struct intel_ddi_buf_trans *table)<br>
 {<br>
         return table == &tgl_combo_phy_trans_edp_hbr2_hobl;<br>
@@ -1606,12 +1630,22 @@ dg2_get_snps_buf_trans(struct intel_encoder *encoder,<br>
                 return intel_get_buf_trans(&dg2_snps_trans, n_entries);<br>
 }<br>
 <br>
+static const struct intel_ddi_buf_trans *<br>
+mtl_get_cx0_buf_trans(struct intel_encoder *encoder,<br>
+                     const struct intel_crtc_state *crtc_state,<br>
+                     int *n_entries)<br>
+{<br>
+       return intel_get_buf_trans(&mtl_cx0c10_trans, n_entries);<br>
+}<br>
+<br>
 void intel_ddi_buf_trans_init(struct intel_encoder *encoder)<br>
 {<br>
         struct drm_i915_private *i915 = to_i915(encoder->base.dev);<br>
         enum phy phy = intel_port_to_phy(i915, encoder->port);<br>
 <br>
-       if (IS_DG2(i915)) {<br>
+       if (DISPLAY_VER(i915) >= 14) {<br>
+               encoder->get_buf_trans = mtl_get_cx0_buf_trans;<br>
+       } else if (IS_DG2(i915)) {<br>
                 encoder->get_buf_trans = dg2_get_snps_buf_trans;<br>
         } else if (IS_ALDERLAKE_P(i915)) {<br>
                 if (intel_phy_is_combo(i915, phy))<br>
diff --git a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h<br>
index 2133984a572b..e4a857b9829d 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h<br>
+++ b/drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h<br>
@@ -51,6 +51,11 @@ struct dg2_snps_phy_buf_trans {<br>
         u8 post_cursor;<br>
 };<br>
 <br>
+struct direct_phy_buf_trans {<br>
+       u8 level;<br>
+       u8 preemph;<br>
+};<br>
+<br>
 union intel_ddi_buf_trans_entry {<br>
         struct hsw_ddi_buf_trans hsw;<br>
         struct bxt_ddi_buf_trans bxt;<br>
@@ -58,6 +63,7 @@ union intel_ddi_buf_trans_entry {<br>
         struct icl_mg_phy_ddi_buf_trans mg;<br>
         struct tgl_dkl_phy_ddi_buf_trans dkl;<br>
         struct dg2_snps_phy_buf_trans snps;<br>
+       struct direct_phy_buf_trans direct;<br>
 };<br>
 <br>
 struct intel_ddi_buf_trans {<br>
diff --git a/drivers/gpu/drm/i915/display/intel_display_power_map.c b/drivers/gpu/drm/i915/display/intel_display_power_map.c<br>
index dc04afc6cc8f..45c3ab4e2f28 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_display_power_map.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_display_power_map.c<br>
@@ -1374,6 +1374,7 @@ I915_DECL_PW_DOMAINS(xelpdp_pwdoms_dc_off,<br>
         XELPDP_PW_2_POWER_DOMAINS,<br>
         POWER_DOMAIN_AUDIO_MMIO,<br>
         POWER_DOMAIN_MODESET,<br>
+       POWER_DOMAIN_DC_OFF,<br>
         POWER_DOMAIN_AUX_A,<br>
         POWER_DOMAIN_AUX_B,<br>
         POWER_DOMAIN_INIT);<br>
-- <br>
2.34.1<o:p></o:p></p>
</div>
</div>
</div>
</div>
</body>
</html>