summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
...
* No init.rom section support in ZephyrHyungwoo Yang2021-01-221-1/+1
| | | | | | | | | | | | | | | | | 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-2211-0/+26
| | | | | | | | | | | | | | | | | | 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>
* usb_mux: Correction in sending the Host event IRQ=0Madhusudanarao Amara2021-01-211-3/+1
| | | | | | | | | | | | | | | | | | | | | Retimer is the first mux and the virtual mux is the second Mux. Here the check should be for virtual Mux (second mux) instead checked for the first Mux. Because of that there is no IRQ=0 host events sent. Removed the condition check as it is taken care in side the usb_mux_hpd_update function. BUG=b:177876072 BRANCH=None TEST=HDMI MST HUB second port display also working Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Change-Id: I36205f2d442e9dcaf3d082151201e4c210878d8d Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637153 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* SYV682: Update Driver for B revision siliconEric Herrmann2021-01-202-69/+60
| | | | | | | | | | | | | | | | | | | | They SYV682B made some meaningful changes to FRS. Update to remove the workaround put in place for the SYV682A and replace with the FRS logic for the SYV682B. The RVS alert can now be masked, so remove the message for an RVS event and repurpose the flag. There are some other changes, but none require driver changes. BUG=b:148144711 TEST=Enable FRS in board config, check that FRS works with with a 5V and 20V supply on a fast and slow-discharge FRS device. BRANCH=none Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: I78e1c7d5eca593661a7d67346c83775ca990e38d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606508 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* Zephyr: Create public headers for bmi260, bma2x2, and tcs3400Hyungwoo Yang2021-01-208-140/+14
| | | | | | | | | | | | | | | 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-203-0/+215
| | | | | | | | | | | | | | | | | | | | | 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>
* mp4245: Add a function to retrieve vbus and ibusScott Collyer2021-01-202-0/+44
| | | | | | | | | | | | | | | | This CL adds an api to the driver to retrieve VBUS information. This can be used by other layers for checking vbus transitions. BUG=b:169312229 BRANCH=None TEST=verfied vbus reading matches what was on the scope. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I1fba62361a64c3a38ba23574e5516441610c38f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267632 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* tcpm: Add USB-PD messaging support for stm32gx driverScott Collyer2021-01-201-18/+14
| | | | | | | | | | | | | | | | This CL implements the tcpci driver wrapper functions for usb-pd messaging which then call into the underlying ucpd driver. BUG=b:167601672 BRANCH=None TEST=verfied type-c attaches properly on quiche Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I6d0a585f6988ef8a45823381038fe04dbbc72ef6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522650 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* elan_sensor_pal: Type definition fp_sensor_info_therman lin2021-01-201-2/+2
| | | | | | | | | | | | | | | | | | | "2002994" was built error in latest version. This patch typedef on struct declaration its "fp_sensor_info_t" for fixed error of "unknown type name". BRANCH=None BUG=None TEST=We build on nami_fp, and testing Elan sensor with libelan_515.a and libelan_80.a successfully. Signed-off-by: herman lin <herman.lin@emc.com.tw> Change-Id: I87884c9d69291839e7632379cd6700d2d77a8d05 Signed-off-by: herman lin <herman.lin@emc.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2632113 Reviewed-by: Yicheng Li <yichengli@chromium.org> Commit-Queue: Yicheng Li <yichengli@chromium.org> Tested-by: Yicheng Li <yichengli@chromium.org>
* tusb422: Fix multi-line #error directivesSimon Glass2021-01-161-4/+4
| | | | | | | | | | | | | | | | | It does not make sense to split these over two lines. The first one causes the compiler to halt compilation and the second one never gets reported. 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: I4fe9434aa8956900fdc2c82bfb914086b962ba21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2631085 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* gl3590: Add CLI for managing USB hubJan Dabros2021-01-151-0/+32
| | | | | | | | | | | | | | | | | | | | | 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>
* SYV682x: Improve Sink OCP HandlingEric Herrmann2021-01-141-35/+85
| | | | | | | | | | | | | | | | | | | | | | | | Previously the sink OCP was calling the source OCP handler, which is incorrect. Remove that, and replace it with equivalent messages and retries in the driver. Since TSD was previously treated the same as OCP, split that into its own message. There is no PD significance to a sink OCP, so just re-enable the sink path 2 times. The 3rd time disables the sink path and requires a device reconnect. This will make us more robust to non-compliant sources. BUG=b:175444003 TEST=Short PPVAR_VBUS_IN to GND with a 2 ohm resistor on Voxel while charging at 15V. See that OCP is reported 3 times, then disabled. On unplug/replug, make sure it begins sinking again. TEST=make buildall BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: Id5eb04819f1e9e2001e3e68283da09a812faeff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2612008 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* gl3590: Add API for per-port power managementJan Dabros2021-01-142-0/+31
| | | | | | | | | | | | | | | | | GL3590 USB3.0 hub has support for enabling/disabling power to its downstream facing ports via I2C interface. New API allows to enable or disable bunch of ports at a time in order to limit number of issued I2C transactions. BUG=b:177295270 BRANCH=main TEST=With consecutive patch applied, one may verify new API with usage of `gl3590` command on servo_v4p1 and enabling/disabling ports. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I979fb2034e176f1603407be5ba46a528a14ec53c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2624470 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* gl3590: Add method for querying UFP connection power capabilitiesJan Dabros2021-01-142-5/+80
| | | | | | | | | | | | | | | | | | 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>
* bb_retimer: Update read and write sequenceDivya Sasidharan2021-01-141-30/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the case of I2C failures on reading or writing to the BB retimer, sleep and resend same I2C message. The CL resends the I2C read/write message 3 times before giving up. The nvm exclusive access was to wait for RESET_N to deassert, but since the RESET_N lines are deasserted at same time this is handled in SPI flash HW logic we no longer require it. Also the mutex was introduced to reduce the delay from 40ms to 20ms, but since the delay is after the RESET_N lines, it is redundant as well. BUG=b:174240235 BRANCH=None TEST=1. Tested with TBT dock, enumeration on both the ports are fine and swapping between ports also works fine. 2. Tested the following: Hot plug TBT dock -> Enter S0ix -> Disconnect the dock -> Connect USB pen drive - Pen drive enumerates fine on both the ports. Change-Id: I6cf2a49af6c1ab463821448df92d9f9a8ca5041e Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2594438 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* raa489000: Add support for linear chargeAseda Aboagye2021-01-141-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds support to enable linear charging of the battery. This leverages the Dynamic Voltage Compensation (DVC) mode of the RAA489000. It allows the BFET to be finely controlled to regulate the precharge current entering the battery pack when charging via the sub board. BUG=b:173530987 BRANCH=dedede TEST=Build and flash magolor. Deplete battery to 0% such that the DFET is disabled. Plug in a charger on the sub board, verify that DUT is able to revive battery pack and charge the battery at its desired precharge current rate. TEST=Cutoff battery, plug in charger on sub board, verify that battery is able to be revived and charged. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I364f1014ec00e877fd7f2dfd30ebb0032fd88ffc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2626205 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* SM5803: Only enable automatic fast charge with connected batteryDiana Z2021-01-131-1/+31
| | | | | | | | | | | | | | | | | | Refrain from enabling automatic fast charge until battery is not disconnected. Automatic fast charge may cause the board to brown out when no battery is connected and a heavy load or transient load happens. BRANCH=Dedede BUG=b:175074427 TEST=on lantis and drawcia, verify: - battery can come out of cutoff on MB port - board can boot with no battery on MB port Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I71b23b926bd319d4d9c87143395d9f33c173d442 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2601238 Tested-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ps8815: delete CONFIG_USB_PD_TCPM_PS8815_FORCE_DIDKeith Short2021-01-131-45/+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>
* BB retimer: add vendor ID 0x8087 supportli feng2021-01-122-3/+4
| | | | | | | | | | | | | | | BB retimer firmware changed vendor ID to 0x8087 from firmware revision 2.8. Added support for this ID. BUG=None BRANCH=None TEST=Volteer with BB retimer firmware 2.18 which uses vendor ID 0x8087, connect a USB/TBT device, in retimer_init(), passed vendor ID checking. Signed-off-by: li feng <li1.feng@intel.com> Change-Id: I95f2d7f74866b2e077a4e3e4bffd0b1d0f6461b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617512 Reviewed-by: Keith Short <keithshort@chromium.org>
* Export more symbols from ps8xxxSimon Glass2021-01-121-21/+0
| | | | | | | | | | | | | | | | | | | 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-128-0/+910
| | | | | | | | | | | | | | | | | | 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>
* ln9310: Update register to reduce hibernate currentJohn Crossley2021-01-122-4/+61
| | | | | | | | | | | | | | | | | Change initialization value of these three registers to reduce hibernate mode current: INFET_CP_PD_BIAS_CFG=0x0, INGATE_PD_EN=0x0, INFET_AUTO_MODE=0x1 BRANCH=Trogdor BUG=b:176858036 TEST=In hibernate mode check that LN9310 VIN current drops from 1.6 mA (w/ previous firmware) to ~105 uA. Change-Id: I9041a912cd68fdf75a7bd2d40d88e17e1dc893c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2622758 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com>
* driver: support PS8802 setting power saving modeBen Chen2021-01-122-0/+30
| | | | | | | | | | | | | | Add function support setting operation to power saving mode(standby mode). BUG=b:172993414 BRANCH=none TEST=make buildall Change-Id: I579b3b2958a930d9d7d70b913d3449397f6fa9db Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2556741 Reviewed-by: Diana Z <dzigterman@chromium.org>
* ina2xx: Add API for setting/getting alertsJan Dabros2021-01-112-0/+32
| | | | | | | | | | | BUG:b:144776402 BRANCH:master TEST:Needs consecutive CL in order to verify setting power thresholds Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I268e80fca0c1a1e763cd930a2b7f034438a8d88d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592494 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* usb_mux: Optimize reading mux state on unconnected portDivya Sasidharan2021-01-111-12/+2
| | | | | | | | | | | | | | | | | | | If Type-C port has nothing connected then the query of mux state should not power on the mux for reading the state. This helps reduce unnecessary power on/off retimer or mux for ports with no device attached to it. BUG=b:174240235 BRANCH=None TEST=Test enumeration of type-c devices is not affected. Also check on voxel if retimer init is not called periodically when device is not connected. Change-Id: I2f1c4093889164c0d47c3ac33e7a46ab524bcce0 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2601679 Reviewed-by: Keith Short <keithshort@chromium.org>
* Create a public header for bb_retimerSimon Glass2021-01-092-31/+4
| | | | | | | | | | | | | | | | 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>
* nb7v9004m: add function to tune usb_eq_rxYongBeum.Ha2021-01-092-0/+33
| | | | | | | | | | | | | | add function to tune usb_eq_rx BUG=b:176566398 BRANCH=None TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Ib928b80c13cf5e0a46b19d5dd2d256be2af0a255 Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606178 Reviewed-by: Diana Z <dzigterman@chromium.org>
* volteer: Separate out some baseboard USB-C config codeSimon Glass2021-01-091-3/+0
| | | | | | | | | | | | | | | | | | 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-15/+5
| | | | | | | | | | | | | | | | | 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>
* BB retimer: Set UFP mode of BB retimerAyushee2021-01-071-44/+88
| | | | | | | | | | | | | | | | | | | | | 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>
* ctn730: Resend i2c on any errorDaisuke Nojiri2021-01-071-2/+2
| | | | | | | | | | | | | | | | | | Currently, ctn730 driver resends i2c frame only if EC_ERROR_BUSY is returned. The i2c error in this case varies chip to chip. NPCX i2c returns EC_ERROR_UNKNOWN, for example. Instead of expecting a specific error, this patch makes CTN730 driver resend I2C on any error. BUG=b:176725734 BRANCH=None TEST=On CoachZ. Verified 'Failed to read/write' disappeared. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I0b461935810aa253c8399cc2a6f9573a4aab123d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611915 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Move tcpic.h header into include/driverSimon Glass2021-01-0717-304/+16
| | | | | | | | | | | | | | | | | | 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-26/+1
| | | | | | | | | | | | | | | | | 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>
* Create public headers for a few PPC/TCPM driversSimon Glass2021-01-075-71/+7
| | | | | | | | | | | | | | | | | | | | | | At present boards includes the private header of some of the drivers. This is not ideal but it works. For Zephyr we don't really want to access headers in private driver directories. Instead, create public headers for the five drivers needed by the Zephyr volteer build. For now, include the public header in the private header (the one included by the EC code), so that fewer code changes are required. BUG=b:175434113 BRANCH=none TEST=make buildall -j30 (way too verbose to see what is happening) build volteer on zephyr Change-Id: I5b810f53cdf545a885f3977849f9f2ca1d04d60a Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2607506 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* driver: si114x: Clean up register listNicolas Boichat2020-12-302-234/+90
| | | | | | | | | | | | | | | Used the datasheet to reconstruct the register table, took it as an opportunity to align the names with datasheet and clean up a bit the order of the registers/commands/parameters. BRANCH=none BUG=b:172225780 TEST=CQ Change-Id: I0b79b5ca6db439b104704b0e817d8f94fab687a8 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603076 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* TCPMv2: Unit Test - reflect TCPCI registers initial valuesDenis Brockus2020-12-291-0/+25
| | | | | | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I262e99c7442acca0118250764017f942239ed493 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2604561 Tested-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org>
* Woomax: Modify strength value of PS8802 for USB-C signal quality.Jacky Wang2020-12-281-0/+16
| | | | | | | | | | | | | Modify strength value of PS8802 for USB-C signal quality. BUG=b:175350836 BRANCH=zork TEST=make BOARD=woomax Signed-off-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com> Change-Id: I0f9199f596a27c1913eb650f063493796ac39ba6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2599730 Reviewed-by: Edward Hill <ecgh@chromium.org>
* driver: fix function name in icm_common.cDavid Huang2020-12-251-3/+3
| | | | | | | | | | | | | Fix function name SLAVE_GET_SPI_ADDR to support spi accel port. BUG=none BRANCH=main TEST=make buildall -j pass when CONFIG_SPI_ACCEL_PORT defined. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I067f6e193c54e2eea3cafa435dd089619c90f819 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2603077 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
* icm426xx: reset data rate when initDavid Huang2020-12-251-0/+2
| | | | | | | | | | | | | | When icm426xx init, reset data rate to enable sensor. BUG=chromium:1160266 BRANCH=main TEST=Check ectool motionsense get data after shutdown and power on. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I0a1042eaf6dbdb132c4bb50975eae3c6f0cfad00 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597131 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
* USB: Remove DTS identification from USB PD polarityBrian J. Nemec2020-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | We've added differentiation for DTS polarity and normal device polarity. These values were being passed to the pd[port].polarity fields. This creates problems for the usb_pd_config.h files which operate on the assumption that polarity is a boolean value of 0 or 1. In the case of ternary blocks that follow the format of: 'polarity ? A | B', if polarity is 'POLARITY_CC1_DTS = 2' we are incorrectly identifying it as flipped. Other usages like Servo_v4 which have lookup arrays like: tx_gpio[port][polarity]. In these cases, the DTS polarities point to garbage memory and generate hard-faults. BRANCH=none BUG=b:176154334 TEST=Connect to servo console and run 'cc snkdts' Validate that the servo did not hard-fault, instead loads a valid configuration. Signed-off-by: Brian Nemec <bnemec@chromium.org> Change-Id: If5ed079fee9e91dbf291e1f210762c298948ad1e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600657 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* tcpm: Move tcpm.h into an include directorySimon Glass2020-12-2219-560/+18
| | | | | | | | | | | | | | | | | | This header file is used from quite a few files, relying on the EC build system to find includes in the driver/tcpm directory. For Zephyr we don't want to add that as an include. It makes more sense for header files to be in an include directory, so move it and fix up the users. BUG=b:175434113 BRANCH=none TEST=build Zephyr and ECOS on volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I5851914b1a7d3fdc1ba911c0fbe9046afbaf6f5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2597985 Reviewed-by: Keith Short <keithshort@chromium.org>
* Revert "driver: Richtek update rt1715 driver code"YH Lin2020-12-222-182/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 7238cb2f23505aff739d60fa7fcd06bb934f4d4e. Reason for revert: Initial merge was for unblocking the factory. Now build(s) have been done we can revert the CL. Original change's description: > driver: Richtek update rt1715 driver code > > Add rt1715 USB C PHY initial setting for better IOP compatibility. > Add Rt1715_init_cc_params function to setup rt1715 PHY noise filter > according to port partner’s CC status.rt1715_get_cc, rt1715_set_cc, > rt1715_set_polarity functions and replace tcpci_tcpm_get_cc, > tcpci_tcpm_set_cc, tcpci_tcpm_set_polarity. > > BUG=b:173023411, b:171461736 > BRANCH=master > TEST=Pass TDA.2.1.2.1 BMC PHY RX BUSIDL with Volteer+RT1715 > > Change-Id: I1bac27a155e152d42d4d35d72e2791909964da14 > Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2583884 > Tested-by: Abe Levkoy <alevkoy@chromium.org> > Reviewed-by: Abe Levkoy <alevkoy@chromium.org> > Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Bug: b:173023411 Bug: b:171461736 Change-Id: I01e9765a0b369f6da93391bd0bb27581a5feee37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2599759 Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: YH Lin <yueherngl@chromium.org> Tested-by: YH Lin <yueherngl@chromium.org>
* SYV682x: Stop VCONN configuration if there is OVPEric Herrmann2020-12-211-3/+8
| | | | | | | | | | | | | | | | | | | If a VBAT OVP is triggered while VCONN is being configured, a PPC re-init will reset the PPC. But, the VCONN configuration would undo this because it is a RMW. Instead, if VBAT OVP is triggered, don't update the VCONN state. BUG=b:171461736 TEST=On a Voxel which experiences VBAT OVPs, ensure that it recovers from these TEST=make buildall BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: I427c43144c8774627783908c0d921fa170686f7f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572236 Reviewed-by: Keith Short <keithshort@chromium.org>
* tcpm/it83xx: Disable Rx decode in pd initRuibin Chang2020-12-211-0/+4
| | | | | | | | | | | | | | | | | | Default setting of Rx decode SOP and Hard reset are enabled, so I disable it in pd init. BUG=none BRANCH=none TEST=on drawcia, console cmd check register 01h Bit[5:7] = 000b, 1Bh Bit[0] = 0b. Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: Ibf3c7bc144dc0385d8d92a07fab7899d1f0d0bdd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592535 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* kohaku: Set base light sensor information correctlyGwendal Grignou2020-12-211-0/+6
| | | | | | | | | | | | | | BH1370 light sensor only support 10Hz frequency. Set parameters properly. Sensor only used on kohaku. BUG=b:172343923 BRANCH=hatch TEST=Check on Kohaku the light parameters are correct. Change-Id: Ibb9b2699e414cf80730d290aba981dcd4898f84f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586069 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* Cleanup: rename function nameRuibin Chang2020-12-213-102/+104
| | | | | | | | | | | | | | | | | Rename function name from it83xx_* to it8xxx2_* for it8xxx2 driver. Rename function name from *_tcpm_sw_reset to *_tcpm_hook_disconnect. BUG=none BRANCH=none TEST=make BOARD=drawcia -j make BOARD=asurada -j Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: I8111ec5b9972d1badae625e87248c62e99eabbf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2598298 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw>
* RAA489000: VBUS current target settingKo_Ko2020-12-181-1/+10
| | | | | | | | | | | | | | | | | The value for VBUS_CURRENT_TARGET (0x92) is determined by current sense which might be different in each board. Use ceiling value to avoid insufficient current output. BUG=b:169788521 BRANCH=dedede TEST=build and flash on madoo, and make sure we get the desired value Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com> Change-Id: If5d976e1f1054dd22ff4b915b399434bc846bb76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2567082 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com> Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
* driver: ppc: Drop paths from driver/ppc filesSimon Glass2020-12-184-4/+4
| | | | | | | | | | | | | | | These paths don't seem to be necessary and don't currently work with Zephyr. Drop them. BUG=b:175434113 BRANCH=none TEST=build zephyr for volteer emerge-volteer -q chromeos-ec Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I482a4a701265631439e3302c4a360e4cb5dba051 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2595220 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable isl9241 for VolteerSimon Glass2020-12-171-1/+7
| | | | | | | | | | | | | | | Add configs and build rules to enable this driver. A few issues are left to clean up later. BUG=b:175248556 BRANCH=none TEST=build for volteer Change-Id: If2c5427d016ae8cddcc25926668011aa11673091 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589562 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tcpm/it8xxx2: use PD_VCONN_SWAP_DELAY delay time for Vconn dropRuibin Chang2020-12-171-1/+3
| | | | | | | | | | | | | | | | Use the already existent board configuration PD_VCONN_SWAP_DELAY for Vconn drop. BUG=none BRANCH=none TEST=on hayato, Vconn drop to 0v before we disable 5v tolerant on cc. Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: I2cf52e1d2ba4cb4c1ce1fb9e09bf20fb9859359a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592212 Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Commit-Queue: Eric Yilun Lin <yllin@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org>