aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2014-02-17 10:20:53 -0500
committerWolfram Sang <wsa@the-dreams.de>2014-03-05 11:11:00 -0500
commitbce9f8d620e5aed7c677dabe5fda09a3af3d5216 (patch)
treea8ca2fd04b8ab87b7d47e0426f5ebb99bdc2cb62
parente46d397550835fc41eeaee08afb37ddeb6a01e72 (diff)
i2c: nomadik: Convert to late and early system PM callbacks
At system suspend_late, runtime PM has been disabled by the PM core which means we can safely operate on these resources. Consequentially we no longer have to wait until the noirq phase of the system suspend. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-nomadik.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 6319f449804e..89f40ea2299d 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -882,9 +882,8 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
882 return IRQ_HANDLED; 882 return IRQ_HANDLED;
883} 883}
884 884
885 885#ifdef CONFIG_PM_SLEEP
886#ifdef CONFIG_PM 886static int nmk_i2c_suspend_late(struct device *dev)
887static int nmk_i2c_suspend(struct device *dev)
888{ 887{
889 struct amba_device *adev = to_amba_device(dev); 888 struct amba_device *adev = to_amba_device(dev);
890 struct nmk_i2c_dev *nmk_i2c = amba_get_drvdata(adev); 889 struct nmk_i2c_dev *nmk_i2c = amba_get_drvdata(adev);
@@ -897,7 +896,7 @@ static int nmk_i2c_suspend(struct device *dev)
897 return 0; 896 return 0;
898} 897}
899 898
900static int nmk_i2c_resume(struct device *dev) 899static int nmk_i2c_resume_early(struct device *dev)
901{ 900{
902 /* First go to the default state */ 901 /* First go to the default state */
903 pinctrl_pm_select_default_state(dev); 902 pinctrl_pm_select_default_state(dev);
@@ -906,9 +905,6 @@ static int nmk_i2c_resume(struct device *dev)
906 905
907 return 0; 906 return 0;
908} 907}
909#else
910#define nmk_i2c_suspend NULL
911#define nmk_i2c_resume NULL
912#endif 908#endif
913 909
914#ifdef CONFIG_PM 910#ifdef CONFIG_PM
@@ -946,14 +942,8 @@ static int nmk_i2c_runtime_resume(struct device *dev)
946} 942}
947#endif 943#endif
948 944
949/*
950 * We use noirq so that we suspend late and resume before the wakeup interrupt
951 * to ensure that we do the !pm_runtime_suspended() check in resume before
952 * there has been a regular pm runtime resume (via pm_runtime_get_sync()).
953 */
954static const struct dev_pm_ops nmk_i2c_pm = { 945static const struct dev_pm_ops nmk_i2c_pm = {
955 .suspend_noirq = nmk_i2c_suspend, 946 SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
956 .resume_noirq = nmk_i2c_resume,
957 SET_PM_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend, 947 SET_PM_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
958 nmk_i2c_runtime_resume, 948 nmk_i2c_runtime_resume,
959 NULL) 949 NULL)