diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drm.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 51 |
1 files changed, 13 insertions, 38 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index 9c3af96a7153..3ed32dd90303 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -547,9 +547,11 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime) | |||
547 | struct nouveau_cli *cli; | 547 | struct nouveau_cli *cli; |
548 | int ret; | 548 | int ret; |
549 | 549 | ||
550 | if (dev->mode_config.num_crtc && !runtime) { | 550 | if (dev->mode_config.num_crtc) { |
551 | NV_INFO(drm, "suspending console...\n"); | ||
552 | nouveau_fbcon_set_suspend(dev, 1); | ||
551 | NV_INFO(drm, "suspending display...\n"); | 553 | NV_INFO(drm, "suspending display...\n"); |
552 | ret = nouveau_display_suspend(dev); | 554 | ret = nouveau_display_suspend(dev, runtime); |
553 | if (ret) | 555 | if (ret) |
554 | return ret; | 556 | return ret; |
555 | } | 557 | } |
@@ -603,7 +605,7 @@ fail_client: | |||
603 | fail_display: | 605 | fail_display: |
604 | if (dev->mode_config.num_crtc) { | 606 | if (dev->mode_config.num_crtc) { |
605 | NV_INFO(drm, "resuming display...\n"); | 607 | NV_INFO(drm, "resuming display...\n"); |
606 | nouveau_display_resume(dev); | 608 | nouveau_display_resume(dev, runtime); |
607 | } | 609 | } |
608 | return ret; | 610 | return ret; |
609 | } | 611 | } |
@@ -618,9 +620,6 @@ int nouveau_pmops_suspend(struct device *dev) | |||
618 | drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) | 620 | drm_dev->switch_power_state == DRM_SWITCH_POWER_DYNAMIC_OFF) |
619 | return 0; | 621 | return 0; |
620 | 622 | ||
621 | if (drm_dev->mode_config.num_crtc) | ||
622 | nouveau_fbcon_set_suspend(drm_dev, 1); | ||
623 | |||
624 | ret = nouveau_do_suspend(drm_dev, false); | 623 | ret = nouveau_do_suspend(drm_dev, false); |
625 | if (ret) | 624 | if (ret) |
626 | return ret; | 625 | return ret; |
@@ -633,7 +632,7 @@ int nouveau_pmops_suspend(struct device *dev) | |||
633 | } | 632 | } |
634 | 633 | ||
635 | static int | 634 | static int |
636 | nouveau_do_resume(struct drm_device *dev) | 635 | nouveau_do_resume(struct drm_device *dev, bool runtime) |
637 | { | 636 | { |
638 | struct nouveau_drm *drm = nouveau_drm(dev); | 637 | struct nouveau_drm *drm = nouveau_drm(dev); |
639 | struct nouveau_cli *cli; | 638 | struct nouveau_cli *cli; |
@@ -658,7 +657,9 @@ nouveau_do_resume(struct drm_device *dev) | |||
658 | 657 | ||
659 | if (dev->mode_config.num_crtc) { | 658 | if (dev->mode_config.num_crtc) { |
660 | NV_INFO(drm, "resuming display...\n"); | 659 | NV_INFO(drm, "resuming display...\n"); |
661 | nouveau_display_repin(dev); | 660 | nouveau_display_resume(dev, runtime); |
661 | NV_INFO(drm, "resuming console...\n"); | ||
662 | nouveau_fbcon_set_suspend(dev, 0); | ||
662 | } | 663 | } |
663 | 664 | ||
664 | return 0; | 665 | return 0; |
@@ -681,47 +682,21 @@ int nouveau_pmops_resume(struct device *dev) | |||
681 | return ret; | 682 | return ret; |
682 | pci_set_master(pdev); | 683 | pci_set_master(pdev); |
683 | 684 | ||
684 | ret = nouveau_do_resume(drm_dev); | 685 | return nouveau_do_resume(drm_dev, false); |
685 | if (ret) | ||
686 | return ret; | ||
687 | |||
688 | if (drm_dev->mode_config.num_crtc) { | ||
689 | nouveau_display_resume(drm_dev); | ||
690 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
691 | } | ||
692 | |||
693 | return 0; | ||
694 | } | 686 | } |
695 | 687 | ||
696 | static int nouveau_pmops_freeze(struct device *dev) | 688 | static int nouveau_pmops_freeze(struct device *dev) |
697 | { | 689 | { |
698 | struct pci_dev *pdev = to_pci_dev(dev); | 690 | struct pci_dev *pdev = to_pci_dev(dev); |
699 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 691 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
700 | int ret; | 692 | return nouveau_do_suspend(drm_dev, false); |
701 | |||
702 | if (drm_dev->mode_config.num_crtc) | ||
703 | nouveau_fbcon_set_suspend(drm_dev, 1); | ||
704 | |||
705 | ret = nouveau_do_suspend(drm_dev, false); | ||
706 | return ret; | ||
707 | } | 693 | } |
708 | 694 | ||
709 | static int nouveau_pmops_thaw(struct device *dev) | 695 | static int nouveau_pmops_thaw(struct device *dev) |
710 | { | 696 | { |
711 | struct pci_dev *pdev = to_pci_dev(dev); | 697 | struct pci_dev *pdev = to_pci_dev(dev); |
712 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | 698 | struct drm_device *drm_dev = pci_get_drvdata(pdev); |
713 | int ret; | 699 | return nouveau_do_resume(drm_dev, false); |
714 | |||
715 | ret = nouveau_do_resume(drm_dev); | ||
716 | if (ret) | ||
717 | return ret; | ||
718 | |||
719 | if (drm_dev->mode_config.num_crtc) { | ||
720 | nouveau_display_resume(drm_dev); | ||
721 | nouveau_fbcon_set_suspend(drm_dev, 0); | ||
722 | } | ||
723 | |||
724 | return 0; | ||
725 | } | 700 | } |
726 | 701 | ||
727 | 702 | ||
@@ -977,7 +952,7 @@ static int nouveau_pmops_runtime_resume(struct device *dev) | |||
977 | return ret; | 952 | return ret; |
978 | pci_set_master(pdev); | 953 | pci_set_master(pdev); |
979 | 954 | ||
980 | ret = nouveau_do_resume(drm_dev); | 955 | ret = nouveau_do_resume(drm_dev, true); |
981 | drm_kms_helper_poll_enable(drm_dev); | 956 | drm_kms_helper_poll_enable(drm_dev); |
982 | /* do magic */ | 957 | /* do magic */ |
983 | nvif_mask(device, 0x88488, (1 << 25), (1 << 25)); | 958 | nvif_mask(device, 0x88488, (1 << 25), (1 << 25)); |