summaryrefslogtreecommitdiff
path: root/zephyr/test
Commit message (Collapse)AuthorAgeFilesLines
...
* retimer: Add emulator and unit tests for ANX7452 retimer driverMadhurima Paruchuri2023-04-127-0/+345
| | | | | | | | | | | BUG=b:267589042 BRANCH=none TEST=./twister -s drivers/drivers.anx7452 -c --coverage Change-Id: I7b4dcef7e667cd69ecb39f6dda7a6c8570177f40 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4303379 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* system_safe_mode: Print process stack dumpRob Barnes2023-04-112-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | Add the CONFIG_SYSTEM_SAFE_MODE_PRINT_STACK option for printing the faulting process stack to the console buffer. This must be done in safe mode because the console buffer ignores log messages while in an ISR. This option is on by default when system safe mode is enabled. get_panic_stack_pointer is a new overidable function that each architecture needs to implement to support this feature. The default implementation returns 0, which will result in no stack being printed. This is a workaround until coredumps are fully supported. BUG=b:266084064 BRANCH=None TEST=System safe mode zephyr test passes Stack print observed on boten, guybrush, and skyrim boards. LOW_COVERAGE_REASON=Cortex-M and NDS32 specific code cannot be tested Change-Id: Ied78ab7e6edca9cfa97c50323d94e39a3fca0eef Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4301695 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* zephyr: Support PLATFORM_EC_CMD_POWERINDEBUG flagKnox Chiou2023-04-111-0/+1
| | | | | | | | | | | | | | | | | | | Support PLATFORM_EC_CMD_POWERINDEBUG flag for `powerindebug` on zephyr. BUG=b:272185086 BRANCH=none TEST=zmake build geralt TEST=disable flag and check powerindebug Signed-off-by: Knox Chiou <knoxchiou@google.com> Change-Id: I89af4161b6bcc351e750d2716e0cc594cfe74814 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4383291 Tested-by: Knox Chiou <knoxchiou@chromium.org> Commit-Queue: Knox Chiou <knoxchiou@chromium.org> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Knox Chiou <knoxchiou@chromium.org>
* zephyr: driver: add gpio test for rt1718slschyi2023-04-105-34/+198
| | | | | | | | | | | | | | | | | Add test for GPIO related driver tests. The common code used in different test suite are extracted into a new file, and extend the GPIO related functionality in RT1718S emulator for testing. BUG=b:273854897 BRANCH=none TEST=./twister -c -i -T zephyr/test/drivers -s drivers.rt1718s Change-Id: Ic32973bcee0f944be59ac6840612a3358d010b76 Signed-off-by: lschyi <lschyi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4387396 Commit-Queue: Sung-Chi Li <lschyi@chromium.org> Tested-by: Sung-Chi Li <lschyi@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com>
* zephyr: Add `test_` prefix to ZTEST function namesAl Semjonovs2023-04-0748-228/+230
| | | | | | | | | | | | | | Twister parsing fails when `test_` prefix is missing from the test name. BUG=None BRANCH=NONE TEST=./twister -T zephyr/test Change-Id: Ic7148a66c761eaf45619b4e764e5aac9b869092c Signed-off-by: Al Semjonovs <asemjonovs@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4409346 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: Fix flaky keyboard_scan testTristan Honscheid2023-04-071-17/+33
| | | | | | | | | | | | | | | | Latent key presses were appearing in a subsequent test, throwing off FFF expectations. Resolved by adding a test-only helper function to `keyboard_scan.c` to wipe out the debouncing state between tests. Also broke out the failing test into two independent ones. BRANCH=None BUG=None TEST=./twister -s drivers/drivers.keyboard_scan Change-Id: I79f2a6891f36e10a7df87865573348312c5b57d5 Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4404706 Reviewed-by: Al Semjonovs <asemjonovs@google.com>
* Zephyr Test: Create test for NX20P3481 PPCDiana Z2023-04-073-0/+58
| | | | | | | | | | | | | | Create test cases and emulor behavior to cover the slightly-different portions of the NX20P348X code related to Vbus sourcig and sinking. BRANCH=None BUG=b:276468569 TEST=./twister -T ./zephyr/test Change-Id: Ieb30b3dbe3ad52448359ef253085058efe5b1d39 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4404285 Reviewed-by: Simon Glass <sjg@chromium.org>
* Zephyr test: Split NX20P3483 specifics into their own testDiana Z2023-04-076-22/+50
| | | | | | | | | | | | | | | | The driver code in drivers/ppc/nx20p348x.c is split between two similar PPCs, with the primary difference being their methods of enabling sourcing and sinking. Split the code for the "3" variant into its own file so it may be tested separately. BRANCH=None BUG=b:276468569 TEST=./twister -T ./zephyr/test Change-Id: I83a8f0a1b01981aa8654aac472b2fb747bcb9feb Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4404283 Reviewed-by: Aaron Massey <aaronmassey@google.com>
* Zephyr test: Test NXP PPC interruptsDiana Z2023-04-074-0/+135
| | | | | | | | | | | | | Add support for testing interrupts with the NX20P384X driver. BRANCH=None BUG=b:276468569 TEST=./twister -T ./zephyr/test Change-Id: I3856063c367ec6d8ffcbd8599c3b62fa73e01b1f Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4389620 Reviewed-by: Tomasz Michalec <tmichalec@google.com>
* mt8186,mt8188: check the holder of AP_RST_ODLEric Yilun Lin2023-04-074-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | To distinguish the AP shutdown, and the AP reset held by GSC/Servo, we use the SYS_RST_ODL as the reference. If AP_EC_SYSRST_ODL is asserted, but SYS_RST_ODL is not, this is a normal shutdown. If AP_EC_SYSRST_ODL is asserted, and so is SYS_RST_ODL, the AP reset is held by GSC or Servo. In this case, we should let the power state stay at S0 to prevent from an unexpected shutdown. BUG=b:276229973 TEST=pass firmware_CorruptMinios TEST=dut-control warm_reset:on sleep:1 warm:reset:off, it stays at S0 BRANCH=none Change-Id: I9b69caa0d15e6e58e7f11ad1079536bc1954b5ce Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4402421 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* system_safe_mode: Set test runner tidRob Barnes2023-04-061-0/+1
| | | | | | | | | | | | | | | | | Add CONFIG_TASKS_SET_TEST_RUNNER_TID_RULE to system safe mode unit test so test runner tid is set automatically. Without this change, the look up of the task id of the current task will cause an assert error. BUG=none BRANCH=None TEST=Test passes without assert errors Change-Id: I35d012253d3ed907c3f1a921c894e6c43e816ef1 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4404230 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* nissa: test project-level sub_board.cPeter Marheine2023-04-068-0/+514
| | | | | | | | | | | | | | | | | | | This defines a Nissa-like board for unit testing and adds tests to exercise the project's sub_board.c, in particular that GPIO configuration is correct. A small change is made to make it possible for the tests to reset some global values that are set by board code on initialization; there is no functional change to board code. BUG=b:271118112 TEST=./twister -ciC -T zephyr/test/nissa BRANCH=nissa Change-Id: I8edfddbf663761f5c72c4d680cc056ee7d46d2f8 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4402751 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* Zephyr test: Create NX20P383X testDiana Z2023-04-036-0/+156
| | | | | | | | | | | | | | Create a test for the NX20P383X driver. This first test checks the APIs into the driver, but does not test the interrupt functionality. BRANCH=None BUG=b:276468569 TEST=./twister -T ./zephyr/test Change-Id: I9ffffda688c6d45b1448aac781bc4c070f06777b Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4389618 Reviewed-by: Yuval Peress <peress@google.com>
* Zephyr test: Create NX20P383X emulatorDiana Z2023-04-031-1/+1
| | | | | | | | | | | | | | | | Create an emulator for this PPC so tests may use it as an available i2c target. BRANCH=None BUG=b:276468569 TEST=./twister -T ./zephyr/test LOW_COVERAGE_REASON=emulator edge cases not tested Change-Id: I54b8aced582e81b3f61895f25b472bce79dddc50 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4389617 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: tests: Update testcase.yaml to remove extra_argsTristan Honscheid2023-04-038-306/+370
| | | | | | | | | | | | | | Update testcase.yaml files using `extra_args` to specify extra config an DT overlays to use the new dedicated YAML fields. BUG=None BRANCH=None TEST=./twister for affected test projects Change-Id: If8162b7424b22638613a60b22ab0b35b2cae4e09 Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4391242 Reviewed-by: Yuval Peress <peress@google.com>
* rex: cbi: db: Add CBI FW_IO_DB lookup to enable appropriate dbMadhurima Paruchuri2023-04-035-0/+96
| | | | | | | | | | | | | | | Add CBI lookup to determine which daughter board is present and enable retimer, PPC, TCPC and other components of that DB if required BRANCH=none BUG=b:273925745 TEST=./twister -T zephyr/test/rex -c Change-Id: I97147ef58512769b4f725a1cfc9a3eb53d121003 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4345595 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* Zephyr test: Add test for ISL9241 charger chipDiana Z2023-03-316-0/+276
| | | | | | | | | | | | | | Add a test to run through the basic available functionality of the ISL9241 charger chip and validate it behaves as expected. BRANCH=None BUG=b:273722902 TEST=./twister -T ./zephyr/test Change-Id: I29beb38a1af867640c31237581dba41512c01ddd Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4387137 Reviewed-by: Al Semjonovs <asemjonovs@google.com>
* zephyr: vboot_efs2 test: Fix GPIO flag mismatchKeith Short2023-03-311-1/+1
| | | | | | | | | | | | | | Fix the GPIO flags for the GPIO04 signal, so that the flags match between the named-gpios and the tcpci_emul node. BUG=none BRANCH=none TEST=./twister Change-Id: Ie699222c89ee5169ce715e1189306ee456ea4348 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4387257 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* Zephyr test: Conditionally compile ISL923x dependent functionsDiana Z2023-03-311-0/+2
| | | | | | | | | | | | | | | Remove the functions which require the ISL923x emulator to function from the build if that emulator isn't present. This way, tests may compile with a different charger emulator in place. BRANCH=None BUG=b:273722902 TEST=./twister -T ./zephyr/test Change-Id: Id497e8c9151a247aedff10eca1b7af3dd047a1fa Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4387135 Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: tests: Fix duplicate GPIOsKeith Short2023-03-302-7/+3
| | | | | | | | | | | | | | Fix duplicate GPIOs found in the unit tests. Duplicate GPIOs may cause test instability. BUG=none BRANCH=none TEST=./twister Change-Id: Ie6df5ebd0d663488673442377b09d66e07fff38e Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4382527 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: tcpc: add rt1718s testlschyi2023-03-307-0/+300
| | | | | | | | | | | | | | | Add test cases for testing rt1718s tcpc driver. BUG=b:273854897 BRANCH=none TEST=./twister -c -i -T zephyr/test/drivers -s drivers.rt1718s Change-Id: Ib37a41bf85200778b8488be5ff3c16d99d2d1f28 Signed-off-by: lschyi <lschyi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369111 Reviewed-by: Eric Yilun Lin <yllin@google.com> Tested-by: Sung-Chi Li <lschyi@chromium.org> Commit-Queue: Sung-Chi Li <lschyi@chromium.org>
* voltorb: limit type-c output current in S3Siyu Qin2023-03-294-0/+115
| | | | | | | | | | | | | | | | | | According to OEM requirement, if battery power is lower than 30% in S3, the type-c output current should be limited to 1.5A. For devices that support PD, change source PDO to 1.5A. BUG=b:270837688 BRANCH=corsola TEST=1. zmake build voltorb 2. ./twister --coverage -v -i -T zephyr/test/kingler Change-Id: I3852a96084f322875fa1117fd41a0b79c6d09afa Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4235510 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
* Zephyr test: Add test for AMD FP6 USB muxDiana Z2023-03-286-0/+194
| | | | | | | | | | | | | | | Add a test exercising all the basic sets, as well as timing quirks, of the AMD FP6 USB mux driver. BRANCH=None BUG=b:274159180 TEST=./twister -T ./zephyr/test, observe a satisfying 96% coverage in the AMD FP6 mux driver Change-Id: Id931126bcb6639f9004a99543e7e803b0042ec60 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4350996 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: tcpc: Add tests for TCPC alternate switch during runtimeMadhurima Paruchuri2023-03-286-0/+107
| | | | | | | | | | | | | Add tests to test the working of TCPC alternatives switch working BRANCH=none BUG=b:274151516 TEST=./twister -s drivers/drivers.usbc_tcpc -c Change-Id: Ic5f666d4efa053a888d0f045fb3075d39b9000d2 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4356352 Reviewed-by: Keith Short <keithshort@chromium.org>
* mkbp_fifo: fix buffer overflow bugTing Shen2023-03-272-1/+7
| | | | | | | | | | | | | | | | | | | | | The element type we used in mkbp fifo (ec_response_get_next_event, 13 bytes) is smaller than the maximum data we put into the queue (KEYBOARD_COLS_WITH_KEYPAD, 15 bytes). Change the element type to ec_response_get_next_event_v1 to fix this bug. Also added a compile time check and updated the unittest to detect similar bugs in the future. BUG=none TEST=pass the updated drivers.mkbp test BRANCH=none Change-Id: Ifb6d89a81cbbb1bbcf9fa20164b6b133bad3d0a2 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369577 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* zephyr: move tcpc_get_alert_status to shimJason Yuan2023-03-243-17/+16
| | | | | | | | | | | | | | | | | | | | tcpc_get_alert_status is similar between multiple different projects. They have been now merged into common code. BUG=b:254148652 TEST=twister, usbc charging on villager, lazor BRANCH=none LOW_COVERAGE_REASON=the change from hardcoding to rst-gpios in board specific code is uncovered. The common code is 100% covered. This CL increases the absolute coverage. Change-Id: I3136bd5b600dbb385547e06490dcbf8815b85b85 Signed-off-by: Jason Yuan <jasonyuan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4257651 Commit-Queue: zhi cheng yuan <jasonyuan@chromium.org> Auto-Submit: zhi cheng yuan <jasonyuan@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: zhi cheng yuan <jasonyuan@chromium.org>
* markarth: Modify fw config structureLeila Lin2023-03-241-5/+0
| | | | | | | | | | | | | | | | Add keyboard backlight fw config in cbi and add the override ec feature function. Also remove the unused fw config and function. BUG=b:270880660, b:273834148 BRANCH=none TEST=zmake build markarth Change-Id: I4488d473ee2b073a3df96f72926110395c0fc9b4 Signed-off-by: Leila Lin <leilacy_lin@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4362352 Tested-by: LeilaCY Lin <leilacy_lin@compal.corp-partner.google.com.test-google-a.com> Reviewed-by: Chao Gui <chaogui@google.com> Commit-Queue: Chao Gui <chaogui@google.com>
* zephyr/emul/anx7483: Add support for changing reserved register masksRobert Zieba2023-03-231-0/+174
| | | | | | | | | | | | | | | | | Some of the bits marked as reserved in the ANX7483's registers are used by the manufacturer for board-specific tuning. Add an API to allow for changing reserved masks to allow for tests to fully validate their tunings. BRANCH=none BUG=b:247151116 TEST=Ran tests Change-Id: Ifca5e5dea60b0ed4d2557096be65211c0f83f459 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4345934 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: ppc: Add support for multiple altnernatesKeith Short2023-03-225-3/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for multiple PPC altnernate on each USB-C port. PPC chips that are candidates for runtime selection must add the "is-alt" property to the PPC definition. ppc_port0_alt: sn5s330@40 { compatible = "ti,sn5s330"; status = "okay"; reg = <0x40>; is-alt; }; The board specific code then calls PPC_ENABLE_ALTERNATE_BY_NODELABEL, specifying both the USB-C port to update, and the nodelabel of the new PPC device. PPC_ENABLE_ALTERNATE_BY_NODELABEL(0, ppc_nx20p348x_alt); BUG=b:274126703 BRANCH=none TEST=./twister -s drivers/drivers.usbc_ppc Change-Id: I8fff03beac8dbb98fea5b574e2ad456721cefe98 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4354880 Tested-by: Madhu 🌱 <mparuchuri@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* Host sleep: Consider a reboot after suspend to be a resumeDiana Z2023-03-211-0/+91
| | | | | | | | | | | | | | | | | | | | When we try to wake the host during a failed resume, the host may reboot rather than actually following the resume path. In this case, we will receive events of "0" indicating we're on a fresh boot and the chipset RESUME hooks never run. Instead, we should treat this new boot as a resume in order to ensure the previous SUSPEND hooks get a RESUME call to go with them. BRANCH=None BUG=b:273327518 TEST=on whiterun, run suspend with bad AP FW version and ensure the backlight turns on after we wake the host Change-Id: I9c8e7ad70dbca5245844a31772e99097256e592f Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4344029 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* corsola: set GPIO_LID_OPEN as GPIO_INPUT_PULL_UPSiyu Qin2023-03-201-0/+1
| | | | | | | | | | | | | | | | | | | | The lid sensor is on daughter board, if daughter board is disconnected, the EC will detect the floating pin as low, then the lid state is locked as lid close. The DUT cannot power on by power button. So set the pin as GPIO_INPUT_PULL_UP. BUG=b:273422759 BRANCH=corsola TEST=1. disconnect daughter board, 'lidstate' shows 'lid open', and the DUT can power on by power button. 2. connect daughter board, DUT can power on by lid open. 3. ./twister -T zephyr/test/krabby/ Change-Id: I2766d4a3a245efc28621d8a0292390c64721aae4 Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4344441 Reviewed-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* rex: fan: Remove fan_initMadhurima Paruchuri2023-03-176-137/+0
| | | | | | | | | | | | | | | | Rex project is not fan less and it's CBI structure is not containing information regarding fan, hence cleaning up fan_init. The current CBI configuration is at program level which should be at project level. BUG=b:244870433 BRANCH=none TEST=zmake build rex --clobber && ./twister -T zephyr/test/rex -i --coverage --clobber Change-Id: Ia4fbc658bdbf571c38e507bfa7ea37be77bcc534 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4337896 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* bma4xx: emulator and driver testsPeter Marheine2023-03-174-0/+490
| | | | | | | | | | | | | | | | | | | | This implements an emulator and tests for the accel_bma4xx driver using that emulator in the drivers.default test binary. One change to the driver itself is made to fix an overread during interrupt processing (which is not harmful but is slightly inefficient) and a function is marked __maybe_unused so the driver builds successfully when not using interrupts. BUG=b:256047664 TEST=twister -ciC -s drivers/drivers.default -- --test="bma4xx::*" BRANCH=none LOW_COVERAGE_REASON=Some aspects of emulator functionality are not currently exercised. Change-Id: I2765f768c1f5f3651893dfedd1c04cd15cb7fa86 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4310762 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* zephyr/emul: Add ANX7483 emulatorRobert Zieba2023-03-165-5/+1312
| | | | | | | | | | | | | Add ANX7483 emulator and associated tests. BRANCH=none BUG=b:247151116 TEST=Ran tests Change-Id: Idd56a90e58c6d482556d92446aa0659a6a1b8105 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4322379 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr/emul: Add PS8811 emulatorRobert Zieba2023-03-168-0/+413
| | | | | | | | | | | | | Add emulator for the PS8811 retimer and associated tests. BRANCH=none BUG=b:247151116 TEST=Ran tests Change-Id: I65153b9c7cd2b597c1ebcc0371a96d34740c8a81 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4313466 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr/test: add tentacruel usb mux init testjeffrey Lin2023-03-163-0/+37
| | | | | | | | | | | | | | | | Add testing for checking the tentacruel project usb mux init. BUG=b:250798561 TEST=./twister -T zephyr/test/krabby BRANCH=none Change-Id: Ie84f0b717ad14979d945746ccf4c9f2ec1f7b59f Signed-off-by: jeffrey Lin <jeffrey_Lin@pegatron.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4318614 Reviewed-by: Jeffrey Lin <jeffrey_lin@pegatron.corp-partner.google.com> Tested-by: Jeffrey Lin <jeffrey_lin@pegatron.corp-partner.google.com> Commit-Queue: Jeffrey Lin <jeffrey_lin@pegatron.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* tree: Run clang-format on C++ filesTom Hughes2023-03-162-8/+8
| | | | | | | | | | | 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>
* zephyr: power_button: convert to the input APIFabio Baltieri2023-03-155-2/+36
| | | | | | | | | | | | | | | | | Convert the shim button driver to use the input APIs for the debounced state, use gpio_pin_get_dt() for the signal level one. BUG=b:268200726 BRANCH=none TEST=./twister, cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Cq-Depend: chromium:4339704 Change-Id: Ie4c3729709af7690332bc91aea2131a51aed184e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4329528 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Al Semjonovs <asemjonovs@google.com> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr test: Verify no discovery notification spamAbe Levkoy2023-03-152-0/+67
| | | | | | | | | | | | | | | Attach to a PD 2.0 partner that will not let the TCPM swap to DFP, preventing the TCPM from performing discovery. Verify that the TCPM only notifies the AP that discovery is complete (and empty) once. BUG=b:271613370 TEST=twister -s zephyr/test/drivers/drivers.usbc_alt_mode BRANCH=none Change-Id: I3f97d05e7578f06d9867442fdfbc73a3e4d9b8a5 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4334628 Reviewed-by: Diana Z <dzigterman@chromium.org>
* mt8186,mt8188: fix warm reset issued by servo and gscEric Yilun Lin2023-03-151-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix the EC holding SYS_RST_ODL (AP reset) in S3S5. Only asserting the SYS_RST_ODL with forcing shutdown. This will allow the AP to boot when the servo or gsc releases SYS_RST_ODL. When the AP is in reset, the power_state will be set to S5 first, and the target should be G3 if the power state has been put to G3 by S5 inactive timer. This is to prevent EN_PP4200_S5 and PMIC from being turned off, which would prevent the AP from booting when SYS_RST_ODL released if the AP reset was held by gsc or servo. To make it clearer, only three cases that we need to consider: 1. SYS_RST_ODL is held by GSC or Servo 2. SYS_RST_ODL is asserted by AP itself, a gracefully shutdown 3. SYS_RST_ODL is asserted by EC. For case 1, and 2, we don't need to assert SYS_RST_ODL, since the EC is not the initiator. BUG=b:267268982 b:273657518 TEST=On Steelix, and Geralt: * Cold reset: $ dut-control cold_reset:on sleep:0.2 cold_reset:off Result: G3 -> S0 * Long power press to shutdown: $ dut-control dut-control power_key:8.2 Result: S0 -> S5 -> G3 * Long power press to power-on but then shutdown: $ dut-control dut-control power_key:9.2 Result: G3 -> S0 -> S5 -> G3 * Short power press to power-on: $ dut-control dut-control power_key:tab Result: G3 -> S0 * Console command: apreset Result: S0 -> S0, AP reboots * Console command: apshutdown Result: S0 -> S5 -> G3 * Lid open to power-on: $ dut-control lid_open:no sleep:0.2 lid_open:yes Result: G3 -> S0 * AP console: reboot Reulst: S0 -> S0 * AP console: poweroff Reulst: S0 -> G3 * Short power press to power-on: $ dut-control dut-control power_key:tab Result: G3 -> S0 * Servo issue warm reset: $ dut-control power_state:warm_reset Result: S0 -> S5 -> S0 * Servo hold warm_reset and release: $ dut-control warm_reset:on sleep:2 warm_reset:off Result: S0 -> S5 -> S0 BRANCH=none Change-Id: I81fc25a5088722487fbbf74d641a5edf4ad450e5 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338758 Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com>
* skyrim: Validate usb port number in ppc_configKornel Dulęba2023-03-151-0/+4
| | | | | | | | | | | | | | | On skyrim only port0 is supported in current limiter logic. Add a check to verify that. Update the test accordingly BUG=b:267205976 TEST=./twister -i -T zephyr/test/skyrim BRANCH=none Change-Id: I04d5cd68ff99b72b0fa4884cbb3b09849f61407e Signed-off-by: Kornel Dulęba <korneld@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4334556 Reviewed-by: Robert Zieba <robertzieba@google.com>
* Zephyr test: Add USB PD Discovery testDiana Z2023-03-145-0/+419
| | | | | | | | | | | | | | | Add a test to cover the various ifs and elses of the usb_pd_discovery.c code. BRANCH=None BUG=b:267964449 TEST=run in twister and observe sweet sweet 93% coverage in usb_pd_discovery.c Change-Id: Ifdec5a8f57213b1e8050dbd0ca69ff068b038714 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4329094 Reviewed-by: Tomasz Michalec <tmichalec@google.com>
* rex: test: usb_pd_policy: Refactor the FFF declarationMadhurima Paruchuri2023-03-141-12/+6
| | | | | | | | | | | | | | | | | Use FAKE_VALUE_FUNC inplace of DECLARE_FAKE_VALUE_FUNC and DEFINE_FAKE_VALUE_FUNC, as both of them are called from same file Use FAKE_VOID_FUNC inplace of DECLARE_FAKE_VOID_FUNC and DEFINE_FAKE_VOID_FUNC, as both of them are called from same file BRANCH=none BUG=none TEST=./twister -T zephyr/test -c Change-Id: I8ca62a45c53d18174248d4f0476af900674c9d8e Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4323340 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* rex: test: fan: Refactor FFF declaration and DTC overlay configMadhurima Paruchuri2023-03-142-7/+6
| | | | | | | | | | | | | | | | | | | | | Use FAKE_VALUE_FUNC inplace of DECLARE_FAKE_VALUE_FUNC and DEFINE_FAKE_VALUE_FUNC, as both of them are called from same file Use FAKE_VOID_FUNC inplace of DECLARE_FAKE_VOID_FUNC and DEFINE_FAKE_VOID_FUNC, as both of them are called from same file Use new YAML DTC overlay config field inplace of extra_args to configure device tree files to be used during testing BRANCH=none BUG=none TEST=./twister -s rex/rex.fan -c Change-Id: I44b3d2998eea33ae1f83c4af1d2d8cf5c2f843e3 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4323339 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* rex: zephyr: test: Add unit tests for board_powerMadhurima Paruchuri2023-03-146-6/+385
| | | | | | | | | | | | BUG=b:247796816 BRANCH=None TEST=./twister -s rex/rex.board_power -c Change-Id: Ic0c93914ff978ca69215f196cec2f33dbd080524 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4214905 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* tasks: Remove use of IS_ENABLED in macro conditionsRob Barnes2023-03-131-1/+1
| | | | | | | | | | | | | | | | IS_ENABLED is not meant to be used in macro conditionals according to the documentation: "Note: This macro will only function inside a code block due to the way it checks for unknown values." BUG=None BRANCH=None TEST=Build Change-Id: I407ddfe4f75d51933c9ee4e8f2ea24ec86b47764 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4320980 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* skyrim: Add clamshell & convertible tests.Grzegorz Bernacki2023-03-136-1/+265
| | | | | | | | | | | BRANCH=none BUG=b:269234224 TEST=Ran tests Change-Id: I8d0d889cbc7d508854e35ab45bb13d1b2a4af360 Signed-off-by: Grzegorz Bernacki <bernacki@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4296798 Reviewed-by: Robert Zieba <robertzieba@google.com>
* tcpci: test: add get_vbus_voltage testEric Yilun Lin2023-03-133-0/+70
| | | | | | | | | | | | | | | | Add the test for TCPCI get_vbus_voltage API. BUG=b:272664811 TEST=./twister -c -i -T zephyr/test/drivers BRANCH=none Change-Id: I5b26e1e0d43225b4318694d3e76d2133905013e2 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4328914 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* Zephyr Test: Add more HPD casesDiana Z2023-03-093-3/+95
| | | | | | | | | | | | | | | | | | Add test cases for HPD IRQ being set high in a subsequent Attention packet and also for HPD set high early in the DP:Status message with no following Attention. Note, this also changes the HPD pins to be both input and output, so the code may read their state. BRANCH=None BUG=b:266714542 TEST=./twister -T ./zephyr/test Change-Id: I72c18d43a55a22c936ea2ebf4aeacef5412a5721 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4292303 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* Zephyr test: Add feature disabled test for AP VDM controlDiana Z2023-03-093-1/+60
| | | | | | | | | | | | | | Add a suite to confirm the host command and stub behavior expected when the AP VDM control command is disabled. BRANCH=None BUG=b:266714542 TEST=./twister -T ./zephyr/test Change-Id: If82c2d6f4d679f6af782b52298c9468a51a28503 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4290240 Reviewed-by: Yuval Peress <peress@google.com>