summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* ps8818: fix redriver configurationDenis Brockus2020-01-311-0/+9
| | | | | | | | | | | | | | | | | | | in driver Added software IN_HPD control Added compile time optional debug in board specific tune function in usb_retimer Added gain control Added DP lane control BUG=b:146394157 BRANCH=none TEST=verify USB-C1 DP and USB connections Change-Id: Ida0cc243413b8fa469d3edb706040535e4a3f0e0 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2031645 Reviewed-by: Jett Rink <jettrink@chromium.org>
* driver: bmi160: Fix rounding error in set_offset() and get_offset()Ching-Kang Yen2020-01-311-0/+5
| | | | | | | | | | | | | | | | | | | | | The original set_offset() and get_offset() codes in the driver/accelgyro_bmi160 use simple divisions to write the data. The more times the set_offset() and get_offset() is used, the data will get closer to 0. Fixing it by replacing simple division to round_divide(), division that round to nearest, in the common/math_util.c. BRANCH=octopus BUG=b:146823505 TEST=Testing on octopus:ampton on branch [firmware-octopus-11297.B]. Checking the data did not rounding to 0. Change-Id: Ide9df9e32fc501e63d6f952cb8254df7662afd23 Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2002998 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
* jinlon: add dual fan control by ecDevin Lu2020-01-313-0/+8
| | | | | | | | | | | | | | | | This patch allows the ec to manage two fans. Currently common/thermal.c cannot monitor more than 1 fan at the same time. This CL implements a board-specific thermal policy with multiple fans. BUG=b:141259174 BRANCH=hatch TEST=thermal team verified thermal policy is expected. Change-Id: I6ababcb0795408e8062b7605bc749e23b8bde45a Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1936077 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* usb_pd TCPMv1: Maintain independent MessageID for SOP PrimeAyushee2020-01-311-0/+22
| | | | | | | | | | | | | | | | | | | This patchset enables storage of MessageId counter received from the cable plug. Since SOP*(Cable) communication and SOP(Port Partner) have separate MessageID counters, it is necessary to store separate messageIDs to avoid the the incoming packets from getting dropped. BUG=b:148481858 BRANCH=None TEST=Tested on Volteer, able to maintain separate MessageId count for SOP and SOP' communication. Change-Id: Iac2dc616f99a9e19914588e59441df8b09068afa Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2026650 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1: Add support for USB4.0Ayushee Shah2020-01-314-19/+205
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 is based on the Thunderbolt 3 protocol specification. It supports 40 Gbit/s throughput, is compatible with Thunderbolt 3, and backwards compatible with USB 3.2, USB 2.0. USB4.0 PD Flow: Ref: USB Type-C Cable and Connector Specification 2.0 Figure 5-1 USB4 Discovery and Entry Flow Model USB PD Explicit Contract Discover ID SOP -------- USB4 compatible? | -------------yes------------|------No----- Exit USB4 Discovery | Discover ID SOP' --------- Product type | Passive cable----------|----Active Cable---USB4? | | | (Not implemented in this CL) USB Signaling ----------------------- | | | | USB4 with USB4 active cable Exit USB4 | Discovery --------------------------------------------- | | | | USB4 Gen3 USB3.2 Gen2 USB3.2 Gen1 USB2.0 | | | | Enter USB4 with | Enter USB4 with Exit USB4 Discovery USB4 Gen3 | USB4 Gen1 Passive cable | Passive cable | DFP Gen3 capable? | ------yes---- |---------No-------- | | Discover SVID SOP Enter USB4 with USB3.2 Gen2 Passive Cable | Discover SVID SOP' | Discover Mode SOP | Discover Mode SOP' --------Is TBT3? | -----yes----|-----No---- | | Enter USB4 with TBT3 Enter USB4 with TBT Gen3 passive cable Gen2 passive cable BUG=b:140819518 BRANCH=None TEST=With Gatkex creek 3 device, TGLRVP can enter to USB4.0 mode Change-Id: Id861661c66c53a0a32679388bb7e2e81aae3ceb5 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1926382 Reviewed-by: Diana Z <dzigterman@chromium.org>
* ioexpander: Fix IOEX_INT after ioex_signal numbering changeEdward Hill2020-01-311-2/+3
| | | | | | | | | | | | | | | Fix ioex_is_valid_interrupt_signal() and IOEX_INT() to account for IOEX_SIGNAL_START correctly. BUG=none BRANCH=none TEST=ioex_enable_interrupt() returns success Change-Id: I8f13fa8f2d645aae565ac1062eab4a4d0968c4bc Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2031649 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* npcx: Add driver support for PS/2 interfaceCHLin2020-01-304-0/+9
| | | | | | | | | | | | | | | | | | | | | | Morphius connects the trackpoint device to EC via the PS/2 interface. To support it, we implemented the chip level PS/2 driver in this CL. The PS/2 driver can be used on all series of NPCX EC chips (NPCX5/7). BUG=b:145575366 BRANCH=none TEST=No error for "make buildall" TEST=Apply this and related CLs, connect npcx5/npcx7 EVBs to standard PS/2 keyboards and PS/2 device emulator with different channels. Verify that the PS/2 write/read transaction can keep working for several hours without issue. Change-Id: I5bae313db2d697999c2da5cf33478be2da754b8c Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1982302 Tested-by: CH Lin <chlin56@nuvoton.com> Commit-Queue: Edward Hill <ecgh@chromium.org> Auto-Submit: CH Lin <chlin56@nuvoton.com> Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb: differentiate DTS polarity and normal device polarityDenis Brockus2020-01-301-0/+44
| | | | | | | | | | | | | | | | | When we have SNK_DTS polarity, we still want to drive both CC lines with the appropriate pull. SRC_DTS should not show as having a polarity. Non-DTS should show the correct polarity. We were only handling the last sentence of that. BUG=b:147754772 BRANCH=none TEST=verify SuzyQ works on zork Change-Id: I013f9d881427d6d97b655f88cfb3a94e3ed10c61 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2022914 Tested-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_CONTROL host command to common fileVijay Hiremath2020-01-301-2/+61
| | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: Iadb75b9b187a0444c445c2641ec71d592cf4ac92 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2013228 Reviewed-by: Keith Short <keithshort@chromium.org>
* PD 3.0: Add AMS start detection to collision avoidanceDiana Z2020-01-291-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an explicit contract is in place for PD 3.0, the source shall control the Rp value in order to facilitate collision avoidance. When the value is set to 1.5 A, the sink can only respond to an existing AMS, and not start a new one. An Atomic Message Sequence (AMS) is defined as "a Message sequence that starts and/or ends in either the PE_SRC_Ready, PE_SNK_Ready or PE_CBL_Ready states." This means any given PD message may be starting an AMS (requiring the source to set Rp, and sink to check the CC level) or it may be a response within an AMS (in which case, sink may send regardless of CC levels). This change adjusts the pd_transmit() calls to indicate whether any given PD message is the beginning of an AMS. There are many AMS's defined, which may be found in section 8.3.2 of the PD 3.0 spec. Anytime the source returns to its ready state, it will reset Rp to reflect that the sink may start an AMS. Additionally, this removes the buffer for sending PD messages. If an AMS cannot be started, then it's better to fail the send so the pd_task state machine can handle the unsent message. BRANCH=None BUG=b:64411727, b:147476471 TEST=Tested with bip board with PD 3.0 config using 2 different PD 3.0 hubs. Monitored Twinkie output with hubs acting as source, sink, and power swapping to source. Also turned off PD 3.0 to ensure PD 2.0 behavior with the hubs was unaffected. TEST=Tested on volteer board with PD 3.0 config using Thunderbolt capable dock. Change-Id: Ib02670add1a125217a981a846e6e2c31681de169 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1246273 Tested-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* TCPMv1: Cleanup sending TBT control flags to hostVijay Hiremath2020-01-292-15/+12
| | | | | | | | | | | BUG=b:148114593 BRANCH=none TEST=tested on Volteer, able to get correct TBT control flags Change-Id: If673d4a194d3cc6b9579f0f32511c6363f2614f3 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2013825 Reviewed-by: Keith Short <keithshort@chromium.org>
* driver/retimer: Add support for ON Semi NB7V904MAseda Aboagye2020-01-291-0/+1
| | | | | | | | | | | | | | | | | This commit adds support for the ON Semiconductor NB7V904M USB Type-C Alt Mode Linear Redriver. BUG=b:147782066 BRANCH=None TEST=Enable on waddledoo, `make -j BOARD=waddledoo` Change-Id: Ia6fe76d0ad99bf7a8129e5d453ff12183990a50a Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2018707 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_GET_AMODE host command to common fileVijay Hiremath2020-01-281-0/+37
| | | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: I0b9cb76adbc5e385cb20256f693bd2b0687b30de Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2024428 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_DISCOVERY host command to common fileVijay Hiremath2020-01-281-0/+8
| | | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: Ia2ad22669a908e9b9c23c4b73e97872399049e75 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2024427 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* common: vec3: Add init/sub/add functionsYuval Peress2020-01-281-0/+57
| | | | | | | | | | | | | | | | Add convinience functions for initializing, adding, and subtracting vec3. BUG=None BRANCH=None TEST=buildall Change-Id: I594db350863a8199eade15a38deb6c223e2ae1ac Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1869729 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* common: mag_cal: update magnetometer to leverage kasaYuval Peress2020-01-281-15/+2
| | | | | | | | | | | | | | | Update magnetometer calibration algorithm to leverage the new kasa standalone code. BUG=b:138303429,chromium:1023858 TEST=added unit test BRANCH=None Change-Id: I5c0403b66d9fe7c2925b2ec6244cf9e32ad5ea5f Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1931464 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* Charger: change get_vbus_voltage to return EC errorDiana Z2020-01-281-2/+3
| | | | | | | | | | | | | | | The other driver structure members return an ec_error_list value and fill in parameters to return data. This commit changes the get_vbus_voltage call to follow that model. BRANCH=None BUG=b:147672225 TEST=builds Change-Id: I7308502a9734274dd308b830762493c4d70d147a Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2015340 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Charger: Remove unused charger driversDiana Z2020-01-281-31/+0
| | | | | | | | | | | | | | | | The driver/charger directory contains a number of charger drivers which are currently unused. As a part of the refactor of the charger drivers into a structure, remove these dead files which are no longer built. BRANCH=None BUG=b:147672225 TEST='make -j buildall' Change-Id: I89629c0cef3593954b5b6431bc29be5cc5ee6e45 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008346 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Charger: Create charger driver structureDiana Z2020-01-282-35/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With upcoming boards which use multiple charger chips, the EC codebase needs to be changed to assume chargers may have different I2C ports. This commit creates the driver structure and wrapper functions, which for now are hard-coded to chip 0 for equivalent behavior with previous code. A general charger config is created for all boards in charger.c for now, which uses the build information to fill in the structure. All boards will default to defining CONFIG_CHARGER_SINGLE_CHIP, which in turn defines a CHARGER_SOLO which can be used by drivers which have code that needs to determine charger numbers. For boards which have multiple chips, they may undefine this config and should generate build errors if their driver is still using the hardcoded charger reference of CHARGER_SOLO. Older drivers may continue using CHARGER_SOLO in non-static functions until they're needed in a multiple charger board. For boards which may be supporting different I2C configurations for the charger over board versions, they may define CONFIG_CHARGER_RUNTIME_CONFIG to fill in these fields after boot. BRANCH=none BUG=b:147672225 TEST=builds, chargers on hatch and octopus work Change-Id: I390ede494226252e512595c48099fa1288ffe93e Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008451 Reviewed-by: Jett Rink <jettrink@chromium.org>
* usb_mux: cleanup: Replace mux state enums with ec_command bit flagVijay Hiremath2020-01-282-24/+5
| | | | | | | | | | | BUG=b:145796172 BRANCH=none TEST=make buildall -j Change-Id: Ie4ffaf208745764262931501f0dff77b525a4e59 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2017569 Reviewed-by: Jett Rink <jettrink@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_DEV_INFO host command to common fileVijay Hiremath2020-01-241-0/+11
| | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: If9d902ef77da7d56a123c0c78b1ebbcd0d95bc3b Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008301 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1/v2: Move EC_CMD_USB_PD_RW_HASH_ENTRY host command to common fileVijay Hiremath2020-01-241-1/+7
| | | | | | | | | | | BUG=b:142911453 BRANCH=none TEST=make buildall -j Change-Id: Ibcf7b23c9b4c166a59c00b4805d1fbad5e79e5f1 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2008298 Reviewed-by: Keith Short <keithshort@chromium.org>
* uart: Add uart_put_rawDaisuke Nojiri2020-01-241-1/+10
| | | | | | | | | | | | | | | | | | uart_put_raw sends byte stream without translating '\n' to '\r\n'. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/119329144,chromium:998135 BRANCH=none TEST=Boot Nami Change-Id: Iaac4244d45231bf5904d917f2f446f87e8e10c50 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1757273 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* PD: Add support for new host command, EC_CMD_GET_PD_PORT_CAPSTim Wawrzynczak2020-01-242-0/+80
| | | | | | | | | | | | | | | | | This host command is used to report the static capabilities of a USB-PD port, including its power role, Try power role, data role, and its physical port location on the device. This will be used to expose the information in ACPI, via the EC object. BUG=b:146506369 BRANCH=none TEST=Along with coreboot changes, dump the SSDT, and verify that the object looks as expected. Change-Id: Ie1975a8b391eba6e924b0552ba9b0973fd2c63f3 Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2015825 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* driver/temp_sensor: add support OTI502 temperature sensorDevin Lu2020-01-221-0/+1
| | | | | | | | | | | | | | | This patch adds OTI502 IR temperature sensor driver. OT502 has two temperture information which is ambient and object temperature. ambient is chip temperature and object is IR temperature. BUG=b:140817732 BRANCH=none TEST=none Change-Id: Ia49e0c7962eaa446f788a9104204c6dbe18ee97c Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1925795 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* driver/tcpci: Add support for TCPCI Rev2 v1.0Aseda Aboagye2020-01-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TCPCI Revision 2.0 made a couple major changes compared to the 1.0 revision. One of these changes was that the method in transmitting and receiving messages from the TCPC had changed. The receive buffer register is now comprised of three sets of registers: READABLE_BYTE_COUNT, RX_BUF_FRAME_TYPE, and RX_BUF_BYTE_x. These registers can only be accessed by reading at a common register address 30h. Similarly, the transmit buffer register holds the I2C_WRITE_BYTE_COUNT and the portion of the SOP* USB PD message payload (including the header) in TX_BUF_BYTE_x. TX_BUF_BYTE_x is "hidden" and can only be accessed by writing to register address 51h. This commit adds support for TCPCI Rev2 v1.0 by adding the new mechanisms for transmitting and receiving messages. A flag was introduced to enable the TCPCI Rev2 handling, TCPC_FLAGS_TCPCI_V2_0. A board should set this flag in their tcpc_config structs for those TCPCI-compliant TCPCs which use TCPCI Rev2. BUG=b:147716486 BRANCH=None TEST=Enable TCPCI Rev2.0 on waddledoo, verify that PD messages are able to be received and transmitted. Change-Id: Ie0117adf56c95f85f9c67ed678cf1e367f83eb7e Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2006710 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* common: Implement kasa sphere fit algorithmYuval Peress2020-01-211-0/+46
| | | | | | | | | | | | | | Add an implementation of the kasa sphere fit algorithm adapted from AOSP. BUG=b:138303429,chromium:1023858 TEST=Added unit tests BRANCH=None Change-Id: I8194bfaddbb7c57a2b20a1917c91f7c78707e685 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867226 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* charger: Add support for RAA489000Aseda Aboagye2020-01-181-1/+2
| | | | | | | | | | | | | | | | | | | | | The RAA489000 is a narrow voltage direct charging buck boost charger with an integrated USB Type-C Port Controller. The charger IC portion is very similar to the existing Intersil 923x chargers therefore, support for the RAA489000 is being added to that existing driver. BUG=b:147316511 BRANCH=None TEST=Enable on waddledoo, flash and verify that we can talk to the charger. TEST=With other patches, verify that DUT can charge a battery. Change-Id: I7788eb67f0181dd540e20db862a1ab5788f2099c Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1995440 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* ServoMicro: Enable Brownout detection with PVD circuitBrian J. Nemec2020-01-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enables the programmable voltage detector (PVD) interrupt in ServoMicro. This interrupt fires when the supply voltage drops from the expected 3.3V to under 2.3V after power on. This gives several hundred microseconds of time for the device to respond to the power reduction. In order to ensure that the ServoMicro does not enter a non-responsive state, it triggers a reboot of the system to restore it to a good configuration. BRANCH=servo BUG=chromium:1023715 TEST=Configured GPIO output to trigger on pvd_interrupt() and verified the interrupt fires during the following situations using Saleae analyzer: * USB Power removed from working device * Ramping supply voltage from 1.5V to 5V with a DC supply * Repoducing failure condition from crbug/1016051 1 Connect ServoMicro to Cyan board 2 dut-control power_state:on 3 dut-control fw_wp_vref:pp3300 4 dut-control power_state:off 5 GPIO toggles and system reset occurs Change-Id: I721f48ab84b01d52a5f98747cc9d879ff2876a07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1911759 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Tested-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Auto-Submit: Brian Nemec <bnemec@chromium.org>
* i2c: Support changing I2C bus speed at runtimeTing Shen2020-01-172-21/+80
| | | | | | | | | | | | | | | | | | | | | Add a i2c_set_freq function and let chip drivers add their underlying implementation. Also implemented on stm32f0. BUG=b:143677811,b:78189419 TEST=1) make 2) On kodama, call i2c_set_freq(1, 100) during init. verify the bus is configured to 100kbps in kodama rev 1 BRANCH=kukui Change-Id: Iebb5baacf098b3e5649a4bd8ca14acf097d39693 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1969245 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* usbc: hpd_deadline cleanupDenis Brockus2020-01-161-0/+9
| | | | | | | | | | | | | | | | | | some of the usages of this static variable were used in overridable functions and they also had their own static variable for this same purpose. Since it is not required to override all of the functions, this left two variables out of sync with one another. So made them the same variable. BUG=b:147535104 BRANCH=none TEST=make buildall -j Change-Id: Ic560d3a2a2e129450e918e0cb6dfff75fd1222a2 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2002953 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* retimer: framework cleanup for chip specific control configDenis Brockus2020-01-161-11/+0
| | | | | | | | | | | | | | | | combine the optional control variables into a union of structures to reduce the amount of space needed for a particular board type. BUG=b:147593165 BRANCH=none TEST=make buildall -j Change-Id: If02c4c8065f4570aba210c3e34b30bc0d5c7a852 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2001134 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* TBT/USB4: Allow enabling TBT & USB4 per port basedVijay Hiremath2020-01-151-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | When TBT or USB4 mode is enabled, by default all the ports are assumed to be supporting TBT or USB4. However, not all the ports may support TBT & USB4 due to dependency on retimer and platform level Aux/LSx muxing. This board level function can override the TBT & USB4 logic based on board design. Ref: TGL PDG 5.2 USB-C* Sub-System: a. otherboard should have re-timer for all USB-C connectors that supports TBT. b. Aux/LSx platform level muxing is required. BUG=b:147658946 BRANCH=none TEST=Manually tested on Volteer TBT & USB4 mode detection and entry is allowed only on Port-1 Change-Id: I07b339023a4da6bd69382420f3aa11ed82379179 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2001221 Reviewed-by: Keith Short <keithshort@chromium.org>
* TBT: Allow limiting the cable speed based on board designVijay Hiremath2020-01-151-0/+21
| | | | | | | | | | | | | | | | | From the TGL PDG, MAX TBT signals routing length can be 205mm prior to connection to re-timer. Orthogonal routing with such length would results in adverse effect to channel margin, as described in Fiberweave White Paper. Hence, added overridable function to override the TBT cable speed based on the board design. BUG=b:147498371 BRANCH=none TEST=Able to detect TBT3 devices on Volteer Change-Id: I4490bc507c2c12b26372ed86e485c0491f1a9f21 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1998544 Reviewed-by: Keith Short <keithshort@chromium.org>
* util: enable chargen for USB consoleNamyoon Woo2020-01-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows chargen to print output to USB instead of UART, which is chosen by command parameter. If USB console is not supported, then the parameter will be ignored, and output shall go to UART port. The patch increases flash usage by 48 bytes if CONFIG_CMD_CHARGEN is defined. BUG=chromium:992607 BRANCH=None TEST=manually ran on fleex. for BOARD in {cr50, fleex} 1. Define CONFIG_CMD_CHARGEN in board/cr50/board.h, and baseboard/octopus/baseboard.h. 2. Build binaries, and program them. 3. Connect CCD to Octopus Fleex. 4. Open terminal to Cr50 and EC consoles, and run chargen (cr50) chargen 1 4 > // no output, because they went to UART. (cr50) chargen 1 4 usb 0000 > (ec) chargen 1 4 0000 > (ec) chargen 1 4 usb // usb parameter gets ignored. 0000 > Change-Id: I5810421fef56548e0bd667488e853e724f699a31 Signed-off-by: Namyoon Woo <namyoon@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1769386 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* usb_pd: Request Vconn swap to communicating with the cableAyushee2020-01-141-1/+14
| | | | | | | | | | | | | | | | | | | | | | | Before sending SOP' requests to cable plug, the port checks if the port is the Vconn source. If the port isn't the Vconn source, it can't talk to the cable. From USB PD spec 1.3 sections 2.6.1 and 2.6.2, during an explicit contract, after the data and power role swaps, if any, source/sink can initiate or receive a request for exchanging the Vconn source. Hence, adding support for the port to request Vconn swap, if it hasn't already been swapped. BUG=b:147209888 BRANCH=None TEST=Checked on volteer, able to communicate with the cable plug Change-Id: I36d896eda6319970b1a0a9bd7cc4efcbc381c8b1 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1988234 Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
* audio_codec: npcx: deprecate legacy option CONFIG_WAKE_ON_VOICETzung-Bi Shih2020-01-141-3/+0
| | | | | | | | | | | | | | | | | | | | | CONFIG_WAKE_ON_VOICE consists 3 features in NPCX: - DMIC - I2S_RX - WOV These features has broken down into smaller CONFIG options. Deprecates CONFIG_WAKE_ON_VOICE and prepares to separate smaller features in NPCX. BRANCH=none BUG=b:144064048, b:144063867 TEST=make BOARD=trembyle -j Change-Id: Ieaa123299ea687644f19066cf95ef150a18bf252 Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1986687 Commit-Queue: Yu-Hsuan Hsu <yuhsuan@chromium.org> Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* common: make ARRAY_SIZE, ARRAY_BEGIN, ARRAY_END type safeJack Rosenthal2020-01-141-3/+18
| | | | | | | | | | | | | | | | | | | | ARRAY_SIZE (and family) used to allow pointers to be passed to the macro, which would cause a value of one for the array size. This is a really easy accidental programming error. This change causes ARRAY_SIZE and ARRAY_END to divide by zero (using BUILD_CHECK_INLINE) if a pointer is passed. ARRAY_BEGIN will cause a BUILD_ASSSERT to fail if a pointer is passed. BUG=none BRANCH=none TEST=buildall Change-Id: Ibdd0efcc9fc46c43d46f2bd06529cc76df910f2e Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1993915 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* ps8xxx: add support for the ps8815Caveh Jalali2020-01-141-0/+1
| | | | | | | | | | | | | | | | | | | this adds support for the ps8815 variant of the parade TCPC. this chip is very similar to its predecessors like the ps8751 and ps8805 and can be supported by the same driver. at this point, the TCPM can talk to the chip but we don't properly detect chargers - the CC line states seem wrong and CC status changes do not trigger an ALERT in the ps8815. BRANCH=none BUG=b:144397088,b:147459088 TEST=EC detects the chip on boot. Change-Id: If86abd1fa21cf8f33f28c4ce89050b29e9408532 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1969524 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* TCPMv1 & TCPMv2: Move common functions to common codeVijay Hiremath2020-01-142-3/+18
| | | | | | | | | | | BUG=b:147249926, b:146623068 BRANCH=none TEST=make buildall -j Change-Id: Ibb24bdad4e9ec24b02106c05ca5fe51269efcb1c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1990425 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* common: motion_sense_fifo: Read temperature on stageYuval Peress2020-01-112-0/+29
| | | | | | | | | | | | | | | | Assuming online calibration is enabled, and the driver implements the get_temp function. When a driver stages data, if this is the first staged sample, read the current internal sensor temperature and cache it (will later be used in commit_data()). BUG=b:138303429,chromium:1023858 BRANCH=None TEST=buildall Change-Id: I8e5404e628d3e8ded7c2d75b1b5cbac8166e97aa Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1867225 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* RAA489000: Add TCPC driverDiana Z2020-01-111-0/+1
| | | | | | | | | | | | | | | The RAA489000 is both a charger and TCPC. This commit adds the driver for the TCPC portion. BRANCH=none BUG=b:147316570 TEST=builds Change-Id: I797a3bf9a6cd15a23b6188e695c6d1abd3ce3980 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991846 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
* TBT3: Correct TBT Adapter type in Device Discover Mode VDO ResponsesVijay Hiremath2020-01-101-3/+7
| | | | | | | | | | | | | | | Corrected the TBT Adapter bits that are swapped in the "USB Type-C cable and connector specification, Release 2.0" BUG=b:146626829 BRANCH=none TEST=Verified that all TBT3 docking stations present "TBT Adapter" bit 0 Change-Id: I15202a35a00166914d67f3cc5de319d838e43c83 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991855 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv1: Correct the TBT3 Discovery and Entry FlowVijay Hiremath2020-01-103-430/+936
| | | | | | | | | | | | | | | | | | | | | | Ref: USB Type-C Cable and Connector Specification 2.0 F.2 TBT3 Discovery and Entry Flow - Corrected the TBT3 Discovery flow - Corrected the TBT3 Entry Flow - Enabled the Active cable TBT3 mode entry - Refactored TBT & Cable VDO code on TCPMv1 so that same VDO structures can be used for TCPMv2 - Corrected getting the cable version - Cleaned up the code for super speed cable detection BUG=b:146006708, b:140643923, b:147134610 BRANCH=none TEST=Make buildall -j Able to detect Thunderbolt-compatible devices on TGLRVP Change-Id: I65f82e241d0cc2187050913e7d16942fdaa0ebd4 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1981276 Reviewed-by: Diana Z <dzigterman@chromium.org>
* pd: use pd_get_[power/data]_role instead of the tc versionDenis Brockus2020-01-102-17/+9
| | | | | | | | | | | | | | the tc versions were doing the same thing as the pd version so removed the duplication BUG=b:147290482,b:147314832 BRANCH=none TEST=make buildall -j Signed-off-by: Denis Brockus <dbrockus@chromium.org> Change-Id: Iaa48dcd65e3a6c325b0ae2cca33e629fec6e33c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1993861 Reviewed-by: Edward Hill <ecgh@chromium.org>
* USB_MUX: correct setting the retimer dataVijay Hiremath2020-01-092-0/+11
| | | | | | | | | | | | | | | Modified the USB MUX common driver to correctly configure the retimer data based on the current USB MUX info. BUG=b:145943811 BRANCH=none TEST=DP works on Volteer Change-Id: I5f37bcc0647f07b94fd9ee33913610cf6ae70c80 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1992842 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* pd: cleanup pd_get_data_roleDenis Brockus2020-01-091-4/+10
| | | | | | | | | | | | | | | This is the second half of b/147290482 Cleaning up to use pd_data_role instead of int BUG=b:147314832 BRANCH=none TEST=make buildall -j Change-Id: I2445b06f5f5469fb1f3a968034a83e3ee792e7c7 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991845 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* pd: cleanup pd_get_roleDenis Brockus2020-01-091-3/+5
| | | | | | | | | | | | | | | | | | pd_get_role in the TCPMv1 stack meant pd_get_power_role. pd_get_role in the TCPMv2 stack meant pd_get_data_role. This CL will clean that up and make them the correct naming. pd_get_power_role will also return an enum pd_power_role type instead of an int. BUG=b:147290482 BRANCH=none TEST=make buildall -j Change-Id: I73ee465401ccd050c2bd151f2fc043a59d95e079 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1991844 Reviewed-by: Jett Rink <jettrink@chromium.org>
* TCPMv2: Add BC1.2 trigger eventsDenis Brockus2020-01-081-2/+0
| | | | | | | | | | | | | | | The BC1.2 was holding the data lines so a USB SNK device would not be allowed to talk on the bus BUG=none BRANCH=none TEST=verify attached USB stick on BC1.2 enabled board Change-Id: I501a3d491241d00917d921c041b0567ec4ec55a1 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1967934 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* tcpci: Only drive one CC line when attachedDenis Brockus2020-01-084-15/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the NCT38XX driver code was more generic TCPCI than specific to the chip. So moved a number of the functions over to be generically handled. In doing this I propagated the idea of tri-state polarity. It is now either NORMAL, FLIPPED, or NONE for unattached. This is needed for the generic handling of correctly setting CC. This required changing the polarity from NONE to the appropriate detected polarity when in auto toggle. tcpci_tcpm_set_cc will now only set a single CC line when attached and both when unattached. BUG=b:146003980, chromium:951681 BRANCH=none TEST=Charging works with both plug orientations with AP on TEST=Device works with both plug orientations with AP on TEST=Charging works with both plug orientations with AP off Change-Id: Ie4b5cc998902a346a4f4a2c1480204b3a81017dd Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1967932 Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>