[Intel-gfx] [PATCH 3/4] drm/i915: send proper opregion notifications on suspend/resume

Imre Deak imre.deak at intel.com
Fri May 30 15:47:13 CEST 2014


On Thu, 2014-05-29 at 14:11 -0700, Jesse Barnes wrote:
> From: Kristen Carlson Accardi <kristen at linux.intel.com>
> 
> This indicates to the firmware that it can power down various other
> components or bring them back up, depending on the target system state.
> 
> Signed-off-by: Kristen Carlson Accardi <kristen at linux.intel.com>
> Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
> ---
>  drivers/acpi/sleep.c            |  1 +
>  drivers/gpu/drm/i915/i915_drv.c | 10 ++++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index c40fb2e..807f333 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -89,6 +89,7 @@ u32 acpi_target_system_state(void)
>  {
>  	return acpi_target_sleep_state;
>  }
> +EXPORT_SYMBOL(acpi_target_system_state);
>  
>  static bool pwr_btn_event_pending;
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 433bdfa..b6211d7 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -28,6 +28,7 @@
>   */
>  
>  #include <linux/device.h>
> +#include <linux/acpi.h>
>  #include <drm/drmP.h>
>  #include <drm/i915_drm.h>
>  #include "i915_drv.h"
> @@ -491,6 +492,7 @@ static int i915_drm_freeze(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	struct drm_crtc *crtc;
> +	pci_power_t opregion_target_state;
>  
>  	intel_runtime_pm_get(dev_priv);
>  
> @@ -540,6 +542,12 @@ static int i915_drm_freeze(struct drm_device *dev)
>  
>  	i915_save_state(dev);
>  
> +	if (acpi_target_system_state() >= ACPI_STATE_S3)
> +		opregion_target_state = PCI_D3cold;
> +	else
> +		opregion_target_state = PCI_D1;
> +	intel_opregion_notify_adapter(dev, opregion_target_state);
> +
>  	intel_opregion_fini(dev);
>  
>  	console_lock();
> @@ -671,6 +679,8 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
>  	dev_priv->modeset_restore = MODESET_DONE;
>  	mutex_unlock(&dev_priv->modeset_restore_lock);
>  
> +	intel_opregion_notify_adapter(dev, PCI_D0);
> +

This could be moved after intel_opregion_init() just for clarity, but
I'm also fine keeping it here.

This patch depends on Rafael's change in his PM tree to export
acpi_target_system_state(), other than that this is:
Reviewed-by: Imre Deak <imre.deak at intel.com>
 
>  	intel_runtime_pm_put(dev_priv);
>  	return 0;
>  }

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20140530/0a3ea7de/attachment.sig>


More information about the Intel-gfx mailing list