drm/i915: split ibx_digital_port_connected to ibx and cpt variants
authorJani Nikula <jani.nikula@intel.com>
Thu, 20 Aug 2015 07:47:40 +0000 (10:47 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 26 Aug 2015 09:00:49 +0000 (11:00 +0200)
Choose the right function at the intel_digital_port_connected level.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_dp.c

index 1db7e1edd00dd47bfe0f8bdbd139060c3ba8ce37..689dfe65d27b18d72cc67c7e2362992c8627b72e 100644 (file)
@@ -4485,40 +4485,46 @@ static bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
 {
        u32 bit;
 
-       if (HAS_PCH_IBX(dev_priv->dev)) {
-               switch (port->port) {
-               case PORT_A:
-                       return true;
-               case PORT_B:
-                       bit = SDE_PORTB_HOTPLUG;
-                       break;
-               case PORT_C:
-                       bit = SDE_PORTC_HOTPLUG;
-                       break;
-               case PORT_D:
-                       bit = SDE_PORTD_HOTPLUG;
-                       break;
-               default:
-                       MISSING_CASE(port->port);
-                       return false;
-               }
-       } else {
-               switch (port->port) {
-               case PORT_A:
-                       return true;
-               case PORT_B:
-                       bit = SDE_PORTB_HOTPLUG_CPT;
-                       break;
-               case PORT_C:
-                       bit = SDE_PORTC_HOTPLUG_CPT;
-                       break;
-               case PORT_D:
-                       bit = SDE_PORTD_HOTPLUG_CPT;
-                       break;
-               default:
-                       MISSING_CASE(port->port);
-                       return false;
-               }
+       switch (port->port) {
+       case PORT_A:
+               return true;
+       case PORT_B:
+               bit = SDE_PORTB_HOTPLUG;
+               break;
+       case PORT_C:
+               bit = SDE_PORTC_HOTPLUG;
+               break;
+       case PORT_D:
+               bit = SDE_PORTD_HOTPLUG;
+               break;
+       default:
+               MISSING_CASE(port->port);
+               return false;
+       }
+
+       return I915_READ(SDEISR) & bit;
+}
+
+static bool cpt_digital_port_connected(struct drm_i915_private *dev_priv,
+                                      struct intel_digital_port *port)
+{
+       u32 bit;
+
+       switch (port->port) {
+       case PORT_A:
+               return true;
+       case PORT_B:
+               bit = SDE_PORTB_HOTPLUG_CPT;
+               break;
+       case PORT_C:
+               bit = SDE_PORTC_HOTPLUG_CPT;
+               break;
+       case PORT_D:
+               bit = SDE_PORTD_HOTPLUG_CPT;
+               break;
+       default:
+               MISSING_CASE(port->port);
+               return false;
        }
 
        return I915_READ(SDEISR) & bit;
@@ -4574,8 +4580,10 @@ static bool g4x_digital_port_connected(struct drm_i915_private *dev_priv,
 static bool intel_digital_port_connected(struct drm_i915_private *dev_priv,
                                         struct intel_digital_port *port)
 {
-       if (HAS_PCH_SPLIT(dev_priv))
+       if (HAS_PCH_IBX(dev_priv))
                return ibx_digital_port_connected(dev_priv, port);
+       if (HAS_PCH_SPLIT(dev_priv))
+               return cpt_digital_port_connected(dev_priv, port);
        else
                return g4x_digital_port_connected(dev_priv, port);
 }