ALS: wake up ALS task when switched to RW mode

Enabling of ALS is done during resume hook.
During EC sw sync, resume hook is not called
and hence ALS task wont run.
Adding init hook to wake up the ALS task.

BUG=chrome-os-partner:48418
BRANCH=none
TEST= On Kunimitsu board, ensure sw sync is enabled.
In OS, cat /sys/bus/iio/devices/iio:devicesx/in_illuminace_input
should output valid value and not zero.

Change-Id: Iba1a3ab2cf7bfc2d8aa36cf9bb9b762f398882c3
Signed-off-by: Jagadish Krishnamoorthy <jagadish.krishnamoorthy@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/317030
Commit-Ready: Freddy Paul <freddy.paul@intel.com>
Reviewed-by: Freddy Paul <freddy.paul@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Jagadish Krishnamoorthy
2015-12-08 18:31:00 -08:00
committed by chrome-bot
parent 5618054f95
commit 56385a0567

View File

@@ -8,10 +8,12 @@
*/
#include "als.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
#include "hooks.h"
#include "host_command.h"
#include "system.h"
#include "task.h"
#include "timer.h"
#include "util.h"
@@ -77,8 +79,20 @@ static void als_task_disable(void)
task_timeout = -1;
}
static void als_task_init(void)
{
/*
* Enable ALS task in S0 only and may need to re-enable
* when sysjumped.
*/
if (system_jumped_to_this_image() &&
chipset_in_state(CHIPSET_STATE_ON))
als_task_enable();
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, als_task_enable, HOOK_PRIO_ALS_INIT);
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, als_task_disable, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_INIT, als_task_init, HOOK_PRIO_ALS_INIT);
/*****************************************************************************/
/* Console commands */