On Tue, Mar 24, 2015 at 04:59:55PM +0000, Charles Keepax wrote:
> Allow the chip to completely power off if we enter runtime suspend and
> there is no jack detection active. This is helpful for systems where
> system suspend might remove the supplies to the CODEC, without informing
> us. Note the powering off is done in runtime suspend rather than system
> suspend, because we need to hold reset until the first time DCVDD is
> powered anyway (which would be in runtime resume), and we might as well
> save the extra power.
>
> Signed-off-by: Charles Keepax <[email protected]>
> ---
> @@ -581,6 +616,18 @@ static int arizona_runtime_suspend(struct device *dev)
> regcache_mark_dirty(arizona->regmap);
> regulator_disable(arizona->dcvdd);
>
> + /* Allow us to completely power down if no jack detection */
> + if (!(val & ARIZONA_JD1_ENA)) {
> + dev_dbg(arizona->dev, "Fully powering off\n");
> +
> + arizona->has_fully_powered_off = true;
> +
> + arizona_enable_reset(arizona);
> +
> + regulator_bulk_disable(arizona->num_core_supplies,
> + arizona->core_supplies);
> + }
> +
Turns out we will need to disable the IRQ across this as well, we
lose control of it once we put the chip into reset. So depending
on pulls etc. we might get pulled straight out of suspend again
if we leave the IRQ enabled.
I will send a new series shortly.
Thanks,
Charles