summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* util/ide-config: Add basic eclipse supportCraig Hesling2020-06-191-1/+121
| | | | | | | | | | | | | | | | * It can only generate for a single board-image at a time. * It generates an XML that is importable from an existing CDT project. See https://gn.googlesource.com/gn/+/master/docs/reference.md#eclipse-ide-support for a better description about what is generated. BRANCH=none BUG=none TEST=./util/ide-config.sh eclipse nocturne_fp:RW >nocturne_fp-rw.xml Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I891bce7fedf6cf10778618638f7bf5caffe57717 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2084413 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Zork: Change 3AXIS_INT_L to GPIO_PULL_DOWNEdward Hill2020-06-196-6/+6
| | | | | | | | | | | | | | | | 3AXIS_INT_L is unused (we use polling not interrupt for reading lid accel), and defaults to low, so change to GPIO_PULL_DOWN for a small power saving. BUG=b:157243373 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I7f5f3af692d0958237f9876ac9ad65fdd3696d1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2253059 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* dalboz: move HDMI HPD off the IO expanderPeter Marheine2020-06-192-9/+20
| | | | | | | | | | | | | | | | | On earlier board versions (prior to version 2) the hotplug detect signal was routed only through an IO expander, but latency in that configuration is too high- new hardware routes it directly to an EC GPIO. Because the old one was too slow, drop support for it and use the new direct IO exclusively. BUG=b:153399461 TEST=HPD passthrough works on new boards. BRANCH=None Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: If7a0cc8f57e8264a8910291879515de4eb1c338e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247968 Reviewed-by: Edward Hill <ecgh@chromium.org>
* TCPMv2: Add pathway to enable FRS from PPC driverEric Herrmann2020-06-1810-17/+91
| | | | | | | | | | | | | | | Some PPCs have integrated CC line detection to trigger FRS faster, but this needs to be enabled from the USBC policy engine only after the sink capabilities have been exchanged. BUG=b:148144711 TEST=make buildall BRANCH=none Change-Id: Iaa64f64845c5ffdd32fa66a3eb6f6251abb7c157 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2056493 Reviewed-by: Keith Short <keithshort@chromium.org>
* meep: enable 2nd ppc source syv682xDevin Lu2020-06-183-3/+55
| | | | | | | | | | | | | | | This patch adds 2nd ppc source syv682x base on ppc ID pin. BUG=b:156019835 BRANCH=octopus TEST=Verify system can be charged by typec charger. Verify typec dongle works. Verify c to HDMI dongle works. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I8b8452399340f36878cb5a14d11622f87f382f00 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247433 Reviewed-by: Marco Chen <marcochen@chromium.org>
* Dood: Add PPC syv682x configYu-An Chen2020-06-183-4/+54
| | | | | | | | | | | | | Supoprt PPC SYV682X on Dood. BUG=b:158054901 BRANCH=octopus TEST=make buildall Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Change-Id: Ibd60e0ab06204a6a369a19956a848aed1151d987 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2239598 Reviewed-by: Ren Kuo <ren.kuo@quanta.corp-partner.google.com> Reviewed-by: Marco Chen <marcochen@chromium.org>
* delbin: Initial EC imageMichael5 Chen2020-06-189-0/+1260
| | | | | | | | | | | | | | | | | | Create the initial EC image for the delbin variant by copying the volteer reference board EC files into a new directory named for the variant. (Auto-Generated by create_initial_ec_image.sh version 1.0.3). BUG=b:158797761 BRANCH=none TEST=make BOARD=delbin Signed-off-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I3f5ebc5e7c58748fdba443907fc185696a3fe024 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247969 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* Volteer: create new board target for TCPMv1Keith Short2020-06-183-8/+20
| | | | | | | | | | | | | | | | | | USB4 an Thunderbolt support is not complete in the TCPMv2 stack. Create a new board project called "volteer_tcpmv1" that can be used to continue developing USB4 and Thunderbolt support in the BIOS and kernel. BUG=b:145756626 BRANCH=none TEST=make buildall TEST=make BOARD=volteer, confirm image uses TCPMv2 stack TEST=make BOARD=volteer_tcpmv1, confirm image uses TCPMv1 stack Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I975f9c6af037dc344a0f4e4fb573a9400ca6bb49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2243317 Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* sc7180: Handle the exception cases of power onWai-Hong Tam2020-06-181-35/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the switchcap and PMIC functions return a success or error code. In the power on sequence, an error happening in the middle will make it skip the remaining steps, and then calls the power off sequence to restore back S5. The power off sequence don't care about any error and perform the entire procedure. BRANCH=None BUG=b:159101052 TEST=Manually trigger power on and power off. TEST=Forced to a switchcap error, it went back to S5. > gpioset DA9313_GPIO0 0 > power on Requesting power on > RTC: 0x5ed1d4a7 (1590809767.00 s) [7177.018477 power state 4 = G3->S5, in 0x0005] RTC: 0x5ed1d4a7 (1590809767.00 s) [7177.019409 power state 1 = S5, in 0x0005] [7177.019918 power on 4] RTC: 0x5ed1d4a7 (1590809767.00 s) [7177.021168 power state 5 = S5->S3, in 0x0005] [7177.021700 power button released in time] [7177.024143 set_system_power(1)] [7177.076708 SWITCHCAP NO POWER GOOD!] [7177.187407 set_system_power(0)] RTC: 0x5ed1d4a7 (1590809767.00 s) [7177.188564 power state 1 = S5, in 0x0005] Change-Id: Iaf2676d84513056b3a1deb4f4c554c607e588c37 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250668 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* sc7180: Move the hook notifications out of power_on and power_offWai-Hong Tam2020-06-181-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the functions power_on and power_off just contain the power rail control. Move the hook notifications out of them. So they can be reused in the follow-up change. Also move the battery level check out of the power_off. BRANCH=None BUG=b:153594300 TEST=Manually trigger power on and power off. TEST=For the low battery case, no misleading messages: > power on Requesting power on > RTC: 0x5ecf416f (1590641007.00 s) [14.208200 power state 4 = G3->S5, in 0x0005] RTC: 0x5ecf416f (1590641007.00 s) [14.211855 power state 1 = S5, in 0x0005] [14.213840 power on 4] RTC: 0x5ecf416f (1590641007.00 s) [14.214463 power state 5 = S5->S3, in 0x0005] [14.214898 power button released in time] [14.220408 Not enough power to boot (2 %, 0 mW)] [14.323917 Not enough power to boot (2 %, 0 mW)] [14.425590 Not enough power to boot (2 %, 0 mW)] [14.530575 Not enough power to boot (2 %, 0 mW)] [14.635587 Not enough power to boot (2 %, 0 mW)] [14.740618 Not enough power to boot (2 %, 0 mW)] [14.744386 Not enough power to boot (2 %, 0 mW)] RTC: 0x5ecf4170 (1590641008.00 s) [14.747297 power state 1 = S5, in 0x0005] Change-Id: Ic368b28ba045dfced7979deca545d2393d3453b7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250667 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* drawcia: change TCPC to ps8705 on USBC1 portDevin Lu2020-06-182-7/+7
| | | | | | | | | | | | | | Drawcia support ps8705 on sub-board, this patch chagnes TCPC to ps8705 to USBC1 port. BUG=b:159013131 BRANCH=none TEST=make -j buildall Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ie360d490078afafdd98fa85a9e6a7d07291ae933 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249645 Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver/tcpm: fix ps8705 definitionDevin Lu2020-06-181-1/+1
| | | | | | | | | | | BUG=b:158760026 BRANCH=none TEST=make -j buildall Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Iac79496b333c04b8a67225503b4d35060ddef2c1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249641 Reviewed-by: Diana Z <dzigterman@chromium.org>
* test: Make flash_write_protect a multistep testTom Hughes2020-06-182-13/+28
| | | | | | | | | | | | | | | | | | | Now that the scratchpad works on the STM32F412, we can make flash_write_protect a multistep test, so that no manual steps are required to run the test. BRANCH=none BUG=b:157059753 TEST=With dragonclaw v0.2 connected to Segger J-Trace and servo micro: dut-control -n bloonchipper fw_wp_en:on ./test/run_device_tests.py -t flash_write_protect => PASS Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Iedb4ad8d89db805fa1c6e65d8a0bcc767993f5d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2233198 Reviewed-by: Craig Hesling <hesling@chromium.org> Commit-Queue: Craig Hesling <hesling@chromium.org>
* TCPMv2: Consolidate code in SOP' Discover IdentityAbe Levkoy2020-06-181-100/+61
| | | | | | | | | | | | | | | | Remove code from pe_vdm_identity_request_cbl_run that is common to all discovery VDM requests. Save 191 bytes of flash on average (volteer RO: 192 bytes; RW: 164). BUG=b:158572770 TEST=Observe SOP' identity discovery for 2 cables BRANCH=none Change-Id: Ib949c42bb1cf99a28aa8c187e9a627390338904b Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250542 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Consolidate code in SOP Discover IdentityAbe Levkoy2020-06-181-73/+32
| | | | | | | | | | | | | | | | Remove code from pe_init_port_vdm_identity_request_run that is common to all discovery VDM requests. Save 212 bytes of flash on average (volteer RO: 192; volteer RW: 168). BUG=b:158572770 TEST=Observe SOP identity discovery for various devices BRANCH=none Change-Id: Icdfb2dc29112c3a6aa4073c36820794bd80627ab Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2246277 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Don't reset power supply on entries of CC_RD and CC_OPENWai-Hong Tam2020-06-181-21/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The power supply is given on the entries of the states Attached.SNK and UnorientedDebugAccessory.SRC. The power supply is reset on the exits of the states Attached.SNK and UnorientedDebugAccessory.SRC. In the entries of the super states CC_RD and CC_OPEN, resetting the power supply is unnecessary. This causes a side effort that wakes AP up right after entering S3, since it is a power change event. For the case that VBUS is sourced before reboot, call the tc_src_power_off(port) on init. Also skips the check of attached source states in tc_src_power_off(). This change also replaces the pd_set_power_supply_ready(port) to the tc_src_power_on(port). It helps readability as it is paired to the tc_src_power_off(port). BRANCH=None BUG=b:158701496 TEST=Tested sinking power from a 20V charger, sourcing power to a Type-C hub. Made AP transition to S3 and S5 and back for the above cases. Also tested power role swap. Change-Id: I97364aa7145f3c139aa5e99f916226bd3a05370f Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2243751 Reviewed-by: Jett Rink <jettrink@chromium.org>
* test: rename usb_prl to usb_prl_oldPaul Fagerburg2020-06-184-3/+3
| | | | | | | | | | | | | | | | | | In preparation for moving the usb_prl unit test from the simulation to mocks, rename the current test to _old. We will set up a new usb_prl test that uses mocks and move the tests over in a controlled fashion. BUG=b:158608129 BRANCH=None TEST=`TEST_LIST_HOST=usb_prl make runhosttests` works. Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I4639be16c64ca9b79b1c001518df81ca40cf1527 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250659 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* docs: Design doc for Detachable Base Verified BootTom Hughes2020-06-172-0/+436
| | | | | | | | | | | | | | | Original document: http://go/detachable-base-vboot Cleanup document: https://docs.google.com/document/d/1Gm2LXaoQeyo-eppss62sQdKkxd_qD2FdBPDOHQId3qI/ BRANCH=none BUG=b:145815809 TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ic27848f2a86234a8f757262ecaba784f19e0ba38 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249462 Commit-Queue: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* test/run_device_tests.py: Add utils unit testTom Hughes2020-06-171-3/+7
| | | | | | | | | | | | | | | Also allow specifying the timeout on a per-test basis. The utils unit test takes longer than the other tests to run. BRANCH=none BUG=b:155230812 TEST=With dragonclaw v0.2 connected to Segger J-Trace and servo micro: ./test/run_device_tests.py -t utils Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I3b7368a4e4178f8371fae1155cf7dc457578dad0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2248713 Reviewed-by: Yicheng Li <yichengli@chromium.org>
* stm32: Enable utils on-device unit test for fingerprint boardsYicheng Li2020-06-175-0/+5
| | | | | | | | | | | | | | | | BRANCH=none BUG=b:155230812, b:155235321 TEST=make -j BOARD={dartmonkey, bloonchipper, nucleo-dartmonkey, nucleo-f412zg, nucleo-h743zi} test-utils TEST=flash the utils test binary, then runtest on bloonchipper and nucleo-f412zg ==> Pass! Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: Ia45b494111f2a536876a5ca60fdc12c06f870e1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242356 Tested-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* test: Correct memset speed expectation for stm32f412Yicheng Li2020-06-171-6/+15
| | | | | | | | | | | | | | | | On STM32F4, the speed gain of memset is slightly above 2x. Set this expectation explicitly. BRANCH=none BUG=b:155230812 TEST=verified that test_memset passes on nucleo-f412zg Signed-off-by: Yicheng Li <yichengli@chromium.org> Change-Id: Icb9951732fb03296007ceeca5f83ac26f7e0e709 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242355 Tested-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Tom Hughes <tomhughes@chromium.org>
* PB: Clear AP_IDLE for recovery bootDaisuke Nojiri2020-06-171-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, if CONFIG_POWER_BUTTON_INIT_IDLE is defined, EC_RESET_FLAG_AP_IDLE is set when the system enters S5. This is for restoring the power state after power loss or blackout. This can cause a recovery boot to be blocked depending on the timing that the hardware resets the EC. This patch makes EC clear AP_IDLE flag when a manual recovery request is detected so that AP can be unconditionally booted in the recovery mode. BUG=b:158802935, b:37536389 BRANCH=none TEST=Shutdown DUT. Press power + recovery. DUT enters recovery mode. TEST=Shutdown DUT. Replug AC. DUT stays off. TEST=Boot DUT to OS. Replug AC. DUT boots back to OS. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Iec1fd51cb0fa49e088f3b2489c5e94c8a4777a9b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242664 Reviewed-by: Andrew McRae <amcrae@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* Puff: Update thermal config tableBen Chen2020-06-171-7/+7
| | | | | | | | | | | | | | Follow the thermal team test, modify parameter that max/min Fan rpm and thermal config table. BUG=b:159172924 BRANCH=none TEST=Thermal team verified thermal policy is expected. Change-Id: I9b1442c8c2591dea5e7fcbdcd106ca19a3a7f4ae Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2249650 Reviewed-by: Andrew McRae <amcrae@chromium.org>