Display code should not care about graphics version. While at it,
abstract the version check to a separate macro.

Signed-off-by: Jani Nikula <jani.nik...@intel.com>
---
 .../gpu/drm/i915/display/intel_hdcp_regs.h    | 28 ++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hdcp_regs.h 
b/drivers/gpu/drm/i915/display/intel_hdcp_regs.h
index 8023c85c7fa0..a568a457e532 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp_regs.h
+++ b/drivers/gpu/drm/i915/display/intel_hdcp_regs.h
@@ -8,6 +8,8 @@
 
 #include "intel_display_reg_defs.h"
 
+#define TRANS_HDCP(__i915)             (DISPLAY_VER(__i915) >= 12)
+
 /* HDCP Key Registers */
 #define HDCP_KEY_CONF                  _MMIO(0x66c00)
 #define  HDCP_AKSV_SEND_TRIGGER                REG_BIT(31)
@@ -82,7 +84,7 @@
 #define TRANS_HDCP_CONF(trans)         _MMIO_TRANS(trans, _TRANSA_HDCP_CONF, \
                                                    _TRANSB_HDCP_CONF)
 #define HDCP_CONF(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_CONF(trans) : \
                                         PORT_HDCP_CONF(port))
 
@@ -95,7 +97,7 @@
                                                    _TRANSA_HDCP_ANINIT, \
                                                    _TRANSB_HDCP_ANINIT)
 #define HDCP_ANINIT(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_ANINIT(trans) : \
                                         PORT_HDCP_ANINIT(port))
 
@@ -105,7 +107,7 @@
 #define TRANS_HDCP_ANLO(trans)         _MMIO_TRANS(trans, _TRANSA_HDCP_ANLO, \
                                                    _TRANSB_HDCP_ANLO)
 #define HDCP_ANLO(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_ANLO(trans) : \
                                         PORT_HDCP_ANLO(port))
 
@@ -115,7 +117,7 @@
 #define TRANS_HDCP_ANHI(trans)         _MMIO_TRANS(trans, _TRANSA_HDCP_ANHI, \
                                                    _TRANSB_HDCP_ANHI)
 #define HDCP_ANHI(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_ANHI(trans) : \
                                         PORT_HDCP_ANHI(port))
 
@@ -126,7 +128,7 @@
                                                    _TRANSA_HDCP_BKSVLO, \
                                                    _TRANSB_HDCP_BKSVLO)
 #define HDCP_BKSVLO(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_BKSVLO(trans) : \
                                         PORT_HDCP_BKSVLO(port))
 
@@ -137,7 +139,7 @@
                                                    _TRANSA_HDCP_BKSVHI, \
                                                    _TRANSB_HDCP_BKSVHI)
 #define HDCP_BKSVHI(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_BKSVHI(trans) : \
                                         PORT_HDCP_BKSVHI(port))
 
@@ -148,7 +150,7 @@
                                                    _TRANSA_HDCP_RPRIME, \
                                                    _TRANSB_HDCP_RPRIME)
 #define HDCP_RPRIME(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_RPRIME(trans) : \
                                         PORT_HDCP_RPRIME(port))
 
@@ -159,7 +161,7 @@
                                                    _TRANSA_HDCP_STATUS, \
                                                    _TRANSB_HDCP_STATUS)
 #define HDCP_STATUS(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP_STATUS(trans) : \
                                         PORT_HDCP_STATUS(port))
 
@@ -200,7 +202,7 @@
 #define   AUTH_FORCE_CLR_INPUTCTR      REG_BIT(19)
 #define   AUTH_CLR_KEYS                        REG_BIT(18)
 #define HDCP2_AUTH(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP2_AUTH(trans) : \
                                         PORT_HDCP2_AUTH(port))
 
@@ -211,7 +213,7 @@
                                                    _TRANSB_HDCP2_CTL)
 #define   CTL_LINK_ENCRYPTION_REQ      REG_BIT(31)
 #define HDCP2_CTL(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP2_CTL(trans) : \
                                         PORT_HDCP2_CTL(port))
 
@@ -225,7 +227,7 @@
 #define   LINK_AUTH_STATUS             REG_BIT(21)
 #define   LINK_ENCRYPTION_STATUS       REG_BIT(20)
 #define HDCP2_STATUS(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP2_STATUS(trans) : \
                                         PORT_HDCP2_STATUS(port))
 
@@ -247,7 +249,7 @@
 #define   STREAM_ENCRYPTION_STATUS     REG_BIT(31)
 #define   STREAM_TYPE_STATUS           REG_BIT(30)
 #define HDCP2_STREAM_STATUS(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP2_STREAM_STATUS(trans) : \
                                         PIPE_HDCP2_STREAM_STATUS(pipe))
 
@@ -263,7 +265,7 @@
                                                    _TRANSB_HDCP2_AUTH_STREAM)
 #define   AUTH_STREAM_TYPE             REG_BIT(31)
 #define HDCP2_AUTH_STREAM(dev_priv, trans, port) \
-                                       (GRAPHICS_VER(dev_priv) >= 12 ? \
+                                       (TRANS_HDCP(dev_priv) ? \
                                         TRANS_HDCP2_AUTH_STREAM(trans) : \
                                         PORT_HDCP2_AUTH_STREAM(port))
 
-- 
2.39.2

Reply via email to