ASoC: SOF: add runtime idle callback
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Tue, 2 Jul 2019 13:24:27 +0000 (16:24 +0300)
committerMark Brown <broonie@kernel.org>
Sat, 6 Jul 2019 11:23:24 +0000 (12:23 +0100)
Add ability to implement a SOF device level runtime idle callback.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20190702132428.13129-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda.h
sound/soc/sof/ops.h
sound/soc/sof/pm.c
sound/soc/sof/sof-acpi-dev.c
sound/soc/sof/sof-pci-dev.c
sound/soc/sof/sof-priv.h

index 73d7cc08afc2253037cedc6f80da433f7d7687f8..d9c17146200b36e094900ae0d538e668ad9ed622 100644 (file)
@@ -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_runtime_suspend(struct snd_sof_dev *sdev, int state);
 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);
 void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags);
 void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
index 45a3d10911634af648e544cddd307423a0e8baf2..b9bdf45889da1cbfac81b0dcb3b6f406a0087e92 100644 (file)
@@ -134,6 +134,14 @@ static inline int snd_sof_dsp_runtime_suspend(struct snd_sof_dev *sdev,
        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)
 {
        if (sof_ops(sdev)->set_hw_params_upon_resume)
index 8eeb3a1029f24d168b779badb35aecac1a45cd5a..278abfd10490d1f616dedc6b567449ced7ccaacc 100644 (file)
@@ -394,6 +394,14 @@ int snd_sof_runtime_suspend(struct device *dev)
 }
 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)
 {
        return sof_resume(dev, true);
index c8dafb1ac54e2022ab2fedd108de85060fb99061..ea7b8b8954128772331c998d252889a2e96fb3ad 100644 (file)
@@ -116,7 +116,7 @@ static const struct sof_dev_desc sof_acpi_cherrytrail_desc = {
 static const struct dev_pm_ops sof_acpi_pm = {
        SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_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)
index e2b19782f01ac474ca2e746085b112b897e4755e..65d1bac4c6b8b67ad22b72674959ca6217eedd59 100644 (file)
@@ -206,7 +206,7 @@ static const struct sof_dev_desc kbl_desc = {
 static const struct dev_pm_ops sof_pci_pm = {
        SET_SYSTEM_SLEEP_PM_OPS(snd_sof_suspend, snd_sof_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)
index 58621db4fd31a9799e621b554a3cbbeaba87d511..b8c0b2a226845e05e15f51963c920b3636508c37 100644 (file)
@@ -176,6 +176,7 @@ struct snd_sof_dsp_ops {
        int (*runtime_suspend)(struct snd_sof_dev *sof_dev,
                               int state); /* 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 */
 
        /* DSP clocking */
@@ -446,6 +447,7 @@ int snd_sof_device_remove(struct device *dev);
 
 int snd_sof_runtime_suspend(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_suspend(struct device *dev);