summaryrefslogtreecommitdiff
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorYilun Lin <yllin@chromium.org>2019-08-14 11:17:57 +0300
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-08-27 10:38:31 +0300
commit058bf149b92a735b2b17a3797938fa455f9ed189 (patch)
treee9c902458645eae748b0287a2aa986d61029a68c /drivers/platform/chrome
parent38d3cfbc95624fa2e8e84cd36c10bfef31d90f0c (diff)
downloadlinux-058bf149b92a735b2b17a3797938fa455f9ed189.tar.xz
platform/chrome: cros_ec_rpmsg: Add host command AP sleep state support
Add EC host command to inform EC of AP suspend/resume status. Signed-off-by: Yilun Lin <yllin@chromium.org> Tested-by: Pi-Hsun Shih <pihsun@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/cros_ec_rpmsg.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/platform/chrome/cros_ec_rpmsg.c b/drivers/platform/chrome/cros_ec_rpmsg.c
index 5d3fb2abad1d..6f34fe629e2c 100644
--- a/drivers/platform/chrome/cros_ec_rpmsg.c
+++ b/drivers/platform/chrome/cros_ec_rpmsg.c
@@ -236,6 +236,25 @@ static void cros_ec_rpmsg_remove(struct rpmsg_device *rpdev)
cancel_work_sync(&ec_rpmsg->host_event_work);
}
+#ifdef CONFIG_PM_SLEEP
+static int cros_ec_rpmsg_suspend(struct device *dev)
+{
+ struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
+
+ return cros_ec_suspend(ec_dev);
+}
+
+static int cros_ec_rpmsg_resume(struct device *dev)
+{
+ struct cros_ec_device *ec_dev = dev_get_drvdata(dev);
+
+ return cros_ec_resume(ec_dev);
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(cros_ec_rpmsg_pm_ops, cros_ec_rpmsg_suspend,
+ cros_ec_rpmsg_resume);
+
static const struct of_device_id cros_ec_rpmsg_of_match[] = {
{ .compatible = "google,cros-ec-rpmsg", },
{ }
@@ -246,6 +265,7 @@ static struct rpmsg_driver cros_ec_driver_rpmsg = {
.drv = {
.name = "cros-ec-rpmsg",
.of_match_table = cros_ec_rpmsg_of_match,
+ .pm = &cros_ec_rpmsg_pm_ops,
},
.probe = cros_ec_rpmsg_probe,
.remove = cros_ec_rpmsg_remove,