summaryrefslogtreecommitdiff
path: root/zephyr/subsys
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Eliminate pointer from SYS_INIT functionsKeith Short2023-04-174-6/+4
| | | | | | | | | | | | | | | | | | | | The upstream change https://github.com/zephyrproject-rtos/zephyr/pull/51217 modified the function signature for the SYS_INIT call, eliminating the unused device pointer. Run the Zephyr provided script ./zephyr/scripts/utils/migrate_sys_init.py to update all callers. BUG=b:278595739 BRANCH=none TEST=zmake build -a Cq-Depend: chromium:4422804 Change-Id: I881bc536cef43a7c3ac4bc5eb3ce1893237bbd1f Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4437049 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* ap_pwrseq: Add s0ix counterGrzegorz Bernacki2023-04-142-1/+16
| | | | | | | | | | | | | | This commit adds counter which increments every time EC detects going into S0ix state. BUG=b:261869264 TEST=Tested on nissa BRANCH=none Change-Id: I2a35411eb085924c95129d98bb7b2be2bdc013a7 Signed-off-by: Grzegorz Bernacki <bernacki@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4239442 Reviewed-by: Robert Zieba <robertzieba@google.com>
* ap_pwrseq: Remove board API dependenciesBernardo Perez Priego2023-03-271-0/+2
| | | | | | | | | | | | | BUG=b:217952699 BRANCH=none TEST=zmake build Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: Ie945b8a7d7a8ee8bc68efc253740b2751d350997 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4079731 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Peter Marheine <pmarheine@chromium.org>
* ap_pwrseq: Trigger power sequence events from chipsetBernardo Perez Priego2023-03-271-0/+119
| | | | | | | | | | | | | | | | | | | This CL decouples power events generation from power sequence state action handlers, instead AP power sequence driver will generate power events using driver API `ap_pwrseq_register_entry_state_callback` and `ap_pwrseq_register_exit_state_callback`. BUG=b:217952699 BRANCH=none TEST=zmake build Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: Idadcee50a2ca1dfcb81fe4b550841854ad4258ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4079732 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* ap_pwrseq: Adapt power interface components to AP Power Sequence driverstabilize-15395.B-mainBernardo Perez Priego2023-03-2411-34/+343
| | | | | | | | | | | | | | | This CL make other components to follow AP Power Sequence driver. BUG=b:217952699 BRANCH=none TEST=zmake build Change-Id: I9d528fadd3074bfa9a2e9d1f36cfdeaf45015579 Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3996453 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Peter Marheine <pmarheine@chromium.org> Tested-by: Peter Marheine <pmarheine@chromium.org>
* rex: zephyr: test: Add unit tests for board_powerMadhurima Paruchuri2023-03-143-2/+9
| | | | | | | | | | | | BUG=b:247796816 BRANCH=None TEST=./twister -s rex/rex.board_power -c Change-Id: Ic0c93914ff978ca69215f196cec2f33dbd080524 Signed-off-by: Madhurima Paruchuri <mparuchuri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4214905 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Tristan Honscheid <honscheid@google.com>
* rex: Update arail and rsmrst system boot timestampRajesh Kumar2023-03-011-0/+2
| | | | | | | | | | | | | | | | | | This change updates ARAIL and RSMRST timestamp for rex platform. 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 Change-Id: Ie621f862f704bf35d249d57fb33411bf4e9f4348 Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4263103 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Al Semjonovs <asemjonovs@google.com> Reviewed-by: Brandon Breitenstein <brandon.breitenstein@intel.com> Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
* zephyr: de-clang-format a bunch of enums and initsFabio Baltieri2023-02-173-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | Usually clang-format works great, but it gets really confused by macros that include a comma termination in their definition. In those situation it tends to add unnecessary indentation and makes it more confusing to understand that the statements on different lines are actually doing the same thing. Don't think there's a good way of configuring the tool to do that properly, and frankly it's probably fine to indent few weird code snippets manually. This fixes a bunch of enums and initialization code that had unusual indentation by shutting clang off for the block and indenting manually BRANCH=none BUG=none TEST=zmake compare-builds -a Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com> Change-Id: Ic923b27c2ed9f66a2858bfa12e63838f1538700d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4264115 Tested-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
* ap_pwrseq: Enable driver to use state machine APIBernardo Perez Priego2023-02-093-16/+81
| | | | | | | | | | | | | | | This CL includes state machine API calls in AP power sequence driver implementation. BUG=b:217952699 BRANCH=none TEST=zmake build Change-Id: Ibe48608f1e09879a636a5e9ce7ac0e5a25214fe0 Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4162274 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* ap_pwrseq: Implement AP power sequencer driver underlying frameworkBernardo Perez Priego2023-02-092-0/+333
| | | | | | | | | | | | | | | | | | | | | | | This CL establishes an underlaying framework to easily add or extend AP Power Sequence routines, it is designed to follow the zephyr's State Machine Framework (SMF). This CL includes the following: - Macros definition to incorporate state machine action handlers implementation for all three levels: Application, chipset and architecture. - Devicetree binding declaration to allow creating additional powert states. - Implementation of API's to interact with state machine. BUG=b:217952699 BRANCH=none TEST=zmake build Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: Ic9ee7b81795d43eea8bb1ed3d78bd2cc2f5df0e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4098524 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* ap_pwrseq: Implement Application Processor (AP) power sequencer driverBernardo Perez Priego2023-02-093-0/+262
| | | | | | | | | | | | | | | | This driver provides execution context for underlaying AP power sequence framework. This CL includes driver API's implementation and declares configuration flag CONFIG_AP_PWRSEQ_DRIVER. BUG=b:217952699 BRANCH=none TEST=zmake build Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: I3e0e0f405a13db4713844bd94c2a87d6eb70e176 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3645011 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* ap_power: Reduce power signal debug name storageAndrew McRae2023-01-162-0/+15
| | | | | | | | | | | | | | | | | Use shortened power signal debug names by default, unless the BRINGUP config option is set. This reduces flash space usage by around 520 bytes. BUG=none TEST=Verify on craask BRANCH=none Change-Id: I69bdb74e7b272b9f5b842b888052e04e3e659c01 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4165982 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* tree: Replace "unsigned" with "unsigned int"Andrea Grandi2023-01-041-2/+2
| | | | | | | | | | | | | | | | | Fix checkpatch error: > Prefer 'unsigned int' to bare use of 'unsigned' BUG=b:262047616 TEST=./util/compare_build.sh -b all -j 120 => MATCH BRANCH=none Change-Id: Ibf82332a1e1ea0a0a03d3993336e24883e495e05 Signed-off-by: Andrea Grandi <agrandi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4126483 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: ap_pwrseq: use DT_DRV_COMPAT properlyFabio Baltieri2022-12-205-49/+54
| | | | | | | | | | | | | | | | | Drop the unused DT_DRV_COMPAT to intel_ap_pwrseq and add those to the various signal files and use the proper, more compact, DT_INST_ macro variants. BRANCH=none BUG=none TEST=cq dry run TEST=zmake compare-builds -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I4666589e9ac83fcc39b0eb305abda61be7aaf973 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4097134 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Yuval Peress <peress@google.com>
* ap_pwseq: Disable sleep mask when in S0Andrew McRae2022-12-191-0/+4
| | | | | | | | | | | | | | | Disable the EC deep sleep mode when the AP is in S0. BUG=b:230427574 TEST=Confirm on nirwen that deep sleep is not entered in S0 TEST=as PWM clock is not disabled BRANCH=none Change-Id: I76faa94a19753f26019afb2f965a388dfc039b68 Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4113627 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: ap_pwrseq: Enable features for power signal emulatorBernardo Perez Priego2022-12-161-12/+58
| | | | | | | | | | | | | | | | | | | | This CL enables the following features into power signal emulator: - Support for virtual wire power signals by utilizing its emulator API. - Managing `ACTIVE_LOW` gpio power signals when getting signal value. Note: Enabling this feature required adding some modifications to Devicetree file. BUG=b:222933615 TEST=zmake test test-ap_power BRANCH=None Change-Id: I93301caa6107f39c8514930f11bb187b6d42e14c Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4091524 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Andrew McRae <amcrae@google.com>
* zephyr: ap_pwrseq: Switch `retain` flag into `initialized`Bernardo Perez Priego2022-12-161-14/+12
| | | | | | | | | | | | | | | This simplifies logic when initializing power signals from devicetree. BUG=b:222933615 TEST=zmake test test-ap_power BRANCH=None Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: I8af6b55e63917a056d58a1c42f182fc9f84e2b35 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4091523 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Andrew McRae <amcrae@google.com>
* zephyr: Kconfig: select SENSOR automaticallyFabio Baltieri2022-12-151-0/+1
| | | | | | | | | | | | | | | | There's only two EC drivers using the sensor API, set up Kconfig so that those enable the sensor subsystem automatically and drop a bunch of explicit config entries. BRANCH=none BUG=none TEST=zmake compare-builds -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I444daf7b86cd0ef2ee3102ab085dbe3475f98c82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4110699 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: ap_pwrseq: use Kconfig helper symbol for signal featuresFabio Baltieri2022-12-1310-53/+65
| | | | | | | | | | | | | | | | | | Use zephyr Kconfig symbol instead of custom HAS_ macros for compatible based files. This allows dropping some compiler guards as well. Fix some missing #include that got exposed in the process. BRANCH=none BUG=none TEST=cq dry run TEST=zmake compare-builds -a Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I1b76e66b410d01a67944504a2b9ad6651bac1d2f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4097133 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: ap_pwrseq: select CONFIG_AP_PWRSEQ automaticallyFabio Baltieri2022-12-133-6/+2
| | | | | | | | | | | | | | | Select CONFIG_AP_PWRSEQ and drop a few unnecessary #if guards. BRANCH=none BUG=none TEST=cq dry run TEST=zmake compare-builds -a Change-Id: Ia85badce8b5bb998c99c13b8039b2d52f1ab5b22 Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4097132 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* ap_pwrseq: Do not backup already-cleared SCI and SMI hostevent masksSam McNally2022-12-051-2/+11
| | | | | | | | | | | | | | | | | | | | | In some situations, the S0S0ix power state is entered multiple times ahead of a resume to the point that the kernel sends a host event indicating the resume, where the SCI and SMI hostevent masks are restored. When the masks are cleared more than once, the previous backups are overwritten by the already-cleared values, and the original masks are lost. BUG=b:261318939 TEST=hostevent SCI mask is restored after S0ix with a touchpad click while the lid is closed BRANCH=nissa Change-Id: I8e93ed79a745f7f4c525fb7a8a419198d086448f Signed-off-by: Sam McNally <sammc@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4075654 Reviewed-by: Andrew McRae <amcrae@google.com> Code-Coverage: Andrew McRae <amcrae@google.com> Commit-Queue: Andrew McRae <amcrae@google.com>
* ap_pwrseq: support blocking power-on if insufficient powerPeter Marheine2022-12-022-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the system from booting the AP if there's not enough power according to configuration. Although there is similar logic in the power button task, typical AP configuration is to boot directly after entry to S5, meaning both are needed: * From G3, this new path gates whether the system boots (matching similar logic in the legacy power sequencing code) by preventing transition to S5. * From S5 (as in after shutdown and not yet having gone to G3), the power button gates booting. BUG=b:234049176,b:242627237,b:260909787 TEST=On craask, modify MIN_POWER settings to prevent hibernate during testing and fake low battery; verify that an instrumented version of charge_prevent_power_on indicates that the battery is too low to boot, although the "factory override" still allows this DUT to boot (because hardware WP is off). BRANCH=nissa Change-Id: I9cce0817dec8ffb59c133dbe54e63037542e5e55 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4066722 Commit-Queue: Andrew McRae <amcrae@google.com> Tested-by: Andrew McRae <amcrae@google.com> Reviewed-by: Andrew McRae <amcrae@google.com> Code-Coverage: Andrew McRae <amcrae@google.com>
* zephyr: Sort header filesJeremy Bettis2022-11-217-21/+28
| | | | | | | | | | | | | | | | | | | | Sort all headers in zephyr with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j$(nproc) buildall_only runtests TEST=zmake compare-builds Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ic4431f9354cfb87b8357e6288f651aaef8a50f7f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4043353 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* zephyr: IWYU Include header for PWR_SIGNAL_ENUMJeremy Bettis2022-11-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | PWR_SIGNAL_ENUM is defined in power_signals.h, so add include for that header. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j$(nproc) buildall_only runtests TEST=zmake compare-builds Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I426432b253d41516fe5158198fb7763f9b64d7dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4043351 Tested-by: Fernando Perea <pirunchy1989@gmail.com> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Fernando Perea <pirunchy1989@gmail.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Tristan Honscheid <honscheid@google.com> Code-Coverage: Fernando Perea <pirunchy1989@gmail.com>
* ap_pwrseq: reset sleep state after a full resumeArchana Patni2022-11-101-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This sleep state should be reset only after a full resume. Clearing it after suspend can create a state mismatch between ec and AP when slp_s0 toggles and then goes back to sleep in certain cases. The S0->S0S0ix transition in the power state machine looks up the sleep state variable. If there is a transition from s0ix to S0 in EC due to a SLP S0 signal toggle without a full system wake, the transition back to s0ix will not happen since the sleep state variable for host will not reflect a suspended state due to the reset. This patch fixes this issue by resetting the state only after a full resume. BUG=b:246231274 BRANCH=none TEST=zmake build nivviks Tested using 'powerd_dbus_suspend' on AP and observed no issues in dozing stress test. Change-Id: I147986966e9420a740cb1064d6122e28f71cd8b6 Signed-off-by: Subramony Sesha <subramony.sesha@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4019704 Tested-by: Andrew McRae <amcrae@google.com> Reviewed-by: Andrew McRae <amcrae@google.com> Code-Coverage: Andrew McRae <amcrae@google.com> Tested-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Commit-Queue: Andrew McRae <amcrae@google.com>
* zephyr: ap_pwrseq: Add Power Signals EmulatorBernardo Perez Priego2022-11-046-0/+593
| | | | | | | | | | | | | | | | | | | Power Signal Emulator provides an engine in which a given set of defined power signals connection is instantiated to simulate platform behavior. This emulator is created to supports executing AP Power Sequence test by configuring power signals behavior using devicetree. BUG=b:222933615 TEST=zmake test test-ap_power BRANCH=None Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: If1b1af2d287e23fe73e77986356bd3c50d56f148 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3684435 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Andrew McRae <amcrae@google.com>
* ap_pwrseq: console command to enable debug modeRajesh Kumar2022-10-042-0/+47
| | | | | | | | | | | | | | | | | | | | | | | Intel debugger puts SOC in boot halt mode for step debugging, during this time EC may lose Sx lines, Adding this console command to enable debug_mode and avoid force shutdown. Below EC console command can be used to prevent force shutdown: 1. debug_mode enable - to prevent force shutdown. 2. debug_mode disable - to follow normal power seq. debug_mode is disabled by default. BRANCH=None BUG=None TEST=force shutdown should be preveneted if debug_mode is enabled. Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Change-Id: I3fe432d287c9e033d3bb2cb253e436dd2801c6c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3902601 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-1225-25/+25
| | | | | | | | | | | | | | | 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>
* config: rename HOSTCMD_ESPI_* to HOST_INTERFACE_ESPI_*Michał Barnaś2022-09-092-6/+6
| | | | | | | | | | | | | | | Rename ESPI additional configs to match the name of base config that selects ESPI as HOST_INTERFACE. BUG=b:195416058 BRANCH=main TEST=zmake testall && make buildall Change-Id: I137449a1a58b1ea0d9794ebc0900e1b68413819d Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3291744 Reviewed-by: Sam Hurst <shurst@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* ap_power: Refresh virtual wire signals when channel readyAndrew McRae2022-09-061-25/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the ESPI VW channel is ready, refresh the VW signal values. Depending on when the channel status was received, new values for the VW signals may or may not have been received. If the signals were received and then the channel status indicated not ready, the signals were marked invalid (and the power sequence state machine may be stalled waiting for the signals to become valid). However once the channel status became ready, new signal values may not be received (since the actual value may not have changed), so the signals may remain (incorrectly) marked as invalid. So when the VW channel status indicates ready, refresh the VW signal values (allowing them to be marked valid), and update the power sequence code via power_signal_interrupt(), which will unblock the state machine, allowing the now valid VW signals to be handled. LOW_COVERAGE_REASON=ESPI emulator does not have API for channel setting BUG=b:235429065 TEST=firmware_ECPowerButton passes BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I547919e2d8c758878de9b6869ac223e4226a4f71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3874582 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* gpio: Use alternative if gpio_pin_get_config not supportedAndrew McRae2022-08-231-7/+13
| | | | | | | | | | | | | | If gpio_pin_get_config is not supported for a GPIO device, use the alternative method to return the pin value. BUG=b:243309500 TEST=twister -T zephyr/test/{drivers,ap_power} BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ib2b8e6ebd4c910509e302e84ab862a09c2eb35ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3847002 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* Revert "zephyr: ap_pwrseq: Handle low battery charge"Peter Marheine2022-08-222-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit e7d8c9f84a65f389f4fda5d000b243c8b56e0ea5. Use of battery state change incorrectly expresses the desired outcome, causing wrong behavior in multiple situations: * If the EC starts and the AP should remain off (handled by the power button task), it automatically starts as soon as the battery charge state changes. * When resuming from hibernate with a fully-charged battery, startup can be wrongly inhibited due to a race with PD negotiation. It seems that blocking startup should already be handled elsewhere so why that doesn't work needs to be further investigated, and this attempt at a fix turns out to cause further problems so it should be reverted. BUG=b:242627237,b:240638348,b:234049176 TEST=Nereid bootup from hibernate is not inhibited by uninitialized charger state. BRANCH=none Change-Id: I2ba40d0349f73444b359d1740fe7b01762dc5b3e Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3834906 Reviewed-by: Andrew McRae <amcrae@google.com> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* ap_power: Check for GPIO_GET_CONFIG optionAndrew McRae2022-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | Use CONFIG_GPIO_GET_CONFIG as a guard for calling gpio_pin_get_config_dt() to get the output pin value. Some platforms use ioexpanders that do not support this API call. There is a possibility but not using this call that the wrong value will be retrieved if the output pin is open drain, and the actual voltage on the pin is below the threshold of detecting a high state, but the ioexpander pins should not be in this situation. BUG=b:243309500 TEST=./twister -T zephyr/test/{ap_power,drivers} BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ieae25aaf5549eb9c7ec5dd46ef25e03b2fd207a2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3844247 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: ap_pwrseq: Add S0IX error recovery supportRajesh Kumar2022-08-127-3/+286
| | | | | | | | | | | | | | | | | 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: ap_pwrseq: Handle low battery chargeBernardo Perez Priego2022-07-262-0/+13
| | | | | | | | | | | | | | | | | | | This will prevent AP power up when battery charge is too low and power up AP automatically as soon as battery charge level becomes acceptable. BUG=b:234049176 BRANCH=None TEST=Build, flash, boot and follow steps: 1. Discharge battery to ~2% 2. Press power button Board should not boot 3. Connect AC adapter Board should boot automatically Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: Ida4f6557c998e3e6059d68a66672e35890b13046 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3662701 Reviewed-by: Andrew McRae <amcrae@google.com>
* ap_pwrseq: Block power sequence thread when idleBernardo Perez Priego2022-07-263-4/+26
| | | | | | | | | | | | | | | | | | Power sequence thread runs continuously and sleep for ten milliseconds between iterations, this change will block thread while no power state transition occurs, and enables power signal, power button, inactivity timer and host sleep event to unblock it. BUG=b:226494755 BRANCH=none TEST=zmake build nivviks; flash & run; AP states transition should be correct. Signed-off-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com> Change-Id: Ida203d1eb1d5fef1f7712874cb6a08686e40fe9e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3631638 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Andrew McRae <amcrae@google.com>
* pwrseq: gpio: Use output state for GPIO get on outputsAndrew McRae2022-07-182-0/+25
| | | | | | | | | | | | | | | | | | | | | | | When retrieving the state of an output GPIO, do not read the physical level on the pin, but instead read the configured state (by reading the GPIO configuration). Open drain outputs sometimes use low voltages, and so reading the physical level on the pin may indicate a 0 for an output that has been set to 1. The stored configuration of the GPIO does not include the GPIO_ACTIVE_LOW flag, so this is explicitly checked, and the state inverted if necessary. BUG=none TEST=zmake build nivviks; flash & run BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Idb2cb1c6b1b0902189e1fd1471cf9ca30c2711dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3769706 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* ap_pwrseq: set VCCST_PWRGD_OD low early in power down sequenceDeepti Deshatty2022-07-181-1/+7
| | | | | | | | | | | | | | | | | | | | | In power down sequence or in S0 to S3 transition, VCCST_PWRGD_OD is set to low in S0S3 state. This do not meet the timing requirements. Hence change sets VCCST_PWRGD_OD set to low in S0 state when SLP_S3 is found low. PWR_VCCST_PWRGD declared as open-drain signal, measures 1.05v when set to high. Hence gpio read of PWR_VCCST_PWRGD always returns 0. Use api power_signals_on() to monitor the signal status correctly. BUG=b:236664113 BRANCH=none TEST=Verify boot and S3 on nivviks Change-Id: I422cf78ba6d086af67a8e4b1ac275aa25772b430 Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3754819 Reviewed-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* ap_pwrseq: Send an INITIALIZED event when the pwrseq code is readyAndrew McRae2022-07-151-1/+6
| | | | | | | | | | | | | | | Send an event when the AP power sequence code is initialized and ready, for any clients that rely on knowing the state of the AP for their own initialization. BUG=none TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Iab07e2489be1937780c3070c493fc08675785ad8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3763024 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* ap_pwrseq: add an explicit "uninitialized" statePeter Marheine2022-07-152-1/+14
| | | | | | | | | | | | | | | It's possible for callers to request the AP state before the power state machine is ready, which without an UNINIT state can cause incorrect behavior because the initial (zero-initialized) state is G3. BUG=none TEST=zmake build nereid BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: Ib6e9158214c321943a63fff05e0f69224c5f9ae9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750257 Reviewed-by: Andrew McRae <amcrae@google.com>
* ap_pwrseq: Use common ESPI init and callbackAndrew McRae2022-07-131-11/+11
| | | | | | | | | | | | | | | Use common ESPI init and callback for power signals ESPI callback so that signal changes are guaranteed to be received by the power signal VW handler. BUG=b:237449433 TEST=zmake build nivviks; flash & run BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I1dfbc45bd1944ab124bec42897617463190b6853 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3756994 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* ap_pwrseq: all_sys_pwrgd_timeout handlingDeepti Deshatty2022-07-131-1/+2
| | | | | | | | | | | | | | | | | | API all_sys_pwrgd_handler() implements sleep for "all_sys_pwrgd_handler" time value always. Change will avoid this sleep if all_sys_pwrgd gpio is already high. BUG=b:236664113 BRANCH=none TEST=Verify boot on nivviks Change-Id: I1aecb021ae37129d07f58b07b148a84282d73f84 Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3750835 Reviewed-by: Andrew McRae <amcrae@google.com> Reviewed-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Bernardo Perez Priego <bernardo.perez.priego@intel.com>
* zephyr/subsys/ap_pwrseq/include/x86_power_signals.h: Format with clang-formatJack Rosenthal2022-07-061-57/+38
| | | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Tricium: disable Change-Id: Ic8b7cbb55504159dd24b700504542be81916e032 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730931 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/include/power_signals.h: Format with clang-formatJack Rosenthal2022-07-011-15/+15
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I08c308c05199802d80ff29e7085e276c9034b360 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730929 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/x86_non_dsx_mtl_pwrseq_sm.c: Format with clang-formatJack Rosenthal2022-07-011-2/+2
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ic29145991de7de66c84a1400ae18eb36834b8e9c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730935 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c: Format with ↵Jack Rosenthal2022-07-011-35/+30
| | | | | | | | | | | | | clang-format BUG=b:236386294 BRANCH=none TEST=none Change-Id: Iee2782fc32c857462eaa2ca869b22c2756405cd1 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730922 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_host_command.c: Format ↵Jack Rosenthal2022-07-011-2/+1
| | | | | | | | | | | | | with clang-format BUG=b:236386294 BRANCH=none TEST=none Change-Id: I67152500692c736979c91855bba1337beabc7a2a Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730934 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/include/signal_gpio.h: Format with clang-formatJack Rosenthal2022-07-011-5/+5
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I0655256501f87e0872df70466e43d231a42e153a Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730930 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/signal_gpio.c: Format with clang-formatJack Rosenthal2022-07-011-19/+17
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ib9a95dcbb5688a9e6d56bd53f864578abc33e84a Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730952 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr/subsys/ap_pwrseq/power_signals.c: Format with clang-formatJack Rosenthal2022-07-011-34/+30
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I165fbbfa13d29de6f5d30a16735b689dd3adde1a Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730951 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>