summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ec_commands: Make importing ec_commands.h easier for foreign projectsYu-Ping Wu2019-08-212-7/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are many projects (e.g., kernel, coreboot, flashrom, mosys) having their own copy of the ec_commands.h header file. To reduce the effort of synchronization, this file should be maintained so that it can be copied and included without modification whenever possible. Currently ec_commands.h includes compile_time_macros.h only if __KERNEL__ is not defined. However, there are many macros defined in the latter file (e.g., ARRAY_SIZE) that are already defined in other projects, leading to a redefinition error. To resolve this issue, ec_commands.h is modified in this CL so that compile_time_macros.h is only included when inside the Chromium EC repository, which is controlled by the macro CHROMIUM_EC. Option '-DCHROMIUM_EC' is also added to CPPFLAGS to avoid redefinition error of macro 'BUILD_ASSERT'. BUG=b:109900671,b:118654976,chromium:984623 BRANCH=none TEST=make buildall -j Cq-Depend:chromium:1760656 Change-Id: I38c77f0233ff5962b6f90f25ba96802d05e706d7 Signed-off-by: Yu-Ping Wu <yupingso@chromium.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1535086 Tested-by: Yu-Ping Wu <yupingso@chromium.org> Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* baseboard/intelrvp: Avoid including "usb_pd_tcpm.h" from baseboard.hYu-Ping Wu2019-08-212-1/+1
| | | | | | | | | | | | | | | | | | | | | board/tglrvpu_ite/board.h includes baseboard.h, which includes usb_pd_tcpm.h, which includes ec_commands.h, which includes board.h again, leading to compilation failure in CL:1535086. This patch breaks the circular dependency by removing "usb_pd_tcpm.h" inclusion in baseboard.h. To make baseboard/intelrvp/retimer.c compilable, "compile_time_macros.h" is also included since it is where BUILD_ASSERT is defined. BRANCH=none BUG=b:109900671,b:118654976 TEST=make buildall -j Change-Id: Ifdf6594f4eb3a2f732bc5979c0fbb0c79ee15ddf Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1760656 Commit-Queue: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* baseboard/kukui: remove incorrectly defined flagsTing Shen2019-08-211-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The expected usage of baseboard.h is: <in board.h> #define VARIANT_KUKUI_SOMETHING ... #include "baseboard.h" If some VARIANT_KUKUI_* flag is also defined/removed in baseboard.h, it will overwrite board's config. As a result, baseboard.h should not define any of the VARIANT_* flags. Move VARIANT_KUKUI_DP_MUX_GPIO into comment for document propose only. BUG=b:139648560 TEST=verify both direction of dp works BRANCH=master Change-Id: I0b4f6afa07657ee4cd1495d302e026a99e770640 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1761752 Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* akemi: enable motion sensor driversPaul Ma2019-08-213-39/+46
| | | | | | | | | | | | | | | | | Akemi use lis2dwl as lid sensor and lsm6ds3tr-c as base sensor. This patch enable both of them. lis2dwl works in forced mode. BUG=b:138978278 BRANCH=none TEST=boot Akemi board, use command 'accelinfo on' to see sensor output, make sure the data are correct. Cq-Depend: chromium:1741598 Change-Id: I6ff19e388c74d95b8287b9899a81d2a3f866939e Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741106 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* driver/rt946x: check wrong bit status when ADC conversionxiong.huang2019-08-211-1/+1
| | | | | | | | | | | | | | | | Base on official MT6370 datasheet, ADC_STAT status is 0 which indicates ADC conversion complete. BUG=b:139653474 BRANCH=master TEST=Add more log information, EC will check ADC_STAT status about 6 times in one loop. Change-Id: I50a10c25cfb35a1f41c569fabf360c5e29f44be2 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1760661 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
* driver/tcpm/it83xx: Enable TCPC receive SOP'Ruibin Chang2019-08-216-27/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | Enable TCPC receive SOP' for communication with cable, when we are Vconn source role. BUG=None BRANCH=None TEST=test on board: ampton and reef_it8320 1.SRC connects to SNK via E-mark cable, sources Vconn successfully, and receives cable's ack of discover id request. 2.SRC connects to SNK via E-mark cable, but not source Vconn to cable, and receives nothing of discover id request (this isn't effect on request SNK flow). 3.console cmd pdcable 0 2019-07-30 11:43:40 > pdcable 0 2019-07-30 11:43:45 Cable Type: Passive 2019-07-30 11:43:45 Connector Type: Type C 2019-07-30 11:43:45 Cable Current: 5A 2019-07-30 11:43:45 USB Superspeed Signaling support: Gen 1 Change-Id: Icd2e6f8481bb7a4e0b922460d46b831f36112738 Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728669 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* treeya: enable motion sensor drivers and fix ec feature flagPaul Ma2019-08-214-3/+151
| | | | | | | | | | | | | | | | | | | | | | | | | Treeya use two sets of base/lid sensors, one is BMI160/KX022 which is supported by baseboard, another is LSM6DS3TR/LIS2DWL. This patch will enable one of them according to sku_id. This patch also remove keyboard backlight feature from ec feature flags according to sku_id since both Treeya and Treeya360 do not support keyboard backlight. BUG=b:138744661, b:137945787, b:137849739 BRANCH=none TEST=boot treeya boards which mounted BMI160/KX022 or LSM6DS3TR/LIS2DWL, use 'accelinfo on' to enable sensor output, make sure that their x/y/x value are correct. Cq-Depend: chromium:1741598, chromium:1751302 Change-Id: I213a2073c2232ef0f2f70be788f859a264e09425 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1746006 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org>
* Grunt/Treeya: Add ANX3447 variant for TCPC 0.Paul Ma2019-08-2113-888/+207
| | | | | | | | | | | | | | | | | | | Merge common TCPC code into baseboard, and add choice of ANX3429 or ANX3447 for port 0 TCPC. Treeya uses ANX3447, all others use ANX3429. BUG=b:138744661 BRANCH=none TEST=build -j BOARD=treeya Change-Id: I66f84ae50be0b5fe80479dfdc699717427e4457c Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1751302 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org>
* driver: lis2dw12/lis2dwl: add polling mode supportPaul Ma2019-08-212-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | This patch add polling (forced mode) support for lis2dw family. 'froced mode' is a common usage model for lid accel sensor. Treeya will support two set (BMI160/KX022 and LSM6DS3/LIS2DWL) of base/lid sensors and both of their lid sensor should work in the same mode (forced mode or interrupt). Since KX022 driver only support polling, so lis2dwl also need polling support. This patch add it. BUG=b:138768226, b:138978278 BRANCH=none TEST=on Akemi board, build both interrupt and polling (by define CONFIG_ACCEL_LIS2DW_AS_BASE or not) mode firmware, boot and confirm sensors init suscess and 'accelinfo on' has correct sensor x/y/z output. Cq-Depend: chromium:1739026 Change-Id: Ib0dcb7b317eec51a38598a644f965d7ecc5928c6 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741598 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org>
* driver: lis2dwl: add driver supportPaul Ma2019-08-217-4/+65
| | | | | | | | | | | | | | | | | | | | | | | | | lis2dwl has almost the same register interface as lis2dw12. lis2dwl only has one low power mode and when in low power mode, it has only 12 bit resolution. In order to get 14 bit resolution, we only use its high performance mode. Add MOTIONSENSE_FLAG_INT_ACTIVE_HIGH flag to support both active high and active low interrupt. BUG=b:138768226, b:138978278 BRANCH=none TEST=use Akemi board, add lis2dwl as accel sensor, boot the board and make sure sensor x/y/z get correct value by 'accelinfo on' Cq-Depend: chromium:515302 Change-Id: I37fcc0f43af3c8055079e09db00757b665813ba8 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1739026 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: mario tesi <mario.tesi@st.com> Commit-Queue: Martin Roth <martinroth@chromium.org>
* EC: Do not drop SCI events responsible for wake.Ravi Chandra Sadineni2019-08-212-7/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | EC currently clears all events(main copy of hostevents) on every resume. This seems to be added to clear events that are only part of wake mask and not part of SCI mask as they can stick and cause premature wake on next suspend. This patch stops clearing events that are part of SCI mask from the main copy as ACPI subsystem will query and clear them on resume anyway. This helps kernel to identify the reason for wake if it caused by events that are part of SCI mask. Previously coreboot used to depend on main copy to log wake reason. i.e on every resume coreboot used to query and log and clear the wake reason by reading all events from the main copy. Since this also comes in way of kernel in identifying the wake reason, this change also sets up events_copy_b for coreboot by clearing it on every suspend entery. More details can be found at http://go/hostevent-refactor. BUG=b:133262012, b:65976859 BRANCH=None TEST=Tested suspend/resume with wakeup count on hatch and grunt. Change-Id: I0fac250d4dac49af960b29e8b0e28841af2ef509 Signed-off-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1717498 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* driver: IO expander: nct38xx: add the interrupt supportCHLin2019-08-217-65/+389
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IO pins of Nuvoton TCPC NCT38XX chips have the ability to support the interrupt function. This commit adds the driver to support it. However, please note that if the system needs to use an IO on NCT38XX to support the interrupt, the following two consideration should be taken into account. 1. Interrupt latency: Because it requires to access the registers of NCT38XX via I2C transaction to know the interrupt event, there is some added latency for the interrupt handling. If the interrupt requires short latency, we do not recommend to connect such a signal to the NCT38XX. 2. Shared ALERT pin: Because the ALERT pin is shared also with the TCPC ALERT, we do not recommend to connect any signal that may generate a high rate of interrupts so it will not interfere with the normal work of the TCPC. BRANCH=none BUG=none TEST=No error for "make buildall" TEST=Apply this and related CLs, manually test each IO pins; make sure each pin's interrupt handler is correctly executed. Change-Id: I72d835557913d87097b2e0d82165e40fe132ca77 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1734948 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com>
* log: Preserve Kukui EC reset logs across every EC reboot on SRAM.Shannon Chen2019-08-2110-9/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | On Kukui, we need to put console logs and reset reasons at fixed addresses on SRAM to save the information across each EC resets. Otherwise, EC will lose console logs and reset reasons after resetting EC. This CL ensures that the contents of reset and console logs will not be clobbered or cleared by putting mandatory symbols at a fixed location on SRAM. The values will only be reset when checksum or sanity check fails. BUG=b:133795403 TEST=1. On Kukui, shutdown AP, reboot AP, or sysjump, and see the previous logs before reboot will be kept on /var/log/croc_ec.log 2. Reset reasons can be viewed with ectool uptimeinfo BRANCH=master Change-Id: I19db49101fda1675dc2fdc047b7f14af77cdb6e6 Signed-off-by: Shannon Chen <shannc@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716671 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Shannon Chen <shannc@chromium.org> Tested-by: Shannon Chen <shannc@chromium.org>
* Helios: Support mode-aware DPTFPhilip Chen2019-08-211-0/+4
| | | | | | | | | | | | | | | BUG=b:138702459 BRANCH=none TEST=manually test on helios board together with coreboot changes, confirm the trip temperatures are different in clamshell/flipped-360 mode Change-Id: I4ad0d9d0d12ceb536f5c1c2e5074f046f307131b Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1752720 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org>
* cr50: Add vendor command to set U2F modestabilize-12441.BLouis Collard2019-08-212-0/+19
| | | | | | | | | | | | | | | | The existing U2F command will be deleted, as it is part of the legacy U2F implementation; this command is a replacement for it. BRANCH=none BUG=b:138578925 TEST=run u2fd with --g2f and --u2f, check G2F cert to verify mode is respected Signed-off-by: Louis Collard <louiscollard@chromium.org> Change-Id: I3956809248bb35baaaecdeef66f2fa35832aa421 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1748846 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* util/presubmit_check.sh: Exclude README.md and navbar.md filesTom Hughes2019-08-211-0/+4
| | | | | | | | | | | | | | | These files aren't used by "make buildall", so it shouldn't cause a developer to run "make buildall" before submitting a change to the file. BUG=None BRANCH=None TEST=Modify navbar.md. Try to upload and verify that the presubmit check does not flag it. Change-Id: Ia4eaa7009aa52b7a096171e66e6541694ef73032 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1758539 Reviewed-by: Jett Rink <jettrink@chromium.org>
* cleanup: remove redundant header file includeJett Rink2019-08-201-1/+0
| | | | | | | | | | | | The header file includes itself, which does nothing. Remove. BRANCH=none BUG=none TEST=builds Change-Id: I6b87a801a1ba09400b7c582dab66dec62b096e5b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1762534
* common: change clksrc_high to use STATIC_IF_NOTJack Rosenthal2019-08-201-10/+2
| | | | | | | | | | | | | | | This is an example of using STATIC_IF_NOT to assert a config option when a variable wil go unused. BUG=chromium:989786 BRANCH=none TEST=buildall Change-Id: I727505a26580506c04b26888030924253bb5fb2f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733017 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* cleanup: use STATIC_IF for hibernate variablesJack Rosenthal2019-08-201-12/+14
| | | | | | | | | | | | | | | | This is an example usage of STATIC_IF, as a child CL of the STATIC_IF implementation. BUG=chromium:989786 BRANCH=none TEST=buildall Change-Id: I1e69bf85a3daf8aa5f5c0e0b1da9808a8a5f8649 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731972 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Raul E Rangel <rrangel@chromium.org>
* common: add STATIC_IF and STATIC_IF_NOT macrosJack Rosenthal2019-08-207-20/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A common pattern to use with IS_ENABLED is like this: /* * This var should only be used if CONFIG_FOO. The linker errors if * CONFIG_FOO is not defined is intentional. */ #ifdef CONFIG_FOO static #else extern #endif int some_var; The issue with this is that it leads to an over-verbose and potentially hard to read pattern, and does not have the check that CONFIG_FOO was only defined to blank. Suppose a macro like this existed: STATIC_IF(CONFIG_FOO) int some_var; ... which expands to "static" when CONFIG_FOO is defined to empty, "extern" when CONFIG_FOO is not defined, and errors when CONFIG_FOO is defined to non-empty. This CL implements that, as well as the inverse (STATIC_IF_NOT). BUG=chromium:989786 BRANCH=none TEST=provided unit tests, buildall Change-Id: Ib57aaba62bc184fda9aa782a780d5f13ba44ae88 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731859 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Volteer: add I2C bus configurationKeith Short2019-08-203-0/+83
| | | | | | | | | | | | | Configure I2C pins and i2c_ports for Volteer BUG=none BRANCH=none TEST=make BOARD=volteer, make buildall Change-Id: I3834a18a94565566b839d1e34befb180a366177c Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1758534 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* Volteer: Add initial AP signalsKeith Short2019-08-205-2/+28
| | | | | | | | | | | | | | Enable ESPI interface and support for IceLake chipset. Configure reset and power button signals. BUG=none BRANCH=none TEST=make BOARD=volteer Change-Id: I6f06a71fc2516781fe3c23b997310a960e6e0bb8 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1758533 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* flapjack: tcs3400: add channel offsets and coefficientsNick Vaccaro2019-08-202-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | - adds channel offsets - adds channel coeefficients for use in xyz translation - enables LUX table use in anti-saturation algorithm These values are from the "Color Sensor Calibration to Compensate Cover Window Induced Error" document. BUG=b:124512628 BRANCH=master TEST=Flash and boot flapjack, verify that ALS and RGB sensors are still generating data. I used alslog patch and enabled saturation logging in EC console via "alslog 8". Verified LUX calculation had < 1% error (driver read 0.1% lower than a $3k LUX meter read). Verify that under a constant light source, the adjustment mechanism correctly drives the ALS values such that they land in the sweet spot between 90 to <100% of saturation. Cq-Depend: chromium:1633269 Change-Id: I88ec0e23f93aebb542823bccf27aade566074f2b Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1665210
* IO Expander: add the interrupt support to IOEX frameworkCHLin2019-08-205-2/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL creates interfaces which bring the IOEX framework to support interrupt feature. To declare an IOEX IO which supports the interrupt function, file its declaration in gpio.inc with the format: IOEX_INT(name, expin, flags, signal) Note: like GPIO, all IOEX IOs with interrupt handlers must be declared at the top of the IOEX's declaration in the gpio.inc The following two APIs are added to enable/disable each IOEX IO's interrupt function: 1. ioex_enable_interrupt 2. ioex_disable_interrupt BRANCH=none BUG=none TEST=No error for "make buildall" TEST=Apply this and related CLs, manually test each IO pins; make sure each pin's interrupt handler is correctly executed. Change-Id: Icbf54c09120e37b68c647c884cd6aa28d9313167 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1734947 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: CH Lin <chlin56@nuvoton.com> Commit-Queue: Edward Hill <ecgh@chromium.org>
* driver/tcs3400: improve efficiency of auto-adjustNick Vaccaro2019-08-203-16/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds an array which holds the number of atime increments needed at various lux levels and again settings to change delta from saturation by 1%. Using this table, the anti-saturation algorithm can get to the 90% band in most cases in a single adjustment vs the 10 to 15 adjustments previously needed when not using this table. Enabling CONFIG_TCS_USE_LUX_TABLES takes up 280 bytes in the ec.obj. BUG=b:124512628 BRANCH=master TEST=Flash and boot flapjack, verify that ALS and RGB sensors are still generating data. I used alslog patch and enabled ALS logging in EC console via "alslog 2047". Verify that under a constant light source, the adjustment mechanism correctly drives the ALS values such that they land in the sweet spot between 90 to <100% of saturation. Change-Id: I7cd0b8242e72233f50ff2751834f7bba367c6706 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1677764 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* tcs3400: update fields for als and rgb sensorNick Vaccaro2019-08-205-29/+107
| | | | | | | | | | | | | | | | Update board files for akemi, flapjack, hatch, kohaku, and kukui to use new field names in als_calibration_t and als_channel_scale_t. BUG=b:124512628 BRANCH=master TEST='make buildall' of the EC, verified builds succeed. Cq-Depend: chromium:1633269 Change-Id: I7ee324ce3de3377cd1538b631f4ec6294d2e9078 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1711958 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver/tcs3400: add auto-compensation for saturationNick Vaccaro2019-08-203-142/+455
| | | | | | | | | | | | | | | | | | | | | | | | | | Making settings more sensitive makes the SNR better, so this algorithm strives to keep the output level as close to 90% saturation as possible. Adds calibration mode and lux calculation. Removes unused last_value field from the tcs3400_rgb_drv_data_t structure, we use raw_xyz field in motion_sensor_t struct instead. BUG=b:124512628 BRANCH=master TEST=Flash and boot flapjack, verify that ALS and RGB sensors are still generating data. I used alslog patch and enabled ALS logging in EC console via "alslog 1023". Verify that under a constant light source, the adjustment mechanism correctly drives the ALS values such that they land in the sweet spot between 90 to <100% of saturation. Cq-Depend: chromium:1711958,chromium:1702543 Change-Id: Ibf260a990fe285cb54ee94c1ebe8aa85ea10affc Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633269 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* test: add baseline test for TC_DRP_TRYSRC SMJett Rink2019-08-205-9/+78
| | | | | | | | | | | | BRANCH=none BUG=none TEST=unit test pass Change-Id: I0ecb9f0298fd43ca0db800311a309d98eb1e29b5 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1744658 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* test: add sanity check for existing state machinesJett Rink2019-08-2010-23/+398
| | | | | | | | | | | | | | | | | | | | We want to ensure that our usb state machines - do not have any cycles - do not have any completely empty states - have names for every print statement if called These new unit tests allow us to have build-times checks for the above. BRANCH=none BUG=none TEST=tests pass. Made each test fail locally to ensure that tests were actually working. Change-Id: Idd2c4d69e83cf38c97278edd1727d86b52a85db9 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1744657 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* test: test nested entry/run calls to set_stateJett Rink2019-08-201-14/+93
| | | | | | | | | | | | | | | Ensure that a call to set_state will stop the chain of entry or run calls in parent/child states. BRANCH=none BUG=none TEST=run unit test Change-Id: I38a6eefeb728403503fee5455ed3ec065747a760 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1744656 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* usb: update state machine frameworkJett Rink2019-08-2020-2917/+2221
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - OBJ is renamed to context (CTX) for current and last state - State definition now includes its parent (no need for the boiler plate function that takes in a signal) - The init_state, set_state, and exe_state have been re-written to take advantages of new state machine definition. I had to add more logic to handle hierarchical states fully. - Explicitly create the USB states at the bottom of the file with all of the statics. Don't need to use macros (even though I did suggest them) - Use NULL when we do_nothing instead of calling into a function - Created a "private" enum in the C file that lists all of the states in the file, that we can use to refer to a state (it is also the index into the states array for that state). - Changed prototype of state function to return void, since we aren't really using the return value and it cleans up a lot of return 0 that aren't needed. - Add const to int port since we can and should - Moves struct definition to implementation file only to keep implementation details private. We can access data through accessor if needed. BRANCH=none BUG=none TEST=all unit tests passes Change-Id: I482a63e08f7d63022d5102b891a2fac0b0faa46f Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733744 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Trembyle: Make GPIO names match schematicEdward Hill2019-08-205-58/+79
| | | | | | | | | | | | | BUG=none BRANCH=none TEST=make BOARD=trembyle Change-Id: I870bb384e59468c91ad19ebfbdf6d376438ae7ba Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1755648 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* Trembyle: update usb_pd_policyDenis Brockus2019-08-201-15/+28
| | | | | | | | | | | | | | | | | | Update some of the latest usb_pd_policy fixes that did not migrate to the code base used for trembyle https://crrev.com/c/1450815 https://crrev.com/c/1585121 https://crrev.com/c/1742870 BUG=b:139351980 BRANCH=none TEST=make buildall -j Change-Id: I536c1c19acaf72c66ca2ed3e6729a88f3f524344 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1754583 Reviewed-by: Edward Hill <ecgh@chromium.org>
* Volteer: initial EC board setupKeith Short2019-08-208-0/+217
| | | | | | | | | | | | | | | | Create Volteer skeleton build. Only includes base NPCX7 configuration required to build. BUG=none BRANCH=none TEST=make BOARD=volteer, make buildall TEST=Booted skeleton volteer EC image on careena board. Change-Id: I07769edfac9818320f18bbc9d0ebcd8f345fb8bb Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1758532 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* usb: state machines will resume immediatelyJett Rink2019-08-192-18/+17
| | | | | | | | | | | | | | Instead of waiting for one iteration to resume when we enable it, restart the state machine immediately BRANCH=none BUG=none TEST=build and units tests Change-Id: I6e1d1b281798ad8bd67fb552d4e2c2b36859a7f9 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733743 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* usb: remove state transitions in exitJett Rink2019-08-192-2/+0
| | | | | | | | | | | | | | | If we transition to a new state in exit, then the original state we are transitioning to is lost. The new state machine common code will warn in this scenario. BRANCH=none BUG=none TEST=builds Change-Id: I571ff62dd6969bd3743cf33ae5c56dc02ae59724 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733742 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* usb: de-dup common code from old and new PD stackJett Rink2019-08-1914-153/+147
| | | | | | | | | | | | | | We still need to pull out more common code between the two stacks, but this is scaffolding with a few examples. BRANCH=none BUG=b:137493121 TEST=unit tests pass Change-Id: Ibd9dda1e544e06f02aa3dde48ca7de1539700cfa Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1744655 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* common: Prepare always_memset()stabilize-kernelnext-broadwell-12434.BYicheng Li2019-08-174-0/+26
| | | | | | | | | | | | | | Add a config for using always_memset() from third_party/cryptoc BRANCH=nocturne BUG=chromium:968809,chromium:989594,b:130238794 TEST=make -j buildall Change-Id: I22c83512eb1b8bdc8dac1b26315d25b65831513c Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731543 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* docs: Add logo and change "Sitemap" to "Documentation"Tom Hughes2019-08-161-1/+2
| | | | | | | | | | | | | | | | | | The logo makes the docs consistent with other Chromium documentation: https://chromium.googlesource.com/chromiumos/docs/+/master/developer_guide.md I think that Using "Documentation" instead of "Sitemap" in the navbar makes it a little more obvious that clicking on that brings you to the index of all EC documentation. BRANCH=none BUG=none TEST=View in gitiles Change-Id: Iefacc1c1f7565061951ca78950313bc29f40ff9f Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741304 Reviewed-by: Jett Rink <jettrink@chromium.org>
* kodama: Add ACCEL and GYRO sensor LSM6DS3TR-C driverxiong.huang2019-08-163-26/+23
| | | | | | | | | | | | | | | | | | Kodama project uses chip LSM6DS3TR-C instead of BMI160, and modify its driver information to support LSM6DS3TR-C well. BUG=b:136977971 BRANCH=master TEST=1) At EC RW stage, accel and gyro init successfully. 2) It can get accel sensor XYZ datas with command 'ectool motionsense' in VT2. Cq-Depend:chromium:1730377 Change-Id: I32d5fb7ea1b305e42e1e5bbe9e1f22c9e6220abd Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1736408 Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* kodama: Support smart batterystabilize-12428.Bxiong.huang2019-08-166-17/+121
| | | | | | | | | | | | | | | | | Provide SMP and Celxpert smart battery initial files. BUG=b:136977971, b:138826367 BRANCH=master TEST=boot ec, verify that ec console prints 'found batt:SMP' or 'found batt:Celxpert'. Cq-Depend:chromium:1730377 Change-Id: I607fc41c51e8b27acddefda4dcd2ea02a7597a0f Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731211 Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
* usb_pd: Get USB-C cable type informationAyushee2019-08-164-2/+19
| | | | | | | | | | | | | | | Added logic to share the USB-C cable type information in host command to configure the virtual mux of Intel SOC. BUG=b:129990370 BRANCH=None TEST=Verified on Intelrvp, able to get correct USB-C cable type information Change-Id: Iee7c274d318f59a482d21b8faa56610509fbdf8e Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1749560 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* usb_pd: Storing USB-C cable attributesAyushee2019-08-163-32/+371
| | | | | | | | | | | | | | | | | | | | | | Cable response VDO after a discovery Identity command with SOP' is being stored and also added a console command which print the information on the console according the cable revision. Since USB PD rev2.0, USB PD rev 3.0 for active cable and USB PD rev 3.0 for passive cable have different cable vdos, different decodings are added for each according to their respective specifications. BUG=b:129990370 BRANCH=none TEST=Verified on dragonegg, able to store the cable attributes. Change-Id: I59e60fe9c820d3d08138875092849345db603776 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1553898 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* usb_pd: Adding USB-C cable detectionAyushee2019-08-166-15/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a discover identity command is sent with a SOP prime packet, the cable plug of an emark cable responds with the cable attribute. Added a structure pd_cable that stores the cable type and and resetting it when the cable is disconnected. Also added console command that gives the type of cable connected. Host(DFP) Cable Port-Partner(UFP) -------------------------EXPLICIT CONTRACT------------------------ Discover Identity SOP -----------------------------> request | <------------------------- Discover Identity response Discover Identity SOP' ---------> request | (If Emark Cable) <------------ Discover Identity SOP' | response Store cable type | (If Non-Emark Cable) <-------------- No response | Discover SVID SOP request ------------------------------------> (Rest of the PD flow) BUG=b:129990370 BRANCH=none TEST=Verified on dragonegg, able to get cable response Change-Id: I2536cf24d58f7ee5ff462b34fc32f69d7a200d41 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1707851 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* strago: Disable console commands to save spaceVijay Hiremath2019-08-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Strago is running out of space for additional changes in the common code hence disabled CONFIG_CMD_ACCELSPOOF console command to save space. Before: section `.data' will not fit in region `FLASH' No room left in the flash region `FLASH' overflowed by 52 bytes After: 204 bytes in flash and 1836 bytes in RAM still available on strago RO 592 bytes in flash and 1836 bytes in RAM still available on strago RW BUG=none BRANCH=none TEST=make buildall -j Change-Id: I208f6929518136e462ba79b74ea147f11516d6f2 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1753693 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* hammer: Add magnemite boardNicolas Boichat2019-08-167-1/+36
| | | | | | | | | | | | | | | A close hammer derivative. BRANCH=none BUG=b:138968914 TEST=make BOARD=magnemite -j Flash into staff, see the board boot: util/flash_ec --board=magnemite --port=9000 Change-Id: Ibe5c3f4b0fb4a31d4667d5dc4d76a691b0e64e39 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741599 Reviewed-by: Yilun Lin <yllin@chromium.org>
* acpi: Notify AP when setting DPTF profile numberPhilip Chen2019-08-161-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Assuming a device without hall sensor is switched from clamshell mode all the way to 360-degree-flipped mode, the event sequence is like: (a) When the device hits 200-degree, it switches to tablet mode. (b) We notify AP to re-read DPTF profile from ACPI. (c) When the device hits 300-degree, it switches to 360-degree flipped mode and updates DPTF profile in EC space. Since the DPTF profile is switched in (c) while AP re-reads the DPTF profile in (b), AP wouldn't update DPTF profile for 360-degree-flipped mode. To fix this issue, let's notify AP when updating DPTF profile. BUG=b:139168228 BRANCH=none TEST=manually test on Nautilus/Hatch and confirm trip temperature is updated in flipped-360-degree mode Change-Id: I3bc61fb3d7808bf17f7da7ebc606307fbbf026fc Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1747166 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* util: make flash_ec tolerant with dummy npcx_uut chipNamyoon Woo2019-08-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | flash_ec fails when npcx_uut chip in a bad status doesn't respond at all, especially upon ec_flash_size query. This patch subpress the exit on ec_flash_size query failure, because that information is not mandatory in flashing EC. BUG=none BRANCH=none TEST=manualy tested on kohaku. 1. programmed kohaku EC with a wrong binary. 2. checked kohaku EC in a bad status, and was not able to respond. 3. ran flash_ec and checked flash_ec finished EC FW program. e.g. flash_ec --board kohaku --image ${IMG} 4. read EC firmware back. e.g. flash_ec --board kohaku --read ${TMP_IMG} Change-Id: Ic853dd9f827217621cd598c799c68fbbf970078a Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1753009 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* tglrvp_ite: Add TGL-U/Y RVP base codeDaniel Gonzalez2019-08-1513-17/+514
| | | | | | | | | | | | | | | | | | | | | | Added TGL-U/Y RVP base code using ITE EC. Following features are enabled. 1. TCPC + retimer 2. Charger 3. Battery 4. Power sequencing 5. Host communication 6. LED 7. Keyboard BUG=b:138597987 BRANCH=none TEST=Both TGLRVP U&Y can boot to ChromeOS Change-Id: Idf6be38796c26b31be6e13485a63ec13487bf954 Signed-off-by: Daniel Gonzalez <daniel.d.gonzalez@intel.com> Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1726943 Reviewed-by: Keith Short <keithshort@chromium.org>
* test: Update TEST_EQ to using string format specifierYuval Peress2019-08-152-166/+166
| | | | | | | | | | | BRANCH=None BUG=None TEST=builds and all tests pass Change-Id: Idbb288d8f422b4c01fe27c989bdf1188df509a27 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1752204 Reviewed-by: Jett Rink <jettrink@chromium.org>