aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c24
-rw-r--r--include/drm/drm_crtc_helper.h2
2 files changed, 22 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 205349ea1075..eea5e6c4099c 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -260,13 +260,27 @@ EXPORT_SYMBOL(drm_helper_crtc_in_use);
260void drm_helper_disable_unused_functions(struct drm_device *dev) 260void drm_helper_disable_unused_functions(struct drm_device *dev)
261{ 261{
262 struct drm_encoder *encoder; 262 struct drm_encoder *encoder;
263 struct drm_connector *connector;
263 struct drm_encoder_helper_funcs *encoder_funcs; 264 struct drm_encoder_helper_funcs *encoder_funcs;
264 struct drm_crtc *crtc; 265 struct drm_crtc *crtc;
265 266
267 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
268 if (!connector->encoder)
269 continue;
270 if (connector->status == connector_status_disconnected)
271 connector->encoder = NULL;
272 }
273
266 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 274 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
267 encoder_funcs = encoder->helper_private; 275 encoder_funcs = encoder->helper_private;
268 if (!drm_helper_encoder_in_use(encoder)) 276 if (!drm_helper_encoder_in_use(encoder)) {
269 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); 277 if (encoder_funcs->disable)
278 (*encoder_funcs->disable)(encoder);
279 else
280 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
281 }
282 /* disconnector encoder from any connector */
283 encoder->crtc = NULL;
270 } 284 }
271 285
272 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 286 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -411,7 +425,7 @@ static int drm_pick_crtcs(struct drm_device *dev,
411 c = 0; 425 c = 0;
412 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 426 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
413 427
414 if ((connector->encoder->possible_crtcs & (1 << c)) == 0) { 428 if ((encoder->possible_crtcs & (1 << c)) == 0) {
415 c++; 429 c++;
416 continue; 430 continue;
417 } 431 }
@@ -496,8 +510,10 @@ static void drm_setup_crtcs(struct drm_device *dev)
496 mode->name, crtc->base.id); 510 mode->name, crtc->base.id);
497 crtc->desired_mode = mode; 511 crtc->desired_mode = mode;
498 connector->encoder->crtc = crtc; 512 connector->encoder->crtc = crtc;
499 } else 513 } else {
500 connector->encoder->crtc = NULL; 514 connector->encoder->crtc = NULL;
515 connector->encoder = NULL;
516 }
501 i++; 517 i++;
502 } 518 }
503 519
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index e44a4f87303c..4c8dacaf4f58 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -79,6 +79,8 @@ struct drm_encoder_helper_funcs {
79 /* detect for DAC style encoders */ 79 /* detect for DAC style encoders */
80 enum drm_connector_status (*detect)(struct drm_encoder *encoder, 80 enum drm_connector_status (*detect)(struct drm_encoder *encoder,
81 struct drm_connector *connector); 81 struct drm_connector *connector);
82 /* disable encoder when not in use - more explicit than dpms off */
83 void (*disable)(struct drm_encoder *encoder);
82}; 84};
83 85
84struct drm_connector_helper_funcs { 86struct drm_connector_helper_funcs {