@@ -740,6 +740,46 @@ static int platform_legacy_resume(struct device *dev)
#ifdef CONFIG_SUSPEND
+int platform_pm_suspend_mem(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->suspend_mem)
+ ret = drv->pm->suspend_mem(dev);
+ else if (drv->pm->suspend)
+ ret = drv->pm->suspend(dev);
+ } else {
+ ret = platform_legacy_suspend(dev, PMSG_SUSPEND);
+ }
+
+ return ret;
+}
+
+int platform_pm_suspend_standby(struct device *dev)
+{
+ struct device_driver *drv = dev->driver;
+ int ret = 0;
+
+ if (!drv)
+ return 0;
+
+ if (drv->pm) {
+ if (drv->pm->suspend_standby)
+ ret = drv->pm->suspend_standby(dev);
+ else if (drv->pm->suspend)
+ ret = drv->pm->suspend(dev);
+ } else {
+ ret = platform_legacy_suspend(dev, PMSG_SUSPEND);
+ }
+
+ return ret;
+}
+
int platform_pm_suspend(struct device *dev)
{
struct device_driver *drv = dev->driver;
@@ -262,9 +262,13 @@ static inline char *early_platform_driver_setup_func(void) \
#ifdef CONFIG_SUSPEND
extern int platform_pm_suspend(struct device *dev);
+extern int platform_pm_suspend_mem(struct device *dev);
+extern int platform_pm_suspend_standby(struct device *dev);
extern int platform_pm_resume(struct device *dev);
#else
#define platform_pm_suspend NULL
+#define platform_pm_suspend_mem NULL
+#define platform_pm_suspend_standby NULL
#define platform_pm_resume NULL
#endif
@@ -283,6 +287,8 @@ extern int platform_pm_restore(struct device *dev);
#ifdef CONFIG_PM_SLEEP
#define USE_PLATFORM_PM_SLEEP_OPS \
.suspend = platform_pm_suspend, \
+ .suspend_standby = platform_pm_suspend_standby, \
+ .suspend_mem = platform_pm_suspend_mem, \
.resume = platform_pm_resume, \
.freeze = platform_pm_freeze, \
.thaw = platform_pm_thaw, \
If a drivers does not need to care about this distinction we fallback to suspend. This will allow to do not update the current drivers. Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: linux-pm@vger.kernel.org --- drivers/base/platform.c | 40 +++++++++++++++++++++++++++++++++++++++ include/linux/platform_device.h | 6 ++++++ 2 files changed, 46 insertions(+)