summaryrefslogtreecommitdiff
path: root/common/gaia_power.c
diff options
context:
space:
mode:
authorCharlie Mooney <charliemooney@chromium.org>2012-08-23 14:28:57 -0700
committerGerrit <chrome-bot@google.com>2012-08-27 09:27:43 -0700
commitecd4e1b5d6cc0530b3416ce626b4665ec298e4e4 (patch)
tree4ff004e1093d4e2e78a0cc30150ef649a9e341af /common/gaia_power.c
parentb11c1e234b86498311c340bd8b9b51b8d22e2ff5 (diff)
downloadchrome-ec-ecd4e1b5d6cc0530b3416ce626b4665ec298e4e4.tar.gz
Reset pmic registers to known safe values on boot
If a bug causes the pmic's internal registers to be overwritten with garbage, they won't go away and can cause long lasting problems. This change overwrites them all whenever the EC or AP turn on with known, safe values, so if that happens, a reboot will restore them instead of forcing the user to pull the battery. It also overwrites a few of them when the AP shuts down, to prevent AP bugs from leaving the pmu powering a bunch of peripherals that it doesn't need after it has turned off. BUG=chrome-os-partner:12913 TEST=from EC console run "i2c w 0x90 0x0c 0xff" to screw up one of the pmic registers. Reboot the EC, and the AP should be able to boot just fine. Once the AP is booted, run that command again. This time, just reboot the AP, it should come back on like normal. Try again with "i2c w 0x90 0x0c 0x00". Without the change, this fails to work. BRANCH=snow Change-Id: If3f0764f23e0112cc11be60b413f51e1b66e54a7 Signed-off-by: Charlie Mooney <charliemooney@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/31259 Reviewed-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Diffstat (limited to 'common/gaia_power.c')
-rw-r--r--common/gaia_power.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/common/gaia_power.c b/common/gaia_power.c
index aae1bd35b7..88936d18fb 100644
--- a/common/gaia_power.c
+++ b/common/gaia_power.c
@@ -31,6 +31,7 @@
#include "hooks.h"
#include "keyboard_scan.h"
#include "power_led.h"
+#include "pmu_tpschrome.h"
#include "system.h"
#include "task.h"
#include "timer.h"
@@ -446,6 +447,7 @@ static void power_off(void)
lid_changed = 0;
enable_sleep(SLEEP_MASK_AP_RUN);
powerled_set_state(POWERLED_STATE_OFF);
+ pmu_shutdown();
CPUTS("Shutdown complete.\n");
}