summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tcpci: debug cleanupDenis Brockus2020-06-241-8/+43
| | | | | | | | | | | | | | | | | | | | | | | DEBUG_GET_CC was already present to output CC information on every get_cc call. This CL adds in spam reduction to not continue to output the values if they are the same as they were the last time they were output. DEBUG_ROLE_CTRL_UPDATES was added to output RoleControl register information every time it is written in the TCPCI code. BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ic6eeadce8813908f1b89e4b756e90e95b1f9ca01 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250093 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* tcpmv2: only enable AutoDischargeDisconnect when attachedDenis Brockus2020-06-246-343/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | Connecting a non-PD charger the DUT performs a TRY switch to become SRC. During this TRY path the AutoDischargeDisconnect had been enabled and the fact the non-PD charger will never allow Vbus to drop to Safe0V causes the fault. AutoDischargeDisconnect should only be enabled when there is a known stable attach and when this stops being the case the feature should return back to disabled. Verified on Trembyle NCT3807 platform BUG=b:158751942 BRANCH=none TEST=verify try does not fault on 5V charger Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I9ab507a1bbc5b84948620b6174f946f07befde90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250092 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* drawcia: enable USB-A power 5VDevin Lu2020-06-243-2/+11
| | | | | | | | | | | BUG=none BRANCH=none TEST=make sure USB-A port works. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ie22f7129932b26d2b47913c4a2e49450ded4d5c5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2260177 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Add RCH check to avoid RX packet dropsEric Herrmann2020-06-241-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | The chunked message RX state machine can take multiple cycles to process a PD message when the message is received while transmitting. If another message comes in during this, it can overwrite the current PD message since the RCH state machine is before the extended buffer to the PE. This CL checks to make sure the RCH state machine doesn't have a pending message before overwriting pdmsg. This issue only shows up when CONFIG_USB_PD_REV30 is set (since PD20 doesn't use chunked messages). It was seen during fast role swaps on multiple devices. A fast role swap will send an ACCEPT immediately followed by a PS_READY, and the ACCEPT was being dropped. BUG=b:148144711, b:159671235 TEST=make buildall TEST=with an FRS-capable device and host, make sure no packets are dropped in the swap. this is easy to see with PD debug level 2 BRANCH=none Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: Ib86fd25a70b42cc14457bcec4261cdb9734fad63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259332 Reviewed-by: Jett Rink <jettrink@chromium.org>
* volteer: re-enable CONFIG_CMD_KEYBOARDKeith Short2020-06-231-1/+0
| | | | | | | | | | | | | | | | | CONFIG_CMD_KEYBOARD is needed by the FAFT tests. With this change Volteer still has 944 bytes RO and 772 bytes RW free with the TCPMv2 stack. BUG=b:158572770, b:159521752, b:159058351 BRANCH=none TEST=make buildall -j Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ieb85542e4eced938e509547b23ce130d6fd4e7bb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2261294 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Jes Klinke <jbk@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* docs/fingerprint: Add instructions for toggling hardware write protectTom Hughes2020-06-231-0/+25
| | | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ibd8fa4a504798860acb85ae8fc4c4383ee55337e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2190821 Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Craig Hesling <hesling@chromium.org>
* stm32: Enable rsa and rsa3 on-device unit testsYicheng Li2020-06-236-0/+12
| | | | | | | | | | | | | | | | | | | | BRANCH=none BUG=b:155235321 TEST=make BOARD=nucleo-dartmonkey tests -j TEST=make BOARD=bloonchipper tests -j TEST=make BOARD=dartmonkey tests -j TEST=make BOARD=nucleo-f412zg tests -j TEST=make BOARD=nucleo-h743zi tests -j TEST=flash rsa unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa3 unit test binary to nucleo-f412zg, run test => pass TEST=flash rsa unit test binary to nucleo-h743zi, run test => pass TEST=flash rsa3 unit test binary to nucleo-h743zi, run test => pass Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: I2ebcf6f322f9c16aba65a3a627a0a83ca00d2a02 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2240516 Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* tcpci: add 16-bit TCPC I2C accessorsCaveh Jalali2020-06-232-13/+21
| | | | | | | | | | | | | | | | this extends the TCPC I2C access API to provide 16-bit accessors for vendor specific pages of a TCPC. some TCPCs, like the ps8xxx series define registers in pages beyond the TCPCI definition for vendor specific functions. BRANCH=none BUG=b:158857815 TEST=buildall -j succeeds Change-Id: I115ab305317a0816e625718676b2bedfaa39e70d Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254991 Reviewed-by: Keith Short <keithshort@chromium.org>
* include/chipset: Define dummy init_reset_log if no CHIPSET task.Nicolas Boichat2020-06-231-5/+7
| | | | | | | | | | | BRANCH=none BUG=b:159571683 TEST=make BOARD=krane -j tests Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Change-Id: I77212f0ff3215270c0e466f2220d64e267c18efb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256632 Reviewed-by: Jett Rink <jettrink@chromium.org>
* include/power: Add dummy power_get_state if no CHIPSET taskNicolas Boichat2020-06-231-0/+6
| | | | | | | | | | | BRANCH=none BUG=b:159571683 TEST=make BOARD=krane -j tests Change-Id: I0484bbb5b6dcb0703aace88be59248968a662bb5 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256631 Reviewed-by: Jett Rink <jettrink@chromium.org>
* asurada: enable config of CONFIG_IT83XX_RESET_PD_CONTRACT_IN_BRAMDino Li2020-06-231-0/+5
| | | | | | | | | | | | BUG=b:154670981 BRANCH=none TEST=Unplug type-c adapter, and plug it in: no soft reset occurred during negotiation. (no reboot continuously) Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: Ie18f9f9a75306242dc1cfa237521c82a4b44d0b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2259414 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* it83xx: add option to reset PD contract in power-on resetDino Li2020-06-232-0/+18
| | | | | | | | | | | | | | | | This CL allows to reset PD contract in power-on reset. It applies to situation of EC's VBAT won't go low when system's power isn't presented. BUG=b:154670981 BRANCH=none TEST=PD contract gets cleared when power-on reset even VBAT keeps high Change-Id: I2c8d185725542bb77fadfe6cb0497e0aace8aee2 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2208343 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Puff: Only reset TCPC on power-on restartAndrew McRae2020-06-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset the TCPC after a power-on restart, and clear any explicit PD contract so that the previous state is not restored. Even though Puff does not have BBRAM, the state is required for restarts so that PD can determine when power needs to be renegotiated explicitly through sending a soft reset, or not since the system is starting from a fresh connection. The impact was that a system powered from a type-C charger would not go into recovery since a restart assumed it was an initial charger connection (so no soft reset was sent), the wait for capabilities timed out, and a hard reset was sent, causing the charger to cycle power, and thereby skipping the recovery stage. BUG=b:159281839 TEST=Confirm that recovery can be entered using type-C charger. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ibecf75e999ae5ff15580ce69c3a58a3c49930b48 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251706 Tested-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org>
* TCPMv2: Do not reset negotiated PD revision level during soft resetPatryk Duda2020-06-234-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | PD3.0 6.2.1.1.5 Specification Revision clearly states that negotiated Specification Revision level should be used until Detach, Hard Reset or Error Recovery happens. Current implementation of soft reset performs full reinitialization of PRL state machines, flags, counters including negotiated Specification Revision level. As a result when sending PD_CTRL_SOFT_RESET DUT was waiting for SinkTxOk, but it was never observed because ServoV4 was running PD2.0 stack. This issue was fixed by separating parts of SM_INIT state which shouldn't be reset during soft reset. BUG=b:158996004 BRANCH=none TEST=Flash nocturne with firmware which contains fix. Make sure ServoV4 runs PD2.0 revision. Run firmware_PDResetSoft test, make sure that hard reset doesn't occur. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I852817a63772dbc8baab74ff6b0c425228b2f49b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2246020 Reviewed-by: Jett Rink <jettrink@chromium.org>
* fuzz: Fix varargs/printf with MSANEdward Hill2020-06-231-0/+6
| | | | | | | | | | | | | | | | | | Remove our implementations of memcpy/memset/memmove for MSAN and ASAN since they are intercepted by the sanitizers. This was breaking varargs, causing va_arg() to return 0, which was most obvious in printf() with MSAN enabled. BUG=chromium:963303 BRANCH=none TEST=make -j host-host_command_fuzz TEST_MSAN=1 Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Id65d88b79bbb1834babe62c90078ec92a6aa5fba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2220160 Reviewed-by: Evgenii Stepanov <eugenis@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
* common: add CONFIG_POWER_SIGNAL_RUNTIME_CONFIGZick Wei2020-06-232-0/+7
| | | | | | | | | | | | | | This patch add config: CONFIG_POWER_SUGNAL_RUNTIME_CONFIG to allow board modified power signal gpio if needed. BUG=b:150278507, b:152841287 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I5c885f9cb3400f3354a18b6d497340dfe3ad993b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256624 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Puff: Implement power monitoring and controlAndrew McRae2020-06-234-234/+296
| | | | | | | | | | | | | | | | Monitor the power usage and if necessary apply throttles to reduce power demand. go//puff-power-distro BUG=b:151252619 TEST=Reduce power margin and check that throttling occurs. BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: Ib385cbf561795be0b424cf6a9a15c976e20d8b80 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2224677 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
* npcx: Add a new flag to check for initial power-onAndrew McRae2020-06-238-32/+81
| | | | | | | | | | | | | | | | | | | | | The CR50 will reset the EC on some platforms after power-on. Add a reset flag to detect this and treat the second restart as a power-on restart rather than reset. Subsume the CONFIG_GPIO_INIT_POWER_ON_DELAY_MS config to make it clear what the behaviour will be. BUG=b:151329011 TEST=Confirm on dalboz, puff & variants that second reset is treated correctly. BRANCH=none Change-Id: Ib66de920403f08099b87d1eff797270606b44f8f Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255830 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Andrew McRae <amcrae@chromium.org> Tested-by: Andrew McRae <amcrae@chromium.org>
* Lazor: Modify LED behavior.Sue2020-06-232-64/+53
| | | | | | | | | | | | | | | | | | | | | | LED behavior: Charging | Amber on (S0/S3/S5) Full Charged | Blue on (S0/S3/S5) Discharging S3 | Amber on 1 sec, off 3 sec Discharging S5 | off Error | Amber on 1 sec, off 1 sec Discharging S0 | Blue on Factory mode | Blue on 2 sec, Amber on 2 sec BUG=b:158226994 BRANCH=none TEST=make buildall -j; check led behavior in every state on Lazor Change-Id: Ie654c64f8bb6bb6e364edc1b61009f97638e8f1a Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2235233 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Tested-by: Alexandru M Stan <amstan@chromium.org> Commit-Queue: Alexandru M Stan <amstan@chromium.org>
* usb_prl: new unit test with mocksPaul Fagerburg2020-06-2314-0/+356
| | | | | | | | | | | | | | | | | Now that the old usb_prl unit test is under usb_prl_old, add a new unit test for usb_prl with mocks for the various subsystems that it will use. BUG=b:158608129 BRANCH=None TEST=`TEST_LIST_HOST="usb_prl_old usb_prl" make runhosttests` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: Ie1bf9a4494cd933473caa4ceb594eddd97c277c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2252662 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* octopus: Enable TCPMv2Patryk Duda2020-06-231-1/+5
| | | | | | | | | | | | | | | | | | This patch enables TCPMv2 on octopus boards. Please note that due to bug in PS8751 (see b/148554997 for details) only PD2.0 specification level is enabled. BUG=none BRANCH=none TEST=Flash board from octopus family. Make sure that TCPMv2 is running. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9aabcbcd274964e4206e1d82324782dcf67793a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250685 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* baseboard/octopus: Use PD port count obtained dynamicallyPatryk Duda2020-06-231-5/+7
| | | | | | | | | | | | | | | | | | | | Some boards from octopus family have only one USB-C port. Performing any operation on inexistent ports will always result in failure. BUG=b:154602760 BRANCH=none TEST=Flash casta board. Make sure that EC RW doesn't report: "Disabling C1 as sink failed" or "C1: sink path disable failed." Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ifc1da701bd862a74d1d434c3839511d5340c2fce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250684 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_pd_tcpc: Don't process tcpc_run() when port is not availablePatryk Duda2020-06-231-0/+4
| | | | | | | | | | | | | | | | | Function tcpc_run() is responsible for receiving, transmitting messages but also for sampling CC lines. Running this for inexistent ports doesn't make any sense. BUG=b:154602760 BRANCH=none TEST=make buildall -j Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I8fe11719e35a1c99f307ebb9d581c3531d79177a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250683 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Do not call ppc_init() on unavailable USB-C portsPatryk Duda2020-06-231-1/+2
| | | | | | | | | | | | | | | | | | Do not try to initialize PPC on USB-C ports which are not available in board BUG=b:154602760 BRANCH=none TEST=make buildall -j TEST=Flash casta board. Make sure that EC RW doesn't report PPC init failures on port 1 Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ifc931055f1e90b9dc4ae8593d6d8ffa9880ca3f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250682 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_mux: Add check if port is available in every exposed functionPatryk Duda2020-06-231-0/+20
| | | | | | | | | | | | BUG=b:154602760 BRANCH=none TEST=make buildall -j Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9a5097ed6746c917cb88a8e6bf5e98fa01267808 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250681 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* flash_ec: remove verify-whole option for npcx_(int_)spiNamyoon Woo2020-06-231-11/+0
| | | | | | | | | | | | | | | | | | | This patch removes the verification of the whole firmware area for npcx_spi and npcx_int_spi chip. The reason is flash_ec programs WP_RO and EC_RW area only so it should verify partially on those area only, not the whole area. The option "--fast-verify" already was used for that purpose in flash_ec script. BUG=b:158864362 BRANCH=none TEST=ran flash_ec on nami. Signed-off-by: Namyoon Woo <namyoon@google.com> Change-Id: If08194697e1b15b13c592be94d5268359edd6b5a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254739 Tested-by: Namyoon Woo <namyoon@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Namyoon Woo <namyoon@chromium.org>
* servo_v4p1: Add CCD measurement functionalitySam Hurst2020-06-225-8/+157
| | | | | | | | | | | | | | The CCD measurement functionality is only available in RO. BRANCH=none BUG=b:146793000 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I4bf9885a8a76c8d9dbb688a72673726fb0a7efa5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2216402 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* drawcia: remove board version 0 unused codeDevin Lu2020-06-222-16/+4
| | | | | | | | | | | | BUG=none BRANCH=none TEST=make -j buildall Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ief6645b4103fd91a3441f2bcec3dd6fe13e25eb4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255827 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* TCPMv2: Do not initialize port which is not availablePatryk Duda2020-06-221-0/+9
| | | | | | | | | | | | | | | | If port doesn't exist there is no reason to initialize anything. Go directly to Disabled state and set flags to disable PE and PRL state machines too. BUG=b:154602760 BRANCH=none TEST=Flash casta. EC RW should report port 1 transition to Disabled state Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I4d90324842363a5b714ee2e2953edffb30c6009f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250680 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Avoid deadlock when calling pd_set_suspend()Patryk Duda2020-06-221-0/+8
| | | | | | | | | | | | | | | | | | Calling pd_set_suspend() from PD task we are going to suspend results in deadlock, because pd_set_suspend() waits until it reaches Disabled state. This fix adds early return after setting appropriate flags when task we are going to disable is running task BUG=none BRANCH=none TEST=make buildall -j Change-Id: I295677908db8a24215b010e47dbb56e586bbb041 Signed-off-by: Patryk Duda <pdk@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250679 Reviewed-by: Diana Z <dzigterman@chromium.org>
* common/charge_state_v2: Use CONFIG_USB_PD_PREFER_MV to guard functionsNicolas Boichat2020-06-221-1/+2
| | | | | | | | | | | | | | | | Guarding them for TEST_BUILD is not correct, as the functions may still be needed for board tests. Without this, make BOARD=kukui tests fails. BRANCH=none BUG=b:159571683 TEST=make BOARD=krane -j tests Change-Id: Ib1be0ac55c15e610ff6cd13d746442c5b0e645ad Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2256630 Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
* dedede: npcx7: Toggle ADC interrupts to save powerAseda Aboagye2020-06-211-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to save EC power and allow deep sleep to be entered, this change disables the ADC interrupts after booting up into S0, and then enables them when the system is attempting to power on. (Via power button or lid open or something else). BUG=b:157887329 BRANCH=None TEST=Build and flash waddledoo. Boot DUT, verify it can boot to S0. Enter `apshutdown` command on the EC console, verify that DUT shuts down. Verify that 15s later all power signals indicate low. Press power button, verify DUT boots up again. Repeat shutdown but initiated from the AP, verify power button can boot DUT again. Repeat shutdown and verify that a lid open can wake the DUT. TEST=Verify that suspend and resume continue to work. Verify that ADC interrupts remain disabled in suspend. TEST=Setup an RTC wake and shutdown to S5. Verify that AP wakes up after RTC alarm and boots all the way back up. TEST=Verify that power consumption is reduced when ADC interrupts are disabled. Change-Id: Ib9f6c30533afe8f354d731bb0f30ea207b44c601 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2233847 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
* morphius: update gpio's for board version 3Zick Wei2020-06-202-20/+42
| | | | | | | | | | | BUG=none BRANCH=b:150278507 TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I362e4797e3c59098c2b1b56277ba4771774409e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251136 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* tusb422: Ensure auto discharge disconnect disabledKeith Short2020-06-201-1/+17
| | | | | | | | | | | | | | | | | | | | The TUSB422 requires auto discharge disconnect to be enabled when in active mode (defined as not unattached). Make sure auto discharge disconnect is disabled prior to enable of DRP toggling as required by the USB Port Controller Specification. BUG=b:159160125 BRANCH=none TEST=make buildall TEST=On Volteer CC line toggling when unattached and verify connection of SNK devices. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I583085dae2547026e64c2b6162912b85805f0137 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2255329 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* Battery: Implement smart discharge systemDaisuke Nojiri2020-06-203-0/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, CrOS EC chooses only one of the two powre-saving states when the system is left idle. One is to hibernate and the other is to cut off the battery. And these are determined at compile time. If the system hibernates, EC will not have a chance to cut off the battery before the state of charge reaches critical low. If the system is in cutoff, it requires an AC adapter to wake up. So, neither behavior is ideal. This patch introduces the smart discharge system. Given the number of hours to zero capacity as a target, it tries to choose the better state for idling. For example, if the state of charge is high, it will hibernate the system because the target can be met before the battery completely drains. If the state of charge is low, it will keep the EC up so that it can cutoff the battery. Tests are done on Bloog as follows: Verify EC selects not to hibernate when the remaining capacity is below the stay-up threshold. The ectool smartdischarge command is tested as follows: localhost ~ # ectool smartdischarge Hours to zero capacity: 0 h Stay-up threshold: 0 mAh Cutoff threshold: 0 mAh Hibernate discharge rate: 0 uA Cutoff discharge rate: 0 uA localhost ~ # ectool smartdischarge 2160 Hours to zero capacity: 2160 h Stay-up threshold: 0 mAh Cutoff threshold: 0 mAh Hibernate discharge rate: 0 uA Cutoff discharge rate: 0 uA localhost ~ # ectool smartdischarge 2160 200 1500 EC result 3 (INVALID_PARAM) localhost ~ # ectool smartdischarge 2160 1500 200 Hours to zero capacity: 2160 h Stay-up threshold: 3240 mAh Cutoff threshold: 432 mAh Hibernate discharge rate: 1500 uA Cutoff discharge rate: 200 uA localhost ~ # ectool smartdischarge 2160 1500 0 EC result 3 (INVALID_PARAM) localhost ~ # ectool smartdischarge 0 Hours to zero capacity: 0 h Stay-up threshold: 0 mAh Cutoff threshold: 0 mAh Hibernate discharge rate: 1500 uA Cutoff discharge rate: 200 uA Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:152431365, b:157602162 BRANCH=none TEST=See above Change-Id: I1470b13203f3653ae0e495cd5ec8ed05f3c5102f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2216392 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* Zork: Don't KB_SCAN_DISABLE_LID_ANGLE in S0Edward Hill2020-06-201-2/+17
| | | | | | | | | | | | | | Keep keyboard scan enabled in tablet mode if the AP is in S0, so AP can decide whether to ignore input devices or not. BUG=b:159456704 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I7e71e2b8d593732315caa73cf585e5d20e5eb9a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254981 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Nami: Remove dev_keyDaisuke Nojiri2020-06-191-39/+0
| | | | | | | | | | | | | | | | | | | Nami does not use RW signature (RWSIG) but it has dev_key.pem. This is causing flash_ec to fail because flash_ec writes only 224 KB of RW but reads the entire RW region for verification. dev_key was copied when Nami was forked from Fizz. This patch removes dev_key.pem. BUG=b:158864362 BRANCH=none TEST=build BOARD=nami Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: If3a890d15550bcdd1a514863df0dd5c084471c7a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2254542 Reviewed-by: Namyoon Woo <namyoon@chromium.org>
* boten: reconfigure GPIOsxiong.huang2020-06-193-24/+9
| | | | | | | | | | | | | | | Remove GPF4, GPF5, GPC7, GPF1, GPL2. Configure GPL6 and GPE6, which control MB and DB USB-A power supply. GPE0 and GPE7 are used for DB HDMI. BUG=b:157626290, b:158658777 BRANCH=none TEST=make buildall -j Signed-off-by: xiong.huang <xiong.huang@bitland.corp-partner.google.com> Change-Id: Idb04e9d93d30c4ff8792dc92e92888a771bd02ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2245588 Reviewed-by: Diana Z <dzigterman@chromium.org>
* baseboard/kukui: Do not consider FET states in battery presence checkIkjoon Jang2020-06-193-78/+3
| | | | | | | | | | | | | | | | | | | | | | When Juniper is powered up with fully drained LGC battery, its FET states indicates battery is disconnected even it's still i2c responsive. In MT8183 platform, !battery_is_presence() isn't blocking power on, this function does not need to return BP_NO when battery is i2c responsive but DFET state is off. This patch fixes the problem of sbs-battery probe fail from host side when a device is powered up from external power source with fully drained battery reporting DFET state is off. BUG=b:153710351 TEST=none BRANCH=none Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Change-Id: I67b750b7586fcad149c65e88e73dcbd872ca76bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247972 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* delbin: Modify GPIO table and remove ALS sensor dependent on schematic.Michael5 Chen2020-06-194-136/+5
| | | | | | | | | | | | | | | 1. Modity GPIO table. 2. Remove ALS sensor. BUG=b:158797761 BRANCH=master TEST=make buildall Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: Idcedfe73784807256f04bbf40ef71cc9c44a150d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247971 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* morphius: add ppc aoz1380Zick Wei2020-06-195-3/+64
| | | | | | | | | | | | | This patch add ppc aoz1380 on daughter board. BUG=b:156552519, b:159282505 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I5ca87a2d524ee265626e5b163754a33dcb31853d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251127 Reviewed-by: Edward Hill <ecgh@chromium.org>
* morphius: Add HDMI_POWER_EN_DB to NCT3807Zick Wei2020-06-192-0/+7
| | | | | | | | | | | | | | The HDMI_POWER_EN_DB signal is set to power HDMI power rail. BUG=b:150278507 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ib2b79083f4518aacef31550432cb23fbf822a6b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251703 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* morphius: remove mst/hdmi hpd functionZick Wei2020-06-192-57/+0
| | | | | | | | | | | | | | This patch remove mst/hdmi hpd function due to schematic change. BUG=b:150278507 BRANCH=none TEST=make buildall Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I8e61f850cc8861b20756213460c91f86d0d8bf6d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2251702 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* npcx: Fix taskinfo runtime profilingEdward Hill2020-06-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Add missing call to task_start_irq_handler() for watchdog timer interrupt ITIM16_INT(ITIM_WDG_NO). This was missing because the watchdog does its own custom IRQ_HANDLER() instead of using DECLARE_IRQ() like everyone else. When task_start_irq_handler wasn't called, exc_start_time wasn't updated, which causes trouble because svc_handler() assumes exc_start_time has been updated to be greater than exc_end_time: /* * Bill the current task for time between the end of the last interrupt * and the start of this one. */ current->runtime += (exc_start_time - exc_end_time); BUG=chromium:1096716 BRANCH=none TEST=taskinfo command shows reasonable task runtimes Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I35794644054f01feac2e7823b7dc0da9ed6bf7d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2253064 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* boten: remove unused I2Cxiong.huang2020-06-192-4/+5
| | | | | | | | | | | | | Remove I2C4. BUG=b:157626290, b:158658777 BRANCH=none TEST=make buildall -j Signed-off-by: xiong.huang <xiong.huang@bitland.corp-partner.google.com> Change-Id: Id1af7591e2bfcc39175470b93c27df257a5dff1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2245577 Reviewed-by: Diana Z <dzigterman@chromium.org>
* SM5803: Add SM5803A 3S initsDiana Z2020-06-192-0/+48
| | | | | | | | | | | | | Adds recommended inits from vendor for 3S batteries on new silicon. BRANCH=None BUG=b:155218826 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I52f4809376d1705fc06eb2cf8d8d42a4a4b97b63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247394 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* nct3807: use tcpci version of enable_drpDenis Brockus2020-06-191-22/+1
| | | | | | | | | | | | | | | | | With the latest spec, it makes more sense to go back to the default implementation of enable_drp BUG=none BRANCH=none TEST=verify basic USB-C on trembyle Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I5d63fa94ab832feb2063e13f46ed4be0a2bc44e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250091 Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* tcpci: DRP enable should set role based on versionDenis Brockus2020-06-191-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | TCPCI R1 wants both CC lines to be Rd on entry to auto toggle TCPCI R2 wants both CC lines to be Rp on entry to auto toggle Both suggest setting the Rp Value to 0 for the smallest power usage when toggling Verified on Trembyle NCT3807 TCPC which is TCPCI R2 BUG=none BRANCH=none TEST=verify basic USB-C Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I5bc0d88c62bc47f78a622f3846839f7d2be97c6b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250090 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Consolidate debug steady states into attached statesDiana Z2020-06-191-410/+99
| | | | | | | | | | | | | | | | | | | | | | | | | Nearly all of the behavior needed in the debug accessory steady states is also covered in Attached.SRC and Attached.SNK. Consolidate those states in order to save flash space and ensure we don't have untested code paths sitting around the TC (saves an average of 883 bytes of flash). This change is mostly functionally equivalent, except it: - removes super states from debug states so swap controls setting Rd/Rp - checks trySrc overrides when leaving attached.snk BRANCH=None BUG=b:158466320 TEST=on waddledoo, verify: -Suzy-Q connection goes into debug sink, sets bbram flag for debug -servo_v4 connection goes into debug source, sets bbram flag for debug -data role swap with v4 succeeds -power role swap with v4 succeeds Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I2ea135b186db23dc970d77b7753131193b6c7571 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2244019 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Rename discovery flagsAbe Levkoy2020-06-193-23/+19
| | | | | | | | | | | | | | | | | | PE_FLAGS_DISCOVER_PORT_IDENTITY_DONE has been used to indicate that DisplayPort configuration is done for some time. PE_FLAGS_DISCOVER_PORT_CONTINUE is now only used to resume non-discovery VDM requests. Maybe the way they are used should change. For now, rename them to reflect their current use; this should make subsequent changes easier to understand. BUG=b:155890173,b:158813138 TEST=make buildall BRANCH=none Change-Id: Icbb6a44412b1b901ed160da58d4fbe016348bc2b Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250921 Reviewed-by: Diana Z <dzigterman@chromium.org>