diff options
author | Denis Brockus <dbrockus@google.com> | 2020-07-27 12:53:31 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-28 05:24:13 +0000 |
commit | ea077cccd9e5cf25176ab9082be438ac26823126 (patch) | |
tree | 9694b14a57bc46841b452a00a8d2f9c4247959b9 /driver/ppc | |
parent | 9fadd40cebcd179aebf1b12b6fbc0080e71420bc (diff) | |
download | chrome-ec-ea077cccd9e5cf25176ab9082be438ac26823126.tar.gz |
AOZ1380: initialize srcing/snking flags to reflect hardware
The AOZ1380 always started off with not sinking and not
sourcing. In a batteryless or dead battery condition this
is not true. So making sure we start with an accurate
state.
BUG=b:162016100
BRANCH=none
TEST=trembyle cold boot with only AC power
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: Ic542e52b3b8d715b7526e7e393ae4f4c40c721ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2321132
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Diffstat (limited to 'driver/ppc')
-rw-r--r-- | driver/ppc/aoz1380.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/driver/ppc/aoz1380.c b/driver/ppc/aoz1380.c index 67ad00c5e8..42239dd168 100644 --- a/driver/ppc/aoz1380.c +++ b/driver/ppc/aoz1380.c @@ -37,8 +37,19 @@ static uint32_t flags[CONFIG_USB_PD_PORT_MAX_COUNT]; static int aoz1380_init(int port) { + int rv; + bool is_sinking, is_sourcing; + flags[port] = 0; + rv = tcpm_get_snk_ctrl(port, &is_sinking); + if (rv == EC_SUCCESS && is_sinking) + AOZ1380_SET_FLAG(port, AOZ1380_FLAGS_SINK_ENABLED); + + rv = tcpm_get_src_ctrl(port, &is_sourcing); + if (rv == EC_SUCCESS && is_sourcing) + AOZ1380_SET_FLAG(port, AOZ1380_FLAGS_SOURCE_ENABLED); + return EC_SUCCESS; } |