mfd: cros_ec: Send correct suspend/resume event to EC
authorShawn Nematbakhsh <shawnn@chromium.org>
Fri, 13 Jan 2017 15:04:32 +0000 (16:04 +0100)
committerLee Jones <lee.jones@linaro.org>
Mon, 13 Feb 2017 09:29:43 +0000 (09:29 +0000)
pm_suspend_via_firmware() will return false for platforms with ACPI
disabled and ACPI is a prerequisite for S0ix support.

With this patch, sleep state event sent to EC is forced to S3 if ACPI is
disabled.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Thierry Escande <thierry.escande@collabora.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/cros_ec.c

index b8a50808bedbbbf30f530321ce44c5cf0285b623..9b66a98ba4bfbbaf52be52a8778d1bc62b9f3b2a 100644 (file)
@@ -190,8 +190,9 @@ int cros_ec_suspend(struct cros_ec_device *ec_dev)
        int ret;
        u8 sleep_event;
 
-       sleep_event = pm_suspend_via_firmware() ? HOST_SLEEP_EVENT_S3_RESUME :
-                                                 HOST_SLEEP_EVENT_S0IX_RESUME;
+       sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
+                     HOST_SLEEP_EVENT_S3_RESUME :
+                     HOST_SLEEP_EVENT_S0IX_RESUME;
 
        ret = cros_ec_sleep_event(ec_dev, sleep_event);
        if (ret < 0)
@@ -224,8 +225,9 @@ int cros_ec_resume(struct cros_ec_device *ec_dev)
        ec_dev->suspended = false;
        enable_irq(ec_dev->irq);
 
-       sleep_event = pm_suspend_via_firmware() ? HOST_SLEEP_EVENT_S3_RESUME :
-                                                 HOST_SLEEP_EVENT_S0IX_RESUME;
+       sleep_event = (!IS_ENABLED(CONFIG_ACPI) || pm_suspend_via_firmware()) ?
+                     HOST_SLEEP_EVENT_S3_RESUME :
+                     HOST_SLEEP_EVENT_S0IX_RESUME;
 
        ret = cros_ec_sleep_event(ec_dev, sleep_event);
        if (ret < 0)