drm/i915/icl: introduce tc_port
authorPaulo Zanoni <paulo.r.zanoni@intel.com>
Tue, 22 May 2018 00:25:37 +0000 (17:25 -0700)
committerPaulo Zanoni <paulo.r.zanoni@intel.com>
Fri, 1 Jun 2018 23:04:56 +0000 (16:04 -0700)
Add and enum for TC ports and auxiliary functions to handle them.
Icelake brings a lot of registers and other things that only apply to
the TC ports and are indexed starting from 0, so having an enum for
tc_ports that starts at 0 really helps the indexing.

This patch is based on previous patches written by Dhinakaran Pandiyan
and Mahesh Kumar.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
Reviewed-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180522002558.29262-4-paulo.r.zanoni@intel.com
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_display.h
drivers/gpu/drm/i915/intel_drv.h

index 141ded5..17c590b 100644 (file)
@@ -5869,6 +5869,22 @@ static void i9xx_pfit_enable(struct intel_crtc *crtc)
        I915_WRITE(BCLRPAT(crtc->pipe), 0);
 }
 
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+       if (IS_ICELAKE(dev_priv))
+               return port >= PORT_C && port <= PORT_F;
+
+       return false;
+}
+
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv, enum port port)
+{
+       if (!intel_port_is_tc(dev_priv, port))
+               return PORT_TC_NONE;
+
+       return port - PORT_C;
+}
+
 enum intel_display_power_domain intel_port_to_power_domain(enum port port)
 {
        switch (port) {
index 2ef3161..c88185e 100644 (file)
@@ -126,6 +126,17 @@ enum port {
 
 #define port_name(p) ((p) + 'A')
 
+enum tc_port {
+       PORT_TC_NONE = -1,
+
+       PORT_TC1 = 0,
+       PORT_TC2,
+       PORT_TC3,
+       PORT_TC4,
+
+       I915_MAX_TC_PORTS
+};
+
 enum dpio_channel {
        DPIO_CH0,
        DPIO_CH1
index b1bb1a9..8641583 100644 (file)
@@ -1489,6 +1489,9 @@ void intel_connector_attach_encoder(struct intel_connector *connector,
                                    struct intel_encoder *encoder);
 struct drm_display_mode *
 intel_encoder_current_mode(struct intel_encoder *encoder);
+bool intel_port_is_tc(struct drm_i915_private *dev_priv, enum port port);
+enum tc_port intel_port_to_tc(struct drm_i915_private *dev_priv,
+                             enum port port);
 
 enum pipe intel_get_pipe_from_connector(struct intel_connector *connector);
 int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,