diff options
author | Aseda Aboagye <aaboagye@google.com> | 2017-08-10 13:12:30 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-11 20:10:20 -0700 |
commit | 79ae73477c1d6a84ce9c64eb82a183a163aa3646 (patch) | |
tree | 6afeec8aa404c0750d079a326712fc3ab39fd4aa /include | |
parent | 97fe22e8d559449cbd9df5cc2065f5ab5941830e (diff) | |
download | chrome-ec-79ae73477c1d6a84ce9c64eb82a183a163aa3646.tar.gz |
charge_manager: Consider port in source PDO.
When CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT is defined for a board, as
its name implies, the board can source a higher current if there is
only one port acting as a source.
This commit fixes an issue with selecting the right source capability
message to advertise. charge_manager_get_source_pdo() was simply
checking if there was more than one sink connected, instead of checking
if there were any *other* sinks connected. In the event that a sink
was connected to a different port, we would advertise the max source
PDO.
BUG=b:64037926, b:35577509
BRANCH=gru,eve,reef
TEST=Connect sink to port 1. Connect a AMA to port 0 that claims that
VBUS isn't necessary. Start sending source caps, verify that the max
PDO is not being advertised in the source caps.
Change-Id: Ie4145ecaf98d5b9070ad3e8b139e5653685fa801
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/610479
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/charge_manager.h | 5 | ||||
-rw-r--r-- | include/usb_pd.h | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/charge_manager.h b/include/charge_manager.h index 2137899a13..037723047c 100644 --- a/include/charge_manager.h +++ b/include/charge_manager.h @@ -161,10 +161,11 @@ void charge_manager_source_port(int port, int enable); /** * Get PD source power data objects. * - * @param src_pdo pointer to the data to return. + * @param src_pdo Pointer to the data to return. + * @param port Current port to evaluate against. * @return number of PDOs returned. */ -int charge_manager_get_source_pdo(const uint32_t **src_pdo); +int charge_manager_get_source_pdo(const uint32_t **src_pdo, const int port); /* Board-level callback functions */ diff --git a/include/usb_pd.h b/include/usb_pd.h index cefe8abe06..9deed54b88 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -942,9 +942,10 @@ int pd_is_valid_input_voltage(int mv); * Request a new operating voltage. * * @param rdo Request Data Object with the selected operating point. + * @param port The port which the request came in on. * @return EC_SUCCESS if we can get the requested voltage/OP, <0 else. */ -int pd_check_requested_voltage(uint32_t rdo); +int pd_check_requested_voltage(uint32_t rdo, const int port); /** * Run board specific checks on request message |