aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-08-20 13:15:55 +0200
committerTakashi Iwai <tiwai@suse.de>2021-08-20 13:15:55 +0200
commit473b6d86baaebfae7e92ddac236011c1dc21f696 (patch)
treefa7ab99e322d8f49d7b2394ea5d39cff140f3b9a
parentf2db3c875c0d7330d3d9987781c7a3e5ee7e4175 (diff)
downloadhda-emu-473b6d86baaebfae7e92ddac236011c1dc21f696.tar.gz
Add pm_runtime_suspend() and pm_runtime_resume() wrappers
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/linux/pm_runtime.h2
-rw-r--r--snd-wrapper.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index a575b55..a7e994b 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -22,6 +22,8 @@ static inline int pm_request_resume(struct device *dev) { return 0; } // XXX
int pm_runtime_get_sync(struct device *dev);
int pm_runtime_get_if_in_use(struct device *dev);
int pm_runtime_put_autosuspend(struct device *dev);
+int pm_runtime_suspend(struct device *dev);
+int pm_runtime_resume(struct device *dev);
int pm_runtime_force_suspend(struct device *dev);
int pm_runtime_force_resume(struct device *dev);
void pm_runtime_allow(struct device *dev);
diff --git a/snd-wrapper.c b/snd-wrapper.c
index 9f78af6..2d2c63c 100644
--- a/snd-wrapper.c
+++ b/snd-wrapper.c
@@ -908,6 +908,20 @@ int pm_runtime_force_resume(struct device *dev)
return dev->driver->pm->runtime_resume(dev);
}
+int pm_runtime_suspend(struct device *dev)
+{
+ if (!pm_runtime_suspended(dev))
+ return pm_runtime_force_suspend(dev);
+ return 0;
+}
+
+int pm_runtime_resume(struct device *dev)
+{
+ if (pm_runtime_suspended(dev))
+ return pm_runtime_force_resume(dev);
+ return 0;
+}
+
void pm_runtime_allow(struct device *dev)
{
dev->pmallow = 1;