summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Support use of zephyr "dummy" consolestabilize-14498.B-mainJeremy Bettis2022-02-037-38/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now we only use the serial console in ec zephyr, however if you want to check the output of a console command in a test, that is not sufficient. Add test only get_ec_shell() function that will give you the active shell, whichever backend it might use. Change console.c to setup the serial or dummy backends depending on Kconfig. Removed all calls to shell_backend_uart_get_ptr(), except for 1 in console.c:init_ec_shell(). Switch test/drivers to SHELL_BACKEND_DUMMY. Added some better failure logging in utils.c. BRANCH=None BUG=b:214256453 TEST=zmake testall Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ibafc37cc4363d1f20a919fa5e38325bd6a071eec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3433630 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* chip/stm32/registers-stm32l5.h: Add register bank F, GJes B. Klinke2022-02-031-1/+2
| | | | | | | | | | | | | | | | | | It turns out that the L5xx series has two more register banks on top of the L4xx code that I originally copied from. Signed-off-by: Jes B. Klinke <jbk@chromium.org> BUG=b:192262089 TEST=Observe gpioset work on additional pins on HyperDebug BRANCH=none Change-Id: I302237ace0d8bcf5e96450e226d3d557d5a1d7fd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3359922 Tested-by: Jes Klinke <jbk@chromium.org> Auto-Submit: Jes Klinke <jbk@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Jes Klinke <jbk@chromium.org>
* zephyr: make _BMI and _ICM Kconfigs implicitYuval Peress2022-02-032-9/+8
| | | | | | | | | | | | | | | Removing the prompt text makes these fields implicit and not configurable from a prj.conf file. BRANCH=none BUG=b:208437221 TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I1df5c04eefcc05206d78885ad6cf28556d556248 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3415388 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: remove default for ALSYuval Peress2022-02-031-1/+0
| | | | | | | | | | | | | Enabling the PLATFORM_EC_ALS Kconfig should be explicit. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ibbcd5bd509671b9d224cec88b475a2fdb5a3163d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3415387 Reviewed-by: Keith Short <keithshort@chromium.org>
* cortex-m: Introduce FPU interrupt handlerPatryk Duda2022-02-0315-0/+374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When performing some illegal operation or when result can't be represented using floats, the FPU will assert an interrupt which should be handled. After this change, the EC will inform about type of FPU exception and address where it ocurred. To reduce overhead, the FPU handler will only copy necessary information, schedule fpu_warn() function and clear FPU flags. Message is printed from fpu_warn() which is deferred function (it's called from HOOK task context). Please note that: - FPU interrupt is not asserted immediately after problem occurred, but with noticeable delay, so PC and LR might not be correct. - FPU interrupt will be never triggered on STM32H7 (see errata ES0392 Rev 8, 2.1.2 Cortex-M7 FPU interrupt not present on NVIC line 81). BUG=b:215606535 BRANCH=none TEST=./test/run_device_tests.py --board bloonchipper --tests cortexm_fpu TEST=./test/run_device_tests.py --board dartmonkey --tests cortexm_fpu Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ib6f6c974082affc35302a822f0beea176e204206 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3412259 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* zephyr: Remove unused zephyr board (trogdor)Andrew McRae2022-02-035-340/+0
| | | | | | | | | | | | | Remove unused zephyr board (trogdor). BUG=b:217460464 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I93539cc5756b538ed8ea5ea04780944313d6eca4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3434185 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: brya: do not remove WP GPIODawid Niedzwiecki2022-02-031-1/+0
| | | | | | | | | | | | | | | There is no reason to set the GPIO_WP_L as GPIO_UNIMPLEMENTED at this stage of the project. BUG=b:211779766 TEST=zmake buildall BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ibd5ce553bf5fb2bb817ac05d55318bf65f8e7aec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3431666 Reviewed-by: Andrew McRae <amcrae@google.com> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
* zephyr: test: src then sink pd info host cmdAaron Massey2022-02-033-29/+47
| | | | | | | | | | | | | | | | | | | Modify existing skeleton test to no longer need IS_ENABLED config branches to pass without faking any values. Now this test verifies default values from a PD INFO host cmd when a source followed by a sink are connected to the EC. BRANCH=none BUG=b:209907615 TEST=zmake configure --test test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I52208601f30d98d9ff14523e590051ec572dfacb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3432910 Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Yuval Peress <peress@google.com> Tested-by: Yuval Peress <peress@google.com>
* docs: zephyr: Add Kconfig details for motionsenseYuval Peress2022-02-033-1/+221
| | | | | | | | | | | | | | Replicate the zephyr_template.md and document the Kconfig values in zephyr/Kconfig.motionsense and zephyr/Kconfig.sensor_devices BRANCH=none BUG=b:208437221 TEST=none Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I72d36687ea07a840456908a4c66db4167f0a4993 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3405646 Reviewed-by: Keith Short <keithshort@chromium.org>
* lazor: Use Zephyr APIs for migrated codeAndrew McRae2022-02-0310-69/+302
| | | | | | | | | | | | | Use the zephyr APIs for lazor board-specific code. BUG=b:217460464 TEST=zmake configure -b lazor BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ica1fbccab29d7d2c05ced32815099329735ac42e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3431606 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* ppc/syv682x: Make FRS_TCPC check port specificCaveh Jalali2022-02-031-1/+2
| | | | | | | | | | | | | | | | This updates the IS_ENABLED(CONFIG_USB_PD_FRS_TCPC) check with the new tcpm_tcpc_has_frs_control(port) call that supports port specific configurations. BRANCH=none BUG=b:216551944,b:216411401 TEST=buildall passes Change-Id: I1b0c7a95beb872d7807700ce28f81fc0b1dea047 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3418875 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm: try TCPC FRS control even when PPC does not implement FRSCaveh Jalali2022-02-031-1/+2
| | | | | | | | | | | | | | | | | | This applies to boards that have a mix of ports where FRS is controlled by the PPC or TCPC. For ports where FRS is controlled by the TCPC, it is likely that the associated PPC is not configured to control FRS through software, so associted calls return EC_ERROR_UNIMPLEMENTED. We need to treat this case like a success case when deciding whether to continue to control FRS via the TCPC. BRANCH=none BUG=b:216411401 TEST=buildall passes Change-Id: I17cf0a8d35f1282b9891da977823c18992d9db1e Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3432915 Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm: allow TCPC FRS without CONFIG_USB_PD_FRS_TCPCCaveh Jalali2022-02-034-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new TCPC port flag (TCPC_FLAGS_CONTROL_FRS) that allows it to be configured for TCPC based FRS independently of other ports. Traditionally, we would enable CONFIG_USB_PD_FRS_TCPC, but that config option applies to all ports which is not appropriate in some devices. Brya's ps8815 daughterboard needs FRS_TCPC while the other ports need FRS_PPC. To enable this feature, CONFIG_USB_PD_FRS must be enabled for basic FRS support. Then, any TCPC port with TCPC_FLAGS_CONTROL_FRS set will be treated like CONFIG_USB_PD_FRS_TCPC was enabled. The new API tcpm_tcpc_has_frs_control(port) is used instead of IS_ENABLED(CONFIG_USB_PD_FRS_TCPC). BRANCH=none BUG=b:216411401 TEST=buildall passes Cq-Depend: chromium:3432915 Change-Id: I9c3c35c5921b6afb8241e1d9e1205fe7064d40cf Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3417012 Reviewed-by: Keith Short <keithshort@chromium.org>
* ktu1125 ppc driver: type fixBoris Mittelberg2022-02-031-1/+1
| | | | | | | | | | | | | | Use atomic_t instead of int32 BRANCH=none BUG=b:207178886 TEST=driver compiles Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: I5708d3ad10eec3b55ddfc04b7ac93b1139c501ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3433635 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: test: Reset isl923x vbus mV ruleAaron Massey2022-02-031-0/+10
| | | | | | | | | | | | | | | | | | | Part of the skeleton test_attach_src_then_snk skeleton test passes due to isl923x vbus state setup in the test_attach_20v_pd_charger test. This causes a test execution order dependent flaky failure. Explicitly reset the isl923x vbus state to vbus 0mV aftear each integration test. BRANCH=none BUG=b:209907615 TEST=zmake configure test-drivers (only fails test_attach_src_then_snk when enabled with new rule Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I1e01633e7de4f19d3c401f2eeb2222175f11d898 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3432909 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* zephyr: brya: Enable dynamic-speed for tcpc1 and ppc1 i2c portRajesh Kumar2022-02-031-0/+2
| | | | | | | | | | | | | | | | | Enable dynamic-speed flag for tcpc1 and ppc1 i2c port to allow dynamically change i2c speed at runtime using i2cspeed console command. BUG=b:216756724 BRANCH=none TEST=zmake configure -B ~/tmp/brya/ brya -b successfully set i2c speed for tcpc1 using i2cspeed command Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: I441ec56df4cfe36256d4d1ce82e671eec6d96752 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3432914 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* check_allowed: Check git repository quietlyAbe Levkoy2022-02-031-1/+1
| | | | | | | | | | | | | | | Suppress output from checking whether the build is running inside a git checkout. Also, do a little bit less work. BUG=none TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I60e676d106a4317966147302da863ad85e04f1c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3432912 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zmake: Fix configure --coverage --build on testJeremy Bettis2022-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Running zmake configure --coverage --build on a non-test works great. It builds all the libs, and runs lcov to get a 0 lines covered report as a baseline. And the coverage enabled binary is too big to flash, so there is no reason to finish the build. However for tests, you really want the full binary, but there is no reason to run lcov until after you run the test once. Change configure --coverage --build to only do the partial build and lcov on non-tests. BRANCH=None BUG=None TEST=zmake configure --coverage --build zephyr/test/drivers && \ build/zephyr/test-drivers/output/zephyr.elf Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I0a4711da61d894ca39097a912de781e0f816be44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3433631 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
* lazor: Copy board level code to lazor zephyr projectAndrew McRae2022-02-0310-14/+1004
| | | | | | | | | | | | | | Copy board level code for lazor to lazor zephyr project. Minimal changes to code. BUG=b:217460464 TEST=zmake configure -b lazor BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ic806eecd7ed8ebd0b3dcf022a231cebaf29b7b0d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3431605 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: zmake: Disable traceback suppressionJack Rosenthal2022-02-032-25/+20
| | | | | | | | | | | | | | | | | | | | | | | | As discussed in the logging brainstorming meeting, traceback suppression only makes it more difficult to fix bugs, determine the cause of a failure, or make changes in zmake. This is to the point that much of our documentation has been putting -D everywhere. While there's much work to go to get rid of -D everywhere so that we display the right logs when we need them, we can start at getting rid of the traceback suppression feature and making -D just set --log-level=DEBUG. The two options are placed in a mutually-exclusive group such that specifying --debug/-D and --log-level at the same time is not valid. BUG=b:217423904 BRANCH=none TEST=unit tests pass Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I124b23c307b8b6e82edf4d5e43e2fcff82384a8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3432911 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* baseboard: octopus: Limit sensor ODR to 125Hz when using it8320Gwendal Grignou2022-02-021-0/+6
| | | | | | | | | | | | | | | | | | | For device with it8320, limit sensor frequency to 125Hz to make sure the EC is able to process a sample before another one arrives. BUG=b:217195395 BRANCH=octopus TEST=`tast run localhost:22552 hardware.SensorIioserviceHard` Passes. Without it, would have errors like: error during validation: too much delta between samples for base cros-ec-gyro at index 8(2h11m49.912599111s): got 10.374407ms; want <= 7.5ms Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: If5b88b5fee0cb6037dbd1cbc5bee690d07fdfb3a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430316 Reviewed-by: Diana Z <dzigterman@chromium.org>
* baseboard: dedede: Limit sensor ODR to 125Hz when using it8320Gwendal Grignou2022-02-021-0/+6
| | | | | | | | | | | | | | | | | | For device with it8320, limit sensor frequency to 125Hz to make sure the EC is able to process a sample before another one arrives. BUG=b:217195395, b:2070559, b:210565451, b:210566007 BRANCH=dedede TEST=`tast run localhost:22552 hardware.SensorIioserviceHard` Passes. Without it, would have errors like: error during validation: too much delta between samples for base cros-ec-gyro at index 8(2h11m49.912599111s): got 10.374407ms; want <= 7.5ms Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Iae88157381e1fc8fe3eeb1375788a81510d2d697 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430315 Reviewed-by: Diana Z <dzigterman@chromium.org>
* common/i2c: Fix reading 32bit big endian registerGwendal Grignou2022-02-021-1/+1
| | | | | | | | | | | | | | | Byte swapping was incorrect. Fixes: cca70a517b ("common: Add i2c 32bit read/write") BUG=b:172225851 TEST=compile BRANCH=none Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I00cec1858ee90d0b362e3cbfd10d4563c69fba43 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425443 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add npcx7 as zephyr board targetAndrew McRae2022-02-025-0/+152
| | | | | | | | | | | | | | Make npcx7 support common so that lazor et. al can use it instead of having a trogdor board target. BUG=b:217460464 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ia91173c74b0c4ae2fcc6a8931dd9e43f29ab3bbc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430639 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* TCPMv2: Do not skip cable reset during Data ResetAbe Levkoy2022-02-021-2/+0
| | | | | | | | | | | | | | | | | | Do not set PE_FLAGS_DATA_RESET_COMPLETE during pe_ddr_perform_data_reset_entry. In the case where the TCPM is not the initial VCONN Source, VCONN should already have been turned off. However, wait until the TC has completed turning it back on before considering Data Reset complete at the PE level. BUG=b:209625351,b:209624473 TEST=Attach Voxel to Godzilla Creek; successful mode entry after Data Reset with Godzilla Creek as initial VCONN Source BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Idecc964ad1252174db90854dfad43abfaa6ad113 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430307 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: brya: Enable i2cspeed commandRajesh Kumar2022-02-021-0/+1
| | | | | | | | | | | | | | | | Enable i2cspeed command to get/set i2c speed BUG=b:216756724 BRANCH=none TEST=zmake configure -B ~/tmp/brya/ brya -b i2cspeed command is avialable on EC console Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: I265bf1c48d25e23a4228c69d856625e3f0854f7a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430313 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Do not call power_set_state in testsstabilize-14496.B-mainJeremy Bettis2022-02-028-17/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | Change tests to not call power_set_state() as it doesn't actually change the power state, since the chipset_task only reads the state once and then keeps the state in a local var. There are a few exceptions to this. Some tests run before chipset_task is started, those continue to use power_set_state(). Also the hibernate tests make some redundant calls to set state to G3 when it already is in that state, just to reset the last_shutdown_time. Otherwise the g3 time will be unpredictable. Fixed test_set_chipset_to_s0 to actually coax the chipset_task to go to S0. BRANCH=None BUG=b:214256453 TEST=zmake testall Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I04ea6f73fcf784f20e53049eb3276173efd2655f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430309 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* trogdor: Remove trogdor from Zephyr projectsAndrew McRae2022-02-029-814/+0
| | | | | | | | | | | | | Clean up old unsupported Zephyr projects (trogdor/trogdor) BUG=b:217456306 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Id90a9ab9e57c3c5c4b34dc4c72c80eb04c072f94 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3430643 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* clock-stm32h7: Handle timer overflow in IDLE taskPatryk Duda2022-02-021-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Like STM32F4, implementation of IDLE task for STM32H7 is also prone to issues with timer overflow when interrupts are disabled (CL:3347659). This patch brings this fix to boards based on STM32H7 family. Description of timer overflow issue in CL:3347659: STM32F4 microcontroller has 32 bit timer which is used by EC to measure system uptime (in microseconds) and wake tasks if necessary. In EC timestamp is defined as two 32 bit values, which combined together give full 64 bit value. Lower 32 bits are read directly from timer. Higher 32 bits are kept in clksrc_high variable. The variable is updated in process_timers() function which is called in interrupt context (it's not an interrupt handler, but it's called by the driver). The function also sets event timestamp which is supposed to generate interrupt if timer register matches event timestamp. When EC switches to IDLE task, interrupts are disabled in order to prevent task preemption in uncontrolled manner. It is possible that after interrupts are disabled timer overflow could occur and clksrc_high variable remains old. Other problem is that event timestamp which is read using __hw_clock_event_get() and points to timestamp in previous "epoch". Its value is about 2^32 - HOOK_TICK_INTERVAL (500 ms). After overflow, t0.le.lo is very low and t0.le.hi remains unincremented. As a result next_delay variable (which tells for how long RTC alarm is set) is very high (even above 1 hour). Another important fact is that t0 timestamp is wrong and it is used to calculate value which will be loaded into the timer after wake. This can potentially lead to very long wait before running tasks. This fix checks if timestamp overflow occurs between disabling interrupt and getting "t0" value. If it happens, interrupts are enabled (to handle timer overflow) and IDLE enter procedure is repeated. BUG=b:200828093 BRANCH=none TEST=make -j buildall TEST=Run EC on dartmonkey and enable deep sleep. Check if device crashes. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I1f2b64da5b8e1ec2f2b2a273f60cab6529863d1e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425365 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* driver/als_cm32183: Remove interrupt handlerGwendal Grignou2022-02-021-10/+0
| | | | | | | | | | | | | | | | | | Current driver does not enable interrupt. The current interrupt handler (called by motionsense code each time the main task is scheduled) would unnecessarily read the LUX register. With the current driver, the sensor should be used in forced mode, motionsense calling the ->read() entry point at fixed intervals. BUG=b:208721153 BRANCH=none TEST=compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Ic614f537b3d5123d8f8e2615ae7c6af5d8fce47e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425520 Reviewed-by: caveh jalali <caveh@chromium.org>
* dt-gpionames: Add new utility to generate gpio-line-namesAndrew McRae2022-02-024-0/+560
| | | | | | | | | | | | | | Use the named-gpios node to generate the GPIO controller gpio-line-names properties. BUG=none TEST=build and confirm that gpio-lines-names is correct BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I39b8990b6cf2fad6c4c1e2196263774c996eb0cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3426242 Reviewed-by: Eizan Miyamoto <eizan@chromium.org>
* zephyr: Use GPIO in eeprom WP not named-gpioAndrew McRae2022-02-025-3/+10
| | | | | | | | | | | | | | Use a GPIO reference in the eeprom WP property, not a named-gpio. BUG=b:217287221 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Iae0e24de8d7e93dd7958005e5ce0fef2673d4057 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3428600 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: Remove enum-names that are not used by common codeAndrew McRae2022-02-0215-293/+8
| | | | | | | | | | | | | | | | Clean up the named-gpios enum-names to remove names that are not referenced in common code or shimmed in baseboard code. BUG=b:216466985 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Cq-Depend: chromium:3426250, chromium:3427097 Change-Id: Ifb65c76ef17afec7df1e0b857f666c600d60e6f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3428601 Reviewed-by: Aaron Massey <aaronmassey@google.com>
* herobrine: Migrate GPIO access to use Zephyr APIAndrew McRae2022-02-024-34/+44
| | | | | | | | | | | | | Migrate GPIO access to use Zephyr GPIO API. BUG=b:216466985 TEST=zmake configure -b herobrine_npcx9 BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ifb8591dc282fd367e389d4a0902ea8c001fc82b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3426250 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Use DT for ALS_COUNTYuval Peress2022-02-024-18/+7
| | | | | | | | | | | | | | Move the definition of ALS_COUNT to use device tree instead of Kconfig BRANCH=none BUG=b:173507858 TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Id59ec8bc4afc09478265f649ce3bdb723819e48e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3415386 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* Skyrim: Add FRS supportDiana Z2022-02-021-0/+2
| | | | | | | | | | | | | Skyrim and guybrush both support FRS via their TCPC. BRANCH=None BUG=b:195137794,b:208515128 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I0f00ffdd086324e9096516f622fad66b21c1d30b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425761 Reviewed-by: Keith Short <keithshort@chromium.org>
* corsola: Migrate GPIO access to Zephyr APIAndrew McRae2022-02-0212-61/+103
| | | | | | | | | | | | | | | Migrate the GPIO access to use the Zephyr API. Also consolidate the GPIO naming so that remapping of GPIO names is done through DTS. BUG=b:216466985 TEST=zmake configure -b {krabby,kingler} BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I914a1659fb4cc25e513e0aff1c3460855cd9f76d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3427097 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: test: Add partial src/snk integration testAaron Massey2022-02-013-16/+107
| | | | | | | | | | | | | | Add a partially working usb integration test working that the entire test team can iterate on to get fully functional. BRANCH=none BUG=b:209907615 TEST=zmake configure --test test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: Id6de1fb3f0c30bd66ae869213e6e761036260882 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425508 Reviewed-by: Yuval Peress <peress@google.com>
* math: Introduce isnan and isinf functionsPatryk Duda2022-02-013-55/+75
| | | | | | | | | | | | | | | | | | | | This patch adds functions responsible for checking if floating point operation result is NaN or infinity. Minute-ia specific functions were removed, because generic version should be used. To test added functions, 'fp' unit test was extended. BUG=b:215606535 BRANCH=none TEST=make buildall TEST=make runhosttests Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I68f46e91491b4a221beccde4275fd27a5424a048 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3423529 Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* mchp: Fix MEC172x RO_FRID wrong area_offset in SPI imagemartin yan2022-02-011-2/+22
| | | | | | | | | | | | | | | | | Update config_flash_layout.h to fix RO_FRID wrong area_offset in SPI image, this offset is used in CPFE process to validate FWID refer to https://chromium-review.googlesource.com/c/chromiumos/overlays /chromiumos-overlay/+/3282675 BUG=none BRANCH=none TEST=Verified in adlrvpp_mchp1727 board ec.bin Signed-off-by: martin yan <martin.yan@microchip.corp-partner.google.com> Change-Id: Ic0acd9b8a202d6c99f8b04dc429fa5a2909099c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425157 Reviewed-by: Brandon Breitenstein <brandon.breitenstein@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* docs/fingerprint: Update audit report linkTom Hughes2022-02-011-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3cb185e03f6df1e35dccf0923f27cc6e57c6c981 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425446 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: drivers: Ignore polarity on typec command testTomasz Michalec2022-02-011-3/+8
| | | | | | | | | | | | | | | | | | | | Polarity in "typec" command is set to value reported by TC state machine. TC SM presents polarity of last connected port partner even if it disconnects. Because of that test of "typec" command should expect that polarity is set to value reported by TC SM. BUG=none BRANCH=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ieb85ce5b7648956ce9c8a78b0df7d6637087e665 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3427959 Tested-by: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* zephyr: Fix named-gpios et al to drop #gpio-cellsAndrew McRae2022-02-0121-339/+6
| | | | | | | | | | | | | | | | | | | | | The #gpio-cells property is only required when the referenced node is a GPIO controller. named-gpios is not a GPIO controller, and cannot be used as a GPIO reference. DTS and code can refer to named-gpios directly, and then retrieve the GPIO from the named-gpio gpios property. Also rename irq-gpio to irq-pin so that DTS does not complain about missing #gpio-cells. BUG=b:216402316 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Cq-Depend: chromium:3418800, chromium:3418799, chromium:3423294 Change-Id: Ifdea8662647c092950962d3b6b0f32acda23aa5a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3412626 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* c2d2: allow GSC reset in one commandVadim Bendebury2022-02-011-1/+23
| | | | | | | | | | | | | | | | | | To speed things up when iterating during GSC development let's add an h1_reset command option to allow to generate a GSC reset pulse in one invocation. BRANCH=none BUG=none TEST=manual: verified behavior of h1_reset: 'h1_reset pulse' - generate a reset pulse 'h1_reset' - show the current GSC reset state 'h1_reset <0 or 1>' - as expected Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I785a4ff29e6d55afa06baddd17b21486c5011e0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3422769 Reviewed-by: Jett Rink <jettrink@chromium.org>
* jhl8040: Rename *gpios to *pinAndrew McRae2022-02-013-13/+13
| | | | | | | | | | | | | Do not use -gpio to refer to a named-gpio BUG=b:216402316 TEST=zmake configure -b brya BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ia0b58b410dd7ab0228811dc40f9c73fae72720be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3418799 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: Convert wake-pins to use interrupt configAndrew McRae2022-02-0117-91/+142
| | | | | | | | | | | | | | Convert the hibernate wake-pins to use the new interrupt config. BUG=b:214608987,b:216869126 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Cq-Depend: chromium:3423294,chromium:3423295 Change-Id: Iaaf03da88ead8bce7b2b428c265434a5a17b4ab7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3422856 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* nissa: Use aliases for sub-board GPIOsAndrew McRae2022-02-016-75/+87
| | | | | | | | | | | | | Use GPIO aliases for sub-board GPIOs BUG=none TEST=zmake configure -b {nivviks,nereid} BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I9816ba1b44f209e10a8f5235498d43e5626d95e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3428599 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: Add GPIO_DT_FROM_{NODE,ALIAS} macrosAndrew McRae2022-02-011-4/+12
| | | | | | | | | | | | | | | Add GPIO_DT_FROM_NODE and GPIO_DT_FROM_ALIAS macro. Similar to GPIO_DT_FROM_NODELABEL, but references the spec from a node or alias, not a node label. BUG=none TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I17c51335ca4d05bfcd6195f0badbd834e1f32ba6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3423295 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr test: Set ISL923x in natural unitsAbe Levkoy2022-01-314-21/+19
| | | | | | | | | | | | | | Accept voltage in mV as an argument to isl923x_emul_set_adc_vbus. Test using this interface. BUG=b:216497851 TEST=zmake testall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I8a0ec6019f1d4ef7853d731b11726e4fb1bdf136 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425638 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr test: Check charging in 5V charger testAbe Levkoy2022-01-311-6/+20
| | | | | | | | | | | | | | Check charging state after attaching 5V 3A charger. Rename the 5V and 20V charger tests to more accurately distinguish between them. BUG=b:216830930 TEST=zmake testall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: If656def75036e20ceae40dd816e1ff4afc6a6bcc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3425637 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>