summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* gitlab: Only run CI in main and coverage branchesfirmware-asurada-13885.B-mainJeremy Bettis2023-02-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | This workflow rule will prevent this CI config from running unless the branch name is "main" or "coverage". It will have to be cherry-picked into all the other branches to make them stop running sadly. BRANCH=None BUG=b:244766499 TEST=Used yaml validator at https://gitlab.com/zephyr-ec/ec/-/ci/editor?branch_name=main&tab=2 Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I536de3e3fdbca1c48505e61de5737f865bd0e233 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3872545 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> (cherry picked from commit 15612bc4af40cb2a824ff2590508df29f27fbf56) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4240329
* Asurada: move isl9238c_hibernate to board_hibernateSue Chen2023-02-031-2/+5
| | | | | | | | | | | | | move isl9238c_hibernate from board_hibernate_late to board_hibernate. BUG=b:247925239 BRANCH=asurada TEST=hibernate Change-Id: I56c3227111fd49a8d795ee1671a50c74b1dacd66 Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4218838 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Revert "mkbp: don't queue mkbp events in S3"Ting Shen2022-08-041-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 524cba08cceb373050cf79c41e4f6f92ff519c5e. Reason for revert: b/241036338 we need EC_MKBP_EVENT_BUTTON queued in S3. Original change's description: > mkbp: don't queue mkbp events in S3 > > In S3, if a mkbp event is not a wake source, we should not queue it in > the mkbp fifo, otherwise the system will see a bunch of outdated event > after resume. > > mkbp_fifo_add() uses the return value from mkbp_send_event() to > decide if it needs to queue the event. So we need to pass the decision > through the path activate_mkbp_with_events() -> mkbp_send_event() -> > mkbp_fifo_add(). > > BUG=b:238057993 > TEST=suspend -> lidclose -> lidopen(=resume) > verify that powerd does not see the lid close event. > BRANCH=cherry > > Signed-off-by: Ting Shen <phoenixshen@google.com> > Change-Id: I3e1c58f97020d7ee2e3b4b56f14c4cadf51bef64 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3765440 > Reviewed-by: Jett Rink <jettrink@chromium.org> > Commit-Queue: Ting Shen <phoenixshen@chromium.org> > Reviewed-by: Mengqi Guo <mqg@chromium.org> > Tested-by: Ting Shen <phoenixshen@chromium.org> Bug: b:238057993 Change-Id: I0b66b06d3c834641426dda24d71fc462d0030f92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3809735 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* mkbp: don't queue mkbp events in S3Ting Shen2022-07-181-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In S3, if a mkbp event is not a wake source, we should not queue it in the mkbp fifo, otherwise the system will see a bunch of outdated event after resume. mkbp_fifo_add() uses the return value from mkbp_send_event() to decide if it needs to queue the event. So we need to pass the decision through the path activate_mkbp_with_events() -> mkbp_send_event() -> mkbp_fifo_add(). BUG=b:238057993 TEST=suspend -> lidclose -> lidopen(=resume) verify that powerd does not see the lid close event. BRANCH=cherry Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I3e1c58f97020d7ee2e3b4b56f14c4cadf51bef64 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3765440 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Mengqi Guo <mqg@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 524cba08cceb373050cf79c41e4f6f92ff519c5e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3768138 Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* it8xxx2: The "M" extension is disabled by defaultDino Li2022-06-135-0/+60
| | | | | | | | | | | | | | | | | | | | | | | There is a mul instruction bug. The bug may cause instructions of writing back CPU GPR (e.g mv a0,s2) which following the mul instruction to fail. This patch disables the 'M' extension and overwrite integer multiplication and division arithmetic library routines with using hardware multiplication and division and nop instructions. This will ensure that there is no write back GPR instruction to follow mul instruction to avoid the bug. BUG=b:235297478 BRANCH=asurada,cherry,icarus TEST=- buildall - The "M" extension is disabled on cherry image (-march=rv32iac) Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I39b34a91dd77d975b78b6756494691c6b28dc42d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3690042 Reviewed-by: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 4a2e334030cf936cc5bc59b034b8bbbb6aa55caa) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3697773
* riscv: it8xxx2: pull __switch_task function into ram_code_ilm0 sectionDino Li2022-06-103-2/+5
| | | | | | | | | | | | | | | | | | | The ram_code section will out of space once mul instruction workaround is enabled. This change pulls the function into the second ram code section. BUG=b:235297478 BRANCH=asurada,cherry,icarus TEST=- buildall - Check map file, the function is in the ram_code_ilm0 section. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I236caf2261a16edf25185b2442d126ec6ed7ef41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3686728 Reviewed-by: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 9e82920e70ea835ec0744eb666a108f265f287fb) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3697760 Commit-Queue: Eric Yilun Lin <yllin@google.com>
* config: riscv: add CONFIG_RISCV_EXTENSION_M configurationDino Li2022-06-103-1/+11
| | | | | | | | | | | | | | | | | This makes the 'M' extension to be configurable. BUG=b:235297478 BRANCH=asurada,cherry,icarus TEST=- buildall - ISA for cherry images includes "M" extension (-march=rv32imac) Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I56957a6767378121443659a170ca33896ada67ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3690041 Reviewed-by: Eric Yilun Lin <yllin@google.com> (cherry picked from commit adae86b9387e261919d5e9921814f0d8f31f49fa) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3695854 Commit-Queue: Eric Yilun Lin <yllin@google.com>
* hayato: Enable CONFIG_SMART_BATTERY_OPTIONAL_MFG_FUNCJacky2022-05-171-0/+5
| | | | | | | | | | | | | | | | | | | | | Enable CONFIG_SMART_BATTERY_OPTIONAL_MFG_FUNC BUG=b:232494783 BRANCH=asurada TEST=make BOARD=hayato Run command "ectool i2cread 16 0 0x16 0x3c" Run command "ectool i2cread 16 0 0x16 0x3d" Run command "ectool i2cread 16 0 0x16 0x3e" Run command "ectool i2cread 16 0 0x16 0x3f" Run command "ectool i2cxfer 0 0x0b 2 0x70" Signed-off-by: Jacky <jacky5_wang@pegatron.corp-partner.google.com> Change-Id: I5b31d9ba1d1cee10b2db8751ca9e520991931b6f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3646984 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit c69a6af83883b4fb1da9bd3e3784db9425661912) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3650300 Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
* virtual_battery: Support Battery MFG function and manufacture infoMichael5 Chen12022-05-175-0/+43
| | | | | | | | | | | | | | | | | | | | Add Battery MFG function and manufacture info (0x70) BUG=b:228360450 BRANCH=kukui TEST=make buildall zmake build -a Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I81c73c468de170dac1ef141514cabbc30bf97536 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3595402 Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 7d03da76a7360483a00c499532cac0c3375067c3) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3644561 Tested-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Commit-Queue: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
* virtual battery: Write manufacturer access commandMichael5 Chen12022-05-163-1/+21
| | | | | | | | | | | | | | | | | | | Add battery command manufacturer data BUG=b:228360450 BRANCH=kukui TEST=make buildall Run command "ectool i2cwrite 16 2 0x16 0x00 0x0001" on damu. Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: Ic560c76cf6ccffecf0f35f4d8d8d7abaa0a6bce2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3595399 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 197da82322401ec38a181b28fb00ff37e647440b) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3644558 Commit-Queue: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Tested-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
* virtual_battery: Return manufacturer dataMichael5 Chen12022-05-163-0/+27
| | | | | | | | | | | | | | | | | | | Add battery command manufacturer data BUG=b:228360450 BRANCH=kukui TEST=make buildall Run command "ectool i2cxfer 2 0x0b 0x05 0x23" on damu Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: Iab93801e28b0d6f32cb257c19573e6dfbdc3c3bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3583910 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 4efe01202e6c8e5681c953732ebf3ada539c8804) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3644395 Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Commit-Queue: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Tested-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
* chgstv2: rework "charge_command_charge_control()"Tommy Chung2022-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | Condition of judging whether to enable or disable the battery sustainer should be the mode host commands give, not the current chg_ctl_mode. BUG=b:194219157, b:222620437 BRANCH=none TEST=make sure that the battery sustainer will not be incorrectly enabled when giving "ectool chargecontrol discharge" or "ectool chargecontrol idle" under CHARGE_CONTROL_NORMAL mode. Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Change-Id: I8a28970164a7e80805601817f2761d6684b183cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3070328 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit f60c312dcf183fdaef40d9a32f092193f8ec89db) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3573695 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* chgstv2: Add unit test for battery sustainerDaisuke Nojiri2022-04-072-20/+107
| | | | | | | | | | | | | | | | | This patch adds a unit test for the battery sustainer. BUG=b:188457962 BRANCH=None TEST=make run-sbs_charging_v2 Change-Id: Ica227cf4ee3f71a746150fb6a5f4e40ab8ca0720 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2987734 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 29f7ce6dc2e941bf00d1a0ee233a9b388a7bb0d5) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3573694 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* driver/tcs3400: Set timestamp when emulating interruptGwendal Grignou2022-02-181-18/+13
| | | | | | | | | | | | | | | | | | | | | | | | | Use the same interrupt handler for wire or emulated interrupt, so we are sure to timestamp the samples. BUG=b:218890983,b:129419982 TEST=make -j buildall Check on kukui/krane that tast test hardware.SensorIioserviceHard passes. It would fail previously with error like: "error during validation: too much delta between samples for lid cros-ec-gyro at index 174(1m52.310435376s): got 14.894431ms; want <= 7.5ms" BRANCH=kukui,asurada Fixes: commit ae22b703601 ("driver: add an option to emulate irq event in TCS3400") Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I9f4deaa214abe6e8ac7a2aa6b6071a02565f8825 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3454215 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit c09e13ca676a25c64a66f5db2149d8e2197ffbb9) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3465945
* flash_ec: add error message for missing i2c-pseudo moduleTing Shen2022-01-211-0/+8
| | | | | | | | | | | | | | | | | | | | | Missing i2c-pseudo is a FAQ for people not familiar with ite devices. Add this to the error message to unblock their work. BUG=none TEST=1) Unload module, remove /lib/modules/*/extra/i2c-pseudo.ko. run flash_ec. Verify that error message is displayed. 2) Install i2c-pseudo, verify that flash_ec still works. BRANCH=asurada,cherry Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I936b06b1c69c7448c39b92ed40e320609589292b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3404352 Tested-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 5b65df181b1016bd16059c5dfa4f984f450ced75) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3405647
* asurada: disable DCI function on PS8743 to save powerTing Shen2021-12-102-1/+10
| | | | | | | | | | | | | | | BUG=b:209528621 TEST=manually BRANCH=asurada Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ia85a861f8895d055dea48463cb2bcdd93e8ea569 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3320081 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit e4fba9246db72c4f44f4cf3e7c3a742753bb6e37) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3324700
* ps8743: add i2c_field_update and DCI mode config registerTing Shen2021-12-102-0/+18
| | | | | | | | | | | | | | | | | Add helper function and registers for Asurada. BUG=b:209528621 TEST=make BRANCH=asurada Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ia1b6f8761ce4cc23a1f671ca752b6004ac16eaaf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3320080 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 70e0694ffb569b5b5cbc0dd411628125083dc557) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3324699
* mt6360: prevent BC1.2 trigger after PD establishedTing Shen2021-12-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry-picked from CL:3299287 and removed rt1718s part) Add an extra check to prevent BC 1.2 detection trigger when VBUS state change after pd connection established (for example, power role swap or fast role swap) and break the existing USB2 connection. Note that after this change, BC1.2 detection still triggers when a PD charger just plugged in, because bc1.2 detection happens before EC awares that the adapter supports PD. BUG=b:193753475 TEST=verify BC1.2 detection doesn't trigger in following scenario: 1) power role swap 2) fast role swap 3) plug in USB-C-to-A adapter BRANCH=asurada Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I6657d7f1fd8b8f2aad19744b89f794e107cd45c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3299287 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 762e1373319c42230923f7310d25a54d64697374) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3310397
* system: don't hibernate if AC is presentRicardo Quesada2021-11-091-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL prevents hibernation if AC adapter is connected. This is to prevent AP from rebooting. This might happen because if EC is hibernated when AC is connected, it might wake up immediately in response to AC being connected, resulting in AP reboot. BUG=b:192259035 TEST=delbin EC console: run "hibernate" w/ AC: didn't hibernate. Press Alt+Volume Up+H w/o AC: it hibernated. Press Alt+Volume Up+H w AC: it didn't hibernate. BRANCH=none Signed-off-by: Ricardo Quesada <ricardoq@google.com> Change-Id: I07dee088e5b6ed7d0b3901049323d93ef4d0b9c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3042989 Commit-Queue: Ricardo Quesada <ricardoq@chromium.org> Tested-by: Ricardo Quesada <ricardoq@chromium.org> Auto-Submit: Ricardo Quesada <ricardoq@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 210d9ab509fffed848d491b73219d863b3155301) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3269866 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* hayato: Fix icm40608 will pending when gryo set offset value.Michael5 Chen12021-11-031-0/+1
| | | | | | | | | | | | | | | | | | | | Because the configuration "icm426xx_base_gyro" miss setting "drv_data". It will cause icm40608 will pending when gyro set offset value. BUG=b:193752214 BRANCH=asurada TEST=manual 1. ectool motionsense offset 1 0 0 0 2. watch ectool motionsense => Check icm40608 sesnor. Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I895df941192c86a447c552f3872c9156d61bec80 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3256731 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> (cherry picked from commit ee290758caf172eca83431627acaafb65352a276) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3257948 Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* charge: respect PDO current maximum limitEric Yilun Lin2021-10-183-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | The current input limit setting doesn't respect the PDO's current limit (e.g. when the current limit is less than CONFIG_INPUT_CURRENT_LIMIT) and this might cause the over-draining the charger. BUG=b:172878439 TEST=1) make buildall 2) modified servo-v4 which only broadcast PDOs with 250mA current limit and ensure the goroh won't sink more than 250mA. (while the CONFIG_INPUT_CURRENT_LIMIT is 512mA) BRANCH=main Change-Id: I09f8e6fb39a072ee38ea09a5c9898984f4122513 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3220037 Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> (cherry picked from commit 537def8417e4cdf7f381474c57ec93f6cb963a3c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229046 Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* it83xx: clock: fix sequence to set PLL control registerDino Li2021-09-281-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We change event timer's clock to 32.768kHz before entering low power mode. And will restore the clock to 8MHz (by checking PLL control register's setting in ISR) when chip wake up from the low power mode. So we need to ensure the setting is taken into PLL control register before wfi instruction. The original implementation can't ensure event timer’s clock is restored to 8MHz when chip wake up. So we fix it. This also fix wfi (wait for interrupt) instruction fail issue on RISV-V core chips when a timer count down to zero (MTIP@mip is set to 1 until HW reload timer counter). Once CPU executed wfi instruction, CPU should stay there until interrupt is fired or MEIP@mip is non-zero. But currently, HW checks entire mip value (should check MEIP@mip only) to decide whether or not to ignore wfi instruction. The issue will cause EC premature wake from idle task even there is no interrupt fired. BRANCH=asurada, icarus BUG=none TEST=-On asurada, increase CPU clock to 96mhz. Plug out/in type-c adapter to wake chip up from low power mode, no pre-watchdog warning fired. (x100) -buildall Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I72bb2566c5b22bc132ab304a38a5a1b5b968e463 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3168672 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 4e2d1981915533a3f214b4075babd49c8ca6c0ef) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3189461
* usb_pd_dual_role: fix dbz when parsing PDOEric Yilun Lin2021-09-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This path was hitted by ec_usb_pd_fuzzer. BUG=b:198325864 TEST=cros_fuzz --board=amd64-generic reproduce \ --fuzzer ec_usb_pd_fuzzer \ --testcase /build/amd64-generic/tmp/\ clusterfuzz-testcase-minimized-ec_usb_pd_fuzzer-6223286274490368 \ --package chromeos-ec --build-type ubsanh BRANCH=main Change-Id: I9575a890bba16145f3d92d1ecc84afcf12d72d67 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159850 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit f464d2e99a9cb51cd422d65f43c9a77b57744003) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3162465 Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Rong Chang <rongchang@chromium.org> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Rong Chang <rongchang@chromium.org>
* Clear OWNERS for factory/firmware branchBrian Norris2021-09-107-24/+0
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155134 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* riscv: panic: S0/S1 are clobbered registers in software_panic()Dino Li2021-09-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | So compiler won't use these two registers to store any other value in the function. This fixed software panic info isn't correct issue when LTO is enabled. BRANCH=asurada BUG=b:179206540 TEST=Run "crash assert" on hayato, the software panic info is correct. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I4a94e7ea94ebc0bf4f056de58edb66c2962d669d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3113485 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 5a6406cf2ec23b0c28dfd8bb8d1db4edb810ebcf) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115605 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Revert "HACK: it8xxx2: handle irq 0"Eric Yilun Lin2021-09-035-41/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6393f2a6cea0a18a57c3b8240a57e8593b30c5ae. Reason for revert: fix by https://crrev.com/c/3139652 Original change's description: > HACK: it8xxx2: handle irq 0 > > EC panic info shows CPU M-mode external interrupt is fired with > EC interrupt 0 (AIVECT register = 0x10). > This CL creates ISR for interrupt 0 to print out CSRs (control and > status register) and current AIVECT's value when hit this issue. > These info should be able to provide us with more details. > > Also because the ISR created, EC won't go into __unhandled_irq > exception to reset itself, then we can observe EC’s status. > > BRANCH=asurada > BUG=b:179206540 > TEST=fire software interrupt 0, EC prints CSR info out. > > Signed-off-by: Dino Li <Dino.Li@ite.com.tw> > Change-Id: I193393fb64c4816a6cefa22db63e497910116e6b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115647 > Reviewed-by: Eric Yilun Lin <yllin@google.com> > Commit-Queue: Eric Yilun Lin <yllin@google.com> > Tested-by: Eric Yilun Lin <yllin@google.com> Bug: b:179206540 Change-Id: I417959f89403e4743584f04f975394138568067b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139863 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* it83xx/riscv: Ensure IER has been disabled before enabling CPU interruptDino Li2021-09-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This CL read EC's IER one time after configured. The load operation will ensure chip-level's interrupt has been disabled before enabling CPU interrupt. BRANCH=asurada, icarus BUG=b:179206540 TEST=create stress test on it8xxx2 evb: - Loop calling task_disable_irq() and task_enable_irq() to enable and disable IRQ 13 (keyboard KSI interrupt). - Toggle KSI continuously. Without the patch, EC will hit IRQ 0 issue in two seconds. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I56bad182bd101d45b00368083b60aabbd9fb8bdb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139652 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 7999cc115b95dc918ec6a89d4e0f4b55728557d7) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139520 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* Revert "HACK: baseboard/asurada: enable CONFIG_IT83XX_HANDLE_IRQ_0"Eric Yilun Lin2021-09-031-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 270bec355847733746b685cba2c446acb2ed01b0. Reason for revert: fix https://crrev.com/c/3139652 Original change's description: > HACK: baseboard/asurada: enable CONFIG_IT83XX_HANDLE_IRQ_0 > > BRANCH=asurada > BUG=b:179206540 > TEST=fire software interrupt 0, EC prints CSR info out. > > Signed-off-by: Dino Li <Dino.Li@ite.com.tw> > Change-Id: Ifcf653599e51f3974d2b1037b26d2b7df7031bcd > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115648 > Reviewed-by: Eric Yilun Lin <yllin@google.com> > Commit-Queue: Eric Yilun Lin <yllin@google.com> > Tested-by: Eric Yilun Lin <yllin@google.com> Bug: b:179206540 Change-Id: I06b7b4d60dce4d3de4eab4f837d3e47d89e7af25 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139862 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Reviewed-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* it83xx/irq: there is no need to configure IER on nds32 core chipDino Li2021-09-031-2/+10
| | | | | | | | | | | | | | | | | | | | | Configure interrupt enable register is redundant on nds32 core chip (IT8320). We just need to configure extended IER. BRANCH=asurada, dedede BUG=b:197308582 TEST=buildall passes, storo and hayato boot. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I8f99f7b937ac98d95b2f50f5be7b461ae3e9a413 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3134888 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 14b2c5df42665b8d592807de604ec7a930ead262) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139866 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* usbpd: support dynamic PDO selectionEric Yilun Lin2021-09-0110-5/+774
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support dynamic PDO selection CONFIG_USB_PD_DPS. This config controls the charging voltage and power according to the input power and battery configuration. DPS would continuously evaluate the system load and current charging voltage, and decide a new one by below: 1. If the PDO can fulfill system desired power. 2. If the PDO is efficient for the battery configuration. To detect if the system load cannot be fulfilled by the current PDO, it checks: 1. if the input current closes to the PDO current limit. 2. if the input power closes to the PDO maximum power. To detect if the system load can be fulfilled by a more efficient PDO, it checks: - if the voltage of a new PDO is closer to the battery voltage than the current PDO, and the power is able fulfill the system load. BUG=b:169532537 TEST=1. tested on asurada, the charging voltage is able to switch to different PDOs under different system loads 2. tested that the DPS is able to switch charge port (e.g. C1 12V -> C0 9V) based on the provided PDOs. BRANCH=asurada Change-Id: I7c7706b331dc0d4f8ac68569dc7ed852fc9308e3 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2897064 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 61bbfcaa37ecec87a9cea89e0f8fc65ecbecd13e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133187 Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* mt6360: Don't clear negative number supplier's charge port infoDino Li2021-08-271-1/+3
| | | | | | | | | | | | | | | | | Because we didn't create space for it to store current/voltage info. Clear its charge port info will override other global variables. BRANCH=asurada BUG=b:179206540 TEST=No panic on asurada when plug AC only on port 0. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ia7a9a058d65aca9b5a84963d1e08f3e2541bc8da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3113487 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit ffc3742a73c7124c62890210f9136908e7b669c1) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115870
* HACK: baseboard/asurada: enable CONFIG_IT83XX_HANDLE_IRQ_0Dino Li2021-08-241-0/+3
| | | | | | | | | | | | | BRANCH=asurada BUG=b:179206540 TEST=fire software interrupt 0, EC prints CSR info out. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ifcf653599e51f3974d2b1037b26d2b7df7031bcd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115648 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* HACK: it8xxx2: handle irq 0Dino Li2021-08-245-0/+41
| | | | | | | | | | | | | | | | | | | | | | EC panic info shows CPU M-mode external interrupt is fired with EC interrupt 0 (AIVECT register = 0x10). This CL creates ISR for interrupt 0 to print out CSRs (control and status register) and current AIVECT's value when hit this issue. These info should be able to provide us with more details. Also because the ISR created, EC won't go into __unhandled_irq exception to reset itself, then we can observe EC’s status. BRANCH=asurada BUG=b:179206540 TEST=fire software interrupt 0, EC prints CSR info out. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I193393fb64c4816a6cefa22db63e497910116e6b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115647 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* hayato: Fix gyro sensor rotation mistakeMichael5 Chen12021-08-231-10/+12
| | | | | | | | | | | | | | | | | | | Because rotation matrix will be overwritten by function "update_rotation_matrix" when AP SW SYNC. Modify update_rotation_matrix condition to fix it. BUG=b:193752214 BRANCH=asurada TEST=Run "watch ectool motionsense lid_angle" Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: Ia39265ed7acc1f3cb2cbd2fa3971a8dc65362779 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3106633 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit d63ba9739b77bece9e0be136dd256c89ce2fd688) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3109274 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* spherion: enable USMEric Yilun Lin2021-08-232-1/+13
| | | | | | | | | | | | | | | | | | | | | | | Ultrasonic Module(USM) is used for noise cancelling the buzzing sound while charging. The sound is louder if we have USB peripheral connected. We only enable this function in S0, and disable it in S3 because the power consumption is significant. BUG=b:185978753 TEST=make buildall BRANCH=asurada Change-Id: Ic2bfbf5a1364f5da6d776a1be56abb66934f9496 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3105905 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 1fb82e8268c4c31b21f910a0682d35a22ee5c45d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3112702 Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* usbpd: do not enter DP mode in S5->S3 transitionEric Yilun Lin2021-08-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | If DUTs enter mode in S5->S3, and the mux would be re-configured after in S3 and make the DP alt mode not correctly function. BUG=b:194031794 TEST=plug DP dongle in S5/G3 on Asurada, boot to S0, and see display BRANCH=asurada Change-Id: Iee0ea2549e68ca7effc8cc538c22f4d388f10943 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093347 Reviewed-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit b1e287f83f45e9b8217b7249c335369e1a3e873c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3096810 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
* chgstv2: Add battery sustainerDaisuke Nojiri2021-08-121-3/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the battery sustainer. Given a target SoC by the host, the sustainer will try to keep the SoC stay close within the range near the target. The diagram below shows how the sustainer uses the charge mode to charge or discharge the battery as the SoC moves near the target: T-d% T% ----------|----------------------|----------- charge normally charge normally/slowly (mode=NORMAL) ... ----> +---------------------> | | <----------------------+ <----- ... discharge naturally discharge normally (mode=IDLE) (mode=DISCHARGE) When AC is unplugged, the sustainer is disabled. Currently, the sustainer requires CONFIG_CHARGER_DISCHARGE_ON_AC. > chgstate state_of_charge = 69% chg_ctl_mode = NORMAL manual_voltage = -1 manual_current = -1 Battery sustainer = off (-1% ~ -1%) > chgstate sustain 70 72 state_of_charge = 69% chg_ctl_mode = NORMAL manual_voltage = -1 manual_current = -1 Battery sustainer = on (70% ~ 72%) > battfake 71 > chgstate state_of_charge = 71% chg_ctl_mode = NORMAL > battfake 73 > chgstate state_of_charge = 73% chg_ctl_mode = DISCHARGE manual_voltage = -1 manual_current = -1 > battfake 71 > chgstate state_of_charge = 71% chg_ctl_mode = IDLE manual_voltage = 0 manual_current = 0 Unplug AC and EC keeps running. > chgstate state_of_charge = 73% chg_ctl_mode = DISCHARGE manual_voltage = -1 manual_current = -1 Replug AC. > chgstate state_of_charge = 73% chg_ctl_mode = DISCHARGE manual_voltage = 0 manual_current = 0 BUG=b:188457962 BRANCH=None TEST=Atlas. See the description above. Change-Id: I62b4e8bc9517900a5a32d2f35369c645fa8a60c3 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2929347 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit b67eba19973a046ffdc87926d527f240bfee29d7) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3086790 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* chgstv2: Refactor charger_discharge_on_acDaisuke Nojiri2021-08-123-29/+37
| | | | | | | | | | | | | | | | | | | | This patch makes charger_discharge_on_ac call board_discharge_on_ac. It also makes set_chg_ctrl_mode call charger_discharge_on_ac. This makes sense since when the charge control mode changes, discharge-on-ac also needs to be enabled or disabled. BUG=b:188457962 BRANCH=none TEST=make runhosttests Change-Id: I65ec09f580afc987cc86f4c60c15c1f90ead6c3c Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2986848 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088963 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* Update EC_CMD_CHARGE_CONTROL to version 2Daisuke Nojiri2021-08-124-9/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Version 2 of EC_CMD_CHARGE_CONTROL can control battery sustainer. It allows the host to set the upper and lower thresholds between which the EC tries to keep the battery state of charge. Version 2 of EC_CMD_CHARGE_CONTROL also supports 'GET' request. It allows the host to query the current charge control settings. localhost ~ # ectool chargecontrol Charge mode = NORMAL (0) Battery sustainer = off (-1% ~ -1%) localhost ~ # ectool chargecontrol normal 66 66 Charge state machine is in normal mode with sustainer enabled. localhost ~ # ectool chargecontrol Charge mode = NORMAL (0) Battery sustainer = on (66% ~ 66%) localhost ~ # ectool chargecontrol normal Charge state machine is in normal mode. BUG=b:188457962 BRANCH=none TEST=Atlas. See above. Change-Id: I81ec62172b4f159c46334fc0f940a2adae3f2b8a Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2929340 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088962 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* enable CONFIG_CMD_CHARGENNamyoon Woo2021-08-121-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | This patch enables the uart command, chargen by default. It generates a series of alphanumeric chractecters, and is useful in testing UART related modules with a stress workload. This patch occupies 400 bytes or so in flash memory of RW image. BUG=b:158477297 BRANCH=all TEST=ran it on Atlas, Puff, and Volteer. Signed-off-by: Namyoon Woo <namyoon@chromium.org> Cq-Depend: chromium:1679710,chromium:1554198,chromium:2080933,chromium:2217112 Change-Id: I3c0407e7a4a6d3bb8d998e3e5618be5769192a8c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2951863 Reviewed-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit a1a7979aaf4187acafbb7a6cfae3166274ec0645) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3088956 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* driver: lis2dw12: Set FIFO vector number properlyGwendal Grignou2021-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We have been lucky the accelerometer was always in first position, as the FIFO filling routine always set the sensor number to 0. Fix for hayato. BUG=b:192649615 TEST=On hayato, using iioservice_simpleclient --channels="accel_x accel_y accel_z" --device_id=0 --frequency=10 --samples=10 Check the sensor data is constant. (device_id 0 is the base accelerometer), we get data for that sensor only. Checking with device_id set to 2 (the lid accelerometer), that we get samples for that sensor. BRANCH=asurada Signed-off-by: Gwendal Grignou <gwendal@google.com> Change-Id: I96ea5f696c38b8c54aed7537f93eba70a647dc53 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069990 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 9b779dd2ce02e7b43b5bf835c09aff4f3ea3a21f) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3072401 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* spherion: config GPIOA2 to INPUT + PULL DOWNBen Chen2021-08-031-1/+1
| | | | | | | | | | | | | | | | | sysjump to RW the GPIO init PULL up, will cause keyboard backlight blinking. BUG=b:194047863 BRANCH=asurada TEST=sysjump RO/RW to check, backlight don't blinking. Change-Id: I27adfb99b2b9c7708302556eb07b87d5130db777 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3063877 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 8f5bab3aaf97f7a2b9778a3ebdbde83c86a4c3e2) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3068838 Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* it83xx: pwm: fix wrong index of pwm_channelsDino Li2021-07-221-3/+3
| | | | | | | | | | | | | | | | BRANCH=none BUG=b:194047863 TEST=On spherion, no keyboard backlight blinking. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I847291268720bf12ca98b3e38e29a556ec038cd0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3043075 Tested-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 877ac2c151a7858836196a526fdc522c406ac30e) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3041517 Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* hayato: gyro sensor add 2nd source icm-40608Michael5 Chen12021-07-193-1/+93
| | | | | | | | | | | | | | | | | | gyro sensor add 2nd source icm-40608 BUG=b:193752214 BRANCH=asurada TEST=manual Using command "watch ectool motionsense lid_angle" and check angle. Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I741d1ca86642d8949af23167b09867b98a3ad79b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3030601 Reviewed-by: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 2c71fa9450c41b8ade2142c34753981cc358ea43) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3034800 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
* common: motionsense fifo: Reset the initialized bits after commitYuval Peress2021-07-122-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously once we had one sample from a sensor, we considered the fifo initialized. Meaning we would use our computed next timestamp to spread the timestamps. This was causing issues with some devices that ended up causing the timestamps to run ahead. Reset next_timestamp_initialized back to 0 after each commit. This will allow repeated timestamps but only if a driver stages/commits the same timestamp twice. Staging the same timestamp with only a single commit will still work as before (which is the expected path). BRANCH=none BUG=b:168335284 TEST=make run-motion_sense_fifo Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib7c566f69d7c1e4e898050b67105555dd05376e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2871055 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> (cherry picked from commit 9ac6a40461e949d122cd68f89818e94eeb820f58) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2875110 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
* i2c_controller: add volatile for i2c_port_active_listEric Yilun Lin2021-06-251-2/+2
| | | | | | | | | | | | | | | | | | | | With the LTO enabled, the i2c_port_active_list might be reordered by linker and causes the i2c lock checking failure. BUG=b:191444593 TEST=i2c waveform looks good, no "Access i2c without lock" complain BRANCH=none Change-Id: I96996c7288b65e74f1734fd14a82f069b6ff11ff Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2984257 Tested-by: Eric Yilun Lin <yllin@google.com> Tested-by: Hsu Alvis <alvishsu@google.com> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit 2ffc903ae4c772f2b12897634e24fa8e0c1791ef) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2986849 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* asurada: config MKBP host event wake source.Eric Yilun Lin2021-06-161-0/+5
| | | | | | | | | | | | | | | | | | | To explicitly exclude the DP enter mode event as wake source, and allow keyboard matrix and host event. BUG=b:187159670 TEST=verify DP enter mode event won't wake the system from suspend BRANCH=asurada Change-Id: If8f2258579f26ebbb3f521d0614854fe31dc1bad Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2870891 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> (cherry picked from commit f75b7d2deed1c5f25ee3df2b4e4ceb77c20cf3d3) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2966522 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* asurada: renames ADC_VBUS to ADC_VBUS_C0Eric Yilun Lin2021-06-162-2/+1
| | | | | | | | | | | | | | | | | To make the naming clearer that's pointed to C0 port. BUG=none TEST=make buildall BRANCH=asurada Change-Id: If9cb520114b893af995aa67a2281b8e7302c2771 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2814729 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit 5d346dd2f95125934632d07a7d02247ec6a21df8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2966523 Tested-by: Ting Shen <phoenixshen@chromium.org>
* spherion: support thermal charge policyBen Chen2021-06-162-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | supports skin temperature thermal policy from charge current setting via charger temperature threshols hit/release. setting input max current to 3.1A. The charging limitation is listed below: While NB in OS, sample temperature as chager task Tsens < 48 degree C , No limitation Tesen > 48 degree C , Limit charge current at 3.1A Tsens > 52 degree C , Limit charge current at 2.2A BUG=b:183174897 BRANCH=asurada TEST=The thermal test report PASS, make builadall PASS. Change-Id: I1d66fb133324e186c58a716b9c61e07b3edbdd7e Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2962200 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit a1815d00eedc0bcaa81220f861a3fa9b5ae38753) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2966520 Tested-by: Ting Shen <phoenixshen@chromium.org>
* asurada: add least to boot AP battery percentEric Yilun Lin2021-06-151-0/+1
| | | | | | | | | | | | | | | | | | BUG=none TEST=make BARDO=hayato BRANCH=asurada Change-Id: I82be5b51508c91077f26fd014a666a7db4769ee8 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2954987 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> (cherry picked from commit ada8db32a3578cab97257af6cbe783187bfdda2c) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2959006 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>