summaryrefslogtreecommitdiff
path: root/test/test_config.h
Commit message (Collapse)AuthorAgeFilesLines
* TCPMV2: Add explicit setting of VPD VDO CT CurrentSam Hurst2021-03-121-1/+1
| | | | | | | | | | | | | | | | | | Add the capablility to explicity set a CTVPDs VDO current. BUG=b:165934405 BRANCH=none TEST=make runtests Verified that returned VDO from chocodile_vpdmcu was correct. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I2292024986fa89b228b56678d61d1aef2866c817 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748427 Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Sam Hurst <shurst@google.com>
* config: Provide default VCONN Swap delayAbe Levkoy2021-01-221-3/+0
| | | | | | | | | | | | | | | | | Almost every relevant board copy-pastes 5000 us. Make that the default and get rid of the redundant definitions. This is the approximate result of this command: find . -type f -name *.h | xargs sed -i -E \ '/#define CONFIG_USBC_VCONN_SWAP_DELAY_US[[:space:]]+5000[[:space:]]/d' BUG=b:144165680 TEST=make buildall BRANCH=none Change-Id: Ife86f9752971abcd7ab5ad5a5e607eb2ccbde2ba Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628132 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* config: Make VCONN Swap delay a documented optionAbe Levkoy2021-01-221-3/+3
| | | | | | | | | | | | | | | | | | | | | Replace PD_VCONN_SWAP_DELAY with CONFIG_USBC_VCONN_SWAP_DELAY_US. This is the approximate result of the following command, run from platform/ec: find . -type f -\( -name '*.c' -o -name '*.h' -\) | \ xargs sed -iE 's/PD_VCONN_SWAP_DELAY/CONFIG_USBC_VCONN_SWAP_DELAY/g' Fix some latent formatting errors in usb_pd_protocol.c, because they were preventing pre-upload hooks from passing. BUG=b:144165680 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Icaf3b309c08fdcd162e960cf5dc88185016b5d2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628131 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* TCPMv2: Test that PE ignores invalid BIST requestsAbe Levkoy2021-01-221-1/+3
| | | | | | | | | | | | | | | Send the PE BIST requests with inappropriate VBUS voltages or inappropriate BIST modes. Verify that the PE ignores them. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=run-usb_pe_drp passes BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I240ff6746debcf49934419940ab4f49b54e2b7e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639585 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Refactor CONFIG_FLASH_SIZE to CONFIG_FLASH_SIZE_BYTESYuval Peress2021-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | In Zephyr CONFIG_FLASH_SIZE is a Kconfig value that is used throughout. The issue is that the units don't match. In Zephyr the value is in KiB instead of bytes. This refactor simply renames CONFIG_FLASH_SIZE in platform/ec to include the unit (via _BYTES). BRANCH=none BUG=b:174873770 TEST=make buildall be generated by the build instead of per board Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I44bf3c7a20fcf62aaa9ae15715be78db4210f384 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2627638 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* TCPMv2: Compliance Unit Test - use CONFIG for NUM_FIXED_BATTERIESDenis Brockus2021-01-081-0/+1
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I0bc4d3f9d7dfebf91d4b7045055440587be7a71e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615625 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* TCPMv2: Compliance Unit Test - TD.PD.SRC3.E7Denis Brockus2021-01-071-0/+1
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iaa6888d2e0d861d64b2747856465789304dde414 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613724 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Update source-out configsDiana Z2020-12-241-0/+1
| | | | | | | | | | | | | | | | | | | | 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: Remove test/usb_tcpmv2_tcpci.cEdward Hill2020-12-181-29/+0
| | | | | | | | | | | | | | Remove test/usb_tcpmv2_tcpci.c to avoid duplication with test/usb_tcpmv2_compliance.c BUG=none BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ie62d0f7e2cc30c3086e03103a43dede5515006b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597598 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Unit Test TD.PD.LL.E3 Soft Reset UsageDenis Brockus2020-12-171-0/+27
| | | | | | | | | | | | | | BUG=b:175144677 BRANCH=none TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I629e2811b2cba5aa9821d8c855e039a6cfaa32ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2595816 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* tcpci: Base retry count on active PD revAbe Levkoy2020-12-151-0/+2
| | | | | | | | | | | | | | | Retry twice when operating at PD 3.0 and thrice when operating at PD 2.0. Provide a TCPM-agnostic interface to get the number of retries. BUG=b:173025773,b:173025737 TEST=Pass TD.PD.LL.E3 Soft Reset Usage and TD.PD.LL.E4 Hard Reset Usage BRANCH=firmware-volteer-13521.B-master Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I422447718f1bfc9a9d4f8ffc5b284723a5332833 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578201 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* common:online_calibration: Spoof sensor dataYuval Peress2020-12-081-0/+8
| | | | | | | | | | | | | | | | | This change allows the `accelspoof` ec command to also override the calibration data (bypassing the calibration module). This config flag should be used when testing layers above the EC (kernel and up)'s handling of the calibration values. BRANCH=none BUG=none TEST=Built on eve and added unit tests. TEST=make run-online_calibration_spoof -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I4735b9613c152af5559661a91565b05635d6495e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2494986
* test: motion: Update test to match motion_senseGwendal Grignou2020-11-231-1/+2
| | | | | | | | | | | | | | | | | Put sensors in forced mode, since interrupts are not generated in test mode. Remove unnecessary task wakeup, since motion sense are sending them. Fix comments and remove empty code. BUG=b:170703322 BRANCH=kukui TEST=unittest Change-Id: Ic9096998a29cebeb47bed5cc2c148b7743f6c78f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523295 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* zephyr: forward cros_crc8 to zephyrs crc8 implJett Rink2020-11-131-0/+1
| | | | | | | | | | | | | | | Shim in support for crc8 used in CBI, I2C, and other applications within platform/ec BRANCH=none BUG=b:168032589 TEST=add unit test for platform/ec and zephyr based CRC8 approaches and verify they both pass. Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I9b6112cb83dab81a44a1ac020d4efb1b7bb1df5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532692 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* crc32: rename test crc32->crc to allow for crc8Jett Rink2020-11-131-1/+1
| | | | | | | | | | | | | | | Instead of creating a new test for crc8, just make the existing crc32 test more generic. BRANCH=none BUG=none TEST=none Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: Ie630d4991d4e2c7dc441842c39d63fc0281ac809 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532690 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Revert "crc32: rename test crc32->crc to allow for crc8"Jett Rink2020-11-111-1/+1
| | | | | | | | | | | | | | | | | Something slipped through CQ coverage. Need to figure out, but in the mean time, revert the 3 CLs that seemed to have caused the issue. BRANCH=none BUG=chromium:1147953 TEST=none This reverts commit 5ec269c5a71643c955fe45191ed9f06794c6113a. Change-Id: I90f812cd4d4f83ea05d34740541db0076abce392 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2533356 Tested-by: Rajat Jain <rajatja@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* crc32: rename test crc32->crc to allow for crc8Jett Rink2020-11-111-1/+1
| | | | | | | | | | | | | | Instead of creating a new test for crc8, just make the existing crc32 test more generic. BRANCH=none BUG=none TEST=none Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I459e9b721a6cc0d94cef8c0d93102ad372095c34 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527493 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* test: Add 3072-byte key test case for rsa testYicheng Li2020-11-111-5/+3
| | | | | | | | | | | | | | | | | | This is so that the unittest can be built for a board that actually uses 3072-byte RSA in RW signature verification, and run on-device. E.g. `build --BOARD=hatch_fp test-rsa` BRANCH=none BUG=b:169256204 TEST=make -j buildall TEST=make BOARD=bloonchipper test-rsa3, flash to Dragonclaw, rwsig verify OK, test passes. Change-Id: I1e67f05b76b53d96fe508832a94e9af5ad896d4d Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2429392 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* COIL: Rename CONFIG_I2C_CONTROLLERDiana Z2020-11-051-7/+7
| | | | | | | | | | | | | 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>
* common: include config.h from console.hJack Rosenthal2020-09-291-0/+4
| | | | | | | | | | | | | | | | | | | | | console.h currently relies on many config options to selectively define macros. It does not currently include config.h, which means these config options are not guaranteed to be defined by this point. We will need this for Zephyr as well. There were a few configuration header files which implicitly relied on the ording of including console.h to bring in stdint.h at some point. We explicitly include what we use here to fix that. BUG=b:167590251 BRANCH=none TEST=build passes Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia005577a2579962ee8b14c61930f37fe28bc8f5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427088 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* test: body_detection: add unittest for algorithmChing-Kang Yen2020-09-031-3/+9
| | | | | | | | | | | | | | | | | | Add test to check if the algorithm of body detection is correct. There are three testcases: OnBody: always in on-body state, should not change to off-body Off to On: change state from off-body to on-body On to Off: change state from on-body to off-body BRANCH=None BUG=b:123434029 TEST=make buildall Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Change-Id: Ib027fa3ed659f0d2efd7416888a9ee4ad519edd6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2329113 Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>
* usb_pe_drp: new unit test with mocksPaul Fagerburg2020-08-311-0/+24
| | | | | | | | | | | | | | | | | | | Add a new unit test for usb_pe_drp with mocks for the various subsystems that it will use. The fake_prl module is already essentially a mock for the PRL layer, so just move it into the mocks directory and make it available as mock to other tests. BUG=b:163421994 BRANCH=None TEST=`make runhosttests` succeeds Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I2aea3fa0694e8d9e6bae1f47516cb4d5d2a1e714 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2364050 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* common: gyro_cal: Implement gyroscope calibrationYuval Peress2020-08-181-0/+8
| | | | | | | | | | | | | | Implement the calibration code for the gyroscope which is ported over from AOSP's https://android.googlesource.com/device/google/contexthub/+/refs/heads/master/firmware/os/algos/calibration/gyroscope/ BUG=b:138303429,b:137204366,chromium:1023858 TEST=Added unit tests BRANCH=None Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ic1ab2efb66565cda0a96c9c06722136fb184df77 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2244934 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* test: rename usb_pe_drp to usb_pe_drp_oldPaul Fagerburg2020-08-171-2/+2
| | | | | | | | | | | | | | | | | Rename the current usb_pe_drp test to usb_pe_drp_old. There will be a new usb_pe_drp test that uses mocks and we will move the tests over in a controlled fashion. BUG=b:163421994 BRANCH=None TEST=`TEST_LIST_HOST=usb_pe_drp_old make runhosttests` works. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I2e0f79eb793d888109d00a96567042356c770502 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357519 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* tcpmv2: wait before enabling HW auto toggleJett Rink2020-08-131-0/+1
| | | | | | | | | | | | | | | We need to ensure that the previous Rd or Rp has been held long enough before we transition into hardware auto toggle otherwise the first toggle might be too short and violate the DRP timing spec BRANCH=none BUG=b:163095971 TEST=Verify on scope Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I92e9f5ca7dbca2b347e438d774551cc11476195b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2343176 Reviewed-by: Edward Hill <ecgh@chromium.org>
* test: Soft_Reset sent regardless of Rp valueEdward Hill2020-08-121-0/+1
| | | | | | | | | | | | | | | Add test for TD.PD.SRC3.E26.Soft_Reset sent regardless of Rp value. BUG=b:161835483 BRANCH=none TEST=make -j run-usb_tcpmv2_tcpci Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I972bffcb1c7a330aef4ebdff98fcd33af9a667be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2340486 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* test: Add PD TX and RX to usb_tcpmv2_tcpciEdward Hill2020-08-051-0/+3
| | | | | | | | | | | | | BUG=b:162369240 BRANCH=none TEST=make -j run-usb_tcpmv2_tcpci Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I61a9f99a10c3432135a91699ac04ff65690388e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335455 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* TCPMv2: Optionally build extended message supportAbe Levkoy2020-07-291-2/+15
| | | | | | | | | | | | | | | | | | If CONFIG_USB_PD_EXTENDED_MESSAGES is defined, support sending and receiving extended messages. If it is not, remove the chunking state machines from the PRL and modify the PE to respond with Not Supported as appropriate. BUG=b:160374787,b:158572770 TEST=Attach various devices; observe PD traffic TEST=make run-usb_prl_noextended; make run-usb_pe_drp_noextended BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I862020155927b5613d599274708e60678c49c43c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2304263 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* tcpmv2: Add usb_tcpmv2_tcpci testEdward Hill2020-07-151-0/+23
| | | | | | | | | | | | | | | | | | | | Add a new test that runs a full set of TCPMv2 layers and state machines, talking to a simulated TCPC via I2C. Initial test cases: 1) Plug in a non-PD power supply -> we connect as sink. 2) AP S5 > S3 > S0 -> auto-toggle + low power. BUG=b:161167893 BRANCH=none TEST=make -j run-usb_tcpmv2_tcpci Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: If8b8eb2cca722ed01cbe1d6000fb3e4f4b70149c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2283911 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* stm32: Enable rsa and rsa3 on-device unit testsYicheng Li2020-06-231-0/+2
| | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:155235321 TEST=make BOARD=nucleo-dartmonkey tests -j TEST=make BOARD=bloonchipper tests -j TEST=make BOARD=dartmonkey tests -j TEST=make BOARD=nucleo-f412zg tests -j TEST=make BOARD=nucleo-h743zi tests -j TEST=flash rsa unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa3 unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa unit test binary to nucleo-h743zi, run test => pass TEST=flash rsa3 unit test binary to nucleo-h743zi, run test => pass Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: I2ebcf6f322f9c16aba65a3a627a0a83ca00d2a02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2240516 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* usb_prl: new unit test with mocksPaul Fagerburg2020-06-231-0/+11
| | | | | | | | | | | | | | | | | Now that the old usb_prl unit test is under usb_prl_old, add a new unit test for usb_prl with mocks for the various subsystems that it will use. BUG=b:158608129 BRANCH=None TEST=`TEST_LIST_HOST="usb_prl_old usb_prl" make runhosttests` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie1bf9a4494cd933473caa4ceb594eddd97c277c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2252662 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* test: rename usb_prl to usb_prl_oldPaul Fagerburg2020-06-181-1/+1
| | | | | | | | | | | | | | | | | | In preparation for moving the usb_prl unit test from the simulation to mocks, rename the current test to _old. We will set up a new usb_prl test that uses mocks and move the tests over in a controlled fashion. BUG=b:158608129 BRANCH=None TEST=`TEST_LIST_HOST=usb_prl make runhosttests` works. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I4639be16c64ca9b79b1c001518df81ca40cf1527 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250659 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* TCPMv2: Only include PD3.0 functionality when CONFIG_USB_PD_REV30Sam Hurst2020-05-211-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The TCPMv2 stack defaults to PD2.0 functionality. Defining CONFIG_USB_PD_REV30 enables PD3.0 functionality. BUG=b:155879504 BRANCH=none TEST=make -j buildall Manual tests: passed FAFT_PD running on kohaku Before patch: *** 18624 bytes in flash and 29216 bytes in RAM on kohaku RO **** *** 18544 bytes in flash and 29216 bytes in RAM on kohaku RW **** After patch: *** 23320 bytes in flash and 30336 bytes in RAM on kohaku RO **** *** 23228 bytes in flash and 30336 bytes in RAM on kohaku RW **** Flash savings of 4696 bytest Ram savings of 1120 Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I082cf62617a91b487d2d3567afd5e340bd52258c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2184547 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Remove unused CONFIG macrosDaisuke Nojiri2020-05-081-1/+0
| | | | | | | | | | | | | | CONFIG_GPU, CONFIG_USB_SM_FRAMEWORK, CONFIG_BOARD_HAS_AFTER_RSMRST are no longer used. This patch removes them. BUG=b/155996358 BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ia407850398c07b7cdb01cddb0288ae977b9dca82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2189171 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Button: Add unit tests for simulated button presspandeyan2020-04-291-0/+1
| | | | | | | | | | | | | | Added unit test cases to verify the button simulate operations. BUG=b:149659987 BRANCH=None TEST= Executed all unit tests locally make runhosttests -j Signed-off-by: pandeyan <anshuman.pandey@intel.com> Change-Id: If936766e03d574590fd90b1ea7a543102e263b0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2131966 Reviewed-by: Jett Rink <jettrink@chromium.org>
* common/keyboard_vivaldi: New keyboard framework for custom layoutRajat Jain2020-04-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Vivaldi is a new keyboard that allows individual boards to have additional or different top row keys and/or to reorder those keys. The primary agenda of vivaldi is to allow customization of the top row keys. However, as a secondary objective, it also allows coreboot to send a keymap to the kernel, for only the keys that are actually present on the keyboard. As part of enabling vivaldi, another feature that get enabled is to start sending action codes instead of function codes for the top row of the keyboard. go/vivaldi-prd go/vivaldi-design go/vivaldi-fw-design With this patch, things remain unchanged for any boards that do not provide board_set_vivaldi_keybd_config(). For boards that do provide it: * EC begins to send action scancodes instead of function scancodes for the top row when top row keys are pressed. * EC responds to an EC command from the coreboot, that asks for the layout for the keyboard. Coreboot uses this to expose corresponding keycodes to the kernel. BUG=b:146501925 TEST=Check on Jinlon the (new) expected scancodes are output from EC. BRANCH=firmware-hatch-12672.B Signed-off-by: Rajat Jain <rajatja@google.com> Change-Id: I1f45ce6eee138a984f8d4caef1ec76c9538dd30b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2135566
* TCPMv2: Configure PE test for alternate modesDiana Z2020-04-161-0/+3
| | | | | | | | | | | | Configures the TCPMv2 PE test to build the alternate mode code. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I4cb5824875e2a4b4e93fbae0a4d8762195b987f5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2137258
* tcpmv2: move function from TC layer to PEJett Rink2020-04-031-0/+4
| | | | | | | | | | | | | | | | | | | | | - Move pd_ function that belong in PE layer to PE layer. Remove the extra pe_ layer. - Remove unnecessary PE and Vconn ifdef guards in TC layer - Remove unused print_dev_info function - Move host commands in TC layer to host command file - Move RW hash stuff from TC to PE, since this only has to do with VDO (Which is a PE layer thing) - Removed dependency for tc_drp test on usbc_fake as we don't really need it anymore once we don't pull in the PRL and PE layers anymore (based on previously landed CLs) BRANCH=none BUG=b:153071799 TEST=everything still builds and passes tests Change-Id: Id1d1efa291c3525f57bc26af9fddda6ddace1b58 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2132871
* cleanup: correct max port count on testJett Rink2020-04-011-1/+1
| | | | | | | | | | | | | | Looking at code, we only test one port, so make the test defines match the test code BRANCH=none BUG=none TEST=all tests pass Change-Id: I0b793425e20678173f3ec52fdcff4567f0b8ccb4 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2131047 Reviewed-by: Diana Z <dzigterman@chromium.org>
* config: update TCPMv2 config optionsJett Rink2020-03-271-30/+5
| | | | | | | | | | | | | | | | | | | Reorganize how the TCPMv2 options are used - Update documentation in config.h and bring TCPMv2 items close together - Make the layer defines consistent on how they include compilation units - Update tests to account for how files are included now - Remove unnecessary defines in board.h since they are default on BRANCH=none BUG=none TEST=builds Change-Id: I91fca51648912deef44db23492ecc7775b2e3062 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2120063 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* cleanup: drop the _TYPEC part of USB device configJett Rink2020-03-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | The three USB device configurations describe more than just the Type-C layer, so remove the _TYPEC part within the define. This is also in preparation to change how the usbc build.mk includes files. This was performed with the following commands: $ git grep --name-only CONFIG_USB_TYPEC_DRP_ACC_TRYSRC | xargs perl -i -ple 's/CONFIG_USB_TYPEC_DRP_ACC_TRYSRC/CONFIG_USB_DRP_ACC_TRYSRC/g' $ git grep --name-only CONFIG_USB_TYPEC_CTVPD | xargs perl -i -ple 's/CONFIG_USB_TYPEC_CTVPD/CONFIG_USB_CTVPD/g' $ git grep --name-only CONFIG_USB_TYPEC_VPD | xargs perl -i -ple 's/CONFIG_USB_TYPEC_VPD/CONFIG_USB_VPD/g' BRANCH=none BUG=none TEST=builds Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I4deab784b7c3479cffd3dee7fb3ea3c8a9d6081c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2121193 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* common: online_calibration: Fire MKBP event on new calibrationYuval Peress2020-03-091-0/+15
| | | | | | | | | | | | | | Implement online calibration for accelerometers and fire a new MKBP event when a new calibration value is computed. TEST=Added new unit tests BRANCH=None BUG=b:138303429,chromium:1023858 Change-Id: I31ec7164be0d8c7dac210a1ac4b94ec9ecd6a60a Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2012847 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* remove cr50 related filesNamyoon Woo2020-03-091-37/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=b:149350081 BRANCH=none TEST=build all, and emerged ec related packages for host and octopus. $ make buildall -j $ cros_workon --host list chromeos-base/chromeos-cr50-dev chromeos-base/chromeos-ec chromeos-base/chromeos-ec-headers chromeos-base/ec-devutils chromeos-base/ec-utils chromeos-base/ec-utils-test dev-util/hdctools $ sudo emerge chromeos-cr50-dev -j $ sudo emerge chromeos-ec -j $ sudo emerge chromeos-ec-headers -j $ sudo emerge ec-devutils -j $ sudo emerge ec-utils -j $ sudo emerge ec-utils-test -j $ sudo emerge hdctools -j $ cros_workon-octopus list chromeos-base/chromeos-ec chromeos-base/chromeos-ec-headers chromeos-base/ec-devutils chromeos-base/ec-utils chromeos-base/ec-utils-test dev-util/hdctools $ sudo emerge-octopus chromeos-ec -j $ sudo emerge-octopus chromeos-ec-headers -j $ sudo emerge-octopus ec-devutils -j $ sudo emerge-octopus ec-utils -j $ sudo emerge-octopus ec-utils-test -j $ sudo emerge-octopus hdctools -j Signed-off-by: Namyoon Woo <namyoon@chromium.org> Change-Id: If751b26b0635b0021c077338e96eaa8e8dcf17a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2080631 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* TCPMV1/2: Make the PD Config Flags more consistentSam Hurst2020-02-221-8/+11
| | | | | | | | | | | | | | | | | | | | The current use of the PD Config Flags are a bit confusing and has been changed to the following: The CONFIG_USB_POWER_DELIVERY flag is used to enable and disable the TCPMv1 and TCPMv2 stacks. And when CONFIG_USB_POWER_DELIVERY is enabled, one of the following must be enabled: CONFIG_USB_PD_TCPMV1 - legacy power delivery state machine CONFIG_USB_PD_TCPMV2 - current power delivery state machine BUG=b:149993808 BRANCH=none TEST=make -j buildall Change-Id: Ie3f8615a75b15b4f1c703f57f3db9e152a471238 Signed-off-by: Sam Hurst <shurst@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2068519 Reviewed-by: Diana Z <dzigterman@chromium.org>
* common: Migrate online calibration to own moduleYuval Peress2020-02-131-4/+16
| | | | | | | | | | | | | | | This change moves the code that handles caching the temperature (which is the first step in online calibration) into a new compilational unit. TEST=None BRANCH=None BUG=b:138303429,chromium:1023858 Change-Id: Ib1fe3d2234dc2436e2bbfd4febd22196e5cdafef Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1906340 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: Implement accelerometer calibrationYuval Peress2020-02-081-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change implements the hybrid accelerometer calibration algorithm described in https://drive.google.com/corp/drive/u/0/folders/13k8AWvVkCg8KUr1HhD2qv6_ob1ixgCbE 1. Waits until the device is still 2. Adds a still sample to an orientation accumulator - If the new sample is close to an existing one, they're merged. - If the new sample is unique, it is added to the list of orientations in a FIFO manner (may be evicting an older sample). - Once enough orientations have been gathered, run the kasa algorithm. - The kasa algorithm should yield a radius that's near 1g, since all the samples were added when still. If this isn't the case, we fall back on newton's method (which takes longer). BUG=b:138303429,chromium:1023858 BRANCH=None TEST=buildall with new unit tests Change-Id: I98bb0d365017d8a916b008c7c0c263345a9cddac Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879716 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* fpsensor: Refactor fpsensor tests into separate binariesTom Hughes2020-02-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Using separate test binaries helps to prevent state from one set of tests accidentally leaking into other tests. Ideally all unit tests should be completely independent. Since there's a lot of global state in the fpsensor code the separate test binaries should help prevent the state from leaking across tests as we continue to add more. Also, by having a 1:1 correspondence between test binaries and test files, it's clearer what file (and functionality) each set of tests is targeting. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I937a5ffebfe61aa711efbbc2467d15d514fcfbae Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1832748 Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org> Reviewed-by: Yicheng Li <yichengli@chromium.org>
* common: Implement newton sphere fitYuval Peress2020-02-061-0/+5
| | | | | | | | | | | | | Add implementation of Newton's method for sphere fitting. BUG=b:137758297,chromium:1023858 TEST=Added new unit tests BRANCH=None Change-Id: Ic78ec4f8a8c2f57ddfa1d5220861bf5c06981ad8 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869730 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: mag_cal: update magnetometer to leverage kasaYuval Peress2020-01-281-0/+4
| | | | | | | | | | | | | | | Update magnetometer calibration algorithm to leverage the new kasa standalone code. BUG=b:138303429,chromium:1023858 TEST=added unit test BRANCH=None Change-Id: I5c0403b66d9fe7c2925b2ec6244cf9e32ad5ea5f Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1931464 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* common: Implement kasa sphere fit algorithmYuval Peress2020-01-211-0/+5
| | | | | | | | | | | | | | Add an implementation of the kasa sphere fit algorithm adapted from AOSP. BUG=b:138303429,chromium:1023858 TEST=Added unit tests BRANCH=None Change-Id: I8194bfaddbb7c57a2b20a1917c91f7c78707e685 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867226 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>