Skip to content

Commit 72e4316

Browse files
charleskeepaxLee Jones
authored andcommitted
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: [email protected] # v3.5+ Signed-off-by: Charles Keepax <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 1115092 commit 72e4316

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/mfd/arizona-core.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,10 +1141,6 @@ int arizona_dev_init(struct arizona *arizona)
11411141
arizona->pdata.gpio_defaults[i]);
11421142
}
11431143

1144-
pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1145-
pm_runtime_use_autosuspend(arizona->dev);
1146-
pm_runtime_enable(arizona->dev);
1147-
11481144
/* Chip default */
11491145
if (!arizona->pdata.clk32k_src)
11501146
arizona->pdata.clk32k_src = ARIZONA_32KZ_MCLK2;
@@ -1245,11 +1241,17 @@ int arizona_dev_init(struct arizona *arizona)
12451241
arizona->pdata.spk_fmt[i]);
12461242
}
12471243

1244+
pm_runtime_set_active(arizona->dev);
1245+
pm_runtime_enable(arizona->dev);
1246+
12481247
/* Set up for interrupts */
12491248
ret = arizona_irq_init(arizona);
12501249
if (ret != 0)
12511250
goto err_reset;
12521251

1252+
pm_runtime_set_autosuspend_delay(arizona->dev, 100);
1253+
pm_runtime_use_autosuspend(arizona->dev);
1254+
12531255
arizona_request_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, "CLKGEN error",
12541256
arizona_clkgen_err, arizona);
12551257
arizona_request_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, "Overclocked",
@@ -1278,10 +1280,6 @@ int arizona_dev_init(struct arizona *arizona)
12781280
goto err_irq;
12791281
}
12801282

1281-
#ifdef CONFIG_PM
1282-
regulator_disable(arizona->dcvdd);
1283-
#endif
1284-
12851283
return 0;
12861284

12871285
err_irq:

0 commit comments

Comments
 (0)