• Daniel Baluta's avatar
    ASoC: SOF: imx8m: Add runtime PM / System PM support · a73b493d
    Daniel Baluta authored
    We make use of common imx8m_suspend / imx8m_resume functions
    for both system PM and runtime PM.
    
    imx8m_suspend:
    	- frees the MU channels
    	- disables the clocks
    
    imx8m_resume
    	- enables the clocks
    	- requests the MU channels
    
    On i.MX8MP there is no dedicated functionality to put the DSP in reset.
    The only way of doing this is to POWER DOWN the Audiomix domain.
    
    We are able to do this because turning off the clocks and freeing the
    channels makes the Audiomix to have no users thus PM kernel core turns
    it down.
    
    SOF core will not call system PM suspend handler if the DSP is already
    down, but at resume it will call the system PM resume. So, we need to
    keep track of the state via snd_sof_dsp_set_power_state
    
    Few insights on how SOF core handles the PM:
     - SOF core uses PM runtime autosuspend (with a timeout of 2 secs)
     - at probe, SOF core boots the DSP and lets the PM runtime suspend to
       turn it off, if there is no activity
     - when someone opens the ALSA sound card (aplay/arecord, etc) ALSA core
       calls PM runtime resume to turn on the DSP
     - when the ALSA sound card is closed SOF core make use of PM subsystem
      to call PM runtime suspend and thus turning off the DSP.
    Signed-off-by: default avatarDaniel Baluta <daniel.baluta@nxp.com>
    Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
    Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20211119094319.81674-4-daniel.baluta@oss.nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
    a73b493d
imx8m.c 9.35 KB