summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJagadish Krishnamoorthy <jagadish.krishnamoorthy@intel.com>2015-12-08 18:31:00 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-11 11:22:01 -0800
commit56385a05672ebee2e7ec17e37a18f90b0e92e9f3 (patch)
treead592cd2bffec9bb8f17ae006af68571a5ec80da
parent5618054f952963e04be7aa886d5dcd8a1c55aa4f (diff)
downloadchrome-ec-56385a05672ebee2e7ec17e37a18f90b0e92e9f3.tar.gz
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>
-rw-r--r--common/als.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/als.c b/common/als.c
index 06bd734ef0..96a1550570 100644
--- a/common/als.c
+++ b/common/als.c
@@ -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 */