linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] i2c: at91: ensure state is restored after suspending
@ 2017-02-16 17:27 Alexandre Belloni
  2017-02-17  8:24 ` Ludovic Desroches
  2017-02-20 18:24 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Alexandre Belloni @ 2017-02-16 17:27 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Ludovic Desroches, linux-i2c, linux-arm-kernel, linux-kernel,
	Alexandre Belloni

When going to suspend, the I2C registers may be lost because the power to
VDDcore is cut. Restore them when resuming.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
Changes in v2:
 - don't cache unecessary registers and simply call at91_init_twi_bus()


 drivers/i2c/busses/i2c-at91.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 0b86c6173e07..c925a690cb32 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -1180,6 +1180,7 @@ static int at91_twi_suspend_noirq(struct device *dev)
 
 static int at91_twi_resume_noirq(struct device *dev)
 {
+	struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
 	int ret;
 
 	if (!pm_runtime_status_suspended(dev)) {
@@ -1191,6 +1192,8 @@ static int at91_twi_resume_noirq(struct device *dev)
 	pm_runtime_mark_last_busy(dev);
 	pm_request_autosuspend(dev);
 
+	at91_init_twi_bus(twi_dev);
+
 	return 0;
 }
 
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] i2c: at91: ensure state is restored after suspending
  2017-02-16 17:27 [PATCH v2] i2c: at91: ensure state is restored after suspending Alexandre Belloni
@ 2017-02-17  8:24 ` Ludovic Desroches
  2017-02-20 18:24 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Desroches @ 2017-02-17  8:24 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Wolfram Sang, Ludovic Desroches, linux-i2c, linux-arm-kernel,
	linux-kernel

On Thu, Feb 16, 2017 at 06:27:59PM +0100, Alexandre Belloni wrote:
> When going to suspend, the I2C registers may be lost because the power to
> VDDcore is cut. Restore them when resuming.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>

> ---
> Changes in v2:
>  - don't cache unecessary registers and simply call at91_init_twi_bus()
> 
> 
>  drivers/i2c/busses/i2c-at91.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 0b86c6173e07..c925a690cb32 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -1180,6 +1180,7 @@ static int at91_twi_suspend_noirq(struct device *dev)
>  
>  static int at91_twi_resume_noirq(struct device *dev)
>  {
> +	struct at91_twi_dev *twi_dev = dev_get_drvdata(dev);
>  	int ret;
>  
>  	if (!pm_runtime_status_suspended(dev)) {
> @@ -1191,6 +1192,8 @@ static int at91_twi_resume_noirq(struct device *dev)
>  	pm_runtime_mark_last_busy(dev);
>  	pm_request_autosuspend(dev);
>  
> +	at91_init_twi_bus(twi_dev);
> +
>  	return 0;
>  }
>  
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] i2c: at91: ensure state is restored after suspending
  2017-02-16 17:27 [PATCH v2] i2c: at91: ensure state is restored after suspending Alexandre Belloni
  2017-02-17  8:24 ` Ludovic Desroches
@ 2017-02-20 18:24 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2017-02-20 18:24 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Ludovic Desroches, linux-i2c, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 323 bytes --]

On Thu, Feb 16, 2017 at 06:27:59PM +0100, Alexandre Belloni wrote:
> When going to suspend, the I2C registers may be lost because the power to
> VDDcore is cut. Restore them when resuming.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Applied to for-next, thanks (will be in 4.11)!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-20 18:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-16 17:27 [PATCH v2] i2c: at91: ensure state is restored after suspending Alexandre Belloni
2017-02-17  8:24 ` Ludovic Desroches
2017-02-20 18:24 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).