<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<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: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
Thanks and Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
Arun R Murthy</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);" class="elementToProof">
-------------------</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kandpal, Suraj <suraj.kandpal@intel.com><br>
<b>Sent:</b> Wednesday, August 23, 2023 11:28 AM<br>
<b>To:</b> intel-gfx@lists.freedesktop.org <intel-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>; uma.shakar@intel.com <uma.shakar@intel.com>; Murthy, Arun R <arun.r.murthy@intel.com>; Kandpal, Suraj <suraj.kandpal@intel.com><br>
<b>Subject:</b> [PATCH v2 2/4] drm/i915/hdcp: Propagate aux info in DP HDCP functions</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">We were propagating dig_port info to dp hdcp2 specific functions.<br>
Let us clean that up and send intel_connector in the following<br>
functions: intel_dp_hdcp2_wait_for_msg, get_receiver_id_list_rx_info,<br>
intel_dp_hdcp2_read_rx_status.<br>
This optimises mst scenarios where aux ends up being remote and not<br>
stored in dig_port and dig_port can always be derived from<br>
intel_connector if needed.<br>
<br>
--v2<br>
-Fix Typo [Arun]<br>
-Dont pass drm_dp core structures [Arun]<br>
-Fix commit message styling [Arun]<br>
<br>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com><br>
---<br>
 drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 39 +++++++++++---------<br>
 1 file changed, 22 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c<br>
index 6cd42363837a..59ef77476cb9 100644<br>
--- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c<br>
+++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c<br>
@@ -331,10 +331,11 @@ static const struct hdcp2_dp_msg_data hdcp2_dp_msg_data[] = {<br>
 };<br>
 <br>
 static int<br>
-intel_dp_hdcp2_read_rx_status(struct intel_digital_port *dig_port,<br>
+intel_dp_hdcp2_read_rx_status(struct intel_connector *connector,<br>
                               u8 *rx_status)<br>
 {<br>
-       struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);<br>
+       struct drm_i915_private *i915 = to_i915(connector->base.dev);<br>
+       struct intel_digital_port *dig_port = intel_attached_dig_port(connector);<br>
         ssize_t ret;<br>
 <br>
         ret = drm_dp_dpcd_read(&dig_port->dp.aux,<br>
@@ -350,14 +351,14 @@ intel_dp_hdcp2_read_rx_status(struct intel_digital_port *dig_port,<br>
 }<br>
 <br>
 static<br>
-int hdcp2_detect_msg_availability(struct intel_digital_port *dig_port,<br>
+int hdcp2_detect_msg_availability(struct intel_connector *connector,<br>
                                   u8 msg_id, bool *msg_ready)<br>
 {<br>
         u8 rx_status;<br>
         int ret;<br>
 <br>
         *msg_ready = false;<br>
-       ret = intel_dp_hdcp2_read_rx_status(dig_port, &rx_status);<br>
+       ret = intel_dp_hdcp2_read_rx_status(connector, &rx_status);<br>
         if (ret < 0)<br>
                 return ret;<br>
 <br>
@@ -383,12 +384,11 @@ int hdcp2_detect_msg_availability(struct intel_digital_port *dig_port,<br>
 }<br>
 <br>
 static ssize_t<br>
-intel_dp_hdcp2_wait_for_msg(struct intel_digital_port *dig_port,<br>
+intel_dp_hdcp2_wait_for_msg(struct intel_connector *connector,<br>
                             const struct hdcp2_dp_msg_data *hdcp2_msg_data)<br>
 {<br>
-       struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);<br>
-       struct intel_dp *dp = &dig_port->dp;<br>
-       struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;<br>
+       struct drm_i915_private *i915 = to_i915(connector->base.dev);<br>
+       struct intel_hdcp *hdcp = &connector->hdcp;<br>
         u8 msg_id = hdcp2_msg_data->msg_id;<br>
         int ret, timeout;<br>
         bool msg_ready = false;<br>
@@ -411,8 +411,8 @@ intel_dp_hdcp2_wait_for_msg(struct intel_digital_port *dig_port,<br>
                  * the timeout at wait for CP_IRQ.<br>
                  */<br>
                 intel_dp_hdcp_wait_for_cp_irq(hdcp, timeout);<br>
-               ret = hdcp2_detect_msg_availability(dig_port,<br>
-                                                   msg_id, &msg_ready);<br>
+               ret = hdcp2_detect_msg_availability(connector, msg_id,<br>
+                                                   &msg_ready);<br>
                 if (!msg_ready)<br>
                         ret = -ETIMEDOUT;<br>
         }<br>
@@ -445,6 +445,7 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector,<br>
         u8 *byte = buf;<br>
         ssize_t ret, bytes_to_write, len;<br>
         const struct hdcp2_dp_msg_data *hdcp2_msg_data;<br>
+       struct drm_dp_aux *aux;<br>
 <br>
         hdcp2_msg_data = get_hdcp2_dp_msg_data(*byte);<br>
         if (!hdcp2_msg_data)<br>
@@ -452,6 +453,8 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector,<br>
 <br>
         offset = hdcp2_msg_data->offset;<br>
 <br>
+       aux = &dig_port->dp.aux;<br>
+<br>
         /* No msg_id in DP HDCP2.2 msgs */<br>
         bytes_to_write = size - 1;<br>
         byte++;<br>
@@ -460,7 +463,7 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector,<br>
                 len = bytes_to_write > DP_AUX_MAX_PAYLOAD_BYTES ?<br>
                                 DP_AUX_MAX_PAYLOAD_BYTES : bytes_to_write;<br>
 <br>
-               ret = drm_dp_dpcd_write(&dig_port->dp.aux,<br>
+               ret = drm_dp_dpcd_write(aux,<br>
                                         offset, (void *)byte, len);<br>
                 if (ret < 0)<br>
                         return ret;<br>
@@ -474,8 +477,10 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector,<br>
 }<br>
 <br>
 static<br>
-ssize_t get_receiver_id_list_rx_info(struct intel_digital_port *dig_port, u32 *dev_cnt, u8 *byte)<br>
+ssize_t get_receiver_id_list_rx_info(struct intel_connector *connector,<br>
+                                    u32 *dev_cnt, u8 *byte)<br>
 {<br>
+       struct intel_digital_port *dig_port = intel_attached_dig_port(connector);<br>
         ssize_t ret;<br>
         u8 *rx_info = byte;<br>
 <br>
@@ -500,8 +505,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector,<br>
 {<br>
         struct intel_digital_port *dig_port = intel_attached_dig_port(connector);<br>
         struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);<br>
-       struct intel_dp *dp = &dig_port->dp;<br>
-       struct intel_hdcp *hdcp = &dp->attached_connector->hdcp;<br>
+       struct intel_hdcp *hdcp = &connector->hdcp;<br>
         unsigned int offset;<br>
         u8 *byte = buf;<br>
         ssize_t ret, bytes_to_recv, len;<br>
@@ -515,7 +519,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector,<br>
                 return -EINVAL;<br>
         offset = hdcp2_msg_data->offset;<br>
 <br>
-       ret = intel_dp_hdcp2_wait_for_msg(dig_port, hdcp2_msg_data);<br>
+       ret = intel_dp_hdcp2_wait_for_msg(connector, hdcp2_msg_data);<br>
         if (ret < 0)<br>
                 return ret;<br>
 <br>
@@ -525,7 +529,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector,<br>
         byte++;<br>
 <br>
         if (msg_id == HDCP_2_2_REP_SEND_RECVID_LIST) {<br>
-               ret = get_receiver_id_list_rx_info(dig_port, &dev_cnt, byte);<br>
+               ret = get_receiver_id_list_rx_info(connector, &dev_cnt, byte);<br>
                 if (ret < 0)<br>
                         return ret;<br>
 <br>
@@ -609,7 +613,8 @@ int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port,<br>
         u8 rx_status;<br>
         int ret;<br>
 <br>
-       ret = intel_dp_hdcp2_read_rx_status(dig_port, &rx_status);<br>
+       ret = intel_dp_hdcp2_read_rx_status(connector,<br>
+                                           &rx_status);<br>
         if (ret)<br>
                 return ret;<br>
 <br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</body>
</html>