summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2020-09-16 12:41:15 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-21 22:03:07 +0000
commitcb4a02d5e0358631242ada9178bbc6d5b8367340 (patch)
tree7fc8dae92bdc09f0453086aa39d10e932e34e49f /include
parent3e5d154aaa0c8e71953e1227ffd760f61efe8135 (diff)
downloadchrome-ec-cb4a02d5e0358631242ada9178bbc6d5b8367340.tar.gz
TCPMv2: Move DPM requests to public API
It is safe (atomic bit ops) and will soon be necessary (new host commands) to send DPM requests from outside the PD tasks. Rename pe_dpm_request to pd_dpm_request and move the declarations into usb_pd.h to reflect this. BUG=b:168030639 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ied43e9f6973a3172b98090cc068a607257dce21b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2415068 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd.h38
-rw-r--r--include/usb_pe_sm.h37
2 files changed, 38 insertions, 37 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 806df4d396..4d8a98bac9 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -940,6 +940,34 @@ enum pd_dual_role_states {
/* Switch to source */
PD_DRP_FORCE_SOURCE,
};
+
+/*
+ * Device Policy Manager Requests.
+ * NOTE: These are usually set by host commands from the AP.
+ */
+enum pd_dpm_request {
+ DPM_REQUEST_DR_SWAP = BIT(0),
+ DPM_REQUEST_PR_SWAP = BIT(1),
+ DPM_REQUEST_VCONN_SWAP = BIT(2),
+ DPM_REQUEST_GOTO_MIN = BIT(3),
+ DPM_REQUEST_SRC_CAP_CHANGE = BIT(4),
+ DPM_REQUEST_GET_SNK_CAPS = BIT(5),
+ DPM_REQUEST_SEND_PING = BIT(6),
+ DPM_REQUEST_SOURCE_CAP = BIT(7),
+ DPM_REQUEST_NEW_POWER_LEVEL = BIT(8),
+ DPM_REQUEST_VDM = BIT(9),
+ DPM_REQUEST_BIST_RX = BIT(10),
+ DPM_REQUEST_BIST_TX = BIT(11),
+ DPM_REQUEST_SNK_STARTUP = BIT(12),
+ DPM_REQUEST_SRC_STARTUP = BIT(13),
+ DPM_REQUEST_HARD_RESET_SEND = BIT(14),
+ DPM_REQUEST_SOFT_RESET_SEND = BIT(15),
+ DPM_REQUEST_PORT_DISCOVERY = BIT(16),
+ DPM_REQUEST_SEND_ALERT = BIT(17),
+ DPM_REQUEST_ENTER_USB = BIT(18),
+ DPM_REQUEST_GET_SRC_CAPS = BIT(19),
+};
+
/**
* Get dual role state
*
@@ -2236,6 +2264,16 @@ void pd_log_recv_vdm(int port, int cnt, uint32_t *payload);
void pd_send_vdm(int port, uint32_t vid, int cmd, const uint32_t *data,
int count);
+/**
+ * Instruct the Policy Engine to perform a Device Policy Manager Request
+ * This function is called from the Device Policy Manager and only has effect
+ * if the current Policy Engine state is Src.Ready or Snk.Ready.
+ *
+ * @param port USB-C port number
+ * @param req Device Policy Manager Request
+ */
+void pd_dpm_request(int port, enum pd_dpm_request req);
+
/*
* TODO(b/155890173): Probably, this should only be used by the DPM, and
* pd_send_vdm should be implemented in terms of DPM functions.
diff --git a/include/usb_pe_sm.h b/include/usb_pe_sm.h
index 340c0b486b..0cd3bd86da 100644
--- a/include/usb_pe_sm.h
+++ b/include/usb_pe_sm.h
@@ -19,33 +19,6 @@ enum pe_error {
ERR_TCH_XMIT,
};
-/*
- * Device Policy Manager Requests.
- * NOTE: These are usually set by host commands from the AP.
- */
-enum pe_dpm_request {
- DPM_REQUEST_DR_SWAP = BIT(0),
- DPM_REQUEST_PR_SWAP = BIT(1),
- DPM_REQUEST_VCONN_SWAP = BIT(2),
- DPM_REQUEST_GOTO_MIN = BIT(3),
- DPM_REQUEST_SRC_CAP_CHANGE = BIT(4),
- DPM_REQUEST_GET_SNK_CAPS = BIT(5),
- DPM_REQUEST_SEND_PING = BIT(6),
- DPM_REQUEST_SOURCE_CAP = BIT(7),
- DPM_REQUEST_NEW_POWER_LEVEL = BIT(8),
- DPM_REQUEST_VDM = BIT(9),
- DPM_REQUEST_BIST_RX = BIT(10),
- DPM_REQUEST_BIST_TX = BIT(11),
- DPM_REQUEST_SNK_STARTUP = BIT(12),
- DPM_REQUEST_SRC_STARTUP = BIT(13),
- DPM_REQUEST_HARD_RESET_SEND = BIT(14),
- DPM_REQUEST_SOFT_RESET_SEND = BIT(15),
- DPM_REQUEST_PORT_DISCOVERY = BIT(16),
- DPM_REQUEST_SEND_ALERT = BIT(17),
- DPM_REQUEST_ENTER_USB = BIT(18),
- DPM_REQUEST_GET_SRC_CAPS = BIT(19),
-};
-
/**
* Runs the Policy Engine State Machine
*
@@ -151,16 +124,6 @@ void pe_vconn_swap_complete(int port);
*/
int pe_is_explicit_contract(int port);
-/**
- * Instruct the Policy Engine to perform a Device Policy Manager Request
- * This function is called from the Device Policy Manager and only has effect
- * if the current Policy Engine state is Src.Ready or Snk.Ready.
- *
- * @param port USB-C port number
- * @param req Device Policy Manager Request
- */
-void pe_dpm_request(int port, enum pe_dpm_request req);
-
/*
* Return true if port partner is dualrole capable
*