summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Battery: Apply faked state of charge to remaining capacityDaisuke Nojiri2020-09-291-6/+22
| | | | | | | | | | | | | | | | Currently, only the state of charge is modified by battfake command. This patch applies the faked state of charge to the remaining capacity as well. BUG=b:163721887 BRANCH=Octopus TEST=Verified Fleex wakes up host on BATTERY_LEVEL_CRITICAL. TEST=Verified powerd reports faked state of charge. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I34eb409bab129804a983abbe2a1d021298ce044e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432865 Reviewed-by: Todd Broch <tbroch@chromium.org>
* Dedede: Remove requirement for >15W to boot with no batteryDiana Z2020-09-291-1/+0
| | | | | | | | | | | | | | | Allow dedede boards to boot with only a 15W charger present. BRANCH=None BUG=b:166003337,b:168730307 TEST=on waddledoo and waddledee, confirm board can boot to S0 and remain there with a 15W charger in C0 or in C1 and no battery Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I24f8f2f13bb2b2ba92ba6e2b87db569bd023e5c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2438670 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* common: include config.h from console.hJack Rosenthal2020-09-293-0/+7
| | | | | | | | | | | | | | | | | | | | | console.h currently relies on many config options to selectively define macros. It does not currently include config.h, which means these config options are not guaranteed to be defined by this point. We will need this for Zephyr as well. There were a few configuration header files which implicitly relied on the ording of including console.h to bring in stdint.h at some point. We explicitly include what we use here to fix that. BUG=b:167590251 BRANCH=none TEST=build passes Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Ia005577a2579962ee8b14c61930f37fe28bc8f5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427088 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* tree: rename atomic_* functions to deprecated_atomic_*Jack Rosenthal2020-09-2956-245/+337
| | | | | | | | | | | | | | | | We will move to an API compatible with Zephyr's API. See the bug for complete rationale and plan. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id611f663446abf00b24298a669f2ae47fef7f632 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427507 Tested-by: Dawid Niedźwiecki <dn@semihalf.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* common: body_detection: modify calculation of noise levelChing-Kang Yen2020-09-292-1/+14
| | | | | | | | | | | | | | | | | | | We used rms_noise^2 as noise level for body_detection. But, there are still some different noise level based on different devices. Add the CONFIG_BODY_DETECTION_VAR_NOISE_FACTOR to adjust the noise_level. Default value is 120%, since the 100% of the rms_noise^2 is not enough, especially in 200Hz. BRANCH=None BUG=b:123434029 TEST=make buildall; make BOARD=ampton, re-flash the DUT, see if the body detection works Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Change-Id: I2a7416b0bd8d0aac51d16c3aed9d962837f52c0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2416477 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>
* cts: Migrate cts.py to python2/3 compatibleYilin Yang2020-09-292-30/+44
| | | | | | | | | | | | BUG=chromium:1031705 BRANCH=master TEST=None Signed-off-by: kerker <kerker@chromium.org> Change-Id: If043aa2d7d8b758571f43730635f741e3b81d8ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431316 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tigertool: Migrate tigertool.py to python2/3 compatibleYilin Yang2020-09-291-2/+4
| | | | | | | | | | | | BUG=chromium:1031705 BRANCH=master TEST=None Signed-off-by: kerker <kerker@chromium.org> Change-Id: I50b9aa6724bc6d9db5c7f743909d81c0b2dfc849 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431319 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* asurada: remove board_get_version() == 0 checkTing Shen2020-09-293-43/+22
| | | | | | | | | | | | | | | | | Since hayato firmware is ready now, we can now replace board_get_version() calls by compile time macros to make the code simpler. BUG=b:163098341 TEST=make BOARD=asurada/hayato BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I5d40e29d097f0cf0cbc6d58b6154832e928445fb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437237 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* asurada: configure adc channels for rev2Ting Shen2020-09-294-50/+6
| | | | | | | | | | | | | | | | | | | | Implement new gpio changes for rev2, including: - temp sensors removed - VBUS adc assigned to ADC0 - new location for it5205 interrupt is TBD, temporarily remove the code BUG=b:168767467 TEST=1) `adc` in ec console 2) `ectool usbpdpower` BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I4de70280ad5c1af227242d62cf0aa61758f8cc20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2435266 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* Esche: Override battery LEDs to indicate system suspendDevin Lu2020-09-291-0/+18
| | | | | | | | | | | | | | | Esche is non-power LED design, to indicate system suspend, blinking battery white LED (1 sec on/1 sec off) to indicate system suspend without charging. BUG=none BRANCH=firmware-kukui-12573.B TEST=Make sure LED blinking on suspend without charging. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I7a2fb73434efec7da3bf5bcd68d658db20418f99 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432227 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Esche: Delete boardDevin Lu2020-09-297-939/+0
| | | | | | | | | | | | | Share with same firmware with Burnet base on SKUID. BUG=b:161767717 BRANCH=firmware-kukui-12573.B TEST=make buildall Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I5b7e3b69d8af821aea5646ee40e510a6dc45d271 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431311 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Burnet/Esche: Disable IMU sensors base on SKUIDDevin Lu2020-09-292-29/+53
| | | | | | | | | | | | | | | Burnet is 360 SKU and Esche is clamshell SKUID. Disable Esche IMU sensors base on SKUID. BUG=none BRANCH=firmware-kukui-12573.B TEST=On Burnet, check sensor initial passed. TEST=On Esche, check no sensor initial. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I1839fb7c1366c8ccde6db00f0fba9f1eb9f6d3a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2387681 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* kukui/baseboard: enable CONFIG_HOSTCMD_AP_SET_SKUIDDevin Lu2020-09-291-0/+1
| | | | | | | | | | | | | | CL:2321689 already sent SKUID to EC. This patch enable AP set SKUID to EC to distinguish platform factor. BUG=b:161767717 BRANCH=firmware-kukui-12573.B TEST=make buildall -j and boots to Burnet Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I5f92c293a26c0612b3a61bf009961217e17e8f3d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2386691 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Kukui/baseboard: free flash spaceDevin Lu2020-09-294-21/+7
| | | | | | | | | | | | | Disable PD log and enable GPIO short name to save ~800 bytes for RO. BUG=none BRANCH=none TEST=make buildall Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I326199411a3728b0ff6f5dc9531ad054245b31b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432226 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Burnet: unmux pins away from emmc once we want to talk to sensorsDevin Lu2020-09-292-13/+19
| | | | | | | | | | | | | | Apply CL:2043151 to burnet. BUG=b:169259387 BRANCH=firmware-kukui-12573.B TEST=Boot Burnet, no sensor init fail. TEST=emmc still works. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ic4bde54ab3bf2b1482230335fe5d2b71dc72faa6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2430908 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Madoo: Remove redriver for later buildelmo_lan2020-09-292-2/+12
| | | | | | | | | | | | | | | Modify usb_mux structure, and set up by different board_id. BUG=b:162802526 BRANCH=none TEST=modify board_version and unit can project to external monitor via main board type-c. Signed-off-by: elmo_lan <elmo_lan@compal.corp-partner.google.com> Change-Id: I13b3ef4d808edf4aa667d36053897dd1369daa81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431320 Reviewed-by: Henry Sun <henrysun@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zed: initial commitTing Shen2020-09-293-0/+14
| | | | | | | | | | | | | BUG=b:167884598 TEST=make BOARD=zed BRANCH=master Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I0b3542bff38756c07e5073672f0d485cd6a9d0c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2428444 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* chip/mt8192_scp: support ULPOSCTzung-Bi Shih2020-09-294-0/+478
| | | | | | | | | | | | | | | Supports ULPOSC and selects ULPOSC2 (360MHz). BRANCH=none BUG=b:146213943 BUG=b:156222893 TEST=make BOARD=asurada_scp Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Signed-off-by: Weiyi Lu <weiyi.lu@mediatek.com> Change-Id: Ib9f043bb5575a6e18fc64479c7b241e11e012b5c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2198823 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* Revert "Zork: Workaround for bad ISL9241 CONTROL1 read"Edward Hill2020-09-293-46/+5
| | | | | | | | | | | | | | | | This reverts commit 61d40d6eaa88437d48e06fba9b773f7eb99f6ecc. Revert the workaround since CL:2393404 solved the problem. BUG=b:163076059 BRANCH=zork TEST=none Change-Id: I0397141b5b4e15736172474cb073842e18c3a71d Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437194 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* util/presubmit_check.sh: disable buildall requirementJack Rosenthal2020-09-291-36/+0
| | | | | | | | | | | | | | | | | This was added to the presubmit back in the days of the legacy commit queue, to avoid blowing up the CQ when unit tests had not been run. This is unnecessary now with Parallel CQ, these tests are run as a part of CL-specific commit queues. BUG=none BRANCH=none TEST=presubmit Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I57837755e37cc46f80ad5bd7c61082d2c7077aa8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2436379 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* TUSB544: Set TUSB544 always to DP Alt mode sourceSue Chen2020-09-291-4/+2
| | | | | | | | | | | | | | | | | | Since all chromebooks are DP SRC, set TUSB544 always at DP Alt mode source (set TUSB544_DIR_SEL_USB_DP_SRC to register TUSB544_REG_GENERAL6). BUG=b:169303733 BRANCH=zork TEST=Plug in typeC monitor which can provide 20V power and make sure it can display while boot to S0 on Ezkinil. Change-Id: I893f7f0ca98ede6ffd678c1118212cad9184d2ba Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431313 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* berknip: Remove sensorsEdward Hill2020-09-295-110/+4
| | | | | | | | | | | | | | Remove motion sense (gyro + accel) drivers, since HW has none. BUG=b:166183179 BRANCH=zork TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I954bf491dd7cecf8a76d28b02ea100a0decb12d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2437191 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* honeybuns: Enable I2C feature and CBI supportScott Collyer2020-09-294-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds config options and tables required to pull in i2c support for honeybuns. In addition, config options for CBI were added to facilitate i2c testing. BUG=b:148493929 BRANCH=None TEST=ran i2cscan on quiche > i2cscan Scanning 0 usbc................. 0x18. 0x19. 0x1a. 0x1b. 0x1c. 0x1d. 0x1e. 0x1f. 0x20. 0x21. 0x22. 0x23. 0x24. 0x25. 0x26. 0x27........................... 0x42.............................. 0x60....................... Scanning 1 usb_mst. 0x08. 0x09. 0x0a. 0x0b. 0x0c. 0x0d. 0x0e. 0x0f. 0x10. 0x11. 0x12. 0x13. 0x14. 0x15. 0x16. 0x17.......................................... 0x41................................ 0x61......... 0x6a............. Scanning 2 eeprom......................................... 0x30................................ 0x50....................................... Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ib1b8b795a2a07a5b1cbe167b17c3f70a8d9703b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2213943 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* quiche: Add EC console supportScott Collyer2020-09-292-26/+8
| | | | | | | | | | | | | | | | | | | | | | | This CL adds the configs required to enable EC console. BUG=b:148493929 BRANCH=None TEST=verfied ec console works on quiche > help Known commands: chan gpioget md sysinfo crash gpioset panicinfo sysjump flashinfo help reboot syslock flashwp hibernate rw taskinfo gettime history shmem timerinfo HELP LIST = more info; HELP CMD = help on CMD. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ie78965483a1c70368e4375e63ddf33a423bb7776 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2399622 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* gingerbread: Correct chip family and variantScott Collyer2020-09-291-2/+2
| | | | | | | | | | | | | | | | This CL replaces the placeholder chip family/variant with the correct version for the STM32G4. BUG=b:168616400 BRANCH=None TEST=make buidall Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Id6e70d8048f7454302178dd8c6b47ba587b75a95 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2419495 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* quiche: Add power sequencingScott Collyer2020-09-297-29/+179
| | | | | | | | | | | | | | | | | | This CL adds a function in baseboard that will sequence through a list of gpio controlled power rails and chip resets. The table includes a delay prior to executing the next entry. The table is intended to be in board.c as the rails and delays can very much be board specific. BUG=b:167430750 BRANCH=None TEST=Verified that power rails come up and status LED is on. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I830dee9eb28d4648d274d8cbc49b6972cd70dba5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2213837 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* board/samus_pd: Disable some commands to free up spaceTom Hughes2020-09-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | samus_pd is on the very edge of usable flash RO. Free up some space to give us breathing room. Before: 52 bytes in flash and 1620 bytes in RAM still available on samus_pd RO 436 bytes in flash and 1620 bytes in RAM still available on samus_pd RW After: 564 bytes in flash and 1620 bytes in RAM still available on samus_pd RO 920 bytes in flash and 1620 bytes in RAM still available on samus_pd RW BRANCH=none BUG=b:169343201 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia898e74f0d9a88d7a78b1cc0bd5bdbf3c1b14818 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2430284 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* util: Delete flash_pd.pyYilin Yang2020-09-281-348/+0
| | | | | | | | | | | | | | | | | | Reasons: 1. We integrated pd into ec for all recent projects. So after Skylake, we don't need it anymore. 2. For old project, they can find it in firmware branch. BUG=chromium:1031705 BRANCH=master TEST=None Signed-off-by: kerker <kerker@chromium.org> Change-Id: I8975a0d61058b9c95c7c681c17cf1c543cffeaac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2434587 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* Revert "volteer: Move USB PID to board files"Abe Levkoy2020-09-2812-27/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 6ed9b65ae38977118f0d5f02d6f5c61da23c5f24. Reason for revert: Historically, Octopus variants used the baseboard VID and PID. Original change's description: > volteer: Move USB PID to board files > > Add TODOs to update variants boards. > > BUG=none > TEST=make buildall > BRANCH=none > > Signed-off-by: Abe Levkoy <alevkoy@chromium.org> > Change-Id: If0d8d0dd544c06114f355dcf281b2841a8397aee > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2417348 > Reviewed-by: Keith Short <keithshort@chromium.org> BUG=b:168826898,b:168827570,b:168827133,b:168827128,b:168827420 BUG=b:168827418,b:168826886,b:168826868,b:168827029,b:168826914 Change-Id: I5b9b1cee25e34a4b922fd604b49deabc9591b4e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431687 Tested-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* Dedede: Remove DAC for boards using ITE+SM combinationDiana Z2020-09-284-8/+3
| | | | | | | | | | | | | | | For boards which are using the SM charger chips, they will have a Psys offset register to generate the OCPC Psys output. BRANCH=None BUG=b:168783892 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib963ed11f73a76dfeffa11d5ab4a81ccbbd71102 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2435746 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* dedede: Set CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEADAseda Aboagye2020-09-281-0/+1
| | | | | | | | | | | | | | | | | | Some dedede batteries have a charge request of (0,0) when the battery is completely depleted. Enable this config option to help revive those batteries. BUG=None BRANCH=None TEST=Build and flash drawcia, drain battery until it's dead, plug in a charger on C1 and verify that the battery can be revived. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I9206120a0c36813cbcd5618fe595faf57741ac47 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431696 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* ocpc: Misc fixes for coming out of cutoffAseda Aboagye2020-09-281-17/+24
| | | | | | | | | | | | | | | | | | | | | This commit fixes a bug in how OCPC determined which portion of the charge curve that we are in. Upon startup, the phase is uninitialized and we get a charge_request of 0,0. The code assumed that if the battery voltage was less than the desired voltage, we'd be in the CV state. But ignoring a zero desired voltage prevented us from assuming we're in CV. BUG=b:168135339 BRANCH=None TEST=Build and flash drawcia, cutoff the battery, wait 15s, plug in a charger on C1, verify that the DUT comes out of cutoff. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Id5f36d701c2d4e1608954c898c5bc4f0010dec1d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431695 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* sm5803: Remove initial VSYS setting in initAseda Aboagye2020-09-281-8/+0
| | | | | | | | | | | | | | | | | | | | | | The OCPC code will ensure that the first VSYS set point is either the battery voltage, or if not present, the minimum battery voltage as specified by the batt_info structure. There's no need to set an intermediate value here upon init. The default regulation set point will be set by the strapping resistor on the charger IC before FW even gets a chance to run. BUG=b:168730125 BRANCH=None TEST=Build and flash drawcia. Cutoff battery, wait 15s, plug in charger on C1, verify that VSYS is not initially set with a bad voltage. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ibf7c09679fc132c049b79f7ac070d9b3caed794b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431694 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Revert "ServoV4/V4p1: Change CCD detection flow"Brian Nemec2020-09-283-52/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 1a09ade7b846cc048fb2f177adcacd5f836b8887. Reason for revert: b:167734179 CCD detection is failing on many devices. Tests on reverted devices show this is primary cause. Original change's description: > ServoV4/V4p1: Change CCD detection flow > > Currently, servoV4 and servoV4p1 don't apply terminations to SBU when > searching for a DUT. This means SBU can float which can break the SBU > voltage detection. Technically, the DUT should only need to pull up D+ > and can float D- since it is a FS USB2 device when in CCD mode. > > Change the detection to connect SBU to the USB2 hub on servoV4/4p1. The > USB2 hub will apply 15k pulldowns to the USB lines, which will pull SBU > down and fix detection in the case where the DUT floats SBU. > > BUG=b:161762948, b:150886157, b:151487379 > TEST=make BOARD=servo_v4; make BOARD=servo_v4p1 > TEST=check that CCD works on DUT without pulldown resistors on SBU > BRANCH=none > > Change-Id: I9b6f620617fb0e270e35804704111afd3c606a3b > Signed-off-by: Eric Herrmann <eherrmann@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2352439 > Reviewed-by: Wai-Hong Tam <waihong@google.com> BUG=b:167734179, b:168546666, b:168548776 TEST=Measured SBU voltages with the prior CL included, observed low voltages and no-voltage on some platforms including variations of dedede under the flipped orientation. TEST=Reverted the CL and CCD detection worked reliably, devices with CCD not driving SBU rails started working, and labstation release was more reliable on prior versions. Change-Id: Iaecd7371164804ce09a7fd19ac8fd1f44d93aef2 Signed-off-by: Brian Nemec <bnemec@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2429496 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Eric Herrmann <eherrmann@chromium.org>
* sm5803: Enable BFET when disabledAseda Aboagye2020-09-282-6/+32
| | | | | | | | | | | | | | | | | | | | | When coming out of cutoff, the BFET can be disabled if the system is powered up from an auxiliary charge port and the battery is dead. Our attempts to regulate VSYS won't actually cause the battery to come out of cutoff. This commit adds a check to see if the BFET is disabled and tries to enable it such that the battery can actually be charged. BUG=b:168730125, b:168135339 BRANCH=None TEST=Build and flash drawcia, cutoff battery, wait 15s, plug in AC on C1, verify that DUT is able to revive battery pack and start charging. Verify that this works at 0% SoC and 50%. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ie452f1e82f39fb7b525db60e198ab584e2b1564e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431693 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* drawcia: Update OCPC PID constantsAseda Aboagye2020-09-281-6/+6
| | | | | | | | | | | | | | | | | | Since changing the approach of charging via the sub board on systems that use the SM5803, we need to update the PID constants to work with this new approach. This commit updates the constants for drawcia. BUG=b:168253008 BRANCH=None TEST=Build and flash drawcia and verify charging is working as expected. Change-Id: I8073aa240f90a0ba1ba3d2adabdc0e9fd12dfc6d Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2415512 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* waddledee: Update OCPC PID constantsAseda Aboagye2020-09-281-6/+6
| | | | | | | | | | | | | | | | | | This commit updates the PID constants for waddledee after having switched to forcing the BFET on instead of using linear mode for the majority of the charge curve. BUG=b:168253008 BRANCH=None TEST=Build and flash waddledee, verify that charging from the sub board is working and converges without significant oscillation. Change-Id: Ia55d7b693c4e0745fc4bec94c96595c81995be3c Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2407018 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* ocpc: Miscellaneous fixesAseda Aboagye2020-09-281-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | This commit just performs some miscellaneous fixes for OCPC. Some key fixes are: - Fix handling of full batteries with respect to CFET status - Reducing upward transitions - Restrict system resistance calculations to high current scenarios only. BUG=b:168135339 BRANCH=None TEST=Build and flash waddldee with new PID constants, drain battery, verify DUT can charge from the sub board port all the way to full, verify DUT can source out the main board port while charging from the sub board. Verify that the charging curve is fairly stable. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Id170b1c5dfe56733f4ebcf350bf96d0de59e3ec4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2411467 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* ocpc: Add visualization graphAseda Aboagye2020-09-281-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When tuning an OCPC system, the OCPC debug output is very useful in order to examine the behaviour of the system. However, instead of simply looking at a bunch of changing numbers on the terminal, it's easier to view a waveform of the current entering the battery. In lieu of using an oscilloscope with a current probe, this commit adds a visualization graph which shows the current entering the battery relative to the target current. Each segment on the graph represents 5% of the target current. Usage is as follows: > ocpcdebug enable/viz/all/disable `enable` will show text debug only. `viz` will show the visualization graph (output shown below). `all` will show both the graph and text debug data. `disable` will show no debug output. Here is an example of the output [2665.199505 Act Chg: 1] [2665.702271 Battery 47% (Display 47.1 %) / ??h:?? to empty] [2665.703810 charge_request(13050mV, 1800mA)] [2665.725854 OCPC: Target VSYS: 11979mV] [----------#----------] (actual)251mA (desired)1880mA [2666.317342 OCPC: Target VSYS: 12179mV] [----------|---------o] (actual)879mA (desired)1880mA [2666.908941 OCPC: Target VSYS: 12274mV] [----------|-----o----] (actual)1216mA (desired)1880mA [----------|o---------] (actual)1631mA (desired)1880mA [2668.090373 OCPC: Target VSYS: 12259mV] [----------#----------] (actual)1797mA (desired)1880mA [----------#----------] (actual)1813mA (desired)1880mA [----------#----------] (actual)1769mA (desired)1880mA [----------#----------] (actual)1779mA (desired)1880mA BUG=None BRANCH=None TEST=Build and flash waddledee, enable debug command, verify that visualization graph is shown. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ie271524ce2ce90781b966a77f2a7ef27dc969075 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2410556 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org>
* sm5803: Force BFET on when charging from AUX portAseda Aboagye2020-09-281-43/+21
| | | | | | | | | | | | | | | | | | | | | | | | In order to have both our charger ICs behave the same way when running OCPC, this commit changes our usage of the charger IC to force the BFET to be on during the majority of the charge curve. This also improves efficiency over using the previous linear mode. Additionally, as part of the charger init, the initial VSYS voltage is set to the battery voltage. BUG=b:168253008,b:168252106 BRANCH=None TEST=Build and flash waddledee. Verify DUT can charge from both ports. Verify DUT can source out of both ports. Verify that DUT can sink and charge simultaneously from both ports. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I56a59b4aaff11b6f2f190695c8497b19a9dbf9e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2410555 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* boten: Modify battery parametersjerry2.huang2020-09-281-5/+5
| | | | | | | | | | | | | | | | | | Modify battery parameters: 1.SMP:precharge_current to 256,start_charging_max_c to 50 2.LGC:precharge_current to 256 3.SUNWODA:precharge_current to 186, start_charging_max_c to 50 BUG=b:167264077 BRANCH=none TEST=make buildall -j Signed-off-by: jerry2.huang <jerry2.huang@lcfc.corp-partner.google.com> Change-Id: I37dbcc176d22988a47fba5b59d82b3b3e2eb6b68 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2435169 Reviewed-by: Henry Sun <henrysun@google.com> Commit-Queue: Henry Sun <henrysun@google.com> Tested-by: Henry Sun <henrysun@google.com>
* asurada: enable virtual batteryTing Shen2020-09-282-0/+8
| | | | | | | | | | | | | BUG=b:168453157 TEST=Verify virtual_battery_operation() is called BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: If634d6fafab7e49dcfeae8088e07d0f7de5cf89e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2434838 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* fennel: add host command for the ioexpander pwmZhuohao Lee2020-09-282-0/+58
| | | | | | | | | | | | | | | | | | In order to support the kernel driver to use the ioexpander pwm driver, we add two host command EC_CMD_PWM_SET_DUTY and EC_CMD_PWM_GET_DUTY to the board layer to support it. Besides, to avoid the RO rom size overflow, we remove the ioexpander pwm function and keyboard backlight function from the RO rom. BUG=b:162902808 BRANCH=firmware-kukui-12573.B TEST=build pass Change-Id: Ibbd66164c19cd792a865f471c0c32ecb595f75e7 Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2430904 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* it8801: fix the it8801_pwm_(set|get)_dutyZhuohao Lee2020-09-281-3/+3
| | | | | | | | | | | | | | | The value in PWMDCRi register is used to control the clock of the PWM. We only need to set the clock value to the register after normalized to the 255. BUG=b:162902808 BRANCH=firmware-kukui-12573.B TEST=`kblight <percentage>` is working correctly Change-Id: I6a0c012a06789eb8bbca6209a00b06ef34ee9c86 Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431321 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* berknip: update mux hpd signalZick Wei2020-09-261-4/+4
| | | | | | | | | | | | | | This CL update USB_C1_HPD_IN_DB use gpio_or_ioex_set_level(). BUG=none BRANCH=zork TEST=verify EC not panic on board version>=3. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ifc01005d0f974f1ab3f5f095156b516e0cba9ff1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2428355 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* ecusb: Fix subprocess argument to make it py2/3 compatibleYilin Yang2020-09-262-8/+13
| | | | | | | | | | | BUG=chromium:1031705 BRANCH=master TEST=None Signed-off-by: kerker <kerker@chromium.org> Change-Id: I78713f635e00cf01e1df641436b3a6d2f5c3c00b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431318 Reviewed-by: Yu-Ping Wu <yupingso@chromium.org>
* SM5803: Leave Vbus PROCHOT comparator on for active portsDiana Z2020-09-261-1/+17
| | | | | | | | | | | | | | | | | | | | | The Vbus PROCHOT comparator provides feedback for OTG Vbus sourcing, so it should not be disabled while a port is active. Additionally, it must be enabled before Vbus is sourced and so is not a candidate to move into the PD connect/disconnect hooks. It can be disabled on PD disconnect in chipset off or suspended states to save power after unplug. BRANCH=None BUG=b:168931726 TEST=on waddledee, reboot EC with a sinking dongle plugged in and observe the port begins sourcing again in S0 with no errors. Suspend DUT and observe sourcing out continues to work, and remove dongle and observe all PROCHOT comparators are disabled. Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I70f7d8386c650d91257e5d76f95aa5cef145c5ce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2429520 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* voxel: undefine CONFIG_CHIP_INIT_ROM_REGIONBen Chen2020-09-261-2/+0
| | | | | | | | | | | | | | Supports NPCX797FC dose not leave unused flash space. BUG=b:169172356 BRANCH=master TEST=make buildall Change-Id: I643790fc34b949d4efc847bb102f3d29fd341a12 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2425986 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* Coachz: Remove the reversed-plug detection for detachible baseWai-Hong Tam2020-09-261-36/+0
| | | | | | | | | | | | | | The reversed-plug is not supported. Updated the TODO's and removed the reversed-plug detection. BRANCH=None BUG=b:169094188, b:168712053 TEST=Built the Coachz image. Change-Id: I15563c91e37bb752f15a7538bd1e19b9d922d5f9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432411 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* usb_serial: Migrate console.py to python2/3 compatibleYilin Yang2020-09-261-15/+26
| | | | | | | | | | | | | | | Trace pyusb source code to make sure the correct interface, and change them properly. BUG=chromium:1031705 BRANCH=master TEST=None Signed-off-by: kerker <kerker@chromium.org> Change-Id: I185bf8a7d47f641f6554ba2d36a11d56967661b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2422929 Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>