[Intel-gfx] [PATCH] drm/i915: Ensure proper HDA suspend/resume ordering with a device link

Takashi Iwai tiwai at suse.de
Thu Oct 18 15:00:34 UTC 2018


On Thu, 18 Oct 2018 16:25:58 +0200,
Imre Deak wrote:
> 
> In order to ensure that our system suspend and resume callbacks are
> called in the correct order wrt. those of the HDA driver add a device
> link to the HDA driver during audio component binding time. With i915 as
> the supplier and HDA as the consumer the PM framework will guarantee
> the HDA->i915 suspend (and shutdown) and i915->HDA resume order.
> 
> Atm, the lack of this ordering is not a problem, since all the i915
> suspend/resume steps that need to be ordered wrt. the HDA driver's
> suspend/resume steps are separated out to the i915
> suspend_late/resume_early hooks. That will change in a follow-up
> patchset where we'll need this ordering guarantee for steps that are in
> the i915 suspend/resume hooks (and which can't be moved to
> suspend_late/resume_early for other reasons). So this patch is a
> preparation for that follow-up patchset.
> 
> The change also allows us to move towards removing the i915
> suspend_late/resume_early hooks alltogether.
> 
> Since we only need to ensure the ordering during suspend/resume and not
> during driver probing create the link with DL_FLAG_STATELESS. Since the
> probe time ordering has to be optional we use the component framework
> for that.
> 
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: Takashi Iwai <tiwai at suse.de>
> Signed-off-by: Imre Deak <imre.deak at intel.com>

This looks like a good idea!


thanks,

Takashi

> ---
>  drivers/gpu/drm/i915/intel_audio.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index 769f3f586661..391b88701610 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -921,6 +921,8 @@ static int i915_audio_component_bind(struct device *i915_kdev,
>  	dev_priv->audio_component = acomp;
>  	drm_modeset_unlock_all(&dev_priv->drm);
>  
> +	WARN_ON(!device_link_add(hda_kdev, i915_kdev, DL_FLAG_STATELESS));
> +
>  	return 0;
>  }
>  
> @@ -930,6 +932,8 @@ static void i915_audio_component_unbind(struct device *i915_kdev,
>  	struct i915_audio_component *acomp = data;
>  	struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev);
>  
> +	device_link_remove(hda_kdev, i915_kdev);
> +
>  	drm_modeset_lock_all(&dev_priv->drm);
>  	acomp->base.ops = NULL;
>  	acomp->base.dev = NULL;
> -- 
> 2.13.2
> 


More information about the Intel-gfx mailing list