pd: Store PD active state in battery-backed memory

Our previous idea to cut Rd for many reset cases cannot work if cr50
consistently resets the EC by asserting the reset pin shortly after
power-on. Therefore, make a decision based upon whether battery-backed
memory indicates we previously negotiated a PD power contract as a sink.
If we previously did not negotiate a contract, or if power was removed
from the device (causing battery-backed memory to wipe) then we can
assume that we don't have an active power contract.

BUG=chrome-os-partner:62952
BRANCH=reef
TEST=On reef, run "cutoff" on the console, reattach AC, and verify
device successfully wakes. Also verify Rp is dropped on console 'reboot'
and F3 + power from RW.

Change-Id: Ie300b9589cac6be7a69b77678bea6b1b6b25578c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/443356
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2017-02-15 17:06:37 -08:00
committed by chrome-bot
parent b7f8d9df65
commit 23bc38414a
8 changed files with 85 additions and 14 deletions

View File

@@ -284,6 +284,9 @@ enum system_bbram_idx {
* ...
*/
SYSTEM_BBRAM_IDX_VBNVBLOCK15 = 15,
/* PD state for CONFIG_USB_PD_DUAL_ROLE uses one byte per port */
SYSTEM_BBRAM_IDX_PD0,
SYSTEM_BBRAM_IDX_PD1,
};
/**