From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH v3 11/14] ASoC: SOF: Add PM support Date: Wed, 12 Dec 2018 12:32:06 +0100 Message-ID: References: <20181211212318.28644-1-pierre-louis.bossart@linux.intel.com> <20181211212318.28644-12-pierre-louis.bossart@linux.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20181211212318.28644-12-pierre-louis.bossart@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, andriy.shevchenko@intel.com, Daniel Baluta , Ranjani Sridharan , liam.r.girdwood@linux.intel.com, vkoul@kernel.org, broonie@kernel.org, Alan Cox , sound-open-firmware@alsa-project.org List-Id: alsa-devel@alsa-project.org 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