summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* boringssl: Add elliptic curve key helpersYi Chou2023-05-161-0/+31
| | | | | | | | | | | | | | | BUG=b:248508087 TEST=make V=1 BOARD=bloonchipper -j TEST=./test/run_device_tests.py --board bloonchipper -t boringssl_crypto => PASS TEST=./test/run_device_tests.py --board dartmonkey -t boringssl_crypto => PASS Change-Id: Ifdca7743c09910d413407be986e9d959e5b90479 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4505560 Tested-by: Yi Chou <yich@google.com> Commit-Queue: Yi Chou <yich@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* boringssl: Implement sysrand from TRNGYi Chou2023-05-165-0/+51
| | | | | | | | | | | | | | | | | | The boringssl doesn't include the TRNG implementation, we need our own CRYPTO_sysrand. BUG=b:248508087 TEST=make V=1 BOARD=bloonchipper -j TEST=./test/run_device_tests.py --board bloonchipper -t boringssl_crypto => PASS TEST=./test/run_device_tests.py --board dartmonkey -t boringssl_crypto => PASS Change-Id: I3136bcc96e09f674278bf338297d7bc0576e174c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4496289 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Yi Chou <yich@google.com> Tested-by: Yi Chou <yich@google.com>
* charger: Rename enum charge_state_v2 to charge_stateSimon Glass2023-05-151-8/+8
| | | | | | | | | | | | | | | | Now that we don't have an old charge_state, this is the only one. Rename it accordingly. This makes no functional change. BUG=b:218332694 TEST=make buildall Change-Id: I95923eedd2715b8c7793df8f6e3171c82f9347ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516193 Reviewed-by: Tristan Honscheid <honscheid@google.com> Tested-by: Simon Glass <sjg@chromium.org> Commit-Queue: Eric Peers <epeers@google.com>
* ec: Enable unaligned access for cortex-mFiras Sammoura2023-05-154-0/+168
| | | | | | | | | | | | | | | | | | Enable unaligned access for cortext-m and. Add a unit test to validate that unaligned access runs properly on both bloonchipper and dartmonkey. Add benchmarks to measure the speed gain between aligned and unaligned access. BRANCH=none BUG=b:239254184 TEST=test/run_device_tests.py -b dartmonkey -t unaligned_access TEST=test/run_device_tests.py -b bloonchipper -t unaligned_access Change-Id: I7d75433e6b7b33d7c82ad740dc85a8646d891c6a Signed-off-by: Firas Sammoura <fsammoura@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4327795 Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* charger: Rename charge_get_state() to led_pwr_get_state()Simon Glass2023-05-111-2/+2
| | | | | | | | | | | | | | | | | | We have a new 'charge state' in struct charge_state_data as part of the charge_state_v2.h file. This is confusing. Rename this function to match the enum it is referencing. This makes no functional change. BUG=b:218332694 TEST=make buildall Change-Id: I7f08dd4fb11e2939e0ef779018c1e3206ebc8d20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516188 Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* charger: Rename enum charge_state to led_pwr_stateSimon Glass2023-05-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | This name is confusing, since its members start with PWR_ and the comment for enum charge_state_v2 says that these values are only used to control the LEDs, with one not-quite-correct exception, whatever that might be. We could rename it to power_state, but that is already fairly widely used as a variable in the code base. Also it seems better to match the enum PWR_ prefix. Future work may rename the members too. Rename the charge_state enum. This makes no functional change. BUG=b:218332694 TEST=make buildall Change-Id: If8a7cc73dcfb4c1e89984e57fc55e432416e8aec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516187 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* GPU: Rename DC_ATLEAST_SOC to DC_ATMOST_SOCDaisuke Nojiri2023-05-051-2/+2
| | | | | | | | | | | | | | | | | | | When a D-Notify level is being searched, a battery percentage is compared against an upper threshold defined by DC_ATLEAST_SOC(x) macro. This CL renames the macro to avoid confusion. There is no functionality change. BUG=b:216485035 TEST=make run-nvidia_gpu Change-Id: Ic970a96881c61be62445258d1f0927db5d6e6b48 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4504734 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* chgstv2: Always discharge if soc is > sustainer_soc.upperDerek Basehore2023-05-051-2/+2
| | | | | | | | | | | | | | | | For the Charge Limit feature, we need to discharge down to the upper limit for the battery sustainer. The Charge Limit feature requires that the system never charge above 80%, so if the feature is enabled when the system is over that, it needs to discharge down to 80%. BUG=b:222619859 TEST=run-sbs_charging_v2 Change-Id: I3f65743144de64411484dd3f2aa6c5fd681a47c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4507756 Commit-Queue: Derek Basehore <dbasehore@chromium.org> Tested-by: Derek Basehore <dbasehore@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Return the enum type for error and statusYi Chou2023-05-042-31/+38
| | | | | | | | | | | | | | BUG=b:248508087 TEST=make V=1 BOARD=bloonchipper -j TEST=make runhosttests TEST=./util/compare_build.sh -b all => MATCH Force-Relevant-Builds: all Change-Id: I0177791509ae37a5d40793e219aedafe1e45430e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4502323 Commit-Queue: Yi Chou <yich@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Tested-by: Yi Chou <yich@google.com>
* test/fpsensor_crypto: Convert to C++Tom Hughes2023-04-261-4/+8
| | | | | | | | | | | BRANCH=none BUG=b:234181908 TEST=make run-fpsensor_crypto Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I26e7b7bcc8f2a7ee7d1ba19cb8cd8c0f7e22b2cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3860408 Reviewed-by: Yi Chou <yich@google.com>
* test/fpsensor_state: Convert to C++Yi Chou2023-04-251-10/+10
| | | | | | | | | | | | BUG=b:248508087, b:234181908 TEST=make V=1 BOARD=bloonchipper -j TEST=make run-fpsensor_state BRANCH=none Change-Id: If61f4d5f66df397a06d1b5961b60f60b0810c75e Signed-off-by: Yi Chou <yich@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4354807 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* clock: Add ScopedFastCpuYi Chou2023-04-254-0/+76
| | | | | | | | | | | | | Add a helper class to scope the range of boosting CPU. BUG=b:248508087 TEST=make V=1 BOARD=bloonchipper -j BRANCH=none Change-Id: Ic3dc59bb71e75aec8efb0eb1f2b035ef2867bd42 Signed-off-by: Yi Chou <yich@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4345046 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Reland "Use third_party boringssl for AES"Yi Chou2023-04-252-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 6fa9cc0c7484be908010a6acdd6547d686234e34 Original change's description: > Use third_party boringssl for AES > > The original boringssl copy is not maintainable in the long term. > We should build it from the upstream version. > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> BUG=b:248508087, b:273639386 TEST=make runhosttests -j TEST=make buildall -j BRANCH=none Force-Relevant-Builds: all Change-Id: I2bf9e2157eec030ec3526939846a5706b1954afd Signed-off-by: Yi Chou <yich@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4464659 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Revert "Reland "Use third_party boringssl for AES""Jonathon Murphy2023-04-212-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 0164feeebaad4abc7deb510c57ca0707dd2babb1. Reason for revert: Breaks postsubmit b/279174496 Original change's description: > Reland "Use third_party boringssl for AES" > > This is a reland of commit 6fa9cc0c7484be908010a6acdd6547d686234e34 > > Original change's description: > > Use third_party boringssl for AES > > > > The original boringssl copy is not maintainable in the long term. > > We should build it from the upstream version. > > > > BUG=b:248508087, b:273639386 > > TEST=make runhosttests -j > > TEST=make buildall -j > > BRANCH=none > > > > Signed-off-by: Yi Chou <yich@google.com> > > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > > Reviewed-by: Tom Hughes <tomhughes@chromium.org> > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Cq-Depend: chromium:4439330 > Change-Id: Ic22faafacaf331a1376d094a37c6efe271326d0b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4439569 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> Bug: b:248508087, b:273639386 Change-Id: I5cfb826bff10df55bbadf76c6cc2062bc761a6d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4456117 Commit-Queue: Jonathon Murphy <jpmurphy@google.com> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Auto-Submit: Jonathon Murphy <jpmurphy@google.com> Reviewed-by: Jonathon Murphy <jpmurphy@google.com> Tested-by: Jonathon Murphy <jpmurphy@google.com> Owners-Override: Jonathon Murphy <jpmurphy@google.com>
* Reland "Use third_party boringssl for AES"Yi Chou2023-04-212-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 6fa9cc0c7484be908010a6acdd6547d686234e34 Original change's description: > Use third_party boringssl for AES > > The original boringssl copy is not maintainable in the long term. > We should build it from the upstream version. > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> BUG=b:248508087, b:273639386 TEST=make runhosttests -j TEST=make buildall -j BRANCH=none Signed-off-by: Yi Chou <yich@google.com> Cq-Depend: chromium:4439330 Change-Id: Ic22faafacaf331a1376d094a37c6efe271326d0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4439569 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Revert "Use third_party boringssl for AES"Yi Chou2023-04-182-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6fa9cc0c7484be908010a6acdd6547d686234e34. Reason for revert: break the build of chromeos-base/chromeos-fpmcu-unittests. Original change's description: > Use third_party boringssl for AES > > The original boringssl copy is not maintainable in the long term. > We should build it from the upstream version. > > BUG=b:248508087, b:273639386 > TEST=make runhosttests -j > TEST=make buildall -j > BRANCH=none > > Signed-off-by: Yi Chou <yich@google.com> > Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 > Reviewed-by: Tom Hughes <tomhughes@chromium.org> Bug: b:248508087, b:273639386 Change-Id: Ie6acdab0be298625229b69eb9ac3ff5fd196387c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4439430 Commit-Queue: Yi Chou <yich@google.com> Owners-Override: Yi Chou <yich@google.com> Reviewed-by: Howard Yang <hcyang@google.com> Tested-by: Yi Chou <yich@google.com>
* Use third_party boringssl for AESYi Chou2023-04-182-6/+9
| | | | | | | | | | | | | | | The original boringssl copy is not maintainable in the long term. We should build it from the upstream version. BUG=b:248508087, b:273639386 TEST=make runhosttests -j TEST=make buildall -j BRANCH=none Signed-off-by: Yi Chou <yich@google.com> Change-Id: I3ead1244c3c839590281e20e5c4828242933d1f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3925087 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* USB-PD: Make sink automatically enter EPR modeDaisuke Nojiri2023-04-171-0/+10
| | | | | | | | | | | | | | | | | | | | Currently, EPR mode is entered only by 'pd' console command. This CL makes sink ports enter EPR mode automatically. PE_FLAGS_EPR_EXPLICIT_EXIT is cleared when soft reset is sent, a source is disconnected, or EPR is entered again. BUG=b:257320026,b:274929940 BRANCH=None TEST=On Agah, plug AC, observe automatic entry to EPR. Then type 'pd 1 epr exit' and observe EPR mode is not re-entered. Then replug AC and observe the port enters EPR automatically. TEST=make run-usb_pd_console Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ie2b94323ba404d44ee70756e1893c065c34911fd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4421425 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* USB-PD: Update pd console command for EPRDaisuke Nojiri2023-04-142-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > pd 1 epr enter EPR enter requested > [130.434040 C1: PE_SNK_Send_EPR_Mode_Entry] [130.434852 C1: DPM Waiting] [130.445641 C1: PE_SNK_EPR_Mode_Entry_Wait_For_Response] [130.501005 C1: Entered EPR] [130.501378 C1: PE_SNK_Wait_for_Capabilities] [130.518489 C1: PE_SNK_Evaluate_Capability] [130.519076 C1: PE_SNK_Select_Capability] C1: Req [8] 28000mV 5000mA > pd 1 state Port C1 CC1, Enable - Role: SNK-UFP TC State: Attached.SNK, Flags: 0x1000 PE State: PE_SNK_Ready, Flags: 0x41000201 EPR > pd 1 epr exit EPR exit requested [222.511037 C1: Request SPR before EPR exit] [222.511515 C1: PE_SNK_Select_Capability] C1: Req [4] 20000mV 5000mA BUG=b:257320026 BRANCH=None TEST=Agah. Run make run-usb_pd_console. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: If7566e1dc4de790180e44b49893622e1e71269da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4296999 Reviewed-by: Keith Short <keithshort@chromium.org>
* trng: Drop trng_rand() functionPatryk Duda2023-04-131-2/+2
| | | | | | | | | | | | | | | | | | | The function is not used anywhere except test/rng_benchmark.cc, so we will have a problem with code coverage when implementing the function using Zephyr API. The RNG benchmark was modified to use trng_rand_bytes() function. BUG=b:277029648 BRANCH=none TEST=./test/run_device_tests.py --board bloonchipper -t rng_benchmark Change-Id: Ic6cf7e511b2e8fe88a08e9e1c4354f7afa9ae425 Signed-off-by: Patryk Duda <pdk@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4423151 Tested-by: Patryk Duda <patrykd@google.com> Commit-Queue: Patryk Duda <patrykd@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* test/malloc: Add a test for double-free when using mallocstabilize-15415.B-mainTom Hughes2023-04-071-0/+25
| | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:274737509 TEST=Add RUN_TEST(test_malloc_double_free) to run_test ./test/run_device_tests.py --board bloonchipper -t malloc => PASS TEST=Add RUN_TEST(test_malloc_double_free) to run_test ./test/run_device_tests.py --board dartmonkey -t malloc => PASS TEST=Add RUN_TEST(test_malloc_double_free) to run_test make run-malloc Change-Id: I1695d3b5cbf5d29bbaf35aaddcea76be51de53f7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4406092 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* test: Add a test for malloc/freeTom Hughes2023-04-074-0/+106
| | | | | | | | | | | | | | | BRANCH=none BUG=b:274737509 TEST=./test/run_device_tests.py --board bloonchipper -t malloc => PASS TEST=./test/run_device_tests.py --board dartmonkey -t malloc => PASS TEST=make run-malloc Change-Id: Ida58335dcacbeefad56804246897810936c98546 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4390609 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* fpsensor: Rename fpsensor_detect functionsBobby Casey2023-04-061-1/+1
| | | | | | | | | | | | | | | | Rename get_fp_sensor_type and get_fp_sensor_spi_select to fpsensor_detect_get_type and fpsensor_detect_get_spi_select to be more consistent with other APIs BRANCH=none BUG=b:256674283 TEST=./util/compare_build.sh -b all -j 120 => MATCH Change-Id: Ie548ff5b33079cbc607cb9552efdfe9676da4c02 Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4283704 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* fp_sensor_mock: Rename fp_sensor_mockBobby Casey2023-04-061-1/+1
| | | | | | | | | | | | | | | | | Rename fp_sensor_mock files to fpsensor_mock to be consistent with other file names. This helps avoid issues with scripts using pattern matched filenames, such as util/migrated_files.sh. BRANCH=none BUG=none TEST=compare_build.sh -b fp => MATCH TEST=make BOARD=bloonchipper tests TEST=make BOARD=dartmonkey tests Change-Id: I6f7e213cbf72a59cfd5994c66dc7b93ea44c6505 Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4334695 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* test: Add unit tests for sbrkTom Hughes2023-04-044-0/+98
| | | | | | | | | | | | | | BRANCH=none BUG=b:234181908 TEST=./test/run_device_tests.py --board bloonchipper -t sbrk => PASS TEST=./test/run_device_tests.py --board dartmonkey -t sbrk => PASS Change-Id: I02d6fe269718f0f4f7f5d72e6a8f01bb4e6b4cfd Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4396773 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Revert "test/fpsensor_hw: fpsensor_hw test compiles and runs with gtest"Aashish Sharma2023-03-252-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 050c151b39c9cad3bb487b9218a822bb8a50615a. Reason for revert: Causing CQ compilation failures Original change's description: > test/fpsensor_hw: fpsensor_hw test compiles and runs with gtest > > BRANCH=none > BUG=b:254530679 > TEST=make BOARD=bloonchipper test-fpsensor_hw -j > TEST=make BOARD=dartmonkey test-fpsensor_hw -j > > Cq-Depend: chromium:3994436, chrome-internal:5548068 > Signed-off-by: Tom Hughes <tomhughes@chromium.org> > Change-Id: I1908ea496cd69c7d0e0cd84a841bd4c1692a1bf2 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3994291 > Reviewed-by: Firas Sammoura <fsammoura@google.com> > Reviewed-by: Andrea Grandi <agrandi@google.com> Bug: b:254530679,b:275142246 Change-Id: Iecf582a135487c794449a4f5f4422304003f1e84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369173 Auto-Submit: Aashish Sharma <shraash@google.com> Owners-Override: Aashish Sharma <shraash@google.com> Commit-Queue: Aashish Sharma <shraash@google.com> Tested-by: Aashish Sharma <shraash@google.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
* test/fpsensor_hw: fpsensor_hw test compiles and runs with gtestTom Hughes2023-03-242-12/+6
| | | | | | | | | | | | | | BRANCH=none BUG=b:254530679 TEST=make BOARD=bloonchipper test-fpsensor_hw -j TEST=make BOARD=dartmonkey test-fpsensor_hw -j Cq-Depend: chromium:3994436, chrome-internal:5548068 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I1908ea496cd69c7d0e0cd84a841bd4c1692a1bf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3994291 Reviewed-by: Firas Sammoura <fsammoura@google.com> Reviewed-by: Andrea Grandi <agrandi@google.com>
* test: Add a wrapper for googletestTom Hughes2023-03-241-0/+35
| | | | | | | | | | | | | | | | | | This wrapper makes it possible for unit tests that want to use googletest just need to include "ec_test.h". All googletest test cases will automatically be run. Failure/success is printed in the same format as traditional EC tests for compatibility. BRANCH=none BUG=b:254530679 TEST=make BOARD=bloonchipper test-fpsensor_hw -j TEST=make BOARD=dartmonkey test-fpsensor_hw -j Change-Id: I96bfd2067ad53412998184657b5a6cbb1e24126a Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4348158 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Firas Sammoura <fsammoura@google.com>
* test/motion_lid: Integrate with tablet hall sensorGwendal Grignou2023-03-232-9/+91
| | | | | | | | | | | | | | | | | | Include GMR tablet sensor in testing to verify that they are not on the way to lid calculation. Check we enter/exit tablet mode on lid angle, check GMR does not send incorrect information, trigger uncessary tablet mode changes. BUG=b:267680317, b:270994196 BRANCH=trogdor, dedede, many more potentially. TEST=Check with 'make run-motion_lid' Change-Id: I96d5f386dd0a3e0c207485e58d5ccdbe2d1f025f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338480 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common/tablet: Allow getting out of tablet mode when sensors are brokenGwendal Grignou2023-03-236-2/+310
| | | | | | | | | | | | | | | | | | | | | When sensors stop working, at least one accelerometer, the EC can not calculate the lid angle anymore. Add hook to the lid opening event, to be able to get out out of tablet mode when lid close. Move scope of the variables that keep track of the lid angle deduced from the GMR sensors. BUG=b:267680317, b:270994196 BRANCH=trogdor, dedede, many more potentially. TEST=Added unit tests. Change-Id: Iaf7cc0d27fba32b3c8616a0674a47af815921ac4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338479 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tree: Run clang-format on C++ filesTom Hughes2023-03-162-2/+2
| | | | | | | | | | | BRANCH=none BUG=none TEST=CQ passes Change-Id: I4e359ebbfacfa10239e991ee89da82db5161ef20 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338476 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/fpsensor_hw: Include config.h instead of board.hTom Hughes2023-03-151-2/+2
| | | | | | | | | | | | | | | | | | | | When running clang-format (which rearranged headers), the build for the fpsensor_hw started failing with "Include config.h instead of board.h": https://chromium.googlesource.com/chromiumos/platform/ec/+/3089e438e3a89aab1ca67c8488c6d7519f4ee630/include/config.h#5862 board.h shouldn't be included directly; instead we can just include config.h, which includes board.h. BRANCH=none BUG=none TEST=CQ passes Change-Id: Id9dc6374ccaa34ae45b184f62eded6c84eb20cba Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4342815 Reviewed-by: Firas Sammoura <fsammoura@google.com>
* crc16: Add CRC-16 utility functionsDerek Huang2023-03-081-0/+16
| | | | | | | | | | | | | | | | | crc-16 is required for CPS8200 firmware update to validate the correctness of the firmware after programming the firmware to CPS8200 flash. This patch add CRC-16 utility functions and the test. BUG=b:195708351 BRANCH=none TEST=make -j buildall; make run-crc Change-Id: I198993387833464e151acd19531e18c6d077b8f1 Signed-off-by: Derek Huang <derekhuang@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4269952 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* driver/fingerprint: Add _FPC suffix to FPC macrosBobby Casey2023-03-031-1/+1
| | | | | | | | | | | | | | | This commit is based on http://crrev.com/c/2727971, which was reverted in http://crrev.com/c/2810517 BRANCH=none BUG=b:264457390 TEST=test/run_device_tests.py -b bloonchipper TEST=test/run_device_tests.py -b dartmonkey Signed-off-by: Bobby Casey <bobbycasey@google.com> Change-Id: Ife7373d366228a7940b87b036be1bb7c2a1cf770 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4273187 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* chgstv2: Separate v0 and v1 param struct for EC_CMD_CHARGE_CURRENT_LIMITDaisuke Nojiri2023-03-031-1/+1
| | | | | | | | | | | | | | This CL separates param struct for v0 and v1 of EC_CMD_CHARGE_CURRENT_LIMIT. BUG=b:265372046 BRANCH=None TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I836f15fade7f1660475af7ceeebadb9082b45e84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4292617 Reviewed-by: caveh jalali <caveh@chromium.org>
* fpsensor: Rename fpsensor_private.h to fpsensor_utils.hBobby Casey2023-03-021-1/+1
| | | | | | | | | | | | | | | | Rename fpsensor_private.h as it does not contain any private interfaces and is included by non-private source files. BRANCH=none BUG=none TEST=make BOARD=bloonchipper TEST=make BOARD=dartmonkey TEST=make run-fpsensor_crypto Signed-off-by: Bobby Casey <bobbycasey@google.com> Change-Id: I4f9233c8c7b5ffdf84fdd0c11c3166dd65f4a913 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4273186 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* USB-PD: Print DPM state only if debug_level >= 2Daisuke Nojiri2023-03-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | Printing DPM state names is not much useful unless you're debugging timing issues). Normally, it's mostly either in 'waiting' or 'ready'. This patch introduces dpm_debug_level and sets it to DEBUG_LEVEL_1 by default. It can be configured by CONFIG_USB_PD_DEBUG_LEVEL. This prevents the EC console from being flooded by DPM state names when a policy engine sends an EPR keep alive message. BUG=b:257320026 BRANCH=None TEST=On Agah, turn on/off DPM debug messages by the pd dump command. LOW_COVERAGE_REASON=code coverage falsely reporting no coverage for closing braces on if conditions Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I7da0c2fb775cd0978e08464c8923757094c12ca7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4289286 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Divorce v1 and v2 alternate mode handlingDiana Z2023-02-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retire the common DFP mode support to the TCPMv1 specific module from whence it came. Since TCPMv1 does not support TBT, all TBT functions can be removed from its copy. Move the DFP support for TCPMv2 to the DPM and its modules. Note that the reduced redundancy in tracking active alternate modes means that we can remove the majority of the "generic" mode handling. This results in approximately 1k additional free flash space for boards. For now, leave the svdm_dp_* interfaces in place as boards are using them as entry points to modify the DP mode sequencing. Also leave a stripped down version of pd_dfp_exit_mode() in place, though this would be worth consolidating to a new API in the future. BRANCH=None BUG=b:170372521,b:159856063 TEST=all unit tests passing, confirm display works on nipperkin (ECOS) and skyrim (zephyr) boards, USB4 and TBT regression tested on skolas LOW_COVERAGE_REASON=b/243151272 filed for improving TBT coverage, common/mock files no longer relevant Change-Id: Idbe59bc7c6a0ab6103e8fa158e69275a142f8a16 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4211277 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* Add unit test for EC_CMD_CHARGE_CURRENT_LIMIT v1Daisuke Nojiri2023-02-191-27/+87
| | | | | | | | | | | | | | This patch add unit test for EC_CMD_CHARGE_CURRENT_LIMIT v1. BUG=b:265372046,b:269725114 BRANCH=None TEST=make run-sbs_charging_v2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I1f1528f0017c30a1b24b1593b5355938d99ddd6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4263562 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Peter Marheine <pmarheine@chromium.org>
* i8042: return self-test status on resetBoris Mittelberg2023-02-171-3/+14
| | | | | | | | | | | | | | | | | As described in PS/2 keyboard protocol spec, the reset command 0xff is followed by diagnostic self-test, aka BAT. Along with the ACK for reset command EC must return BAT status. BRANCH=none BUG=b:134366527 TEST=buildall; make run-kb_8042; depthcharge screen on brya Change-Id: I5803d06b204d552c458ad443393f80072d41e40e Signed-off-by: Boris Mittelberg <bmbm@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4252007 Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: CoolStar <coolstarorganization@gmail.com> Tested-by: Raul Rangel <rrangel@chromium.org>
* TCPMv2: Remove PE_FLAGS_VDM_SETUP_DONEAbe Levkoy2023-02-131-3/+36
| | | | | | | | | | | | | | Remove a PE flag that is redundant with the discovery state. Update the discovery state where appropriate to keep it internally consistent. BUG=b:189353401 TEST=voxel: Attach TBT4 hub; verify discovery sequence BRANCH=none Change-Id: I8ea870271ee95eb1dd4633370f7e39ca789f1328 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4237156 Reviewed-by: Diana Z <dzigterman@chromium.org>
* run_device_tests: Temporarily ignore long line errorsBobby Casey2023-02-091-0/+2
| | | | | | | | | | | | | | run_device_tests has gotten long enough to report an error about lines being too long. Ignore this error until it is refactored. BUG=none BRANCH=none TEST=none Change-Id: I461de971f4ce0b9912895511c459c8f54a62db6d Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4193839 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* run_device_tests: Add option to test with production app imageBobby Casey2023-02-091-16/+53
| | | | | | | | | | | | | | | | | | | | | Add the ability to run tests against the production application image. It should be noted that the production image does not support the "runtest" command so any tests using a production image must supply appropriate commands using pre/post test callbacks (to be added in a future CL) and/or supplying finish_regexes. Also add a test to verify this functionality. Tests using the standard application image should not have a target buildable via make, as they use the standard app) but may be run from run_device_tests.py. BUG=b:180445334 BRANCH=none TEST=run_device_tests.py -b dartmonkey Signed-off-by: Bobby Casey <bobbycasey@google.com> Change-Id: I76cc248775a4cafdfcc4278799156a291277a19b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4193835 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Andrea Grandi <agrandi@google.com>
* test: Check TPM_SEED is reset after rebootFiras Sammoura2023-02-084-0/+116
| | | | | | | | | | | | | | | Add a unit test to check that TPM_SEED is reset after the FPMCU is rebooted. BRANCH=None BUG=b:143471027 TEST=test/run_device_tests.py -b dartmonkey -t tpm_seed_clear TEST=test/run_device_tests.py -b bloonchipper -t tpm_seed_clear Change-Id: I478c8ffcfc75c8188438d56958f0bf16f752efef Signed-off-by: Firas Sammoura <fsammoura@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4199160 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* docs: Add missing sudo to commandTom Hughes2023-02-081-1/+1
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=run "JLinkRemoteServerCLExe -select USB" Cannot connect to J-Link. Retrying in 5 seconds.. TEST=run "sudo JLinkRemoteServerCLExe -select USB" -> success Change-Id: If701bacfc4ce04d778be0f6800b4bb266866f1af Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4228735 Reviewed-by: Firas Sammoura <fsammoura@google.com>
* TCPM: Separate Discovery into its own moduleDiana Z2023-02-071-0/+3
| | | | | | | | | | | | | | | | | | | | Discovery can be a separate feature from DFP mode entry, as any data role can run discovery in PD 3.0. Additionally, boards may want to enable discovery separate from full EC mode entry so put this feature behind a new CONFIG indicating its scope. BRANCH=None BUG=b:266714542 LOW_COVERAGE_REASON=only moving functions to a new file, b/267964449 filed to track expanding the testing of these functions later TEST=./twister -T ./zephyr/test, run on both nipperkin (ECOS) and skyrim (zephyr) to confirm cable and device identities are being reported correctly Change-Id: I84a08eaf4775ed427112d62777ff38f8a914a750 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4211268 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Gate DP module support on a CONFIGDiana Z2023-02-072-8/+3
| | | | | | | | | | | | | | | | | | | | | | | Add a CONFIG option to gate DP mode support within the embedded controller. By default, turn the DP module off if the AP is controlling the VDMs for mode entry. For modules which do not implement the DP config option, the header now defines stubs for DP specific functions to use. This obsoletes some of the stub functions from older unit tests. BRANCH=None BUG=b:266714542 TEST=on skyrim, compile with DP disabled and observe 3162 bytes saved, run zmake compare-builds -a and util/compare_build.sh -b all, ./twister -T ./zephyr/test passes (note: ECOS compare builds needed all assert statements removed to pass, as they grab the line number, zephyr compare builds passed before HC mode entry was revamped) Change-Id: I9619eb5d34e418f1972c4bf16d4cf9c8d551eac5 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4201454 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* run_device_tests: Add explicit function to power cycle the boardBobby Casey2023-02-071-3/+9
| | | | | | | | | | | | | | | BUG=b:180445334 BRANCH=none TEST=run_device_tests.py -b dartmonkey -t system_is_locked_wp_off TEST=run_device_tests.py -b dartmonkey -t system_is_locked_wp_on TEST=run_device_tests.py -b dartmonkey -t flash_physical TEST=run_device_tests.py -b dartmonkey -t flash_write_protect Change-Id: I4bee052e1766ff1eb09123cb494ea59d857fef18 Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4121374 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Andrea Grandi <agrandi@google.com>
* ec: Use chromite isort configJeremy Bettis2023-02-032-5/+8
| | | | | | | | | | | | | | | | | | Remove the .isort.cfg from platform/ec and use the one from chromite instead. This should be compatible with cros format. BRANCH=None BUG=b:267757300 TEST=Ran firmware_builder.py Change-Id: Ice4955b6995bd1f9380e97f58e89efb7c1e8aeb1 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4221928 Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* TCPMv2: Queue Attention messages for consumptionDiana Z2023-01-251-0/+4
| | | | | | | | | | | | | | | Set up a queue within the DPM to hold VDM:Attention messages which the AP will be able to deplete at its leisure. BRANCH=None BUG=b:208884535 TEST=builds with and without AP VDM control Change-Id: Ia73ac3c6164251ab021776fdca252033646797dd Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4171490 Code-Coverage: Aaron Massey <aaronmassey@google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>