* [PATCH] i2c: mv64xxx: add suspend/resume support
@ 2016-12-22 15:54 Thomas Petazzoni
2017-01-25 20:50 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Petazzoni @ 2016-12-22 15:54 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c
Cc: Jason Cooper, Andrew Lunn, Sebastian Hesselbarth, Gregory Clement,
linux-arm-kernel, Grzegorz Jaszczyk, Thomas Petazzoni
From: Grzegorz Jaszczyk <jaz@semihalf.com>
This commit implements suspend/resume support in the mv64xxx I2C
controller driver. There is no need to implement a ->suspend() hook, as
calling mv64xxx_i2c_hw_init() at ->resume() time is enough.
Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
Reviewed-by: Nadav Haklai <nadavh@marvell.com>
Reviewed-by: Lior Amsalem <alior@marvell.com>
Tested-by: Lior Amsalem <alior@marvell.com>
[Thomas: switch to dev_pm_ops, fix build warning when !PM.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
drivers/i2c/busses/i2c-mv64xxx.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index b4dec08..a50bd68 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -977,11 +977,32 @@ mv64xxx_i2c_remove(struct platform_device *dev)
return 0;
}
+#ifdef CONFIG_PM
+static int mv64xxx_i2c_resume(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct mv64xxx_i2c_data *drv_data = platform_get_drvdata(pdev);
+
+ mv64xxx_i2c_hw_init(drv_data);
+
+ return 0;
+}
+
+static const struct dev_pm_ops mv64xxx_i2c_pm = {
+ .resume = mv64xxx_i2c_resume,
+};
+
+#define mv64xxx_i2c_pm_ops (&mv64xxx_i2c_pm)
+#else
+#define mv64xxx_i2c_pm_ops NULL
+#endif
+
static struct platform_driver mv64xxx_i2c_driver = {
.probe = mv64xxx_i2c_probe,
.remove = mv64xxx_i2c_remove,
.driver = {
.name = MV64XXX_I2C_CTLR_NAME,
+ .pm = mv64xxx_i2c_pm_ops,
.of_match_table = mv64xxx_i2c_of_match_table,
},
};
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: mv64xxx: add suspend/resume support
2016-12-22 15:54 [PATCH] i2c: mv64xxx: add suspend/resume support Thomas Petazzoni
@ 2017-01-25 20:50 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2017-01-25 20:50 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: linux-i2c, Jason Cooper, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, linux-arm-kernel, Grzegorz Jaszczyk
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On Thu, Dec 22, 2016 at 04:54:02PM +0100, Thomas Petazzoni wrote:
> From: Grzegorz Jaszczyk <jaz@semihalf.com>
>
> This commit implements suspend/resume support in the mv64xxx I2C
> controller driver. There is no need to implement a ->suspend() hook, as
> calling mv64xxx_i2c_hw_init() at ->resume() time is enough.
>
> Signed-off-by: Grzegorz Jaszczyk <jaz@semihalf.com>
> Reviewed-by: Nadav Haklai <nadavh@marvell.com>
> Reviewed-by: Lior Amsalem <alior@marvell.com>
> Tested-by: Lior Amsalem <alior@marvell.com>
> [Thomas: switch to dev_pm_ops, fix build warning when !PM.]
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-25 20:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-22 15:54 [PATCH] i2c: mv64xxx: add suspend/resume support Thomas Petazzoni
2017-01-25 20:50 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox