From 753bbb202b8e464cb425372266042cc7d60d3513 Mon Sep 17 00:00:00 2001
From: Dave Airlie <airlied@redhat.com>
Date: Wed, 17 Feb 2016 23:21:13 +1000
Subject: [PATCH] nouveau: hack the parent power down so the GPU powers down.
---
drivers/acpi/device_pm.c | 3 +++
drivers/gpu/drm/nouveau/nouveau_drm.c | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
@@ -117,6 +117,9 @@ int acpi_device_get_power(struct acpi_device *device, int *state)
&& result == ACPI_STATE_D0)
device->parent->power.state = ACPI_STATE_D0;
+ if (result == ACPI_STATE_UNKNOWN)
+ result = device->parent ?
+ device->parent->power.state : ACPI_STATE_D0;
*state = result;
out:
@@ -715,6 +715,14 @@ nouveau_pmops_runtime_suspend(struct device *dev)
pci_disable_device(pdev);
pci_ignore_hotplug(pdev);
pci_set_power_state(pdev, PCI_D3cold);
+ {
+ struct acpi_device *adev;
+ int r;
+
+ r = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev);
+ if (!r)
+ acpi_device_set_power(adev->parent, ACPI_STATE_D3_COLD);
+ }
drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
return ret;
}
@@ -730,6 +738,14 @@ nouveau_pmops_runtime_resume(struct device *dev)
if (nouveau_runtime_pm == 0)
return -EINVAL;
+ {
+ struct acpi_device *adev;
+ int r;
+
+ r = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev);
+ if (!r)
+ acpi_device_set_power(adev->parent, ACPI_STATE_D0);
+ }
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
ret = pci_enable_device(pdev);
--
2.5.0