diff mbox

[06/19] drm/i915: do adapter power state notification at runtime PM

Message ID 1385583224-2593-1-git-send-email-przanoni@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Zanoni Nov. 27, 2013, 8:13 p.m. UTC
From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Now that we are actually setting the device to the D3 state, we should
issue the notification.

The opregion spec says we should send the message before the adapter
is about to be placed in a lower power state, and after the adapter is
placed in a higher power state.

Jani originally wrote a similar patch for PC8, but then we discovered
that we were not really changing the PCI D states when
enabling/disabling PC8, so we had to postpone his patch.

v2: - Improve commit message, explaining the expected state.

Cc: Jani Nikula <jani.nikula@intel.com>
Credits-to: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Rodrigo Vivi Nov. 29, 2013, 12:56 p.m. UTC | #1
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

On Wed, Nov 27, 2013 at 06:13:44PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
> 
> Now that we are actually setting the device to the D3 state, we should
> issue the notification.
> 
> The opregion spec says we should send the message before the adapter
> is about to be placed in a lower power state, and after the adapter is
> placed in a higher power state.
> 
> Jani originally wrote a similar patch for PC8, but then we discovered
> that we were not really changing the PCI D states when
> enabling/disabling PC8, so we had to postpone his patch.
> 
> v2: - Improve commit message, explaining the expected state.
> 
> Cc: Jani Nikula <jani.nikula@intel.com>
> Credits-to: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index d5310a0..6b92929 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -918,6 +918,7 @@ static int i915_runtime_suspend(struct device *device)
>  
>  	dev_priv->pm.suspended = true;
>  
> +	intel_opregion_notify_adapter(dev, PCI_D3cold);
>  	pci_save_state(pdev);
>  	pci_set_power_state(pdev, PCI_D3cold);
>  
> @@ -936,6 +937,7 @@ static int i915_runtime_resume(struct device *device)
>  
>  	pci_set_power_state(pdev, PCI_D0);
>  	pci_restore_state(pdev);
> +	intel_opregion_notify_adapter(dev, PCI_D0);
>  
>  	dev_priv->pm.suspended = false;
>  
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Rodrigo Vivi Nov. 29, 2013, 1:33 p.m. UTC | #2
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>

(resent with correct smtp)

On Fri, Nov 29, 2013 at 10:56 AM, Rodrigo Vivi <rodrigo.vivi@gmail.com> wrote:
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
>
> On Wed, Nov 27, 2013 at 06:13:44PM -0200, Paulo Zanoni wrote:
>> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>>
>> Now that we are actually setting the device to the D3 state, we should
>> issue the notification.
>>
>> The opregion spec says we should send the message before the adapter
>> is about to be placed in a lower power state, and after the adapter is
>> placed in a higher power state.
>>
>> Jani originally wrote a similar patch for PC8, but then we discovered
>> that we were not really changing the PCI D states when
>> enabling/disabling PC8, so we had to postpone his patch.
>>
>> v2: - Improve commit message, explaining the expected state.
>>
>> Cc: Jani Nikula <jani.nikula@intel.com>
>> Credits-to: Jani Nikula <jani.nikula@intel.com>
>> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
>> ---
>>  drivers/gpu/drm/i915/i915_drv.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
>> index d5310a0..6b92929 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -918,6 +918,7 @@ static int i915_runtime_suspend(struct device *device)
>>
>>       dev_priv->pm.suspended = true;
>>
>> +     intel_opregion_notify_adapter(dev, PCI_D3cold);
>>       pci_save_state(pdev);
>>       pci_set_power_state(pdev, PCI_D3cold);
>>
>> @@ -936,6 +937,7 @@ static int i915_runtime_resume(struct device *device)
>>
>>       pci_set_power_state(pdev, PCI_D0);
>>       pci_restore_state(pdev);
>> +     intel_opregion_notify_adapter(dev, PCI_D0);
>>
>>       dev_priv->pm.suspended = false;
>>
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index d5310a0..6b92929 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -918,6 +918,7 @@  static int i915_runtime_suspend(struct device *device)
 
 	dev_priv->pm.suspended = true;
 
+	intel_opregion_notify_adapter(dev, PCI_D3cold);
 	pci_save_state(pdev);
 	pci_set_power_state(pdev, PCI_D3cold);
 
@@ -936,6 +937,7 @@  static int i915_runtime_resume(struct device *device)
 
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
+	intel_opregion_notify_adapter(dev, PCI_D0);
 
 	dev_priv->pm.suspended = false;