summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* util/uut/cmd.c: fix printf argumentsPatrick Georgi2019-07-311-7/+7
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: I6965fda01b45bc15146103564c6eea271c65f96f Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #1994{41,43,44,45,46,49,51,56,57} Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725952 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/ec_flash: avoid divide-by-zeroPatrick Georgi2019-07-311-0/+7
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: I514c2aa307e94be826e9c8e219eb471892b3fad6 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Found-by: Coverity Scan #201954 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725951 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: Move __stdlib_compat to function definitionsCraig Hesling2019-07-303-45/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Putting a visibility-hidden attribute in the header file is ambiguous. The compiler cannot determine which definition should be hidden (our implementation or stdlib). This serves as a slight correction to the work in crrev.com/c/1180401 . In particular, this fixes test/fuzz builds with code coverage enabled: make runtests TEST_COVERAGE=1 -j Before this fix, enabling coverage would trigger build errors, like the following: In file included from common/test_util.c:19: include/util.h:82:1: error: attribute declaration must precede definition [-Werror,-Wignored-attributes] __stdlib_compat int atoi(const char *nptr); ^ include/common.h:267:40: note: expanded from macro '__stdlib_compat' #define __stdlib_compat __attribute__((visibility("hidden"))) ^ /usr/include/stdlib.h:361:8: note: previous definition is here __NTH (atoi (const char *__nptr)) Note that enabling sanitizer on some unit tests is still broken (as it was before this CL). For example, these unit tests fail when compiling with sanitizers: make host-charge_manager_drp_charging TEST_ASAN=1 make host-charge_manager_drp_charging TEST_MSAN=1 BRANCH=none BUG=none TEST=make runtests TEST_COVERAGE=1 -j TEST=make buildall -j Change-Id: I74462c964c0ff9d3ee131450e6826cbbd6c89319 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1724936 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Trembyle: Add USB-C sink BC12 driverDenis Brockus2019-07-304-22/+36
| | | | | | | | | | | | Hooked in the PI3USB9201 BC12 driver BUG=b:138600672 BRANCH=none TEST=make BOARD=trembyle Change-Id: I849d182063c62539add88b8a2aa73a149dc25c92 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726330
* pi3usb9201: Fix typo in structure name.Keith Short2019-07-305-9/+9
| | | | | | | | | | | | | | | | The structure used by board files to define the I2C connections to the PI3USB9201 driver had digits in the part number transposed. BUG=b:138650914 BRANCH=none TEST=make buildall Change-Id: Iaa7897a35f3172dd71fccca4e203b1d0e6a18ef7 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725959 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Zork: Use more designated initializers.Edward Hill2019-07-302-23/+110
| | | | | | | | | | | | | | Use designated initializers for adc_channels, power_signal_list, i2c_ports, temp_sensors. And minor related tidy up. BUG=none BRANCH=none TEST=make BOARD=trembyle Change-Id: Iee9d2d1d85ec6844d565e89d698d99d40644a088 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725369 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* type-c: USB Type-C State Machine based on Release 1.4 of the spec.Sam Hurst2019-07-3021-1059/+2776
| | | | | | | | | | | | | | | | | | | | | | | | | Implements DRP with Accessory, and Try.SRC as detailed in Release 1.4 of the USB Type-C specification. BUG=b:130895206 BRANCH=none TEST=manual Used Atlas device to verify that it could be charged from PD and none PD charges at 5V/3A. Attached USB dock and verifed access to USB Thumb drive. Performed same tests on Hatch Port 0 on Hatch was used to run this CL, merged with PD functionality, on the PD2.0 Compliance tester. All tests pass except for a few physical layer tests. The test report has been added to the bug. Change-Id: Ic4869e20e5b4c2ba6c827d92e40c70f3140f2518 Signed-off-by: Sam Hurst <shurst@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1574667 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Sam Hurst <shurst@google.com> Commit-Queue: Sam Hurst <shurst@google.com>
* kukui: add baseboard/kukuiTing Shen2019-07-3011-289/+333
| | | | | | | | | | | | | | | | | | | | Create a baseboard to reduce the effort of forking and maintaining kukui derivatives. This CL is intended to just moving things around, with minimal changes to make compiler happy, complex logic changes will implement in subsequent CLs. BUG=b:137172860 TEST=build and deploy on a Krane BRANCH=master Change-Id: Ifd3ad5c3b03dce101cd15cbcec304f5e3a1081ac Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1695562 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* casta & bluebird : make charge state to ST_DISCHARGEYongBeum Ha2019-07-301-1/+2
| | | | | | | | | | | | | | | | charge_profile_override() changes charge state from ST_DISCHARGE to ST_IDLE on overtemperature condition. This makes led color to green when there is no adapter. This CL skip changing charge state when charge state is ST_DISCHARGE. BUG=b:138268383 BRANCH=None TEST=None Change-Id: I581a42641cf6632657b8e19ab41b532805024d9e Signed-off-by: YongBeum Ha <ybha@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715952 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* Helios:Modify Power LED behavior under suspendBarney_Liao2019-07-301-3/+4
| | | | | | | | | | | | | | | | According to Hatch Chromebook Requirements (Four second period, 25% duty cycle), modify power LED behavior under suspend. BUG=b:138411772 BRANCH=master TEST=Manual Check Power LED behavior under suspend. Change-Id: Id92539c378d2c99d884a84eca58514ffa78773fa Signed-off-by: Barney_Liao <barney_liao@pegatron.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1723889 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* mkbp_event: Only declare EC_CMD_MKBP_WAKE_MASK host command if neededNicolas Boichat2019-07-301-2/+2
| | | | | | | | | | | | | | | | | No need to use up flash space if the command is not supported anyway. BRANCH=none BUG=chromium:988303 TEST=make buildall -j TEST=make BOARD=jerry -j32, see that there is still 156 bytes free Save 64-128 bytes on most boards. Change-Id: Ib0494969840dfc4c11d236a2932f5de688ad6d14 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1723611 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
* common/mkbp_event: Remove prints in hc_mkbp_wake_maskNicolas Boichat2019-07-301-4/+0
| | | | | | | | | | | | | | | | They take up flash space, and should not be super useful. BRANCH=none BUG=chromium:988303 TEST=make buildall before and after Save 64-100 bytes on most boards Change-Id: I8eafb19b971f0823c0b0b704e680e063aa23dbd8 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1723610 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
* g: reset and wipe dcrypto engine after timeout.Marius Schilder2019-07-291-22/+203
| | | | | | | | | | | | | | | | | | | In case of a timeout, we need to clean up state and make sure engine is ready for a subsequent call. Added dcrypto_test console command to test the various scenarios: stack overflow, infinite loop and cfi failure recovery. Signed-off-by: mschilder@google.com BUG=b:135772657 BRANCH=none TEST=run console command dcrypto_test; build and run cr53 Change-Id: I531a59de6f2cf6941c797aeeeabb10eb10f02c9b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1677229 Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Commit-Queue: Marius Schilder <mschilder@chromium.org>
* Trembyle: Initial GPIO and CONFIG_* definitionsEdward Hill2019-07-298-747/+272
| | | | | | | | | | | | | | | | Update GPIOs to match schematic. First pass at CONFIG_* definitions. Just enough [base]board.c changes to build. BUG=none BRANCH=none TEST=make BOARD=trembyle Change-Id: Ia242351f60a5c00d90def77eb5cfcb7ac67c4b8b Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1720861 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* Zork: Change host_cmd to be ESPIDenis Brockus2019-07-292-2/+6
| | | | | | | | | | | | | | | | | | | This functionality requires a chipset_handle_espi_reset_assert to be defined. I created on in power/stoney.c but it is not filled in for what is needed. Not sure anything needs to be done but leaving a placeholder to make sure to follow up for verification. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I4c21e75c0ed7cafbc7f2058e9bd3c36bc8314c3a Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1721517 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* PoC: tablet-mode: Disable tablet mode in recovery bootDaisuke Nojiri2019-07-293-2/+23
| | | | | | | | | | | | | | | | | | | | | | | In recovery boot, keyboard could be unintentionally disabled due to unstable accels, which are not calibrated. This patch disables tablet mode in recovery boot. We get the same effect if motion sensors or a motion sense task are disabled in RO. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:984086,b/137251616 BRANCH=none TEST=buildall Change-Id: Idcf53ad119edbd8ff9362523ec7a72f438ae4401 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1696914 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* dorp: enable ec_feature kbbacklit by SKUIDDevin Lu2019-07-292-0/+22
| | | | | | | | | | | | | | | | | Consider Dorp use the same firmware with Meep and only Dorp has kbbacklight SKU. so we're only reporting Dorp kbbacklit SKU on ec_feature. BUG=b:138177049, b:138413969 BRANCH=octopus TEST=make sure ectool inventory has show keyboard backlight support with Dorp kbbacklit SKU. Change-Id: I952b48128669790d7018017e3fb550c73f256d28 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1723890 Reviewed-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org>
* dorp: add support keyboard backlightDevin Lu2019-07-292-3/+4
| | | | | | | | | | | | | | | | | Currently Dorp use the same firmware with Meep, enable keyboard backlight support from Meep. BUG=b:138177049, b:138413969 BRANCH=octopus TEST=make buildall -j, make sure ec console kblight can adjust keyboard backlight brightness. Change-Id: Id624e31a85c296468199e4532b758fd4777e70d2 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716681 Reviewed-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org>
* cortex-m0: implement __ffssi2Ting Shen2019-07-292-1/+17
| | | | | | | | | | | | | | | | | | | The file is copied from riscv-rv32i/__builtin.c. bc12_update_charge_manager() in pi3usb9201 driver uses this function. BUG=b:135895590 TEST=combined with CL:1673955, build and deploy on jacuzzi BRANCH=master Change-Id: If8b8cc8e4a3acdad7285c23e2f3627c7d05bf3b8 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715951 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* chip/host: Add check for TEST_BUILD in trng.cCraig Hesling2019-07-271-0/+4
| | | | | | | | | | | | | | | | | | | Due to the possibly unnoticeable security vulnerability it would cause if the dummy host trng driver made it's way into production (non-test) code, this change adds a small check to ensure it is being used only in test or fuzz builds. This isn't as much of a concern for other dummy host drivers. For example, including a fake spi driver may simply manifest as broken feature. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I31138976566d39ed44d905bbb2c43c5f6decbaf4 Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1722182 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Zork: Change charger to ISL9241Denis Brockus2019-07-262-3/+5
| | | | | | | | | | | | | | | | Found a couple of compile issues when I swapped over to the ISL9241 charger. So fixed those as I changed chargers. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Ifcacca859eb86f22ea0619e05dcaa689c56b0d73 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1720859 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* fpsensor: Change crypto functions to return error code instead of result codeYicheng Li2019-07-264-28/+28
| | | | | | | | | | | | | | | | | EC_RES_SUCCESS and EC_RES_ERROR are meant to be returned in EC command handler to represent command result, so change crypto functions to return EC_SUCCESS and EC error codes instead. BRANCH=nocturne BUG=none TEST=make -j buildall TEST=tested enrollment, matching, deletion and multifinger on nocturne DUT Change-Id: Ia98fa7469ab4e5dba00ede19dd34c5007d17b054 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715512 Reviewed-by: Nicolas Norvez <norvez@chromium.org>
* isl923x: Check max current in isl923x_set_dc_prochotKo2019-07-262-2/+22
| | | | | | | | | | | | | | | | | | The DCProchot register takes a value in multiple of 128 up to 12800 mA. This patch makes isl923x_set_dc_prochot return error when a value exceeding the max is passed. Signed-off-by: Ko Ko <ko_ko@compal.corp-partner.google.com> BUG=b/130387567 BRANCH=Nami TEST=buildall Change-Id: If2155d7fc74c1491bf7c0a742ba8356c268a94a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716673 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* chip/mt_scp/clock.c: enable pwrap_scp clockHsin-Hsiung Wang2019-07-262-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | | During suspend, pmic wrap will be waken up by scp which is due to hw design. However, the clock of pmic wrap is 26mhz which would be turned off in the suspend mode, so we needs to change the clock of pmic wrap from 26mhz to ULPOSC. BRANCH=none BUG=b:135985700 TEST=make BOARD=kukui_scp -j && \ bash board/kukui_scp/update_scp $IP alias rtcalm='echo "+15" > \ /sys/class/rtc/rtc0/wakealarm' rtcalm cat /proc/driver/rtc powerd_dbus_suspend TEST=Can resume in suspend. Change-Id: I07b9d76f574fe1007e20f185bb278e0884397176 Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1686990 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
* ectool: Add stress command to ectoolCraig Hesling2019-07-251-0/+166
| | | | | | | | | | | | | | | | | | | | | | | This command stress tests the channel between the user-side ec command interface and the target MCU. This can be used to expose rare communication errors, such as exceeding communication timeouts. BRANCH=none BUG=b:131724307,b:116065496 TEST=make buildall -j TEST=cros_workon --board=nocturne start chromeos-base/ec-utils emerge-nocturne chromeos-base/ec-utils cros deploy dut1 chromeos-base/ec-utils # On dut1 ectool stress ectool --name=cros_fp stress ectool --name=cros_fp stress reboot Change-Id: I485e915d0bc027ccee8d2d78b90fe0d066a3ff4d Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1686712 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* clang-format: import style from Linux kernelJack Rosenthal2019-07-251-12/+119
| | | | | | | | | | | | | | | | | | | | | | The Linux kernel now has an official .clang-format file available. Import this file to EC codebase. Changes made: - Uncommented options that were disabled since kernel targets clang-format 4.0, but we have 9.0 in the chroot - Removed kernel-specific foreach macros BUG=none BRANCH=none TEST=clang-formatted some files, made sure they looked Linux-kernel like Change-Id: I8255fad43f965186852f82120ed07ca5f7fff643 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1718830 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* ec_commands: Add EC_CMD_MKBP_WAKE_MASK.Aseda Aboagye2019-07-253-2/+242
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds a new host command, EC_CMD_MKBP_WAKE_MASK which allows the host to retrieve and set the MKBP host event wake mask along with the MKBP event wake mask. An accompanying console command, `mkbpwakemask` is present as well to view and adjust the wake masks. In order to use this host command, one of the following EC CONFIG_* options must be enabled in the EC: CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK or CONFIG_MKBP_EVENT_WAKEUP_MASK. BUG=chromium:786721 BRANCH=None TEST=Deploy new version of ectool and EC firmware on nocturne, verify that ectool can view and adjust the wake masks. Verify that masks can be adjusted via the console command as well. Change-Id: I01a389ccd571328220eadd19ded4167dea8c6faa Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1700004 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
* i2c: don't scan i2c addresses less than 0x08Jett Rink2019-07-253-5/+19
| | | | | | | | | | | | | | | None of the existing i2c addresses in the EC code base are less than 0x08 and those addresses are reserved by the i2c and SMBus specification. BRANCH=none BUG=b:138156666 TEST=i2c bus scan with a smart battery doesn't "misbehave" any more and other devices can be detected properly. Change-Id: I561b082c4c7e3df7caaa33b6ef6ad467dabbd5a5 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715326 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* it83xx(iteflash): Support Flash for it8xxx1 or it8xxx2Donald Huang2019-07-251-16/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support 3 Byte Chip ID. Support 3 Byte DBGR Address. Change the flash size determination method. BUG=none BRANCH=none TEST=Check it ok on both it8320 and it8xxx2 series. There are several new chip from ITE. The Chip ID : 81201 81202 83201 83202 We temporarily defined it as it8xxx1 and it8xxx2 series. The new chip id is from 2 bytes to 3 bytes. We verify it ok from Servo V2 + ITE evboard. (cr) (asus-serve-v4) donald@donald-Aspire-4752 ~/trunk/src/platform/ec $ sudo ~/trunk/src/platform/ec/util/flash_ec --board=it83xx_evb INFO: Using servo_v2. INFO: Using ec image : /mnt/host/source/src/platform/ec/build/it83xx_evb/ec.bin INFO: Flashing chip it83xx. INFO: Closing servod connection to ftdi_i2c interface INFO: Programming EC firmware image using iteflash... CHIPID 81201, CHIPVER 40, Flash size 256 kB Done with sending special waveform. Disabling watchdog... Disabling protect path... Erasing flash...erase size=262144 \100% Erasing Done. Writing 262144 bytes at 0x00000000....... \100% Writing Done. Verify 262144 bytes at 0x00000000 \ 99% Verify Done. INFO: Flashing done. INFO: Reinitializing ftdi_i2c interface Change-Id: If17f85cb5d67d262a85d5cdeb89044646c39a0e1 Signed-off-by: Donald Huang <donald.huang@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1655213 Reviewed-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Donald Huang <cguwinds@gmail.com> Tested-by: Donald Huang <cguwinds@gmail.com>
* treeya: Add new grunt-family board.Chris Wang2019-07-258-0/+707
| | | | | | | | | | | | | | | | Add treeya board. Initially base on aleena. BUG=b:135551210 BRANCH=none TEST=emerge-grunt chromeos-ec Ensure that ec.bin are created Change-Id: I16abc65af81d5127c0f964a42327e60a8674be22 Signed-off-by: Chris Wang <chris.wang@amd.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1710209 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
* driver: Add support for calibration modeGwendal Grignou2019-07-246-12/+30
| | | | | | | | | | | | | | | | | For TCS3400, performing calibration is not just a one-shot event: The RBG sensor stays in calibration mode: returns raw value in R, G, B space. When out of calibration, it returns light information in X, Y and Z space. BUG=b:124512628 BRANCH=hatch,flapjack TEST=unit test Change-Id: I6766907054c8e79a3cbcb629ef91a0967ea0780a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1702543 Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
* Kindred: update Led behaviorben.chen2@quanta.corp-partner.google.com2019-07-242-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | Support Kindred LED Behavior as below Charge: Amber on (S0/S3/S5) Full: Blue on (S0/S3/S5) Discharge in s0: Blue on Discharge in s3: Amber on 1 sec off 3 sec Discharge in s5: off Erro: Amber on 1 sec off 1 sec Factory mode: Blue on 2 sec Amber on 2 sec BUG=b:135720559 BRANCH=master TEST=none Change-Id: I2ff503e0f4b874e2a3785d0c0cf6f0fd5c7f1e3c Signed-off-by: ben.chen2@quanta.corp-partner.google.com Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1695564 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Tested-by: David Huang <David.Huang@quantatw.com> Commit-Queue: Philip Chen <philipchen@chromium.org>
* test: Add new test framework toolsYuval Peress2019-07-242-6/+29
| | | | | | | | | | | | | | | | | | | | | | | | | Add new before/after test functions to be used for clean-up and tear-down of tests. Add new asserting functions: - TEST_EQ ensures that two values are equal - TEST_NE ensures that two values are not equal - TEST_BITS_SET ensures that a value contains all bits in mask - TEST_BITS_CLEARED ensures that a value doesn't contain any bits in mask The benefit of these is that unlike TEST_ASSERT they will also print the values when the assersion is wrong. BRANCH=None BUG=b:137758297 TEST=None yet Change-Id: I2f305ef34e541c289f22c6596f53ee5cd977c7a8 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704165 Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cr50: add closed loop reset print statementsMary Ruthven2019-07-241-0/+2
| | | | | | | | | | | | | | Add some print statements to closed loop reset, so it's easier to tell what cr50 is doing. BUG=none BRANCH=cr50 TEST=none Change-Id: I2b6b28d8eabcd8950fe7105b4382d8b8ed94afa6 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716927 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* hatch: Override board_hibernateTim Wawrzynczak2019-07-241-0/+29
| | | | | | | | | | | | | | | | | | In the board_hibernate function, shut down the AP, and wait 300ms for the chipset state machine to settle down. This allows the EC to actually hibernate; otherwise, it would simply reboot the device. BUG=b:135073910 BRANCH=none TEST=Verify that EC goes into hibernate with Alt+Volume Up+H, then boots back up from time 0 on PB press. Verified that EC will wake from hibernate on insertion of AC. Change-Id: Ie98333e9ce65778df8d07ce6ae165b5c7140edf1 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1715907 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* driver: IO expander: nct38xx: add support for NCT38XX series chipsCHLin2019-07-245-0/+243
| | | | | | | | | | | | | | | | | | | Nuvoton TCPC NCT38XX series chips have some pins which can be used as GPIO function. we can treat it as the IO expander chip also. This commit adds the driver to support it. BRANCH=none BUG=none TEST=No error for "make buildall" TEST=Apply this and related CLs, manually test each API, make sure each function works correctly with NCT3807 and NCT3808 at the same time. Change-Id: I2254c2e867445e55d1c261172e4b7175d22f28ef Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1657859 Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* garg: add simplo BYD 916Q2294H batteryDevin Lu2019-07-242-4/+34
| | | | | | | | | | | BUG=b:135986521,b:136786005 BRANCH=octopus TEST=Test on charging/discharging/battery cut off pass. Change-Id: Idda1c4bc027b44980e047dc89ccae3c26e23cfbe Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1710208 Reviewed-by: Marco Chen <marcochen@chromium.org>