drm/i915: unify HDMI/DP hpd definitions
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 7 Feb 2013 11:42:32 +0000 (12:42 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 15 Feb 2013 09:30:37 +0000 (10:30 +0100)
They're physically the same pins and also the same bits, duplicating
only confuses the reader. This also makes it a bit obvious that we
have quite some code duplication going on here. Squashing that is for
a larger rework in our hpd handling though.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_hdmi.c

index 13bb8d3f2a777b5ed67fe0a8caf9656454364fe7..b27ffdbc98a7f750b20cf643ab2e92165641d000 100644 (file)
@@ -2137,12 +2137,12 @@ static void valleyview_hpd_irq_setup(struct drm_device *dev)
        u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN);
 
        /* Note HDMI and DP share bits */
-       if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS)
-               hotplug_en |= HDMIB_HOTPLUG_INT_EN;
-       if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS)
-               hotplug_en |= HDMIC_HOTPLUG_INT_EN;
-       if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS)
-               hotplug_en |= HDMID_HOTPLUG_INT_EN;
+       if (dev_priv->hotplug_supported_mask & PORTB_HOTPLUG_INT_STATUS)
+               hotplug_en |= PORTB_HOTPLUG_INT_EN;
+       if (dev_priv->hotplug_supported_mask & PORTC_HOTPLUG_INT_STATUS)
+               hotplug_en |= PORTC_HOTPLUG_INT_EN;
+       if (dev_priv->hotplug_supported_mask & PORTD_HOTPLUG_INT_STATUS)
+               hotplug_en |= PORTD_HOTPLUG_INT_EN;
        if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_I915)
                hotplug_en |= SDVOC_HOTPLUG_INT_EN;
        if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_I915)
@@ -2408,12 +2408,12 @@ static void i915_hpd_irq_setup(struct drm_device *dev)
        if (I915_HAS_HOTPLUG(dev)) {
                hotplug_en = I915_READ(PORT_HOTPLUG_EN);
 
-               if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS)
-                       hotplug_en |= HDMIB_HOTPLUG_INT_EN;
-               if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS)
-                       hotplug_en |= HDMIC_HOTPLUG_INT_EN;
-               if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS)
-                       hotplug_en |= HDMID_HOTPLUG_INT_EN;
+               if (dev_priv->hotplug_supported_mask & PORTB_HOTPLUG_INT_STATUS)
+                       hotplug_en |= PORTB_HOTPLUG_INT_EN;
+               if (dev_priv->hotplug_supported_mask & PORTC_HOTPLUG_INT_STATUS)
+                       hotplug_en |= PORTC_HOTPLUG_INT_EN;
+               if (dev_priv->hotplug_supported_mask & PORTD_HOTPLUG_INT_STATUS)
+                       hotplug_en |= PORTD_HOTPLUG_INT_EN;
                if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_I915)
                        hotplug_en |= SDVOC_HOTPLUG_INT_EN;
                if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS_I915)
@@ -2642,12 +2642,12 @@ static void i965_hpd_irq_setup(struct drm_device *dev)
 
        /* Note HDMI and DP share hotplug bits */
        hotplug_en = 0;
-       if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS)
-               hotplug_en |= HDMIB_HOTPLUG_INT_EN;
-       if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS)
-               hotplug_en |= HDMIC_HOTPLUG_INT_EN;
-       if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS)
-               hotplug_en |= HDMID_HOTPLUG_INT_EN;
+       if (dev_priv->hotplug_supported_mask & PORTB_HOTPLUG_INT_STATUS)
+               hotplug_en |= PORTB_HOTPLUG_INT_EN;
+       if (dev_priv->hotplug_supported_mask & PORTC_HOTPLUG_INT_STATUS)
+               hotplug_en |= PORTC_HOTPLUG_INT_EN;
+       if (dev_priv->hotplug_supported_mask & PORTD_HOTPLUG_INT_STATUS)
+               hotplug_en |= PORTD_HOTPLUG_INT_EN;
        if (IS_G4X(dev)) {
                if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS_G4X)
                        hotplug_en |= SDVOC_HOTPLUG_INT_EN;
index 8754f9160aef5a8ddcb3b238afaac1a10eb267b9..b9fdc9963817fc98deb9c5af0904c97f0fecc5e2 100644 (file)
 
 /* Hotplug control (945+ only) */
 #define PORT_HOTPLUG_EN                (dev_priv->info->display_mmio_offset + 0x61110)
-#define   HDMIB_HOTPLUG_INT_EN                 (1 << 29)
-#define   DPB_HOTPLUG_INT_EN                   (1 << 29)
-#define   HDMIC_HOTPLUG_INT_EN                 (1 << 28)
-#define   DPC_HOTPLUG_INT_EN                   (1 << 28)
-#define   HDMID_HOTPLUG_INT_EN                 (1 << 27)
-#define   DPD_HOTPLUG_INT_EN                   (1 << 27)
+#define   PORTB_HOTPLUG_INT_EN                 (1 << 29)
+#define   PORTC_HOTPLUG_INT_EN                 (1 << 28)
+#define   PORTD_HOTPLUG_INT_EN                 (1 << 27)
 #define   SDVOB_HOTPLUG_INT_EN                 (1 << 26)
 #define   SDVOC_HOTPLUG_INT_EN                 (1 << 25)
 #define   TV_HOTPLUG_INT_EN                    (1 << 18)
 
 #define PORT_HOTPLUG_STAT      (dev_priv->info->display_mmio_offset + 0x61114)
 /* HDMI/DP bits are gen4+ */
-#define   DPB_HOTPLUG_LIVE_STATUS               (1 << 29)
-#define   DPC_HOTPLUG_LIVE_STATUS               (1 << 28)
-#define   DPD_HOTPLUG_LIVE_STATUS               (1 << 27)
-#define   DPD_HOTPLUG_INT_STATUS               (3 << 21)
-#define   DPC_HOTPLUG_INT_STATUS               (3 << 19)
-#define   DPB_HOTPLUG_INT_STATUS               (3 << 17)
-/* HDMI bits are shared with the DP bits */
-#define   HDMIB_HOTPLUG_LIVE_STATUS             (1 << 29)
-#define   HDMIC_HOTPLUG_LIVE_STATUS             (1 << 28)
-#define   HDMID_HOTPLUG_LIVE_STATUS             (1 << 27)
-#define   HDMID_HOTPLUG_INT_STATUS             (3 << 21)
-#define   HDMIC_HOTPLUG_INT_STATUS             (3 << 19)
-#define   HDMIB_HOTPLUG_INT_STATUS             (3 << 17)
+#define   PORTB_HOTPLUG_LIVE_STATUS               (1 << 29)
+#define   PORTC_HOTPLUG_LIVE_STATUS               (1 << 28)
+#define   PORTD_HOTPLUG_LIVE_STATUS               (1 << 27)
+#define   PORTD_HOTPLUG_INT_STATUS             (3 << 21)
+#define   PORTC_HOTPLUG_INT_STATUS             (3 << 19)
+#define   PORTB_HOTPLUG_INT_STATUS             (3 << 17)
 /* CRT/TV common between gen3+ */
 #define   CRT_HOTPLUG_INT_STATUS               (1 << 11)
 #define   TV_HOTPLUG_INT_STATUS                        (1 << 10)
index 56e408b2e3c8319566c653d05c1063ec323c1db7..7b8bfe8982e6af228e48ebc1ee79ccd22e174dee 100644 (file)
@@ -2302,13 +2302,13 @@ g4x_dp_detect(struct intel_dp *intel_dp)
 
        switch (intel_dig_port->port) {
        case PORT_B:
-               bit = DPB_HOTPLUG_LIVE_STATUS;
+               bit = PORTB_HOTPLUG_LIVE_STATUS;
                break;
        case PORT_C:
-               bit = DPC_HOTPLUG_LIVE_STATUS;
+               bit = PORTC_HOTPLUG_LIVE_STATUS;
                break;
        case PORT_D:
-               bit = DPD_HOTPLUG_LIVE_STATUS;
+               bit = PORTD_HOTPLUG_LIVE_STATUS;
                break;
        default:
                return connector_status_unknown;
@@ -2838,15 +2838,15 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
                name = "DPDDC-A";
                break;
        case PORT_B:
-               dev_priv->hotplug_supported_mask |= DPB_HOTPLUG_INT_STATUS;
+               dev_priv->hotplug_supported_mask |= PORTB_HOTPLUG_INT_STATUS;
                name = "DPDDC-B";
                break;
        case PORT_C:
-               dev_priv->hotplug_supported_mask |= DPC_HOTPLUG_INT_STATUS;
+               dev_priv->hotplug_supported_mask |= PORTC_HOTPLUG_INT_STATUS;
                name = "DPDDC-C";
                break;
        case PORT_D:
-               dev_priv->hotplug_supported_mask |= DPD_HOTPLUG_INT_STATUS;
+               dev_priv->hotplug_supported_mask |= PORTD_HOTPLUG_INT_STATUS;
                name = "DPDDC-D";
                break;
        default:
index 5b4efd64c2f96cda58ad4ed0e34efa269bd6cd51..5a6138c62fe997f1b2d31211747fdb277372f645 100644 (file)
@@ -802,10 +802,10 @@ static bool g4x_hdmi_connected(struct intel_hdmi *intel_hdmi)
 
        switch (intel_dig_port->port) {
        case PORT_B:
-               bit = HDMIB_HOTPLUG_LIVE_STATUS;
+               bit = PORTB_HOTPLUG_LIVE_STATUS;
                break;
        case PORT_C:
-               bit = HDMIC_HOTPLUG_LIVE_STATUS;
+               bit = PORTC_HOTPLUG_LIVE_STATUS;
                break;
        default:
                bit = 0;
@@ -1022,15 +1022,15 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
        switch (port) {
        case PORT_B:
                intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
-               dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
+               dev_priv->hotplug_supported_mask |= PORTB_HOTPLUG_INT_STATUS;
                break;
        case PORT_C:
                intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
-               dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
+               dev_priv->hotplug_supported_mask |= PORTC_HOTPLUG_INT_STATUS;
                break;
        case PORT_D:
                intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
-               dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
+               dev_priv->hotplug_supported_mask |= PORTD_HOTPLUG_INT_STATUS;
                break;
        case PORT_A:
                /* Internal port only for eDP. */