leds: handle suspend/resume in heartbeat trigger
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 8 Jun 2016 08:29:48 +0000 (10:29 +0200)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Wed, 8 Jun 2016 09:47:06 +0000 (11:47 +0200)
commit5ab92a7cb82c66bf30685583a38a18538e3807db
treee4e31ecd7cce17d9716202acdb1da4b3c12b907e
parent7cfe749fad5158247282f2fee30773fd454029ab
leds: handle suspend/resume in heartbeat trigger

The following phenomena was observed: when suspending the
system, sometimes the heartbeat LED was left on, glowing and
wasting power while the rest of the system is asleep, also
disturbing power dissapation measures on the odd suspend
cycle when it's left on.

Clearly this is not how we want the heartbeat trigger to
work: it should turn off and leave the LED off during
system suspend.

This removes the heartbeat trigger when preparing suspend and
restores it during resume. The trigger code will make sure all
LEDs are left in OFF state after removing the trigger, and
will re-enable the trigger on all LEDs after resuming.

Cc: linux-pm@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/trigger/ledtrig-heartbeat.c