]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/hdcp: Do not use inline intel_de_read
authorSuraj Kandpal <suraj.kandpal@intel.com>
Thu, 19 Jun 2025 11:33:39 +0000 (17:03 +0530)
committerSuraj Kandpal <suraj.kandpal@intel.com>
Tue, 24 Jun 2025 04:53:21 +0000 (10:23 +0530)
Do not use intel_de_read() inline in the WARN_ON functions.
While we are at it make the comparision for stream_type u8 to u8.

--v2
-Use REG_GENMASK() [Jani]
-USe REG_FIELD_GET() [Jani]
-Fix the WARN_ON() condition [Jani]

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20250619113340.3379200-2-suraj.kandpal@intel.com
drivers/gpu/drm/i915/display/intel_dp_hdcp.c
drivers/gpu/drm/i915/display/intel_hdcp_regs.h

index 7bd775fb65a052cc1024956353784a46c2375ea6..70dafaa2afadc627de2ac1775927ac3389f72143 100644 (file)
@@ -805,10 +805,13 @@ intel_dp_mst_hdcp2_stream_encryption(struct intel_connector *connector,
        enum pipe pipe = (enum pipe)cpu_transcoder;
        enum port port = dig_port->base.port;
        int ret;
+       u32 val;
+       u8 stream_type;
 
+       val = intel_de_read(display, HDCP2_AUTH_STREAM(display, cpu_transcoder, port));
+       stream_type = REG_FIELD_GET(AUTH_STREAM_TYPE_MASK, val);
        drm_WARN_ON(display->drm, enable &&
-                   !!(intel_de_read(display, HDCP2_AUTH_STREAM(display, cpu_transcoder, port))
-                   & AUTH_STREAM_TYPE) != data->streams[0].stream_type);
+                   stream_type != data->streams[0].stream_type);
 
        ret = intel_dp_mst_toggle_hdcp_stream_select(connector, enable);
        if (ret)
index f590d7f48ba74fdbc822de1e649180ced766c6de..8b9b87910a9eecc733d3eb60f9fcd8a2a8f79950 100644 (file)
 #define TRANS_HDCP2_AUTH_STREAM(trans) _MMIO_TRANS(trans, \
                                                    _TRANSA_HDCP2_AUTH_STREAM, \
                                                    _TRANSB_HDCP2_AUTH_STREAM)
-#define   AUTH_STREAM_TYPE             REG_BIT(31)
+#define   AUTH_STREAM_TYPE_MASK                REG_GENMASK(31, 31)
 #define HDCP2_AUTH_STREAM(dev_priv, trans, port) \
                                        (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP2_AUTH_STREAM(trans) : \