Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321285
b: refs/heads/master
c: ac25041
h: refs/heads/master
i:
  321283: aa5cd44
v: v3
  • Loading branch information
Andres Salomon committed Aug 1, 2012
1 parent 7911aee commit f02c16f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3d26c20bae9e97c98f7240184427d3a38515d406
refs/heads/master: ac2504151f5af27bbf0c0362b7da5951e05dfc43
48 changes: 48 additions & 0 deletions trunk/drivers/platform/olpc/olpc-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/completion.h>
#include <linux/spinlock.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/workqueue.h>
#include <linux/module.h>
#include <linux/list.h>
Expand Down Expand Up @@ -122,3 +123,50 @@ int olpc_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, size_t outlen)
return desc.err;
}
EXPORT_SYMBOL_GPL(olpc_ec_cmd);

static int olpc_ec_probe(struct platform_device *pdev)
{
int err;

if (!ec_driver)
return -ENODEV;

err = ec_driver->probe ? ec_driver->probe(pdev) : 0;

return err;
}

static int olpc_ec_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
return ec_driver->suspend ? ec_driver->suspend(pdev) : 0;
}

static int olpc_ec_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
return ec_driver->resume ? ec_driver->resume(pdev) : 0;
}

static const struct dev_pm_ops olpc_ec_pm_ops = {
.suspend_late = olpc_ec_suspend,
.resume_early = olpc_ec_resume,
};

static struct platform_driver olpc_ec_plat_driver = {
.probe = olpc_ec_probe,
.driver = {
.name = "olpc-ec",
.pm = &olpc_ec_pm_ops,
},
};

static int __init olpc_ec_init_module(void)
{
return platform_driver_register(&olpc_ec_plat_driver);
}

module_init(olpc_ec_init_module);

MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
MODULE_LICENSE("GPL");
6 changes: 6 additions & 0 deletions trunk/include/linux/olpc-ec.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
#define EC_SCI_QUERY 0x84
#define EC_EXT_SCI_QUERY 0x85

struct platform_device;

struct olpc_ec_driver {
int (*probe)(struct platform_device *);
int (*suspend)(struct platform_device *);
int (*resume)(struct platform_device *);

int (*ec_cmd)(u8, u8 *, size_t, u8 *, size_t, void *);
};

Expand Down

0 comments on commit f02c16f

Please sign in to comment.