summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2016-09-23 17:04:15 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-26 11:59:15 -0700
commit8e7539765207b24f836ad71b14ad5764935de1c4 (patch)
tree53c790feec67e56e1d3e9af254c06a13ea9d3d0c
parent672ea89dba35644d5a6b056c5e6a6ffa37dfca11 (diff)
downloadchrome-ec-8e7539765207b24f836ad71b14ad5764935de1c4.tar.gz
power: common: Prevent console spam.
The power state driver would print out the current power state along with its signals everytime a power signal interrupt was fired. On some systems, a signal may briefly go low and then come back before our chipset module has a chance to notice. This causes what appears to be duplicate prints. This commit tries to only print out the current power state when something has actually changed. If the input power signals or state differs from the last time it checked, then the information will be printed. BUG=None BRANCH=gru TEST=Find a kevin where PGOOD goes away quite frequently. Build and flash; Verify that significantly less "power state S0" console spam is emitted. TEST=Verify that all state transitions are still printed. Change-Id: I9d66c04e2ed79ab203c54f0a8dad82f32856bbf0 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/388761 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--power/common.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/power/common.c b/power/common.c
index 7e213f0569..83fd2a302d 100644
--- a/power/common.c
+++ b/power/common.c
@@ -373,10 +373,24 @@ void chipset_exit_hard_off(void)
void chipset_task(void)
{
enum power_state new_state;
+ static enum power_state last_state;
+ uint32_t this_in_signals;
+ static uint32_t last_in_signals;
while (1) {
- CPRINTS("power state %d = %s, in 0x%04x",
- state, state_names[state], in_signals);
+ /*
+ * In order to prevent repeated console spam, only print the
+ * current power state if something has actually changed. It's
+ * possible that one of the power signals goes away briefly and
+ * comes back by the time we update our in_signals.
+ */
+ this_in_signals = in_signals;
+ if (this_in_signals != last_in_signals || state != last_state) {
+ CPRINTS("power state %d = %s, in 0x%04x",
+ state, state_names[state], this_in_signals);
+ last_in_signals = this_in_signals;
+ last_state = state;
+ }
/* Always let the specific chipset handle the state first */
new_state = power_handle_state(state);