summaryrefslogtreecommitdiff
path: root/board/servo_v4
Commit message (Collapse)AuthorAgeFilesLines
* board: Sort header filesJeremy Bettis2022-12-013-4/+5
| | | | | | | | | | | | | | | | | | | | Sort all includes in board 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 -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I6ad72b167cbb768a64c338fa633eb4bf5a401897 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4060360 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* Add default implementation of board_set_charge_limitPeter Marheine2022-11-241-2/+2
| | | | | | | | | | | | | | | | | | | The majority of boards simply call charge_set_input_current_limit() from board_set_charge_limit() now that the minimum current limit and derating are available as config options. Make this the default behavior of the charge manager, overridable by boards as needed. Boards that have existing custom behavior retain it, with their versions of board_set_charge_limit() marked as __override as necessary. BUG=b:163093572 TEST=make buildall; zmake build -a BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I72475ca0e8381596cafbcda4b042c7f884ae0432 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4022857 Reviewed-by: Keith Short <keithshort@chromium.org>
* board/servo_v4: Free up more flash spaceTom Hughes2022-11-121-0/+2
| | | | | | | | | | | | BRANCH=none BUG=b:172020503 TEST=CC=clang make BOARD=servo_v4 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I719bd93e1aaadd1591cf49c07ac65e6815de94bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4024563 Reviewed-by: Brian Nemec <bnemec@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* tree: Remove CONFIG_STM_HWTIMER32Tom Hughes2022-11-111-1/+0
| | | | | | | | | | | | | | | | | | | | | CONFIG_STM_HWTIMER32 was used to choose between a 32-bit timer and 16-bit timer. The 16-bit timer code was removed in https://crrev.com/c/3388064, so we no longer need this config. Command used: git grep --name-only CONFIG_STM_HWTIMER |\ xargs sed -i '/CONFIG_STM_HWTIMER32/d' BRANCH=none BUG=b:214423235 TEST=make buildall -j Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I89da8915cd5a467975cd8f90e734ea2b11f18cb3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3388065 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Patryk Duda <patrykd@google.com>
* ServoV4pX: Correct DUT port SRC_CAP fixed flagsNathan K2022-09-301-4/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | ServoV4p1 has SRC_CAP readvertisement capability between DUTCHG and DUT ports. A longstanding issue is ServoV4pX noncompliantly sets vSafe5v fixed status flags on all PDO indices, not just the first passthrough object. This CL corrects that oversight for ServoV4p1 and ServoV4p0. Note: This is partial excerpt from abandoned major refactor 313b82b. BUG=b:238142672 BRANCH=main TEST=1. Connect PD analyzer and Charger to Servo in pdsrc mode 2. Connect Chromebook 3. Monitor PD trace for SRC_CAP flags Change-Id: I32a7370fad0e9f4b13c488f7b4089dde2d544b9f Signed-off-by: Nathan K <nkolluru@google.com> Signed-off-by: Łukasz Hajec <lha@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750316 Tested-by: Łukasz Hajec <hajec@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* c2d2,servo_micro,servo_v4,servo_v4p1,sweetberry: add OWNERSMatthew Blecker2022-09-241-0/+3
| | | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Matthew Blecker <matthewb@chromium.org> Change-Id: Id907f9b4f8db252abedb7e0ce56ccc92aaeb3516 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3916926 Reviewed-by: Brian Nemec <bnemec@google.com> Commit-Queue: Brian Nemec <bnemec@google.com>
* board: change Google USB vendor infoMike Frysinger2022-09-141-1/+1
| | | | | | | | | | | | | | Use updated legal name. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: I526bea449364cbe44adf83cca1375d47c514dd70 Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893391 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-129-9/+9
| | | | | | | | | | | | | | | 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>
* servo_v4: add "cc dtsoff" and "cc dtson" commandsMatthew Blecker2022-09-101-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=none TEST=Built servo_v4 firmware with this change cherry-picked onto d771c18ba9989eed5eca134d27e1973a63bded74 from cros/firmware-servo-12768.B-master branch (current top-of-branch) and flashed it to a Servo v4 with Type-C CCD DUT cable. Repeated the following steps with and without a DUT charge plugged into Servo v4: 1) Power on the Servo v4 while connected to a known-good CCD capable DUT. Verify presence of CR50 CCD USB device on servo host machine. 2) Run "cc" to log its output. 3) Run "cc dtsoff" and compare the output. Only change is "dts mode: on" changing to "dts mode: off" . Verify absence of CR50 CCD USB device on servo host machine. 4) Run "cc dtson" and compare the output. Only change is going back to "dts mode: on" . Verify presence of CR50 CCD USB device on servo host machine. Change-Id: I780073165609f2278d3323f42ff8cf6a1ea71999 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3888998 Reviewed-by: Brian Nemec <bnemec@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* tree-wide: const-ify argv for console commandsCaveh Jalali2022-09-011-5/+5
| | | | | | | | | | | | | | | | | | | | | | | This updates the API for console commands from "int cmd(int argc, char **argv)" to "int cmd(int argc, const char **argv)" which is more accurate and in line with common convention. BRANCH=none BUG=b:244387210 TEST="make buildall" passes TEST="zmake build -a" passes TEST="util/compare_build.sh -b all" passes TEST="./twister -v -T zephyr/test" passes Cq-Depend: chrome-internal:4960125 Cq-Depend: chrome-internal:4959932 Change-Id: I57de9f35b85b8f3c7119df36aefb2abf25d2625f Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3863941 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* board/servo_v4/usb_pd_config.h: Format with clang-formatJack Rosenthal2022-07-071-14/+16
| | | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Tricium: disable Change-Id: Ice808816780fbf197a0ab9dcb671842e306ae373 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3749419 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/servo_v4/usb_pd_policy.c: Format with clang-formatJack Rosenthal2022-07-071-9/+10
| | | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Tricium: disable Change-Id: Ib378ce961b759abff7ce095412d9dfde99bb110f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3749420 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/servo_v4/usb_pd_pdo.c: Format with clang-formatJack Rosenthal2022-07-011-4/+4
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ic8b2cb4e147959cf8d8c273187e1b8862e5f46b9 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728921 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/servo_v4/board.c: Format with clang-formatJack Rosenthal2022-07-011-102/+79
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I5ab61115bf402abd068cca5847f0e1e316552afd Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728905 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/servo_v4/usb_pd_policy.c: Format with clang-formatJack Rosenthal2022-06-291-113/+105
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I3b34209196c024ca48faa4298bd2ba09de8ec478 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728927 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/servo_v4/usb_pd_config.h: Format with clang-formatJack Rosenthal2022-06-281-21/+30
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I297cc1bf39ed3954ee0410a84d517d917e5b87dc Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728906 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/servo_v4/board.h: Format with clang-formatJack Rosenthal2022-06-281-29/+28
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I800aef086b69f9713d2088bfe01451c63d2bf6de Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728920 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* servo_v4: Undefine CONFIG_USB_PD_TCPMV1_DEBUG to save spaceŁukasz Hajec2022-01-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | The servo_v4 is almost out of flash space in RO. Undefine CONFIG_USB_PD_TCPMV1_DEBUG to save space. It disables PD protocol state names in the TPCMv1 console and saves ~900 bytes in RO flash space. Applying to RO only since space is most limited there. This is to keep servo_v4 buildig at ToT. TCPMv1 is deprecated and probably would not be developed in future. BUG=b:212683593 BRANCH=none TEST=Built and flashed the servo v4 firmware. Started servod and verified some functions. Signed-off-by: Łukasz Hajec <lha@semihalf.com> Change-Id: I01d2926ba14f81368c61ab817ddc407e0bef9f43 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3405036 Tested-by: Łukasz Hajec <hajec@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Łukasz Hajec <hajec@google.com>
* i2c: Use declared initializers for i2c_ports: servo boardsKeith Short2021-11-301-2/+7
| | | | | | | | | | | | | | Convert all instances of i2c_ports[] to use declared initializers. This allows the fields to be reordered without breaking code. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I7eb605c0a87fad9b803955fa6ae34d39d71ad27a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300660 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* tree: Create usb_pd_pdo.cTom Hughes2021-11-054-50/+88
| | | | | | | | | | | | | | | | | | | | genvif depends on usb_pd_policy.c. However, the usb_pd_policy.c files often depend on other symbols that are not included when building genvif. genvif only needs the pd_src_pdo and pd_src_pdo_count variables (and charge_manager_get_source_pdo() in one case). Extract these variables into their own files. BRANCH=none BUG=b:172020503 TEST=CC=clang make BOARD=zinger -j TEST=make buildall TEST=compare generated *_vif.xml files before and after change: => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I765750cd86243a0a355dcc6a29b80fc23403d99f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3231026 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Disable verbose output for EC commandNehemiah Dureus2021-10-291-0/+1
| | | | | | | | | | | | | | | | | | | Compiles the less detailed but more memory efficient version of EC command `pd <port> srccaps`, to save servo_v4 memory. This is for a feature to make the EC power delivery command more verbose: c/3248345. BRANCH=None BUG=b:194402616 TEST=Built all boards (make -j buildall) Signed-off-by: Nehemiah Dureus <ndureus@google.com> Cq-Depend: chromium:3248345 Change-Id: If3ddb94513d08e829a4bdfa16f49ded40d084afe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3248341 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* tree: Files should end with single newlineTom Hughes2021-10-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Enable DEBUG_ASSERT_BRIEF for RORob Barnes2021-09-031-0/+5
| | | | | | | | | | | | | | Enable CONFIG_DEBUG_ASSERT_BRIEF for RO to reduce flash size. Only applying to RO since that is where space is most limited. BUG=None TEST=Build all BRANCH=None Change-Id: I29ba1496c75a5cd1ee2e9484f67ce3f08fbda982 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3136038 Reviewed-by: Brian J. Nemec <bnemec@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-312-4/+4
| | | | | | | | | | | | | | | 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>
* adc: Remove adc_chip.h where adc.h is usedCaveh Jalali2021-08-271-1/+0
| | | | | | | | | | | | | | This removes the use of adc_chip.h where adc.h is also used. In this case, adc_chip.h is redundant. BRANCH=none BUG=b:181271666 TEST=buildall passes Change-Id: Id7baf9aef949447a4d47934242f9bae97c971262 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120317 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Rename enum tcpm_transmit_typeAbe Levkoy2021-08-181-1/+1
| | | | | | | | | | | | | | | 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>
* system: Clean up system_get_board_version()Philip Chen2021-07-091-1/+0
| | | | | | | | | | | | | | | | | | | Refactor system_get_board_version() a bit so that we can remove CONFIG_BOARD_VERSION_CUSTOM and CONFIG_BOARD_VERSION from config.h. BRANCH=None BUG=b:186264627 TEST=make buildall -j TEST=zmake testall Cq-Depend: chromium:3015243 Change-Id: Id5ab809493c297b7d330ea13dcd6934ec00042a6 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3004112 Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* servo_v4(p1): Implement empty usb interface descriptorJan Dabros2021-04-231-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | After removal of gpio_over_usb, firmware for servo_v4 was implementing only 5 interfaces, even tough configuration descriptor claimed 6. This leads to kernel warning during enumeration and more importantly some UEFI implementations on high-end devices refused to boot. Eventually we would like to remove EMPTY identifier and re-define all consecutive interface numbers, however this bring implications to the hdctools, which are using hardcoded values during normal operation. BUG=b:183857501 BRANCH=main TEST=Connect servo_v4 & servo_v4p1 to server machines (e.g HP,DELL) in the lab and reboot the server. It should boot without issues TEST=Plug servo_v4/v4p1 into host computer and verify dmesg. No warnings should be visible in the output. For error case one may have seen: `config 1 has 5 interfaces, different from the descriptor's value: 6 config 1 has no interface number 1` Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: Ibc114aaeae7572845d3c6160cb897a9856e2f276 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2846330 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ec: Filter non-FIXED PDOs in servo_v4{p1}Jeremy Bettis2021-04-132-2/+3
| | | | | | | | | | | | | | | | | | | | | | Add a new config CONFIG_USB_PD_ONLY_FIXED_PDOS. If that config is enabled, ignore non-FIXED PDOs in both the console command `ada_srccaps` and also when selecting the preferred PDO for a voltage. Enable CONFIG_USB_PD_ONLY_FIXED_PDOS for servo_v4 and servo_v4p1, since they don't expose non-fixed PDO in their srccaps. Without this change, there is a risk that the "best" PDO for a given voltage will be non-FIXED and then that voltage just won't be supported at all. BRANCH=none BUG=b:178484932 TEST=added Change-Id: I0d1187ca372120c7fe21d627e1b82b59f6334add Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809353 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_common: support parse Augmented PDOEric Yilun Lin2021-04-081-6/+7
| | | | | | | | | | | | | | | | | | Change the function signature to void pd_extract_pdo_power(uint32_t pdo, uint32_t *ma, uint32_t *max_mv, uint32_t *min_mv); Replace the original caller with an extra unused parameter, no functional changes. BUG=none TEST=`pd 0 srccaps` prints the correct PDO info BRANCH=asurada Change-Id: I9b508e1a13737fe3ed61e6086416cff0c8ffb9a9 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2810660 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* TCPMv1: clear SourceCap in disconnected stateEric Yilun Lin2021-04-081-8/+0
| | | | | | | | | | | | | Clear the SourceCaps to prevent misleading info. BUG=none TEST=`pd 0 srccaps` no output if adapter unplugged BRANCH=asurada Change-Id: Ibfefb3cc2e91c548fdf6579603dd5be20d68c08e Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2810659 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* genvif: Use VIF overrides by defaultAbe Levkoy2021-03-301-0/+3
| | | | | | | | | | | | | | Use board-specific override files when generating VIFs for boards. BUG=b:172276715 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I197365018ceb8197c22d631cebf4cbce1c0119f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2785506 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* servo_v4,servo_v4p1: filter Augmented PDO for pass-throughEric Yilun Lin2021-03-111-0/+4
| | | | | | | | | | | | | This is currently unsupported since servo-v4 uses PD2.0 (TCPMv1) stack. BUG=b:182219864 TEST=Ensure APDOs don't show in ada_srccaps cmd BRANCH=servo Change-Id: I4d10ac6a44d649281c5ae2fff665cc1fd0c590c9 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748194 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Servo_v4/v4p1: Only read CC if a pull is appliedEric Herrmann2021-03-101-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | CC readings aren't valid if we aren't applying a pull to CC. This causes some issues on platforms which use voltage clamp Rd implementations. There is currently the intention to fake CC readings if we aren't applying a pull, but it uses the CC_DETACH flag which doesn't directly mirror the CC status, and we could be applying no CC pull even if CC_DETACH isn't set. Check more directly if we're applying CC pulls when getting the CC status. BUG=b:182173370 TEST=firmware_PDTrySrc on Voxel with servoV4 TEST=check that fakedisconnect as src and snk works on servoV4p1 BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: Ie67c5c7a05add81aca1336caa7951d31f88c35fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2745222 Reviewed-by: Nathan Kolluru <nkolluru@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Servo_V4: Remove unused commands to save flash spaceBrian J. Nemec2021-01-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Servo_V4 shares common code with the rest of the EC. Flash space slowly increases as features are enabled and added. This removes several large commands which are unused by the Servo_V4 flow to free up space. Initial Capacity: 36 bytes in flash and 1684 bytes in RAM still available on servo_v4 RO 4520 bytes in flash and 1684 bytes in RAM still available on servo_v4 RW Changes: * Removed chgsup: 128 byte removed from RO * Removed usart_info: 192 byte removed from RO * Removed flashwp: 320 byte removed from RO * Added new guard CONFIG_CMD_FLASH_WP which is enabled by default and disabled on Servo_v4 Due to reorganization that occurs, the total improvement is not equal to the sum of the changes, the RO region which increased by 576 bytes and RW increased by 592 bytes. Final Capacity: 612 bytes in flash and 1684 bytes in RAM still available on servo_v4 RO 5112 bytes in flash and 1684 bytes in RAM still available on servo_v4 RW BUG=b:178186394 TEST=Searched autotest, hdctool, and ec/util directories for references to the above commands. Validated cases have no usages or in the case of the flashwp command is used only by the EC rather than the Servo. TEST=Validated commands are not used in update process. Updates to and from these images are successful. TEST=Validated basic servo functionality is working BRANCH=Servo Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: Ib9c4e92c723e9eea3d0f403e1eb46556e3984074 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654610 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* tcpm: Move tcpm.h into an include directorySimon Glass2020-12-221-1/+1
| | | | | | | | | | | | | | | | | | This header file is used from quite a few files, relying on the EC build system to find includes in the driver/tcpm directory. For Zephyr we don't want to add that as an include. It makes more sense for header files to be in an include directory, so move it and fix up the users. BUG=b:175434113 BRANCH=none TEST=build Zephyr and ECOS on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5851914b1a7d3fdc1ba911c0fbe9046afbaf6f5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597985 Reviewed-by: Keith Short <keithshort@chromium.org>
* servo_v4/usb_pd_policy: Disable VBUS instead of power supply resetPatryk Duda2020-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When running 'fakedisconnect' command on ServoV4, CC_DETACH bit is going to be set. Detach is done by calling pd_power_supply_reset() which disables VBUS (set DUT_CHG_EN to 0) and requests 5 volts from charger. Next step is disable PD communication by calling pd_comm_enable() and set RP to RP_RESERVED value (pd_set_rp_rd() function). Setting RP to RP_RESERVED (just disconnect all resistors on CC1 and CC2) actually is a trick to make PD_C1 task think that DUT is disconnected. TCPM stack checks voltage on CC lines and when voltage on active CC line indicates that we are open it changes state to SRC_DISCONNECTED. Changing state to SRC_DISCONNECTED triggers pd_power_supply_reset() which was already run in do_cc() function as a result of 'fakedisconnect' command. Calling this once again causes weird behaviour - communication issues and finally Hard Reset, eg: > fakedisconnect 100 1000 Fake disconnect for 1000 ms starting in 100 ms. C0 Req [1] 5000mV 3000mA [210.470350 CL: p0 s0 i500 v15000] [210.472703 PD TMOUT RX 1/1] RXERR1 Preamble C1 srcCAP>-1 C1 srcCAP>-1 C1 st14 SRC_DISCONNECTED [210.473835 PD TMOUT RX 467/1] RXERR0 Preamble C0 REQ>1 C0 st6 SNK_REQUESTED C0 st34 HARD_RESET_SEND C0 st35 HARD_RESET_EXECUTE C0 HARD RST TX Hard Reset in PD_C0 task can cause additional delay when C1 gets connected and DUT requests higher voltage. As a result DUT sends Hard Reset due to timeout. Hard Reset on port 1 causes PDTrySrc to fail because of timeout waiting for 'fakedisconnect' command. This was fixed by removing one voltage change request. In other words in do_cc() function we are not calling pd_power_supply_reset(), but disabling VBUS only. Eventually pd_power_supply_reset() will be called during transition to SRC_DISCONNECT state. BUG=b:162254118 BRANCH=none TEST=Run FAFT_PD test suite. All tests should pass except PDVbusRequest (depends on charger connected to ServoV4). TEST=Call 'fakedisconnect' command on ServoV4 console and check if there is no Hard Reset on port 0. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I657dd1ce2dc3a2f4914e975387eeebb037e1ada5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2569652 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* servo_v4/usb_pd_policy: Reject SNK->SRC power swap if CC_ALLOW_SRC not setPatryk Duda2020-12-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ServoV4 acts as sink ('cc snk' issued), and we issue 'cc pdsnk' there are following state transitions (starting from C1 SNK_READY): C1 st8 SNK_READY <--- From this point DUT acts as source DUT's PE is in PE_SRC_Ready state C1 RECV 196f/1 [0]ff008001 C1 RECV 0b67/0 <--- DUT asks for source capabilities C1 srcCAP>1 <--- ServoV4 sends its capabilities C1 RECV 0d6a/0 <--- DUT requests power swap C1 CTRL[3]>1 <--- ServoV4 accepts C1 st10 SNK_SWAP_SNK_DISABLE C1 st11 SNK_SWAP_SRC_DISABLE C1 RECV 0e66/0 <--- DUT sends PS_RDY to inform that it disabled power C1 st12 SNK_SWAP_STANDBY <--- ServoV4 enables power supply and waits PD_POWER_SUPPLY_TURN_ON_DELAY to ensure that it is turned on, before switching to SNK_SWAP_COMPLETE C1 st13 SNK_SWAP_COMPLETE <--- Power swap completed successfully C1 CTRL[6]>1 <--- ServoV4 sends PS_RDY to inform that power was enabled. C1 st18 SRC_DISCOVERY C1 srcCAP>1 <--- ServoV4 sends its capabilities C1 st19 SRC_NEGOCIATE C1 RECV 1062/1 [0]4304b12c Requested 15000 mV 3000 mA (for 3000/3000 mA) C1 CTRL[3]>1 <--- ServoV4 accepts C1 st20 SRC_ACCEPTED C1 st21 SRC_POWERED <--- Switching to requested voltage. This calls pd_transition_voltage() from servo_v4/usb_pd_policy which requests charger to change its voltage. [570.815776 Waiting for CHG port transition] <--- Here we are changing active task to PD_C0. This task changes dual role for C1 (DUT port), because CC_ALLOW_SRC is not set. Appropriate event is set too C0 Req [4] 15000mV 3000mA C0 REQ>1 C0 st6 SNK_REQUESTED [570.822679 CL: p0 s0 i500 v5000] C0 RECV 0763/0 C0 st7 SNK_TRANSITION C0 RECV 0966/0 C0 st8 SNK_READY <--- Charger voltage changed successfully [570.991969 CL: p0 s0 i3000 v15000] <--- Context switch to PD_C1 task [571.001981 CHG transitioned] <--- Check event and call update_dual_role_config() which changes state to SNK_DISCONNECTED C1 st2 SNK_DISCONNECTED Port 1 switches to SNK_DISCONNECTED state because PD_C0 task calls pd_send_request_msg() (reaction for voltage change request), which limits maximum current by calling charge_manager_force_ceil(). Charge manager calls board_set_charge_limit() to limit current, which calls update_ports() which calls board_manage_dut_port() unconditionally. This function checks if charge through is allowed. It turns out that it is not allowed, because CC_ALLOW_SRC bit is not set in cc_config (see is_charge_through_allowed()), then board_manage_dut_port() changes dual role of port 1 to force sink. Fix for this issue is simple. Function is_charge_through_allowed() actually tells us that we are not able to source power when 'cc snk' or 'cc pdsnk' was issued. So fix is just to reject power swap when our power role is sink, and CC_ALLOW_SRC is not set. BUG=b:162254118 BRANCH=none TEST=Issue 'cc snk' from ServoV4 console and wait until state gets stable. Issue 'cc pdsnk' from ServoV4 console and check if port 1 reaches SNK_READY state. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Idf89c0f79a60275345d23aca4705811b1acba98a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2563682 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* COIL: Rename CONFIG_I2C_CONTROLLERDiana Z2020-11-051-1/+1
| | | | | | | | | | | | | Rename CONFIG_I2C_CONTROLLER and related comments. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ied6a1829bf54a5c9a32e6772982a4b8aa31aaf23 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* servo_v4,servo_v4p1: control acceptance of power and data swapEric Yilun Lin2020-10-141-3/+28
| | | | | | | | | | | | | | enable this command for more FAFT test coverage BUG=b:139065787 TEST=on servo_v4, test that usbc_action prswap|drswap works as expected BRANCH=servo Change-Id: I1b88d5c0ed00997e78d129633faf435e3cee61ac Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2467599 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Revert "ServoV4/V4p1: Change CCD detection flow"Brian Nemec2020-09-281-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1a09ade7b846cc048fb2f177adcacd5f836b8887. Reason for revert: b:167734179 CCD detection is failing on many devices. Tests on reverted devices show this is primary cause. Original change's description: > ServoV4/V4p1: Change CCD detection flow > > Currently, servoV4 and servoV4p1 don't apply terminations to SBU when > searching for a DUT. This means SBU can float which can break the SBU > voltage detection. Technically, the DUT should only need to pull up D+ > and can float D- since it is a FS USB2 device when in CCD mode. > > Change the detection to connect SBU to the USB2 hub on servoV4/4p1. The > USB2 hub will apply 15k pulldowns to the USB lines, which will pull SBU > down and fix detection in the case where the DUT floats SBU. > > BUG=b:161762948, b:150886157, b:151487379 > TEST=make BOARD=servo_v4; make BOARD=servo_v4p1 > TEST=check that CCD works on DUT without pulldown resistors on SBU > BRANCH=none > > Change-Id: I9b6f620617fb0e270e35804704111afd3c606a3b > Signed-off-by: Eric Herrmann <eherrmann@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2352439 > Reviewed-by: Wai-Hong Tam <waihong@google.com> BUG=b:167734179, b:168546666, b:168548776 TEST=Measured SBU voltages with the prior CL included, observed low voltages and no-voltage on some platforms including variations of dedede under the flipped orientation. TEST=Reverted the CL and CCD detection worked reliably, devices with CCD not driving SBU rails started working, and labstation release was more reliable on prior versions. Change-Id: Iaecd7371164804ce09a7fd19ac8fd1f44d93aef2 Signed-off-by: Brian Nemec <bnemec@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2429496 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Eric Herrmann <eherrmann@chromium.org>
* ServoV4/V4p1: Change CCD detection flowEric Herrmann2020-08-261-25/+25
| | | | | | | | | | | | | | | | | | | | | Currently, servoV4 and servoV4p1 don't apply terminations to SBU when searching for a DUT. This means SBU can float which can break the SBU voltage detection. Technically, the DUT should only need to pull up D+ and can float D- since it is a FS USB2 device when in CCD mode. Change the detection to connect SBU to the USB2 hub on servoV4/4p1. The USB2 hub will apply 15k pulldowns to the USB lines, which will pull SBU down and fix detection in the case where the DUT floats SBU. BUG=b:161762948, b:150886157, b:151487379 TEST=make BOARD=servo_v4; make BOARD=servo_v4p1 TEST=check that CCD works on DUT without pulldown resistors on SBU BRANCH=none Change-Id: I9b6f620617fb0e270e35804704111afd3c606a3b Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2352439 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* servo_v4: optimize USB PD TX switchingVincent Palatin2020-08-111-55/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimize the duration when switching the USB PD path to TX, in order to meet the PD spec tStartDive timing between when we start driving the line and the start of the preamble waveform. Try to decrease the number of operations on the GPIO registers which might be clocked slowly in order to achieve this, this includes abandoning the high level GPIO functions and writing directly the useful GPIO registers and knowing in advance between which modes we are switching. A few constant values in the GPIO registers for the TX path are now written in the pd_tx_init function. The current version uses the regular GPIO functions *but* it will glitch these GPIOs, we might want to switch to a lower level implementation and avoid the glitch. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=b:155202697 BRANCH=none TEST=make BOARD=servo_v4p1 TEST=probe TX_DATA on the scope and measure the duration before the preamble Change-Id: I84c8321ed9be045087e228a74f6e0ddb3f677d76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2346804 Reviewed-by: Nitin Kolluru <nkolluru@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Nitin Kolluru <nkolluru@google.com>
* servo: Increased stack sizes for servo_v4Brian J. Nemec2020-07-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Increased the stack sizes in servo_V4's console and power delivery tasks. The report from stack analysis: make BOARD=servo_v4 SECTION=RW analyzestack Task: HOOKS, Max size: 336 (112 + 224), Allocated size: 768 Task: CONSOLE, Max size: 664 (440 + 224), Allocated size: 768 Task: PD_C0, Max size: 1136 (912 + 224), Allocated size: 1184 Task: PD_C1, Max size: 1136 (912 + 224), Allocated size: 1184 BUG=b:156476618 BRANCH=servo TEST=make -j BOARD=servo_v4 TESt=make BOARD=servo_v4 SECTION=RW analyzestack Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: Id313b02616441e4cc438e76ec01bf84c598bd4e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2271011 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* TCPMv2: Support mode entry for SOP' and SOP''Abe Levkoy2020-06-112-4/+4
| | | | | | | | | | | | | | | | | | | | | | 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>
* servo_v4: clear SrcCap on CHG port disconnectedEric Yilun Lin2020-05-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Currently, when CHG port's PD disconnected from the servo-v4, it still holds the SourceCap information. This CL clears the SourceCap when the PD disconnection event is found. BUG=b:157261654 TEST=plug charger: > ada_srccaps 0: 5000mV/3000mA 1: 9000mV/3000mA 2: 15000mV/3000mA 3: 20000mV/2250mA unplug charger: > ada_srccaps # print nothing. BRANCH=servo_v4 Change-Id: Ia91c97d6baa5e796c909893dac9abe0e6bc7ebad Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215393 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* servo_v4: use PD_PREFER_HIGH_VOLTAGE for PDO selection logicEric Yilun Lin2020-05-271-0/+9
| | | | | | | | | | | | | | | | | | | | Define PDO selection logic for SourceCap PDO collection. On a 45W PD charger, it might provide PDOs with 15V/3A and 20V/2.25A. In this case, pd_find_pdo_index() would always prefer 15V/3A rather than 20V/2.25A and such that the 20V PDO will be disappeared when servo-v4 advertise the SrcCap. We define PD_PREFER_HIGH_VOLTAGE so that all the PDOs could be advertised by servo-v4. BUG=b:147021699 TEST=plug treeya 45W charger, and see servo-v4 advertise 20V/2.25A PDO BRANCH=servo-v4 Change-Id: I3bd071161679bae98be17fd6b53a24e258d9c15c Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215391 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* Rename CONFIG_ macros to CONF_*Daisuke Nojiri2020-05-081-22/+22
| | | | | | | | | | | | | | | | | CONFIG_ name space is reserved for configuration macros, which all live in config.h. This patch renames the regular macros, which happened to be prefixed with CONFIG_, to avoid the presubmit errors. BUG=b/155996358 BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ic87a23a34c7d36d65f210dd51fed109443ef71ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2189174 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Add console commands to override the HPD pass-throughWai-Hong Tam2020-05-084-13/+68
| | | | | | | | | | | | | | | | | New console commands, like: > usbc_action dp hpd ext # use the external HPD, no overridden > usbc_action dp hpd h # override HPD to high, IRQ pass-through > usbc_action dp hpd l # override HPD to low, no IRQ pass-through > usbc_action dp hpd irq # send HPD IRQ BRANCH=servo BUG=b:153647984 TEST=Tried the new console commands. Change-Id: I197efd1d03d906b99d7b82ad151865da44e321ea Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2143937 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* servo_v4: Introduce console commands to config DP alt-modeWai-Hong Tam2020-05-082-40/+144
| | | | | | | | | | | | | | | | | | | | | New console commands, like: > usbc_action dp disable # disable DP alt-mode > usbc_action dp enable # enable DP alt-mode > usbc_action dp pins cde # support pin assignments C, D, and E > usbc_action dp pins cd # support pin assignments C and D > usbc_action dp pins d # support pin assignment D > usbc_action dp mf 1 # enable multi-function preference > usbc_action dp plug 1 # it is a plug > usbc_action dp plug 0 # it is a receptacle BRANCH=servo BUG=b:153647984 TEST=Tried the new console commands. Change-Id: I36744e772999f67f10189bc80dcec9f2b37123c2 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2143936 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>