diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-08-23 12:43:35 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-08 05:13:29 -0400 |
commit | 481b6af3d1f36d4a19bd36321c1e9f713db49aad (patch) | |
tree | af86f7fdd673130fe726df2bd822eb45abce63a4 /drivers/gpu/drm/i915 | |
parent | 75ef9da2cdb64e7926404dd2b755bbbfe98eaeaf (diff) |
drm/i915: Drop the msleep parameter to wait_for()
Jesse's feedback from using the wait_for() macro was that the msleep
argument was that it was superfluous and made the macro more difficult
to use and to read. As the actually amount of time to sleep is not
critical, the crucial part is to sleep and let the processor schedule
something else whilst we wait for the event, replace the argument with a
hardcoded value.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/intel_crt.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_lvds.c | 4 |
5 files changed, 18 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 4b7735196cd5..c2982e48b61f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -187,7 +187,7 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) | |||
187 | I915_WRITE(PCH_ADPA, adpa); | 187 | I915_WRITE(PCH_ADPA, adpa); |
188 | 188 | ||
189 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, | 189 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, |
190 | 1000, 1)) | 190 | 1000)) |
191 | DRM_ERROR("timed out waiting for FORCE_TRIGGER"); | 191 | DRM_ERROR("timed out waiting for FORCE_TRIGGER"); |
192 | 192 | ||
193 | if (turn_off_dac) { | 193 | if (turn_off_dac) { |
@@ -244,7 +244,7 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
244 | /* wait for FORCE_DETECT to go off */ | 244 | /* wait for FORCE_DETECT to go off */ |
245 | if (wait_for((I915_READ(PORT_HOTPLUG_EN) & | 245 | if (wait_for((I915_READ(PORT_HOTPLUG_EN) & |
246 | CRT_HOTPLUG_FORCE_DETECT) == 0, | 246 | CRT_HOTPLUG_FORCE_DETECT) == 0, |
247 | 1000, 1)) | 247 | 1000)) |
248 | DRM_ERROR("timed out waiting for FORCE_DETECT to go off"); | 248 | DRM_ERROR("timed out waiting for FORCE_DETECT to go off"); |
249 | } | 249 | } |
250 | 250 | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 794d4ac0c40f..854d8f4415b7 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1007,9 +1007,9 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) | |||
1007 | I915_READ(pipestat_reg) | PIPE_VBLANK_INTERRUPT_STATUS); | 1007 | I915_READ(pipestat_reg) | PIPE_VBLANK_INTERRUPT_STATUS); |
1008 | 1008 | ||
1009 | /* Wait for vblank interrupt bit to set */ | 1009 | /* Wait for vblank interrupt bit to set */ |
1010 | if (wait_for((I915_READ(pipestat_reg) & | 1010 | if (wait_for(I915_READ(pipestat_reg) & |
1011 | PIPE_VBLANK_INTERRUPT_STATUS), | 1011 | PIPE_VBLANK_INTERRUPT_STATUS, |
1012 | 50, 0)) | 1012 | 50)) |
1013 | DRM_DEBUG_KMS("vblank wait timed out\n"); | 1013 | DRM_DEBUG_KMS("vblank wait timed out\n"); |
1014 | } | 1014 | } |
1015 | 1015 | ||
@@ -1108,7 +1108,7 @@ void i8xx_disable_fbc(struct drm_device *dev) | |||
1108 | I915_WRITE(FBC_CONTROL, fbc_ctl); | 1108 | I915_WRITE(FBC_CONTROL, fbc_ctl); |
1109 | 1109 | ||
1110 | /* Wait for compressing bit to clear */ | 1110 | /* Wait for compressing bit to clear */ |
1111 | if (wait_for((I915_READ(FBC_STATUS) & FBC_STAT_COMPRESSING) == 0, 10, 0)) { | 1111 | if (wait_for((I915_READ(FBC_STATUS) & FBC_STAT_COMPRESSING) == 0, 10)) { |
1112 | DRM_DEBUG_KMS("FBC idle timed out\n"); | 1112 | DRM_DEBUG_KMS("FBC idle timed out\n"); |
1113 | return; | 1113 | return; |
1114 | } | 1114 | } |
@@ -2070,7 +2070,7 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2070 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); | 2070 | I915_WRITE(transconf_reg, temp | TRANS_ENABLE); |
2071 | I915_READ(transconf_reg); | 2071 | I915_READ(transconf_reg); |
2072 | 2072 | ||
2073 | if (wait_for(I915_READ(transconf_reg) & TRANS_STATE_ENABLE, 100, 1)) | 2073 | if (wait_for(I915_READ(transconf_reg) & TRANS_STATE_ENABLE, 100)) |
2074 | DRM_ERROR("failed to enable transcoder\n"); | 2074 | DRM_ERROR("failed to enable transcoder\n"); |
2075 | } | 2075 | } |
2076 | 2076 | ||
@@ -2102,7 +2102,7 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2102 | I915_WRITE(pipeconf_reg, temp & ~PIPEACONF_ENABLE); | 2102 | I915_WRITE(pipeconf_reg, temp & ~PIPEACONF_ENABLE); |
2103 | 2103 | ||
2104 | /* wait for cpu pipe off, pipe state */ | 2104 | /* wait for cpu pipe off, pipe state */ |
2105 | if (wait_for((I915_READ(pipeconf_reg) & I965_PIPECONF_ACTIVE) == 0, 50, 1)) | 2105 | if (wait_for((I915_READ(pipeconf_reg) & I965_PIPECONF_ACTIVE) == 0, 50)) |
2106 | DRM_ERROR("failed to turn off cpu pipe\n"); | 2106 | DRM_ERROR("failed to turn off cpu pipe\n"); |
2107 | } else | 2107 | } else |
2108 | DRM_DEBUG_KMS("crtc %d is disabled\n", pipe); | 2108 | DRM_DEBUG_KMS("crtc %d is disabled\n", pipe); |
@@ -2160,7 +2160,7 @@ static void ironlake_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
2160 | I915_WRITE(transconf_reg, temp & ~TRANS_ENABLE); | 2160 | I915_WRITE(transconf_reg, temp & ~TRANS_ENABLE); |
2161 | 2161 | ||
2162 | /* wait for PCH transcoder off, transcoder state */ | 2162 | /* wait for PCH transcoder off, transcoder state */ |
2163 | if (wait_for((I915_READ(transconf_reg) & TRANS_STATE_ENABLE) == 0, 50, 1)) | 2163 | if (wait_for((I915_READ(transconf_reg) & TRANS_STATE_ENABLE) == 0, 50)) |
2164 | DRM_ERROR("failed to disable transcoder\n"); | 2164 | DRM_ERROR("failed to disable transcoder\n"); |
2165 | } | 2165 | } |
2166 | 2166 | ||
@@ -5521,7 +5521,7 @@ void ironlake_enable_drps(struct drm_device *dev) | |||
5521 | rgvmodectl |= MEMMODE_SWMODE_EN; | 5521 | rgvmodectl |= MEMMODE_SWMODE_EN; |
5522 | I915_WRITE(MEMMODECTL, rgvmodectl); | 5522 | I915_WRITE(MEMMODECTL, rgvmodectl); |
5523 | 5523 | ||
5524 | if (wait_for((I915_READ(MEMSWCTL) & MEMCTL_CMD_STS) == 0, 1, 0)) | 5524 | if (wait_for((I915_READ(MEMSWCTL) & MEMCTL_CMD_STS) == 0, 10)) |
5525 | DRM_ERROR("stuck trying to change perf mode\n"); | 5525 | DRM_ERROR("stuck trying to change perf mode\n"); |
5526 | msleep(1); | 5526 | msleep(1); |
5527 | 5527 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index b1fc65b41275..3449a3b89e7f 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -772,7 +772,7 @@ static void ironlake_edp_panel_on (struct drm_device *dev) | |||
772 | pp |= PANEL_UNLOCK_REGS | POWER_TARGET_ON; | 772 | pp |= PANEL_UNLOCK_REGS | POWER_TARGET_ON; |
773 | I915_WRITE(PCH_PP_CONTROL, pp); | 773 | I915_WRITE(PCH_PP_CONTROL, pp); |
774 | 774 | ||
775 | if (wait_for(I915_READ(PCH_PP_STATUS) & PP_ON, 5000, 10)) | 775 | if (wait_for(I915_READ(PCH_PP_STATUS) & PP_ON, 5000)) |
776 | DRM_ERROR("panel on wait timed out: 0x%08x\n", | 776 | DRM_ERROR("panel on wait timed out: 0x%08x\n", |
777 | I915_READ(PCH_PP_STATUS)); | 777 | I915_READ(PCH_PP_STATUS)); |
778 | 778 | ||
@@ -797,7 +797,7 @@ static void ironlake_edp_panel_off (struct drm_device *dev) | |||
797 | pp &= ~POWER_TARGET_ON; | 797 | pp &= ~POWER_TARGET_ON; |
798 | I915_WRITE(PCH_PP_CONTROL, pp); | 798 | I915_WRITE(PCH_PP_CONTROL, pp); |
799 | 799 | ||
800 | if (wait_for((I915_READ(PCH_PP_STATUS) & PP_ON) == 0, 5000, 10)) | 800 | if (wait_for((I915_READ(PCH_PP_STATUS) & PP_ON) == 0, 5000)) |
801 | DRM_ERROR("panel off wait timed out: 0x%08x\n", | 801 | DRM_ERROR("panel off wait timed out: 0x%08x\n", |
802 | I915_READ(PCH_PP_STATUS)); | 802 | I915_READ(PCH_PP_STATUS)); |
803 | 803 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index ad312ca6b3e5..686ed533dbe3 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -33,7 +33,7 @@ | |||
33 | 33 | ||
34 | #include "drm_crtc_helper.h" | 34 | #include "drm_crtc_helper.h" |
35 | 35 | ||
36 | #define wait_for(COND, MS, W) ({ \ | 36 | #define _wait_for(COND, MS, W) ({ \ |
37 | unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \ | 37 | unsigned long timeout__ = jiffies + msecs_to_jiffies(MS); \ |
38 | int ret__ = 0; \ | 38 | int ret__ = 0; \ |
39 | while (! (COND)) { \ | 39 | while (! (COND)) { \ |
@@ -46,6 +46,9 @@ | |||
46 | ret__; \ | 46 | ret__; \ |
47 | }) | 47 | }) |
48 | 48 | ||
49 | #define wait_for(COND, MS) _wait_for(COND, MS, 1) | ||
50 | #define wait_for_atomic(COND, MS) _wait_for(COND, MS, 0) | ||
51 | |||
49 | /* | 52 | /* |
50 | * Display related stuff | 53 | * Display related stuff |
51 | */ | 54 | */ |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 4fbb0165b26f..fe79c5a2740c 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -114,7 +114,7 @@ static void intel_lvds_set_power(struct drm_device *dev, bool on) | |||
114 | 114 | ||
115 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) | | 115 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) | |
116 | POWER_TARGET_ON); | 116 | POWER_TARGET_ON); |
117 | if (wait_for(I915_READ(status_reg) & PP_ON, 1000, 0)) | 117 | if (wait_for(I915_READ(status_reg) & PP_ON, 1000)) |
118 | DRM_ERROR("timed out waiting to enable LVDS pipe"); | 118 | DRM_ERROR("timed out waiting to enable LVDS pipe"); |
119 | 119 | ||
120 | intel_lvds_set_backlight(dev, dev_priv->backlight_duty_cycle); | 120 | intel_lvds_set_backlight(dev, dev_priv->backlight_duty_cycle); |
@@ -123,7 +123,7 @@ static void intel_lvds_set_power(struct drm_device *dev, bool on) | |||
123 | 123 | ||
124 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) & | 124 | I915_WRITE(ctl_reg, I915_READ(ctl_reg) & |
125 | ~POWER_TARGET_ON); | 125 | ~POWER_TARGET_ON); |
126 | if (wait_for((I915_READ(status_reg) & PP_ON) == 0, 1000, 0)) | 126 | if (wait_for((I915_READ(status_reg) & PP_ON) == 0, 1000)) |
127 | DRM_ERROR("timed out waiting for LVDS pipe to turn off"); | 127 | DRM_ERROR("timed out waiting for LVDS pipe to turn off"); |
128 | 128 | ||
129 | I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); | 129 | I915_WRITE(lvds_reg, I915_READ(lvds_reg) & ~LVDS_PORT_EN); |