Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4f64ae2 authored by Grzegorz Jaszczyk's avatar Grzegorz Jaszczyk Committed by Wolfram Sang
Browse files

i2c: mv64xxx: add suspend/resume support



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: default avatarGrzegorz Jaszczyk <jaz@semihalf.com>
Reviewed-by: default avatarNadav Haklai <nadavh@marvell.com>
Reviewed-by: default avatarLior Amsalem <alior@marvell.com>
Tested-by: default avatarLior Amsalem <alior@marvell.com>
[Thomas: switch to dev_pm_ops, fix build warning when !PM.]
Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 62817fc8
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -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,
	},
};