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

Commit 7e82d6ff authored by Rabin Vincent's avatar Rabin Vincent Committed by Samuel Ortiz
Browse files

mfd: Handle the ab8500 irq for suspend/resume



Ensure that the AB interrupt is only handled at a time when
all core drivers are resumed. Ensure that the AB interrupt
is marked as a wakeup interrupt.

Signed-off-by: default avatarRabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: default avatarJonas Aberg <jonas.aberg@stericsson.com>
Reviewed-by: default avatarMattias Wallin <mattias.wallin@stericsson.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 44f72e53
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -101,10 +101,42 @@ static const struct platform_device_id ab8500_id[] = {
	{ }
};

#ifdef CONFIG_PM
static int ab8500_i2c_suspend(struct device *dev)
{
	struct ab8500 *ab = dev_get_drvdata(dev);

	disable_irq(ab->irq);
	enable_irq_wake(ab->irq);

	return 0;
}

static int ab8500_i2c_resume(struct device *dev)
{
	struct ab8500 *ab = dev_get_drvdata(dev);

	disable_irq_wake(ab->irq);
	enable_irq(ab->irq);

	return 0;
}

static const struct dev_pm_ops ab8500_i2c_pm_ops = {
	.suspend	= ab8500_i2c_suspend,
	.resume		= ab8500_i2c_resume,
};

#define AB8500_I2C_PM_OPS	(&ab8500_i2c_pm_ops)
#else
#define AB8500_I2C_PM_OPS	NULL
#endif

static struct platform_driver ab8500_i2c_driver = {
	.driver = {
		.name = "ab8500-i2c",
		.owner = THIS_MODULE,
		.pm	= AB8500_I2C_PM_OPS,
	},
	.probe	= ab8500_i2c_probe,
	.remove	= __devexit_p(ab8500_i2c_remove),