diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-02-04 13:02:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-02-04 13:02:22 -0500 |
commit | bb5b583b52794efc7b59f70a78be1b66a98dd939 (patch) | |
tree | 762a25a712211fde3e6c13ec5baa2ae028f6153c /drivers | |
parent | 811aaa55ba21ab37407018cfc01770d6b037d3fb (diff) | |
parent | b9e55f5a2720af59561b26dce20179deb118af1a (diff) |
Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (27 commits)
gpu/stub: fix acpi_video build error, fix stub kconfig dependencies
drm/radeon/kms: dynamically allocate power state space
drm/radeon/kms: fix s/r issues with bios scratch regs
agp: ensure GART has an address before enabling it
Revert "agp: AMD AGP is used on UP1100 & UP1500 alpha boxen"
amd-k7-agp: remove non-x86 code
drm/radeon/kms/evergreen: always set certain VGT regs at CP init
drm/radeon/kms: add updated ib_execute function for evergreen
drm/radeon: remove 0x4243 pci id
drm/radeon/kms: Enable new pll calculation for avivo+ asics
drm/radeon/kms: add new pll algo for avivo asics
drm/radeon/kms: add pll debugging output
drm/radeon/kms: switch back to min->max pll post divider iteration
drm/radeon/kms: rv6xx+ thermal sensor fixes
drm/nv50: fix display on 0x50
drm/nouveau: correctly pair hwmon_init and hwmon_fini
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
...
Diffstat (limited to 'drivers')
29 files changed, 392 insertions, 158 deletions
diff --git a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig index fcd867d923ba..d8b1b576556c 100644 --- a/drivers/char/agp/Kconfig +++ b/drivers/char/agp/Kconfig | |||
@@ -50,7 +50,7 @@ config AGP_ATI | |||
50 | 50 | ||
51 | config AGP_AMD | 51 | config AGP_AMD |
52 | tristate "AMD Irongate, 761, and 762 chipset support" | 52 | tristate "AMD Irongate, 761, and 762 chipset support" |
53 | depends on AGP && (X86_32 || ALPHA) | 53 | depends on AGP && X86_32 |
54 | help | 54 | help |
55 | This option gives you AGP support for the GLX component of | 55 | This option gives you AGP support for the GLX component of |
56 | X on AMD Irongate, 761, and 762 chipsets. | 56 | X on AMD Irongate, 761, and 762 chipsets. |
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index b1b4362bc648..45681c0ff3b6 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c | |||
@@ -41,22 +41,8 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
41 | if (page_map->real == NULL) | 41 | if (page_map->real == NULL) |
42 | return -ENOMEM; | 42 | return -ENOMEM; |
43 | 43 | ||
44 | #ifndef CONFIG_X86 | ||
45 | SetPageReserved(virt_to_page(page_map->real)); | ||
46 | global_cache_flush(); | ||
47 | page_map->remapped = ioremap_nocache(virt_to_phys(page_map->real), | ||
48 | PAGE_SIZE); | ||
49 | if (page_map->remapped == NULL) { | ||
50 | ClearPageReserved(virt_to_page(page_map->real)); | ||
51 | free_page((unsigned long) page_map->real); | ||
52 | page_map->real = NULL; | ||
53 | return -ENOMEM; | ||
54 | } | ||
55 | global_cache_flush(); | ||
56 | #else | ||
57 | set_memory_uc((unsigned long)page_map->real, 1); | 44 | set_memory_uc((unsigned long)page_map->real, 1); |
58 | page_map->remapped = page_map->real; | 45 | page_map->remapped = page_map->real; |
59 | #endif | ||
60 | 46 | ||
61 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { | 47 | for (i = 0; i < PAGE_SIZE / sizeof(unsigned long); i++) { |
62 | writel(agp_bridge->scratch_page, page_map->remapped+i); | 48 | writel(agp_bridge->scratch_page, page_map->remapped+i); |
@@ -68,12 +54,7 @@ static int amd_create_page_map(struct amd_page_map *page_map) | |||
68 | 54 | ||
69 | static void amd_free_page_map(struct amd_page_map *page_map) | 55 | static void amd_free_page_map(struct amd_page_map *page_map) |
70 | { | 56 | { |
71 | #ifndef CONFIG_X86 | ||
72 | iounmap(page_map->remapped); | ||
73 | ClearPageReserved(virt_to_page(page_map->real)); | ||
74 | #else | ||
75 | set_memory_wb((unsigned long)page_map->real, 1); | 57 | set_memory_wb((unsigned long)page_map->real, 1); |
76 | #endif | ||
77 | free_page((unsigned long) page_map->real); | 58 | free_page((unsigned long) page_map->real); |
78 | } | 59 | } |
79 | 60 | ||
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 857df10c0428..b0a0dccc98c1 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -774,20 +774,14 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
774 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); | 774 | dev_info(&pdev->dev, "Intel %s Chipset\n", intel_agp_chipsets[i].name); |
775 | 775 | ||
776 | /* | 776 | /* |
777 | * If the device has not been properly setup, the following will catch | ||
778 | * the problem and should stop the system from crashing. | ||
779 | * 20030610 - hamish@zot.org | ||
780 | */ | ||
781 | if (pci_enable_device(pdev)) { | ||
782 | dev_err(&pdev->dev, "can't enable PCI device\n"); | ||
783 | agp_put_bridge(bridge); | ||
784 | return -ENODEV; | ||
785 | } | ||
786 | |||
787 | /* | ||
788 | * The following fixes the case where the BIOS has "forgotten" to | 777 | * The following fixes the case where the BIOS has "forgotten" to |
789 | * provide an address range for the GART. | 778 | * provide an address range for the GART. |
790 | * 20030610 - hamish@zot.org | 779 | * 20030610 - hamish@zot.org |
780 | * This happens before pci_enable_device() intentionally; | ||
781 | * calling pci_enable_device() before assigning the resource | ||
782 | * will result in the GART being disabled on machines with such | ||
783 | * BIOSs (the GART ends up with a BAR starting at 0, which | ||
784 | * conflicts a lot of other devices). | ||
791 | */ | 785 | */ |
792 | r = &pdev->resource[0]; | 786 | r = &pdev->resource[0]; |
793 | if (!r->start && r->end) { | 787 | if (!r->start && r->end) { |
@@ -798,6 +792,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
798 | } | 792 | } |
799 | } | 793 | } |
800 | 794 | ||
795 | /* | ||
796 | * If the device has not been properly setup, the following will catch | ||
797 | * the problem and should stop the system from crashing. | ||
798 | * 20030610 - hamish@zot.org | ||
799 | */ | ||
800 | if (pci_enable_device(pdev)) { | ||
801 | dev_err(&pdev->dev, "can't enable PCI device\n"); | ||
802 | agp_put_bridge(bridge); | ||
803 | return -ENODEV; | ||
804 | } | ||
805 | |||
801 | /* Fill in the mode register */ | 806 | /* Fill in the mode register */ |
802 | if (cap_ptr) { | 807 | if (cap_ptr) { |
803 | pci_read_config_dword(pdev, | 808 | pci_read_config_dword(pdev, |
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 17459ee49ec3..92369655dca3 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/drivers/gpu/drm/nouveau/nouveau_pm.c b/drivers/gpu/drm/nouveau/nouveau_pm.c index fb846a3fef15..f05c0cddfeca 100644 --- a/drivers/gpu/drm/nouveau/nouveau_pm.c +++ b/drivers/gpu/drm/nouveau/nouveau_pm.c | |||
@@ -443,7 +443,7 @@ nouveau_hwmon_fini(struct drm_device *dev) | |||
443 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; | 443 | struct nouveau_pm_engine *pm = &dev_priv->engine.pm; |
444 | 444 | ||
445 | if (pm->hwmon) { | 445 | if (pm->hwmon) { |
446 | sysfs_remove_group(&pm->hwmon->kobj, &hwmon_attrgroup); | 446 | sysfs_remove_group(&dev->pdev->dev.kobj, &hwmon_attrgroup); |
447 | hwmon_device_unregister(pm->hwmon); | 447 | hwmon_device_unregister(pm->hwmon); |
448 | } | 448 | } |
449 | #endif | 449 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nv50_evo.c b/drivers/gpu/drm/nouveau/nv50_evo.c index 14e24e906ee8..0ea090f4244a 100644 --- a/drivers/gpu/drm/nouveau/nv50_evo.c +++ b/drivers/gpu/drm/nouveau/nv50_evo.c | |||
@@ -283,8 +283,7 @@ nv50_evo_create(struct drm_device *dev) | |||
283 | nv50_evo_channel_del(&dev_priv->evo); | 283 | nv50_evo_channel_del(&dev_priv->evo); |
284 | return ret; | 284 | return ret; |
285 | } | 285 | } |
286 | } else | 286 | } else { |
287 | if (dev_priv->chipset != 0x50) { | ||
288 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, | 287 | ret = nv50_evo_dmaobj_new(evo, 0x3d, NvEvoFB16, 0x70, 0x19, |
289 | 0, 0xffffffff, 0x00010000); | 288 | 0, 0xffffffff, 0x00010000); |
290 | if (ret) { | 289 | if (ret) { |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 842954fe74c5..b1537000a104 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -555,6 +555,7 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
555 | dp_clock = dig_connector->dp_clock; | 555 | dp_clock = dig_connector->dp_clock; |
556 | } | 556 | } |
557 | } | 557 | } |
558 | /* this might work properly with the new pll algo */ | ||
558 | #if 0 /* doesn't work properly on some laptops */ | 559 | #if 0 /* doesn't work properly on some laptops */ |
559 | /* use recommended ref_div for ss */ | 560 | /* use recommended ref_div for ss */ |
560 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { | 561 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { |
@@ -572,6 +573,11 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
572 | adjusted_clock = mode->clock * 2; | 573 | adjusted_clock = mode->clock * 2; |
573 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) | 574 | if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) |
574 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; | 575 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; |
576 | /* rv515 needs more testing with this option */ | ||
577 | if (rdev->family != CHIP_RV515) { | ||
578 | if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) | ||
579 | pll->flags |= RADEON_PLL_IS_LCD; | ||
580 | } | ||
575 | } else { | 581 | } else { |
576 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) | 582 | if (encoder->encoder_type != DRM_MODE_ENCODER_DAC) |
577 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; | 583 | pll->flags |= RADEON_PLL_NO_ODD_POST_DIV; |
@@ -951,8 +957,16 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode | |||
951 | /* adjust pixel clock as needed */ | 957 | /* adjust pixel clock as needed */ |
952 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); | 958 | adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); |
953 | 959 | ||
954 | radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | 960 | /* rv515 seems happier with the old algo */ |
955 | &ref_div, &post_div); | 961 | if (rdev->family == CHIP_RV515) |
962 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | ||
963 | &ref_div, &post_div); | ||
964 | else if (ASIC_IS_AVIVO(rdev)) | ||
965 | radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | ||
966 | &ref_div, &post_div); | ||
967 | else | ||
968 | radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, | ||
969 | &ref_div, &post_div); | ||
956 | 970 | ||
957 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); | 971 | atombios_crtc_program_ss(crtc, ATOM_DISABLE, radeon_crtc->pll_id, &ss); |
958 | 972 | ||
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 677af91b555c..ffdc8332b76e 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -97,26 +97,29 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | /* get temperature in millidegrees */ | 99 | /* get temperature in millidegrees */ |
100 | u32 evergreen_get_temp(struct radeon_device *rdev) | 100 | int evergreen_get_temp(struct radeon_device *rdev) |
101 | { | 101 | { |
102 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 102 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
103 | ASIC_T_SHIFT; | 103 | ASIC_T_SHIFT; |
104 | u32 actual_temp = 0; | 104 | u32 actual_temp = 0; |
105 | 105 | ||
106 | if ((temp >> 10) & 1) | 106 | if (temp & 0x400) |
107 | actual_temp = 0; | 107 | actual_temp = -256; |
108 | else if ((temp >> 9) & 1) | 108 | else if (temp & 0x200) |
109 | actual_temp = 255; | 109 | actual_temp = 255; |
110 | else | 110 | else if (temp & 0x100) { |
111 | actual_temp = (temp >> 1) & 0xff; | 111 | actual_temp = temp & 0x1ff; |
112 | actual_temp |= ~0x1ff; | ||
113 | } else | ||
114 | actual_temp = temp & 0xff; | ||
112 | 115 | ||
113 | return actual_temp * 1000; | 116 | return (actual_temp * 1000) / 2; |
114 | } | 117 | } |
115 | 118 | ||
116 | u32 sumo_get_temp(struct radeon_device *rdev) | 119 | int sumo_get_temp(struct radeon_device *rdev) |
117 | { | 120 | { |
118 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; | 121 | u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff; |
119 | u32 actual_temp = (temp >> 1) & 0xff; | 122 | int actual_temp = temp - 49; |
120 | 123 | ||
121 | return actual_temp * 1000; | 124 | return actual_temp * 1000; |
122 | } | 125 | } |
@@ -1182,6 +1185,18 @@ static void evergreen_mc_program(struct radeon_device *rdev) | |||
1182 | /* | 1185 | /* |
1183 | * CP. | 1186 | * CP. |
1184 | */ | 1187 | */ |
1188 | void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib) | ||
1189 | { | ||
1190 | /* set to DX10/11 mode */ | ||
1191 | radeon_ring_write(rdev, PACKET3(PACKET3_MODE_CONTROL, 0)); | ||
1192 | radeon_ring_write(rdev, 1); | ||
1193 | /* FIXME: implement */ | ||
1194 | radeon_ring_write(rdev, PACKET3(PACKET3_INDIRECT_BUFFER, 2)); | ||
1195 | radeon_ring_write(rdev, ib->gpu_addr & 0xFFFFFFFC); | ||
1196 | radeon_ring_write(rdev, upper_32_bits(ib->gpu_addr) & 0xFF); | ||
1197 | radeon_ring_write(rdev, ib->length_dw); | ||
1198 | } | ||
1199 | |||
1185 | 1200 | ||
1186 | static int evergreen_cp_load_microcode(struct radeon_device *rdev) | 1201 | static int evergreen_cp_load_microcode(struct radeon_device *rdev) |
1187 | { | 1202 | { |
@@ -1233,7 +1248,7 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
1233 | cp_me = 0xff; | 1248 | cp_me = 0xff; |
1234 | WREG32(CP_ME_CNTL, cp_me); | 1249 | WREG32(CP_ME_CNTL, cp_me); |
1235 | 1250 | ||
1236 | r = radeon_ring_lock(rdev, evergreen_default_size + 15); | 1251 | r = radeon_ring_lock(rdev, evergreen_default_size + 19); |
1237 | if (r) { | 1252 | if (r) { |
1238 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); | 1253 | DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); |
1239 | return r; | 1254 | return r; |
@@ -1266,6 +1281,11 @@ static int evergreen_cp_start(struct radeon_device *rdev) | |||
1266 | radeon_ring_write(rdev, 0xffffffff); | 1281 | radeon_ring_write(rdev, 0xffffffff); |
1267 | radeon_ring_write(rdev, 0xffffffff); | 1282 | radeon_ring_write(rdev, 0xffffffff); |
1268 | 1283 | ||
1284 | radeon_ring_write(rdev, 0xc0026900); | ||
1285 | radeon_ring_write(rdev, 0x00000316); | ||
1286 | radeon_ring_write(rdev, 0x0000000e); /* VGT_VERTEX_REUSE_BLOCK_CNTL */ | ||
1287 | radeon_ring_write(rdev, 0x00000010); /* */ | ||
1288 | |||
1269 | radeon_ring_unlock_commit(rdev); | 1289 | radeon_ring_unlock_commit(rdev); |
1270 | 1290 | ||
1271 | return 0; | 1291 | return 0; |
@@ -2072,6 +2092,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
2072 | WREG32(VGT_CACHE_INVALIDATION, vgt_cache_invalidation); | 2092 | WREG32(VGT_CACHE_INVALIDATION, vgt_cache_invalidation); |
2073 | 2093 | ||
2074 | WREG32(VGT_GS_VERTEX_REUSE, 16); | 2094 | WREG32(VGT_GS_VERTEX_REUSE, 16); |
2095 | WREG32(PA_SU_LINE_STIPPLE_VALUE, 0); | ||
2075 | WREG32(PA_SC_LINE_STIPPLE_STATE, 0); | 2096 | WREG32(PA_SC_LINE_STIPPLE_STATE, 0); |
2076 | 2097 | ||
2077 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14); | 2098 | WREG32(VGT_VERTEX_REUSE_BLOCK_CNTL, 14); |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index d4d4db49a8b8..a1ba4b3053d0 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
@@ -232,7 +232,7 @@ draw_auto(struct radeon_device *rdev) | |||
232 | 232 | ||
233 | } | 233 | } |
234 | 234 | ||
235 | /* emits 34 */ | 235 | /* emits 36 */ |
236 | static void | 236 | static void |
237 | set_default_state(struct radeon_device *rdev) | 237 | set_default_state(struct radeon_device *rdev) |
238 | { | 238 | { |
@@ -499,6 +499,10 @@ set_default_state(struct radeon_device *rdev) | |||
499 | radeon_ring_write(rdev, 0x00000000); | 499 | radeon_ring_write(rdev, 0x00000000); |
500 | radeon_ring_write(rdev, 0x00000000); | 500 | radeon_ring_write(rdev, 0x00000000); |
501 | 501 | ||
502 | /* set to DX10/11 mode */ | ||
503 | radeon_ring_write(rdev, PACKET3(PACKET3_MODE_CONTROL, 0)); | ||
504 | radeon_ring_write(rdev, 1); | ||
505 | |||
502 | /* emit an IB pointing at default state */ | 506 | /* emit an IB pointing at default state */ |
503 | dwords = ALIGN(rdev->r600_blit.state_len, 0x10); | 507 | dwords = ALIGN(rdev->r600_blit.state_len, 0x10); |
504 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; | 508 | gpu_addr = rdev->r600_blit.shader_gpu_addr + rdev->r600_blit.state_offset; |
@@ -679,7 +683,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
679 | /* calculate number of loops correctly */ | 683 | /* calculate number of loops correctly */ |
680 | ring_size = num_loops * dwords_per_loop; | 684 | ring_size = num_loops * dwords_per_loop; |
681 | /* set default + shaders */ | 685 | /* set default + shaders */ |
682 | ring_size += 50; /* shaders + def state */ | 686 | ring_size += 52; /* shaders + def state */ |
683 | ring_size += 10; /* fence emit for VB IB */ | 687 | ring_size += 10; /* fence emit for VB IB */ |
684 | ring_size += 5; /* done copy */ | 688 | ring_size += 5; /* done copy */ |
685 | ring_size += 10; /* fence emit for done copy */ | 689 | ring_size += 10; /* fence emit for done copy */ |
@@ -687,7 +691,7 @@ int evergreen_blit_prepare_copy(struct radeon_device *rdev, int size_bytes) | |||
687 | if (r) | 691 | if (r) |
688 | return r; | 692 | return r; |
689 | 693 | ||
690 | set_default_state(rdev); /* 34 */ | 694 | set_default_state(rdev); /* 36 */ |
691 | set_shaders(rdev); /* 16 */ | 695 | set_shaders(rdev); /* 16 */ |
692 | return 0; | 696 | return 0; |
693 | } | 697 | } |
diff --git a/drivers/gpu/drm/radeon/evergreend.h b/drivers/gpu/drm/radeon/evergreend.h index 36d32d83d866..afec1aca2a73 100644 --- a/drivers/gpu/drm/radeon/evergreend.h +++ b/drivers/gpu/drm/radeon/evergreend.h | |||
@@ -240,6 +240,7 @@ | |||
240 | #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) | 240 | #define FORCE_EOV_MAX_CLK_CNT(x) ((x) << 0) |
241 | #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16) | 241 | #define FORCE_EOV_MAX_REZ_CNT(x) ((x) << 16) |
242 | #define PA_SC_LINE_STIPPLE 0x28A0C | 242 | #define PA_SC_LINE_STIPPLE 0x28A0C |
243 | #define PA_SU_LINE_STIPPLE_VALUE 0x8A60 | ||
243 | #define PA_SC_LINE_STIPPLE_STATE 0x8B10 | 244 | #define PA_SC_LINE_STIPPLE_STATE 0x8B10 |
244 | 245 | ||
245 | #define SCRATCH_REG0 0x8500 | 246 | #define SCRATCH_REG0 0x8500 |
@@ -652,6 +653,7 @@ | |||
652 | #define PACKET3_DISPATCH_DIRECT 0x15 | 653 | #define PACKET3_DISPATCH_DIRECT 0x15 |
653 | #define PACKET3_DISPATCH_INDIRECT 0x16 | 654 | #define PACKET3_DISPATCH_INDIRECT 0x16 |
654 | #define PACKET3_INDIRECT_BUFFER_END 0x17 | 655 | #define PACKET3_INDIRECT_BUFFER_END 0x17 |
656 | #define PACKET3_MODE_CONTROL 0x18 | ||
655 | #define PACKET3_SET_PREDICATION 0x20 | 657 | #define PACKET3_SET_PREDICATION 0x20 |
656 | #define PACKET3_REG_RMW 0x21 | 658 | #define PACKET3_REG_RMW 0x21 |
657 | #define PACKET3_COND_EXEC 0x22 | 659 | #define PACKET3_COND_EXEC 0x22 |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 1e10e3e2ba2a..650672a0f5ad 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -97,12 +97,16 @@ void r600_irq_disable(struct radeon_device *rdev); | |||
97 | static void r600_pcie_gen2_enable(struct radeon_device *rdev); | 97 | static void r600_pcie_gen2_enable(struct radeon_device *rdev); |
98 | 98 | ||
99 | /* get temperature in millidegrees */ | 99 | /* get temperature in millidegrees */ |
100 | u32 rv6xx_get_temp(struct radeon_device *rdev) | 100 | int rv6xx_get_temp(struct radeon_device *rdev) |
101 | { | 101 | { |
102 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> | 102 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> |
103 | ASIC_T_SHIFT; | 103 | ASIC_T_SHIFT; |
104 | int actual_temp = temp & 0xff; | ||
104 | 105 | ||
105 | return temp * 1000; | 106 | if (temp & 0x100) |
107 | actual_temp -= 256; | ||
108 | |||
109 | return actual_temp * 1000; | ||
106 | } | 110 | } |
107 | 111 | ||
108 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) | 112 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 71d2a554bbe6..56c48b67ef3d 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -179,10 +179,10 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev); | |||
179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); | 179 | void radeon_atombios_get_power_modes(struct radeon_device *rdev); |
180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); | 180 | void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); |
181 | void rs690_pm_info(struct radeon_device *rdev); | 181 | void rs690_pm_info(struct radeon_device *rdev); |
182 | extern u32 rv6xx_get_temp(struct radeon_device *rdev); | 182 | extern int rv6xx_get_temp(struct radeon_device *rdev); |
183 | extern u32 rv770_get_temp(struct radeon_device *rdev); | 183 | extern int rv770_get_temp(struct radeon_device *rdev); |
184 | extern u32 evergreen_get_temp(struct radeon_device *rdev); | 184 | extern int evergreen_get_temp(struct radeon_device *rdev); |
185 | extern u32 sumo_get_temp(struct radeon_device *rdev); | 185 | extern int sumo_get_temp(struct radeon_device *rdev); |
186 | 186 | ||
187 | /* | 187 | /* |
188 | * Fences. | 188 | * Fences. |
@@ -812,8 +812,7 @@ struct radeon_pm { | |||
812 | fixed20_12 sclk; | 812 | fixed20_12 sclk; |
813 | fixed20_12 mclk; | 813 | fixed20_12 mclk; |
814 | fixed20_12 needed_bandwidth; | 814 | fixed20_12 needed_bandwidth; |
815 | /* XXX: use a define for num power modes */ | 815 | struct radeon_power_state *power_state; |
816 | struct radeon_power_state power_state[8]; | ||
817 | /* number of valid power states */ | 816 | /* number of valid power states */ |
818 | int num_power_states; | 817 | int num_power_states; |
819 | int current_power_state_index; | 818 | int current_power_state_index; |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index 3a1b16186224..e75d63b8e21d 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -759,7 +759,7 @@ static struct radeon_asic evergreen_asic = { | |||
759 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, | 759 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, |
760 | .gart_set_page = &rs600_gart_set_page, | 760 | .gart_set_page = &rs600_gart_set_page, |
761 | .ring_test = &r600_ring_test, | 761 | .ring_test = &r600_ring_test, |
762 | .ring_ib_execute = &r600_ring_ib_execute, | 762 | .ring_ib_execute = &evergreen_ring_ib_execute, |
763 | .irq_set = &evergreen_irq_set, | 763 | .irq_set = &evergreen_irq_set, |
764 | .irq_process = &evergreen_irq_process, | 764 | .irq_process = &evergreen_irq_process, |
765 | .get_vblank_counter = &evergreen_get_vblank_counter, | 765 | .get_vblank_counter = &evergreen_get_vblank_counter, |
@@ -805,7 +805,7 @@ static struct radeon_asic sumo_asic = { | |||
805 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, | 805 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, |
806 | .gart_set_page = &rs600_gart_set_page, | 806 | .gart_set_page = &rs600_gart_set_page, |
807 | .ring_test = &r600_ring_test, | 807 | .ring_test = &r600_ring_test, |
808 | .ring_ib_execute = &r600_ring_ib_execute, | 808 | .ring_ib_execute = &evergreen_ring_ib_execute, |
809 | .irq_set = &evergreen_irq_set, | 809 | .irq_set = &evergreen_irq_set, |
810 | .irq_process = &evergreen_irq_process, | 810 | .irq_process = &evergreen_irq_process, |
811 | .get_vblank_counter = &evergreen_get_vblank_counter, | 811 | .get_vblank_counter = &evergreen_get_vblank_counter, |
@@ -848,7 +848,7 @@ static struct radeon_asic btc_asic = { | |||
848 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, | 848 | .gart_tlb_flush = &evergreen_pcie_gart_tlb_flush, |
849 | .gart_set_page = &rs600_gart_set_page, | 849 | .gart_set_page = &rs600_gart_set_page, |
850 | .ring_test = &r600_ring_test, | 850 | .ring_test = &r600_ring_test, |
851 | .ring_ib_execute = &r600_ring_ib_execute, | 851 | .ring_ib_execute = &evergreen_ring_ib_execute, |
852 | .irq_set = &evergreen_irq_set, | 852 | .irq_set = &evergreen_irq_set, |
853 | .irq_process = &evergreen_irq_process, | 853 | .irq_process = &evergreen_irq_process, |
854 | .get_vblank_counter = &evergreen_get_vblank_counter, | 854 | .get_vblank_counter = &evergreen_get_vblank_counter, |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h index e01f07718539..c59bd98a2029 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.h +++ b/drivers/gpu/drm/radeon/radeon_asic.h | |||
@@ -355,6 +355,7 @@ int evergreen_resume(struct radeon_device *rdev); | |||
355 | bool evergreen_gpu_is_lockup(struct radeon_device *rdev); | 355 | bool evergreen_gpu_is_lockup(struct radeon_device *rdev); |
356 | int evergreen_asic_reset(struct radeon_device *rdev); | 356 | int evergreen_asic_reset(struct radeon_device *rdev); |
357 | void evergreen_bandwidth_update(struct radeon_device *rdev); | 357 | void evergreen_bandwidth_update(struct radeon_device *rdev); |
358 | void evergreen_ring_ib_execute(struct radeon_device *rdev, struct radeon_ib *ib); | ||
358 | int evergreen_copy_blit(struct radeon_device *rdev, | 359 | int evergreen_copy_blit(struct radeon_device *rdev, |
359 | uint64_t src_offset, uint64_t dst_offset, | 360 | uint64_t src_offset, uint64_t dst_offset, |
360 | unsigned num_pages, struct radeon_fence *fence); | 361 | unsigned num_pages, struct radeon_fence *fence); |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 52777902bbcc..5c1cc7ad9a15 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -1163,16 +1163,6 @@ bool radeon_atom_get_clock_info(struct drm_device *dev) | |||
1163 | p1pll->pll_out_min = 64800; | 1163 | p1pll->pll_out_min = 64800; |
1164 | else | 1164 | else |
1165 | p1pll->pll_out_min = 20000; | 1165 | p1pll->pll_out_min = 20000; |
1166 | } else if (p1pll->pll_out_min > 64800) { | ||
1167 | /* Limiting the pll output range is a good thing generally as | ||
1168 | * it limits the number of possible pll combinations for a given | ||
1169 | * frequency presumably to the ones that work best on each card. | ||
1170 | * However, certain duallink DVI monitors seem to like | ||
1171 | * pll combinations that would be limited by this at least on | ||
1172 | * pre-DCE 3.0 r6xx hardware. This might need to be adjusted per | ||
1173 | * family. | ||
1174 | */ | ||
1175 | p1pll->pll_out_min = 64800; | ||
1176 | } | 1166 | } |
1177 | 1167 | ||
1178 | p1pll->pll_in_min = | 1168 | p1pll->pll_in_min = |
@@ -1987,6 +1977,9 @@ static int radeon_atombios_parse_power_table_1_3(struct radeon_device *rdev) | |||
1987 | num_modes = power_info->info.ucNumOfPowerModeEntries; | 1977 | num_modes = power_info->info.ucNumOfPowerModeEntries; |
1988 | if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) | 1978 | if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) |
1989 | num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; | 1979 | num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; |
1980 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * num_modes, GFP_KERNEL); | ||
1981 | if (!rdev->pm.power_state) | ||
1982 | return state_index; | ||
1990 | /* last mode is usually default, array is low to high */ | 1983 | /* last mode is usually default, array is low to high */ |
1991 | for (i = 0; i < num_modes; i++) { | 1984 | for (i = 0; i < num_modes; i++) { |
1992 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 1985 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
@@ -2338,6 +2331,10 @@ static int radeon_atombios_parse_power_table_4_5(struct radeon_device *rdev) | |||
2338 | power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); | 2331 | power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); |
2339 | 2332 | ||
2340 | radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); | 2333 | radeon_atombios_add_pplib_thermal_controller(rdev, &power_info->pplib.sThermalController); |
2334 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * | ||
2335 | power_info->pplib.ucNumStates, GFP_KERNEL); | ||
2336 | if (!rdev->pm.power_state) | ||
2337 | return state_index; | ||
2341 | /* first mode is usually default, followed by low to high */ | 2338 | /* first mode is usually default, followed by low to high */ |
2342 | for (i = 0; i < power_info->pplib.ucNumStates; i++) { | 2339 | for (i = 0; i < power_info->pplib.ucNumStates; i++) { |
2343 | mode_index = 0; | 2340 | mode_index = 0; |
@@ -2418,6 +2415,10 @@ static int radeon_atombios_parse_power_table_6(struct radeon_device *rdev) | |||
2418 | non_clock_info_array = (struct NonClockInfoArray *) | 2415 | non_clock_info_array = (struct NonClockInfoArray *) |
2419 | (mode_info->atom_context->bios + data_offset + | 2416 | (mode_info->atom_context->bios + data_offset + |
2420 | power_info->pplib.usNonClockInfoArrayOffset); | 2417 | power_info->pplib.usNonClockInfoArrayOffset); |
2418 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * | ||
2419 | state_array->ucNumEntries, GFP_KERNEL); | ||
2420 | if (!rdev->pm.power_state) | ||
2421 | return state_index; | ||
2421 | for (i = 0; i < state_array->ucNumEntries; i++) { | 2422 | for (i = 0; i < state_array->ucNumEntries; i++) { |
2422 | mode_index = 0; | 2423 | mode_index = 0; |
2423 | power_state = (union pplib_power_state *)&state_array->states[i]; | 2424 | power_state = (union pplib_power_state *)&state_array->states[i]; |
@@ -2491,19 +2492,22 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) | |||
2491 | break; | 2492 | break; |
2492 | } | 2493 | } |
2493 | } else { | 2494 | } else { |
2494 | /* add the default mode */ | 2495 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state), GFP_KERNEL); |
2495 | rdev->pm.power_state[state_index].type = | 2496 | if (rdev->pm.power_state) { |
2496 | POWER_STATE_TYPE_DEFAULT; | 2497 | /* add the default mode */ |
2497 | rdev->pm.power_state[state_index].num_clock_modes = 1; | 2498 | rdev->pm.power_state[state_index].type = |
2498 | rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; | 2499 | POWER_STATE_TYPE_DEFAULT; |
2499 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; | 2500 | rdev->pm.power_state[state_index].num_clock_modes = 1; |
2500 | rdev->pm.power_state[state_index].default_clock_mode = | 2501 | rdev->pm.power_state[state_index].clock_info[0].mclk = rdev->clock.default_mclk; |
2501 | &rdev->pm.power_state[state_index].clock_info[0]; | 2502 | rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; |
2502 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; | 2503 | rdev->pm.power_state[state_index].default_clock_mode = |
2503 | rdev->pm.power_state[state_index].pcie_lanes = 16; | 2504 | &rdev->pm.power_state[state_index].clock_info[0]; |
2504 | rdev->pm.default_power_state_index = state_index; | 2505 | rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; |
2505 | rdev->pm.power_state[state_index].flags = 0; | 2506 | rdev->pm.power_state[state_index].pcie_lanes = 16; |
2506 | state_index++; | 2507 | rdev->pm.default_power_state_index = state_index; |
2508 | rdev->pm.power_state[state_index].flags = 0; | ||
2509 | state_index++; | ||
2510 | } | ||
2507 | } | 2511 | } |
2508 | 2512 | ||
2509 | rdev->pm.num_power_states = state_index; | 2513 | rdev->pm.num_power_states = state_index; |
@@ -2619,7 +2623,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) | |||
2619 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; | 2623 | bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; |
2620 | 2624 | ||
2621 | /* tell the bios not to handle mode switching */ | 2625 | /* tell the bios not to handle mode switching */ |
2622 | bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); | 2626 | bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH; |
2623 | 2627 | ||
2624 | if (rdev->family >= CHIP_R600) { | 2628 | if (rdev->family >= CHIP_R600) { |
2625 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); | 2629 | WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); |
@@ -2670,10 +2674,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock) | |||
2670 | else | 2674 | else |
2671 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); | 2675 | bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); |
2672 | 2676 | ||
2673 | if (lock) | 2677 | if (lock) { |
2674 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; | 2678 | bios_6_scratch |= ATOM_S6_CRITICAL_STATE; |
2675 | else | 2679 | bios_6_scratch &= ~ATOM_S6_ACC_MODE; |
2680 | } else { | ||
2676 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; | 2681 | bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; |
2682 | bios_6_scratch |= ATOM_S6_ACC_MODE; | ||
2683 | } | ||
2677 | 2684 | ||
2678 | if (rdev->family >= CHIP_R600) | 2685 | if (rdev->family >= CHIP_R600) |
2679 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); | 2686 | WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 591fcae8f224..d27ef74590cd 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -2442,6 +2442,17 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) | |||
2442 | 2442 | ||
2443 | rdev->pm.default_power_state_index = -1; | 2443 | rdev->pm.default_power_state_index = -1; |
2444 | 2444 | ||
2445 | /* allocate 2 power states */ | ||
2446 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL); | ||
2447 | if (!rdev->pm.power_state) { | ||
2448 | rdev->pm.default_power_state_index = state_index; | ||
2449 | rdev->pm.num_power_states = 0; | ||
2450 | |||
2451 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | ||
2452 | rdev->pm.current_clock_mode_index = 0; | ||
2453 | return; | ||
2454 | } | ||
2455 | |||
2445 | if (rdev->flags & RADEON_IS_MOBILITY) { | 2456 | if (rdev->flags & RADEON_IS_MOBILITY) { |
2446 | offset = combios_get_table_offset(dev, COMBIOS_POWERPLAY_INFO_TABLE); | 2457 | offset = combios_get_table_offset(dev, COMBIOS_POWERPLAY_INFO_TABLE); |
2447 | if (offset) { | 2458 | if (offset) { |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index d26dabf878d9..2eff98cfd728 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -780,6 +780,115 @@ static int radeon_ddc_dump(struct drm_connector *connector) | |||
780 | return ret; | 780 | return ret; |
781 | } | 781 | } |
782 | 782 | ||
783 | /* avivo */ | ||
784 | static void avivo_get_fb_div(struct radeon_pll *pll, | ||
785 | u32 target_clock, | ||
786 | u32 post_div, | ||
787 | u32 ref_div, | ||
788 | u32 *fb_div, | ||
789 | u32 *frac_fb_div) | ||
790 | { | ||
791 | u32 tmp = post_div * ref_div; | ||
792 | |||
793 | tmp *= target_clock; | ||
794 | *fb_div = tmp / pll->reference_freq; | ||
795 | *frac_fb_div = tmp % pll->reference_freq; | ||
796 | } | ||
797 | |||
798 | static u32 avivo_get_post_div(struct radeon_pll *pll, | ||
799 | u32 target_clock) | ||
800 | { | ||
801 | u32 vco, post_div, tmp; | ||
802 | |||
803 | if (pll->flags & RADEON_PLL_USE_POST_DIV) | ||
804 | return pll->post_div; | ||
805 | |||
806 | if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP) { | ||
807 | if (pll->flags & RADEON_PLL_IS_LCD) | ||
808 | vco = pll->lcd_pll_out_min; | ||
809 | else | ||
810 | vco = pll->pll_out_min; | ||
811 | } else { | ||
812 | if (pll->flags & RADEON_PLL_IS_LCD) | ||
813 | vco = pll->lcd_pll_out_max; | ||
814 | else | ||
815 | vco = pll->pll_out_max; | ||
816 | } | ||
817 | |||
818 | post_div = vco / target_clock; | ||
819 | tmp = vco % target_clock; | ||
820 | |||
821 | if (pll->flags & RADEON_PLL_PREFER_MINM_OVER_MAXP) { | ||
822 | if (tmp) | ||
823 | post_div++; | ||
824 | } else { | ||
825 | if (!tmp) | ||
826 | post_div--; | ||
827 | } | ||
828 | |||
829 | return post_div; | ||
830 | } | ||
831 | |||
832 | #define MAX_TOLERANCE 10 | ||
833 | |||
834 | void radeon_compute_pll_avivo(struct radeon_pll *pll, | ||
835 | u32 freq, | ||
836 | u32 *dot_clock_p, | ||
837 | u32 *fb_div_p, | ||
838 | u32 *frac_fb_div_p, | ||
839 | u32 *ref_div_p, | ||
840 | u32 *post_div_p) | ||
841 | { | ||
842 | u32 target_clock = freq / 10; | ||
843 | u32 post_div = avivo_get_post_div(pll, target_clock); | ||
844 | u32 ref_div = pll->min_ref_div; | ||
845 | u32 fb_div = 0, frac_fb_div = 0, tmp; | ||
846 | |||
847 | if (pll->flags & RADEON_PLL_USE_REF_DIV) | ||
848 | ref_div = pll->reference_div; | ||
849 | |||
850 | if (pll->flags & RADEON_PLL_USE_FRAC_FB_DIV) { | ||
851 | avivo_get_fb_div(pll, target_clock, post_div, ref_div, &fb_div, &frac_fb_div); | ||
852 | frac_fb_div = (100 * frac_fb_div) / pll->reference_freq; | ||
853 | if (frac_fb_div >= 5) { | ||
854 | frac_fb_div -= 5; | ||
855 | frac_fb_div = frac_fb_div / 10; | ||
856 | frac_fb_div++; | ||
857 | } | ||
858 | if (frac_fb_div >= 10) { | ||
859 | fb_div++; | ||
860 | frac_fb_div = 0; | ||
861 | } | ||
862 | } else { | ||
863 | while (ref_div <= pll->max_ref_div) { | ||
864 | avivo_get_fb_div(pll, target_clock, post_div, ref_div, | ||
865 | &fb_div, &frac_fb_div); | ||
866 | if (frac_fb_div >= (pll->reference_freq / 2)) | ||
867 | fb_div++; | ||
868 | frac_fb_div = 0; | ||
869 | tmp = (pll->reference_freq * fb_div) / (post_div * ref_div); | ||
870 | tmp = (tmp * 10000) / target_clock; | ||
871 | |||
872 | if (tmp > (10000 + MAX_TOLERANCE)) | ||
873 | ref_div++; | ||
874 | else if (tmp >= (10000 - MAX_TOLERANCE)) | ||
875 | break; | ||
876 | else | ||
877 | ref_div++; | ||
878 | } | ||
879 | } | ||
880 | |||
881 | *dot_clock_p = ((pll->reference_freq * fb_div * 10) + (pll->reference_freq * frac_fb_div)) / | ||
882 | (ref_div * post_div * 10); | ||
883 | *fb_div_p = fb_div; | ||
884 | *frac_fb_div_p = frac_fb_div; | ||
885 | *ref_div_p = ref_div; | ||
886 | *post_div_p = post_div; | ||
887 | DRM_DEBUG_KMS("%d, pll dividers - fb: %d.%d ref: %d, post %d\n", | ||
888 | *dot_clock_p, fb_div, frac_fb_div, ref_div, post_div); | ||
889 | } | ||
890 | |||
891 | /* pre-avivo */ | ||
783 | static inline uint32_t radeon_div(uint64_t n, uint32_t d) | 892 | static inline uint32_t radeon_div(uint64_t n, uint32_t d) |
784 | { | 893 | { |
785 | uint64_t mod; | 894 | uint64_t mod; |
@@ -790,13 +899,13 @@ static inline uint32_t radeon_div(uint64_t n, uint32_t d) | |||
790 | return n; | 899 | return n; |
791 | } | 900 | } |
792 | 901 | ||
793 | void radeon_compute_pll(struct radeon_pll *pll, | 902 | void radeon_compute_pll_legacy(struct radeon_pll *pll, |
794 | uint64_t freq, | 903 | uint64_t freq, |
795 | uint32_t *dot_clock_p, | 904 | uint32_t *dot_clock_p, |
796 | uint32_t *fb_div_p, | 905 | uint32_t *fb_div_p, |
797 | uint32_t *frac_fb_div_p, | 906 | uint32_t *frac_fb_div_p, |
798 | uint32_t *ref_div_p, | 907 | uint32_t *ref_div_p, |
799 | uint32_t *post_div_p) | 908 | uint32_t *post_div_p) |
800 | { | 909 | { |
801 | uint32_t min_ref_div = pll->min_ref_div; | 910 | uint32_t min_ref_div = pll->min_ref_div; |
802 | uint32_t max_ref_div = pll->max_ref_div; | 911 | uint32_t max_ref_div = pll->max_ref_div; |
@@ -826,6 +935,9 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
826 | pll_out_max = pll->pll_out_max; | 935 | pll_out_max = pll->pll_out_max; |
827 | } | 936 | } |
828 | 937 | ||
938 | if (pll_out_min > 64800) | ||
939 | pll_out_min = 64800; | ||
940 | |||
829 | if (pll->flags & RADEON_PLL_USE_REF_DIV) | 941 | if (pll->flags & RADEON_PLL_USE_REF_DIV) |
830 | min_ref_div = max_ref_div = pll->reference_div; | 942 | min_ref_div = max_ref_div = pll->reference_div; |
831 | else { | 943 | else { |
@@ -849,7 +961,7 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
849 | max_fractional_feed_div = pll->max_frac_feedback_div; | 961 | max_fractional_feed_div = pll->max_frac_feedback_div; |
850 | } | 962 | } |
851 | 963 | ||
852 | for (post_div = max_post_div; post_div >= min_post_div; --post_div) { | 964 | for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { |
853 | uint32_t ref_div; | 965 | uint32_t ref_div; |
854 | 966 | ||
855 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) | 967 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) |
@@ -965,6 +1077,10 @@ void radeon_compute_pll(struct radeon_pll *pll, | |||
965 | *frac_fb_div_p = best_frac_feedback_div; | 1077 | *frac_fb_div_p = best_frac_feedback_div; |
966 | *ref_div_p = best_ref_div; | 1078 | *ref_div_p = best_ref_div; |
967 | *post_div_p = best_post_div; | 1079 | *post_div_p = best_post_div; |
1080 | DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n", | ||
1081 | freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div, | ||
1082 | best_ref_div, best_post_div); | ||
1083 | |||
968 | } | 1084 | } |
969 | 1085 | ||
970 | static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) | 1086 | static void radeon_user_framebuffer_destroy(struct drm_framebuffer *fb) |
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c index 5e90984d5ad2..d4a542247618 100644 --- a/drivers/gpu/drm/radeon/radeon_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_encoders.c | |||
@@ -1063,7 +1063,7 @@ atombios_set_edp_panel_power(struct drm_connector *connector, int action) | |||
1063 | if (!ASIC_IS_DCE4(rdev)) | 1063 | if (!ASIC_IS_DCE4(rdev)) |
1064 | return; | 1064 | return; |
1065 | 1065 | ||
1066 | if ((action != ATOM_TRANSMITTER_ACTION_POWER_ON) || | 1066 | if ((action != ATOM_TRANSMITTER_ACTION_POWER_ON) && |
1067 | (action != ATOM_TRANSMITTER_ACTION_POWER_OFF)) | 1067 | (action != ATOM_TRANSMITTER_ACTION_POWER_OFF)) |
1068 | return; | 1068 | return; |
1069 | 1069 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index ace2e6384d40..cf0638c3b7c7 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -778,9 +778,9 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode) | |||
778 | DRM_DEBUG_KMS("\n"); | 778 | DRM_DEBUG_KMS("\n"); |
779 | 779 | ||
780 | if (!use_bios_divs) { | 780 | if (!use_bios_divs) { |
781 | radeon_compute_pll(pll, mode->clock, | 781 | radeon_compute_pll_legacy(pll, mode->clock, |
782 | &freq, &feedback_div, &frac_fb_div, | 782 | &freq, &feedback_div, &frac_fb_div, |
783 | &reference_div, &post_divider); | 783 | &reference_div, &post_divider); |
784 | 784 | ||
785 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { | 785 | for (post_div = &post_divs[0]; post_div->divider; ++post_div) { |
786 | if (post_div->divider == post_divider) | 786 | if (post_div->divider == post_divider) |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 12bdeab91c86..6794cdf91f28 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -149,6 +149,7 @@ struct radeon_tmds_pll { | |||
149 | #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) | 149 | #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) |
150 | #define RADEON_PLL_USE_POST_DIV (1 << 12) | 150 | #define RADEON_PLL_USE_POST_DIV (1 << 12) |
151 | #define RADEON_PLL_IS_LCD (1 << 13) | 151 | #define RADEON_PLL_IS_LCD (1 << 13) |
152 | #define RADEON_PLL_PREFER_MINM_OVER_MAXP (1 << 14) | ||
152 | 153 | ||
153 | struct radeon_pll { | 154 | struct radeon_pll { |
154 | /* reference frequency */ | 155 | /* reference frequency */ |
@@ -510,13 +511,21 @@ extern bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, | |||
510 | struct radeon_atom_ss *ss, | 511 | struct radeon_atom_ss *ss, |
511 | int id, u32 clock); | 512 | int id, u32 clock); |
512 | 513 | ||
513 | extern void radeon_compute_pll(struct radeon_pll *pll, | 514 | extern void radeon_compute_pll_legacy(struct radeon_pll *pll, |
514 | uint64_t freq, | 515 | uint64_t freq, |
515 | uint32_t *dot_clock_p, | 516 | uint32_t *dot_clock_p, |
516 | uint32_t *fb_div_p, | 517 | uint32_t *fb_div_p, |
517 | uint32_t *frac_fb_div_p, | 518 | uint32_t *frac_fb_div_p, |
518 | uint32_t *ref_div_p, | 519 | uint32_t *ref_div_p, |
519 | uint32_t *post_div_p); | 520 | uint32_t *post_div_p); |
521 | |||
522 | extern void radeon_compute_pll_avivo(struct radeon_pll *pll, | ||
523 | u32 freq, | ||
524 | u32 *dot_clock_p, | ||
525 | u32 *fb_div_p, | ||
526 | u32 *frac_fb_div_p, | ||
527 | u32 *ref_div_p, | ||
528 | u32 *post_div_p); | ||
520 | 529 | ||
521 | extern void radeon_setup_encoder_clones(struct drm_device *dev); | 530 | extern void radeon_setup_encoder_clones(struct drm_device *dev); |
522 | 531 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 3b1b2bf9cdd5..2aed03bde4b2 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -430,7 +430,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev, | |||
430 | { | 430 | { |
431 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); | 431 | struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); |
432 | struct radeon_device *rdev = ddev->dev_private; | 432 | struct radeon_device *rdev = ddev->dev_private; |
433 | u32 temp; | 433 | int temp; |
434 | 434 | ||
435 | switch (rdev->pm.int_thermal_type) { | 435 | switch (rdev->pm.int_thermal_type) { |
436 | case THERMAL_TYPE_RV6XX: | 436 | case THERMAL_TYPE_RV6XX: |
@@ -646,6 +646,9 @@ void radeon_pm_fini(struct radeon_device *rdev) | |||
646 | #endif | 646 | #endif |
647 | } | 647 | } |
648 | 648 | ||
649 | if (rdev->pm.power_state) | ||
650 | kfree(rdev->pm.power_state); | ||
651 | |||
649 | radeon_hwmon_fini(rdev); | 652 | radeon_hwmon_fini(rdev); |
650 | } | 653 | } |
651 | 654 | ||
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index 491dc9000655..2211a323db41 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -78,18 +78,23 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* get temperature in millidegrees */ | 80 | /* get temperature in millidegrees */ |
81 | u32 rv770_get_temp(struct radeon_device *rdev) | 81 | int rv770_get_temp(struct radeon_device *rdev) |
82 | { | 82 | { |
83 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> | 83 | u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >> |
84 | ASIC_T_SHIFT; | 84 | ASIC_T_SHIFT; |
85 | u32 actual_temp = 0; | 85 | int actual_temp; |
86 | 86 | ||
87 | if ((temp >> 9) & 1) | 87 | if (temp & 0x400) |
88 | actual_temp = 0; | 88 | actual_temp = -256; |
89 | else | 89 | else if (temp & 0x200) |
90 | actual_temp = (temp >> 1) & 0xff; | 90 | actual_temp = 255; |
91 | 91 | else if (temp & 0x100) { | |
92 | return actual_temp * 1000; | 92 | actual_temp = temp & 0x1ff; |
93 | actual_temp |= ~0x1ff; | ||
94 | } else | ||
95 | actual_temp = temp & 0xff; | ||
96 | |||
97 | return (actual_temp * 1000) / 2; | ||
93 | } | 98 | } |
94 | 99 | ||
95 | void rv770_pm_misc(struct radeon_device *rdev) | 100 | void rv770_pm_misc(struct radeon_device *rdev) |