summaryrefslogtreecommitdiff
path: root/zephyr/CMakeLists.txt
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: remove disable of position independent codeKeith Short2023-04-261-1/+0
| | | | | | | | | | | | | | | | Zephyr by default does not create position independent code. Remove references that added compiler specific flags to disable position independent code. BUG=none BRANCH=none TEST=zmake compare-builds -a TEST=twister Change-Id: Ia85ec4a5767a42951c8ec4fa0513eb1578607bef Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4477707 Reviewed-by: Yuval Peress <peress@google.com>
* zmake: Use CONFIG_COMPILER_WARNINGS_AS_ERRORSKeith Short2023-04-261-6/+0
| | | | | | | | | | | | | | | | | Zephyr provides the Kconfig option COMPILER_WARNINGS_AS_ERRORS to automatically treat warnings as errors. Use this Kcoonfig in place of an EC specific Cmake option. BUG=none BRANCH=none TEST=zmake build skyrim. Confirm compiler options enable "-Werror" TEST=zmake build skyrim --allow-warnings. Confirm compiler options don't include "-Werror" Change-Id: I9ea85928a9125472bbf00bac6ee452b4ab97fdf9 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4451647 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* retimer: Add driver for ANX7452 retimerMadhurima Paruchuri2023-04-121-0/+2
| | | | | | | | | | | | BUG=b:267589042 BRANCH=None TEST=./twister -s drivers/drivers.anx7452 -c --coverage Change-Id: I99be488d82a58a5d38a2afcef0966b9c3236074d Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4226575 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* Zephyr: Add NX20P3481 CONFIGDiana Z2023-04-071-0/+2
| | | | | | | | | | | | | Add a configuration for the now lesser-used NX20P3481 chip. BRANCH=None BUG=b:276468569 TEST=CQ+1 Change-Id: I28c2cc4821e4e456571bfb5584fa746845c9a750 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4404284 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: add checks for duplicate GPIOsKeith Short2023-03-301-0/+16
| | | | | | | | | | | | | | | Add a check of the final devicetree generated, verifying that there are no duplicate GPIOs specified. BUG=b:271135255 BRANCH=none TEST=Add duplicate GPIO to rex and verify build fails. TEST=zmake configure -a Change-Id: Ie5be0d450ba53d6c67a87bc7216f38552576e862 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4368546 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* common: Move pse driver into driver placeDavid Huang2023-03-201-0/+2
| | | | | | | | | | | | | | Since there are more projects using this driver. Move it into driver place. BUG=b:273191751 BRANCH=None TEST=make buildall -j Change-Id: I50e2cb480a551ce19722edc2b6f70824f4b9147e Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4335461 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr/Kconfig: add detachable base supportTing Shen2023-03-101-0/+2
| | | | | | | | | | | | | BUG=b:272439221 TEST=enable these config on geralt and build ec BRANCH=none Change-Id: I2acbd499ff26ef38ea8e0919cab2e95f8a5450b4 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4327718 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Tested-by: Ting Shen <phoenixshen@chromium.org>
* TCPMv2: Create a HPD GPIO moduleDiana Z2023-03-091-0/+2
| | | | | | | | | | | | | | | Create a module to track the HPD transmission to the AP through a GPIO. This way, any implementations which use the HPD GPIO but otherwise do not use the DP module can still have access to this bit setting. BRANCH=None BUG=b:266714542 TEST=./twister -T ./zephyr/test Change-Id: Ifcc3ec11485143e3c70ae02f04a6d0240187554f Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4218925 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMV2: Create AP VDM control moduleDiana Z2023-03-091-0/+2
| | | | | | | | | | | | | | | The AP VDM control code has gotten large enough it warrants its own module within the USB-C code. For boards which do not use this module, handy stubs are defined in its header to fascilitate linking. BRANCH=None BUG=b:266714542 TEST=./twister -T ./zephyr/test Change-Id: I3fe787a5d6e33c8cd18460a401879f4903bcfba3 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4218924 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* system: Introduce Memory Dump Host CommandsRob Barnes2023-03-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Add memory dump host commands and memory dump backend. These commands allow the host to fetch metadata about the coredump and fetch the actual coredump data. Host command payloads are limited to <256 byts on many platforms, so these commands are structured to work around this limitation. These commands do not allow fetching arbitrary memory. Each memory dump region must be explicitly registered for dumping before the host may fetch it. BUG=b:263250131 BRANCH=None TEST=Passing memory_dump_hostcmds unit test ectool memory_dump outputs memory dump. Change-Id: Iebddc2c1a65d741d3e7e5936bd6156647f193dc6 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4117923 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: enable elan touchpad driverTing Shen2023-03-031-0/+2
| | | | | | | | | | | | | | | | This CL enables the Elan touchpad driver and touchpad task on zephyr EC, with minimal changes to make the code compilable. BUG=b:269989432 TEST=Add a touchpad node on krabby and verify it buildable. BRANCH=none Change-Id: I4b723ed2230f54d3dc597cdc30605fcfa4d4e0a3 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4149991 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com>
* TCPM: Divorce v1 and v2 alternate mode handlingDiana Z2023-02-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Retire the common DFP mode support to the TCPMv1 specific module from whence it came. Since TCPMv1 does not support TBT, all TBT functions can be removed from its copy. Move the DFP support for TCPMv2 to the DPM and its modules. Note that the reduced redundancy in tracking active alternate modes means that we can remove the majority of the "generic" mode handling. This results in approximately 1k additional free flash space for boards. For now, leave the svdm_dp_* interfaces in place as boards are using them as entry points to modify the DP mode sequencing. Also leave a stripped down version of pd_dfp_exit_mode() in place, though this would be worth consolidating to a new API in the future. BRANCH=None BUG=b:170372521,b:159856063 TEST=all unit tests passing, confirm display works on nipperkin (ECOS) and skyrim (zephyr) boards, USB4 and TBT regression tested on skolas LOW_COVERAGE_REASON=b/243151272 filed for improving TBT coverage, common/mock files no longer relevant Change-Id: Idbe59bc7c6a0ab6103e8fa158e69275a142f8a16 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4211277 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* power/amd_x86: Add support for STB dumpingRobert Zieba2023-02-161-0/+2
| | | | | | | | | | | | | | | | Skyrim supports dumping the contents of the SoCs smart-trace buffer when triggered externally. The contents of the STB can be useful in debugging S0i3 suspend failures. Add support for triggering an STB dump when the SoC hangs during S0i3 entry/exit. BRANCH=none BUG=b:246770811 TEST=Ran on skyrim DUT Change-Id: Ie18c6072a77f6dd306a46d7f76bd345b4f9e75a7 Signed-off-by: Robert Zieba <robertzieba@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4220248 Reviewed-by: Diana Z <dzigterman@chromium.org>
* mt8188: add notes about mt8186 code reuseEric Yilun Lin2023-02-131-0/+1
| | | | | | | | | | | | | | | | | | | Add comments for indicating the reuse of the mt8186 code on mt8188 platform. BUG=b:267268982 TEST=zmake build BRANCH=none Change-Id: I026071eec35fa0bd999c1c1642f1c15065712a7f Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4243819 Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Fei Shao <fshao@chromium.org> Reviewed-by: Fei Shao <fshao@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* power/mt8186: support mt8188 power sequenceEric Yilun Lin2023-02-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MT8186 and MT8188 chipset have similar power sequence, so we re-use the mt8186.c. Add power signal EN_PP4200_PG_S5, which controls the PP4200 rail and which is PMIC's VCC. We turn it on/off at S5->S3/S3->S5. Also, drop cros-ec support, which is not used. BUG=b:267268982 TEST=* 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:9.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 BRANCH=none Change-Id: I76bf3e4c4352982132e37bf952c29c4fce60f630 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4219278 Commit-Queue: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* TCPM: Separate Discovery into its own moduleDiana Z2023-02-071-0/+2
| | | | | | | | | | | | | | | | | | | | Discovery can be a separate feature from DFP mode entry, as any data role can run discovery in PD 3.0. Additionally, boards may want to enable discovery separate from full EC mode entry so put this feature behind a new CONFIG indicating its scope. BRANCH=None BUG=b:266714542 LOW_COVERAGE_REASON=only moving functions to a new file, b/267964449 filed to track expanding the testing of these functions later TEST=./twister -T ./zephyr/test, run on both nipperkin (ECOS) and skyrim (zephyr) to confirm cable and device identities are being reported correctly Change-Id: I84a08eaf4775ed427112d62777ff38f8a914a750 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4211268 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Gate DP module support on a CONFIGDiana Z2023-02-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Zephyr : Add PS8811 to build.Logan_Liao2023-02-031-0/+2
| | | | | | | | | | | | | | | | This patch add PS8811 retimer zephyr driver code. BUG=b:263458745 BRANCH=none TEST=zmake build frostflow success. Change-Id: I74faa235bb0a84b4e5d140af2e7a0c45e02f91a7 Signed-off-by: Logan_Liao <Logan_Liao@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4207168 Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Logan Liao <logan_liao@compal.corp-partner.google.com>
* Zephyr: Add configs for F75303matt_wang2023-01-301-0/+2
| | | | | | | | | | | | | | | | | | The F75303 driver needs a Kconfig, and needs to build in zephyr. Add support to the device tree parsing and definition for the F75303 i2c temperature sensors. LOW_COVERAGE_REASON=no emulator for the F75303. b:266089368 BUG=b:262409595 BRANCH=none TEST=build the project that using the F75303 success.(mushu nami markarth) Change-Id: Id769718fbcda3e4213c50c90c9c7918bc0a31a43 Signed-off-by: matt_wang <matt_wang@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4142061 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Chao Gui <chaogui@google.com> Reviewed-by: Chao Gui <chaogui@google.com>
* it8xxx2: add hw sha256Dino Li2022-12-201-0/+2
| | | | | | | | | | | | | | | | | | | IT8XXX2 HW support sha256 calculation, and its calculation is faster than FW. Now, we add it. BUG=b:242474986 b:260762509 BRANCH=none TEST=on nereid and tentacruel enable software sync: EC calculate RW sha256 and the result is same with cr50, then jump to RW. LOW_COVERAGE_REASON=sha256 unit test not yet implemented. Disallow-Recycled-Builds: all Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I9060ae1c8f867b8e61ce781e2e14795af7f5636d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4037230 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: adc: add a dedicated NAMED_ADC_CHANNELS optionFabio Baltieri2022-12-191-1/+1
| | | | | | | | | | | | | | | | | | | | | Add a dedicated NAMED_ADC_CHANNELS option to decouple the platforms setting from the Zephyr ADC one. This allows running tests for code that uses only the Zephyr APIs without having to define named channels as well. Also allows dropping some #if guards that made no sense since they were guarding a data structure used outside of the guard. BRANCH=none BUG=none TEST=cq dry run TEST=zmake compare-builds -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I4193a8c41d3bfd684ec03407eee57660aba2c56c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4111644 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Sam Hurst <shurst@google.com>
* ec: Support logging system boot time infoRajesh Kumar2022-12-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL add support logging system boot time and hostcommand to get boot time info. EC logs elapsed time (in micro second) info since boot for different signal events,that can be used to calculate system boot time in cold boot and warm boot scenarios. Below are the events when EC logs time info ARAIL EC turns on A-RAIL RSMRST EC releases RSMRST# ESPIRST ESPIRST received PLTRST_LOW PLTRST# asserted PLTRST_HIGH PLTRST# deasserted EC_CUR_TIME EC current time cnt increments on every warm reboot and reset to 0 on cold reboot BUG=b:249163956 BRANCH=none TEST='ectool boottime' AP console command is used to fetch data 'reboot' on AP console to trigger warm reboot 'apshutdown' on EC console to trigger cold reboot Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: I47abe3f8a0b7ab43f2af11bf8387c006ba383020 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4081566 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Li-Yu Yu <aaronyu@google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com>
* system: Implement system safe modeRob Barnes2022-12-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | Basic implementation of system safe mode recovery. System safe mode is a recovery mode that may be started after a fault/panic. It allows the AP to collect info about the fault and system state before the system resets This CL includes support for Zephyr EC and legacy CrOS EC BUG=b:249128225 BRANCH=None TEST=./twister -s external/platform/ec/zephyr/test/rw_safe_mode/rw_safe_mode.default Manually tested on skyrim Change-Id: I15139bb082011485b54e4ca7813839940bf5401a Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4029604 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* Revert "ec: Support logging system boot time info"Piotr Pawliczek2022-12-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit c8325ba18b9f4d5b1f3f3bc739e83d8f591308cf. Reason for revert: broke at least 9 cq builds (https://ci.chromium.org/ui/p/chromeos/builders/cq/cq-orchestrator/b8795833246203447793/overview) Original change's description: > ec: Support logging system boot time info > > This CL add support logging system boot time and hostcommand to get > boot time info. > EC logs elapsed time (in micro second) info since boot for different > signal events,that can be used to calculate system boot time in cold > boot and warm boot scenarios. > > Below are the events when EC logs time info > > ARAIL EC turns on A-RAIL > RSMRST EC releases RSMRST# > ESPIRST ESPIRST received > PLTRST_LOW PLTRST# asserted > PLTRST_HIGH PLTRST# deasserted > EC_CUR_TIME EC current time > cnt increments on every warm reboot and reset to 0 on > cold reboot > > BUG=b:249163956 > BRANCH=none > TEST='ectool boottime' AP console command is used to fetch data > 'reboot' on AP console to trigger warm reboot > 'apshutdown' on EC console to trigger cold reboot > > Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> > Change-Id: I15fedbde252e0452270ef0e3fd4391bf624169f1 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3794612 > Reviewed-by: Boris Mittelberg <bmbm@google.com> > Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Bug: b:249163956 Change-Id: Ie83026c4a3a38c3dd24522901233f06e03430a54 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4077335 Reviewed-by: Jonathon Murphy <jpmurphy@google.com> Commit-Queue: Piotr Pawliczek <pawliczek@chromium.org> Tested-by: Piotr Pawliczek <pawliczek@chromium.org>
* ec: Support logging system boot time infoRajesh Kumar2022-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL add support logging system boot time and hostcommand to get boot time info. EC logs elapsed time (in micro second) info since boot for different signal events,that can be used to calculate system boot time in cold boot and warm boot scenarios. Below are the events when EC logs time info ARAIL EC turns on A-RAIL RSMRST EC releases RSMRST# ESPIRST ESPIRST received PLTRST_LOW PLTRST# asserted PLTRST_HIGH PLTRST# deasserted EC_CUR_TIME EC current time cnt increments on every warm reboot and reset to 0 on cold reboot BUG=b:249163956 BRANCH=none TEST='ectool boottime' AP console command is used to fetch data 'reboot' on AP console to trigger warm reboot 'apshutdown' on EC console to trigger cold reboot Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: I15fedbde252e0452270ef0e3fd4391bf624169f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3794612 Reviewed-by: Boris Mittelberg <bmbm@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: Kconfig: Add body detectionJosh Tsai2022-11-221-0/+2
| | | | | | | | | | | | | | | | | | Add the body detection related configuration to Kconfig BRANCH=none BUG=b:236668095;b:232946420 TEST=zmake build winterhold Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Change-Id: Ic44154d556a89c1779bd16cbf07b15558f63f8f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3868870 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Tim Van Patten <timvp@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* Reland "hibernate: Add hibernate support to ap power code"Andrew McRae2022-11-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 16c8fce71986d50d9e10ea089d9d9352818129ad Reworked Kconfig handling. Original change's description: > hibernate: Add hibernate support to ap power code > > Add hibernate support to the AP power sequence code. > > The smart discharge system isn't supported yet. > > The system will hibernate after a delay when the AP is in G3 > and there is no external power connected. > > v2: add tests BUG=b:246643307 TEST=build and run on nivviks BRANCH=none Change-Id: I7f4e5633d05ca545e63ad9784a410284ef83e2b7 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4019012 Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* Revert "hibernate: Add hibernate support to ap power code"Diana Z2022-11-091-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 16c8fce71986d50d9e10ea089d9d9352818129ad. Reason for revert: Breaks hibernation on PSL boards (undefines CONFIG_HIBERNATE, which disables hibernate in common/system.c) BUG=b:258093781 Original change's description: > hibernate: Add hibernate support to ap power code > > Add hibernate support to the AP power sequence code. > > The smart discharge system isn't supported yet. > > The system will hibernate after a delay when the AP is in G3 > and there is no external power connected. > > v2: add tests > > BUG=b:246643307 > TEST=Run on nivviks with short delay > BRANCH=none > > Signed-off-by: Andrew McRae <amcrae@google.com> > Cq-Depend: chromium:3985352 > Change-Id: Ib7bb62c3d650a607343a6ea243645346f4b2a797 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3983631 > Reviewed-by: Peter Marheine <pmarheine@chromium.org> > Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Bug: b:246643307 Change-Id: Ia33273d4ebd1903b628cd163a5e3b35882badf14 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4017054 Auto-Submit: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* zephyr: shim: add a CONFIG_PLATFORM_EC_CBI option.Fabio Baltieri2022-11-091-2/+1
| | | | | | | | | | | | | | | | Add a CONFIG_PLATFORM_EC_CBI option that way we can associate it with an explicit build rule instead of having overlapping file list for the various CBI storage types. BRANCH=none BUG=none TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: If7f8e68979118392cc4f7af236640b15c74d91fa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3999726 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* hibernate: Add hibernate support to ap power codeAndrew McRae2022-11-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | Add hibernate support to the AP power sequence code. The smart discharge system isn't supported yet. The system will hibernate after a delay when the AP is in G3 and there is no external power connected. v2: add tests BUG=b:246643307 TEST=Run on nivviks with short delay BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Cq-Depend: chromium:3985352 Change-Id: Ib7bb62c3d650a607343a6ea243645346f4b2a797 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3983631 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* tree: Enable warning for fallthrough in switch statementsTom Hughes2022-10-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The EC code has generally been good about adding comments about intentional fallthrough in switch statements, but there were a few cases without comments (e.g., https://crrev.com/c/3949622). Enabling -Wimplicit-fallthrough generates a compiler warning if the fallthrough is not annotated with __attribute__((fallthrough)). For convenience, we add a "__fallthrough" macro for this attribute. See https://clang.llvm.org/docs/AttributeReference.html#fallthrough and https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html. BRANCH=none BUG=b:253644823 TEST=make buildall LOW_COVERAGE_REASON=legacy code Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I9f4d6049f4507a25ce706675d159b70e28b4b825 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3957420 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* test: move spi_flash_reg to its own moduleYuval Peress2022-10-121-2/+8
| | | | | | | | | | | | | | | | | | | Move the logic of the spi_flash_reg.c from common/ to a separate directory. Also, move the tests. Update the build.mk system to still build this in the same manner as well as CMake to use it as a library. BRANCH=none BUG=b:246839061 TEST=make BOARD=dooly TEST=zmake build hoglin TEST=./twister -T common Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Icc6b4fce1619c2c6a86c040f30390b7788171a9d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3935025 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr/usbc: implement a default DFP-only SVDM identityPeter Marheine2022-10-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Recent PD specifications require that devices with multiple DFPs respond to Discover Identity commands, even if they don't support any modes as responder. This implements a default handler for those commands appropriate for such devices that reports DFP-only operation, enabled by config and default-on for devices that aren't DRDs nor need extra SVDM support (such as for USB4 or TBT). This is implemented only for Zephyr (no equivalent implementation for legacy EC-OS) because it is expected that new devices which might benefit from it will all be using Zephyr. BUG=b:242671457 TEST=nereid now responds to Discover Identity, new test passes BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I2d11ced6928ae65ca00d20a1646509281080243b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3868882 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: Move root cmakestabilize-15167.B-mainYuval Peress2022-10-061-23/+0
| | | | | | | | | | | | | | | | Move the root level CMake for the EC module to the top level directory. This will simplify future changes where zephyr logic is intermixed with legacy EC logic during the migration effort. BRANCH=none BUG=b:246839061 TEST=zmake build -all && ./twister -v Change-Id: I5e67310b2237aeffdf8033c5cf1201cb67559158 Signed-off-by: Yuval Peress <peress@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3932868 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* Revert "common: replace safe_memcmp with cryptoc version"Jeremy Bettis2022-09-261-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 85554f0a843daa1c85ba252c7a27a389968d347b. Reason for revert: Broke gitlab (https://gitlab.com/zephyr-ec/ec/-/pipelines/651162463) and also CQ emerge builds (https://ci.chromium.org/ui/p/chromeos/builders/postsubmit/nissa-postsubmit/16030/overview) Original change's description: > common: replace safe_memcmp with cryptoc version > > We now have to always link against cryptoc, but it does not increase > code size on our most constrained boards: > > Before and after both show: > > Smallest free spaces in RO flash (bytes): > pdeval-stm32f072: 88 > servo_v4 : 104 > fusb307bgevb: 156 > > Smallest free spaces in RW flash (bytes): > volteer : 516 > bobba : 712 > meep : 716 > > Tightest boards' RW RAM images, bytes free: > whiskers : 212 > minimuffin: 284 > zinger : 284 > > BRANCH=none > BUG=b:169156874 > TEST=make buildall > > Signed-off-by: Tom Hughes <tomhughes@chromium.org> > Change-Id: I98422eccb3e903bd82ddb386087dd2d55d1f845e > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2424068 > Reviewed-by: Denis Brockus <dbrockus@chromium.org> > Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Bug: b:169156874 Change-Id: I794ae31f9e217677471b0ff164fadc9623571a33 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3919500 Commit-Queue: Raul Rangel <rrangel@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Raul Rangel <rrangel@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
* common: replace safe_memcmp with cryptoc versionTom Hughes2022-09-261-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now have to always link against cryptoc, but it does not increase code size on our most constrained boards: Before and after both show: Smallest free spaces in RO flash (bytes): pdeval-stm32f072: 88 servo_v4 : 104 fusb307bgevb: 156 Smallest free spaces in RW flash (bytes): volteer : 516 bobba : 712 meep : 716 Tightest boards' RW RAM images, bytes free: whiskers : 212 minimuffin: 284 zinger : 284 BRANCH=none BUG=b:169156874 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I98422eccb3e903bd82ddb386087dd2d55d1f845e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2424068 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* ec: Shim PLATFORM_EC_CPS8100Derek Huang2022-09-211-0/+2
| | | | | | | | | | | | | | Shim CONFIG_PLATFORM_EC_CPS8100 in zephyr to CONFIG_CPS8100 in legacy ec. BRANCH=None BUG=b:239783274 TEST=make -j40 buildall && util/run_tests.sh Change-Id: I15e2009b810102caaee54d59c48015a34a979f49 Signed-off-by: Derek Huang <derekhuang@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3905451 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: add initial shim for lsm6dsm sensoramber.chen2022-09-191-0/+2
| | | | | | | | | | | | | | | | | Add initial shim for the lsm6dsm accel/gryo sensor BUG=none BRANCH=none TEST=zmake build pujjo Signed-off-by: amber.chen <amber.chen@lcfc.corp-partner.google.com> Change-Id: Ib1ab863bedd2575dfafcbfc1c49c54afe46a7c2c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3865215 Reviewed-by: Andrew McRae <amcrae@google.com> Commit-Queue: Andrew McRae <amcrae@google.com> Code-Coverage: Andrew McRae <amcrae@google.com> Tested-by: Andrew McRae <amcrae@google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Move the fake system functions into their own fileSimon Glass2022-09-101-0/+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: Mock power sequence driverAl Semjonovs2022-08-251-0/+1
| | | | | | | | | | | | | | | Mock power sequence handling BUG=None BRANCH=NONE TEST=./twister -T zephyr/test Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: I8ec3198abfb069501bed2c5aa661e31f780e2c34 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3833564 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: ap_pwrseq: Add S0IX error recovery supportRajesh Kumar2022-08-121-2/+0
| | | | | | | | | | | | | | | | | This CL supports s0ix error recovery to ensure the AP doesn't get itself stuck in a state where it's no longer in a sleep state (S0ix/S3), but from the Linux perspective is still suspended. BUG=none BRANCH=none TEST=zmake build nivviks Tested using 'powerd_dbus_suspend' on AP and observed timeout and hang detected through EC logs. Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: Iaf37b2afc7e1bdec251b9c21f6a3f131acab6a50 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3760670 Reviewed-by: Andrew McRae <amcrae@google.com>
* zephyr: Delete CONFIG_PLATFORM_EC_ADCKeith Short2022-08-011-1/+1
| | | | | | | | | | | | | | | | | | | CONFIG_PLATFORM_EC_ADC is redundant with the Zephyr Kconfig option, CONFIG_ADC. Use the Zephyr option directly. Note - projects based on the "minimal" config do not compare. The minimal config disabled CONFIG_ADC, but the CONFIG_PLATFORM_EC_ADC_CMD was still enabled. With this CL, CONFIG_PLATFORM_EC_ADC_CMD now depends on CONFIG_ADC. BUG=none BRANCH=none TEST=zmake testall --static; compare binaries Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I129a3f490abd5c8234bc06ed6f86f2d7ff8a13b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3791659 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Replace full paths in assert outputKeith Short2022-08-011-0/+13
| | | | | | | | | | | | | | | | | Use the compiler option "-fmacro-prefix-map" to replace the full filenames generated by the __file__ preprocessor macro with a hard-coded string. This generates a more deterministic build when asserts are enabled. BUG=none BRANCH=none TEST=zmake build npcx7. This target enables CONFIG_ASSERT. Confirm that the filepaths in the output binary use the "EC_BASE" prefix. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I00347df316f888043e535778370647d7638deee9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3791658 Reviewed-by: Al Semjonovs <asemjonovs@google.com>
* zmake: add support for static versionsKeith Short2022-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Add a the option "--static" to zmake configure/build. This is passed through to the generate_ec_version.py script to generate static version information for reproducible builds. Note that Zephyr builds require https://github.com/zephyrproject-rtos/zephyr/pull/48195 to compare correctly. BUG=none BRANCH=none TEST=zmake testall TEST=zmake build herobrine -B /tmp/zephyr-rev1 --static TEST=zmake build herobrine -B /tmp/zephyr-rev2 --static TEST=cmp /tmp/zephyr-rev1/herobrine/output/zephyr.bin \ /tmp/zephyr-rev2/herobrine/output/zephyr.bin Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I07361f21c865e2b233ebdb2dc730d25afe13a843 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3786857 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: test: migrate drivers test to twisterYuval Peress2022-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | 1. Move the common test logic to drivers/common with its own CMakeLists.txt 2. Move the drivers test suites to drivers/default with its own CMakeLists.txt 3. Add a Kconfig for each suite that can enable it, use Zephyr's add_subdirectory_ifdef to control which suites get added to the biary and verify that at least 1 suite was added. 4. Add a check for ZMAKE_PROJECT_NAME to still allow zmake commands 5. Add testcase.yaml which runs all the tests BRANCH=none BUG=b:240093007 TEST=./twister --coverage -p native_posix -T zephyr/test/drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ib9d4ea4a8431539391cc5349a7a8fd7a7d21f120 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3784043 Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Tristan Honscheid <honscheid@google.com>
* Zephyr: Enable STT driver buildDiana Z2022-07-141-0/+4
| | | | | | | | | | | | | | Enable the STT and related SB RMI driver to build in zephyr. BRANCH=None BUG=b:231994602 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I4ca6672f0cf5addc47a4e1187a4e74fad15d40c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3764069 Commit-Queue: Robert Zieba <robertzieba@google.com> Reviewed-by: Robert Zieba <robertzieba@google.com>
* ec: Shim PLATFORM_EC_PERIPHERAL_CHARGERJeremy Bettis2022-07-131-0/+2
| | | | | | | | | | | | | | | | | | Shim CONFIG_PLATFORM_EC_PERIPHERAL_CHARGER in zephyr to CONFIG_PERIPHERAL_CHARGER in legacy ec. BRANCH=None BUG=b:238773780,b:181253613 TEST=make -j40 buildall && util/run_tests.sh Change-Id: Iedfc6f7eb89fd7018892f9e467c163c453cfcdc6 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3759273 Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Move ec_version.h generation logic from zmake to CMakeTristan Honscheid2022-07-121-0/+17
| | | | | | | | | | | | | | | | | | | | (This CL needs further testing to make sure it works in all conditions) * Add a new Python script that allows generating the ec_version.h header while being somewhat separated from zmake. * Call this new script from CMake so builds can be initiated through Twister without needing zmake to create the header as a pre-build step. BRANCH=None BUG=None TEST=zmake test test-drivers (--clobber); zephyr/zmake/run_tests.sh Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: Iccb670fecd2c40ecc6360521d65259f411b3c7e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3656258 Reviewed-by: Yuval Peress <peress@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* ps8xxx: simplify Kconfig options for driver selectionPeter Marheine2022-07-121-5/+1
| | | | | | | | | | | | | | | | | | Introduce a PLATFORM_EC_USB_PD_TCPM_PS8XXX option that enables the ps8xxx driver, and have the options for individual chips select it. This reduces the number of statements for each chip, and makes it clear that the multi-chip support option is only relevant if at least one chip is enabled. BUG=b:236761058,b:237593618 TEST=Verified ps8xxx.c is still built on Nereid, and selected/implied options remain enabled with the PS8815 driver. BRANCH=none Change-Id: I6a2215e7496613fc5daada154497c2ba2ac5c44b Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3752184 Reviewed-by: Keith Short <keithshort@chromium.org>