pd: change power request based on if active charge port
pd: change power request based on if active charge port

When we receive source capabilities packet from a source, if we are already
the active charging port, then we know we can request max power, otherwise
request vSafe5V. Normally, when you first attach a charger, the port won't
already be the active charge port when we receive source cap. But, if we
already have a power contract with a source and the source sends us new
source capabilities, then this comes in to play.

BUG=chrome-os-partner:34168
BRANCH=samus
TEST=test with plankton. when you press the 5/12/20 V buttons on plankton
it changes the source capabilites of plankton and sends a new source cap
packet to samus. thus, without this change, when you press one of the buttons
twice, the second button press causes us to negotiate to vSafe5V instead
of the max power. with this change, the requested power stays constant
when plankton re-issues source capabilities.

Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/233753
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 5e2409745d28ca3bdf59b167ae5afdd491a10ddc)
Signed-off-by: Duncan Laurie <70662b43bc1a20b57ded72a2b08be88dd0da4841@chromium.org>

Change-Id: I3cc1e6b109117566f59de07762fd1af9adec05bf
Reviewed-on: https://chromium-review.googlesource.com/235741
Tested-by: Duncan Laurie <70662b43bc1a20b57ded72a2b08be88dd0da4841@chromium.org>
Reviewed-by: Duncan Laurie <70662b43bc1a20b57ded72a2b08be88dd0da4841@chromium.org>
Commit-Queue: Duncan Laurie <70662b43bc1a20b57ded72a2b08be88dd0da4841@chromium.org>
Trybot-Ready: Duncan Laurie <70662b43bc1a20b57ded72a2b08be88dd0da4841@chromium.org>

thehobn/ec,thehobn/ec,thehobn/ec,thehobn/ec