summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-01-28 12:00:48 -0800
committerCommit Bot <commit-bot@chromium.org>2020-01-28 23:51:33 +0000
commit609366791c55586d051130363cafb0272ceb0800 (patch)
tree30c3ce6499ae8588d7d2bf822a5629290955b429
parent9c853d14068fe636a24c2c670f6f278851117f89 (diff)
downloadchrome-ec-609366791c55586d051130363cafb0272ceb0800.tar.gz
USB-C: Move EC_CMD_GET_PD_PORT_CAPS host command to host command file
BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: I70625ee9ffe9a3d5c6de73bd80eb5530db39bca7 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2025769 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
-rw-r--r--common/usb_common.c43
-rw-r--r--common/usb_pd_host_cmd.c43
2 files changed, 43 insertions, 43 deletions
diff --git a/common/usb_common.c b/common/usb_common.c
index aeab0bdfdd..fb3ebe84e0 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -1098,46 +1098,3 @@ const struct svdm_amode_fx supported_modes[] = {
};
const int supported_modes_cnt = ARRAY_SIZE(supported_modes);
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
-
-__overridable enum ec_pd_port_location board_get_pd_port_location(int port)
-{
- (void)port;
- return EC_PD_PORT_LOCATION_UNKNOWN;
-}
-
-static enum ec_status hc_get_pd_port_caps(struct host_cmd_handler_args *args)
-{
- const struct ec_params_get_pd_port_caps *p = args->params;
- struct ec_response_get_pd_port_caps *r = args->response;
-
- if (p->port >= board_get_usb_pd_port_count())
- return EC_RES_INVALID_PARAM;
-
- /* Power Role */
- if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE))
- r->pd_power_role_cap = EC_PD_POWER_ROLE_DUAL;
- else
- r->pd_power_role_cap = EC_PD_POWER_ROLE_SINK;
-
- /* Try-Power Role */
- if (IS_ENABLED(CONFIG_USB_PD_TRY_SRC))
- r->pd_try_power_role_cap = EC_PD_TRY_POWER_ROLE_SOURCE;
- else
- r->pd_try_power_role_cap = EC_PD_TRY_POWER_ROLE_NONE;
-
- if (IS_ENABLED(CONFIG_USB_TYPEC_VPD) ||
- IS_ENABLED(CONFIG_USB_TYPEC_CTVPD))
- r->pd_data_role_cap = EC_PD_DATA_ROLE_UFP;
- else
- r->pd_data_role_cap = EC_PD_DATA_ROLE_DUAL;
-
- /* Allow boards to override the locations from UNKNOWN if desired */
- r->pd_port_location = board_get_pd_port_location(p->port);
-
- args->response_size = sizeof(*r);
-
- return EC_RES_SUCCESS;
-}
-DECLARE_HOST_COMMAND(EC_CMD_GET_PD_PORT_CAPS,
- hc_get_pd_port_caps,
- EC_VER_MASK(0));
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index 170482e10b..712d6182e7 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -218,4 +218,47 @@ DECLARE_HOST_COMMAND(EC_CMD_USB_PD_DEV_INFO,
EC_VER_MASK(0));
#endif /* CONFIG_COMMON_RUNTIME */
+__overridable enum ec_pd_port_location board_get_pd_port_location(int port)
+{
+ (void)port;
+ return EC_PD_PORT_LOCATION_UNKNOWN;
+}
+
+static enum ec_status hc_get_pd_port_caps(struct host_cmd_handler_args *args)
+{
+ const struct ec_params_get_pd_port_caps *p = args->params;
+ struct ec_response_get_pd_port_caps *r = args->response;
+
+ if (p->port >= board_get_usb_pd_port_count())
+ return EC_RES_INVALID_PARAM;
+
+ /* Power Role */
+ if (IS_ENABLED(CONFIG_USB_PD_DUAL_ROLE))
+ r->pd_power_role_cap = EC_PD_POWER_ROLE_DUAL;
+ else
+ r->pd_power_role_cap = EC_PD_POWER_ROLE_SINK;
+
+ /* Try-Power Role */
+ if (IS_ENABLED(CONFIG_USB_PD_TRY_SRC))
+ r->pd_try_power_role_cap = EC_PD_TRY_POWER_ROLE_SOURCE;
+ else
+ r->pd_try_power_role_cap = EC_PD_TRY_POWER_ROLE_NONE;
+
+ if (IS_ENABLED(CONFIG_USB_TYPEC_VPD) ||
+ IS_ENABLED(CONFIG_USB_TYPEC_CTVPD))
+ r->pd_data_role_cap = EC_PD_DATA_ROLE_UFP;
+ else
+ r->pd_data_role_cap = EC_PD_DATA_ROLE_DUAL;
+
+ /* Allow boards to override the locations from UNKNOWN if desired */
+ r->pd_port_location = board_get_pd_port_location(p->port);
+
+ args->response_size = sizeof(*r);
+
+ return EC_RES_SUCCESS;
+}
+DECLARE_HOST_COMMAND(EC_CMD_GET_PD_PORT_CAPS,
+ hc_get_pd_port_caps,
+ EC_VER_MASK(0));
+
#endif /* HAS_TASK_HOSTCMD */