diff options
-rw-r--r-- | drivers/gpu/drm/drm_probe_helper.c | 51 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_hotplug.c | 4 | ||||
-rw-r--r-- | include/drm/drm_crtc_helper.h | 1 |
3 files changed, 34 insertions, 22 deletions
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index b452a7ccd84b..cf8f0128c161 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c | |||
@@ -115,27 +115,24 @@ static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector) | |||
115 | 115 | ||
116 | #define DRM_OUTPUT_POLL_PERIOD (10*HZ) | 116 | #define DRM_OUTPUT_POLL_PERIOD (10*HZ) |
117 | /** | 117 | /** |
118 | * drm_kms_helper_poll_enable - re-enable output polling. | 118 | * drm_kms_helper_poll_enable_locked - re-enable output polling. |
119 | * @dev: drm_device | 119 | * @dev: drm_device |
120 | * | 120 | * |
121 | * This function re-enables the output polling work, after it has been | 121 | * This function re-enables the output polling work without |
122 | * temporarily disabled using drm_kms_helper_poll_disable(), for example over | 122 | * locking the mode_config mutex. |
123 | * suspend/resume. | ||
124 | * | 123 | * |
125 | * Drivers can call this helper from their device resume implementation. It is | 124 | * This is like drm_kms_helper_poll_enable() however it is to be |
126 | * an error to call this when the output polling support has not yet been set | 125 | * called from a context where the mode_config mutex is locked |
127 | * up. | 126 | * already. |
128 | * | ||
129 | * Note that calls to enable and disable polling must be strictly ordered, which | ||
130 | * is automatically the case when they're only call from suspend/resume | ||
131 | * callbacks. | ||
132 | */ | 127 | */ |
133 | void drm_kms_helper_poll_enable(struct drm_device *dev) | 128 | void drm_kms_helper_poll_enable_locked(struct drm_device *dev) |
134 | { | 129 | { |
135 | bool poll = false; | 130 | bool poll = false; |
136 | struct drm_connector *connector; | 131 | struct drm_connector *connector; |
137 | unsigned long delay = DRM_OUTPUT_POLL_PERIOD; | 132 | unsigned long delay = DRM_OUTPUT_POLL_PERIOD; |
138 | 133 | ||
134 | WARN_ON(!mutex_is_locked(&dev->mode_config.mutex)); | ||
135 | |||
139 | if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) | 136 | if (!dev->mode_config.poll_enabled || !drm_kms_helper_poll) |
140 | return; | 137 | return; |
141 | 138 | ||
@@ -163,7 +160,7 @@ void drm_kms_helper_poll_enable(struct drm_device *dev) | |||
163 | if (poll) | 160 | if (poll) |
164 | schedule_delayed_work(&dev->mode_config.output_poll_work, delay); | 161 | schedule_delayed_work(&dev->mode_config.output_poll_work, delay); |
165 | } | 162 | } |
166 | EXPORT_SYMBOL(drm_kms_helper_poll_enable); | 163 | EXPORT_SYMBOL(drm_kms_helper_poll_enable_locked); |
167 | 164 | ||
168 | static enum drm_connector_status | 165 | static enum drm_connector_status |
169 | drm_connector_detect(struct drm_connector *connector, bool force) | 166 | drm_connector_detect(struct drm_connector *connector, bool force) |
@@ -290,7 +287,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
290 | 287 | ||
291 | /* Re-enable polling in case the global poll config changed. */ | 288 | /* Re-enable polling in case the global poll config changed. */ |
292 | if (drm_kms_helper_poll != dev->mode_config.poll_running) | 289 | if (drm_kms_helper_poll != dev->mode_config.poll_running) |
293 | drm_kms_helper_poll_enable(dev); | 290 | drm_kms_helper_poll_enable_locked(dev); |
294 | 291 | ||
295 | dev->mode_config.poll_running = drm_kms_helper_poll; | 292 | dev->mode_config.poll_running = drm_kms_helper_poll; |
296 | 293 | ||
@@ -482,12 +479,8 @@ out: | |||
482 | * This function disables the output polling work. | 479 | * This function disables the output polling work. |
483 | * | 480 | * |
484 | * Drivers can call this helper from their device suspend implementation. It is | 481 | * Drivers can call this helper from their device suspend implementation. It is |
485 | * not an error to call this even when output polling isn't enabled or already | 482 | * not an error to call this even when output polling isn't enabled or arlready |
486 | * disabled. Polling is re-enabled by calling drm_kms_helper_poll_enable(). | 483 | * disabled. |
487 | * | ||
488 | * Note that calls to enable and disable polling must be strictly ordered, which | ||
489 | * is automatically the case when they're only call from suspend/resume | ||
490 | * callbacks. | ||
491 | */ | 484 | */ |
492 | void drm_kms_helper_poll_disable(struct drm_device *dev) | 485 | void drm_kms_helper_poll_disable(struct drm_device *dev) |
493 | { | 486 | { |
@@ -498,6 +491,24 @@ void drm_kms_helper_poll_disable(struct drm_device *dev) | |||
498 | EXPORT_SYMBOL(drm_kms_helper_poll_disable); | 491 | EXPORT_SYMBOL(drm_kms_helper_poll_disable); |
499 | 492 | ||
500 | /** | 493 | /** |
494 | * drm_kms_helper_poll_enable - re-enable output polling. | ||
495 | * @dev: drm_device | ||
496 | * | ||
497 | * This function re-enables the output polling work. | ||
498 | * | ||
499 | * Drivers can call this helper from their device resume implementation. It is | ||
500 | * an error to call this when the output polling support has not yet been set | ||
501 | * up. | ||
502 | */ | ||
503 | void drm_kms_helper_poll_enable(struct drm_device *dev) | ||
504 | { | ||
505 | mutex_lock(&dev->mode_config.mutex); | ||
506 | drm_kms_helper_poll_enable_locked(dev); | ||
507 | mutex_unlock(&dev->mode_config.mutex); | ||
508 | } | ||
509 | EXPORT_SYMBOL(drm_kms_helper_poll_enable); | ||
510 | |||
511 | /** | ||
501 | * drm_kms_helper_poll_init - initialize and enable output polling | 512 | * drm_kms_helper_poll_init - initialize and enable output polling |
502 | * @dev: drm_device | 513 | * @dev: drm_device |
503 | * | 514 | * |
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c index b62e3f8ad415..3d546c019de0 100644 --- a/drivers/gpu/drm/i915/intel_hotplug.c +++ b/drivers/gpu/drm/i915/intel_hotplug.c | |||
@@ -180,7 +180,7 @@ static void intel_hpd_irq_storm_disable(struct drm_i915_private *dev_priv) | |||
180 | 180 | ||
181 | /* Enable polling and queue hotplug re-enabling. */ | 181 | /* Enable polling and queue hotplug re-enabling. */ |
182 | if (hpd_disabled) { | 182 | if (hpd_disabled) { |
183 | drm_kms_helper_poll_enable(dev); | 183 | drm_kms_helper_poll_enable_locked(dev); |
184 | mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work, | 184 | mod_delayed_work(system_wq, &dev_priv->hotplug.reenable_work, |
185 | msecs_to_jiffies(HPD_STORM_REENABLE_DELAY)); | 185 | msecs_to_jiffies(HPD_STORM_REENABLE_DELAY)); |
186 | } | 186 | } |
@@ -511,7 +511,7 @@ static void i915_hpd_poll_init_work(struct work_struct *work) | |||
511 | } | 511 | } |
512 | 512 | ||
513 | if (enabled) | 513 | if (enabled) |
514 | drm_kms_helper_poll_enable(dev); | 514 | drm_kms_helper_poll_enable_locked(dev); |
515 | 515 | ||
516 | mutex_unlock(&dev->mode_config.mutex); | 516 | mutex_unlock(&dev->mode_config.mutex); |
517 | 517 | ||
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index d026f5017c33..982c299e435a 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -73,5 +73,6 @@ extern void drm_kms_helper_hotplug_event(struct drm_device *dev); | |||
73 | 73 | ||
74 | extern void drm_kms_helper_poll_disable(struct drm_device *dev); | 74 | extern void drm_kms_helper_poll_disable(struct drm_device *dev); |
75 | extern void drm_kms_helper_poll_enable(struct drm_device *dev); | 75 | extern void drm_kms_helper_poll_enable(struct drm_device *dev); |
76 | extern void drm_kms_helper_poll_enable_locked(struct drm_device *dev); | ||
76 | 77 | ||
77 | #endif | 78 | #endif |