summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
* tcpci: add missing CPRINTS argumentCaveh Jalali2019-09-261-1/+1
| | | | | | | | | | | | | this adds the missing "port" argument to a CPRINTS. BUG=none BRANCH=none TEST=buildall passes, boots on atlas Change-Id: I9308a4beea716441912aaa06eb206e9d17186cd9 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1825876 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* touchpad_gt7288: support touch width and heightHarry Cutts2019-09-212-3/+10
| | | | | | | | | | | | | GT7288 firmware version 4 supports these dimensions. BRANCH=none BUG=none TEST=check output of `gt7288_rep` command, comparing palms and fingers. Change-Id: I9094d8f86f34e4f319a9743c246461853d0382cf Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1815403 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* touchpad_gt7288: Basic driver for Goodix GT7288Harry Cutts2019-09-183-0/+306
| | | | | | | | | | | | | | | | | | | | | | A simple driver which allows touch reports and firmware version information to be read. If the appropriate config flag is set, console commands are included for testing. Unlike the other two touchpad drivers already implemented, which simply receive I2C HID events and send them straight out again over USB HID, we want to do some processing on the touchpad data in the board directory. For that reason, this driver leaves handling the touch interrupts up to the user. BRANCH=none BUG=none TEST=With https://crrev.com/c/1716928 patched, run the various host commands and check the output. Change-Id: Ia38e516473b78fb052ae18ca89acc5d815b53bd6 Signed-off-by: Harry Cutts <hcutts@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1799290 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* tcpc/mt6370: Change rp_def level and enable rx deadzone as sinkGene Chen2019-09-172-3/+47
| | | | | | | | | | | | | | | Change rp_def level and enable rx deadzone as sink BUG=b:139400105 BRANCH=None TEST=Run "TDA.2.1.2.2 BMC PHY RX INT REJ" pass Change-Id: Ieb684f7a3d38e3b36aab9bcf27cbc823b5a7df39 Signed-off-by: Gene Chen <gene_chen@mediatek.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1784269 Reviewed-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Sean Abraham <seanabraham@chromium.org>
* driver/tcpm/anx7447: bound port argumentPatrick Georgi2019-09-121-0/+4
| | | | | | | | | | | | | | | Found by Coverity Scan #187773, #204053 BUG=none BRANCH=none TEST=none Change-Id: Ie7006828d8a5d760097baade6851c72d15e42cf1 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1801206 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
* anx7447: Add proper mux setting for DP alt mode and DTS mode (CCD)Lee, Shawn C2019-09-122-2/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch must be with removing the external 100k pull up/down resistors on the Aux P/Aux N lines which avoids the 3.3V DC bias voltage adds 0.8V pulse of aux channel to turn on TCPC internal P-MOSFET that causes the signal effect on CCD communication. BUG=b:124410548 BRANCH=None TEST=Connect external monitor,usb device or CCD cable to type-c port0 Each type-c device should work normally. Signed-off-by: Xin Ji <xji@analogixsemi.com> Signed-off-by: Jack Lai <jack.lai@intel.com> Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Commit-Queue: Zhuohao Lee <zhuohao@chromium.org> Tested-by: Zhuohao Lee <zhuohao@chromium.org> Change-Id: Ic920c83232163292c3d6dbfce1b23a8e3a1c6b6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1680664 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* rt946x: raise current limit to 2A for HW rampTing Shen2019-09-091-1/+3
| | | | | | | | | | | | | | | | CL:1633930 raised DCP input current limit to 2A when SW ramp enabled, the same limit should also apply to HW ramp too. BUG=b:139012899 TEST=observe the charging curve (see issue link above for test result) BRANCH=master Change-Id: I22098bd81bb46c7d1e638e7b4db8b87cd3284533 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1760655 Reviewed-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* drivers/tcs3400: fix a couple values in lux tableNick Vaccaro2019-09-092-7/+9
| | | | | | | | | | | | | | | | | | | | | | A couple of the values in the lux atime table needed adjusting as they were too aggressive and were causing train-up / saturate / train-down / repeat... pattern cycles. Allow device to upshift in training when we're >= 2.5x from saturation (was >= 3x). Fixed a couple of nits. BUG=b:139749448 BRANCH=master TEST=Walked a flapjack through each lux light level, with a test at the low end of the level and a test at the high end of each level (i.e. for LUX level 1000, tested at 1100 and 1900 LUX), assure the tcs3400 doesn't go into saturation while trying to hit the 90% band. Change-Id: I84c5bf09e072e96d516d91520a176fa35274ce7a Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1767598
* driver/wpc/p9221: Avoiding using uninitialized variablePatrick Georgi2019-09-041-5/+7
| | | | | | | | | | | | | | | | | | For this, restrict the variables' scope and move the print statements closer to the other variable use. Found by Coverity Scan #198955, #198960 BUG=none BRANCH=none TEST=none Change-Id: I947249e4fd36524de5065616d5bcd32203d8b7e4 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781469 Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* config: Refactor CONFIG_ACCEL_FIFO to enable use of IS_ENABLEDYuval Peress2019-09-035-161/+138
| | | | | | | | | | | | | | | This change allows us to use the IS_ENABLED condition to replace the various ifdef guards around the CONFIG_ACCEL_FIFO BUG=b:137758297,chromium:981990 BRANCH=None TEST=buildall and CTS tests on Arcada Change-Id: I65d36bac19855e51c830a33e6f3812575e8d15d9 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704164 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* Revert "it83xx/intc:message id of pd packet repeat"Yilun Lin2019-08-252-13/+0
| | | | | | | | | | | | | | | | | This reverts commit bd19b03b128db664dfb5e6582810bd177b635408. With https://crrev.com/c/1757596/ merged, one doesn't need to handle repeated MessageID in TCPC. TEST=make buildall BUG=b:134556286 BRANCH=none Change-Id: I0f97e4e574b94ecbc23e5ee97ade7cc4da7f9020 Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1763895 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* tglrvpu_ite: Adding VCONN supportAyushee2019-08-231-5/+0
| | | | | | | | | | | | | | | Added GPIOs pin config to support VCONN on tglrvp. Also added power switch function to enable/disable VCONN according to the cc lines. BRANCH=None BUG=b:139763031 TEST=Able to get characteristics of an E-marked cable Change-Id: Ib09307aafe68ea955f256d3f35670579072c3040 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1762591 Reviewed-by: Keith Short <keithshort@chromium.org>
* battery/mm8013: fix battery present statusYilun Lin2019-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | Tighter battery present status by returning BP_NO. charger task will try to charge battery when battery present status is BP_NOT_SURE, and this would put PD and charger tasks in a weird state (and keep resetting) if the battery is actually not present. TEST=boot krane w/o battery and w/ PD charger, and see it doesn't reset for over 5 mins. BUG=b:139509751 BRANCH=none Change-Id: I3e3d818b80ffcfdb12fbd83daafa792d837a0fe0 Signed-off-by: Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1765108 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: Move fifo logic out of motion_sense.cYuval Peress2019-08-235-0/+5
| | | | | | | | | | | | | | | | | | | | This change is needed to allow better testing of the fifo behavior. Additionally, motion_sense_fifo.c will only be compiled if CONFIG_ACCEL_FIFO is defined. This behaviour requires a few small changes to several boards and baseboards to make sure that we only define CONFIG_ACCEL_FIFO when the MOTIONSENSE task is present (some times that may be only in one section RW or RO). BUG=b:137758297 BRANCH=None TEST=buildall and ran CTS on arcada Change-Id: I2f7e4e436ba9568a35b7a0b2c8d53a73f198ba73 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704163 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Commit-Queue: Alexandru M Stan <amstan@chromium.org>
* driver/rt946x: check wrong bit status when ADC conversionxiong.huang2019-08-211-1/+1
| | | | | | | | | | | | | | | | Base on official MT6370 datasheet, ADC_STAT status is 0 which indicates ADC conversion complete. BUG=b:139653474 BRANCH=master TEST=Add more log information, EC will check ADC_STAT status about 6 times in one loop. Change-Id: I50a10c25cfb35a1f41c569fabf360c5e29f44be2 Signed-off-by: Xiong Huang <xiong.huang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1760661 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
* driver/tcpm/it83xx: Enable TCPC receive SOP'Ruibin Chang2019-08-211-18/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Enable TCPC receive SOP' for communication with cable, when we are Vconn source role. BUG=None BRANCH=None TEST=test on board: ampton and reef_it8320 1.SRC connects to SNK via E-mark cable, sources Vconn successfully, and receives cable's ack of discover id request. 2.SRC connects to SNK via E-mark cable, but not source Vconn to cable, and receives nothing of discover id request (this isn't effect on request SNK flow). 3.console cmd pdcable 0 2019-07-30 11:43:40 > pdcable 0 2019-07-30 11:43:45 Cable Type: Passive 2019-07-30 11:43:45 Connector Type: Type C 2019-07-30 11:43:45 Cable Current: 5A 2019-07-30 11:43:45 USB Superspeed Signaling support: Gen 1 Change-Id: Icd2e6f8481bb7a4e0b922460d46b831f36112738 Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw> Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728669 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: lis2dw12/lis2dwl: add polling mode supportPaul Ma2019-08-211-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | This patch add polling (forced mode) support for lis2dw family. 'froced mode' is a common usage model for lid accel sensor. Treeya will support two set (BMI160/KX022 and LSM6DS3/LIS2DWL) of base/lid sensors and both of their lid sensor should work in the same mode (forced mode or interrupt). Since KX022 driver only support polling, so lis2dwl also need polling support. This patch add it. BUG=b:138768226, b:138978278 BRANCH=none TEST=on Akemi board, build both interrupt and polling (by define CONFIG_ACCEL_LIS2DW_AS_BASE or not) mode firmware, boot and confirm sensors init suscess and 'accelinfo on' has correct sensor x/y/z output. Cq-Depend: chromium:1739026 Change-Id: Ib0dcb7b317eec51a38598a644f965d7ecc5928c6 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741598 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org>
* driver: lis2dwl: add driver supportPaul Ma2019-08-213-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | lis2dwl has almost the same register interface as lis2dw12. lis2dwl only has one low power mode and when in low power mode, it has only 12 bit resolution. In order to get 14 bit resolution, we only use its high performance mode. Add MOTIONSENSE_FLAG_INT_ACTIVE_HIGH flag to support both active high and active low interrupt. BUG=b:138768226, b:138978278 BRANCH=none TEST=use Akemi board, add lis2dwl as accel sensor, boot the board and make sure sensor x/y/z get correct value by 'accelinfo on' Cq-Depend: chromium:515302 Change-Id: I37fcc0f43af3c8055079e09db00757b665813ba8 Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1739026 Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: mario tesi <mario.tesi@st.com> Commit-Queue: Martin Roth <martinroth@chromium.org>
* driver: IO expander: nct38xx: add the interrupt supportCHLin2019-08-215-54/+385
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IO pins of Nuvoton TCPC NCT38XX chips have the ability to support the interrupt function. This commit adds the driver to support it. However, please note that if the system needs to use an IO on NCT38XX to support the interrupt, the following two consideration should be taken into account. 1. Interrupt latency: Because it requires to access the registers of NCT38XX via I2C transaction to know the interrupt event, there is some added latency for the interrupt handling. If the interrupt requires short latency, we do not recommend to connect such a signal to the NCT38XX. 2. Shared ALERT pin: Because the ALERT pin is shared also with the TCPC ALERT, we do not recommend to connect any signal that may generate a high rate of interrupts so it will not interfere with the normal work of the TCPC. BRANCH=none BUG=none TEST=No error for "make buildall" TEST=Apply this and related CLs, manually test each IO pins; make sure each pin's interrupt handler is correctly executed. Change-Id: I72d835557913d87097b2e0d82165e40fe132ca77 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1734948 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com>
* driver/tcs3400: improve efficiency of auto-adjustNick Vaccaro2019-08-202-16/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | Adds an array which holds the number of atime increments needed at various lux levels and again settings to change delta from saturation by 1%. Using this table, the anti-saturation algorithm can get to the 90% band in most cases in a single adjustment vs the 10 to 15 adjustments previously needed when not using this table. Enabling CONFIG_TCS_USE_LUX_TABLES takes up 280 bytes in the ec.obj. BUG=b:124512628 BRANCH=master TEST=Flash and boot flapjack, verify that ALS and RGB sensors are still generating data. I used alslog patch and enabled ALS logging in EC console via "alslog 2047". Verify that under a constant light source, the adjustment mechanism correctly drives the ALS values such that they land in the sweet spot between 90 to <100% of saturation. Change-Id: I7cd0b8242e72233f50ff2751834f7bba367c6706 Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1677764 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver/tcs3400: add auto-compensation for saturationNick Vaccaro2019-08-202-137/+419
| | | | | | | | | | | | | | | | | | | | | | | | | | Making settings more sensitive makes the SNR better, so this algorithm strives to keep the output level as close to 90% saturation as possible. Adds calibration mode and lux calculation. Removes unused last_value field from the tcs3400_rgb_drv_data_t structure, we use raw_xyz field in motion_sensor_t struct instead. BUG=b:124512628 BRANCH=master TEST=Flash and boot flapjack, verify that ALS and RGB sensors are still generating data. I used alslog patch and enabled ALS logging in EC console via "alslog 1023". Verify that under a constant light source, the adjustment mechanism correctly drives the ALS values such that they land in the sweet spot between 90 to <100% of saturation. Cq-Depend: chromium:1711958,chromium:1702543 Change-Id: Ibf260a990fe285cb54ee94c1ebe8aa85ea10affc Signed-off-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633269 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* usb_pd: Adding USB-C cable detectionAyushee2019-08-163-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a discover identity command is sent with a SOP prime packet, the cable plug of an emark cable responds with the cable attribute. Added a structure pd_cable that stores the cable type and and resetting it when the cable is disconnected. Also added console command that gives the type of cable connected. Host(DFP) Cable Port-Partner(UFP) -------------------------EXPLICIT CONTRACT------------------------ Discover Identity SOP -----------------------------> request | <------------------------- Discover Identity response Discover Identity SOP' ---------> request | (If Emark Cable) <------------ Discover Identity SOP' | response Store cable type | (If Non-Emark Cable) <-------------- No response | Discover SVID SOP request ------------------------------------> (Rest of the PD flow) BUG=b:129990370 BRANCH=none TEST=Verified on dragonegg, able to get cable response Change-Id: I2536cf24d58f7ee5ff462b34fc32f69d7a200d41 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1707851 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* ps8xxx: disable DCI modeCaveh Jalali2019-08-144-22/+110
| | | | | | | | | | | | | | | | | | | | DCI mode is auto-enabled by default. we don't actually support DCI (intel specific SoC debug path), so we can explicitly disable DCI mode. doing so, saves about 40mW on the 3.3v rail when USB2 devices or USB-C to USB-A dongles are left plugged in. this is particulary relevant in sleep mode as this accounts for a significant portion of the system power consumption. BUG=b:119875949 BRANCH=none TEST=verified power consumption drops using sweetberry, USB devices still functional across suspend/resume. Change-Id: Id13630425c78965d2ac4f2e97715374ae0640d23 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1732231 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Caveh Jalali <caveh@google.com>
* usb_mux: Send DP safe mode info to virtual MUXVijay Hiremath2019-08-141-1/+2
| | | | | | | | | | | | | | | | | Before entering into alternate mode, state of the USB-C MUX needs to be in safe mode so that the USB-C pins cab be re-purposed without getting damaged or do not damage their Port Partner. Hence, sending the DP safe mode info to virtual MUX from EC. BUG=b:139140865 BRANCH=none TEST=Manually tested on Intel RVP, MUX is able to configure to safe mode before entering alternate mode. Change-Id: I3715b5118112b7744407ac5e652f63f6d7cd0a1b Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1745540 Reviewed-by: Keith Short <keithshort@chromium.org>
* ppc: initialize vbus current limit on initJett Rink2019-08-131-0/+9
| | | | | | | | | | | | | | | The nx20p348 should also set the initial current limit during its initialization. BRANCH=octopus BUG=b:139110010,b:139201733 TEST=with CL stack, phaser limits both ports to 1.5A Change-Id: I876b32434bd37bf410d546a3d27f0f7ba949d3ea Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1749945 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* motion: bh1730: use 1K scale for d1_1k/d0_1kJongpil Jung2019-08-131-1/+3
| | | | | | | | | | | | | | | | | | | To use integer instead of float, we use d1_1k/d0_1k instead of d1/d0. But when we devide value, d1_1k/d0_1k is not 1k base. So, before we use value, we need to multiply value by 1K. BUG=b:130835790 BRANCH=none TEST=make -j BOARD=kohaku flash ec.bin on kokaku and read lux with ectool motionsense Change-Id: If4e6abae43b4d296007680452f0584366825ad1e Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1739028 Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org>
* driver: lis2dw12: Add driver supportmario tesi2019-08-133-0/+782
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added ACC LIS2DW12 driver support. Features included in this driver are: - Basic Sensor Read acceleration data - ODR and FS runtime configuration - FIFO support with watermark interrupt events - Shared commons function with ST MEMs devices - Switch Low Power to High perf. mode in case of ODR > 200 Hz - Configure D-TAP event detection in Hardware BUG=b:73546254 BRANCH=master TEST=Tested on discovery_stmems target BOARD with LIS2DW12 connected to EC i2c master bus and motion sense task running. To build firmware for discovery_stmems target with LIS2DW12 sensor connected, simply uncomment CONFIG_ACCEL_LIS2DW12 define in board.h target file and make with target BOARD=discovery_stmems. Commands used to test LIS2DW12 device are: - accelinit 0 (to configure accel. device) All basic features tested, including changing in ODR: - accelrate 0 10000 (set ODR to 10 Hz) - accelrate 0 12500 (set ODR to 12.5 Hz) - accelrate 0 25000 (set ODR to 25 Hz) - accelrate 0 50000 (set ODR to 50 Hz) - accelrate 0 100000 (set ODR to 100 Hz) - accelrate 0 200000 (set ODR to 200 Hz) - accelrate 0 400000 (set ODR to 400 Hz) - accelrate 0 800000 (set ODR to 800 Hz) - accelrate 0 1600000 (set ODR to 1.6 kHz) Full Scale Range: - accelrange 0 2 (set Full Scale Range to 2g) - accelrange 0 4 (set Full Scale Range to 4g) - accelrange 0 8 (set Full Scale Range to 8g) - accelrange 0 16 (set Full Scale Range to 16g) FIFO features and interrupt management: - accelinfo on 1000 (motion info task with refresh rate 1 s) and polling data read: - accelread 0 (to read data from accelerometer) Change-Id: I0b9861a71e81052e7ee8eb235a1a5b2a57d4c6f5 Signed-off-by: mario tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/515302 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org>
* thermistor: update Steinhart-Hart equationsPaul Fagerburg2019-08-122-1/+53
| | | | | | | | | | | | | | | Add support for 30.9K pull-up on resistor divider with the 47K thermistor. BRANCH=none BUG=b:124316213 TEST=Rebuild EC and flash Change-Id: I5bc72fa67549ab15c0e4e1b0291eb934990ee61b Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742914 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* usb: convert cc1 from int to enumJett Rink2019-08-099-12/+26
| | | | | | | | | | | | | | Refactor code to use proper type for cc1 and cc2 lines. BRANCH=none BUG=none TEST=builds. No functional change. Change-Id: Id292db8480920e2b191bac9d9ecc2685f61e4ea9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1744654 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* pi3usb9201: Add EC console log for host CDP mode settingScott Collyer2019-08-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | For the pi3usb9201 the usb D+/D- switches are closed automatically based on either the result of bc1.2 client detection completion or setting CDP_HOST mode. There is a console log already that shows the bc1.2 client mode detection result. However, for host mode there was no console log. This CL adds a message when this setting is used which is useful for knowing for certain that the D+/D- switches have been closed. BUG=b:138618816 BRANCH=none TEST=Verfied message when data role is DFP 2019-08-07 14:32:40 [0.716611 pi3usb9201[p0]: CDP_HOST mode] Change-Id: I65a6321452a8e668c839eba7a18d92398c2b78d1 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742869 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* isl9241: add charger_get_vbus_voltageDenis Brockus2019-08-082-0/+51
| | | | | | | | | | | | BUG=b:138600692 BRANCH=none TEST=make buildall -j Change-Id: Idd20b1833945e37a84db4e7c444d8974f6059f83 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1742532 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* touchpad_elan: Add missing tablet_mode.h includeNicolas Boichat2019-08-071-0/+1
| | | | | | | | | | | BRANCH=none BUG=b:138968914 TEST=make buildall -j Change-Id: Ia753d1a089a326eb15a28528f0ff0cfa320b4e1d Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1741588 Reviewed-by: Yilun Lin <yllin@chromium.org>
* ps8xxx: stub out enter_low_power_modeCaveh Jalali2019-08-071-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the ps8751 really does not behave well with explicit low power mode commands - it enters low power mode on its own in about 2 seconds, so there's really no need to command it into low power mode. when the ps8751 is awake, it will take the low power command, but also generate an alert. when we try to read the alert register, it fails because the chip is in low power mode, so we go through the normal process of waking it up, including re-initializing the chip. we then process the alert and power down the chip again. but this time around the i2c transaction for the power down command fails (we don't check this status). the reason the i2c transaction failed is very likely because the chip processed the I2CIDLE command and didn't complete the i2c transaction. BRANCH=none BUG=b:137622553 TEST=verified chip still goes to sleep on its own Change-Id: I01b864791ae27a81a4512ddb752329e59be6a8c6 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1733860 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Caveh Jalali <caveh@google.com>
* Trembyle: Fix USB-C TCPC driversDenis Brockus2019-08-021-0/+3
| | | | | | | | | | | | | | Add NCT3807 USB-C TCPC drivers BUG=b:138600238,b:138599948 BRANCH=none TEST=make buildall -j Change-Id: Id98df51748beb60e787350265127936b18f4cf46 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1728478 Commit-Queue: Edward Hill <ecgh@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* pi3usb9201: Fix typo in structure name.Keith Short2019-07-302-6/+6
| | | | | | | | | | | | | | | | The structure used by board files to define the I2C connections to the PI3USB9201 driver had digits in the part number transposed. BUG=b:138650914 BRANCH=none TEST=make buildall Change-Id: Iaa7897a35f3172dd71fccca4e203b1d0e6a18ef7 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1725959 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Zork: Change charger to ISL9241Denis Brockus2019-07-261-2/+4
| | | | | | | | | | | | | | | | Found a couple of compile issues when I swapped over to the ISL9241 charger. So fixed those as I changed chargers. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Ifcacca859eb86f22ea0619e05dcaa689c56b0d73 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1720859 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org>
* isl923x: Check max current in isl923x_set_dc_prochotKo2019-07-262-2/+22
| | | | | | | | | | | | | | | | | | The DCProchot register takes a value in multiple of 128 up to 12800 mA. This patch makes isl923x_set_dc_prochot return error when a value exceeding the max is passed. Signed-off-by: Ko Ko <ko_ko@compal.corp-partner.google.com> BUG=b/130387567 BRANCH=Nami TEST=buildall Change-Id: If2155d7fc74c1491bf7c0a742ba8356c268a94a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1716673 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: Add support for calibration modeGwendal Grignou2019-07-243-3/+8
| | | | | | | | | | | | | | | | | For TCS3400, performing calibration is not just a one-shot event: The RBG sensor stays in calibration mode: returns raw value in R, G, B space. When out of calibration, it returns light information in X, Y and Z space. BUG=b:124512628 BRANCH=hatch,flapjack TEST=unit test Change-Id: I6766907054c8e79a3cbcb629ef91a0967ea0780a Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1702543 Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
* driver: IO expander: nct38xx: add support for NCT38XX series chipsCHLin2019-07-244-0/+240
| | | | | | | | | | | | | | | | | | | Nuvoton TCPC NCT38XX series chips have some pins which can be used as GPIO function. we can treat it as the IO expander chip also. This commit adds the driver to support it. BRANCH=none BUG=none TEST=No error for "make buildall" TEST=Apply this and related CLs, manually test each API, make sure each function works correctly with NCT3807 and NCT3808 at the same time. Change-Id: I2254c2e867445e55d1c261172e4b7175d22f28ef Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1657859 Commit-Queue: CH Lin <chlin56@nuvoton.com> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver/tcpm: block bad config combinations at compile timeTing Shen2019-07-243-0/+13
| | | | | | | | | | | | | | | | | The unimplemented fields in tcpm_drv may cause ec jumping into some undefined address. Prevent this happen by checking flags at compile time. BUG=None TEST=make buildall -j BRANCH=master Change-Id: I68f47cdc34046e7551f00f72267850b4f0464200 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1710211 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* isl923x: Fix console messagesDaisuke Nojiri2019-07-241-3/+4
| | | | | | | | | | | | | | | | | | This patch fixes how the console messages in isl923x.c are printed. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I81cd1fc9f0a20a4908013b7b3051fc23953eefc2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1670699 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* isl923x: Check max current in isl923x_set_ac_prochotDaisuke Nojiri2019-07-242-14/+16
| | | | | | | | | | | | | | | | | | | | | The ACProchot register takes a value in multiple of 128 up to 6400 mA. This patch makes isl923x_set_ac_prochot return error when a value exceeding the max is passed. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/130387567 BRANCH=Nami TEST=buildall Change-Id: I1854f091d6ee7eb042fefeff35094abeca452c2f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1669796 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* charger/rt946x: notify AC_CHANGE when ext power plugged/unpluggedYilun Lin2019-07-221-0/+3
| | | | | | | | | | | | | | | | | Support hooking on AC_CHANGE when external power plugged and unplugged. BUG=b:137903027 TEST=on kukui, shutdown -h now, and plug power adapter on kukui, and see battery LED turning on immediately, and also see console prints "AC on" BRANCH=master Change-Id: I6e2704cfe2d3ed09cc6e1c76b8d03a5030a400ed Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1712400 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-20120-774/+765
| | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* drivers/tcpm/ps8xxx: Return hardcoded vendor and product idKarthikeyan Ramasubramanian2019-07-201-0/+5
| | | | | | | | | | | | | | | | | | When the requester does not expect the chip information from the live target, return the hardcoded vendor and product id. BUG=b:128820536,b:119046668 BRANCH=None TEST=Boot to ChromeOS Change-Id: I74affb00951411a3483258a8db165038e7eb683f Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1617894 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Auto-Submit: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* ec_commands: Rename 'renew' to 'live' in EC_CMD_USB_PD_CHIP_INFOKarthikeyan Ramasubramanian2019-07-206-13/+13
| | | | | | | | | | | | | | | | | | | | | | Semantics of renew field in EC_CMD_USB_PD_CHIP_INFO is changing as follows: 0 -> Return hard-coded info for Vendor ID/Product ID and cached info for the Firmware Version 1 -> Return the live chip info for Vendor ID/Product ID/Firmware Version Also rename the 'renew' field to 'live' to match the new semantics. BUG=b:128820536,b:119046668 BRANCH=None TEST=make -j buildall; Boot to ChromeOS. Change-Id: Ie3dd022336b0be5c9728bb0ebabef32b7a6b5d57 Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1617893 Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Karthikeyan Ramasubramanian <kramasub@chromium.org> Auto-Submit: Karthikeyan Ramasubramanian <kramasub@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-19121-884/+1179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver/tcs3400: make error message in sensor read less spammy.Ting Shen2019-07-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | In EMULATED_IRQ_EVENT mode, we try to estimate the time between a read request and data ready. If the estimated time is shorter, an error message is printed to the console on every retry. On Kukui, this caused ec console spamming one line per second. Change the behavior to print only when returning error. No need to adjust the estimate time because one retry per read is still good enough. BUG=b:137345336 TEST=manually, verify that error message disappeared. BRANCH=None Change-Id: Ie85e8f1a80ea36ca5c50f57a19eba35f3f79f86d Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1697889 Tested-by: Fei Shao <fshao@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: remove CONFIG_SMBUS dead codeDenis Brockus2019-07-171-20/+0
| | | | | | | | | | | | | | | | | CONFIG_SMBUS is not used. Cleaning up the code by removing this. Added a comment to document the removal and why. This will give a way to find the code if we ever needed to bring it back BUG=chromium:982316 BRANCH=none TEST=make buildall Change-Id: I40703a95bc849538e1aee32f6f96beab811285bd Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704279 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cleanup: refactor CPRINTF("[%T ...]\n") to CPRINTSJack Rosenthal2019-07-174-15/+14
| | | | | | | | | | | | | | | | Looking at where the non-standard %T printf modifier is used in EC codebase, the majority is cases where CPRINTS could have been used instead of CPRINTF. This is a somewhat-mechanical refactor of these cases, which will make implementing a standard printf easier. BUG=chromium:984041 BRANCH=none TEST=buildall Change-Id: I75ea0be261bfbfa50fb850a0a37fe2ca6ab67cb9 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1703128 Reviewed-by: Evan Green <evgreen@chromium.org>