summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* krabby: disable charger ADC when no ACstabilize-14695.85.B-mainstabilize-14695.107.B-mainrelease-R102-14695.B-mainTing Shen2022-04-133-1/+17
| | | | | | | | | | | | | | | To save G3 power as suggested in b:228574354 BUG=b:228574354 TEST=measure G3 power BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I4862a10c025289ce75471bb105a68819d4147374 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3583742 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* vell: Raise usbc ports i2c speed to 1MhzDevin Lu2022-04-131-5/+5
| | | | | | | | | | | BUG=b:220196847 BRANCH=none TEST=On Vell, Make sure usbc ports are charging. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Iae94fecd3d2c99cecf177f0b52add7a884c80a88 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577316 Reviewed-by: caveh jalali <caveh@chromium.org>
* corsola: add braces to single line blockTing Shen2022-04-1311-62/+114
| | | | | | | | | | | | | | | | | | | | | | | Coding style fix according to review comment in https://crrev.com/c/3580113/2. Ref: https://docs.zephyrproject.org/latest/contribute/guidelines.html BUG=none TEST=1) code compilable: zmake build {krabby,kingler} 2) make sure not missing anything: ag '(if|for|while) \(.*[^{]$' BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I277d00f34d61ea8a6a43a2482bb152d3835e2ae7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3582434 Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* zephyr: herobrine: hoglin battery specsKshitiz Godara2022-04-135-1/+69
| | | | | | | | | | | | | | Added battery parameters for hoglin board. BRANCH=None BUG=None TEST=1)Battery is detecting fine at EC bootup 2)Battery cutoff is working as expected Signed-off-by: Kshitiz Godara <kgodara@qualcomm.corp-partner.google.com> Change-Id: I86c6824a45f477ae83234d115ed8bb900c344eef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3539766 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* tarlo: undef configuration for clamshell deviceamber.chen2022-04-131-0/+1
| | | | | | | | | | | | | | | undef CONFIG_MKBP_INPUT_DEVICES configruation for clamshell device BUG=b:222125478 BRANCH=none TEST=make -j BOARD=taeko Signed-off-by: amber.chen <amber.chen@lcfc.corp-partner.google.com> Change-Id: I154ab19a90e0345a6b1c2682222098ea4652025c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579964 Reviewed-by: Parth Malkan <parthmalkan@google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* zephyr: ap_pwrseq: Handle S0ix power state entry/exitLi Feng2022-04-134-10/+101
| | | | | | | | | | | | | | | | | | | | | | | | | S0ix enablement has multiple patches, this is fourth patch of the series. Add power state S0ix, transition states S0S0ix and S0ixS0 to power state handling thread. BUG=b:203446068 b:203446865 b:225996183 BRANCH=none TEST=Verified on Nivviks, system enter S0ix from S0. echo 1 > /var/lib/power_manager/suspend_to_idle restart powerd powerd_dbus_suspend also tested: suspend_stress_test -c 5 system passed 5 times S0ix test. Signed-off-by: Li Feng <li1.feng@intel.com> Change-Id: Idb07ad2b73d86aea98b5628cb90c8d8f4dd07c67 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3559570 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* zephyr: ap_pwrseq: support host sleep for S0ixLi Feng2022-04-132-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | S0ix enablement has multiple patches, this is the third one of the series. Clear SCI/SMI masks when host enters S0ix and restores SCI/SMI masks on resuming from S0ix. BIOS does not get involved in S0ix, the communication is directly between AP and EC. So it's EC's responsibility to preserve SCI/SMI masks across S0ix suspend/resume. Host and EC uses eSPI for communication. If host enters S0ix but SCI/SMI masks are not cleared, then EC could generate SCI/SMI depends on the value of masks. Since host is in sleep, it won't respond to eSPI virtual wire event from the EC. This causes EC to wait forever and so can't go to low power idle mode. To avoid this, EC saves SCI/SMI masks before S0ix and clears in EC driver, and restore the masks after resume. Refer to CL:1099968. S0ix entry: host event HOST_SLEEP_EVENT_S0IX_SUSPEND, then SLP_S0 assertion; S0ix exit: SLP_S0 de-assertion, then host event HOST_SLEEP_EVENT_S0IX_RESUME. EC tracks sleep states and enable/disable SLP_S0 interrupt on the fly. BUG=b:203446068 b:203446865 BRANCH=none TEST=zmake testall Signed-off-by: Li Feng <li1.feng@intel.com> Change-Id: I35ace43e331fd6348618e8a0a1ee1479c5de65f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3563507 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* zephyr: ap_pwrseq: support host sleep event and wake maskLi Feng2022-04-139-6/+279
| | | | | | | | | | | | | | | | | | | | | | | | | | S0ix enablement has multiple patches, this is second one of the series. HC EC_CMD_HOST_SLEEP_EVENT implementation in legacy EC code is reused. This will be migrated to Zephyr implementation. ap_pwrseq provides ap_power_chipset_handle_host_sleep_event() to process host sleep event changes. BIOS sets wake masks for each sleep state (S3/S5/S0ix) only once during boot up. EC has to take care wake mask update when power state changes. Updating wake mask at run time is added to ap_pwrseq. HC get/set wake mask in legacy EC code is resued. This should migrate to Zephyr implementation too. Refer to CL:576047 for original design. BUG=b:203446068 b:203446865 BRANCH=none TEST=zmake testall Signed-off-by: Li Feng <li1.feng@intel.com> Change-Id: Id972b904add5b3170fb91a8aa180736b42923dfd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3562042 Reviewed-by: Andrew McRae <amcrae@google.com>
* zephyr: docs: add AP Power documentationSam Hurst2022-04-132-0/+59
| | | | | | | | | | | | | Document the AP Power Kconfig.ap_power options BUG=b:208437225 TEST=Browse doc in gerrit BRANCH=main Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I5332a20c9125bd78cb14d4245479f6fd6ad41c81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3451007 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: ap_pwrseq: Rename enable/disable interruptAndrew McRae2022-04-138-39/+49
| | | | | | | | | | | | | | | | Rename enable/disable interrupt to just enable/disable for power signals API. This better reflects the function of this call. BUG=none TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ia78ba01067d3b66c7579749f124399e8b1fd6fca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3583099 Reviewed-by: Kangheui Won <khwon@chromium.org> Reviewed-by: Li1 Feng <li1.feng@intel.com>
* zephyr: docs: add USBA documentationSam Hurst2022-04-133-0/+83
| | | | | | | | | | | | | Document the USBA Kconfig.usba options BUG=b:208437225 TEST=Browse doc in gerrit BRANCH=main Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: If1c791a85c2497584e28de67c2eac6fb9368b92b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3451006 Reviewed-by: Keith Short <keithshort@chromium.org>
* firmware_builder: Call build_with_clang.py scriptTom Hughes2022-04-122-0/+54
| | | | | | | | | | | | | | | | | | The util/build_with_clang.py script helps us validate that boards that build successfully with clang continue to do so. As compilation errors are fixed for boards, they can be added to the list. The script is called from firmware_builder.py as part of the CQ process. BRANCH=none BUG=b:172020503 TEST=CQ passes Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I8d9384e04dbfc25191d5ebf93425e6d178631168 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3221785 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zmake: Cleanup all the pylint warnings in zmakeJeremy Bettis2022-04-1219-371/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added type hints in several places either to correct a warning or to cause one. For example, if pylint can't tell the type of an inherited method, it will report unused params, but if the params match exactly the superclass, it will not. Some cases were because I tried to find all references to a class or function, and the IDE couldn't find them. Moved loose logging functions in multiproc into class methods of LogWriter. Refactored pack_firmware and _get_max_image_bytes to avoid problems with the various packers taking different numbers of params and subclasses not implemented abstract methods. Stop disabling no-self-use and fix them instead. Remove JobClient.run() because it's never called. Remove JobServer, because it does nothing and is not used as a marker. Fixed lots of small warnings also. Disabled most of the too-many-* warnings in specific functions. Fixed the imports in .pylintrc, as it was finding the emerged zmake, not the local one. Disabled wrong-import-order since isort and pylint don't agree. BRANCH=None BUG=b:217969201 TEST=zmake -j8 test -a zephyr/zmake/run_tests.sh find zephyr/zmake -name '*.py' -print0 | xargs -0 cros lint Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I4f1b3a9fa5881fe7bcc4a6065d326dd36701b5ef Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3583754 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* RGBKBD: Separate init and enableDaisuke Nojiri2022-04-124-17/+74
| | | | | | | | | | | | | | Currently, enable is included in init. This patch separates them so that an RGB unit can be enabled or disabled separately. BUG=b:228525798,b:226215987 BRANCH=None TEST=Taniks Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I6f4d3b64f35f0cd30b6b58944d377932bbf5ef2e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3582324 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* RGBKBD: Print error code in set_color_singleDaisuke Nojiri2022-04-121-5/+10
| | | | | | | | | | | | | | This patch makes set_color_single print error code returned from a driver. BUG=b:228525798 BRANCH=None TEST=Taniks Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I8582b4c19c19b8a6dcdf83827f73610b650066ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577988 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* zephyr: docs: Update the doc templateKeith Short2022-04-121-12/+13
| | | | | | | | | | | | | | | Update the document template to reflect current best practices. Specifically, move all related Kconfigs into a separate file and link to the file only BUG=b:207403708 BRANCH=none TEST=View preview in gitiles Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I19e9b78124843e0c9828369464dc37889aeb5114 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3583046 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Enable NCT38XX ioexpander on MTLRVPBrandon Breitenstein2022-04-123-2/+70
| | | | | | | | | | | | | | | | | Enables ioexpander for the nuvoton nct38xx ports on MTL RVP. This allows for type-c functionality on port c0 and c1. BUG=none BRANCH=none TEST=zmake mtlrvpp_npcx verified retimers coming up when toggling rst and ls lines with follow on patch Signed-off-by: Brandon Breitenstein <brandon.breitenstein@intel.com> Change-Id: I43210076bf0f17ff884e777b81853f05ff3765aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3575076 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Quackingstick: Turn off LED before enter EC hibernateSue Chen2022-04-121-0/+8
| | | | | | | | | | | | | | Turn off LED in board_hibernate. BUG=b:228570817 BRANCH=trogdor TEST=make sure LED off after run hibernate in ec console Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I7081d92f662215fd0fea845e6dd44584a4281231 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581233 Reviewed-by: Bob Moragues <moragues@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
* zephyr: increase PD interrupt stack sizeDeepti Deshatty2022-04-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | TASK_PD_INT_STACK_SIZE size changed from 736 to 880. Increased the size by 20%. BRANCH=none BUG=b:228815123 TEST=Verify USBC power role swap test on Nivviks Before including CL (Idle state) ec:~$ kernel stacks PD_INT_C1 (real size 736): unused 244 usage 492 / 736 (66 %) PD_INT_C0 (real size 736): unused 284 usage 452 / 736 (61 %) After including CL (Idle state) ec:~$ kernel stacks PD_INT_C1 (real size 880): unused 388 usage 492 / 880 (55 %) PD_INT_C0 (real size 880): unused 428 usage 452 / 880 (51 %) Change-Id: I9f0ef0ed48d530439265df5e3f418be350631323 Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581824 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* krabby: rt9490: add irq pinTing Shen2022-04-123-11/+3
| | | | | | | | | | | | | | | Move rt9490 interrupt handler from c code to device tree. BUG=b:220814055 TEST=C1 BC1.2 works on krabby BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ide64449e1c3dd23ecd2b06021ee39d746cb9b938 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3580113 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* rt9490: add dt support for irq handlerTing Shen2022-04-124-0/+57
| | | | | | | | | | | | | | | | Adds an `irq` property and auto generates the irq handler for rt9490 driver. BUG=b:220814055 TEST=zmake build krabby BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I5603880378f2ddc67b296adaaabb4948c8cba355 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3562051 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* zephyr: add util header to hold common device-tree opsTing Shen2022-04-126-13/+34
| | | | | | | | | | | | | | | Move duplicated macros to a common header file. BUG=b:220814055 TEST=zmake build herobrine BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I437449592edd994b060908dacde1422a549565ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3580112 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* usb-pe: set FRS and AMS flags before invalidte contractEric Yilun Lin2022-04-121-3/+7
| | | | | | | | | | | | | | | | Ensure the flags can be carried into the pe_invalidate_explicit_contract. BUG=b:223086905 TEST=Kingler C1 FRS with RT1718S TCPC works BRANCH=none Change-Id: Ia7d1c4697f7447945f2de53118d6f8668a2edbce Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3544747 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* nissa: enable battery revive configDeepti Deshatty2022-04-121-0/+1
| | | | | | | | | | | | | | | Enables firmware code to apply current when battery found is in disconnected state. BUG=b:221193121 BRANCH=none TEST=Nivviks build is successful Change-Id: I770574dab44b9aea25f043cc6e7f57cd17f57582 Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3563395 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Andrew McRae <amcrae@google.com>
* nissa: Handle S5 power rails for LTE sub-boardAndrew McRae2022-04-123-9/+60
| | | | | | | | | | | | | | | Enable or disable the LTE sub-board power rails when entering or exiting S5 state. BUG=b:214858346 TEST=zmake build {nivviks,nereid} BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Icf6a30561ac9859bea9377ab2413229a23c5c61b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3583105 Reviewed-by: Kangheui Won <khwon@chromium.org> Tested-by: Sam McNally <sammc@chromium.org>
* zephyr: cleanup the structure member typeRuibin Chang2022-04-121-8/+5
| | | | | | | | | | | | | | | | | | | | | Declare the member type to match the kscan_it8xxx2_regs, so we needn't to transform the type every time in function for the local structure. BUG=none BRANCH=none TEST=on board krabby, console cmd "ksstate on", 1.press multi-key at a time: [1811.881622 KB state: -- -- -- -- -- -- 12 -- -- -- -- -- --] [1811.933868 KB state: -- -- -- -- -- 10 12 -- -- -- -- -- --] [1811.981567 KB state: -- -- -- -- -- 10 10 -- -- -- -- -- --] 2.press a key at a time: check all keyboard key bit field triggered Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: Id9cfdb3ad2626721a615da46a2b28fdb8962ef3e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3359109 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* drive/charger/isl923x: Fix race condition with discharge_on_acEric Yilun Lin2022-04-121-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | This CL is basically a clone of CL:3579624 which fixes the same issue on isl9241 driver. The below comment was copied from it: There is a race condition with `learn_mode`. This variable is read and then discharge_on_ac is disabled if it is not set. However it's possible for isl9241_discharge_on_ac to get called after the branch is taken but before discharge_on_ac is disabled. This can cause factory USB charging tests to fail as discharge_on_ac is disabled improperly. This commit protects the read and branch on `learn_mode` with a mutex to prevent the above from happening. BUG=b:214341758, b:206601685 TEST=zmake testall BRANCH=asurada, cherry Change-Id: I5d584b4b5f87e5f8a356e4f2bc8f6f37fd54250a Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581823 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* ap_pwrseq: Add ADC interrupt enable/disableAndrew McRae2022-04-123-36/+114
| | | | | | | | | | | | | | | Add interrupt enable/disable to the ADC power signal handling, so that the ADC can be turned off when the CPU is off, to save power. BUG=b:228535753 TEST=zmake build nivviks; flash & run BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: If1cc4b52e215115d2a0eb3b30dae29a7a0fa8833 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577313 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* zephyr: Document chargestate AP cmd in battery docAaron Massey2022-04-121-1/+18
| | | | | | | | | | | | | Document the chargestate ectool command in the zephyr battery doc. BRANCH=none BUG=b:216366887 TEST=gitiles gerrit view Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I1bfb93ff9f04f6fbd3ddf902d52c651fbe30615b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579621 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* docs: ec_terms: Reference the ectoolAaron Massey2022-04-121-4/+10
| | | | | | | | | | | | | | Add a quick description and reference to the ectool in the ec_terms.md to make the ectool documentation more discoverabe. BRANCH=none BUG=None TEST=gitiles gerrit view Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I5a7aa99884fd81e549539c76e61d23cd0f6448c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577991 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* zephyr: Document pwr_avg cmd in batteries docAaron Massey2022-04-121-0/+70
| | | | | | | | | | | | | | | | The pwr_avg EC console command can be invoked to query battery charging rates. Document this functionality in the Zephyr battery doc. BRANCH=none BUG=b:216366887 TEST=gerrit view Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I139aa8d83dcdc0d80067b95fafbca77c48e3fdaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3576667 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* amd_x86: Clear SMI/SCI event mask early during suspendRob Barnes2022-04-121-7/+5
| | | | | | | | | | | | | | | | | Clear the SMI/SCI event mask at the earliest indication that the host is suspending. The earliest indication is the host sleep event. This avoids the case where the EC asserts an event while the host has already started suspending which can cause a premature wake. BUG=b:213423172 BRANCH=guybrush TEST=suspend_stress_test while also attempting to trigger an SCI event Do not observe any premature wakes after 100+ cycles Change-Id: I83a842c64d33703595c4e9a5b110d038035cf72e Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3580114 Reviewed-by: Diana Z <dzigterman@chromium.org>
* ztest: motion_sense: add tests for ec_rate subcommandYuval Peress2022-04-124-3/+77
| | | | | | | | | | | | | | | | Add tests for the various code paths of the ec_rate subcommand: - Invalid sensor number - Get the current ec_rate - Set the AP configured ec_rate BRANCH=none BUG=b:224614211 TEST=zmake test --coverage test-drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ib49019b2a8e61f863aa0d27107dc9b204ea24bb2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579627 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* ztest: motion_sense: add tests for the info subcommandYuval Peress2022-04-123-0/+87
| | | | | | | | | | | | | | | Add tests for all code paths of the info subcommand (an invalid sensor number and a valid one as well as all the different versions). Verify that the result contains the right data. BRANCH=none BUG=b:224614211 TEST=zmake test --coverage test-drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I81b38fddda52c64813b074e0645ab003282a5fdd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579626 Reviewed-by: Keith Short <keithshort@chromium.org>
* ztest: motion_sense: add tests for the data subcommandYuval Peress2022-04-123-0/+48
| | | | | | | | | | | | | | | Add tests for both code paths of the data subcommand (an invalid sensor number and a valid one). Verify that the result contains the right data. BRANCH=none BUG=b:224614211 TEST=zmake test --coverage test-drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ib69621037daa758c40e2de3bac88b12171571dab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3578292 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* Reland "Enable "cros lint" presubmit check"Tom Hughes2022-04-112-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit b294077eed6da053eeca07ce5546830d5404c9a1 Now that zmake has a pylint config file, this should be safe to enable. Original change's description: > Enable "cros lint" presubmit check > > The cpplint check run by cros lint is disabled with the CPPLINT.cfg file > since it doesn't apply. Other linters, such as Python and Shell are > applicable and will be run. > > BRANCH=none > BUG=b:217969201 > TEST=none > > Signed-off-by: Tom Hughes <tomhughes@chromium.org> > Change-Id: Ie9aba283d7bf927913ff834c586ec9e8d0e9e9a1 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3444587 > Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> BRANCH=none BUG=b:217969201 TEST=none Change-Id: I796a191333128c35903dd60237e677f854132c50 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581652 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* zmake: Fix cros lint warnings in testsJeremy Bettis2022-04-118-66/+123
| | | | | | | | | | | | | | | | Fixed all the cros lint warnings in the zmake tests. BRANCH=None BUG=b:217969201 TEST=zephyr/zmake/run_tests.sh && \ find zephyr/zmake/tests -name '*.py' -print0 | xargs -0 cros lint Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I01e06bdfbfca239db2092680635fa3bc72008647 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3582802 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* Skyrim: Enable tablet modeDiana Z2022-04-112-1/+5
| | | | | | | | | | | | | | | | Fix the name of the tablet mode GPIO, and also enable tablet mode for the board. BRANCH=None BUG=b:227522206 TEST=on skyrim, verify EC reports tablet mode when the system is folded over with the magnet rework Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ibae53ce3d97761d1d43dc9cc279fcd53dd3a17ec Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579989 Reviewed-by: Robert Zieba <robertzieba@google.com> Commit-Queue: Robert Zieba <robertzieba@google.com>
* Skyrim: Fix GPIO typoDiana Z2022-04-111-4/+4
| | | | | | | | | | | | | | The USB-A lines are 5 V, not 5.5 V BRANCH=None BUG=None TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I24fe0f68f7766d14c53dadd6d58f44b07b236a0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579988 Reviewed-by: Robert Zieba <robertzieba@google.com> Commit-Queue: Robert Zieba <robertzieba@google.com>
* zephyr: Get zephyr BUILD.py files to 0 warningsJeremy Bettis2022-04-1125-0/+94
| | | | | | | | | | | | | | | | Create a .pylintrc and fix all docstring warnings. BRANCH=None BUG=b:217969201 TEST=find zephyr/projects zephyr/test -name '*.py' -print | xargs cros lint Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I43eb7b62032463f5ffeda1f8c5ac95722ac43f8b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581654 Reviewed-by: 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>
* zephyr: npcx: clock: remove the guard for npcx_clock_get_sleep_ticksJun Lin2022-04-117-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The function npcx_clock_get_sleep_ticks is currently guarded by CONFIG_PM && CONFIG_NPCX_PM_TRACE. The other codes guarded by CONFIG_NPCX_PM_TRACE is used to trace and will print a lot of messages. The user who wants to use npcx_clock_get_sleep_ticks has to enable this flag and get a lot of console spam. This commit removes the guard CONFIG_NPCX_PM_TRACE and makes this function is available when CONFIG_PM is defined. This CL also removed the unnecessary default CONFIG* to reflect the change. This CL has dependency on PR: https://github.com/zephyrproject-rtos/zephyr/pull/44195 BRANCH=none BUG=b:226593750 TEST=set CONFIG_NPCX_PM_TRACE=n, the deep sleep time can be printed by "idlestats" console command. TEST=pass "zmake testall --clobber" Signed-off-by: Jun Lin <CHLin56@nuvoton.com> Change-Id: I87138f075a80e7389d58ec5dd38a8ead320593b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3552006 Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: test: USB 5v 3a PD sink alert raceAaron Massey2022-04-111-0/+3
| | | | | | | | | | | | | | | | | | The tcpci_tcpc_alert function is asynchronous meaning we must wait for its async routines to complete before depending on its functionality in USB power delivery tests. Add one second in virtual suspend time on test thread before relying on tcpci_tcpc_alert state changes. BRANCH=none BUG=b:228850425 TEST=zmake test --test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I20e3cb2ae4c899c6137bff7eb1047f4ee1abaae5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581653 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: test: Correct port target for detach_srcAaron Massey2022-04-111-2/+2
| | | | | | | | | | | | | | | | The verify_detach_src test invokes a power info host command at the wrong target port before asserting the appropriate PD power role. Correct port target. BRANCH=none BUG=b:228850425 TEST=zmake test test-drivers Signed-off-by: Aaron Massey <aaronmassey@google.com> Change-Id: I5ecef2a19ec97f27bbb3312ed071d29018ac6238 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3581293 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: ITE keyboard driver uses wake up interface for WUC pinsRuibin Chang2022-04-114-22/+109
| | | | | | | | | | | | | | | | | | | | | The cros_kb_raw_ite driver uses wake up interface for WUC pins. BUG=b:188045130 BRANCH=none TEST=on board krabby, console cmd "ksstate on", 1.press multi-key at a time: [289.487304 KB state: -- -- -- 14 -- -- -- -- -- -- -- -- --] [289.579284 KB state: -- -- -- 12 -- -- -- -- -- -- -- -- --] [289.788635 KB state: -- -- -- 02 -- -- 02 -- -- -- -- -- --] 2.press a key at a time: check all keyboard key bit field triggered Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Change-Id: I4d0a7d88b73938aaf266f51b6982b86b61c11708 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3359166 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* cortex-m/irq_handler: Replace inline asm with CTom Hughes2022-04-111-10/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When building with clang and LTO is enabled, clang optimizes out "routine" (the interrupt handler) and fails to link. gcc does not optimize out the routine. Rewriting IRQ_HANDLER in C makes it compile with both compilers, though it uses two more instructions. Before this change the generated assembly for an interrupt handler on dartmonkey: arm-none-eabi-objdump -d ./build/dartmonkey/RW/ec.RW.elf 081027a8 <irq_37_handler>: 81027a8: 4670 mov r0, lr 81027aa: b501 push {r0, lr} 81027ac: f7ff ffea bl 8102784 <uart_interrupt> 81027b0: e8bd 4001 ldmia.w sp!, {r0, lr} 81027b4: f009 bbc4 b.w 810bf40 <task_resched_if_needed> After this change the generated assembly for an interrupt handler on dartmonkey: arm-none-eabi-objdump -d ./build/dartmonkey/RW/ec.RW.elf 081027e0 <irq_37_handler>: 81027e0: b507 push {r0, r1, r2, lr} 81027e2: f8cd e004 str.w lr, [sp, #4] 81027e6: f7ff ffe9 bl 81027bc <uart_interrupt> 81027ea: 9801 ldr r0, [sp, #4] 81027ec: b003 add sp, #12 81027ee: f85d eb04 ldr.w lr, [sp], #4 81027f2: f009 bbc5 b.w 810bf80 <task_resched_if_needed> BRANCH=none BUG=b:172020503 TEST=make buildall TEST=./test/run_device_tests.py --board dartmonkey => PASS Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I7029556afc4a760e81885d8f84b7d787f48c4036 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3566661 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* zephyr: docs: Add references to the Zephyr devicetree introKeith Short2022-04-114-9/+15
| | | | | | | | | | | | | | | Add references to the Zephyr devicetree introduction documents upstream. Also add direct references to the "node label" definition, as this is a common source of confusion for new users. BUG=b:207403708 BRANCH=none TEST=View docs with gitiles Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I6fad8781cfe51a0d7741cd7eb2ba13b5e744661d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3579985 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* run_device_tests: Improve test results outputPatryk Duda2022-04-111-111/+83
| | | | | | | | | | | | | | | | | | | | | | | | Until now run_device_tests script prints test name passed to EC build system. This patch modifies the script to print name of the test definition in the script. Each test can have variants, eg. system_is_locked test can be run with write protect on and off, so in the script there are two definitions of the test: system_is_locked_wp_on and system_is_locked_wp_off. BUG=b:221087395 BRANCH=none TEST=./test/run_device_tests.py -b dartmonkey --test system_is_locked.* TEST=./test/run_device_tests.py -b dartmonkey Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9d441cdc0897dff6b1de9ebe4e02cec311a005eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3569763 Reviewed-by: Bobby Casey <bobbycasey@google.com> Tested-by: Patryk Duda <patrykd@google.com> Reviewed-by: Andrea Grandi <agrandi@google.com> Commit-Queue: Patryk Duda <patrykd@google.com>
* vell: Update thermal high/halt point version 3Devin Lu2022-04-111-5/+5
| | | | | | | | | | | BUG=b:216026302 BRANCH=none TEST=Thermal team verified thermal policy is expected. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ie1a27714fbc80ee08bcfb67271389580f0a2ad76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577327 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* vell: Update fan table version 3Devin Lu2022-04-111-24/+25
| | | | | | | | | | | BUG=b:216026302 BRANCH=none TEST=Thermal team verified thermal policy is expected. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I4dccd252fe8bfe0c545508da09ac8a9570ddd6bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3577326 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* zephyr: add a symbol to USB-A power type choiceDawid Niedzwiecki2022-04-117-9/+2
| | | | | | | | | | | | | | | | Change the way of configuring USB-A power port type - add a symbol to the choice. Delete all configs that are set by default anyway. BUG=b:227472576 TEST=zmake testall BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I08005659e41c4a78ef60210fe1f23fdf6dbf42f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3575154 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>