[Sound-open-firmware] [SOF][KERNEL] pm_runtime flow in sof

Daniel Baluta daniel.baluta at nxp.com
Tue Oct 5 18:24:31 CEST 2021


Hi Allen,

Not sure I understood your question correctly. But here is how I understood things happens.

PM manager enables PM domain before sof_probe_continue.

We then have:

sof_probe_continue
-------> sof_probe_continue
-------> sof_probe_run
            [ At this point DSP is running]
sof_probe_complete
 [ AT this point RUNTIME PM is set and the DSP will enter runtime suspend if nothing happens in the next 2 seconds ]

After two seconds the DSP will enter runtime suspend and the PM domain will be put to off by PM core.

Next, if anyone tries to use the DSP (via aplay for example) the RUNTIME PM RESUME will be called the PM domain will be turned ON
the firmware will be booted again and start to run normally.

Hope this is clear. Please also Cc: sound-open-firmware at alsa-project.org for your next emails

thanks,
Daniel.


________________________________
From: Allen-KH Cheng (程冠勳) <Allen-KH.Cheng at mediatek.com>
Sent: Monday, October 4, 2021 2:03 PM
To: Daniel Baluta <daniel.baluta at nxp.com>
Cc: YC Hung (洪堯俊) <yc.hung at mediatek.com>
Subject: [SOF][KERNEL] pm_runtime flow in sof


Hi Daniel,



This is Allen Cheng from Mediatek.



Sorry to bother you.



In sof_probe_continue



static int sof_probe_continue(struct snd_sof_dev *sdev)

{

              struct snd_sof_pdata *plat_data = sdev->pdata;

              int ret;



              /* probe the DSP hardware */

              ret = snd_sof_probe(sdev);

              if (ret < 0) {

                             dev_err(sdev->dev, "error: failed to probe DSP %d\n", ret);

                             return ret;

              }



….

              /* init the IPC */

              sdev->ipc = snd_sof_ipc_init(sdev);

              if (!sdev->ipc) {

                             ret = -ENOMEM;

                             dev_err(sdev->dev, "error: failed to init DSP IPC %d\n", ret);

                             goto ipc_err;

              }



              /* load the firmware */

              ret = snd_sof_load_firmware(sdev);

              if (ret < 0) {

                             dev_err(sdev->dev, "error: failed to load DSP firmware %d\n",

                                           ret);

                             goto fw_load_err;

              }



              sdev->fw_state = SOF_FW_BOOT_IN_PROGRESS;



              /*

              * Boot the firmware. The FW boot status will be modified

              * in snd_sof_run_firmware() depending on the outcome.

              */

              ret = snd_sof_run_firmware(sdev);

              if (ret < 0) {

                             dev_err(sdev->dev, "error: failed to boot DSP firmware %d\n",

                                           ret);

                             goto fw_run_err;

              }





……..

}





Normally, we set power domain device node in DTS for sof device driver.



So the device power will be enabled by pm_runtime manager before device probe.



if we don’t call pm_runtime_get_sync  in snd_sof_probe.



The device power should disable after snd_sof_probe done. (Because reference count is zero)



I wonder that how does imx driver handle this situation  .



Because the sof_probe_continue will do snd_sof_load_firmware and snd_sof_run_firmware after snd_sof_probe.



I think it’s impossible that we load fw and launch when DSP is power off .



I would appreciate it if you could give me some advice. :)



Thnaks.

************* MEDIATEK Confidentiality Notice ********************
The information contained in this e-mail message (including any
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be
conveyed only to the designated recipient(s). Any use, dissemination,
distribution, printing, retaining or copying of this e-mail (including its
attachments) by unintended recipient(s) is strictly prohibited and may
be unlawful. If you are not an intended recipient of this e-mail, or believe
that you have received this e-mail in error, please notify the sender
immediately (by replying to this e-mail), delete any and all copies of
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!



More information about the Sound-open-firmware mailing list