ASoC: SOF: Introduce state machine for FW boot
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Wed, 18 Dec 2019 00:26:09 +0000 (18:26 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 18 Dec 2019 19:52:20 +0000 (19:52 +0000)
commit6ca5cecbd1c1758666ab79446f19e0e61ed11444
treed05cd82d0ad092b2c88fda659bc5f3995f7cd7dd
parentcf5629e4594c2164aa629d21a749c65ad594de95
ASoC: SOF: Introduce state machine for FW boot

Add a state machine for FW boot to track the
different stages of FW boot and replace the boot_complete
field with fw_state field in struct snd_sof_dev.
This will be used to determine the actions to be performed
during system suspend.

One of the main motivations for adding this change is the
fact that errors during the top-level SOF device probe cannot
be propagated and therefore suspending the SOF device normally
during system suspend could potentially run into errors.
For example, with the current flow, if the FW boot failed
for some reason and the system suspends, the SOF device
suspend could fail because the CTX_SAVE IPC would be attempted
even though the FW never really booted successfully causing it
to time out. Another scenario that the state machine fixes
is when the runtime suspend for the SOF device fails and
the DSP is powered down nevertheless, the CTX_SAVE IPC during
system suspend would timeout because the DSP is already
powered down.

Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20191218002616.7652-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/core.c
sound/soc/sof/intel/hda-loader.c
sound/soc/sof/intel/hda.c
sound/soc/sof/ipc.c
sound/soc/sof/loader.c
sound/soc/sof/pm.c
sound/soc/sof/sof-priv.h