mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-17 02:21:15 +00:00
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 <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/446685 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -15,6 +15,7 @@ extern int tcpc_alert_status(int port, int *alert);
|
||||
extern int tcpc_alert_status_clear(int port, uint16_t mask);
|
||||
extern int tcpc_alert_mask_set(int port, uint16_t mask);
|
||||
extern int tcpc_get_cc(int port, int *cc1, int *cc2);
|
||||
extern int tcpc_select_rp_value(int port, int rp);
|
||||
extern int tcpc_set_cc(int port, int pull);
|
||||
extern int tcpc_set_polarity(int port, int polarity);
|
||||
extern int tcpc_set_power_status_mask(int port, uint8_t mask);
|
||||
@@ -68,7 +69,7 @@ int tcpm_get_cc(int port, int *cc1, int *cc2)
|
||||
|
||||
int tcpm_select_rp_value(int port, int rp)
|
||||
{
|
||||
return -EC_ERROR_UNIMPLEMENTED;
|
||||
return tcpc_select_rp_value(port, rp);
|
||||
}
|
||||
|
||||
int tcpm_set_cc(int port, int pull)
|
||||
|
||||
@@ -72,6 +72,11 @@ int pd_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int board_select_rp_value(int port, int rp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Tests */
|
||||
|
||||
void inc_tx_id(int port)
|
||||
|
||||
Reference in New Issue
Block a user