diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-21 08:28:47 -0500 |
---|---|---|
committer | Wolfram Sang <w.sang@pengutronix.de> | 2012-03-07 13:06:59 -0500 |
commit | c62c3ca55e0db52b311b1258ed08bc6c7525195e (patch) | |
tree | 7248f0df1fc8c47c6115b19cf2251f0e97feccf2 /drivers/i2c | |
parent | 4ea1557ff7862f63511420395d16647b74ba6f5c (diff) |
i2c-s3c2410: Add stub runtime power management
Add stub runtime_pm calls which go through the flow of enabling and
disabling but don't actually do anything with the device itself as
there's nothing useful we can do. This provides the core PM framework
with information about when the device is idle, enabling chip wide
power savings.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index e6f982be89a8..737f7218a32c 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
32 | #include <linux/err.h> | 32 | #include <linux/err.h> |
33 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
34 | #include <linux/pm_runtime.h> | ||
34 | #include <linux/clk.h> | 35 | #include <linux/clk.h> |
35 | #include <linux/cpufreq.h> | 36 | #include <linux/cpufreq.h> |
36 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
@@ -564,6 +565,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, | |||
564 | int retry; | 565 | int retry; |
565 | int ret; | 566 | int ret; |
566 | 567 | ||
568 | pm_runtime_get_sync(&adap->dev); | ||
567 | clk_enable(i2c->clk); | 569 | clk_enable(i2c->clk); |
568 | 570 | ||
569 | for (retry = 0; retry < adap->retries; retry++) { | 571 | for (retry = 0; retry < adap->retries; retry++) { |
@@ -572,6 +574,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, | |||
572 | 574 | ||
573 | if (ret != -EAGAIN) { | 575 | if (ret != -EAGAIN) { |
574 | clk_disable(i2c->clk); | 576 | clk_disable(i2c->clk); |
577 | pm_runtime_put_sync(&adap->dev); | ||
575 | return ret; | 578 | return ret; |
576 | } | 579 | } |
577 | 580 | ||
@@ -581,6 +584,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, | |||
581 | } | 584 | } |
582 | 585 | ||
583 | clk_disable(i2c->clk); | 586 | clk_disable(i2c->clk); |
587 | pm_runtime_put_sync(&adap->dev); | ||
584 | return -EREMOTEIO; | 588 | return -EREMOTEIO; |
585 | } | 589 | } |
586 | 590 | ||
@@ -1013,6 +1017,9 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1013 | of_i2c_register_devices(&i2c->adap); | 1017 | of_i2c_register_devices(&i2c->adap); |
1014 | platform_set_drvdata(pdev, i2c); | 1018 | platform_set_drvdata(pdev, i2c); |
1015 | 1019 | ||
1020 | pm_runtime_enable(&pdev->dev); | ||
1021 | pm_runtime_enable(&i2c->adap.dev); | ||
1022 | |||
1016 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); | 1023 | dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); |
1017 | clk_disable(i2c->clk); | 1024 | clk_disable(i2c->clk); |
1018 | return 0; | 1025 | return 0; |
@@ -1047,6 +1054,9 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) | |||
1047 | { | 1054 | { |
1048 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); | 1055 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); |
1049 | 1056 | ||
1057 | pm_runtime_disable(&i2c->adap.dev); | ||
1058 | pm_runtime_disable(&pdev->dev); | ||
1059 | |||
1050 | s3c24xx_i2c_deregister_cpufreq(i2c); | 1060 | s3c24xx_i2c_deregister_cpufreq(i2c); |
1051 | 1061 | ||
1052 | i2c_del_adapter(&i2c->adap); | 1062 | i2c_del_adapter(&i2c->adap); |