aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/olpc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/olpc')
-rw-r--r--drivers/platform/olpc/olpc-ec.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-ec.c
index 44e6a4fae79b..d00523c65191 100644
--- a/drivers/platform/olpc/olpc-ec.c
+++ b/drivers/platform/olpc/olpc-ec.c
@@ -8,6 +8,7 @@
8#include <linux/completion.h> 8#include <linux/completion.h>
9#include <linux/spinlock.h> 9#include <linux/spinlock.h>
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/platform_device.h>
11#include <linux/workqueue.h> 12#include <linux/workqueue.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/list.h> 14#include <linux/list.h>
@@ -122,3 +123,50 @@ int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen)
122 return desc.err; 123 return desc.err;
123} 124}
124EXPORT_SYMBOL_GPL(olpc_ec_cmd); 125EXPORT_SYMBOL_GPL(olpc_ec_cmd);
126
127static int olpc_ec_probe(struct platform_device *pdev)
128{
129 int err;
130
131 if (!ec_driver)
132 return -ENODEV;
133
134 err = ec_driver->probe ? ec_driver->probe(pdev) : 0;
135
136 return err;
137}
138
139static int olpc_ec_suspend(struct device *dev)
140{
141 struct platform_device *pdev = to_platform_device(dev);
142 return ec_driver->suspend ? ec_driver->suspend(pdev) : 0;
143}
144
145static int olpc_ec_resume(struct device *dev)
146{
147 struct platform_device *pdev = to_platform_device(dev);
148 return ec_driver->resume ? ec_driver->resume(pdev) : 0;
149}
150
151static const struct dev_pm_ops olpc_ec_pm_ops = {
152 .suspend_late = olpc_ec_suspend,
153 .resume_early = olpc_ec_resume,
154};
155
156static struct platform_driver olpc_ec_plat_driver = {
157 .probe = olpc_ec_probe,
158 .driver = {
159 .name = "olpc-ec",
160 .pm = &olpc_ec_pm_ops,
161 },
162};
163
164static int __init olpc_ec_init_module(void)
165{
166 return platform_driver_register(&olpc_ec_plat_driver);
167}
168
169module_init(olpc_ec_init_module);
170
171MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
172MODULE_LICENSE("GPL");