diff options
author | Patryk Duda <pdk@semihalf.com> | 2020-12-15 18:01:06 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-22 09:44:52 +0000 |
commit | 0fcc700324d8f8517e752e88b05fda49b0689c2c (patch) | |
tree | 505e9b4a66eb65fe7259dfdea95424aec1bb8840 | |
parent | 94a436afae45007cbb06f03bd933aab3f57c63a6 (diff) | |
download | chrome-ec-0fcc700324d8f8517e752e88b05fda49b0689c2c.tar.gz |
TCPMv1/TCPMv2: Add functions providing requested voltage and current
This patch adds functions responsible for providing voltage and current
requested from charger.
This patch doesn't introduce any logical changes.
BUG=b:161775827
BRANCH=none
TEST=make -j buildall
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: Ib86285e4c4e6f2da3f922a8a4389e78706f1de96
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592497
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | common/usb_pd_protocol.c | 12 | ||||
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 10 | ||||
-rw-r--r-- | include/usb_pd.h | 14 |
3 files changed, 36 insertions, 0 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 43db22664b..29b07a0767 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2619,6 +2619,18 @@ uint8_t pd_get_task_state(int port) return pd[port].task_state; } +#ifdef CONFIG_USB_PD_DUAL_ROLE +uint32_t pd_get_requested_voltage(int port) +{ + return pd[port].supply_voltage; +} + +uint32_t pd_get_requested_current(int port) +{ + return pd[port].curr_limit; +} +#endif + const char *pd_get_task_state_name(int port) { #ifdef CONFIG_USB_PD_TCPMV1_DEBUG diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index cdf90056d5..893bdd4244 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -1084,6 +1084,16 @@ uint8_t pd_get_snk_cap_cnt(int port) return pe[port].snk_cap_cnt; } +uint32_t pd_get_requested_voltage(int port) +{ + return pe[port].supply_voltage; +} + +uint32_t pd_get_requested_current(int port) +{ + return pe[port].curr_limit; +} + /* * Evaluate a sink PDO for reported FRS support on the given port. * diff --git a/include/usb_pd.h b/include/usb_pd.h index 2b0b6eff97..bcd4486529 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -2809,6 +2809,20 @@ const uint32_t * const pd_get_snk_caps(int port); uint8_t pd_get_snk_cap_cnt(int port); /** + * Returns requested voltage + * + * @param port USB-C port number + */ +uint32_t pd_get_requested_voltage(int port); + +/** + * Returns requested current + * + * @param port USB-C port number + */ +uint32_t pd_get_requested_current(int port); + +/** * Return true if partner port is capable of communication over USB data * lines. * |