summaryrefslogtreecommitdiff
path: root/baseboard/volteer/usb_pd_policy.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Merge remote-tracking branch cros/main into factory-brya-14517.B-main"factory-brya-14517.B-mainYH Lin2022-12-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit af25602b15b22b9ef5821dcba9934311f2157c48. Reason for revert: broken build due to ec-utils. Original change's description: > Merge remote-tracking branch cros/main into factory-brya-14517.B-main > > Generated by: util/update_release_branch.py --baseboard brya --relevant_paths_file > baseboard/brya/relevant-paths.txt factory-brya-14517.B-main > > Relevant changes: > > git log --oneline 54462f034b..aa40b859b3 -- baseboard/brya board/agah > board/anahera board/banshee board/brya board/crota board/felwinter > board/gimble board/kano board/mithrax board/osiris board/primus > board/redrix board/taeko board/taniks board/vell board/volmar > driver/bc12/pi3usb9201_public.* driver/charger/bq25710.* > driver/ppc/nx20p348x.* driver/ppc/syv682x_public.* > driver/retimer/bb_retimer_public.* driver/tcpm/nct38xx.* > driver/tcpm/ps8xxx_public.* driver/tcpm/tcpci.* include/power/alderlake* > include/intel_x86.h power/alderlake* power/intel_x86.c > util/getversion.sh > > e6da633c38 driver: Sort header files > 234a87ae2d tcpci: Add FRS enable to driver structure > a56be59ccd tcpm_header: add test for tcpm_dump_registers > 57b3256963 Rename CONFIG_CHARGER_INPUT_CURRENT to _CHARGER_DEFAULT_CURRENT_LIMIT > e420c8ff9a marasov: Modify TypeC and TypeA configuration. > 43b53e0045 Add default implementation of board_set_charge_limit > b75dc90677 Add CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT > f1b563c350 baseboard: Sort header files > 7d01b1e58d driver/retimer/ps8818.h: Add I2C ADDR FLAGS 0x30, 0x58, 0x70 > ec31407993 Add CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT > 8f89f69a5b crota: disable lid angle sensor for clamshell > > BRANCH=None > BUG=b:259002141 b:255184961 b:247100970 b:259354679 b:260630630 > BUG=b:163093572 b:254328661 > TEST=`emerge-brya chromeos-ec` > > Force-Relevant-Builds: all > Change-Id: Ia85a701fbf6b8e67ec214b9e25e0e55e980a6f47 > Signed-off-by: YH Lin <yueherngl@google.com> Bug: b:259002141 b:255184961 b:247100970 b:259354679 b:260630630 Bug: b:163093572 b:254328661 Change-Id: I48d5aa4cc67a69ee1f6ac9255ac3087d34da4c72 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4077248 Tested-by: YH Lin <yueherngl@chromium.org> Commit-Queue: YH Lin <yueherngl@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com> Auto-Submit: YH Lin <yueherngl@chromium.org>
* baseboard: Sort header filesJeremy Bettis2022-11-231-2/+2
| | | | | | | | | | | | | | | | | | | | | Sort all includes in baseboard with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I259d3bae478d1f649623bc56339e2f8423ede0dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4049441 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Simon Glass <sjg@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
* volteer: Config-guard TBT UFP codeAbe Levkoy2022-09-141-0/+2
| | | | | | | | | | | | | | Only build Thunderbolt UFP config for boards that support Thunderbolt. Reduce code size and avoid linker errors. BUG=b:244467636 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I31b6ff121663a73e46e1eddace59dbb14140ef55 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887964 Reviewed-by: Keith Short <keithshort@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* baseboard/volteer/usb_pd_policy.c: Format with clang-formatJack Rosenthal2022-07-011-48/+36
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: If24723d71c8cfe93be8f3dd2732c4da41469d9d8 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3727953 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* TBT UFP: Correct TBT UFP VDM ACK timing with mux taskDiana Z2022-02-091-2/+12
| | | | | | | | | | | | | | | | | | | | When an EnterMode command comes in, the Responder should be in the USB mode or safe state before configuring its pins to the new mode and sending an ACK. However, since our virtual mux ACK sequence may take longer than the allowed tVDMEnterMode, the best we can do is wait as long as we can without violating this timing before sending the ACK. BRANCH=None BUG=b:213024508 TEST=on brya, ensure TBT UFP mode entry completes successfully and in a timely manner with the mux task enabled Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I5c6325022cdbd925548c3de7c01a279d0666f130 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3411537 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Volteer: Add TBT UFP board policyDiana Z2022-02-091-0/+21
| | | | | | | | | | | | | | | Add policy tracking to the volteer baseboard for whether TBT UFP mode entry has been enabled. BRANCH=None BUG=b:213024508 TEST=on volteer, confirm we NAK UFP mode entry until explicitly allowed by the AP, and then NAK again when disallowed Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: If3df72f090d35152cf4d44b121919eadad7fe603 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3411535 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: Fix broken volteer buildJeremy Bettis2021-09-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On github, the volteer build was failing with error: undefined reference to `ppc_is_vbus_present' but it was building in the chroot. It seems the chroot linker can determine that the pd_snk_is_vbus_provided function is never called, but the zephyr toolchain linker cannot, or perhaps it does missing function detection before removing unused functions. Remove pd_snk_is_vbus_provided if CONFIG_USB_PD_VBUS_DETECT_PPC is not set. BRANCH=None BUG=b:194375840 TEST=In docker container: PROJECT=volteer; PROJECT_SUBDIR=volteer/; VERSION=26; unset TOOLCHAIN zmake -j1 --zephyr-base "${ZEPHYR_BASE}${VERSION}" \ --modules-dir "${MODULES_DIR}" -l DEBUG configure -b \ -B "${BUILD_DIR}/${PROJECT}" -t ${TOOLCHAIN:-zephyr} \ zephyr/projects/${PROJECT_SUBDIR}${PROJECT} In chroot: zmake configure -b zephyr/projects/volteer/volteer Change-Id: I59679a12e89e8b2e5fa2f62dc5fa60d108234d23 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3188214 Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Parth Malkan <parthmalkan@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com> Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-311-1/+1
| | | | | | | | | | | | | | | 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>
* TCPMv2: VOLTEER: Correctly set ID Header VDOSam Hurst2021-02-241-2/+2
| | | | | | | | | | | | | | | | When responding to a DiscId message, return the ID Header VDO with the USB Communications Capable as a USB Device bit to zero and the Product Type(UFP) bits to 000b. BUG=b:173028252 BRANCH=none TEST=Passes TD.PD.VNDI.E1 VDM Identity Signed-off-by: Sam Hurst <shurst@google.org> Change-Id: I57a62db92eee0f63e081bdb9b6d49e6e3206a41c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2707252 Commit-Queue: Sam Hurst <shurst@google.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* volteer: Add version number of productli feng2021-02-121-2/+2
| | | | | | | | | | | | | | | Per PD Rev3.0 Spec, VDM Product VDO has a field bcdDevice, it's version number relevant to the release version of the product. BUG=b:157163664 BRANCH=none TEST=make buildall Signed-off-by: li feng <li1.feng@intel.com> Change-Id: Ie735b64c9d4a1dec2f3402b2c521c107a9769ee0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2420469 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* BB retimer: Set UFP mode of BB retimerAyushee2021-01-071-10/+1
| | | | | | | | | | | | | | | | | | | | | This CL enables getting the enter mode information received from DFP and sets the following BB retimer bits accordingly. Bit 2: RE_TIMER_DRIVER Bit 18: CABLE_TYPE Bit 19: VPRO_DOCK_DETECTED Bit 20: TBT_ACTIVE_LINK_TRAINING Bit 22: ACTIVE/PASSIVE Bits 27-25: TBT Cable speed Bits 29-28: TBT_GEN_SUPPORT BUG=b:157163664 BRANCH=None TEST=Tested with volteer as UFP, able to set the retimer bits Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I661aa4630b42fbaa136ff3855c4f70e3dee61546 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2382634 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Update source-out configsDiana Z2020-12-241-10/+0
| | | | | | | | | | | | | | | | | | | | Now that the DPM will be handling source-out decisions for TCPMv2, remove references to its old configuration options from TCPMv2 boards in order to avoid any confusion as to what code is running now. Also remove the charge manager notifications of sink attach/detach since the policy is being centralized into the DPM. Note that the previous configuration options only ever allocated one 3.0 A port, and so the default number of 3.0 A ports has been set to 1. BRANCH=None BUG=b:168862110,b:141690755 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie452e3da32b04226503539daa67b6b9f4a58aa58 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597431 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: support TBT Alt mode as UFPli feng2020-12-211-0/+137
| | | | | | | | | | | | | | | | | | | Implemented SVDM responders for TBT Alt mode BUG=b:148528713,b:157163664,b:162986785 BRANCH=none TEST=1. Build ec with CL:2382634; OS CPFE 13447, CB CPFE 13535 2. Boot up Volteer, run "pd trysrc 0" on EC console; 3. Then connect port 1 to TGL Windows RVP TBT port; 4. Thunderbolt connection is established. Volteer port 1 as UFP, Windows RVP TBT port as DFP. From host console, thunderbolt0 is listed as network interface in ifconfig. Signed-off-by: li feng <li1.feng@intel.com> Change-Id: If4c80418677f541e9c1c7c8c84446357000aaecb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2370045 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aashay Shringarpure <aashay@google.com>
* usb_pd_policy: Make a lot of objects commonAseda Aboagye2019-12-101-330/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a board specific usb_pd_policy.c file that contains a lot of code for handling DisplayPort Alternate mode, Google Firmware Update Alternate mode, as well as some PD policy functions such as deciding to Accept or Reject a data role swap or a power role swap. Several boards simply copy/paste this code from project to project as a lot of this functionality is not actually board specific. This commit tries to refactor this by pulling the functions that are not mainly board specific into common code. The functions are made overridable such that boards that truly do require a different implementation may do so. Additionally, this consolidation changes the policy behaviour for some boards, but they should be for the better. Some examples include that data swaps are always allowed if we are a UFP (no system image requirement), power swaps are allowed to become a sink if we are no longer dual role (e.g. - in suspend), and DisplayPort Alternate Mode is not entered if the AP is off. In order to facilitate this refactor, a couple CONFIG_* options were introduced: - CONFIG_USB_PD_DP_HPD_GPIO /* HPD is sent to the GPU from the EC via a GPIO */ - CONFIG_USB_PD_CUSTOM_VDO /* * Define this if a board needs custom SNK and/or SRC PDOs. * * The default SRC PDO is a fixed 5V/1.5A with PDO_FIXED_FLAGS indicating * Dual-Role power, USB Communication Capable, and Dual-Role data. * * The default SNK PDOs are: * - Fixed 5V/500mA with the same PDO_FIXED_FLAGS * - Variable (non-battery) min 4.75V, max PD_MAX_VOLTAGE_MV, * operational current PD_MAX_CURRENT_MA, * - Battery min 4.75V, max PD_MAX_VOLTAGE_MV, operational power * PD_OPERATING_POWER_MW */ BUG=chromium:1021724,b:141458448 BRANCH=<as many as we can that are still supported> TEST=`make -j buildall` TEST=Flash a kohaku, verify that DP Alt Mode still works with a variety of DP peripherals TEST=Repeat above with a nocturne TEST=Repeat above with an atlas Change-Id: I18fd7e22dc77fe1dc6c21c38cd7f1bc53cae86cb Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949052 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* volteer: disable PD 3.0 stackKeith Short2019-12-061-0/+36
| | | | | | | | | | | | | The PD 3.0 stack isn't reliably charging the battery. BUG=b:145622441 BRANCH=none TEST=make buildall TEST=verify PD negotiation with battery connected and battery charging Change-Id: Idccf6a4f325e94fdbf2df310b539a0b75125be92 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949148
* volteer: Add USB-C policyVijay Hiremath2019-11-211-12/+177
| | | | | | | | | | | BUG=b:140578872 BRANCH=none TEST=USB2.0 & USB3.0 device detected over Type-C port 0 Change-Id: I44790aac3543589c32dcd60f84e4e67d5d76cdab Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1922752 Reviewed-by: Keith Short <keithshort@chromium.org>
* Volteer: configure USBC port 0Keith Short2019-11-121-0/+210
Configure PPC, and TCPC for USBC port 0. Includes battery and charger stubs. USB PD policy is stubbed or TODO. BUG=b:140572591 BRANCH=none TEST=make buildall TEST=connect 45W charger to Volteer, observe that PD negotiates 15V/3A operation. Change-Id: Iec92a93dd99286289d77e59865c6f0b52f26dffa Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1896641 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>