summaryrefslogtreecommitdiff
path: root/zephyr/test/drivers
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: test: Test 'flashread' console commandTristan Honscheid2023-02-151-0/+42
| | | | | | | | | | | | | | Test the operation, edge cases, and output formatting of the `flashread` console command BUG=None BRANCH=None TEST=./twister -s drivers/drivers.flash Change-Id: Ic572b4a34ebbe0436142b1214449944175af29f3 Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4224879 Reviewed-by: Tomasz Michalec <tmichalec@google.com>
* zephyr: test: Test 'flashwrite' console commandTristan Honscheid2023-02-151-0/+47
| | | | | | | | | | | | | Test operation and various edge conditions of `flashwrite`. BUG=None BRANCH=None TEST=./twister -v -i -c -s drivers/drivers.flash Change-Id: I02e90d020719b96c88c0a5b8ff1cb9bb83e853ca Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4224878 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* tasks: Add extra MAIN task idRob Barnes2023-02-151-9/+6
| | | | | | | | | | | | | | | | | | Add TASK_ID_MAIN as a non-shimmed extra task. This task is only present when CONFIG_TASK_HOSTCMD_THREAD_DEDICATED is enabled. Add get_hostcmd_thread and get_main_thread helper methods. The hostcmd thread will be the same as the main thread when CONFIG_TASK_HOSTCMD_THREAD_MAIN is enabled. BUG=b:267470086 BRANCH=None TEST=Unit tests Change-Id: If61dca427686a9c3cf6fb05dc5ca4e5a87b47127 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4214560 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: test: Test 'flasherase' console commandTristan Honscheid2023-02-142-17/+114
| | | | | | | | | | | | | | Test the operation of the `flasherase` console command and various edge cases BUG=None BRANCH=None TEST=./twister -v -i -c -s drivers/drivers.flash Change-Id: If81b82c5879e178c4d34c111eef61feed9be0904 Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4224877 Reviewed-by: Al Semjonovs <asemjonovs@google.com>
* zephyr: Fix YAML files to conform with upstream styleTristan Honscheid2023-02-141-2/+5
| | | | | | | | | | | | | | | | | cl:4177231 enabled YAML file linting for platform/ec/zephyr files based on upstream Zephyr's style but several of our YAML files do not currently conform. This CL has all the required corrections when running the linter on every YAML file. BUG=None TEST=util/zephyr_check_compliance.py modified to scan everything BRANCH=None Change-Id: I9dcf1d7f0c306028e4d6b368f20e88c882514169 Signed-off-by: Tristan Honscheid <honscheid@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4247159 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: test: Update RTC driver testSam Hurst2023-02-111-2/+15
| | | | | | | | | | | | | | | | Update RTC driver test to compensate for the additional second added alarm time returned by system_get_rtc_sec(). BUG=b:261377404 BRANCH=None. TEST=twister -T zephyr/test/drivers Change-Id: I7bca42195bdbb066d214173972bc777960609641 Signed-off-by: Sam Hurst <shurst@.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4241078 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Sam Hurst <shurst@google.com> Commit-Queue: Sam Hurst <shurst@google.com>
* zephyr/test: Unset CONFIG_ASSERT_TEST for driver testsRob Barnes2023-02-101-1/+3
| | | | | | | | | | | | | | | Unset CONFIG_ASSERT_TEST for driver tests. This flag will mask assert failures in tests. BUG=b:268638354 BRANCH=None TEST=Pass driver unit tests Change-Id: I2dff6e78fe62a9fce01b2079055008925de64203 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4240495 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr/test: Move console_cmd_crash to separate testRob Barnes2023-02-106-1/+19
| | | | | | | | | | | | | | | | The console_cmd_crash test needs CONFIG_ASSERT_TEST set. Moving console_cmd_crash to be stand alone under drivers so this flag is not polluting any other tests. BUG=b:268638354 BRANCH=None TEST=Pass driver unit tests Change-Id: I5ee5de583b61c77cc483d41dc32c5a4eb0bf9585 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4240330 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* tasks: Return TASK_ID_INVALID on errorRob Barnes2023-02-102-3/+18
| | | | | | | | | | | | | | | | | | Return `TASK_ID_INVALID` when `task_get_current` fails to find the current task instead of 0. 0 is a valid task id. `drivers.host_cmd_thread` test is also updated because it was dependent on this bug. By overriding `in_host_command_main` to return true when the fake main thread is running, `task_get_current` will return `TASK_ID_HOSTCMD` when the fake main thread is running. BUG=b:268477571 BRANCH=None TEST=Unit tests Change-Id: I2d5d6926cc9e2775a1c0e8141d760850bf25141b Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4240327 Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: move usbc interrupt handler to shimJason Yuan2023-02-099-15/+97
| | | | | | | | | | | | | | | | | | | TCPC interrupt no longer uses gpio-int. Instead the shim tcpc completely handles its own interrupt. An optional config is added to allow projects to use the legacy tcpc interrupt. The program intelrvp is excluded from this CL. BUG=b:254148652 TEST=twister, usbc charging on villager, lazor, and xivu BRANCH=none Change-Id: Ieeb4fb61ca6cf8f44df212a6cf520d265cff5147 Signed-off-by: Jason Yuan <jasonyuan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4108942 Commit-Queue: zhi cheng yuan <jasonyuan@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Obsolete AMODE commandsDiana Z2023-02-076-149/+28
| | | | | | | | | | | | | | | The AMODE host commands were created to support GFU mode, which we do not support in TCPMv2. Move these host commands to a TCPMv1 only file and remove references to them from the unit tests. BRANCH=None BUG=b:267562375 TEST=./twister -T ./zephyr/test Change-Id: I7bafcd8eded1f8eca4082560172aee91ebd7ff24 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4221975 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Gate DP module support on a CONFIGDiana Z2023-02-072-0/+121
| | | | | | | | | | | | | | | | | | | | | | | 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>
* raa489000: never report ACOK when sourcing VBUSPeter Marheine2023-02-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | This chip sometimes ACOK when sourcing VBUS because the ACOK status bit actually indicates whether VBUS is above approximately 3.6V and the charger is not overcurrent or over-temperature, though it also seems to report ACOK correctly when the port comes up as a source rather than going through a PRS. This change makes raa489000_is_acok return a correct value (not-OK) in all situations when sourcing VBUS. BUG=b:263691951,b:262663436 TEST=On Nivviks, `hibernate` now correctly hibernates following fast role swap from sink to source on port C0 (with C1 disconnected), where previously it refused to hibernate with the "AC on, skip hibernate" message. BRANCH=nissa Change-Id: I314988d7dfcc8b4d576224f934cd5dc693e7f54f Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4222772 Reviewed-by: Adam Mills <adamjmills@google.com> Reviewed-by: Arthur Lin <arthur.lin@lcfc.corp-partner.google.com>
* Revert "panic: Publish EC_HOST_EVENT_PANIC on panic"Rob Barnes2023-02-065-78/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 98e00bb45940f1cf31216a20c7441364d43fd8fb. Reason for revert: On MKBP based boards, host_set_single_event will result in a mutex lock, which will fail when inside the panic ISR. See b/267681436. Original change's description: > panic: Publish EC_HOST_EVENT_PANIC on panic > > Publish EC_HOST_EVENT_PANIC when a panic occurs. > > The kernel may use this event to clean up before the system is reset > (e.g. sync the drive). > > This will be a no-op if the kernel doesn't handle it. > > BUG=b:258195448 > BRANCH=None > TEST=Observe event in kernel. Pass panic_event unit test. > > Change-Id: I34b9847778bf17dd113e81158bbbdf999ad2ca33 > Signed-off-by: Rob Barnes <robbarnes@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4063818 > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Bug: b:258195448 Change-Id: I772ef77ec7e4661f1c98658b94e73941ad74d4f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4225911 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Ricardo Quesada <ricardoq@chromium.org> Commit-Queue: Rob Barnes <robbarnes@google.com> Auto-Submit: Rob Barnes <robbarnes@google.com>
* zephyr: test: Unmask Accept message after PRS testAbe Levkoy2023-02-011-0/+3
| | | | | | | | | | | | | | | | After changing how the partner handles Accept for a Power Role Swap test, restore the default behavior. Avoid disturbing future tests that depend on the partner receiving Accept. BUG=b:267369382 TEST=twister -s zephyr/test/drivers/drivers.default (with DRS test) BRANCH=none Change-Id: I5ed3eee62889f321d1350f3f2ee763d1b5f0f781 Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4211270 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Commit-Queue: Al Semjonovs <asemjonovs@google.com>
* zephyr: emul: update EMUL_DT_INST_DEFINE API usageFabio Baltieri2023-01-271-1/+1
| | | | | | | | | | | | | | | | | Update various instances of the EMUL_DT_INST_DEFINE to set the extra argument introduced in: 6062914cf2 emul: Add support for backend APIs BRANCH=none BUG=none TEST=./twister Cq-Depend: chromium:4200298 Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I2bcec5786e78840fd552dcbde1b50f6941a23f05 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4188744 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr/test: Fix TYPEC_VDM_RESPONSE paramstabilize-15329.59.B-mainstabilize-15329.44.B-mainrelease-R111-15329.B-mainCaveh Jalali2023-01-261-1/+1
| | | | | | | | | | | | | | | | The EC_CMD_TYPEC_VDM_RESPONSE host command takes a 'struct ec_params_typec_vdm_response' as input, not 'struct ec_params_typec_status'. These structs are identical, so no functional change is introduced. BRANCH=none BUG=b:258110734,b:208884535 TEST='./twister -v -T zephyr/test' passes Change-Id: I583ed1b24eadf7cd3e4c751346337525342d4327 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4195665 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* TCPMv2: Clear DPM state on disconnectDiana Z2023-01-251-0/+61
| | | | | | | | | | | | | | When a partner disconnects, clear the DPM state so stale data from it won't be presented to the AP. BRANCH=None BUG=b:208884535 TEST=./twister -T ./zephyr/test Change-Id: Idf800b6c5c223e67c72c2124fb111fad27ce6361 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4179363 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Test: Add test for VDM:Attention deliveryDiana Z2023-01-251-0/+247
| | | | | | | | | | | | | | Add unit tests to ensure we deliver VDM:Attention properly up to the AP with messages in the correct order. BRANCH=None BUG=b:208884535 TEST=./twister -T ./zephyr/test Change-Id: I922b391e6d2fb9c969063be2b8d2e492fe8e74b3 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4171492 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Rearrange VDM response HC contentsDiana Z2023-01-252-14/+10
| | | | | | | | | | | | | | | | | | The AP would like to consume VDM:Attention packets in the same host command as the VDM responses. To support this, pull the previous return error into a response structure field instead. Also correct an incorrect struct for the VDM response test utility (though it is functionally equivalent to the TYPEC_STATUS struct). BRANCH=None BUG=b:208884535 TEST=./twister -T ./zephyr/test Change-Id: I5d976dda6be40b72de15e84f4bbd9311d908a904 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4171489 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* tcpci: allow get_chip_info callers to update the cachePeter Marheine2023-01-222-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some drivers massage retrieved chip info in assorted ways (usually because the chips misbehave), but it's both confusing and inefficient how that interacts with cached chip info because the consuming driver needs to always interpose itself between possibly-cached values and its caller, usually requiring another layer of caching. This adds a new tcpci_get_chip_info_mutable() function that works like tcpci_get_chip_info(), but the caller can provide a function that modifies the cached data in order to do any required massaging. A callback is used rather than an output pointer to give the implementation freedom to change its behavior more, such as by adding locking to prevent the latent concurrency bugs that currently lurk in it. This also fixes a bug in the previous implementation where partial data would be cached if an error occurred in reading certain TCPC registers. BUG=b:244502337 TEST=make buildall; zmake build -a; twister BRANCH=none Change-Id: Ia3dcac109eb22bf0326e3fd1722aa64fe9f73f50 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4179431 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr/test: Add EC_CMD_GET_NEXT_EVENT V2 coverageCaveh Jalali2023-01-201-0/+58
| | | | | | | | | | | | | | | | | Add coverage for the EC_CMD_GET_NEXT_EVENT V2 host command. This version is essentially identical to the V0 version but uses a bit in ec_response_get_next_event.event_type for the EC_MKBP_HAS_MORE_EVENTS flag. The test focuses on whether the bit is set as expected. BRANCH=none BUG=b:249163956 TEST='./twister -v -T zephyr/test' passes Change-Id: I067070638c45ed79ff46b8ad4cca305aa491e66b Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4183343 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/test: Add EC_CMD_USB_PD_DEV_INFO coverageCaveh Jalali2023-01-207-0/+73
| | | | | | | | | | | | | | | | | Add rudimentary coverage for the EC_CMD_USB_PD_DEV_INFO host command. This is a host command used to interact with PD chips (TCPCs) running cros EC code. These are only found on very old hardware and are not really supported any more. BRANCH=none BUG=b:258110734 TEST='./twister -v -T zephyr/test' passes 'make buildall' passes Change-Id: I96e704d521fc569d31d03dcdc588727da1f11951 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4176178 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Test: Correct SVDM versions in AP VDM testDiana Z2023-01-191-13/+26
| | | | | | | | | | | | | | | Correct the SVDM versions which our VDMs use in this test. Since the port partner is PD 3.0, they should be using SVDM version 2.0. BRANCH=None BUG=None TEST=./zephyr -T ./zephyr/test Change-Id: I9643816be0aa3b673a57abc5a8154b0f15b18059 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4179362 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* shim/src/watchdog: Add support for watchdog helperPatryk Duda2023-01-191-16/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Watchdog helper is used to print a warning along with useful debugging information before hardware watchdog will reset SOC. Zephyr provides counter based watchdog which is very similar to watchdog helper from EC. This patch adds support for using multiple watchdogs simultaneously. One of the watchdogs will be counter based, the other will be hardware based (e.g. IWDG on STM32). Watchdog tests was modified to address the problem with allocating new counter channel every time watchdog_init() is called while there is no way to free them. BUG=b:239712345 BRANCH=none TEST=Add 'zephyr,counter-watchdog' node to DTS. Use 'waitms' command to check if a warning from watchdog based counter is triggered. TEST=./twister -i -T zephyr/test/drivers \ --test external/platform/ec/zephyr/test/drivers/drivers.default Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I66b5474d7e65978791450c2fd62dd3d345cd474a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4116769 Tested-by: Patryk Duda <patrykd@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* tcpci: handle tcpc tx discarded eventScott Chao2023-01-181-3/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | In Revision 2.0, Version 1.3 USB Type-C® Port Controller Interface Specification 4.7.1. If the transmission was discarded due to an incoming received message, the TCPC sets the TransmitSOP*MessageDiscarded bit in the ALERT register. In the old process, TCPM will always send soft reset if TCPC did not set TransmitSOP*MessageSuccessful. It will cause the pending message be cleared. For example, when TCPC get ATTENTION from USB-C dock and TCPM send GET_SINK_CAP to TCPC at the same time. The TCPC will set TransmitSOP*MessageDiscarded and TCPM will send soft reset and cause TCPM did not get ATTENTION message. BUG=b:265247056 BRANCH=none TEST=make sure dock can display. TEST=make buildall TEST=./twister -v -T zephyr/test Change-Id: I2597894c1f7abceea3c352ba1066d270d2d01ba0 Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4160814 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr:test: Correct port80 suite nameAl Semjonovs2023-01-181-1/+1
| | | | | | | | | | | | | | | ZTEST suite for port80 console command went to port80 host command suite. Correcting for console command suite. BUG=None BRANCH=NONE TEST=./twister -c -T zephyr/test Change-Id: I3e31a8a9d92f1dcc0402981b9cdf4551f05b18c3 Signed-off-by: Al Semjonovs <asemjonovs@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4178238 Commit-Queue: Tristan Honscheid <honscheid@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* TCPMv2: Add SOP minor revision to EC_CMD_TYPEC_STATUSJameson Thies2023-01-181-0/+18
| | | | | | | | | | | | | | | | | | | | EC_CMD_TYPEC_STATUS is used to send data about USB-C partners and cables to the kernel where it can then be exposed to userspace. Currently, EC_CMD_TYPEC_STATUS only assigns major PD revision to sop_revision causing the minor revision to appear as "0" regardless of the devices actual minor PD revision. This CL adds minor revision assignment to EC_CMD_TYPEC_STATUS so that it can be correctly reported by the kernel. BUG=b:261736720 BRANCH=None TEST="cat /sys/class/typec/port0-partner/usb_power_delivery_revision" for USB PD 2.0, 3.0 and 3.1 devices. Signed-off-by: Jameson Thies <jthies@google.com> Change-Id: I8c1858d6e6d577628b373d16f9aabdfd15a0e3c4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4163826 Reviewed-by: Diana Z <dzigterman@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr/test: test_shim_rtc: Fix EC_CMD_RTC_GET_* responseCaveh Jalali2023-01-181-2/+2
| | | | | | | | | | | | | | | | The EC_CMD_RTC_GET_* host commands return a 'struct ec_response_rtc' not 'struct ec_params_rtc'. These structs are identical, so no functional change is introduced. BRANCH=none BUG=b:258110734 TEST='./twister -v -T zephyr/test' passes Change-Id: I077d3114a54cd3445dd39ebf49ae493a4927fbd3 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4171499 Reviewed-by: Boris Mittelberg <bmbm@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr/test: host_event_commands: Fix EVENT_CLEAR testsCaveh Jalali2023-01-181-9/+5
| | | | | | | | | | | | | | | | | | The EC_CMD_HOST_EVENT_CLEAR* host commands do not return data. Remove code for handling nonexistent return data. Next, make host_event_mask_cmd_helper() static since it's not used outside this file and signature has changed. BRANCH=none BUG=b:258110734 TEST='./twister -v -T zephyr/test' passes Change-Id: Id101dc5c52110eca581da544e78cf9f0605f6698 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4171498 Reviewed-by: Boris Mittelberg <bmbm@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr/test: keyboard_scan: Fix MKBP_SIMULATE_KEY testCaveh Jalali2023-01-181-6/+4
| | | | | | | | | | | | | | | | The EC_CMD_MKBP_SIMULATE_KEY host command does not return data. Remove code that sets up a 'struct ec_response_keyboard_factory_test' as the return parameter. BRANCH=none BUG=b:258110734 TEST='./twister -v -T zephyr/test' passes Change-Id: Iac1a95453e612b384e22b0cf99812a134b18e378 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4171497 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com>
* zephyr: Increase deadline on console_cmds testJeremy Bettis2023-01-181-0/+2
| | | | | | | | | | | | | | | | | | | | | The test timed out in postsubmit: https://ci.chromium.org/p/chromeos/builders/postsubmit/firmware-zephyr-cov-postsubmit/10089 Increase test timeout to 3 minutes. BRANCH=None BUG=None TEST=./twister --test external/platform/ec/zephyr/test/drivers/drivers.default.console_cmds Change-Id: I7f0f680041f0c192df0f8a2f7314a6fcb03be027 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4175417 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Al Semjonovs <asemjonovs@google.com> Commit-Queue: Al Semjonovs <asemjonovs@google.com>
* zephyr: test: ps8xxx: Test cache for multiport boardsJason Yuan2023-01-178-3/+144
| | | | | | | | | | | | | | | | | | | | A new test suite for multi-ps8xxx-port boards is created. A test is implemented for the cache of firmware version for multiple ps8xxx ports to be unique. BUG=b:261874683 TEST=twister BRANCH=none Change-Id: I4b540919dca7ffc4fe8109ba1cf10b828341bc30 Signed-off-by: Jason Yuan <jasonyuan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4175412 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: zhi cheng yuan <jasonyuan@chromium.org> Commit-Queue: zhi cheng yuan <jasonyuan@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Sam Hurst <shurst@google.com> Auto-Submit: zhi cheng yuan <jasonyuan@chromium.org>
* zephyr: fix all yaml files indentationsFabio Baltieri2023-01-171-3/+3
| | | | | | | | | | | | | | | | | | | | Zephyr upstream now has a yamllint configuration and presubmit check: https://github.com/zephyrproject-rtos/zephyr/blob/main/.yamllint This is a pass on our yaml files to make them compliant with the upstream config, final pass just with the indentation errors. BRANCH=none BUG=none TEST=yamllint -f parsable -c ~/zephyr/.yamllint $( find -regex '.*\.y[a]*ml' ) TEST=zmake compare-builds --ref1 main --ref2 HEAD -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I3ccebebddf803b0fd79a1a980a19e25f204b0bb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4154895 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: reformat yaml files to comply with Zephyr yamllintFabio Baltieri2023-01-171-4/+8
| | | | | | | | | | | | | | | | | | | | Zephyr upstream now has a yamllint configuration and presubmit check: https://github.com/zephyrproject-rtos/zephyr/blob/main/.yamllint This is a pass on our yaml files to make them compliant with the upstream config, handled all checks but the indentation ones. BRANCH=none BUG=none TEST=yamllint -f parsable -c ~/zephyr/.yamllint $( find -regex '.*\.y[a]*ml' ) TEST=zmake compare-builds --ref1 main --ref2 HEAD -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I664738cf4777e6f03d4ac2a19a5100e326a386fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4154894 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: Add coverage for gpio-keys power_button.cAl Semjonovs2023-01-173-1/+25
| | | | | | | | | | | | | | | | | | Enable gpio-keys power button to exercise tests for board specific code. BUG=None BRANCH=NONE TEST=zmake build --coverage herobrine ./twister -v -i --coverage -p native_posix -p unit_testing genhtml -q -s --branch-coverage -o build/zephyr/coverage_rpt/ twister-out/coverage.info build/zephyr/herobrine/output/zephyr.info Change-Id: I79901e458f1e7fc48806779b05e80cc58a5a83e5 Signed-off-by: Al Semjonovs <asemjonovs@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4159985 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr:test: Split console command tests into its own suite.Al Semjonovs2023-01-175-41/+57
| | | | | | | | | | | | | | | | Create a new test suite for console commands. Current default test suite takes excessive time to complete leading to increasing the timeout times. BUG=None BRANCH=None TEST=./twister -T zephyr/test Change-Id: Idb453b0b8f7cc9a61265ac287310772f1b8f24a2 Signed-off-by: Al Semjonovs <asemjonovs@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4159984 Reviewed-by: Simon Glass <sjg@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* flash: allow zero num_banks_desc in flash_info requestTing Shen2023-01-161-0/+26
| | | | | | | | | | | | | | | | | | | | | | | Some external tools (e.g. flashrom) sends EC_CMD_FLASH_INFO with num_banks_desc=0 to get the total number of banks. EC should allow this type of request. Also add a test to cover this use case. BUG=b:265472751 TEST=1) `flashrom -p ec -w <ec.bin>` on tentacruel 2) ./twister -T zephyr/test/drivers/ \ --sub-test drivers.flash.page_layout 3) ./twister -T zephyr/test/drivers/ --sub-test drivers.flash BRANCH=none Change-Id: Iab97ac754bac87067f949cf9435156be91b07ebc Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4167539 Tested-by: Chen-Tsung Hsieh <chentsung@chromium.org> Reviewed-by: Patryk Duda <patrykd@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Patryk Duda <patrykd@google.com>
* zephyr: make the test emulator's PD revision configurableJameson Thies2023-01-131-0/+3
| | | | | | | | | | | | | | | | This CL updates the tcpci partner emulator to have an internal variable define how it responds to Get_Revision, instead of hardcoding it's RMDO to 0x31000000 (USBPD 3.1). BUG=b:236868370 BRANCH=None TEST=./twister -p native_posix -p unit_testing Signed-off-by: Jameson Thies <jthies@google.com> Change-Id: Ib212383ce2a29c87f7284a971b2ad96cce6b68c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4159990 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: Test all ports for correct pd informationJason Yuan2023-01-131-4/+6
| | | | | | | | | | | | | | | | | pd_chip_info is tested for all ports instead of just port 0. BUG=b:261874683 TEST=twister BRANCH=none Change-Id: I338af9781539cd1fe325410d085593832f776120 Signed-off-by: Jason Yuan <jasonyuan@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4159971 Auto-Submit: zhi cheng yuan <jasonyuan@chromium.org> Tested-by: zhi cheng yuan <jasonyuan@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* syv682x: cached force discharge configEric Yilun Lin2023-01-131-2/+10
| | | | | | | | | | | | | | | | | | | | syv682x vbus discharge function is getting called from ppc_dev_is_connected to reset the discharge config many times. We cached the force discharge config to reduce the i2c traffics on IT81202 i2c ports. BUG=none TEST=i2c traffic reduces. FRS is working. BRANCH=none Change-Id: Iebae413d8f6621b8c99dc28c744220f54d420062 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4160813 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* Default charger current derating to 5%Peter Marheine2023-01-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not derating seems like a common pitfall that can cause problems with some chargers, so set a reasonably conservative default. 5% is chosen as the most common derating factor used among boards today (counting occurrences in source code, so this may undercount 5% occurrences because several projects set 5% at the project rather than board-level): 1. 38 x 5% 2. 23 x 4% 3. 6 x 10% 3. 2 x 3% 4. 1 x 2% Boards that currently configure this setting are modified only to continue building without warnings regardless of whether they use the new default value in order to signal that they were explicitly configured. BUG=b:260774380 TEST=make buildall / zmake build -a BRANCH=none Change-Id: I017849d38572fbc48090ae1fa2c539b808e426f9 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4109651 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: enable Kconfig based on the devicetree - motionsenseMichał Barnaś2023-01-121-1/+0
| | | | | | | | | | | | | | | This commit adds automatic selection of required Kconfig options based on the device tree nodes for module: motionsense BUG=b:251812799 BRANCH=main TEST=run twister and zcompare script Change-Id: Icbe3f6b503d803a8d75e17c5eb73993d6be8501c Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3982648 Reviewed-by: Wai-Hong Tam <waihong@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: enable Kconfig based on the devicetree - keyboardMichał Barnaś2023-01-121-1/+0
| | | | | | | | | | | | | | | This commit adds automatic selection of required Kconfig options based on the device tree nodes for module: keyboard BUG=b:251812799 BRANCH=main TEST=run twister and zcompare script Change-Id: I7efb4ed68b475b62d5a399d0f68d2b9e0f1c1bf4 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3982647 Reviewed-by: Yuval Peress <peress@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* battery: extend BATTERY_GET_STATIC hostcmd for 32-byte stringsPeter Marheine2023-01-121-0/+31
| | | | | | | | | | | | | | | | | | | | | | | The Smart Battery Specification defines a string as up to 31 characters, and nissa project has encountered some batteries where the existing 11-character strings for v1 of BATTERY_GET_STATIC are insufficient to differentiate some batteries that can be used on a given device. This change adds a new version of this host command that extends the strings fields to each accommodate up to 31 characters of data, which should be enough to support all smart batteries compliant with the latest version of the specification. BUG=b:263920422 TEST=`ectool battery` with updated ectool works on Nereid and uses the new hostcmd version. If EC support for v2 or v1 is disabled, older command versions are used. BRANCH=nissa Change-Id: Ia6a3a917051d5e641e7d38ef6936ec7174cb8aab Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4150669 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr/test/drivers/flash: Add flash bank API testsPatryk Duda2023-01-112-0/+106
| | | | | | | | | | | | | | | | | | | | | | Introduce unit tests for functions that implement basic API for operating on information about flash sectors. Tests are run only when CONFIG_PLATFORM_EC_USE_ZEPHYR_FLASH_PAGE_LAYOUT is enabled. BUG=b:239712345 BRANCH=none TEST=./twister -v -i -T zephyr/test/drivers/ --test external/platform/\ ec/zephyr/test/drivers/drivers.flash.page_layout Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I6e1a37e7137b49983fc3447ebdc9fff73df43458 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4110952 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Tested-by: Patryk Duda <patrykd@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Patryk Duda <patrykd@google.com>
* zephyr/test/drivers: Add flash page layout test variantPatryk Duda2023-01-112-20/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce drivers.flash test variant with CONFIG_PLATFORM_EC_USE_ZEPHYR_FLASH_PAGE_LAYOUT enabled. If the option is enabled, we use Zephyr's flash page API to get information about flash sectors, sizes, etc. instead of providing these information in EC. Since the API provides flash sector description, we only support flash info version 2 host command. Also output from "flashinfo" command is slightly different. BUG=b:239712345 BRANCH=none TEST=./twister -v -i -T zephyr/test/drivers/ --test external/platform/\ ec/zephyr/test/drivers/drivers.flash.page_layout Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I1f459232f6bc1c786e8c16bf2537f68229b90862 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4118762 Reviewed-by: Bobby Casey <bobbycasey@google.com> Commit-Queue: Patryk Duda <patrykd@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Patryk Duda <patrykd@google.com>
* SBS: Make battery_get_params clear flags selectivelyDaisuke Nojiri2023-01-101-0/+17
| | | | | | | | | | | | | | | | | | | | | | | Currently, battery_get_params clear all flags in batt.flags. This patch makes the function clear only the flags which are explicitly set or unset by battery_get_params. With this change, the charger task can add a flag to batt.flags. There isn't yet functionality change by this patch. BUG=b:263921114 BRANCH=None TEST=run-battery_get_params_smart run-sbs_charging_v2 TEST=./twister -i --toolchain host -s \ external/platform/ec/zephyr/test/drivers/drivers.default Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I5708ab6de81bc0a7c28961b13960fd89460b2e1c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4136966 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Bob Moragues <moragues@chromium.org>
* zephyr: Reset battfake after every testDaisuke Nojiri2023-01-091-1/+7
| | | | | | | | | | | | | | | | This patch makes smart battery tests disable battfake after each test. BUG=None BRANCH=None TEST=./twister -i --toolchain host -s \ external/platform/ec/zephyr/test/drivers/drivers.default Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I1869fa848fcd52d1ea8731d256fb3b72e741e51f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4143800 Commit-Queue: Tristan Honscheid <honscheid@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* zephyr/test/drivers: add it8xxx2_hw_sha256 testDino Li2023-01-065-0/+62
| | | | | | | | | | | | | | | | Verify that the hardware sha256 registers are configured as we want. BRANCH=none BUG=b:263259072 TEST=./twister -v -T zephyr/test/drivers/ \ --test external/platform/ec/zephyr/test/drivers/drivers.it8xxx2_hw_sha256 ./twister -v -i -T zephyr/test/drivers Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ie0c92f0fbdf709c1d1776a0fefe27bc6756d64d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4127644 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>