summaryrefslogtreecommitdiff
path: root/common/usb_pd_console_cmd.c
Commit message (Collapse)AuthorAgeFilesLines
* usbpd: implement new api to access PD discovery dataDeepti Deshatty2021-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API pd_get_am_discovery() sets the lock (task access bit) to keep track of EC tasks accessing the pd port discovery data. If any of the task access bits are set,EC host task typec discovery handler will return EC_RES_BUSY to host, indicating discovery data is modified while copying port discovery data to the host. Hence the lock/task access bit should be set only when the port discovery data is modified by any tasks. Setting of lock/task access is removed from pd_get_am_discovery() and implemented new api pd_get_am_discovery_and_notify_access() for this. pd_get_am_discovery() proto type is changed to return 'constant pointer' which forces developers to use pd_get_am_discovery_and_notify_access() when they intend to access and modify discovery data. summary of changes implemented. - Remove setting of task access bit from pd_get_am_discovery(). - modify pd_get_am_discovery() prototype to return constant pointer. - implement new api pd_get_am_discovery_and_notify_access() - Replace calls to pd_get_am_discovery() with new api wherever discovery data is accessed and modified. BRANCH=none BUG=b:197466819 b:190390784 TEST=Verified 50 cold boot cycling with TBT device attached. Device detected in every cycle. Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: I5b6f1f2b91d92ddbe58f3bf994f684abee948c02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139858 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-311-9/+9
| | | | | | | | | | | | | | | As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Rename enum tcpm_transmit_typeAbe Levkoy2021-08-181-1/+2
| | | | | | | | | | | | | | | Rename tcpm_transmit_type to tcpm_sop_type to reflect that it can be used for Rx as well. Describe it in comments. This prepares to consolidate enum pd_msg_type into this enum. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ife97d4ad51c48f2e832b94e007954919e236a309 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104290 Reviewed-by: Keith Short <keithshort@chromium.org>
* TBT: Correct pdcable commandAyushee Shah2021-01-251-1/+1
| | | | | | | | | | | | | | | This CL changes the revision field in the pdcable console command to check the PD revision instead of checking the VDM version. BUG=None BRANCH=None TEST=Able to get the 'Cable Rev' field as 3.0 for PD 3.0 cables Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: I7e10b2e352bc78c23c8578361b577d04a9491e7a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2643576 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Update 'pdcable' console commandAyushee2020-11-061-0/+26
| | | | | | | | | | | | | | | This patchset adds information about cable's Thunderbolt mode response. BUG=b:129990370 BRANCH=none TEST=EC command "pdcable <port>" prints out the information about the cable. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I485fb767009242636332e19ed7d211dbcc837b27 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2515063 Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_pd: Remove pd_cable usage from common codeAyushee2020-06-251-24/+27
| | | | | | | | | | | | | | | | | | | Previously, the Discovery Identity SOP' response for TCPMv1/2 was being stored in pd_discovery and in pd_cable. This commit removes the storage of Discover Identity SOP' response from the pd_cable structure. BUG=b:158294748 b:159504972 BRANCH=None TEST=1. Able to get the cable characteristics 2. Able to enter into Thunderbolt mode on TCPMv1 3. Able to enter into USB4 mode on TCPMv1 Change-Id: I1e5112f9aa158c41abb6226a3819f1612ed906bd Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247211 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Support mode entry for SOP' and SOP''Abe Levkoy2020-06-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | Add a transmit type parameter to functions involved in mode entry; also add such a parameter to various functions calling those functions. For DisplayPort-specific definitions or calls, specify SOP; we do not currently support DisplayPort mode for cable plugs. For TCPMv1-specific code, specify SOP. TCPMv1 generally assumes that the discovery/mode structures are 1-dimensional, as they were previously, and changing that is outside the scope of this CL. BUG=b:155890173 TEST=Enter DP mode on Volteer with TCPMv2 TEST=Enter DP mode on Volteer with TCPMv1 TEST=Enter TBT mode on Volteer with TCPMV1 BRANCH=none Change-Id: I8afc75b3f3be8939c4645058ac4a31f24c88fb9e Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2229279 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* TCPMv2: Define fields for SVID discovery stateAbe Levkoy2020-05-121-4/+7
| | | | | | | | | | | | | | | Index discovery results by SOP type and track SVID discovery state for each type. Define accessors for this state and modify existing accessors to be SOP-type-aware. BUG=b:152419850,b:152418267 TEST=make buildall; attach port partner; observe discovery via Twinkie BRANCH=none Change-Id: I24ee19aac087c5752a3a822ab2b0c9da7a55af1b Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2174464 Reviewed-by: Diana Z <dzigterman@chromium.org>
* PD: Store cable identity in pd_discovery structureDiana Z2020-04-211-21/+26
| | | | | | | | | | | | | | Stores SOP' cable response in pd_discovery identity array. BRANCH=None BUG=b:152417977 TEST=on kindred with TCPMv2, ensure "pe" command shows correct information for cable and port partner Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia1186e25b92d9ae4f34e8c039b2ad1d1abbff9eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2148426 Reviewed-by: Jett Rink <jettrink@chromium.org>
* PD: Use new structure for storing SOP identity responsesDiana Z2020-04-161-7/+10
| | | | | | | | | | | | | | | | Use the newly created identity_data structure to store the SOP discover identity response. For older boards which are almost out of static space, only allocate space for the SOP response. BRANCH=None BUG=b:152417977 TEST=on kindred with TCPMv2, confirm discovery can complete and correct data is given from the pe console command Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If63d9770bdfcc268734f7b45ce08a0a7abb396e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130476 Reviewed-by: Jett Rink <jettrink@chromium.org>
* PD: Rename pd_policy to pd_discoveryDiana Z2020-04-071-14/+15
| | | | | | | | | | | | | | Rename struct pd_policy to struct pd_discovery to more accurately reflect what the structure contains. BRANCH=None BUG=b:152417977 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I51de48103053aa60b3cdb15cf9fbf15dd75d727a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130473 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv1/v2: Move "pdcable" console command to common fileVijay Hiremath2020-02-071-0/+96
| | | | | | | | | | | BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I7f78efeb74536d5d6c5dd0b4bd5f32325c1500ec Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2036604 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move "pe" console command to common fileVijay Hiremath2020-02-041-0/+85
BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I71c8d491014a69ec938fa1172eee7b5322572654 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2032726 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>