summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* host: remove leftovers from using system clock in testsJack Rosenthal2019-10-253-23/+0
| | | | | | | | | | | | | | There was some leftover constants and a #include we are no longer using due to using a monotonic counter, clean it up. BUG=chromium:1013701 BRANCH=none TEST=buildall Change-Id: Ieeb130aef9ee89d65459f52c8f34753c30c3c388 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1879335 Reviewed-by: Edward Hill <ecgh@chromium.org>
* driver: lis2dw12/lis2dwl: fix wrong __fls usagePaul Ma2019-10-252-10/+24
| | | | | | | | | | | | | | | | | | | | | | | __fls(n) is defined as (31 - __builtin_clz(n)) in include/common.h. Because of the definition, n can't be 0. When n is 0, __fls(0) will be -1 and it is a wrong result. Since sensor data rate can be set lower than LIS2DW12_ODR_MIN_VAL, it is possible for __fls() to get a 0 parameter. This CL will fix this condition. Because macros are getting complex, move them to c file and convert to functions. BUG=b:143242489 BRANCH=none TEST=run 'suspend_stress_test --suspend_min=10 --wake_min=10 \ --count=2500' on DUTs, test pass and no EC crash. Change-Id: I46febb602b47624ba5d0106abaedd34a23ebe96f Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1876297 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* driver: g753: add driver supportLu Zhang2019-10-254-0/+247
| | | | | | | | | | | | | | | | g753 is used on akemi board. It's a temperature sensor, analog-to-digital converter, and digital over-temperature detector with SMBus interface. BUG=b:138426009, b:143046086 BRANCH=none TEST=use Akemi board, add g753 as temp sensor, boot the board and make sure temperature can be read from g753 Change-Id: Iefa1039628171170cf0ca322b462a29b33eb0df5 Signed-off-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1857978 Reviewed-by: Philip Chen <philipchen@chromium.org>
* util: Add optional gdbinit for EC debuggingCraig Hesling2019-10-241-0/+172
| | | | | | | | | | | | | | | | | | | This gdbinit sets up useful functions and initialization for EC debugging. BRANCH=none BUG=none TEST=ln -s util/gdbinit .gdbinit Tested debugging on stm32h743. TEST=make BOARD=nocturne_fp BOARD=nocturne_fp GDBSERVER=openocd GDBPORT=3333 gdb # Check that the right object files were added Change-Id: I0e15501832d4e65e8779aee2c0dc8ca170fa5f3c Signed-off-by: Craig Hesling <hesling@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1856380 Reviewed-by: Harry Cutts <hcutts@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cleanup: clean up reference to power role vs cable plugJett Rink2019-10-2410-46/+91
| | | | | | | | | | | | | | The PD header specifies the power role for SOP packets and cable plug for SOP' and SOP" packets. Refactor code to make this more obvious. BRANCH=none BUG=none TEST=builds and new stack runs on hatch Change-Id: I6cdb1561082d2142214ac65703ff42586b16d70b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865986 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* cr50: Add dummy U2F_ADPU vendor command.Louis Collard2019-10-241-0/+56
| | | | | | | | | | | | | | | | | | | | | | | This command is called by u2fd in M77 on startup, and if a success response is not returned, u2fd will not start up or send commands. We need to support M77 in newer cr50 versions, due to the enterprise rollback feature. cr50 has been updated to not require these commands to be sent, so the dummy command here does nothing other than return success. BUG=b:133275654 TEST=flash M77 and ToT cr50 with this change, check u2fd starts up and works BRANCH=none Signed-off-by: Louis Collard <louiscollard@chromium.org> Change-Id: Ie1576f582df6c3a076a8b9a3cbc7101fb05204b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869172 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* cr50: Remove concept of U2F modeLouis Collard2019-10-243-64/+1
| | | | | | | | | | | | | | | | | | This was previously used to enable/disable U2F or the extended mode. This was never used to disable U2F, and the distinction between U2F and extended mode is no longer required. BRANCH=none BUG=b:133275654 TEST=build, U2FTest, enable g2f mode in u2fd, check attestation certification does not change across multiple registrations Change-Id: I323fa245bf23fb12ffed75fb8dcfc81913bafff7 Signed-off-by: Louis Collard <louiscollard@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1786886 Reviewed-by: Andrey Pronin <apronin@chromium.org>
* jacuzzi: enable usb discharge gpioTing Shen2019-10-241-3/+1
| | | | | | | | | | | | | | | | USB_C0_DISCHARGE is implemented on board rev #1, we can add it to gpio.inc now. BUG=b:137939749 TEST=make BRANCH=master Change-Id: I4a5142594f90b902c455eaaada74a76f66c021de Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1844661 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* akemi: update Simplo battery informationPaul Ma2019-10-241-2/+2
| | | | | | | | | | | | | | | | Simplo updated L19M4PG2 battery specifications and its minimum voltage and precharge current changed. BUG=b:143162679 BRANCH=none TEST=boot akemi board with Simplo battery, charging/discharging/ cutoff work as expected. Change-Id: Iad3fbb2308d82a287eb6c1cc40a9786b148cb36f Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1875859 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* main: Initialize I2C pretty earlyAlexandru M Stan2019-10-2418-27/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices (like the keyboard, CBI) need I2C access pretty early. Until now I2C would get initialized pretty late in a hook, which was far too late for some stuff. As a result from this change, CONFIG_I2C_MASTER now implies the i2c_init() function will be called at board boot. Some chips (cr50, host tests) needed a stub i2c_init in order to compile cleanly. BUG=b/138384267 TEST=EFS doesn't happen significantly later than it used to TEST=Recovery keys now work with I2C keyboard on jacuzzi TEST=make buildall TEST=Sanity check i2c behavior (booting, "i2scan", "battery") on a variety of ECs: * ampton (ite EC, x86 AP) * bobba (npcx EC, x86 AP) * jacuzzi (stm32f0 EC, ARM AP) * cheza (npcx EC, ARM AP) BRANCH=master Change-Id: Ifa830e8e509ff16b36b4dcc86617869b1cb86ac3 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1772490 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* cleanup: use power and data role enums instead of intJett Rink2019-10-246-34/+39
| | | | | | | | | | | | | | | Use first class enums types instead of int for power and data role. BRANCH=none BUG=none TEST=builds and new stack works with single charger on C1 hatch Change-Id: Ied4562e6a148803140cf277bd229b6c3ed801470 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865985 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb: call pd_execute_data_swap within tc_set_dataJett Rink2019-10-244-78/+230
| | | | | | | | | | | | | | | | | | | | We need to let board specific code run any time we change the data role on our USB-C connection. When looking at all of the calls to tc_set_data_role, I realized that we don't really reset any data role until we start a new contract with SNK/SRC ready. We will do need to call into the code that disables the MUX lines when we detach. To do this, I created a super state for SNK/SRC unattached. BRANCH=none BUG=none TEST=builds. No board has an OTG signal using the new stack yet Change-Id: I017d20b2e1973b31ebf2b8925a7f8c5488a8ee24 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1864427
* volteer: Add GPIO_LOCKED to EC_RST_ODL PSL inputKeith Short2019-10-231-1/+6
| | | | | | | | | | | | | BUG=b:143089106 BRANCH=none TEST=make buildall Change-Id: I38b9331f6d0707dcd5b19823153549bd5806969f Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1876891 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* ish: cleanup unused irq defines for ish 5.0Leifu Zhao2019-10-231-4/+0
| | | | | | | | | | | | | | | | | | During code review for tgl rvp enablement, found some hpet timer related unused irq defines, so cleanup them. BUG=b:141519691 BRANCH=none TEST=successfully compile for arcada Signed-off-by: Leifu Zhao <leifu.zhao@intel.com> Change-Id: Ieb6872d6633be8c5e9f38a4642f874db4201403e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1871247 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org> Auto-Submit: Leifu Zhao <leifu.zhao@intel.corp-partner.google.com>
* tcpci: remove extra write when sending HARD_RSTJett Rink2019-10-231-0/+10
| | | | | | | | | | | | | Per the TCPCI spec, we don't need to try to write the header or byte count when sending a non SOP* packet. BRANCH=none BUG=none TEST=PS8751 can still send a hard reset Change-Id: I6cccbc52cf600f7930f0cbc3ac2aab578a81dc51 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1872603
* usb: fix out bounds issue for non-SOP* packetsJett Rink2019-10-232-27/+38
| | | | | | | | | | | | | Non SOP* packets (e.g. hard reset) do not have a message counter, so do not try to access the message counter field. BRANCH=none BUG=chromium:1016109 TEST=reproduced fuzz failure locally then verified fix with prints Change-Id: I2e46b43988cba92636eb9da7f86448b037fbc0a8 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1872602
* fingerprint: Restrict md and rw console commandsCraig Hesling2019-10-234-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL ultimately restricts access to the md and rw console commands when the system is locked, when system_is_locked(). It does this by enabling and configuring the restricted console command feature for nocturne_fp and hatch_fp. This sets up the framework for more console commands to use the restricted flag for fingerprint, but right now, only the md and rw commands use the restricted console command flag. The restricted flag for md and rw was introduced in crrev.com/c/1868430. BRANCH=nocturne BRANCH=hatch BUG=b:142559996, b:142505927 TEST=# Test on nocturne_fp make BOARD=nocturne_fp scp build/nocturne_fp/ec.bin dut1:~/ ssh dut1 flash_fp_mcu ./ec.bin # From FPMCU UART console version # Ensure that version is custom based on workstation help # Ensure that md and rw are not prefixed with "-" help list # Ensure that a "Flags" column exists and that # md and rw both have a 1 in the column. md 0x0 # Ensure that this successfully reads the word rw 0x24000000 # Ensure that this successfully reads the word syslock md 0x0 # Ensure that this fails with "Access Denied" rw 0x24000000 # Ensure that this fails with "Access Denied" help # Ensure that md and rw are now prefixed with "-" Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I1202a118b836ff2a2acc986f6f3b0f6e07b36894 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867388 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* mem_commands: Flag md and rw cmds as restrictedCraig Hesling2019-10-231-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This marks both the md and rw console commands as restricted. This alone does nothing, unless the specific board has enabled console flags, enabled restricted console commands, and provided an implementation for console_is_restricted(). The idea is to allow boards to deny access to these commands under some runtime condition, for example when system_is_locked(). Restricted console commands were introduced in crrev.com/c/376185/4. See crrev.com/c/1867388 as an example board usage. BRANCH=nocturne BRANCH=hatch BUG=b:142559996, b:142505927 TEST=# Test on nocturne_fp, since it has not enabled # console restricted commands, at this CL. # Note that this will not be the case in future CLs. make BOARD=nocturne_fp scp build/nocturne_fp/ec.bin dut1:~/ ssh dut1 flash_fp_mcu ./ec.bin # From FPMCU UART console version # Ensure that version is custom based on workstation syslock help # Ensure that md and rw are not prefixed with "-" help list # Ensure that no "Flags" column exists md 0x0 # Ensure that this successfully reads the word rw 0x24000000 # Ensure that this successfully reads the word TEST=A positive test case is done in crrev.com/c/1867388. Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: Ica6b1f24d9b89186ad0ff854bb6e0786392fd1df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868430 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* assert.h: clang-formatCaveh Jalali2019-10-231-11/+15
| | | | | | | | | | | | | | | this is just a minor cosmetic fix of assert.h courtesy of clang-format. BRANCH=none BUG=none TEST=make buildall passes Change-Id: Ic503c22f1d29e0511a3b5ecbf697c5940c93d18c Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1864424 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* mocks: add tcpc and usb mux mocksJett Rink2019-10-235-0/+260
| | | | | | | | | | | | BRANCH=none BUG=none TEST=use them in CL stack with tests Change-Id: I8a970dc65f7395264a8c536977951ae305e9c24f Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868831 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb: Remove invalid data role from enumJett Rink2019-10-233-6/+10
| | | | | | | | | | | | | | | | The data role as defined in the USB spec is 1 bit. Disconnected does not fit and no one is using it properly. All users of Disconnected value alias the value to DFP anyway. Just use DFP explicitly BRANCH=none BUG=none TEST=builds and runs new stack on hatch Change-Id: I5c7dddea8f34c8e3c524da8701913c87c23b42b2 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865984
* usb_mux: Add driver for AMD FP5 USB/DP MuxEdward Hill2019-10-237-4/+127
| | | | | | | | | | | BUG=b:138600585 BRANCH=none TEST=build Change-Id: I547309c7000e7d3ca8549a7e626a63789665305d Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868921 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* system.c: move jump_data declarations into sysjump.hCaveh Jalali2019-10-232-29/+47
| | | | | | | | | | | | | | | this moves the jump_data related declarations out of system.c into a dedicated sysjump_impl.h header file. this will make it possible to implement unit tests for sysjump. BRANCH=none BUG=b:142031466 TEST=make buildall passes Change-Id: I7df3d24e1f9c0f203656ee8dddc234b64e2dc8c3 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1855647 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Kodama: fix rotation matrix of lid sensorxiong.huang2019-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adjust the rotation matrix of lid sensor to ensure auto-rotate function works as expected. BUG=b:142562612 BRANCH=kukui TEST=1. Work well in UI when rotate DUT. 2. The values returned by the accelerometers must match the axes used by android or w3c: https://source.android.com/devices/sensors/sensor-types, https://www.w3.org/TR/accelerometer/#model device on table: in_accel_z_raw >> 0 (a very large positive value) e.g. X(65), Y(134), Z(8245) device on its default bottom edge: in_accel_y_raw >> 0 (a very large positive value) e.g. X(-17), Y(8141), Z(164) device on its default left edge: in_accel_x_raw >> 0 (a very large positive value) e.g. X(8107), Y(-79), Z(-174) Change-Id: Id570e3665e2c7165a0f43dccc988a157fa7eda29 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1871274 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org>
* common: add __test_only attributeJack Rosenthal2019-10-221-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | For functions which should only be used in test builds, this lets us add __test_only to the prototype, causing an error if used outside of tests. Example error output: test.c: In function ‘main’: test.c:17:5: error: call to ‘foo’ declared with attribute error: This function should only be used by tests foo(); ^~~~~ This will not cause errors if the usage is guarded by a disabled IS_ENABLED (or any other form of optimized-away branch). BUG=none BRANCH=none TEST=see above Change-Id: I64115fd9e7940de9b10063a46548e8d00033d1d3 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1872962 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* common: make __error discard symbols on clangJack Rosenthal2019-10-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | The clang compiler is used by the fuzz tests, and while clang does not have support for the error attribute in GCC, we can do our best to make sure that errors are raised on clang where appropriate by placing functions defined with __error in the special section "/DISCARD/", which the linker discards. An error like below is shown when compiling in clang: `foo' referenced in section `.text' of foo.o: defined in discarded section `/DISCARD/' of /tmp/foo.o BUG=none BRANCH=none TEST=see above error output when __error is used on clang Change-Id: Id58131578f67b9dff7e58e5df58b3509d6046138 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1874382 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Grunt: Add GPIO_LOCKED to EC_RST_ODL PSL inputEdward Hill2019-10-224-4/+4
| | | | | | | | | | | BRANCH=grunt BUG=b:143095616 TEST=GPIO is locked as input Change-Id: I36b123ed068db268d1cd02e990dd720663eaae57 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1873008 Reviewed-by: Keith Short <keithshort@chromium.org>
* pd3.0: change soft reset path for explicit contract or notDenis Brockus2019-10-221-5/+17
| | | | | | | | | | | | | | | | | | | | | Changes for PD 3.0 spec version 2.0 State machine for Source Port Soft Reset and Protocol Error, new section 8.3.3.4.1 changed entry requirements to go to state PE_SRC_Send_Soft_Reset and PE_SRC_Ready. State machine for Sink Port Soft Reset and Protocol Error, new section 8.3.3.4.2 changed entry requirements to go to state PE_SNK_Send_Soft_Reset and PE_SNK_Ready. BUG=b:141468157 BRANCH=none TEST=make buildall -j Change-Id: Ibda109fa15c0bcab34472498920bef06806e0880 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1863710 Reviewed-by: Jett Rink <jettrink@chromium.org>
* akemi: fix rotation matrix of base sensorLu Zhang2019-10-221-7/+2
| | | | | | | | | | | | | | | | | | The rotation matrix needs be filled out into standard reference frame. BUG=b:143045241 BRANCH=none TEST=Using ec console 'accelinfo on' verified lid angle now goes from 0 to 360 and swtiches to tablet mode after crossing 180 threshold. Change-Id: I615ac3c582f7deec681c638a79b59324c9b69584 Signed-off-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1871276 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* Kodama: folio case has no function but only works in VT2xiong.huang2019-10-222-7/+3
| | | | | | | | | | | | | | | | | | | When DUT starts up in S5/G3, HOOK_CHIPSET_STARTUP only called in RO stage. In fact, POGO ADC interrupt not be enabled after jumping to RW stage. Krane and Kodama board use POGO keyboard function. Moving common API to HOOK_INI (pogo_chipset_init) to ensure POGO ADC interrupt is enabled and API base_detect_deferred would be called after jumping to RW stage. BUG=b:142849032 BRANCH=kukui TEST=folio case works well in UI and VT2. Change-Id: Ie3fed9a88620414afeea2fa4dcbf2cd120e7ac37 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869170 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* dood: initial files commitben.chen2@quanta.corp-partner.google.com2019-10-227-0/+1019
| | | | | | | | | | | | | | | | | Initial files for dood are copied from bobba, to be revised later. BRANCH=octopus BUG=b:141960652 TEST=build Change-Id: Ie26c6dfd21f420a9d66902de39d2393b0cd95fb3 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868129 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Henry Sun <henrysun@google.com> Tested-by: Henry Sun <henrysun@google.com> Commit-Queue: Justin TerAvest <teravest@chromium.org>
* fluffy: Fix voltage conversion accuracyAseda Aboagye2019-10-211-3/+4
| | | | | | | | | | | | | | | | | | | | When converting the ADC reads into mV, I had used the wrong value which was leading to some errors that would grow with the voltage. This commit simply uses the right values and attempts to gain more accuracy by increasing the number of significant figures. BUG=b:140393065 BRANCH=None TEST=Flash fluffy; measure the VBUS voltage with a multimeter, verify that the fluffy reported value is now closer to the multimeter. Change-Id: I9dfd749eb533d96c8bc45454f968d7bcb095b9ef Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1871123 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Delay uart_init() done to after pinhold is disengaged.Pai Peng2019-10-211-4/+17
| | | | | | | | | | | | | | | | | | | | | Since pinhold will hold UART pin, UART won't work correctly. In this case, we want to delay uart_init() done until pinhold is disengaged. The messages to UART are still kept in the UART buffer and can be correctly printed through UART after pinhold is released. BUG=b:138327854 BRANCH=none TEST=manual Testing: verified that after cold or warm reset, messages from RW image can be correctly printed to UART. Without this change, we might see incomplete messages or garbage characters. Change-Id: I00934aa16178b995d996f6ba773abab80f329124 Signed-off-by: Pai Peng <paipeng@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1717547 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* stm32f0: handle i2c reload mode properlyTing Shen2019-10-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | Fixed a bug that RELOAD bit not cleared properly when there's two consecutive chip_i2c_xfer() calls, where the first call only contains "write" transaction, and the second call contains a "read" transaction. BUG=b:138095176 TEST=Case 1 - write and read in two separate i2c_xfer call: `ectool i2cxfer 1 0x55 8 0x64` On Krane, this should print the string "L16D2P31" in hex. Case 2 - no write and read 1 byte: `i2cscan` in ec console. BRANCH=kukui Change-Id: I57c1909058606b458801b3b35f54c16c1309c594 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866222 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* it83xx/flash: add support for KGD flashDino Li2019-10-214-14/+79
| | | | | | | | | | | | | | | Embedded flash of it8xxx2 is KGD, so we made this change to support it. BUG=b:133460224 BRANCH=none TEST=On both it83202 and it8320 EVBs, verify flasherase and flashwrite console commands. Change-Id: Idde0846eb8c59a330ccf69d7f6b7aa352c623caa Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1844657 Reviewed-by: Jett Rink <jettrink@chromium.org>
* dratini: chagne thermal configrationDevin Lu2019-10-211-8/+18
| | | | | | | | | | | | | | | | | | | | split thermal configration table for temp sensor 1/temp sensor 2, because sensor location is different, they have their own table. BUG=none BRANCH=none TEST=manually remove dptf control then do follwoing: make sure system shutdown when over 85 degree with temp sensor 1. make sure system shutdown when over 75 degree with temp sensor 2. make sure fan works when over 25 degree with temp sensor 1. make sure fan fully on when over 70 degree with temp sensor 1. make sure fan works when over 25 degree with temp sensor 2. make sure fan fully on when over 50 degree with temp sensor 2. Change-Id: I1139f9ee8a8ef9fc67c3ba6f5cbc2b6cf265ede9 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869171 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* dratini: disable accel, gyro sensors and tablet mode switch for clamshellsDevin Lu2019-10-212-2/+30
| | | | | | | | | | | | | | | | | | dratini and dragonair use the same PCB with BOM changes. Dratini uses a hall sensor instead of GMR, and does not stuff the accelerometer and gryo sensors. Disable initialization of those sensors on Dratini. Dratini is a clamshell that does not support tablet mode, so disable that, too. BUG=none BRANCH=none TEST=make buildall -j. make sure no initial event occurs with dratini. make sure tablet mode was disabled with dragonair. Change-Id: If65183f458d62f0b74e21233900d86102c4cc88d Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866220 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* dratini: enable GMR sensor for tablet modeDevin Lu2019-10-213-0/+4
| | | | | | | | | | | | BUG=none BRANCH=none TEST=Check screen rotation with tablet mode. Check keyboard disabled and on-screen keyboard enabled with tablet mode. Change-Id: Ifa3bcc24b19608fb52525208569e8fdde25e99ea Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866218 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* Reland "baseboard/kukui: use BASE_STATE_SWITCH instead"Yilun Lin2019-10-202-30/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of 92b3e86b23b59ebec3e59132cae2b32288fcf1b4, fixing up the call to base_init that does not exist anymore. Original change's description: > baseboard/kukui: use BASE_STATE_SWITCH instead > > tablet mode will also depend on BASE_ATTACHED_SWITCH. > > TEST=see EC sends BASE_ATTACHED event when keyboard attach/detach > BUG=b:140608847 > BRANCH=none > > Change-Id: Ib7d9bd0e8cf0efb5d0a3808f4649e0d9eb69b6d8 > Signed-off-by: Yilun Lin <yllin@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1806178 > Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> BRANCH=kukui BUG=b:140608847 BUG=b:141518464 TEST=see EC sends BASE_ATTACHED event when keyboard attach/detach Cq-Depend: chromium:1844514 Change-Id: I609c8ac958f7d344d73f28934e2b1187a8d11f22 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1844653 Tested-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* octopus: lock gpio config for reset signalJett Rink2019-10-198-8/+48
| | | | | | | | | | | | | BRANCH=octopus BUG=b:142953493 TEST=verify that later modification of gpio flag will no allow driving signal high. Change-Id: I0b8c1503ba8c03afa3eb6fa4f921b3480106f05b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869407 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* usbc: Add missing IS_ENABLED(CONFIG_CHARGE_MANAGER) checksEdward Hill2019-10-184-16/+7
| | | | | | | | | | | | | | | Remove the need for stubs of charge_manager_set_ceil() by adding a few missing IS_ENABLED(CONFIG_CHARGE_MANAGER) checks. BUG=none BRANCH=none TEST=buildall Change-Id: Ia70434b05107747eb773ae30ee1de5b4bd8cbcea Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869401 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* krane: set end of charge current threshold to 140mAstabilize-12607.6.Bstabilize-12607.5.Bstabilize-12607.3.BTing Shen2019-10-181-0/+14
| | | | | | | | | | | | | | | | According to the battery spec in b/142097561#comment15, EoC current should be 140mA. BUG=b:142097561 TEST=make BRANCH=kukui Change-Id: I913a1abecd2fc6ac28ba16513c3f0cc145afc38c Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866212 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* kukui: remove battery SoC overwrite hackTing Shen2019-10-181-1/+3
| | | | | | | | | | | | | | | | | On-pack battery gauges should have better knowledge about battery life, so maybe we can trust SoC value reported from gauge and don't need this hack. BUG=b:142097561 TEST=confirm battery SoC won't jump to 97% unexpectedly BRANCH=kukui Change-Id: Ie3efdcbfa6d6525040e68b5abe0345a4b6c1fcde Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866210 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* board/hammer: Fix masterball touchpad settingsNicolas Boichat2019-10-183-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Fix the dimensions, and also the size, and make sure that updating the FW actually works (it seems like increasing the timeout to 2000ms is needed). BRANCH=kukui BUG=b:140596094 TEST=Flash masterball, no warning in console on start TEST= Host: make TOUCHPAD_FW=S8648A-15H0_FW01.bin BOARD=masterball -j USE=updater_utils emerge-kukui -av ec-utils cros deploy $IP ec-utils DUT: usb_updater2 -d 18d1:503c -r; sleep 0.5; \ usb_updater2 -d 18d1:503c -s; usb_updater2 -d 18d1:503c ec.bin usb_updater2 -d 18d1:503c -p S8648A-15H0_FW01.bin Change-Id: Ia473ac420b42f52ad1639f950a3f08ff5d32df09 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1847512 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org>
* krane: Modify the Charging and Fully charged LED colorLeo Zhou2019-10-181-5/+4
| | | | | | | | | | | | | | | Based on the Lenovo requirement,modify the Charging and Fully charged LED color as white BUG=b:137618886 BRANCH=kukui TEST=Do a charge test Change-Id: I75a3e9f24c98a67cb6b9dda8294c73926c20d4d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1706248 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Tested-by: Leo Zhou <zhoubo@huaqin.corp-partner.google.com> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
* panic.h: include required stdint.hCaveh Jalali2019-10-181-2/+3
| | | | | | | | | | | | | | | | | panic.h uses types from stdint.h, so it should really include it by default. also, order standard header files ahead of project specific header files. BRANCH=none BUG=b:142031466 TEST=make buildall passes Change-Id: I8ac6d42f1da412bd3ce20df2838b8e420ad25e52 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1855643 Tested-by: Caveh Jalali <caveh@google.com> Commit-Queue: Caveh Jalali <caveh@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* helios: Modify EC fan control tableMichael5 Chen2019-10-181-12/+6
| | | | | | | | | | | | | | | | | | Modify EC fan control table by Thermal request. (#21) BUG=b:136565336 BRANCH=none TEST=Manual Verify fan behavior by thermal team. Remove DPTF and check fan speed with temperature. When temperature over 65 degree, the fan start working. When temperature over 85 degree, the fan full run. And check system shutdown when temperature over 90 degree. Change-Id: I0d4633e9ba93ba12f28d4d069a9ae2a7a82fcedd Signed-off-by: Michael5 Chen <michael5_chen@pegatroncorp.com> Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1833944
* dratini: correct accel orientationDevin Lu2019-10-181-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=When device is laying on a table, lid angle at 180, both sensors report gravity along Z axis: localhost ~ # ectool motionsense Motion sensing active Sensor 0: -1040 4336 15408 Sensor 1: 760 -291 17127 Sensor 2: 0 0 0 When on the base bottom edge, report gravity along Y axis: localhost ~ # ectool motionsense Motion sensing active Sensor 0: -960 14112 -5952 Sensor 1: 453 16136 -373 Sensor 2: 0 0 0 When on its left side, report gravity along X axis: localhost ~ # ectool motionsense Motion sensing active Sensor 0: 16352 -432 64 Sensor 1: 16802 -338 192 Sensor 2: 0 0 0 and check the screen rotation was normally. Change-Id: Idbe7184d5c14eb31d7823f9e17648d9bf3df4443 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866209 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* Cr50: In hash crypto test, return valid hash for empty input.Gurleen Grewal2019-10-172-2/+2
| | | | | | | | | | | | | | | | | | | | FIPS ACVP tests require that on an empty input, the result is the hash of the empty string. In the current implementation, an empty result is returned. Change the implementation so it matches FIPS expectations. Also added two test cases in hash crypto test to check the corner case of the empty input. BUG=None BRANCH=cr50 TEST=test/tpm_test/tpmtest.py Change-Id: I9f5c3f71e4b10cbce2ea204eeb52e57ef26ad0e7 Signed-off-by: Gurleen Grewal <gurleengrewal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866444 Reviewed-by: Andrey Pronin <apronin@chromium.org> Tested-by: Gurleen Grewal <gurleengrewal@google.com>
* fpsensor: Improve unit test for enable/disable positive match secretYicheng Li2019-10-171-11/+27
| | | | | | | | | | | | | | | Initialize the local struct so that the test is not flaky. Also extract helper function and add more asserts to make the logic more explicit to readers. BUG=none BRANCH=nocturne TEST=make -j buildall Change-Id: I84ccd097b64c3ff304f4af228121b2cb989e6ab7 Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1865956 Reviewed-by: Craig Hesling <hesling@chromium.org>