diff options
author | Dave Airlie <airlied@redhat.com> | 2011-02-01 20:22:34 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2011-02-01 20:22:34 -0500 |
commit | a55205e229e4e16559cc2593fdfc37902b248879 (patch) | |
tree | 09286776b4c88e7721a4a313fe3064c1a79f9fd4 | |
parent | e468e0017b656841b661e57a948c3b858d58b959 (diff) | |
parent | 5fe49d86f9d01044abf687a8cd21edef636d58aa (diff) |
Merge remote branch 'intel/drm-intel-fixes' of /ssd/git/drm-next into drm-fixes
* 'intel/drm-intel-fixes' of /ssd/git/drm-next:
drm/i915: Only bind to function 0 of the PCI device
drm/i915: Suppress spurious vblank interrupts
drm: Avoid leak of adjusted mode along quick set_mode paths
drm: Simplify and defend later checks when disabling a crtc
drm: Don't switch fb when disabling an output
drm/i915: Reset crtc after resume
drm/i915/crt: Force the initial probe after reset
drm/i915: Reset state after a GPU reset or resume
drm: Add an interface to reset the device
drm/i915/sdvo: If at first we don't succeed in reading the response, wait
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_irq.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_irq.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_crt.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 17 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 46 | ||||
-rw-r--r-- | include/drm/drmP.h | 2 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 7 |
10 files changed, 104 insertions, 44 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 2baa6708e44c..654faa803dcb 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -2674,3 +2674,23 @@ out: | |||
2674 | mutex_unlock(&dev->mode_config.mutex); | 2674 | mutex_unlock(&dev->mode_config.mutex); |
2675 | return ret; | 2675 | return ret; |
2676 | } | 2676 | } |
2677 | |||
2678 | void drm_mode_config_reset(struct drm_device *dev) | ||
2679 | { | ||
2680 | struct drm_crtc *crtc; | ||
2681 | struct drm_encoder *encoder; | ||
2682 | struct drm_connector *connector; | ||
2683 | |||
2684 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) | ||
2685 | if (crtc->funcs->reset) | ||
2686 | crtc->funcs->reset(crtc); | ||
2687 | |||
2688 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) | ||
2689 | if (encoder->funcs->reset) | ||
2690 | encoder->funcs->reset(encoder); | ||
2691 | |||
2692 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) | ||
2693 | if (connector->funcs->reset) | ||
2694 | connector->funcs->reset(connector); | ||
2695 | } | ||
2696 | EXPORT_SYMBOL(drm_mode_config_reset); | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index 952b3d4fb2a6..b34cc7372b52 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -343,13 +343,12 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
343 | struct drm_encoder *encoder; | 343 | struct drm_encoder *encoder; |
344 | bool ret = true; | 344 | bool ret = true; |
345 | 345 | ||
346 | adjusted_mode = drm_mode_duplicate(dev, mode); | ||
347 | |||
348 | crtc->enabled = drm_helper_crtc_in_use(crtc); | 346 | crtc->enabled = drm_helper_crtc_in_use(crtc); |
349 | |||
350 | if (!crtc->enabled) | 347 | if (!crtc->enabled) |
351 | return true; | 348 | return true; |
352 | 349 | ||
350 | adjusted_mode = drm_mode_duplicate(dev, mode); | ||
351 | |||
353 | saved_hwmode = crtc->hwmode; | 352 | saved_hwmode = crtc->hwmode; |
354 | saved_mode = crtc->mode; | 353 | saved_mode = crtc->mode; |
355 | saved_x = crtc->x; | 354 | saved_x = crtc->x; |
@@ -437,10 +436,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, | |||
437 | */ | 436 | */ |
438 | drm_calc_timestamping_constants(crtc); | 437 | drm_calc_timestamping_constants(crtc); |
439 | 438 | ||
440 | /* XXX free adjustedmode */ | ||
441 | drm_mode_destroy(dev, adjusted_mode); | ||
442 | /* FIXME: add subpixel order */ | 439 | /* FIXME: add subpixel order */ |
443 | done: | 440 | done: |
441 | drm_mode_destroy(dev, adjusted_mode); | ||
444 | if (!ret) { | 442 | if (!ret) { |
445 | crtc->hwmode = saved_hwmode; | 443 | crtc->hwmode = saved_hwmode; |
446 | crtc->mode = saved_mode; | 444 | crtc->mode = saved_mode; |
@@ -497,14 +495,17 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
497 | 495 | ||
498 | crtc_funcs = set->crtc->helper_private; | 496 | crtc_funcs = set->crtc->helper_private; |
499 | 497 | ||
498 | if (!set->mode) | ||
499 | set->fb = NULL; | ||
500 | |||
500 | if (set->fb) { | 501 | if (set->fb) { |
501 | DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n", | 502 | DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n", |
502 | set->crtc->base.id, set->fb->base.id, | 503 | set->crtc->base.id, set->fb->base.id, |
503 | (int)set->num_connectors, set->x, set->y); | 504 | (int)set->num_connectors, set->x, set->y); |
504 | } else { | 505 | } else { |
505 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB] #connectors=%d (x y) (%i %i)\n", | 506 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
506 | set->crtc->base.id, (int)set->num_connectors, | 507 | set->mode = NULL; |
507 | set->x, set->y); | 508 | set->num_connectors = 0; |
508 | } | 509 | } |
509 | 510 | ||
510 | dev = set->crtc->dev; | 511 | dev = set->crtc->dev; |
@@ -649,8 +650,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
649 | mode_changed = true; | 650 | mode_changed = true; |
650 | 651 | ||
651 | if (mode_changed) { | 652 | if (mode_changed) { |
652 | set->crtc->enabled = (set->mode != NULL); | 653 | set->crtc->enabled = drm_helper_crtc_in_use(set->crtc); |
653 | if (set->mode != NULL) { | 654 | if (set->crtc->enabled) { |
654 | DRM_DEBUG_KMS("attempting to set mode from" | 655 | DRM_DEBUG_KMS("attempting to set mode from" |
655 | " userspace\n"); | 656 | " userspace\n"); |
656 | drm_mode_debug_printmodeline(set->mode); | 657 | drm_mode_debug_printmodeline(set->mode); |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 0054e957203f..3dadfa2a8528 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -1250,7 +1250,7 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc) | |||
1250 | * Drivers should call this routine in their vblank interrupt handlers to | 1250 | * Drivers should call this routine in their vblank interrupt handlers to |
1251 | * update the vblank counter and send any signals that may be pending. | 1251 | * update the vblank counter and send any signals that may be pending. |
1252 | */ | 1252 | */ |
1253 | void drm_handle_vblank(struct drm_device *dev, int crtc) | 1253 | bool drm_handle_vblank(struct drm_device *dev, int crtc) |
1254 | { | 1254 | { |
1255 | u32 vblcount; | 1255 | u32 vblcount; |
1256 | s64 diff_ns; | 1256 | s64 diff_ns; |
@@ -1258,7 +1258,7 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1258 | unsigned long irqflags; | 1258 | unsigned long irqflags; |
1259 | 1259 | ||
1260 | if (!dev->num_crtcs) | 1260 | if (!dev->num_crtcs) |
1261 | return; | 1261 | return false; |
1262 | 1262 | ||
1263 | /* Need timestamp lock to prevent concurrent execution with | 1263 | /* Need timestamp lock to prevent concurrent execution with |
1264 | * vblank enable/disable, as this would cause inconsistent | 1264 | * vblank enable/disable, as this would cause inconsistent |
@@ -1269,7 +1269,7 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1269 | /* Vblank irq handling disabled. Nothing to do. */ | 1269 | /* Vblank irq handling disabled. Nothing to do. */ |
1270 | if (!dev->vblank_enabled[crtc]) { | 1270 | if (!dev->vblank_enabled[crtc]) { |
1271 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); | 1271 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); |
1272 | return; | 1272 | return false; |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | /* Fetch corresponding timestamp for this vblank interval from | 1275 | /* Fetch corresponding timestamp for this vblank interval from |
@@ -1311,5 +1311,6 @@ void drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1311 | drm_handle_vblank_events(dev, crtc); | 1311 | drm_handle_vblank_events(dev, crtc); |
1312 | 1312 | ||
1313 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); | 1313 | spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); |
1314 | return true; | ||
1314 | } | 1315 | } |
1315 | EXPORT_SYMBOL(drm_handle_vblank); | 1316 | EXPORT_SYMBOL(drm_handle_vblank); |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 66796bb82d3e..cfb56d0ff367 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -354,6 +354,7 @@ static int i915_drm_thaw(struct drm_device *dev) | |||
354 | error = i915_gem_init_ringbuffer(dev); | 354 | error = i915_gem_init_ringbuffer(dev); |
355 | mutex_unlock(&dev->struct_mutex); | 355 | mutex_unlock(&dev->struct_mutex); |
356 | 356 | ||
357 | drm_mode_config_reset(dev); | ||
357 | drm_irq_install(dev); | 358 | drm_irq_install(dev); |
358 | 359 | ||
359 | /* Resume the modeset for every activated CRTC */ | 360 | /* Resume the modeset for every activated CRTC */ |
@@ -542,6 +543,7 @@ int i915_reset(struct drm_device *dev, u8 flags) | |||
542 | 543 | ||
543 | mutex_unlock(&dev->struct_mutex); | 544 | mutex_unlock(&dev->struct_mutex); |
544 | drm_irq_uninstall(dev); | 545 | drm_irq_uninstall(dev); |
546 | drm_mode_config_reset(dev); | ||
545 | drm_irq_install(dev); | 547 | drm_irq_install(dev); |
546 | mutex_lock(&dev->struct_mutex); | 548 | mutex_lock(&dev->struct_mutex); |
547 | } | 549 | } |
@@ -566,6 +568,14 @@ int i915_reset(struct drm_device *dev, u8 flags) | |||
566 | static int __devinit | 568 | static int __devinit |
567 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 569 | i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
568 | { | 570 | { |
571 | /* Only bind to function 0 of the device. Early generations | ||
572 | * used function 1 as a placeholder for multi-head. This causes | ||
573 | * us confusion instead, especially on the systems where both | ||
574 | * functions have the same PCI-ID! | ||
575 | */ | ||
576 | if (PCI_FUNC(pdev->devfn)) | ||
577 | return -ENODEV; | ||
578 | |||
569 | return drm_get_pci_dev(pdev, ent, &driver); | 579 | return drm_get_pci_dev(pdev, ent, &driver); |
570 | } | 580 | } |
571 | 581 | ||
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 062f353497e6..97f946dcc1aa 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -1196,18 +1196,18 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
1196 | intel_finish_page_flip_plane(dev, 1); | 1196 | intel_finish_page_flip_plane(dev, 1); |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | if (pipea_stats & vblank_status) { | 1199 | if (pipea_stats & vblank_status && |
1200 | drm_handle_vblank(dev, 0)) { | ||
1200 | vblank++; | 1201 | vblank++; |
1201 | drm_handle_vblank(dev, 0); | ||
1202 | if (!dev_priv->flip_pending_is_done) { | 1202 | if (!dev_priv->flip_pending_is_done) { |
1203 | i915_pageflip_stall_check(dev, 0); | 1203 | i915_pageflip_stall_check(dev, 0); |
1204 | intel_finish_page_flip(dev, 0); | 1204 | intel_finish_page_flip(dev, 0); |
1205 | } | 1205 | } |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | if (pipeb_stats & vblank_status) { | 1208 | if (pipeb_stats & vblank_status && |
1209 | drm_handle_vblank(dev, 1)) { | ||
1209 | vblank++; | 1210 | vblank++; |
1210 | drm_handle_vblank(dev, 1); | ||
1211 | if (!dev_priv->flip_pending_is_done) { | 1211 | if (!dev_priv->flip_pending_is_done) { |
1212 | i915_pageflip_stall_check(dev, 1); | 1212 | i915_pageflip_stall_check(dev, 1); |
1213 | intel_finish_page_flip(dev, 1); | 1213 | intel_finish_page_flip(dev, 1); |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 17035b87ee46..8a77ff4a7237 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -535,6 +535,15 @@ static int intel_crt_set_property(struct drm_connector *connector, | |||
535 | return 0; | 535 | return 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | static void intel_crt_reset(struct drm_connector *connector) | ||
539 | { | ||
540 | struct drm_device *dev = connector->dev; | ||
541 | struct intel_crt *crt = intel_attached_crt(connector); | ||
542 | |||
543 | if (HAS_PCH_SPLIT(dev)) | ||
544 | crt->force_hotplug_required = 1; | ||
545 | } | ||
546 | |||
538 | /* | 547 | /* |
539 | * Routines for controlling stuff on the analog port | 548 | * Routines for controlling stuff on the analog port |
540 | */ | 549 | */ |
@@ -548,6 +557,7 @@ static const struct drm_encoder_helper_funcs intel_crt_helper_funcs = { | |||
548 | }; | 557 | }; |
549 | 558 | ||
550 | static const struct drm_connector_funcs intel_crt_connector_funcs = { | 559 | static const struct drm_connector_funcs intel_crt_connector_funcs = { |
560 | .reset = intel_crt_reset, | ||
551 | .dpms = drm_helper_connector_dpms, | 561 | .dpms = drm_helper_connector_dpms, |
552 | .detect = intel_crt_detect, | 562 | .detect = intel_crt_detect, |
553 | .fill_modes = drm_helper_probe_single_connector_modes, | 563 | .fill_modes = drm_helper_probe_single_connector_modes, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index d7f237deaaf0..7e42aa586504 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5551,6 +5551,18 @@ cleanup_work: | |||
5551 | return ret; | 5551 | return ret; |
5552 | } | 5552 | } |
5553 | 5553 | ||
5554 | static void intel_crtc_reset(struct drm_crtc *crtc) | ||
5555 | { | ||
5556 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | ||
5557 | |||
5558 | /* Reset flags back to the 'unknown' status so that they | ||
5559 | * will be correctly set on the initial modeset. | ||
5560 | */ | ||
5561 | intel_crtc->cursor_addr = 0; | ||
5562 | intel_crtc->dpms_mode = -1; | ||
5563 | intel_crtc->active = true; /* force the pipe off on setup_init_config */ | ||
5564 | } | ||
5565 | |||
5554 | static struct drm_crtc_helper_funcs intel_helper_funcs = { | 5566 | static struct drm_crtc_helper_funcs intel_helper_funcs = { |
5555 | .dpms = intel_crtc_dpms, | 5567 | .dpms = intel_crtc_dpms, |
5556 | .mode_fixup = intel_crtc_mode_fixup, | 5568 | .mode_fixup = intel_crtc_mode_fixup, |
@@ -5562,6 +5574,7 @@ static struct drm_crtc_helper_funcs intel_helper_funcs = { | |||
5562 | }; | 5574 | }; |
5563 | 5575 | ||
5564 | static const struct drm_crtc_funcs intel_crtc_funcs = { | 5576 | static const struct drm_crtc_funcs intel_crtc_funcs = { |
5577 | .reset = intel_crtc_reset, | ||
5565 | .cursor_set = intel_crtc_cursor_set, | 5578 | .cursor_set = intel_crtc_cursor_set, |
5566 | .cursor_move = intel_crtc_cursor_move, | 5579 | .cursor_move = intel_crtc_cursor_move, |
5567 | .gamma_set = intel_crtc_gamma_set, | 5580 | .gamma_set = intel_crtc_gamma_set, |
@@ -5652,9 +5665,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
5652 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; | 5665 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; |
5653 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; | 5666 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; |
5654 | 5667 | ||
5655 | intel_crtc->cursor_addr = 0; | 5668 | intel_crtc_reset(&intel_crtc->base); |
5656 | intel_crtc->dpms_mode = -1; | ||
5657 | intel_crtc->active = true; /* force the pipe off on setup_init_config */ | ||
5658 | 5669 | ||
5659 | if (HAS_PCH_SPLIT(dev)) { | 5670 | if (HAS_PCH_SPLIT(dev)) { |
5660 | intel_helper_funcs.prepare = ironlake_crtc_prepare; | 5671 | intel_helper_funcs.prepare = ironlake_crtc_prepare; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 45cd37652a37..6a09c1413d60 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -473,20 +473,6 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd, | |||
473 | return false; | 473 | return false; |
474 | } | 474 | } |
475 | 475 | ||
476 | i = 3; | ||
477 | while (status == SDVO_CMD_STATUS_PENDING && i--) { | ||
478 | if (!intel_sdvo_read_byte(intel_sdvo, | ||
479 | SDVO_I2C_CMD_STATUS, | ||
480 | &status)) | ||
481 | return false; | ||
482 | } | ||
483 | if (status != SDVO_CMD_STATUS_SUCCESS) { | ||
484 | DRM_DEBUG_KMS("command returns response %s [%d]\n", | ||
485 | status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP ? cmd_status_names[status] : "???", | ||
486 | status); | ||
487 | return false; | ||
488 | } | ||
489 | |||
490 | return true; | 476 | return true; |
491 | } | 477 | } |
492 | 478 | ||
@@ -497,6 +483,8 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, | |||
497 | u8 status; | 483 | u8 status; |
498 | int i; | 484 | int i; |
499 | 485 | ||
486 | DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(intel_sdvo)); | ||
487 | |||
500 | /* | 488 | /* |
501 | * The documentation states that all commands will be | 489 | * The documentation states that all commands will be |
502 | * processed within 15µs, and that we need only poll | 490 | * processed within 15µs, and that we need only poll |
@@ -505,14 +493,19 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, | |||
505 | * | 493 | * |
506 | * Check 5 times in case the hardware failed to read the docs. | 494 | * Check 5 times in case the hardware failed to read the docs. |
507 | */ | 495 | */ |
508 | do { | 496 | if (!intel_sdvo_read_byte(intel_sdvo, |
497 | SDVO_I2C_CMD_STATUS, | ||
498 | &status)) | ||
499 | goto log_fail; | ||
500 | |||
501 | while (status == SDVO_CMD_STATUS_PENDING && retry--) { | ||
502 | udelay(15); | ||
509 | if (!intel_sdvo_read_byte(intel_sdvo, | 503 | if (!intel_sdvo_read_byte(intel_sdvo, |
510 | SDVO_I2C_CMD_STATUS, | 504 | SDVO_I2C_CMD_STATUS, |
511 | &status)) | 505 | &status)) |
512 | return false; | 506 | goto log_fail; |
513 | } while (status == SDVO_CMD_STATUS_PENDING && --retry); | 507 | } |
514 | 508 | ||
515 | DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(intel_sdvo)); | ||
516 | if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) | 509 | if (status <= SDVO_CMD_STATUS_SCALING_NOT_SUPP) |
517 | DRM_LOG_KMS("(%s)", cmd_status_names[status]); | 510 | DRM_LOG_KMS("(%s)", cmd_status_names[status]); |
518 | else | 511 | else |
@@ -533,7 +526,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo, | |||
533 | return true; | 526 | return true; |
534 | 527 | ||
535 | log_fail: | 528 | log_fail: |
536 | DRM_LOG_KMS("\n"); | 529 | DRM_LOG_KMS("... failed\n"); |
537 | return false; | 530 | return false; |
538 | } | 531 | } |
539 | 532 | ||
@@ -550,6 +543,7 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode) | |||
550 | static bool intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, | 543 | static bool intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, |
551 | u8 ddc_bus) | 544 | u8 ddc_bus) |
552 | { | 545 | { |
546 | /* This must be the immediately preceding write before the i2c xfer */ | ||
553 | return intel_sdvo_write_cmd(intel_sdvo, | 547 | return intel_sdvo_write_cmd(intel_sdvo, |
554 | SDVO_CMD_SET_CONTROL_BUS_SWITCH, | 548 | SDVO_CMD_SET_CONTROL_BUS_SWITCH, |
555 | &ddc_bus, 1); | 549 | &ddc_bus, 1); |
@@ -557,7 +551,10 @@ static bool intel_sdvo_set_control_bus_switch(struct intel_sdvo *intel_sdvo, | |||
557 | 551 | ||
558 | static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len) | 552 | static bool intel_sdvo_set_value(struct intel_sdvo *intel_sdvo, u8 cmd, const void *data, int len) |
559 | { | 553 | { |
560 | return intel_sdvo_write_cmd(intel_sdvo, cmd, data, len); | 554 | if (!intel_sdvo_write_cmd(intel_sdvo, cmd, data, len)) |
555 | return false; | ||
556 | |||
557 | return intel_sdvo_read_response(intel_sdvo, NULL, 0); | ||
561 | } | 558 | } |
562 | 559 | ||
563 | static bool | 560 | static bool |
@@ -859,18 +856,21 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
859 | 856 | ||
860 | intel_dip_infoframe_csum(&avi_if); | 857 | intel_dip_infoframe_csum(&avi_if); |
861 | 858 | ||
862 | if (!intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_HBUF_INDEX, | 859 | if (!intel_sdvo_set_value(intel_sdvo, |
860 | SDVO_CMD_SET_HBUF_INDEX, | ||
863 | set_buf_index, 2)) | 861 | set_buf_index, 2)) |
864 | return false; | 862 | return false; |
865 | 863 | ||
866 | for (i = 0; i < sizeof(avi_if); i += 8) { | 864 | for (i = 0; i < sizeof(avi_if); i += 8) { |
867 | if (!intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_HBUF_DATA, | 865 | if (!intel_sdvo_set_value(intel_sdvo, |
866 | SDVO_CMD_SET_HBUF_DATA, | ||
868 | data, 8)) | 867 | data, 8)) |
869 | return false; | 868 | return false; |
870 | data++; | 869 | data++; |
871 | } | 870 | } |
872 | 871 | ||
873 | return intel_sdvo_write_cmd(intel_sdvo, SDVO_CMD_SET_HBUF_TXRATE, | 872 | return intel_sdvo_set_value(intel_sdvo, |
873 | SDVO_CMD_SET_HBUF_TXRATE, | ||
874 | &tx_rate, 1); | 874 | &tx_rate, 1); |
875 | } | 875 | } |
876 | 876 | ||
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index a4694c610330..fe29aadb129d 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1367,7 +1367,7 @@ extern int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); | |||
1367 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); | 1367 | extern u32 drm_vblank_count(struct drm_device *dev, int crtc); |
1368 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, | 1368 | extern u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc, |
1369 | struct timeval *vblanktime); | 1369 | struct timeval *vblanktime); |
1370 | extern void drm_handle_vblank(struct drm_device *dev, int crtc); | 1370 | extern bool drm_handle_vblank(struct drm_device *dev, int crtc); |
1371 | extern int drm_vblank_get(struct drm_device *dev, int crtc); | 1371 | extern int drm_vblank_get(struct drm_device *dev, int crtc); |
1372 | extern void drm_vblank_put(struct drm_device *dev, int crtc); | 1372 | extern void drm_vblank_put(struct drm_device *dev, int crtc); |
1373 | extern void drm_vblank_off(struct drm_device *dev, int crtc); | 1373 | extern void drm_vblank_off(struct drm_device *dev, int crtc); |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index acd7fade160d..801be59f4f15 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -275,6 +275,7 @@ struct drm_pending_vblank_event; | |||
275 | 275 | ||
276 | /** | 276 | /** |
277 | * drm_crtc_funcs - control CRTCs for a given device | 277 | * drm_crtc_funcs - control CRTCs for a given device |
278 | * @reset: reset CRTC after state has been invalidate (e.g. resume) | ||
278 | * @dpms: control display power levels | 279 | * @dpms: control display power levels |
279 | * @save: save CRTC state | 280 | * @save: save CRTC state |
280 | * @resore: restore CRTC state | 281 | * @resore: restore CRTC state |
@@ -302,6 +303,8 @@ struct drm_crtc_funcs { | |||
302 | void (*save)(struct drm_crtc *crtc); /* suspend? */ | 303 | void (*save)(struct drm_crtc *crtc); /* suspend? */ |
303 | /* Restore CRTC state */ | 304 | /* Restore CRTC state */ |
304 | void (*restore)(struct drm_crtc *crtc); /* resume? */ | 305 | void (*restore)(struct drm_crtc *crtc); /* resume? */ |
306 | /* Reset CRTC state */ | ||
307 | void (*reset)(struct drm_crtc *crtc); | ||
305 | 308 | ||
306 | /* cursor controls */ | 309 | /* cursor controls */ |
307 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, | 310 | int (*cursor_set)(struct drm_crtc *crtc, struct drm_file *file_priv, |
@@ -379,6 +382,7 @@ struct drm_crtc { | |||
379 | * @dpms: set power state (see drm_crtc_funcs above) | 382 | * @dpms: set power state (see drm_crtc_funcs above) |
380 | * @save: save connector state | 383 | * @save: save connector state |
381 | * @restore: restore connector state | 384 | * @restore: restore connector state |
385 | * @reset: reset connector after state has been invalidate (e.g. resume) | ||
382 | * @mode_valid: is this mode valid on the given connector? | 386 | * @mode_valid: is this mode valid on the given connector? |
383 | * @mode_fixup: try to fixup proposed mode for this connector | 387 | * @mode_fixup: try to fixup proposed mode for this connector |
384 | * @mode_set: set this mode | 388 | * @mode_set: set this mode |
@@ -396,6 +400,7 @@ struct drm_connector_funcs { | |||
396 | void (*dpms)(struct drm_connector *connector, int mode); | 400 | void (*dpms)(struct drm_connector *connector, int mode); |
397 | void (*save)(struct drm_connector *connector); | 401 | void (*save)(struct drm_connector *connector); |
398 | void (*restore)(struct drm_connector *connector); | 402 | void (*restore)(struct drm_connector *connector); |
403 | void (*reset)(struct drm_connector *connector); | ||
399 | 404 | ||
400 | /* Check to see if anything is attached to the connector. | 405 | /* Check to see if anything is attached to the connector. |
401 | * @force is set to false whilst polling, true when checking the | 406 | * @force is set to false whilst polling, true when checking the |
@@ -413,6 +418,7 @@ struct drm_connector_funcs { | |||
413 | }; | 418 | }; |
414 | 419 | ||
415 | struct drm_encoder_funcs { | 420 | struct drm_encoder_funcs { |
421 | void (*reset)(struct drm_encoder *encoder); | ||
416 | void (*destroy)(struct drm_encoder *encoder); | 422 | void (*destroy)(struct drm_encoder *encoder); |
417 | }; | 423 | }; |
418 | 424 | ||
@@ -656,6 +662,7 @@ extern struct drm_display_mode *drm_mode_duplicate(struct drm_device *dev, | |||
656 | struct drm_display_mode *mode); | 662 | struct drm_display_mode *mode); |
657 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); | 663 | extern void drm_mode_debug_printmodeline(struct drm_display_mode *mode); |
658 | extern void drm_mode_config_init(struct drm_device *dev); | 664 | extern void drm_mode_config_init(struct drm_device *dev); |
665 | extern void drm_mode_config_reset(struct drm_device *dev); | ||
659 | extern void drm_mode_config_cleanup(struct drm_device *dev); | 666 | extern void drm_mode_config_cleanup(struct drm_device *dev); |
660 | extern void drm_mode_set_name(struct drm_display_mode *mode); | 667 | extern void drm_mode_set_name(struct drm_display_mode *mode); |
661 | extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); | 668 | extern bool drm_mode_equal(struct drm_display_mode *mode1, struct drm_display_mode *mode2); |