summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* spi: Pass in spi_device as argument to spi_enable instead of portTom Hughes2021-01-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | Rather than passing in the port and iterating over the global spi_devices variable, pass in the specific spi_device that is being enabled/disabled. The spi_device_t struct has the port. This change makes the functions in spi.h more consistent since they now all take a spi_device_t*. This change is the first step in making the SPI configuration more dynamic. BRANCH=none BUG=b:177908650 TEST=git grep 'spi_enable(CONFIG' => no results TEST=make buildall TEST=Flash dragonclaw v0.2 and view console to verify FP sensor ID Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I64124e0ebcf898e88496acb77703b5f59ae931c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654081 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* common: Add attribute to store const data in .dataKeith Short2021-01-271-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On EC chips that support CONFIG_CHIP_DATA_IN_INIT_ROM, the code execution RAM is smaller than flash, leaving some flash unused. The CONFIG_CHIP_DATA_IN_INIT_ROM moves the .data section into the unused flash area, where it is copied directly into data RAM at startup. Add a new attribute __const_data that allows constant data objects to link into the .data section instead of .rodata. This saves 1600 bytes of RO and RW flash space on boards that enable CONFIG_CHIP_DATA_IN_INIT_ROM. delbin_npcx796fc eldrid_npcx796fc halvor lindar lingcod magolor_legacy malefor metaknight_legacy terrador todor trondo voema volteer_apmodeentry volteer waddledoo BUG=none BRANCH=none TEST=make buildall TEST=boot Volteer and verify USB-PD operation Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ibb97a499442bbab8185b1d07f8867a7af1e793f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2651208 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* math_util: fix incorrect int_sqrtf implementationTing Shen2021-01-271-0/+5
| | | | | | | | | | | | | | | | | | | | | Correct the binary search interval for small x. The range should be at least [0, sqrt(2 ** 31)] ~= [0, 46341]. Also fixed some corner cases and added unit test for it. BUG=b:177384512 TEST=1)`watch -n 0.3 ectool motionsense lid_angle` verify the angle looks reasonable. 2) TEST_LIST_HOST=fp make runhosttests BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I394fe3a59ac51ec4491a24399848f179c1074b95 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2646041 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Yilin Yang (kerker) <kerker@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* zephyr: add MKBP supportHyungwoo Yang2021-01-261-0/+6
| | | | | | | | | | | | | | Add MKBP support to zephyr. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I9b7d979241b0df5dc0fa5d9741f05dc9875189ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639854 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Wait for tSrcTransition after AcceptAbe Levkoy2021-01-261-0/+1
| | | | | | | | | | | | | | | | | During power contract negotiation, after sending Accept, wait for tSrcTransition before transitioning the supply and sending PS_RDY. See PD r3.0, v2.0, Table 7-22. BUG=b:173023378 TEST=Pass TDA.2.1.2.2 using MQP compliance tester (or at least don't fail due to sending PS_RDY too early). BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I76e31ff5df6bfd71f78642bda25e1e8f9f590f9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2644179 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: JC Huang <j.c.huang@quanta.corp-partner.google.com>
* usb_mux: Send missed disconnect mode in S3/S0ixMadhusudanarao Amara2021-01-261-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the Type-C devices are connected in S0 and when DUT enters S3/S0ix, if the type-C devices are disconnected and re-connected, Kernel won't receive the disconnected state from EC once DUT boots to S0 as EC moves on and updates the new connected state to Kernel Mux driver. This leads to failure of Type-C device detection on resuming to S0 from S3/S0iX. To overcome this scenario, adding an explicit condition to send previous disconnect state to Kernel Mux driver once initial mux request is received upon resuming from S3/S0iX. Missing Disconnect mode Patch Details: Set disconnect latch flag for the init and disconnect requests For AP to EC PD command: EC_CMD_USB_PD_CONTROL -Check disconnect latch flag if it is true set pd.enabled = 0 For AP to EC mux command: EC_CMD_USB_PD_MUX_INFO -Check the disconnect latch flag if it is true then send disconnect mode -Reset the disconnect latch flag -Send host event EC_HOST_EVENT_USB_MUX for configuring the virtual mux with the latest Mux configuration BUG=b:176604380 BRANCH=None TEST=Type C devices in s0ix disconnect/connect or swapping across the ports scenarios tested Change-Id: Ic38d3632cb0fadb29393405e13ed3606a740c81e Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2632551 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* config: Ensure VBUS measurement consistencyAbe Levkoy2021-01-221-0/+4
| | | | | | | | | | | | | | | Fail to build a board that defines CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT when it uses a charger that can measure VBUS. BUG=b:178102402 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Icc0712c38908646d1b550a4056aa10e29787e5a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2642893 Reviewed-by: Diana Z <dzigterman@chromium.org>
* zephyr: add motion sense supportHyungwoo Yang2021-01-221-3/+4
| | | | | | | | | | | | | | | | | | | Add support for motion sense in zephyr. This change adds basic functions for motion sense task to do meaningful work. sensor_map.h included by board.h will be used to get board specific sensor configuration. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I906316d2e97428cf46b9a15071666c8e3b039b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638909 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test_util: improve EC compatibilityPaul Fagerburg2021-01-221-1/+3
| | | | | | | | | | | | | | | | | | | | | | When building a unit test that compiles for either EC or Ztest, the TEST_MAIN macro should call test_reset and test_print_results as part of running the tests. This allows the test code to omit the functions (which are not defined when building for Ztest). Also add the format parameter so that when testing for floating-point values being near (zassert_within or TEST_NEAR) we can specify the format for the EC assertion to print the result. BUG=b:172240633 BRANCH=None TEST=`make runhosttests` and `zmake testall` Signed-off-by: Paul Fagerburg <pfagerburg@google.com> Change-Id: I23dc933ed4ba0f386fcae68d257161ffffe226eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645197 Tested-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
* TCPMv1/TCPMv2: Add functions providing requested voltage and currentPatryk Duda2021-01-221-0/+14
| | | | | | | | | | | | | | | | | This patch adds functions responsible for providing voltage and current requested from charger. This patch doesn't introduce any logical changes. BUG=b:161775827 BRANCH=none TEST=make -j buildall Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ib86285e4c4e6f2da3f922a8a4389e78706f1de96 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592497 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* config: Provide default VCONN Swap delayAbe Levkoy2021-01-221-2/+3
| | | | | | | | | | | | | | | | | Almost every relevant board copy-pastes 5000 us. Make that the default and get rid of the redundant definitions. This is the approximate result of this command: find . -type f -name *.h | xargs sed -i -E \ '/#define CONFIG_USBC_VCONN_SWAP_DELAY_US[[:space:]]+5000[[:space:]]/d' BUG=b:144165680 TEST=make buildall BRANCH=none Change-Id: Ife86f9752971abcd7ab5ad5a5e607eb2ccbde2ba Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628132 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* config: Make VCONN Swap delay a documented optionAbe Levkoy2021-01-221-0/+6
| | | | | | | | | | | | | | | | | | | | | Replace PD_VCONN_SWAP_DELAY with CONFIG_USBC_VCONN_SWAP_DELAY_US. This is the approximate result of the following command, run from platform/ec: find . -type f -\( -name '*.c' -o -name '*.h' -\) | \ xargs sed -iE 's/PD_VCONN_SWAP_DELAY/CONFIG_USBC_VCONN_SWAP_DELAY/g' Fix some latent formatting errors in usb_pd_protocol.c, because they were preventing pre-upload hooks from passing. BUG=b:144165680 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Icaf3b309c08fdcd162e960cf5dc88185016b5d2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628131 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* No init.rom section support in ZephyrHyungwoo Yang2021-01-222-0/+20
| | | | | | | | | | | | | | | | | Building zephyr generates a warning on init.rom section. This change removes init.rom section declaration in Zephyr build. The change also added third_party into include folders so files in third_party now can be included in Zephyr build. BUG=b:173508071 BRANCH=none TEST=make BOARD=volteer -j8 build volteer on zephyr Change-Id: Ic86866e41d87d83c00a06a207a352a25fe57054b Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2638135 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Support BIST Test ModeAbe Levkoy2021-01-223-0/+27
| | | | | | | | | | | | | | | | | | After the first BIST Test Data packet, enable BIST Test Mode if the TCPC supports it (currently just TCPCI). While in BIST Test Mode, mask ALERT.ReceivedSOP*MessageStatus. Unmask it when the test ends, due to Hard Reset or to detach. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=Complete TDA.2.1.2.2 BMC PHY RX INT REJ on volteer without running out of Rx buffer space or watchdog timeout (still fail though) BRANCH=firmware-volteer-13521.B-master Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I03bbc4cfacceebd0334aa814e11a16e09177a322 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2545667 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Test that PE ignores invalid BIST requestsAbe Levkoy2021-01-221-1/+8
| | | | | | | | | | | | | | | Send the PE BIST requests with inappropriate VBUS voltages or inappropriate BIST modes. Verify that the PE ignores them. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=run-usb_pe_drp passes BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I240ff6746debcf49934419940ab4f49b54e2b7e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639585 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* charge_manager: Create mockAbe Levkoy2021-01-221-0/+27
| | | | | | | | | | | | | | | Allow tests to use a mock charge_manager. Do not build the real charge manager when this is used. BUG=b:173023378,b:169385081,b:172709198,b:173028832,b:173028791 BUG=b:173141941,b:173142113 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I49caccafd024515833880d7251092b77623d4a71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639584 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Ignore BIST messages when appropriateAbe Levkoy2021-01-221-0/+1
| | | | | | | | | | | | | | Ignore BIST messages when not operating at vSafe5V. Ignore unsupported BIST modes. BUG=b:169385081 TEST=make buildall BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ia7504cf0f7cf16273aa641edb364eef7e666a3ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2602720 Reviewed-by: Diana Z <dzigterman@chromium.org>
* charge_manager: Expose get_vbus_voltage functionAbe Levkoy2021-01-221-0/+8
| | | | | | | | | | | | | Allow other modules to get the current VBUS voltage. BUG=b:169385081 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I1c4a22fff0d7e44ef47c2d8a3ff6e25e1a6ded1e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639583 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: TD.PD.SRC.E5 Compliance failure - service event loop as high priorityDenis Brockus2021-01-211-0/+7
| | | | | | | | | | | | | | | | | | | | Increased the event loop while waiting for the response in PE_SRC_Send_Capabilities in order to respond with the HardReset in the correct window of time. BUG=b:173025780 BRANCH=zork TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Ia108b3d4d4f18b76da6550f406011d1ee79c2757 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639663 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* OCPC: Init VSYS to VBAT when starting chargeAseda Aboagye2021-01-212-0/+14
| | | | | | | | | | | | | | | | | | In order to prevent high current spikes when the OCPC PID loop runs, this commit sets the initial VSYS voltage to that of the battery. BUG=b:175334490 BRANCH=dedede TEST=Build and flash DUT. Using a Type-C breakout board and a current probe, plug in charger to sub board, verify that no initial current spike exceeds that of the contract. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Idb6e7d2e51acd0c5279bbb055b75774c6dab6901 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2628573 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* include: Fix typos in gpio.wrap.Tom Hughes2021-01-211-2/+2
| | | | | | | | | | | BRANCH=none BUG=none TEST=none Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ie996435f1da99e766fb25ccad6ea27f78f5acd65 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2641128 Reviewed-by: Craig Hesling <hesling@chromium.org>
* common:test: refactor test_util.h to accommodate ZephyrYuval Peress2021-01-212-4/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change refactors test functionality in test_util.h to better accomomdate zTests. This is done by: * Removing the shim version of test_util.h. This was causing a conflict that made it harder to tell what's being used. This involved migrating some needed code over: - Defining different TASK_PARAMS. - Defining test_pass for Zephyr tests. * Creating a macro (DECLARE_EC_TEST) that will automatically handle creating the individual test functions for both platform and Zephyr tests. * Creating a macro (TEST_MAIN) that will automatically handle creating the main test entry function. This use to be test_main(void) for Zephyr and run_test(int, char**) for platform/ec. To do this we'll be removing the int, char** arguments from platform/ec. This may result in some tests having to be refactored, but overall should improve the test codebase as tests should remain deterministic (i.e. not depend on any outside arguments/parameters). * Creating some common ztest_ function/macros that will allow writing platform/ec tests in a zephyr like style. see test/base32.c for an example. * Update the type of __shared_mem_buf to match Zephyr. This was causing an issue now with the full test_util.h in zephyr/test/system/. BRANCH=none BUG=b:168032590 TEST=make runhosttests TEST=zmake configure --test -B build/host/base32 zephyr/test/base32 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I72173a3e94c7df09a2966e7ffeb9f5668d030f29 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2634401 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* TCPMv2: Do not check for SinkTxOk in FRS-ModeEric Herrmann2021-01-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | After an FRS signal, the initial sink will attempt to initiate the FR Swap AMS, and the initial source should apply SinkTxOk. If the initial source is removed entirely, FRS will be triggered butSinkTxOk will never be applied and this will get the initial sink state machine stuck. So, in the case of an FRS ignore the CC voltage. After an FRS signal, the source isn't allowed to initiate an AMS. BUG=b:171740860 TEST=On Volteer with the PS8815, enable FRS and remove the FRS device. Make sure we enter ErrorRecovery instead of hanging in PE_PRS_SNK_SRC_Send_Swap TEST=make buildall BRANCH=none Change-Id: I8373a76c0c19feeb909b0623a1ae2d6b0ad5fa60 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633654 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: TCPMv2 Send message with timed response should hard reset within rangeDenis Brockus2021-01-201-0/+14
| | | | | | | | | | | | | | | | | | | | PE_SRC_Send_Capabilities is supposed to wait for 24ms before sending HardReset but that reset must be sent before 30ms. Setting the delay to 30ms will guarantee we never are within this range and will always be after it. TD.PD.SRC.E5 is guaranteed to fail with this set to 30ms BUG=b:177999668 BRANCH=zork TEST=make run-usb_tcpmv2_compliance Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I8d743680b62e5dea840c935f06eb987c8358e473 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2640228 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* Zephyr: Create public headers for bmi260, bma2x2, and tcs3400Hyungwoo Yang2021-01-204-0/+184
| | | | | | | | | | | | | | | Separate out the public part of sensor headers so it can be included from Zephyr. BUG=b:175434113 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I899e9aea99d6c7d56a1b6735538b280fe0735313 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637251 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* usb_mux: add a full TUSB1064 driverNathan K2021-01-202-0/+4
| | | | | | | | | | | | | | | | | | | | | The TUSB1064 driver code is modified to implement a real usb_mux driver. This part is a UFP side (RX Equalizer) USB-C switch contrary to most other usb_mux part we have (used in the DFP). It is used in the servo_v4p1. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=b:168621142 BRANCH=servo TEST=use the sink mode enabled by 'cc pdsnk', connect to a USB-C Chromebook try both video output on USB-C->mini-DP and USB 3.0. Change-Id: Ie15d246ba7b6601db0d387e8ffda54f0ec36ba99 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2416764 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* zephyr: Shim the DECLARE_HOST_COMMANDWealian Liao2021-01-191-1/+15
| | | | | | | | | | | | | | | | | | | | Shim the DECLARE_HOST_COMMAND so that host commands can be declared and found. BUG=b:177065174, b:172678200 BRANCH=none TEST=build & boot EC for Volteer 0x0d & 0xa4 don't have error message. 21-01-11 16:42:09.226 [1.528500 HC 0x0d] 21-01-11 16:42:09.227 [1.532100 HC 0xa4] Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ief3b5768715dcc164bcb25ae0d1c8de749514f92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2620729 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* config: update USB PID database linkCaveh Jalali2021-01-151-1/+1
| | | | | | | | | | | | | | this updates the link for allocating a USB PID at google. the original link was either wrong or repurposed. BRANCH=none BUG=none TEST=none Change-Id: I5908fc4a60c2c663e4a71d2693cafa6dc5f6cb06 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631328 Reviewed-by: Keith Short <keithshort@chromium.org>
* chipset/alderlake: add intel alderlake supportCaveh Jalali2021-01-151-1/+4
| | | | | | | | | | | | | | | | | this adds alderlake as a new chipset type. at this point it maps to the icelake chipset, much like tigerlake maps to icelake. BRANCH=none BUG=b:173575131 TEST=buildall succeeds Change-Id: I394a506b4c001279927597f0c36c75e410316f23 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631345 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Poornima Tom <poornima.tom@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* gl3590: Add CLI for managing USB hubJan Dabros2021-01-151-0/+1
| | | | | | | | | | | | | | | | | | | | | Initially `gl3590` command allows only for enabling/disabling downstream facing ports. BUG=177295270 BRANCH=main TEST=On servo_v4p1 verify that ports power may be enabled/disabled via gl3590 command. In order to disable USB3.0 port on top (A0): gl3590 disable 0x2 In order to enable USB3.0 port at the bottom (A1): gl3590 enable 0x1 In order to disable uServo port: gl3590 disable 0x8 Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: Id9f82454fc9309e56c76215bce7058de776a806d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2624471 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Refactor CONFIG_FLASH_SIZE to CONFIG_FLASH_SIZE_BYTESYuval Peress2021-01-154-5/+5
| | | | | | | | | | | | | | | | | | | | | In Zephyr CONFIG_FLASH_SIZE is a Kconfig value that is used throughout. The issue is that the units don't match. In Zephyr the value is in KiB instead of bytes. This refactor simply renames CONFIG_FLASH_SIZE in platform/ec to include the unit (via _BYTES). BRANCH=none BUG=b:174873770 TEST=make buildall be generated by the build instead of per board Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I44bf3c7a20fcf62aaa9ae15715be78db4210f384 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2627638 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* gl3590: Add method for querying UFP connection power capabilitiesJan Dabros2021-01-141-0/+25
| | | | | | | | | | | | | | | | | | GL3590's registers allow to gather information about host connection, e.g. available power. This may be used by platforms which are powered by hub's UFP. Add missing license headers. BUG=b:144776402 BRANCH=main TEST=With consecutive patch applied, verify that available input power reported by servo_v4p1 is correct. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I6a9881fe844b293800653f141c418257c6ebc4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606237 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ps8815: delete CONFIG_USB_PD_TCPM_PS8815_FORCE_DIDKeith Short2021-01-131-6/+0
| | | | | | | | | | | | | | | | Delete config option CONFIG_USB_PD_TCPM_PS8815_FORCE_DID as it is no longer required. All PS8815 devices ship with firmware version 0xE or later. The BCD Device identifier was fixed in PS8815 A1 revision 7 firmware. BUG=b:159289062, b:177251013 BRANCH=none TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I604ab00b92931425f197a00c53109d7b072f45a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2625800 Reviewed-by: caveh jalali <caveh@chromium.org>
* Export more symbols from ps8xxxSimon Glass2021-01-121-0/+21
| | | | | | | | | | | | | | | | | | | It turns out we need more symbols for some drivers. For example, PS8XXX_RESET_DELAY_MS is needed by most boards, including volteer. Export some more things. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Id82eaaa0a1e4a7c66ae0fd1fb7c781f1fc1de1d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615622 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* elan_private: Implement elan sensor driverChiehchun Yu2021-01-121-0/+2
| | | | | | | | | | | | | | | | | | This patch provides ELAN FP APIs that used to control ELAN FP sensor and matching algorithm. BRANCH=None BUG=None TEST=We build on nami_fp, and testing Elan sensor with libelan_515.a and libelan_80.a successfully. Change-Id: I7a58025106f8ed570860b758323bf2047cde0731 Signed-off-by: Chiehchun Yu <chiehchun.yu@elan.corp-partner.google.com> Signed-off-by: herman lin <herman.lin@emc.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2002994 Reviewed-by: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org> Commit-Queue: Yicheng Li <yichengli@chromium.org>
* TCPMv1: Replace charging allow listTing Shen2021-01-121-11/+0
| | | | | | | | | | | | | | | | This CL backports CL:2535217 to TCPMv1, and completely removes charging allow list. BRANCH=kukui BUG=b:175364716 TEST=on Burnet, verify DUT can charge from power bank. Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I89476c89fd4ab6d46acf880f7573b5deb8b2c0f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603614 Reviewed-by: Diana Z <dzigterman@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* COIL: Remove non-inclusive words from commentsDossym Nurmukhanov2021-01-121-2/+2
| | | | | | | | | | | BUG=none BRANCH=none TEST=none Signed-off-by: dossym@chromium.org Change-Id: I4ae57e939c10e826b58bed4b6fbe575d73a244a9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622069 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* COIL: Remove non-inclusive words from Bluetooth codeDossym Nurmukhanov2021-01-121-1/+1
| | | | | | | | | | | BUG=none BRANCH=none TEST=build hadoken Signed-off-by: dossym@chromium.org Change-Id: I9a453bcdf14b3a6823bad23824aaee77a7013a81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622066 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* npcx/system: LCT compensate for MTC in PSL_hibernateWealian Liao2021-01-122-0/+12
| | | | | | | | | | | | | | | | | | | | | NPCX chip uses the MTC module as the RTC counter. However, in PSL hibernate, MTC will stop counting. NPCX9 supports the LCT module which could count continuously when VCC1 power is off. The CL uses LCT to compensate for the MTC counter value after PSL hibernate wake-up. The LCT maximum counting value is 16 weeks. BRANCH=none BUG=b:165777478, b:171919875 TEST=pass "make buildall" TEST=Check the RTC value in the following scenario: 1. "hibernate" and wake up EC by PSL input. 2. "hibernate 30" and wake up EC after timeout. 3. "hibernate 30" and wake up EC by PSL input before timeout. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I39e370a437f40749acbd3a35a8b37ebec70f1bf2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2506864 Reviewed-by: Keith Short <keithshort@chromium.org>
* COIL: Rename EC-EC comm defines to be more inclusiveDossym Nurmukhanov2021-01-122-3/+3
| | | | | | | | | | | | BUG=none BRANCH=none TEST=Build and run on a device Signed-off-by: dossym@chromium.org Change-Id: I48d1ec4be528ac3c39f81740016f11d7eca3c740 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2619070 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Nicolas Boichat <drinkcat@chromium.org>
* guybrush: Implement bc12_interruptRob Barnes2021-01-111-0/+1
| | | | | | | | | | | | | | | Implement bc12_interrupt stub. Add task.h to usb_charge.h to fix build error. BUG=None BRANCH=None TEST=Build Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I7d3d14326cf6973b131a6f575eb305039772df04 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611518 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Create a public header for bb_retimerSimon Glass2021-01-091-0/+41
| | | | | | | | | | | | | | | | Add a separate public header for this driver so we can include it from Zephyr. Update the charger file to use that header, so it builds on Zephyr. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I4613649b8cdca1f45c22922e4d1aa71460ea5382 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615623 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* volteer: Separate out some baseboard USB-C config codeSimon Glass2021-01-091-0/+3
| | | | | | | | | | | | | | | | | | These three functions are needed by the charger task and are currently not compiled on Zephyr. Move them out into their own file so that they can be. Update the isl9241 interface slightly to add a needed define. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr Change-Id: Ia28c406c865003d8aec1c31add590bfdef57601d Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617038 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Create a public header for pi3usb9201Simon Glass2021-01-091-0/+28
| | | | | | | | | | | | | | | | | Add a separate public header for this chip so we can include it from Zephyr. Update Volteer's usbc_config file to use that header, so it builds on Zephyr. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I45bb196a3c6de9bebefd3d06125d1cedd33666a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2615619 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tcpmv2: always issue SOP' soft resetKeith Short2021-01-091-20/+21
| | | | | | | | | | | | | | | | | | | After entering a PD contract, always issue an SOP' soft reset before sending any discovery VDMs to the cable. BUG=b:172364575 BRANCH=volteer TEST=connect monitor with emarked cable, verify SOP' soft reset is sent when EC starts as SNK/DFP. TEST=Connect monitor with non-emark cable. Verify SOP' soft reset is sent once regardless of starting role. TEST=Connect USB4 dock, verify USB4 entry. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Id5026a2c8c9877b860e1356dd33763bad3e51841 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2596838 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Compliance Unit Test - TD.PD.SRC3.E7Denis Brockus2021-01-071-0/+14
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: Iaa6888d2e0d861d64b2747856465789304dde414 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2613724 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* version: Rename version.h to cros_version.hYuval Peress2021-01-071-0/+0
| | | | | | | | | | | | | | | This change simply moves the include/version.h file over to avoid a naming collision with zephyr's version.h. BRANCH=none BUG=b:167392037 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib41b3c21817d5f81e713d3b550bc46a0d1c55cf8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2612772 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* BB retimer: Set UFP mode of BB retimerAyushee2021-01-072-0/+29
| | | | | | | | | | | | | | | | | | | | | This CL enables getting the enter mode information received from DFP and sets the following BB retimer bits accordingly. Bit 2: RE_TIMER_DRIVER Bit 18: CABLE_TYPE Bit 19: VPRO_DOCK_DETECTED Bit 20: TBT_ACTIVE_LINK_TRAINING Bit 22: ACTIVE/PASSIVE Bits 27-25: TBT Cable speed Bits 29-28: TBT_GEN_SUPPORT BUG=b:157163664 BRANCH=None TEST=Tested with volteer as UFP, able to set the retimer bits Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I661aa4630b42fbaa136ff3855c4f70e3dee61546 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2382634 Reviewed-by: Keith Short <keithshort@chromium.org>
* Move tcpic.h header into include/driverSimon Glass2021-01-071-0/+288
| | | | | | | | | | | | | | | | | | This header cannot currently be accessed by Zephyr since it is in a driver directory, not an include directory. This header has quite a bit of public stuff in it, so it seems reasonable to consider everything public. Move the header file and update all users. BUG=b:175434113 BRANCH=none TEST=make buildall -j30 build volteer on zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ibba37f47a06783fafb5095f853f2a68d92b6df87 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2607745
* Create a public header for isl9241Simon Glass2021-01-071-0/+38
| | | | | | | | | | | | | | | | | Add a separate public header for this chip so we can include it from Zephyr. Update the charger file to use that header, so it builds on Zephyr. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 With a zephyr-chrome CL, build volteer on zephyr Change-Id: I562177e2259931730b7dae4d8e43edd5ea96deb7 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>