Commit 62fde977 authored by Kai Vehmanen's avatar Kai Vehmanen Committed by Mark Brown

ASoC: SOF: add runtime idle callback

Add ability to implement a SOF device level runtime idle callback.
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20190702132428.13129-3-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e62bccf8
...@@ -457,6 +457,7 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, int state); ...@@ -457,6 +457,7 @@ int hda_dsp_suspend(struct snd_sof_dev *sdev, int state);
int hda_dsp_resume(struct snd_sof_dev *sdev); int hda_dsp_resume(struct snd_sof_dev *sdev);
int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev, int state); int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev, int state);
int hda_dsp_runtime_resume(struct snd_sof_dev *sdev); int hda_dsp_runtime_resume(struct snd_sof_dev *sdev);
int hda_dsp_runtime_idle(struct snd_sof_dev *sdev);
int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev); int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev);
void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags); void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags);
void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags); void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
......
...@@ -134,6 +134,14 @@ static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev, ...@@ -134,6 +134,14 @@ static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev,
return 0; return 0;
} }
static inline int snd_sof_dsp_runtime_idle(struct snd_sof_dev *sdev)
{
if (sof_ops(sdev)->runtime_idle)
return sof_ops(sdev)->runtime_idle(sdev);
return 0;
}
static inline int snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev) static inline int snd_sof_dsp_hw_params_upon_resume(struct snd_sof_dev *sdev)
{ {
if (sof_ops(sdev)->set_hw_params_upon_resume) if (sof_ops(sdev)->set_hw_params_upon_resume)
......
...@@ -394,6 +394,14 @@ int snd_sof_runtime_suspend(struct device *dev) ...@@ -394,6 +394,14 @@ int snd_sof_runtime_suspend(struct device *dev)
} }
EXPORT_SYMBOL(snd_sof_runtime_suspend); EXPORT_SYMBOL(snd_sof_runtime_suspend);
int snd_sof_runtime_idle(struct device *dev)
{
struct snd_sof_dev *sdev = dev_get_drvdata(dev);
return snd_sof_dsp_runtime_idle(sdev);
}
EXPORT_SYMBOL(snd_sof_runtime_idle);
int snd_sof_runtime_resume(struct device *dev) int snd_sof_runtime_resume(struct device *dev)
{ {
return sof_resume(dev, true); return sof_resume(dev, true);
......
...@@ -116,7 +116,7 @@ static const struct sof_dev_desc sof_acpi_cherrytrail_desc = { ...@@ -116,7 +116,7 @@ static const struct sof_dev_desc sof_acpi_cherrytrail_desc = {
static const struct dev_pm_ops sof_acpi_pm = { static const struct dev_pm_ops sof_acpi_pm = {
SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume) SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume, SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
NULL) snd_sof_runtime_idle)
}; };
static void sof_acpi_probe_complete(struct device *dev) static void sof_acpi_probe_complete(struct device *dev)
......
...@@ -206,7 +206,7 @@ static const struct sof_dev_desc kbl_desc = { ...@@ -206,7 +206,7 @@ static const struct sof_dev_desc kbl_desc = {
static const struct dev_pm_ops sof_pci_pm = { static const struct dev_pm_ops sof_pci_pm = {
SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume) SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_resume)
SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume, SET_RUNTIME_PM_OPS(snd_sof_runtime_suspend, snd_sof_runtime_resume,
NULL) snd_sof_runtime_idle)
}; };
static void sof_pci_probe_complete(struct device *dev) static void sof_pci_probe_complete(struct device *dev)
......
...@@ -176,6 +176,7 @@ struct snd_sof_dsp_ops { ...@@ -176,6 +176,7 @@ struct snd_sof_dsp_ops {
int (*runtime_suspend)(struct snd_sof_dev *sof_dev, int (*runtime_suspend)(struct snd_sof_dev *sof_dev,
int state); /* optional */ int state); /* optional */
int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */ int (*runtime_resume)(struct snd_sof_dev *sof_dev); /* optional */
int (*runtime_idle)(struct snd_sof_dev *sof_dev); /* optional */
int (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */ int (*set_hw_params_upon_resume)(struct snd_sof_dev *sdev); /* optional */
/* DSP clocking */ /* DSP clocking */
...@@ -446,6 +447,7 @@ int snd_sof_device_remove(struct device *dev); ...@@ -446,6 +447,7 @@ int snd_sof_device_remove(struct device *dev);
int snd_sof_runtime_suspend(struct device *dev); int snd_sof_runtime_suspend(struct device *dev);
int snd_sof_runtime_resume(struct device *dev); int snd_sof_runtime_resume(struct device *dev);
int snd_sof_runtime_idle(struct device *dev);
int snd_sof_resume(struct device *dev); int snd_sof_resume(struct device *dev);
int snd_sof_suspend(struct device *dev); int snd_sof_suspend(struct device *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment