summaryrefslogtreecommitdiff
path: root/zephyr/emul
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Move the fake system functions into their own fileSimon Glass2022-09-102-25/+1
| | | | | | | | | | | | | | | | | | Move this out of the flash emulator so we can add to it and use it from other tests. Put it in a new 'fake' subdirectory, since we don't seem to have of this sort of thing yet. BUG=b:243982872 BRANCH=none TEST=./twister -c -T zephyr/test/drivers/ Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ia4cd3b10e2f38dbacadf0d20198be8f9bbc026e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3883773 Reviewed-by: Aaron Massey <aaronmassey@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: Create RTC emulatorAl Semjonovs2022-09-083-0/+145
| | | | | | | | | | | | | | Emulate RTC driver BUG=b:236074639 BRANCH=NONE TEST=./twister -T zephyr/test Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: Ib1073c0e30c0c39d8e778c228a89cc9b6638c887 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3880865 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Tomasz Michalec <tmichalec@google.com>
* zephyr: Replace deprecated zephyr.h with kernel.hAaron Massey2022-09-085-5/+5
| | | | | | | | | | | | | | | | | | The zephyr.h header has been formally deprecated upstream thus causing a build failure when downstreaming. Replace zephyr.h with kernel.h BRANCH=none BUG=none TEST=zmake build -a Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I0e6095160ab7248edde00f5c8336bc8d01c6b937 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3885035 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Al Semjonovs <asemjonovs@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr/test: add rt9490 charger emulatorTing Shen2022-09-063-0/+113
| | | | | | | | | | | | | | | | Implemented a rt9490 charger emulator with basic i2c read/write, and extra peek/reset reg functions BUG=b:244233556,b:243841599 TEST=tested with CL:3873241 BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I87b77cf2b0bc0a0d89f2f76353e16b9296dc5596 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3873240 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add new test for vboot efs2Jeremy Bettis2022-08-291-1/+7
| | | | | | | | | | | | | | | | | | | | This covers the cases in vboot_main. Next is to move the next level down and emulate the communication with the cr50 as well. Add new test hooks to vboot/efs2.c, and the flash emul. BRANCH=None BUG=None TEST=./twister Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Icca8dde3731a91645eabbf2bc547c84a51cb1474 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3858041 Tested-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Zephyr emul: Generalize ExitModeDiana Z2022-08-271-12/+23
| | | | | | | | | | | | | | | | Allow ExitMode to take place with any SVID sent if we've ACK'd an EnterMode of that SVID. BRANCH=None BUG=b:243151272 TEST=./twister -T ./zephyr/test Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iec3dec1900dba54d13d7a4bbe50078b547d4a1f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3859564 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Zephyr emul: Generalize mode entry responseDiana Z2022-08-271-9/+9
| | | | | | | | | | | | | | | | | Generalize the fields for mode entry so they can be used for modes besides DP as well. BRANCH=None BUG=b:243151272 TEST=./twister -T ./zephyr/test Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Idf2ce813cbcfcf730042a1d55b1de63425fbc824 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3859561 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Zephyr emul: Add cable supportDiana Z2022-08-272-21/+140
| | | | | | | | | | | | | | | | | Add support for the cable replying to messages for unit testing. For the first level of support, only reply to DiscoverIdentity (response for a cable with no alternate mode support). BRANCH=None BUG=b:243151272 TEST=./twister -T ./zephyr/test Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I731e0aad35a1d4bc07be75378df1f272d0eef525 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3859560 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Zephyr emul: Clarify TCPCI message typeDiana Z2022-08-262-9/+9
| | | | | | | | | | | | | | | | | Both the TCPCI emulator and the partner emulator have message structures with a member named "type". Re-name the TCPCI "type" to reduce confusion when the code references msg->type in both files. BRANCH=None BUG=b:243151272 TEST=./twister -T ./zephyr/test Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I600e8b046a701f53f21157a15d5073a127209076 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3859559 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: remove label usage from i2c_mock emulatorKeith Short2022-08-261-1/+1
| | | | | | | | | | | | | | Remove all devicetree label usage from the i2c_mock emulator. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Iece16f5aa8ff48e280db4487f38b776554556174 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855428 Reviewed-by: Aaron Massey <aaronmassey@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: remove label usage from sn5s330 emulatorKeith Short2022-08-261-1/+1
| | | | | | | | | | | | | | Remove all devicetree label usage from the sn5s330 emulator. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9f30cb5ba28b85d1cef1a838327a4ff599e28506 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855427 Reviewed-by: Tristan Honscheid <honscheid@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: remove label usage from lis2dw12 emulatorKeith Short2022-08-261-1/+1
| | | | | | | | | | | | | | Remove all devicetree label usage from the lis2dw12 emulator. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ice425e988f1d39e1eb3293c1ac1e9ff97de174d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855426 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Remove label usage from the ps8xxx emulatorKeith Short2022-08-261-3/+3
| | | | | | | | | | | | | | Remove devicetree label property from the ps8xxx emulator. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I8d46b18b3bf5394ca543b28b10ee1e6bf55526d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855424 Reviewed-by: Sam Hurst <shurst@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: Remove label usage from isl923x emulatorKeith Short2022-08-261-1/+1
| | | | | | | | | | | | | | Remove all devicetree label usage from the isl923x emulator. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ie7bd86eadb0804d8d8321c56a2e1a06390b8d1e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855422 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Remove label usage from ln9310 emulatorKeith Short2022-08-261-1/+1
| | | | | | | | | | | | | | Remove all devcietree label references from the ln9310 emulator. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Id56fe974d4f18b32fcd47f9e0a2c4b69412fb827 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3855420 Reviewed-by: Yuval Peress <peress@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: test: Emulate flash write and erase and add the test casesWai-Hong Tam2022-08-251-6/+92
| | | | | | | | | | | | | | | | | | | Implement the flash write and erase functions in the flash emulator. The functions call the underlying flash controller to execute. Add the simple test cases to exercise the flash write and erase, and then readback the data to compare the results. BRANCH=None BUG=b:236075787, b:236075595, b:236075283 TEST=./twister -s zephyr/test/drivers/drivers.default Change-Id: I50cb83c19382362c86a319d0feefa683f6b216bf Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3857443 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: Implement flash protectionWai-Hong Tam2022-08-241-7/+52
| | | | | | | | | | | | | Implement a simple flash protection for RO and ALL. BRANCH=None BUG=b:236075598 TEST=The following CL tests the functions. Change-Id: I0eec87d7ebbf776a676103ae26df5460d3685431 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3854310 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: drop BATTERY label propertyKeith Short2022-08-241-1/+1
| | | | | | | | | | | | | | Drop the label property from the emul_smart_battery driver. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Icd36f78688fd58eeb60527e8862ac3c020b9d843 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3852580 Reviewed-by: Yuval Peress <peress@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: drop KB_RAW label propertyKeith Short2022-08-241-1/+1
| | | | | | | | | | | | | | Drop the label property from the emul_kb_raw driver. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I69ecd3f29a220d28e406777c31f2cf8e73374557 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3852579 Reviewed-by: Sam Hurst <shurst@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: drop USB_C1_BB_RETIMER label propertyKeith Short2022-08-241-1/+1
| | | | | | | | | | | | | | Drop the label property from the emul_bb_retimer driver. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I31d1038606fc62f67c2782be40b148702137d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3852578 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: drop SYV682X_EMUL label propertyKeith Short2022-08-241-1/+1
| | | | | | | | | | | | | | Drop the label property from the emul_syv682x driver. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Id4902fce70c00e189b1559791c21e5915257332d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3852577 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: drop label property from BMI emulatorsKeith Short2022-08-242-2/+2
| | | | | | | | | | | | | | Drop the label property from the emul_bmi and emul_bma255 drivers. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I51a48b255760c55ae322f03a2527f36d4c7bb77b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3852573 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: drop TCS_EMUL label propertyKeith Short2022-08-241-1/+1
| | | | | | | | | | | | | | Drop the label property from the emul_tcs3400 driver. BUG=b:239165779 BRANCH=none TEST=./twister --clobber Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ice83caeb85d83bf49f423b45efe1e682c257746a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3852572 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* zephyr: emul: Rename faulty_snk to faulty_extTomasz Michalec2022-08-233-41/+39
| | | | | | | | | | | | | | | | | Rename faulty_snk TCPCI partner emulator extension to faulty_ext as this extension is not limited to use only with sink emulator. BUG=None TEST=./twister -T zephyr/test/drivers BRANCH=None Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I185c2982e33068c4577e6ae99bd69764bb19573c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3823510 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: Add bmi160 test case of interrupting taskJeremy Bettis2022-08-182-1/+43
| | | | | | | | | | | | | | | | | | | | | | In order to cover common/motion_sense.c:734 consistently, add a test that triggers an interrupt and verifies it was handled. Change the bmi160 emulator to clear interrupt status registers when read. I believe that this is how the hardware works. BRANCH=None BUG=b:242765844 TEST=./twister --coverage Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I880bd9fbc8fd853120c87c20c12010c0e9364d98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3834010 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: test: implement pwm_mock driverTing Shen2022-08-184-0/+97
| | | | | | | | | | | | | | | | | | | Implement a mock pwm device for testing pwm_led driver. This driver supports 1 channel, and an extra get_duty function for verification. BUG=b:241064591 TEST=passed the new test in CL:3792590 BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ife27e29bd615f37733b3592c9c8b0a6df61defb0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3825344 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* keyboard_scan: skip ghost key detection at bootTing Shen2022-08-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This CL fixed a bug that EC can't detect the boot key correctly if GSC asserts KSI2/3. When all columns have row2 or 3 asserted, read_matrix() tries to "fix" this by adding more keys to the state array. This causes the check_boot_key() function rejects the adjusted state. To fix this, add another workaround step before the ghost key detection to remove the rows affected by GSC. BUG=b:239674288,b:236580049 TEST=with gsc firmware from b/239674288$comment9, verify tentacruel able to enter recovery mode BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I3df2e56e0537446954e2b5de24bf849c2189d211 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3795747 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* emul: Migrate from unnecessary i2c_emul changesAaron Massey2022-08-1411-176/+31
| | | | | | | | | | | | | | | | | | | | | Cleanup existing usages and corresponding dependencies on modifying instances of struct i2c_emul so they do not serve as bad code examples for future emulator development. Remove reliance on setting these fields from emulators and tests alike. This includes migrating where we rely on i2c_emul internal fields to get a pointer to an emulator to using the EMUL_DT_GET macro. BRANCH=none BUG=b:241981636 TEST=twister -T ec/zephyr/test/ Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I0ed864eee0795465ed4d54d498199b95f7fddc62 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3821052 Reviewed-by: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: emul: emul_common_i2c: Disable read reg fail on initTomasz Michalec2022-08-091-0/+1
| | | | | | | | | | | | | | | | | | | Set read_fail_reg to I2C_COMMON_EMUL_NO_FAIL_REG on i2c_common_emul_init(). It should be there to make emulators working as the default state. This line of code was there before but was removed by mistake. BUG=None TEST=./twister -T zephyr/test/drivers BRANCH=None Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I3c037b6d357d9b54b773f79ba5be76ca26a0648b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3810443 Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com> Tested-by: Tomasz Michalec <tmichalec@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: emul: ps8xxx: Fix i2c_emul_register callTomasz Michalec2022-08-091-4/+3
| | | | | | | | | | | | | | | | | | The i2c_emul_register() function now takes only two arguments, starting from commit 59d9193df17f2de8e7dd075823c524183bf6f0de in the zephyr repository. PS8xxx emulator has to be aligned to new API. BUG=None TEST=./twister -T zephyr/test/drivers BRANCH=None Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I074e747ae3efb72f2ebf8bc5aa38f65fcf5cffb0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3810442 Tested-by: Tomasz Michalec <tmichalec@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* util: remove unused includesYuval Peress2022-08-051-1/+2
| | | | | | | | | | | | | | | | Remove these includes as they're not needed in this header. Instead, the includes should go where they're actually being used. BRANCH=none BUG=b:240574048 TEST=make buildall -j TEST=zmake build -a Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I64b10af3216654b2a20caa1cabd267661a0bca39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3791980 Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Tristan Honscheid <honscheid@google.com>
* zephyr: emul: drop i2c_label from emul configsFabio Baltieri2022-08-0513-17/+0
| | | | | | | | | | | | | | | This is not used anywhere and is causing problem with downstreaming since the label is being removed. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:3813331 Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I1b900670bde540a745648eb72e7801dec74272b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3811111 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: shim: add all missing include/ prefixesFabio Baltieri2022-08-047-7/+7
| | | | | | | | | | | | | | | Add all the missing include/ prefixes to the various #include around the zephyr tests so that they build with LEGACY_INCLUDE_PATH=n. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:3807663 Change-Id: I81cea4f291eea61e674ef2fa61bdc60407c5f142 Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3810411 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: emul: Use EMUL_DT_INST_DEFINEAbe Levkoy2022-08-0314-73/+71
| | | | | | | | | | | | | | | | Update the emulators to use EMUL_DT_INST_DEFINE and EMUL_DT_GET instead of EMUL_DEFINE and EMUL_REG_NAME, because the latter have been removed upstream. BUG=b:224588313 TEST=zmake testall BRANCH=none Cq-Depend: chromium:3806745 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: If358bd2bcfe9b99df0a671e2542a94deb5fad8f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3805535 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* Zephyr test: Store last 5V fixed source cap for referenceDiana Z2022-08-031-0/+11
| | | | | | | | | | | | | | | | The 5V fixed source cap may have a number of testable fields we'd be interested in, such as the power offered or static capabilities advertised. Store it for the tests to reference, and allow them to clear it when desired. BRANCH=None BUG=b:237256250 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic396be8ca30ba5f1a86c1da1fe60a7a4c66dbea1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3789837 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: test: isl923x: Fix finish i2c writeTomasz Michalec2022-08-021-0/+5
| | | | | | | | | | | | | | | | | Side effects of I2C write messages should be applied only after actual write message. Selecting register before an I2C read message isn't considered as a write message. BUG=None TEST=zmake -D test test-drivers BRANCH=None Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I95871d1b518c7211ff1e56b74598e7ba35358d41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3785335 Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: test: Migrate to upstream emulator APIAaron Massey2022-08-0118-648/+742
| | | | | | | | | | | | | | | | | Migrate the existing emulators and tests to use the new upstream emulator API. Majority of these changes was the removal of struct i2c_emul usages in favor of direct usages of struct emul. BRANCH=none BUG=b:240291860 TEST=zmake test -a Signed-off-by: Aaron Massey <aaronmassey@google.com> Cq-Depend: chromium:3776856 Change-Id: I09c509ffc34ac3b28fbd4dece0acebcc36cc0932 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3781964 Reviewed-by: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com>
* zephyr: Kconfig: use devicetree Kconfig symbolsFabio Baltieri2022-07-296-18/+12
| | | | | | | | | | | | | | | | Replace all instances of $(dt_compat_enabled, ...) with the equivalent auto-generated Kconfig symbols. BRANCH=none BUG=none TEST=zmake testall TEST=zmake build brya and diff the .config Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Cq-Depend: chromium:3776850 Change-Id: I3a86a934182d3277aab7e5a545a4ca2d5cfedfb0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3779894 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: rework i2c enumsDawid Niedzwiecki2022-07-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add additional enum that is created based on used I2C ports from devicetree. Use the new enums to create i2c enums listed in the named-i2c-ports node. The named-i2c-port enums that point to the same i2c port have the same value. The change should allow getting the i2c enum value from the named-i2c-ports node and the i2c port node(the node created by the chip vendor) alternately. It will be useful in process of moving usbc chips e.g. bc12 under the i2c bus, not in the named-usbc-port node. Since i2c enums using the same port have the same value, the i2c_physical_ports is no longer needed. The commit reduces the usage of memory a bit because I2C_PORT_COUNT is lower and initialization of i2c_physical_ports isn't needed. Also, change how the enum values are defined in the dts files. Only one node should be created per physical i2c port and define multiple enum values. BUG=b:228240586 TEST=zmake testall; make sure all i2c ports work BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I95c3f6845cfb71a69d408f33a6c7b22383f10028 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3763905 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
* emul: Remove DT_INST_BUS_LABEL(n) usageAaron Massey2022-07-1913-15/+15
| | | | | | | | | | | | | | | | | | | | | Zephyr upstream deprecated DT_BUS_LABEL(node_id) and DT_INST_BUS_LABEL(inst) macros causing a CQ build failure and blocking Zephyr downstreaming. Replace code occurrences of DT_INST_BUS_LABEL(inst) with DT_LABEL(DT_BUS(DT_DRV_INST(inst))). This macro was only used in emulators. BRANCH=none BUG=b:239447869 TEST=zmake test test-drivers # With breaking commit in downstreamed Zephyr Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: If745caeb1273c7e51331bd45b17dc28960c7f8da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3767857 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* zephyr: flash: drop the label propertyFabio Baltieri2022-07-181-3/+0
| | | | | | | | | | | | | Does not look like this was used anywhere. BRANCH=none BUG=b:239165779 TEST=zmake testall Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ia196dbea753f8790fd4e52a3ee505815ebd3afd5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3763910 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* test: Fix test_set_chipset_to_s0 flaky OD failureAaron Massey2022-07-141-0/+22
| | | | | | | | | | | | | | | | | | | The smart battery driver and other tests may change the smart battery "capacity" and "full capacity" parameters without resetting them. This can lead to bad state later on represented as flaky tests. Add a ZTEST_RULE to reset the capacity and full_capacity values to their defaults defined in devicetree after each test. BRANCH=none BUG=b:233103160 TEST=zmake test-drivers TEST=shuffle_test.sh Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: If7bfb364a0398b5121eb935e2394d0940e04f27f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3761216 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr/emul/tcpc/emul_ps8xxx.c: Format with clang-formatJack Rosenthal2022-07-071-4/+4
| | | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Tricium: disable Change-Id: Iea81aa4f4291eeb7489de760b2384102e3ed9df5 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3749525 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: Track number of DP entry attemptsAbe Levkoy2022-07-061-0/+4
| | | | | | | | | | | | | | | In the PD partner emulator, track the number of attempts by the TCPM to enter DisplayPort mode. This will support tests to verify that the TCPM does not retry DP mode entry forever. BUG=b:235984702 TEST=zmake testall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I3cae20a37610194b60cba3c26d4b84cefa58c415 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3733068 Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr/emul/tcpc/emul_tcpci.c: Format with clang-formatJack Rosenthal2022-07-061-75/+75
| | | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Tricium: disable Change-Id: Id9e097a5408ffed37baa93926219cb3e7ea94e64 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730703 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/emul/tcpc/emul_tcpci_partner_snk.c: Format with clang-formatJack Rosenthal2022-07-011-38/+35
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I1c26c944c7d4dd4401449244c763d16f9bd02e36 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730707 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/emul/emul_kb_raw.c: Format with clang-formatJack Rosenthal2022-07-011-1/+1
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ic45bcae0c25cb86efe934773ee9b38cb07f704c2 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730692 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/emul/emul_bma255.c: Format with clang-formatJack Rosenthal2022-07-011-158/+156
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Id9bcbf4a73816b3f04fc18d404a811faefbcf5e2 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730685 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/emul/emul_pi3usb9201.c: Format with clang-formatJack Rosenthal2022-07-011-14/+14
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I03b744dc2954361ad4a00755e5c7bf8799ccad23 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730695 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/emul/tcpc/emul_tcpci_partner_drp.c: Format with clang-formatJack Rosenthal2022-07-011-15/+13
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I1773982d45519b94b640910b8e0854f4833aacc6 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730705 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>