From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com,
pierre-louis.bossart@linux.intel.com, rander.wang@intel.com,
ranjani.sridharan@linux.intel.com,
yung-chuan.liao@linux.intel.com
Subject: [PATCH 08/11] ASoC: SOF: pm: Extend the optionality of IPC ops to IPC as well
Date: Wed, 21 Dec 2022 12:23:25 +0200 [thread overview]
Message-ID: <20221221102328.9635-9-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20221221102328.9635-1-peter.ujfalusi@linux.intel.com>
The IPC ops are optional, but they require that the ops struct is to be
allocated with all callbacks set to NULL.
Update the code to extend the optionality to:
sdev->ipc == NULL
sdev->ipc->ops == NULL
sdev->ipc->ops->[pm/tplg] == NULL (treated optional for pm currently)
sdev->ipc->ops->[pm/tplg]->ops == NULL (treated optional currently)
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
---
sound/soc/sof/pm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index df740be645e8..e7fce9e4a0d2 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -73,8 +73,8 @@ static void sof_cache_debugfs(struct snd_sof_dev *sdev)
static int sof_resume(struct device *dev, bool runtime_resume)
{
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
- const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm;
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm);
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
u32 old_state = sdev->dsp_power_state.state;
int ret;
@@ -155,7 +155,7 @@ static int sof_resume(struct device *dev, bool runtime_resume)
}
/* restore pipelines */
- if (tplg_ops->set_up_all_pipelines) {
+ if (tplg_ops && tplg_ops->set_up_all_pipelines) {
ret = tplg_ops->set_up_all_pipelines(sdev, false);
if (ret < 0) {
dev_err(sdev->dev, "Failed to restore pipeline after resume %d\n", ret);
@@ -179,8 +179,8 @@ static int sof_resume(struct device *dev, bool runtime_resume)
static int sof_suspend(struct device *dev, bool runtime_suspend)
{
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
- const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm;
- const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
+ const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm);
+ const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
pm_message_t pm_state;
u32 target_state = 0;
int ret;
@@ -277,7 +277,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
int snd_sof_dsp_power_down_notify(struct snd_sof_dev *sdev)
{
- const struct sof_ipc_pm_ops *pm_ops = sdev->ipc->ops->pm;
+ const struct sof_ipc_pm_ops *pm_ops = sof_ipc_get_ops(sdev, pm);
/* Notify DSP of upcoming power down */
if (sof_ops(sdev)->remove && pm_ops && pm_ops->ctx_save)
--
2.39.0
next prev parent reply other threads:[~2022-12-21 10:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 10:23 [PATCH 00/11] ASoC: SOF: Extend the IPC ops optionality Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 01/11] ASoC: SOF: sof-audio: Treat tplg_ops->route_setup() as optional Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 02/11] ASoC: SOF: sof-audio: Update documentation for sof_ipc_tplg_ops Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 03/11] ASoC: SOF: Add helper macro to be used to get an IPC ops Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 04/11] ASoC: SOF: pcm: Extend the optionality of IPC ops to IPC as well Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 05/11] ASoC: SOF: control: " Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 06/11] ASoC: SOF: sof-audio: " Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 07/11] ASoC: SOF: topology: " Peter Ujfalusi
2022-12-21 10:23 ` Peter Ujfalusi [this message]
2022-12-21 10:23 ` [PATCH 09/11] ASoC: SOF: sof-priv: Mark fw_tracing ops optional in documentation Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 10/11] ASoC: SOF: trace: Use sof_ipc_get_ops() in sof_fw_trace_init Peter Ujfalusi
2022-12-21 10:23 ` [PATCH 11/11] ASoC: SOF: trace: No need to check for op pointer in sof_fw_trace_free() Peter Ujfalusi
2022-12-27 11:57 ` [PATCH 00/11] ASoC: SOF: Extend the IPC ops optionality Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221221102328.9635-9-peter.ujfalusi@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox