diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-08-26 10:40:50 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-09 16:32:52 +0100 |
commit | e7d48fa2b5fbc7f74bb7ef4a8d7e080b0e831ef0 (patch) | |
tree | c90aeb47ebd226beb030cb655a55cf429039063d /drivers/i2c | |
parent | 387fa6a5eca021ed5bef5454413b7cdfda74ba41 (diff) | |
download | linux-e7d48fa2b5fbc7f74bb7ef4a8d7e080b0e831ef0.tar.gz linux-e7d48fa2b5fbc7f74bb7ef4a8d7e080b0e831ef0.tar.bz2 linux-e7d48fa2b5fbc7f74bb7ef4a8d7e080b0e831ef0.zip |
[I2C] pxa: provide late suspend and early resume hooks
Properly hook the I2C driver into the PM code; the previous fix for
this (ece5f7b3c4fde70a1ae4add7372ebca5c90bc34d) worked around the
platform where I2C is required to be available early during resume.
It has been found to be sufficient to use the early resume hook for
this function, so the original hack can die. Leave the hack in
place for the PIO transfer handler though.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 57fbffd1ccc0..518b57c795c8 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -909,12 +909,6 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num struct pxa_i2c *i2c = adap->algo_data; int ret, i; - /* If the I2C controller is disabled we need to reset it (probably due - to a suspend/resume destroying state). We do this here as we can then - avoid worrying about resuming the controller before its users. */ - if (!(readl(_ICR(i2c)) & ICR_IUE)) - i2c_pxa_reset(i2c); - for (i = adap->retries; i >= 0; i--) { ret = i2c_pxa_do_xfer(i2c, msgs, num); if (ret != I2C_RETRY) @@ -1085,9 +1079,33 @@ static int __exit i2c_pxa_remove(struct platform_device *dev) return 0; } +#ifdef CONFIG_PM +static int i2c_pxa_suspend_late(struct platform_device *dev, pm_message_t state) +{ + struct pxa_i2c *i2c = platform_get_drvdata(dev); + clk_disable(i2c->clk); + return 0; +} + +static int i2c_pxa_resume_early(struct platform_device *dev) +{ + struct pxa_i2c *i2c = platform_get_drvdata(dev); + + clk_enable(i2c->clk); + i2c_pxa_reset(i2c); + + return 0; +} +#else +#define i2c_pxa_suspend_late NULL +#define i2c_pxa_resume_early NULL +#endif + static struct platform_driver i2c_pxa_driver = { .probe = i2c_pxa_probe, .remove = __exit_p(i2c_pxa_remove), + .suspend_late = i2c_pxa_suspend_late, + .resume_early = i2c_pxa_resume_early, .driver = { .name = "pxa2xx-i2c", .owner = THIS_MODULE, |