drm/i915: Always use adpa_reg
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 25 Jan 2013 19:44:42 +0000 (21:44 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sat, 26 Jan 2013 16:29:52 +0000 (17:29 +0100)
Instead of using ADPA/VLV_ADPA/PCH_ADPA in various parts of
intel_crt code, just use adpa_reg which always contains the
correct value for the platform.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_crt.c

index 71a5ebad14fbf2c86bea360d5bf6620ac729c4d1..68e79f32e10019d994a56932ec80f25a924732ef 100644 (file)
@@ -267,27 +267,27 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 
                crt->force_hotplug_required = 0;
 
-               save_adpa = adpa = I915_READ(PCH_ADPA);
+               save_adpa = adpa = I915_READ(crt->adpa_reg);
                DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa);
 
                adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER;
                if (turn_off_dac)
                        adpa &= ~ADPA_DAC_ENABLE;
 
-               I915_WRITE(PCH_ADPA, adpa);
+               I915_WRITE(crt->adpa_reg, adpa);
 
-               if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
+               if (wait_for((I915_READ(crt->adpa_reg) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
                             1000))
                        DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
 
                if (turn_off_dac) {
-                       I915_WRITE(PCH_ADPA, save_adpa);
-                       POSTING_READ(PCH_ADPA);
+                       I915_WRITE(crt->adpa_reg, save_adpa);
+                       POSTING_READ(crt->adpa_reg);
                }
        }
 
        /* Check the status to see if both blue and green are on now */
-       adpa = I915_READ(PCH_ADPA);
+       adpa = I915_READ(crt->adpa_reg);
        if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0)
                ret = true;
        else
@@ -300,26 +300,27 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
 static bool valleyview_crt_detect_hotplug(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
+       struct intel_crt *crt = intel_attached_crt(connector);
        struct drm_i915_private *dev_priv = dev->dev_private;
        u32 adpa;
        bool ret;
        u32 save_adpa;
 
-       save_adpa = adpa = I915_READ(ADPA);
+       save_adpa = adpa = I915_READ(crt->adpa_reg);
        DRM_DEBUG_KMS("trigger hotplug detect cycle: adpa=0x%x\n", adpa);
 
        adpa |= ADPA_CRT_HOTPLUG_FORCE_TRIGGER;
 
-       I915_WRITE(ADPA, adpa);
+       I915_WRITE(crt->adpa_reg, adpa);
 
-       if (wait_for((I915_READ(ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
+       if (wait_for((I915_READ(crt->adpa_reg) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0,
                     1000)) {
                DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER");
-               I915_WRITE(ADPA, save_adpa);
+               I915_WRITE(crt->adpa_reg, save_adpa);
        }
 
        /* Check the status to see if both blue and green are on now */
-       adpa = I915_READ(ADPA);
+       adpa = I915_READ(crt->adpa_reg);
        if ((adpa & ADPA_CRT_HOTPLUG_MONITOR_MASK) != 0)
                ret = true;
        else
@@ -665,11 +666,11 @@ static void intel_crt_reset(struct drm_connector *connector)
        if (HAS_PCH_SPLIT(dev)) {
                u32 adpa;
 
-               adpa = I915_READ(PCH_ADPA);
+               adpa = I915_READ(crt->adpa_reg);
                adpa &= ~ADPA_CRT_HOTPLUG_MASK;
                adpa |= ADPA_HOTPLUG_BITS;
-               I915_WRITE(PCH_ADPA, adpa);
-               POSTING_READ(PCH_ADPA);
+               I915_WRITE(crt->adpa_reg, adpa);
+               POSTING_READ(crt->adpa_reg);
 
                DRM_DEBUG_KMS("pch crt adpa set to 0x%x\n", adpa);
                crt->force_hotplug_required = 1;