summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* zephyr/console: Add console buffer logging backendstabilize-15120.B-mainRob Barnes2022-09-153-0/+80
| | | | | | | | | | | | | | | | | | Add a zephyr logging backend for the console buffer. This allows the AP to access the logs sent to the zephyr logging subsystem. This backend will not run in LOG_MODE_MINIMAL, so it may not be usable for some EC OS projects. BUG=b:243709788 BRANCH=None TEST='ectool console' on Skyrim in immediate and deferred logging mode. Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I24d9ffeb5c90c99982c70ac2bcbdc0f814b45b01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3853303 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* volteer: Set PD debug level to 0 to save spaceKeith Short2022-09-151-1/+1
| | | | | | | | | | | | | | | Volteer is critically low on flash space (~32 bytes). Set the PD debug level to 0. Free RO flash space is now 2016 bytes. BUG=none BRANCH=none TEST=make BOARD=volteer Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I6844d615ee6893c1b6917907423f9be63041cb34 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3900052 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Delbin-G: Correct the keyboard matrix value for KP_ENTERJacky_Wang2022-09-151-1/+1
| | | | | | | | | | | | | | | Correct the keyboard matrix value for enter key(keypad). BUG=b:232737379 BRANCH=firmware-volteer-13672.B TEST=make BOARD=delbin Check press KP_ENTER key will show KEY_KPENTER on evtest. Signed-off-by: Jacky_Wang <jacky5_wang@pegatron.corp-partner.google.com> Change-Id: Iadbd44c848316ce5d1a856a709d214ae7d9b3625 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893307 Reviewed-by: Kenny Pan <kennypan@google.com> Commit-Queue: Kenny Pan <kennypan@google.com>
* zephyr: enable the chargen console command by defaultPeter Marheine2022-09-151-0/+1
| | | | | | | | | | | | | | | | This command is used by some firmware tests, and it should have a very small effect on overall EC image size (but boards can still disable it if needed). BUG=b:246007302 TEST=zmake build --all BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: Id15fcd3afe7801fe279ae237e1d238bf22581910 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3897910 Commit-Queue: Al Semjonovs <asemjonovs@google.com> Reviewed-by: Al Semjonovs <asemjonovs@google.com>
* test: Verify discovery via PD info host commandsAaron Massey2022-09-151-1/+22
| | | | | | | | | | | | | | | Test that after discovery, the PD info request EC_CMD_PD_DISCOVERY command fetches appropriate values. BRANCH=none BUG=b:236075275 TEST=twister --clobber -i -s zephyr/test/drivers/drivers.usbc_alt_mode Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I90c832e34d38102df1ebe4968a6dd663858a42fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3895513 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* evoker: Add battery PC-VP-BP153Yu-An Chen2022-09-153-1/+59
| | | | | | | | | | | | | | Support new battery PC-VP-BP153 BUG=b:246879091 BRANCH=none TEST=zmake build evoker Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Change-Id: Ib4bfd9826c75877ec9dca15ed8f963f53c74bba8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3897916 Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Sam Hurst <shurst@google.com>
* Zephyr: Clarify keyboard powerbutton assert optionsDiana Z2022-09-151-4/+4
| | | | | | | | | | | | | | Clarify the causality in the powerbutton assert options, and also clarify why one might select either option. BRANCH=None BUG=b:245626014 TEST=zmake build skyrim Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id388200403976dc3914eae32b8ffe258d34e2521 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3896633 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr/console: Return number of bytes consumed by console bufferRob Barnes2022-09-153-5/+12
| | | | | | | | | | | | | | | | | | | | Return the number of bytes consumed by the console buffer. This is not the same as the number of bytes written since null bytes are not written. For now this will always be 0 or len. This change will allow callers to perform an action when the request fails, such as printing a warning or retrying. BUG=b:243709788 BRANCH=None TEST=Boot skyrim, observe buffered console, pass default.console test. Change-Id: I97bf5a0776c123abbaed84b5ca7e58e903c0f20d Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3892209 Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/panic: Capture extra cortex-m registersRob Barnes2022-09-152-9/+34
| | | | | | | | | | | | | | | | | | Copy callee saved registers to panic data structure. Enable extra exception info by default. Clang format affected lines. BUG=b:245591465 BRANCH=none TEST=Dump panic info on skyrim, observe extra registers Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I848d7e6bc35bf2b62b76182dd9d3fa87877a41fc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3880830 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* magikarp: add led behaviorelmo_lan2022-09-151-1/+19
| | | | | | | | | | | | | | add led behavior for S0 and low battery BUG=b:244373502 BRANCH=none TEST=zmake build magikarp --clobber Signed-off-by: elmo_lan <elmo_lan@compal.corp-partner.google.com> Change-Id: I953d20335d452c8a7fa266d4a2a9721e37331228 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891427 Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: SamSP Liu <samsp_liu2@compal.corp-partner.google.com>
* steelix: disable BRINGUPmike2022-09-151-3/+1
| | | | | | | | | | | | | | | | Remove bringup config, the bringup state is completed, and this config caused a power sequence exception. BUG=b:241540339 BRANCH=none TEST=close lid, the dut can enter suspend state; open lid, the dut can wakeup normally. Signed-off-by: mike <mike5@huaqin.corp-partner.google.com> Change-Id: Idbe7dd6eb63c8e489b64f22180ac47a452564378 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3897919 Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
* zephyr: upload test results for local runsAl Semjonovs2022-09-152-0/+54
| | | | | | | | | | | | | | | Upload test results for local twister runs BUG=None BRANCH=NONE TEST=./twister -T zephyr/test --no-upload-cros-rdb; ./twister -T zephyr/test Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: I1ce87ab44fcfcf5ad96f3eb7c6f097bc36643985 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891682 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* kuldax: add BJ power 65w/150w based on fw configben chen2022-09-152-4/+12
| | | | | | | | | | | | | | | | | | bj_power setting of fw_cofig BIT3-4: 150W = 0, (default) 230W = 1, 65W = 2, 135W = 3 BUG=b:229035883 BRANCH=cros/main TEST=chgsup reports voltage/current according to fw config Change-Id: Iff7f5879fc31a93f7600442582c5785c706ddc7d Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3865420 Reviewed-by: David Wu <david_wu@quanta.corp-partner.google.com> Reviewed-by: caveh jalali <caveh@chromium.org>
* Skyrim: Set refresh key CONFIGsDiana Z2022-09-141-0/+2
| | | | | | | | | | | | | | | | The refresh key will be on KSI3, and we may also see this signal asserted on all columns during a recovery boot so it needs to be filtered accordingly. BRANCH=None BUG=b:245626014 TEST=on skyrim, consistently boot to recovery mode Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I9080208356f42d4d7b4a7763b1957da7daecfb8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3896632 Commit-Queue: Robert Zieba <robertzieba@google.com> Reviewed-by: Robert Zieba <robertzieba@google.com>
* gitlab: Remove cache and checkout bydateJeremy Bettis2022-09-141-54/+40
| | | | | | | | | | | | | | | | | | | | | | | Remove the cache, since it only works with shared runners, but keep the needs tags or else Gitlab will run all the build stage jobs before starting any of the test stage jobs, and that is slower. Get the timestamp of the latest commit, and use that timestamp to checkout the corresponding cls in the zephyr and ancillary repos. Retry git clone calls because they actually fail pretty often. BRANCH=None BUG=b:244590155 TEST=Pushed to gitlab coverage branch https://gitlab.com/zephyr-ec/ec/-/pipelines/640483665 Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ie66d5c97349ef17eba302387c3cd525dfbaa82ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3894402 Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* Move Brya PPCs into the devicetreeMiguel Delatorre2022-09-144-3/+26
| | | | | | | | | | | | | | BUG=b:236131108 TEST=zmake testall; zephyr/zmake/run_tests.sh; BRANCH=main Change-Id: Ic1b403ddacacd6f3dabb5f83141d70c2416f7e92 Signed-off-by: Miguel Delatorre <delatmiguel@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3829953 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Adam Mills <adamjmills@google.com>
* Makefile.toolchain: Pass sysroot flag for host buildsTom Hughes2022-09-141-0/+3
| | | | | | | | | | | | | | When compiling with clang, the host build fails to find dependencies when linking (libftdi/libusb) unless sysroot is specified. BRANCH=none BUG=b:246424843 TEST=emerge-hatch chromeos-ec Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I0407853a1dee55666f2c1768d6a981101feba691 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3894405 Reviewed-by: Edward Hill <ecgh@chromium.org>
* util/getversion.sh: Fix version when not in a git repoTom Hughes2022-09-141-1/+1
| | | | | | | | | | | | | | | | | | | When building with "FEATURES="test" emerge-hatch chromeos-ec" after using "cros-workon-hatch chromeos", the working directory is not a git repository (the files are just copied), so "git describe" in getversion.sh fails and the logic falls back to creating its own version number. The test in test/version.c explicitly checks for a version that begins with "v2" and has a hash length of at least 8, so update the version string from this case to match. BRANCH=none BUG=b:246424843 TEST=FEATURES="test" emerge-hatch chromeos-ec Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ie06f9edc2a228eef0162be10e1b1abe123ce6bc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3894408 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* test: EC thinks AP can boot on low battery capstabilize-15117.86.B-mainstabilize-15117.48.B-mainstabilize-15117.111.B-mainrelease-R107-15117.B-mainAaron Massey2022-09-141-0/+41
| | | | | | | | | | | | | | | | | Verify that the EC can still determine if the AP is bootable on a low battery capacity while there is a charger connected. Also verify that the EC thinks it can't boot when it's on low battery without a charger connected. BRANCH=none BUG=b:246335162 TEST=twister --coverage --clobber -i -s zephyr/test/drivers/drivers.default Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I02be9616fe3bee9fedd716f46ccb862b2f1ef0e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3892500 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* ps8xxx: Cache get_chip_info for all portsSam Hurst2022-09-141-24/+24
| | | | | | | | | | | | | | | | | | | | | Cache get_chip_info for all ports instead of just the first port. BUG=b:245748784 TEST=Herobrine does not boot loop on updating the TCPC ps8805.0: vendor 0x1da0 product 0x8805 device 0x0002 fw_rev 0x16 ps8805.1: vendor 0x1da0 product 0x8805 device 0x0001 fw_rev 0x15 BRANCH=main LOW_COVERAGE_REASON=This is a time sensitive change and code coverage will be increased in a separate CL and is tracked by BUG=b:246762616 Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I05647a2d118dce5204f710605afab83a42652ba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3888227 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* mock: Fix format for 2-dimensional arraysFiras Sammoura2022-09-142-21/+34
| | | | | | | | | | | | | | | | | Define default_fake_fp_positive_match_salt and trivial_fp_positive_match_salt explicitly as 2-dimensional arrays with dimensions FP_MAX_FINGER_COUNT and FP_POSITIVE_MATCH_SALT_BYTES. Include driver/fingerprint/fpsensor.h to define FP_MAX_FINGER_COUNT. BRANCH=None BUG=b:242720387 TEST=make run-fpsensor_state TEST=make runhosttests Signed-off-by: Firas Sammoura <fsammoura@google.com> Change-Id: Iaae2280179e99bd5098928976727aa9b3cca9954 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893046 Reviewed-by: Craig Hesling <hesling@chromium.org>
* twister: Update checking if in chrootYuval Peress2022-09-141-1/+1
| | | | | | | | | | | | | | | Check the cros_chroot_version file instead of the environment variable as directed in chat. BRANCH=none BUG=b:246461298 TEST=twister -c -v Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I6b83c403e0ed3eea8c7ffb8e201c64bf1390d7ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893083 Reviewed-by: Tristan Honscheid <honscheid@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* board: change Google USB vendor infoMike Frysinger2022-09-1422-22/+22
| | | | | | | | | | | | | | 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>
* board/hyperdebug: Update pin assignmentJes B. Klinke2022-09-143-209/+204
| | | | | | | | | | | | | | | The OpenTitan project has decided to use the four Nucleo connectors CN7-10 instead of the larger ones CN11-12, which are unpopulated from the factory. This required a reassignment of all the IO signals. BUG=b:192262089 TEST=Manually apply voltage to each physical pin in turn, observing gpioget. Change-Id: I2aaba0298d84370d0cdf5d5f3d19bee77c3c9b5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3892574 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Jes Klinke <jbk@chromium.org> Tested-by: Jes Klinke <jbk@chromium.org>
* Craask: Fix lid rotation parameters for CraaskbowlSue Chen2022-09-142-0/+48
| | | | | | | | | | | | | | | | | The placement of the LID sensor is spin 180' on xy plane for Craaskbowl. Use fw_config bit8 to describe Lid sensor orientation: 0: original placement 1: rotate 180' on xy plane BUG=none BRANCH=none TEST=table mode and rotation work fine on Craaskbowl Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: Ifa3d22ca2e1c90dfebb8ad8a7eca676b84c07191 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891565 Code-Coverage: Andrew McRae <amcrae@google.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* magikarp: initial gpioelmo_lan2022-09-141-3/+7
| | | | | | | | | | | | | | initial board specific gpio.. BUG=b:243631595 BRANCH=none TEST=zmake build magikarp --clobber Signed-off-by: elmo_lan <elmo_lan@compal.corp-partner.google.com> Change-Id: I3176ec0858cc983b45cfafd26b37f5a4b3c8012c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3892080 Reviewed-by: SamSP Liu <samsp_liu2@compal.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* magikarp: initial g-sensorelmo_lan2022-09-142-2/+2
| | | | | | | | | | | | | | initial g-sensor direction and cbi mapping. BUG=b:242929666 BRANCH=none TEST=zmake build magikarp --clobber Signed-off-by: elmo_lan <elmo_lan@compal.corp-partner.google.com> Change-Id: Ie5ba0735de781af7926b7be7abfeea2f7f5e783a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3892079 Reviewed-by: SamSP Liu <samsp_liu2@compal.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* magikarp: add supported batteryelmo_lan2022-09-143-2/+50
| | | | | | | | | | | | | | Setup battery for magikarp. BUG=b:242937675 BRANCH=none TEST=zmake build magikarp --clobber Signed-off-by: elmo_lan <elmo_lan@compal.corp-partner.google.com> Change-Id: I63f4193d3df7b5c9f402e72c42fcfc0c9c4ceb40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891553 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: SamSP Liu <samsp_liu2@compal.corp-partner.google.com>
* krabby: dts: move rt9490 bc12 node to i2c0Ting Shen2022-09-141-7/+7
| | | | | | | | | | | | | | | | | | It's not under i2c4. (Actually this is a no-op change because rt9490 driver only requires that the i2c config in charger node is correct) BUG=none TEST=bc12 detection on c1 port still works BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Id905cbf1a45fe3be0232f42a9c964930fd689467 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893811 Reviewed-by: Eric Yilun Lin <yllin@google.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* nivviks: Add keyboard config for recovery modeAndrew McRae2022-09-141-0/+3
| | | | | | | | | | | | | | Add keyboard configs to enable entering recovery mode via 'Esc'/'Refresh'/power-btn. BUG=b:246657903 TEST=zmake build nivviks; flash & run BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I79a6589ed693deedcf88841051c44e495d70196b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893304 Reviewed-by: Reka Norman <rekanorman@chromium.org>
* yaviks: update thermistor namingZick Wei2022-09-141-6/+6
| | | | | | | | | | | | | BUG=b:241964549 BRANCH=none TEST="ectool temps all" thermistor name is intended. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I97206424eb6ed9db913d4e78a1f91e01e4994242 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893689 Reviewed-by: Andrew McRae <amcrae@google.com> Commit-Queue: Andrew McRae <amcrae@google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: add temperature sensor nameZick Wei2022-09-141-0/+1
| | | | | | | | | | | | | | | Add TEMP_SENSOR_5V_REGULATOR to enum names. BUG=none BRANCH=none TEST=none Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I196d10cc6108824297401f2145a88bf1f070e9de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891563 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@google.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* TCPM: Remove unused VPD functionsAbe Levkoy2022-09-142-125/+0
| | | | | | | | | | | | | | | Remove VPD support functions that are not used anywhere. Reduce coverable lines of code. BUG=b:246363751 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Idf51827ff3b0abdc2b202c5eaae02ead23df6656 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891684 Reviewed-by: Diana Z <dzigterman@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* TCPMv2: Move TBT and USB4 code to modulesAbe Levkoy2022-09-146-303/+295
| | | | | | | | | | | | | | | | | | | | | | | No-op refactor: Move code implementing Thunderbolt alt mode and USB4 mode from usb_pd_alt_mode_dfp.c to tbt_alt_mode.c and usb_mode.c. Guard usages of this code so that only boards with Thunderbolt or USB4 enabled call it. Somewhat reduce code size and coverable lines for non-Thunderbolt, not-USB4 boards. LOW_COVERAGE_REASON=This commit only moves existing code. The bulk of the uncovered delta supports USB4 entry. b:236868055 blocks coverage of this code. BUG=b:244467636 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I5aaa60d276c7b44305a238bbfba30cf092063564 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887967 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* brask: 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: Ia6bf6785cc2def57cbcd65eeb25565a15a5c1484 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887966 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
* brya: 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: I9d78c527ee35501add7d0e8ab3974647f1e4d9a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887965 Reviewed-by: Boris Mittelberg <bmbm@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* 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>
* mithrax: Remove Burnside Bridge configAbe Levkoy2022-09-141-1/+0
| | | | | | | | | | | | | | | | mithrax does not use Burnside Bridge. Reduce image size and avoid linker errors when building without TBT and USB4 functions, which mithrax also does not use. BUG=b:244467636 TEST=make BOARD=mithrax BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I6945656f8a63412420d729f08ecace66fec2be18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887963 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: caveh jalali <caveh@chromium.org>
* TCPMv1: Remove cable discovery supportAbe Levkoy2022-09-142-153/+10
| | | | | | | | | | | | | | | | | TCPMv1 cable discovery support has not been used for some time. Remove it to facilitate refactoring TBT and USB4 code. LOW_COVERAGE_REASON=TCPMv1 is known to be buggy but is deprecated; its behavior is hard to describe but should not be changed. BUG=b:244218024 TEST=make BOARD=careena; DP monitor behavior same as ToT BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I6500f56418a860c343e8159f33151e765512067c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887962 Reviewed-by: Diana Z <dzigterman@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* TCPMv1: Remove TBT and USB4 supportAbe Levkoy2022-09-143-553/+5
| | | | | | | | | | | | | | | | | TCPMv1 has not been used for TBT or USB4 for some time. Remove this support to make it easier to refactor TBT and USB4 code. LOW_COVERAGE_REASON=TCPMv1 is known to be buggy but is deprecated; its behavior is hard to describe but should not be changed. BUG=b:244218024 TEST=make BOARD=careena; DP monitor behavior same as ToT BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ia02ce7a2500b83e3147ec5737134a009a59ea288 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3887961 Reviewed-by: Diana Z <dzigterman@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* Update license boilerplate text in source code filesMike Frysinger2022-09-133-3/+3
| | | | | | | | | | | | | | | | 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: I1cf3efcd52510ddf4cc2b8fe43a0abd2b6a71c77 Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893390 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* rex: Add support for C0 FRS_EN to the PPCScott Collyer2022-09-132-0/+6
| | | | | | | | | | | | | | | | | This CL adds the config option to indicate that FRS swap detection will be done by the PPC. FRS_EN is controlled by the TCPC ioexpander and this signal was not being configured. BRANCH=none BUG=b:244874682 TEST=zmake build rex Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I21b2495cf398d503111654d24043edf05bd7d49e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3873653 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* rex: Remove USB_PD_DISCHARGE_TCPC configScott Collyer2022-09-131-1/+1
| | | | | | | | | | | | | | | | | Both USB_PD_DISCHARGE_PPC and USB_PD_DISCHARGE_TCPC configs were being selected. This causes the PPC to leave force discharge enabled and keeps VBUS low. BRANCH=none BUG=b:244874682 TEST=Verifed that VBUS is supplied when the PPC source path is enabled. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I35ae2c5d4360a89a1d3242906820feabd79936e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3877664 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* ec_commands: Add flexible array member support for C and C++Tom Hughes2022-09-131-13/+21
| | | | | | | | | | | | | | This change allows us to use flexible array members in both C and C++. BRANCH=none BUG=b:234181908 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia62b27507cebbe14c9f5f618a6cf1133859cbe92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3893044 Reviewed-by: Yuval Peress <peress@google.com>
* comm-usb: Make ec_command_usb return response data sizeDaisuke Nojiri2022-09-131-9/+18
| | | | | | | | | | | | | | | | | | | | | | | ec_command_usb currently returns the out data size (i.e. request packet size) but ec_command_proto is supposed to return a response data size (excluding the response header size). This is causing comm_init_buffer always fail to set ec_max_insize to the value expected by the EC. This patch fixes ec_command_usb to fix the issue. This patch also fixes the followings: * Check libusb_bulk_transfer's return value strictly (0 for success). * Make debug() write to stderr. BUG=b:233404167 BRANCH=None TEST=Vell. Run ectool --device 18d1:5022 console. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ifb33c76d65f033a3f68018fb77f492b65493e155 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891677 Commit-Queue: Parth Malkan <parthmalkan@google.com> Reviewed-by: Parth Malkan <parthmalkan@google.com>
* charger: fix up the charge_get_percent default return valueZhuohao Lee2022-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | The charge_get_percent should return zero when the HW design doesn't include a battery(ie. no CONFIG_BATTERY). The reason is that the function handle_new_power_state in usb_tc_drp_acc_trysrc_sm.c will check the battery status (via pd_is_battery_capable) to determine whether the device needs to issue DPM_REQUEST_HARD_RESET_SEND or not. If we return 100, the pd_is_battery_capable() will return true and that makes the PD do the HARD_RESET and cause the device to reboot endlessly. BUG=b:242949656 BRANCH=None TEST=make buildall flash the ec.bin to the device and check the typec pd is working Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Change-Id: I59d24c4f58bed3538b70eeba5eff11566bd5f455 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891810 Reviewed-by: Diana Z <dzigterman@chromium.org>
* yaviks: update led behaviorZick Wei2022-09-137-67/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | yaviks has charge leds on left side and right side, each side have two colors: amber and white. The led behavior define as following: Charging led: led on with charging port active, other port is off. Charging: Amber. Discharging: Off. Battery Error: Blinking amber on both side (0.5 sec on, 0.5 sec off) Fuel < 10%: Blinking amber on both side (1 sec on, 1 sec off) Force idle for factory: Blinking amber (1 sec on, 1 sec off) System suspend with non-charging state: Blinking both side LED white (1 sec on, 1 sec off) BUG=b:246414045 BRANCH=none TEST=verify led behavior as intended, verify VT2 command: ectool led left/right auto/white/amber/off. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I7d7ecaba5f1a78609d9093b94b67a23a40d62812 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3878626 Commit-Queue: Andrew McRae <amcrae@google.com> Reviewed-by: Andrew McRae <amcrae@google.com> Code-Coverage: Andrew McRae <amcrae@google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Devin Lu <devin.lu@quantatw.com>
* zephyr: Add alternative usb_mux_chain config for nissaTomasz Michalec2022-09-137-25/+32
| | | | | | | | | | | | | | | | | | Add alternative USB mux configuration in DTS for nissa. LOW_COVERAGE_REASON=no test for nissa board yet BUG=b:234482311 TEST=zmake build -a TEST=./twister -T zephyr/test BRANCH=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Id367005334cc378c7495b615bab5333a72d39bf8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3875325 Commit-Queue: Tomasz Michalec <tmichalec@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Adam Mills <adamjmills@google.com>
* zephyr: Add alternative usb_mux_chain config for corsolaTomasz Michalec2022-09-135-7/+22
| | | | | | | | | | | | | | | | | Add alternative USB mux configuration in DTS for corsola. LOW_COVERAGE_REASON=missing PS8743 emulator to introduce kingler baseboard_x_ec_gpio2_init test BUG=b:234482311 TEST=zmake build -a BRANCH=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I82e8bbf7da49ba927eb2dfc151db046f5c88cb77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3875324 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com>
* zephyr: shim: Move BB retimer controls to separate fileTomasz Michalec2022-09-133-27/+43
| | | | | | | | | | | | | | | Move bb_controls[] array generation to separate file. BUG=None TEST=zmake build -a BRANCH=None Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Id875840806593d75c4eebde273b1dff583281d10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3875323 Commit-Queue: Tomasz Michalec <tmichalec@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>