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

Takashi Iwai tiwai at suse.de
Thu Apr 4 15:31:55 CEST 2019


On Thu, 21 Mar 2019 17:10:13 +0100,
Pierre-Louis Bossart wrote:
> 
> From: Liam Girdwood <liam.r.girdwood at linux.intel.com>
> 
> 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 <ranjani.sridharan at linux.intel.com>
> Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> ---
>  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 <liam.r.girdwood at linux.intel.com>
> +//
> +
> +#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


More information about the Sound-open-firmware mailing list