aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2015-06-14 10:41:50 -0400
committerLee Jones <lee.jones@linaro.org>2015-07-24 04:05:28 -0400
commit72e43164fd472f6c2659c8313b87da962322dbcf (patch)
tree937c549e7a48232b42104942f4142de9b1c9b0d4
parent111509294b9efafe0353423c8180e03db810bdb5 (diff)
mfd: arizona: Fix initialisation of the PM runtime
The PM runtime core by default assumes a chip is suspended when runtime PM is enabled. Currently the arizona driver enables runtime PM when the chip is fully active and then disables the DCVDD regulator at the end of arizona_dev_init. This however has several problems, firstly the if we reach the end of arizona_dev_init, we did not properly follow all the proceedures for shutting down the chip, and most notably we never marked the chip as cache only so any writes occurring between then and the next PM runtime resume will be lost. Secondly, if we are already resumed when we reach the end of dev_init, then at best we get unbalanced regulator enable/disables at work we lose DCVDD whilst we need it. Additionally, since the commit 4f0216409f7c ("mfd: arizona: Add better support for system suspend"), the PM runtime operations may disable/enable the IRQ, so the IRQs must now be enabled before we call any PM operations. This patch adds a call to pm_runtime_set_active to inform the PM core that the device is starting up active and moves the PM enabling to around the IRQ initialisation to avoid any PM callbacks happening until the IRQs are initialised. Cc: stable@vger.kernel.org # v3.5+ Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/arizona-core.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index e60bcd901d02..a72ddb295078 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -1141,10 +1141,6 @@ int arizona_dev_init(struct arizona *arizona)
1141 arizona->pdata.gpio_defaults[i]); 1141 arizona->pdata.gpio_defaults[i]);
1142 } 1142 }
1143 1143
1144 pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1145 pm_runtime_use_autosuspend(arizona->dev);
1146 pm_runtime_enable(arizona->dev);
1147
1148 /* Chip default */ 1144 /* Chip default */
1149 if (!arizona->pdata.clk32k_src) 1145 if (!arizona->pdata.clk32k_src)
1150 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2; 1146 arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
@@ -1245,11 +1241,17 @@ int arizona_dev_init(struct arizona *arizona)
1245 arizona->pdata.spk_fmt[i]); 1241 arizona->pdata.spk_fmt[i]);
1246 } 1242 }
1247 1243
1244 pm_runtime_set_active(arizona->dev);
1245 pm_runtime_enable(arizona->dev);
1246
1248 /* Set up for interrupts */ 1247 /* Set up for interrupts */
1249 ret = arizona_irq_init(arizona); 1248 ret = arizona_irq_init(arizona);
1250 if (ret != 0) 1249 if (ret != 0)
1251 goto err_reset; 1250 goto err_reset;
1252 1251
1252 pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1253 pm_runtime_use_autosuspend(arizona->dev);
1254
1253 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error", 1255 arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",
1254 arizona_clkgen_err, arizona); 1256 arizona_clkgen_err, arizona);
1255 arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked", 1257 arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",
@@ -1278,10 +1280,6 @@ int arizona_dev_init(struct arizona *arizona)
1278 goto err_irq; 1280 goto err_irq;
1279 } 1281 }
1280 1282
1281#ifdef CONFIG_PM
1282 regulator_disable(arizona->dcvdd);
1283#endif
1284
1285 return 0; 1283 return 0;
1286 1284
1287err_irq: 1285err_irq: