From a990e4e832010c6967eb0243de8ba7ce9c3a7825 Mon Sep 17 00:00:00 2001 From: Scott Date: Thu, 23 Feb 2017 14:21:39 -0800 Subject: pd: Add tcpc_select_rp_value to stub tcpm driver The function tcpm_select_rp_value() is used to set a given Rp value. This function was not supported for boards that use the config option CONFIG_USB_PD_TCPC. This CL adds a weak board_ function which can be overloaded for boards that have the requirement to set Rp to different values. BUG=chrome-os-partner:61878 BRANCH=servo TEST=run 'make buildall'. On plankton added a console command to trigger a call to tcpm_select_rp_value(0, 0), verified that it returned 2 (EC_ERROR_NOT_IMPLEMENTED). Then added board_select_rp_value() to plankton's board.c and verified that it returned 0. Change-Id: I1cd6f0ed51717736d30575c58025bd9a1c5d6fc4 Signed-off-by: Scott Reviewed-on: https://chromium-review.googlesource.com/446685 Commit-Ready: Scott Collyer Tested-by: Scott Collyer Reviewed-by: Vincent Palatin --- common/usb_pd_tcpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'common/usb_pd_tcpc.c') diff --git a/common/usb_pd_tcpc.c b/common/usb_pd_tcpc.c index db1722f2e6..491b471e22 100644 --- a/common/usb_pd_tcpc.c +++ b/common/usb_pd_tcpc.c @@ -970,6 +970,16 @@ int tcpc_get_cc(int port, int *cc1, int *cc2) return EC_SUCCESS; } +int board_select_rp_value(int port, int rp) __attribute__((weak)); + +int tcpc_select_rp_value(int port, int rp) +{ + if (board_select_rp_value) + return board_select_rp_value(port, rp); + else + return EC_ERROR_UNIMPLEMENTED; +} + int tcpc_set_polarity(int port, int polarity) { pd[port].polarity = polarity; -- cgit v1.2.1