From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH v5 11/14] ASoC: SOF: Add PM support Date: Thu, 04 Apr 2019 15:31:55 +0200 Message-ID: References: <20190321161016.26515-1-pierre-louis.bossart@linux.intel.com> <20190321161016.26515-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: <20190321161016.26515-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" To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, Alan Cox , Daniel Baluta , Ranjani Sridharan , liam.r.girdwood@linux.intel.com, vkoul@kernel.org, broonie@kernel.org, andriy.shevchenko@linux.intel.com, sound-open-firmware@alsa-project.org List-Id: alsa-devel@alsa-project.org On Thu, 21 Mar 2019 17:10:13 +0100, Pierre-Louis Bossart wrote: > > From: Liam Girdwood > > Add support for saving and restoring DSP context in D3 to host DDR. > > The suspend callback includes: suspend all pcm's stream that are running, > send CTX_SAVE ipc, drop all ipc's, release trace dma and then > power off the DSP. > > And the resume callback performs the following steps: load FW, run FW, > re-initialize trace, restore pipeline, restore the kcontrol values > and finally send the ctx restore ipc to the dsp. > > The streams that are suspended are resumed by the ALSA resume trigger. > If the streams are paused during system suspend, they are marked > explicitly so they can be restored during PAUSE_RELEASE. > > Signed-off-by: Ranjani Sridharan > Signed-off-by: Liam Girdwood > Signed-off-by: Pierre-Louis Bossart > --- > sound/soc/sof/pm.c | 373 +++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 373 insertions(+) > create mode 100644 sound/soc/sof/pm.c > > diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c > new file mode 100644 > index 000000000000..fd0cf10bf742 > --- /dev/null > +++ b/sound/soc/sof/pm.c > @@ -0,0 +1,373 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) > +// > +// This file is provided under a dual BSD/GPLv2 license. When using or > +// redistributing this file, you may do so under either license. > +// > +// Copyright(c) 2018 Intel Corporation. All rights reserved. > +// > +// Author: Liam Girdwood > +// > + > +#include "ops.h" > +#include "sof-priv.h" > + > +static int sof_restore_kcontrols(struct snd_sof_dev *sdev) > +{ > + struct snd_sof_control *scontrol = NULL; > + int ipc_cmd, ctrl_type; > + int ret = 0; > + > + /* restore kcontrol values */ > + list_for_each_entry(scontrol, &sdev->kcontrol_list, list) { > + /* reset readback offset for scontrol after resuming */ > + scontrol->readback_offset = 0; > + > + /* notify DSP of kcontrol values */ > + switch (scontrol->cmd) { > + case SOF_CTRL_CMD_VOLUME: > + /* fallthrough */ > + case SOF_CTRL_CMD_ENUM: > + /* fallthrough */ > + case SOF_CTRL_CMD_SWITCH: In such an expression, fallthrough marker is superfluous. switch (foo) { case A: case B: case C: .... thanks, Takashi