Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308462
b: refs/heads/master
c: 3bf3b28
h: refs/heads/master
v: v3
  • Loading branch information
Deepak Sikri authored and Wolfram Sang committed May 12, 2012
1 parent 85ad346 commit e9b1a42
Show file tree
Hide file tree
Showing 2 changed files with 28 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: 6923229380bc8ac112f4e6e76d05542c006feaad
refs/heads/master: 3bf3b289c233c28aaef16546168a994070aa24a0
27 changes: 27 additions & 0 deletions trunk/drivers/i2c/busses/i2c-designware-platdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/interrupt.h>
#include <linux/of_i2c.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/io.h>
#include <linux/slab.h>
#include "i2c-designware-core.h"
Expand Down Expand Up @@ -198,6 +199,31 @@ static const struct of_device_id dw_i2c_of_match[] = {
MODULE_DEVICE_TABLE(of, dw_i2c_of_match);
#endif

#ifdef CONFIG_PM
static int dw_i2c_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);

clk_disable(i_dev->clk);

return 0;
}

static int dw_i2c_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct dw_i2c_dev *i_dev = platform_get_drvdata(pdev);

clk_enable(i_dev->clk);
i2c_dw_init(i_dev);

return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(dw_i2c_dev_pm_ops, dw_i2c_suspend, dw_i2c_resume);

/* work with hotplug and coldplug */
MODULE_ALIAS("platform:i2c_designware");

Expand All @@ -207,6 +233,7 @@ static struct platform_driver dw_i2c_driver = {
.name = "i2c_designware",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(dw_i2c_of_match),
.pm = &dw_i2c_dev_pm_ops,
},
};

Expand Down

0 comments on commit e9b1a42

Please sign in to comment.