[Sound-open-firmware] [PATCH v3 11/14] ASoC: SOF: Add PM support

Takashi Iwai tiwai at suse.de
Wed Dec 12 12:32:06 CET 2018


On Tue, 11 Dec 2018 22:23:15 +0100,
Pierre-Louis Bossart wrote:
> 
> +#define RUNTIME_PM 1

What's this?  This seems used in snd_soc_runtime_suspend() and
_resume().  But it's a just normal boolean flag, no?

> +static void sof_suspend_streams(struct snd_sof_dev *sdev)
> +{
> +	struct snd_sof_pcm *spcm;
> +	struct snd_pcm_substream *substream;
> +	int dir;
> +
> +	/* suspend all running streams */
> +	list_for_each_entry(spcm, &sdev->pcm_list, list) {
> +
> +		mutex_lock(&spcm->mutex);
> +
> +		/* suspend running playback stream */
> +		dir = SNDRV_PCM_STREAM_PLAYBACK;
> +		substream = spcm->stream[dir].substream;
> +
> +		if (substream && substream->runtime) {
> +
> +			snd_pcm_suspend(substream);
> +
> +			/*
> +			 * set restore_stream so that hw_params can be
> +			 * restored during resume
> +			 */
> +			spcm->restore_stream[dir] = 1;
> +		}
> +
> +		/* suspend running capture stream */
> +		dir = SNDRV_PCM_STREAM_CAPTURE;
> +		substream = spcm->stream[dir].substream;
> +
> +		if (substream && substream->runtime) {
> +
> +			snd_pcm_suspend(substream);
> +
> +			/*
> +			 * set restore_stream so that hw_params can be
> +			 * restored during resume
> +			 */
> +			spcm->restore_stream[dir] = 1;
> +		}

Both playback and capture do the same thing, so this can be a loop of
dir.


thanks,

Takashi


More information about the Sound-open-firmware mailing list