
Add API log_wakeup_reason() and expose it to userspace via sysfs path /sys/kernel/wakeup_reasons/last_resume_reason Bug: 120445600 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> [AmitP: Folded following android-4.9 commit changes into this patch 1135122a192a ("ANDROID: POWER: fix compile warnings in log_wakeup_reason") b4e6247778b0 ("ANDROID: Power: Changes the permission to read only for sysfs file /sys/kernel/wakeup_reasons/last_resume_reason") e13dbc7c69cd ("ANDROID: power: wakeup_reason: rename irq_count to irqcount")] Signed-off-by: Amit Pundir <amit.pundir@linaro.org> [astrachan: Folded the following changes into this patch: 39d7c7fe91c0 ("ANDROID: power: wakeup_reason: Add guard condition for maximum wakeup reasons") 0730434bdf49 ("ANDROID: power: wakeup_reason: Avoids bogus error messages for the suspend aborts.") 4e42dceae54e ("ANDROID: power: wakeup_reason: Adds functionality to log the last suspend abort reason.") f21313b70ac7 ("ANDROID: power: wakeup_reason: Report suspend times from last_suspend_time") f97ec34442ac ("ANDROID: power: wakeup_reason: fix suspend time reporting") cd92df73e504 ("ANDROID: power: wakeup: Add last wake up source logging for suspend abort reason.") 546b6ae3c087 ("ANDROID: power: wakeup: Add the guard condition for len in pm_get_active_wakeup_sources") 1453d9ffcdbe ("ANDROID: power: wakeup_reason: make logging work in an interrupt context.")] Change-Id: I81addaf420f1338255c5d0638b0d244a99d777d1 Signed-off-by: Alistair Strachan <astrachan@google.com>
31 lines
942 B
C
31 lines
942 B
C
/*
|
|
* include/linux/wakeup_reason.h
|
|
*
|
|
* Logs the reason which caused the kernel to resume
|
|
* from the suspend mode.
|
|
*
|
|
* Copyright (C) 2014 Google, Inc.
|
|
* This software is licensed under the terms of the GNU General Public
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
* may be copied, distributed, and modified under those terms.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#ifndef _LINUX_WAKEUP_REASON_H
|
|
#define _LINUX_WAKEUP_REASON_H
|
|
|
|
#define MAX_SUSPEND_ABORT_LEN 256
|
|
|
|
void log_wakeup_reason(int irq);
|
|
#ifdef CONFIG_SUSPEND
|
|
void log_suspend_abort_reason(const char *fmt, ...);
|
|
#else
|
|
static inline void log_suspend_abort_reason(const char *fmt, ...) { }
|
|
#endif
|
|
|
|
#endif /* _LINUX_WAKEUP_REASON_H */
|