summaryrefslogtreecommitdiff
path: root/common/usb_pd_alt_mode_dfp.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-01-30 20:23:49 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-04 04:07:54 +0000
commit6b87e07a55b83251d30288dbb297d602ddba811a (patch)
tree37a00c1d31f8289bdb1e9e5918d5d6b7e1f2416e /common/usb_pd_alt_mode_dfp.c
parent51e1a092de5daf59b1a6b39755183a6ef312f199 (diff)
downloadchrome-ec-6b87e07a55b83251d30288dbb297d602ddba811a.tar.gz
TCPMv1/v2: Move DFP alternate mode functions to common file
BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I34bf543b381fc9e4f858a48d3d1568de42438509 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032725 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_pd_alt_mode_dfp.c')
-rw-r--r--common/usb_pd_alt_mode_dfp.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c
index 40a048a2bc..80f45ebb01 100644
--- a/common/usb_pd_alt_mode_dfp.c
+++ b/common/usb_pd_alt_mode_dfp.c
@@ -331,3 +331,52 @@ int dfp_discover_modes(int port, uint32_t *payload)
return 1;
}
+
+int pd_alt_mode(int port, uint16_t svid)
+{
+ struct svdm_amode_data *modep = pd_get_amode_data(port, svid);
+
+ return (modep) ? modep->opos : -1;
+}
+
+uint16_t pd_get_identity_vid(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return PD_IDH_VID(pe->identity[0]);
+}
+
+uint16_t pd_get_identity_pid(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return PD_PRODUCT_PID(pe->identity[2]);
+}
+
+uint8_t pd_get_product_type(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return PD_IDH_PTYPE(pe->identity[0]);
+}
+
+int pd_get_svid_count(int port)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return pe->svid_cnt;
+}
+
+uint16_t pd_get_svid(int port, uint16_t svid_idx)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return pe->svids[svid_idx].svid;
+}
+
+uint32_t *pd_get_mode_vdo(int port, uint16_t svid_idx)
+{
+ struct pd_policy *pe = pd_get_am_policy(port);
+
+ return pe->svids[svid_idx].mode_vdo;
+}