summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* isl9241: add charger_get_vbus_voltageDenis Brockus2019-08-085-8/+53
| | | | | | | | | | | | BUG=b:138600692 BRANCH=none TEST=make buildall -j Change-Id: Idd20b1833945e37a84db4e7c444d8974f6059f83 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742532 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* kodama: Initial image copied from kukuilu.zhang2019-08-089-1/+1110
| | | | | | | | | | | | | | | | | | Since kukui baseboad will be created and kodama board is symbolic link now, this image is just copied from kukui ToT instead of symbolic link. BRANCH=none BUG=none TEST=builds Change-Id: I1e1577c294cc9860c60f643ef61e87cd0fd8b4a5 Signed-off-by: lu.zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725383 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Peichao Li <peichao.wang@bitland.corp-partner.google.com> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com>
* Trembyle: add fan supportDenis Brockus2019-08-083-0/+84
| | | | | | | | | | | BUG=b:138600244 BRANCH=none TEST=make buildall -j Change-Id: Ibaf217e9fccf76dff6b70ae529e089367db89221 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742039 Reviewed-by: Keith Short <keithshort@chromium.org>
* baseboard/kukui: refactor smart battery codeTing Shen2019-08-085-53/+60
| | | | | | | | | | | | | | | | | | | | - Use common fuel gauge implenentation in battery_fuel_gauge.c for things like cutoff and get_info - Move battery characteristics data into per-board folder, so follower devices can add their own battery. - Move Jacuzzi-only battery_hw_present() into per-board folder BUG=b:136977971 TEST=boot ec, verify that ec console prints 'found batt:PANASONIC' BRANCH=master Change-Id: Ib4d33a2d3b4e1e061b390a000071f805d4780c27 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728671 Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
* akemi: add initial content for the buildPeichao Wang2019-08-087-0/+1003
| | | | | | | | | | | | | | | | | | | This initial content of akemi is taken after hatch. It will need to be revised later. BUG=b:138879565 BRANCH=none TEST=make -j BOARD=akemi Change-Id: Iae84e5b908e678165311147356f65f61270bfda9 Signed-off-by: peichao.wang <peichao.wang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1679849 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* treeya: remove keyboard backlightlu.zhang2019-08-083-31/+3
| | | | | | | | | | | | | | | | This CL removes keyboard backlight accordding to most recent treeya schematics. BRANCH=none BUG=b:138744661 TEST=builds Change-Id: I2a42b2dcb122ac1fd805f9f614d1b68c0b60d7ca Signed-off-by: lu.zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1738526 Tested-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* treeya: add power led and change battery led behaviorlu.zhang2019-08-083-50/+61
| | | | | | | | | | | | | | | | Accordding to the treeya schematics, a power led is added. Also, the behavior of battery leds does not follow Lenovo's spec BRANCH=none BUG=b:138744661 TEST=builds Signed-off-by: lu.zhang <lu.zhang@bitland.corp-partner.google.com> Change-Id: I51466c36973b9cd4ced3501bf77b5672530d7d98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1739027 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* pd: Don't request LPM in DRP_TOGGLE if cc is not openScott Collyer2019-08-081-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, LPM_REQUESTED flag is always set in the DRP_AUTO_TOGGLE state. This is true even when the next state will be SNK_DISCONNECTED or SRC_DISCONNECTED. This setting makes sense for SNK_DISCONNECTED as when the AP is not in S0, then auto toggling will be disabled so the PD state machine should remain in SNK_DISCONNECTED until something is attached. But for the transition from DRP_TOGGLE to SRC_DISCONNECTED should only happen when either an adapter gets attached while the AP is in S0, or the chipset enters S0 with an adapter already attached. This 2nd case is problematic as if LPM_REQUESTED is set and there is no CC event pending, the PD task will get suspended (wait = -1) and therefore remain in SRC_DISCONNECTED. This CL modifies the existing logic to not set LPM_REQUESTED when something is attached as given by the CC1 and CC2 values. BUG=b:137697655 BRANCH=none TEST=Tested both EC reboot and resume from suspend with a USB stick connected via a type C->A adapter and verified that the PD state machine advances to PD_STATE_SRC_DISCOVERY as expected and the USB stick enumerates. Change-Id: I6afbd642ce38134ddabd20f7dc5e15f937b9810a Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730967 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* makefile: remove print-chip-variantJack Rosenthal2019-08-071-5/+0
| | | | | | | | | | | | | | | We ended up deciding on a different design for the location of ISH firmware in the filesystem (long ago), and the chip variant is no longer needed in the ebuild. Remove this target. BUG=b:122371717 BRANCH=none TEST=buildall Change-Id: I9d5152537c9f4e86296546b86c98f581534d379f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742418 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* touchpad_elan: Add missing tablet_mode.h includeNicolas Boichat2019-08-071-0/+1
| | | | | | | | | | | BRANCH=none BUG=b:138968914 TEST=make buildall -j Change-Id: Ia753d1a089a326eb15a28528f0ff0cfa320b4e1d Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741588 Reviewed-by: Yilun Lin <yllin@chromium.org>
* baseboard/kukui: enable suppressing HCYilun Lin2019-08-071-0/+3
| | | | | | | | | | | | | | | | Some of the HCs are too noisy. TEST=hcdebug normal, and see HC are suppressed BUG=none BRANCH=none Change-Id: Ib095a0df3491c9be9e4df6b71441eabb666d747d Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741107 Tested-by: Yilun Lin <yllin@chromium.org> Auto-Submit: Yilun Lin <yllin@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org>
* mt_scp: Do not set cache-size in SCP FW.Yilun Lin2019-08-072-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | cache-size and way setting should be done in kernel driver side. Logical memory address will be shifted when cache size config changes. e.g. - 8 kb I-cache + 0 kb D-cache: logical address of I-cache 0x7e000~0x7ffff - 8 kb I-cache + 8 kb D-cache: logical address of I-cache 0x7c000~0x7bfff I-cache region moves starting address from 0x7e000 to 0x7c000, and it forces all the contents which was in 0x7c000~0x7dffff step back for 8KB. i.e. The logical address are changed by 8kb. This will break the loaded SCP firmware layout. As a result, we should configure the cache size before loading firmware and never re-configure it in SCP FW. BUG=b:137920815 TEST=Reboot kukui, and see SCP can successfully boot on first time. BRANCH=None Change-Id: I58342e8276b654a786864904cde980c6fc9ef781 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725384 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org>
* mt_scp/ipi: only invoke interrupt when ipi readyYilun Lin2019-08-071-1/+1
| | | | | | | | | | | | | | | | | IPC interrupt should only be invoked when the task inited and informing AP that SCP is ready. TEST=Boot SCP, and doesn't see the process stack overflow. BUG=b:137920815 BRANCH=none Change-Id: Ibe926b77705718a986c3b090227328b569cd9b59 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1736411 Reviewed-by: Erin Lo <erin.lo@mediatek.com> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org>
* ps8xxx: stub out enter_low_power_modeCaveh Jalali2019-08-071-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the ps8751 really does not behave well with explicit low power mode commands - it enters low power mode on its own in about 2 seconds, so there's really no need to command it into low power mode. when the ps8751 is awake, it will take the low power command, but also generate an alert. when we try to read the alert register, it fails because the chip is in low power mode, so we go through the normal process of waking it up, including re-initializing the chip. we then process the alert and power down the chip again. but this time around the i2c transaction for the power down command fails (we don't check this status). the reason the i2c transaction failed is very likely because the chip processed the I2CIDLE command and didn't complete the i2c transaction. BRANCH=none BUG=b:137622553 TEST=verified chip still goes to sleep on its own Change-Id: I01b864791ae27a81a4512ddb752329e59be6a8c6 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733860 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Caveh Jalali <caveh@google.com>
* Fix typo and clarify doc in fpsensor.h and gpio.wrapCraig Hesling2019-08-072-11/+29
| | | | | | | | | | | | | | This also brings some minor Doxygen formatting to gpio.wrap. BRANCH=none BUG=chromium:991365 TEST=make buildall -j Change-Id: Id6d85263b6ac472b0961240ebb266dd22591d68b Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1685772 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* docs: Add fingerprint (FPMCU) docsTom Hughes2019-08-064-170/+549
| | | | | | | | | | | | | | BRANCH=none BUG=chromium:973205 TEST=make buildall -j TEST=View Markdown Preview in CLion TEST=View Markdown in gitiles Change-Id: I64c6060bdf41f69af05a8ffd64d437fb1fd2b507 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1658525 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* hatch: remove CONFIG_SYSTEM_UNLOCKED, enable CONFIG_USB_PD_COMM_LOCKEDPaul Fagerburg2019-08-063-9/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the CONFIG_SYSTEM_UNLOCKED option from some board configurations and enable CONFIG_USB_PD_COMM_LOCKED. This allows factory tests to verify the behavior, and also ensures that developers and dogfooders are working with the same configs that will be released to customers - "test what you fly and fly what you test." Developers must remember to jump to RW before PD will negotiate. BRANCH=none BUG=b:138868206 TEST=Rebuild and flash on hatch: ``cd ~/trunk/src/platform/ec`` ``make -j BOARD=hatch`` ``./util/flash_ec --board=hatch`` Connect to EC console via servo Enable hardware write protect by connecting a battery Verify software write protect is off via ``flashinfo`` Reboot the device Look for "PD comm enabled" at the start of EC RO boot Enable software write protect via ``flashwp true`` Verify software write protect is on via ``flashinfo`` Reboot the device Look for "PD comm disabled" at the start of EC RO boot Look for "PD comm enabled" at the start of EC RW boot Shut down the device Disconnect the AC adapter Disconnect the battery Boot the device Disable software write protect via ``flashwp false`` Shut down the device Disconnect the AC adapter Connect the battery Connect the AC adapter Look for "PD comm enabled" at the start of EC RO boot Verify software write protect is off via ``flashinfo`` Change-Id: Ibf999ee3ef948168dd05a40d9c002f93f32dc48c Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1737530 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* Hatch: Enable CBI info of board skuben.chen2@quanta.corp-partner.google.com2019-08-062-1/+24
| | | | | | | | | | | | | | | This patch enables get board sku BUG=b:138326244 BRANCH=master TEST=None Change-Id: I489de71c75804dd460bda98fa1c49b94c91c8a12 Signed-off-by: ben.chen2@quanta.corp-partner.google.com Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716674 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Tested-by: David Huang <David.Huang@quantatw.com> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* kukui: fix tcpc_init failed on kukuiTing Shen2019-08-063-11/+15
| | | | | | | | | | | | | | | | | Calling board_pogo_charge_init() when DEDICATED_CHARGE_PORT disabled causes buffer overflow inside charge manager, move the function to a suitable place to fix the issue. BUG=b:138741956 TEST=flash and verify that kukui is bootable BRANCH=master Change-Id: I43d8aabf8fd21ed62a37671ba7cd471c8c188b9f Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731212 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
* ectool/trng: Add "rand" host command for testing RNGTom Hughes2019-08-063-2/+103
| | | | | | | | | | | | | | | | | | | | | This host command and corresponding ectool command allows us to generate random numbers with the MCU's RNG and process the resulting output with tools to validate the statistical randomness, such as dieharder (https://webhome.phy.duke.edu/~rgb/General/dieharder.php) and NIST SP 800-22 (https://csrc.nist.gov/publications/detail/sp/800-22/rev-1a/final). BRANCH=none BUG=b:124770147 TEST=ectool --name=cros_fp rand 1 > rand.bin; ls -la rand.bin TEST=ectool --name=cros_fp rand 536 > rand.bin; ls -la rand.bin TEST=ectool --name=cros_fp rand 537 > rand.bin; ls -la rand.bin TEST=ectool --name=cros_fp rand 99999999999999999999999999 Change-Id: Ic0bda4deae79fc7465671dcacfe8bbc9a066b5e5 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726822 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* atlas: Check DP MF-bit against selected pin cfgMatthew Blecker2019-08-061-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we are configuring a Type-C port for DisplayPort alternate mode, we should check to see that the selected pin config supports multi-function mode or not. This commit fixes a bug where we were setting the SuperSpeed muxes based solely upon the Multi-function Preferred bit in the DPStatus VDO. Some Type-C video adapters are buggy and set the MF preferred bit without actually supporting an MF pin configuration. Therefore, we trust the reported supported pin configurations in the DiscMode VDO. BRANCH=master BUG=chromium:919756,b:138874110 TEST=Enable DRM debug by "echo 0xe > /sys/module/drm/parameters/debug" Monitor dmesg. Look for output indicating "Link training successful at 5400000 4 lanes". Look for monitor output at UHD4k60 on Acer B326HK using OSD. Change-Id: I946e601ed672031bc4606878531c561cf487a914 Signed-off-by: Matthew Blecker <matthewb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1737273 Reviewed-by: Nitin Kolluru <nkolluru@google.com> Reviewed-by: Caveh Jalali <caveh@google.com> Tested-by: Nitin Kolluru <nkolluru@google.com> Commit-Queue: Caveh Jalali <caveh@google.com>
* ec3po: make debug logs more user-friendly to readRuben Rodriguez Buchillon2019-08-061-7/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change does two things: (1) it adds by default that both directions i.e. user to EC and EC to user get logged to debug at full lines (or line limit) (2) it hides the per interrupt print statements behind a command: raw-debug This is to allow servod logs to easily contain the MCU logs for all connected devices: servo(s), Cr50, EC, and more. BUG=chromium:932820 TEST=manual testing sudo servod -s 19 -d | grep LogConsole // observe console output (with logger overhead as prefix) with crrev.com/c/1688610: dut-control ec_uart_raw_debug:on // observe in the logs how messages like below return [...] - |DBG|-i->'an 0' Change-Id: I864ac3411a002385505a192db3f300eb7bd71b47 Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1688363 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* Trembyle: update usb_pd_policyDenis Brockus2019-08-052-6/+52
| | | | | | | | | | | | BUG=b:138599669 BRANCH=none TEST=make buildall -j Change-Id: I125a40e316f4d6431412851bd6bd3c8c57118365 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1737132 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* Trembyle: implement board_set_active_charge_portDenis Brockus2019-08-052-6/+57
| | | | | | | | | | | | | | BUG=b:138599952 BRANCH=none TEST=make buildall -j Change-Id: I82ef7cad0cd6d91d1e4bbcc0d1a2d312dd773e8f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1736797 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Trembyle: implement system_get_sku_idDenis Brockus2019-08-052-7/+7
| | | | | | | | | | | | BUG=b:138600504 BRANCH=none TEST=make buildall -j Change-Id: Ibaa43ae3976c171fc715aef380e0f9f26951b432 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1736695 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* Trembyle: Fix USB-C TCPC driversDenis Brockus2019-08-026-20/+103
| | | | | | | | | | | | | | Add NCT3807 USB-C TCPC drivers BUG=b:138600238,b:138599948 BRANCH=none TEST=make buildall -j Change-Id: Id98df51748beb60e787350265127936b18f4cf46 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728478 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* Trembyle: Add USB-C PPC driversDenis Brockus2019-08-023-14/+69
| | | | | | | | | | | | | | Add SN5S330 USB-C PPC drivers BUG=b:138599218 BRANCH=none TEST=make buildall -j Change-Id: I697dbba1f5c5bbc809e0de9a633d9102596a3a98 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1729529 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* g: refactor pinmux state printing functionVadim Bendebury2019-08-021-10/+20
| | | | | | | | | | | | | | | | | | This refactoring improves optional parameter alignment, includes virtual pads in the output and shaves 44 bytes from the image size. BRANCH=cr50, cr50-mp BUG=none TEST=saved pinmux command output in files pm.before and pm.after, then verified that the following command produced no output $ diff -w <(sort pm.before) <(sort pm.after) Change-Id: I81c2fad8c9e87e05dd39c588340a82f83e3ab488 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731138 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* cr50: add gpio assignments descriptionVadim Bendebury2019-08-021-0/+29
| | | | | | | | | | | | | | | | | This is a documentation only change which adds a table showing how internal GPIOs of the g chip are used on Cr50. Adding this table will make it easier to keep track of the GPIOs when adding new use cases. BRANCH=cr50, cr50-mp BUG=none TEST=make buildall Change-Id: I1e573bdc4b9628aae17c7ba976ba1554ee1050e6 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730142 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* hatch: Add charger-related configs for low-battery bootingTim Wawrzynczak2019-08-021-0/+7
| | | | | | | | | | | | | | | | | When there is a battery that isn't communicating, the DUT should not boot the AP in order to avoid brown outs after the system jumps to RW and can begin PD negotiation. BUG=b:136970148 BRANCH=none TEST=Disable PD negotiation in RO, cutoff battery, plug in A/C, and verify that the DUT stays in G3, and doesn't attempt to boot the AP, because Hatch's battery is slow to come back from cutoff (>10 s). Change-Id: I6f53ce83e89520369e9761a64133839b3c162b91 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731976 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* ectool: print unsigned version of sensor valuesJett Rink2019-08-021-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Some sensors use the full 16-bits for an unsigned number; print out the unsigned interpretation of the signed value as well in ectool. Example output: Timestamp:10e87e Timestamp:fdbde87d Sensor 1: -96 -8027 -1559 (as uint16: 4294967200 4294959269 4294965737) Timestamp:2c77e87f Sensor 1: -98 -8025 -1568 (as uint16: 4294967198 4294959271 4294965728) Timestamp:61bee880 Timestamp:5b38e880 Sensor 1: -97 -8026 -1568 (as uint16: 4294967199 4294959270 4294965728) Timestamp:8a10e881 Sensor 1: -98 -8025 -1560 (as uint16: 4294967198 4294959271 4294965736) BRANCH=none BUG=b:138096172, TEST=builds Change-Id: Ifa0eef9721a64b1b9e21624ee7113fbf949adbf7 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726735 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* kukui: remove duplicate items in i2c_ports arrayTing Shen2019-08-021-6/+2
| | | | | | | | | | | | | | | | i2c_ports[] should have one entry for each port, not for each i2c slave BUG=None TEST=verify that `i2cscan` only scans port 0 and 1 once. BRANCH=master Change-Id: I457c780fabd7bb68a5dc8871236a080d2fc6f332 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1729097 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* kukui: fix incorrect input power limitTing Shen2019-08-022-7/+9
| | | | | | | | | | | | | | | | | | | This CL includes two major changes: - set input current in board_set_charge_limit() instead of charger_profile_override(). - remove board revision constraint, apply the fix to all kukui/kranes. BUG=b:134227872 TEST=manually, boot with new fw and measure the power. BRANCH=master Change-Id: Ib826e805990fe3e9af5a88c231825bd477592e49 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730378 Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* Kindred: remove OTP3001 ALS function for kindred/kled.Sue Chen2019-08-022-42/+0
| | | | | | | | | | | | | | | | Clean up unused sensors for kindred/kled. BUG=b:138262676 BRANCH=none TEST=make buildall -j Change-Id: I7b4f7693fc2c7f7ae72f20381a1ec8d1a71dbad7 Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1730371 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Tested-by: David Huang <David.Huang@quantatw.com>
* mkbp_event: Only notify MKBP via hostevent in suspendAseda Aboagye2019-08-011-4/+7
| | | | | | | | | | | | | | | | | | | | | | | If a board is using CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT, make sure that the MKBP event notiification via host event only occurs in suspend. Since MKBP events are a part of the HOST_EVENT_ALWAYS_REPORT_DEFAULT_MASK, an MKBP host event could still be set in S0, but it will not trigger an SCI since the event is not in the SCI mask. This would cause the board to prematurely wake up when suspending due to the lingering event. BUG=none BRANCH=none TEST=Flash nocturne, boot to S0, suspend, verify that no spurious wakeups occur. Change-Id: I2e3196e836934d87d1d5efefff26f58c9e2bc3b2 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728039 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* mock: Add mock structure for fuzzers and testsCraig Hesling2019-07-316-0/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces the common/mock and include/mock directories which hold mock implementations of other common libraries. The general idea it to create mocks which can be used in simple scenarios, by providing meaningful default return values and functionality, and more complicated scenarios like fuzzers, where the return values need to continuously change. The build system has been adapted to allow the inclusion of a new .mocklist file for tests and fuzzers. This file specifies exactly which mocks will be pulled into the build for a given test/fuzz. In order to maintain cleanliness, this file is optional. Examples: * http://crrev.com/c/1682945/17 makes use of three different mocks, one of which is the rollback mock. * An upcoming rollback unit test ( http://crrev.com/c/1686460 ), needs to pull in mocks that support the rollback interface, but explicitly cannot pull in the rollback mock. BRANCH=none BUG=b:116065496 TEST=make buildall -j Change-Id: Ib87b1a93b6d73309afaf7115276ead49218598ff Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1719569 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Trembyle: Add IO expandersEdward Hill2019-07-313-14/+47
| | | | | | | | | | | | | | Add NCT3807 IO expander drivers and GPIO definitions. BUG=b:138599199 BRANCH=none TEST=make BOARD=trembyle Change-Id: I1257263225b4146a4a87d350921189b90a2b3901 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726941 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* g: add flash log entry for dcrypto failuresstabilize-12386.BVadim Bendebury2019-07-312-5/+14
| | | | | | | | | | | | | | | | We want to keep an eye on the dcrypto failures (which are never supposed to happen of course). Let's add logging a flash event so that the failures are visible through UMA. BRANCH=cr50, cr50-mp BUG=b:135772657 TEST=using additional code simulated a single failure, observed new flash log entry by running 'gsctool -a -L' on the DUT. Change-Id: Ib675bb1928166cadc069bf4be3b053a9cf837077 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1723097 Reviewed-by: Mary Ruthven <mruthven@chromium.org>
* jacuzzi: bringup ecTing Shen2019-07-318-0/+533
| | | | | | | | | | | | | | | | | | | | Initial version of jacuzzi ec. The files are basically copied from board/kukui/, battery and charger configured to the correct i2c port and component, and pogo / sensor removed. BUG=b:135895590 TEST=verify that this is bootable on a Jacuzzi, charger and battery looks good, and no error message spamming on ec console. BRANCH=master Change-Id: Ia786076c08019dd2aa1711a68ff1c82cc7fa45ed Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1673955 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* common/system: refactor some confusing ifdefsJack Rosenthal2019-07-315-33/+28
| | | | | | | | | | | | | | | | | I had a hard time reading this section, so figured I may as well rewrite it to use IS_ENABLED while I was here. Gave CONFIG_{RO,RW}_HEAD_ROOM a default value of zero here, which makes the math work out for boards without it anyway. BUG=none BRANCH=none TEST=buildall Change-Id: I87dc2d73838c350088916b57aa51d5f368c5592f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1727570 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* cleanup: remove CONFIG_REPLACE_LOADER_WITH_BSS_SLOWJack Rosenthal2019-07-314-60/+0
| | | | | | | | | | | | | | | | | | This option was only used with kunimitsu, which was removed from the EC codebase a long time ago. The EC code won't even compile with this option enabled anymore. Remove it! BUG=chromium:989301 BRANCH=none TEST=buildall Change-Id: I8ede226ec1e7b300ded6bb1769d82e142db1b0aa Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1727569 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: make IS_ENABLED sorta compatible with clangJack Rosenthal2019-07-311-10/+22
| | | | | | | | | | | | | | | | | | | | | Clang does not feature the error(...) attribute on functions, and apparently we use that compiler for the cr50 fuzz tests. Work around clang's limitations by removing the error(...) attribute when compiling with clang, allowing us to use IS_ENABLED in files that get compiled by the cr50 fuzz tests. BUG=chromium:989315 BRANCH=none TEST=make buildall -j TEST=IS_ENABLED works in system.c Change-Id: I15bf7a2d2854db12f8e00009afe39359cb6f5c19 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726948 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Raul E Rangel <rrangel@chromium.org>
* baseboard/kukui: add smart batteryTing Shen2019-07-313-0/+116
| | | | | | | | | | | | | | | Add a smart battery for implementation Kodama and Jacuzzi. BUG=b:137172860 TEST=boot on a jacuzzi, verify that `battery` command looks good BRANCH=master Change-Id: Ifdaf3c700ea9dccb7f60a266395644daec4eab2f Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725387 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* util/lbcc: match up format string and argumentsPatrick Georgi2019-07-311-1/+1
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: Icfceebfa631a3a3f42095009e23c0562fa898bff Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #199442 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725955 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org>
* baseboard/kukui: support battery/charger variantsTing Shen2019-07-318-124/+223
| | | | | | | | | | | | | | | | | | This CL introduces config option VARIANT_KUKUI_BATTERY_* and VARIANT_KUKUI_CHARGER_* for derivatives to pick their battery / charger option. BUG=b:137172860 TEST=build and deploy on Krane, verify that `battery` and `charger` console output looks reasonable. BRANCH=master Change-Id: Ic5c33a233ec30c9bc71414c95603157301281041 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1697781 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* g: Force word writes for k during ECDSA signLouis Collard2019-07-311-4/+13
| | | | | | | | | | | | | | | | | | Functions that take p256_int* parameters may use byte writes when writing to those parameters. When writing to DMEM_ecc, we must use word writes; this change ensures that happens. BUG=b:131807777 TEST=build and flash to soraka locally, ensure k is populated successfully BRANCH=none Change-Id: I49462b10aa1203fe875417e9526f06b2efc068fb Signed-off-by: Louis Collard <louiscollard@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1592990 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Andrey Pronin <apronin@chromium.org>
* vprintf: fix handling % in the end of the format stringVadim Bendebury2019-07-311-0/+4
| | | | | | | | | | | | | | | | | EC vprintf() implementation treats a single '%' character in the end of the format string as a literal per cent character. This is a special case, while processing it the terminated zero is getting lost. This patch fixes the problem. BRANCH=none BUG=none TEST=none Change-Id: I9abea74072b56edfbbace988b0b7a6d1f7d8cd5f Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726739 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* util/uut: don't pass NULL string to printf that expects no argumentsPatrick Georgi2019-07-311-1/+1
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: Ic6aaa62f3818d544be3f3bd5f99f8063326c3f10 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #199447 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725956 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* util/genvif.c: close file on errorPatrick Georgi2019-07-311-0/+2
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: I873dcfc15f90642e509ba82d521971a29c28b54d Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #180595 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725954 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* util/cbi-util.c: free memory in error casesPatrick Georgi2019-07-311-1/+3
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: Idc8ad893403b1efec818f812f730cbaf5ed4dbf6 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #187040, #187042 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725953 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Auto-Submit: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>