summaryrefslogtreecommitdiff
path: root/driver
Commit message (Collapse)AuthorAgeFilesLines
* tusb1064: Add full list of possible I2C device addressesScott Collyer2021-03-241-1/+24
| | | | | | | | | | | | | | | | | | The TUSB1064 has 16 possible I2C device addresses. This CL adds this full list to the tusb1064.h file. In addition, the TUSB1064 device address was updated to match the new macro. BUG=b:168621142 BRANCH=servo TEST=make -j buildall Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I1ee836ef0a88adab1af63901c2ec0be7cef7b232 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267630 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: DT: support TCS3400Hyungwoo Yang2021-03-241-0/+20
| | | | | | | | | | | | | | | | | | This change is to support TCS3400 via DT. The change includes, using DT, - creating TCS3400 driver specific data - creating motion sensor entry for TCS3400 - creating the TCS3400 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I09cb7d69baa95c8450c7f5cc0149038aa23f3bc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778822 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support BMI260Hyungwoo Yang2021-03-241-0/+20
| | | | | | | | | | | | | | | | | | This change is to support BMI260 via DT. The change includes, using DT, - creating BMI260 driver specific data - creating motion sensor entry for BMI260 - creating the BMI260 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Id5c64df4d2f14a50709ac15855567a67671b8515 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778821 Reviewed-by: Simon Glass <sjg@chromium.org>
* isl923x: change control1_mutex to use K_MUTEX_DEFINEJack Rosenthal2021-03-231-2/+1
| | | | | | | | | | | | | | Convert control1_mutex to use K_MUTEX_DEFINE(), removing the requirement for runtime initialization on Zephyr. BUG=b:177677037 BRANCH=none TEST=zmake testall && make buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I4aa0cba73e4283d6050ddbe46bda542788bcab0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782238 Reviewed-by: Simon Glass <sjg@chromium.org>
* isl9241: change control1_mutex to use K_MUTEX_DEFINEJack Rosenthal2021-03-231-4/+1
| | | | | | | | | | | | | | Convert control1_mutex to use K_MUTEX_DEFINE(), removing the requirement for runtime initialization on Zephyr. BUG=b:177677037 BRANCH=none TEST=zmake testall && make buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I7a24cc23855dc6884ed891ebee7e337821524d9a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782237 Reviewed-by: Simon Glass <sjg@chromium.org>
* Create a public header for isl923xSimon Glass2021-03-232-41/+5
| | | | | | | | | | | | | | | | 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:183296099 BRANCH=none TEST=make BOARD=lazor -j4 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I54506ef17ecda2683f1c1a933f1978df458e08ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774916 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* charger: Update BQ25720 configsCaveh Jalali2021-03-221-0/+1
| | | | | | | | | | | | | | | | | This updates how we select between the BQ25720 and BQ25710 charger chips. The BQ25720 charger chip can now be enabled without enabling the BQ25710 charger chip. Both chips are still supported by the same driver and the choice of BQ25720 vs. BQ25710 remains a compile time configuration. BRANCH=none BUG=b:180980490 TEST=buildall passes Change-Id: If632af0b68d8cf73e5c2436a05b1641e4467d8f8 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774701 Reviewed-by: Keith Short <keithshort@chromium.org>
* Coachz: Change stylus detection interval from 100 to 500 mshanwenchao2021-03-221-1/+1
| | | | | | | | | | | | | | | | | | EE confirmed detection interval from 100 to 500 ms, power consumption reduce to 11 mW from 26 mW. But the pen detection time becomes longer. BRANCH=trogdor BUG=b:181359593 TEST=check the stylus detection Signed-off-by: hanwenchao <hanwenchao@huaqin.corp-partner.google.com> Change-Id: I9c2f9f6def4ccf18bc06f1f628cda73be051f91c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2721321 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: ln9310: move ln9310.h header to include/Jack Rosenthal2021-03-202-189/+1
| | | | | | | | | | | | | | | Move driver/ln9310.h to include/driver/ln9310.h so this header can be readily included from Zephyr builds. BUG=b:183054226 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I47c1d8dc8af90c690639ef1621cc66a9946ba40b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776220 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* driver: ln9310: use CC_I2C for loggingJack Rosenthal2021-03-201-3/+3
| | | | | | | | | | | | | | | | | | CC_CHIPSET is only available if the chipset task is enabled, but the ln9310 has no other dependencies on power sequencing. Bringup may require this driver to be enabled before power sequencing. It makes more sense to log to the I2C channel, since we communicate with this chip on I2C. BUG=b:183054226 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3b040c88613be6075a834c6758b79965ab88fd76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776219 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* ctn730: Make reset pulse 15 usecDaisuke Nojiri2021-03-181-1/+6
| | | | | | | | | | | | | | | | | | | This patch changes the reset pulse from 1 msec to 15 usec. The datasheet says the minimum reset pulse length is 10 usec. This is better not to be a sleep especially if it's long (e.g. ~1 ms) since the PCHG state machine may try to access the I2C bus, which is held low by ctn730 during reset. BUG=b:173235954 BRANCH=trogdor TEST=Stylus connect, disconnect, charge events are triggered as expected. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ibe611b32bd0f88ad875b24c38bbea577d8d4ec10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2770505 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* PCHG: Support reset to firmware update modeDaisuke Nojiri2021-03-181-19/+59
| | | | | | | | | | | | | | | | | | | | | | | This patch allows a charger chip to reset to firmware update mode (a.k.a. download mode). Actual firmware update will be added in a separate patch. Currently, a reset event causes the state machine to unconditionally transition to normal mode. This patch makes the state machine check 'mode' field in the context to decide whether it transitions to normal mode or not. This patch also makes ctn730 driver explicitly return PCHG_EVENT_*_ERROR while PCHG_EVENT_NONE was returned previously. BUG=b:173235954 BRANCH=trogdor TEST=Stylus connect, disconnect, charge events are triggered as expected. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I10dbd25d0b3d5284952e57d4ade2949e9594c8d1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2770503
* isl9241: Add devicetree property for switching frequencyKeith Short2021-03-171-12/+4
| | | | | | | | | | | | | | | | Update the isl9241 driver to support overriding the charger switching frequency using a devicetree property. BUG=b:182300938 BRANCH=none TEST=make buildall, zmake testall TEST=Boot zephyr-ec on volteer, verify ISL9241 charging frequency via register dump. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ic1c3bb24b79ae6e10082cdb79bdb9edc327064a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2754489 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* board/lazor: Move enum definition before its useTom Hughes2021-03-161-7/+0
| | | | | | | | | | | | | | | | board/lazor/board.h:121:6: error: ISO C++ forbids forward references to 'enum' types enum battery_cell_type board_get_battery_cell_type(void); ^ BRANCH=none BUG=b:144959033 TEST=none Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Id2abde06326a0fe9297b98127aa7ef6768ce1479 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2740564 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ucpd: Add support to turn off type-2 BIST modeScott Collyer2021-03-161-0/+15
| | | | | | | | | | | | | | | | | | | This CL adds changes to the ucpd driver to support turning off BIST mode once it's been started. For ucpd, the peripheral has to be disabled and reset for this purpose. BUG=b:182436876 BRANCH=None TEST=Verfied that honeybuns can pass TDA.2.1.1.1: BMC-PHY-TX-EYE compliance test, which previously was failing because BIST type-2 mode was not being stopped. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ib6aa898ef5727dd5887e5d1c0b2eee94fdb366b3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751328 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* virtual_battery: bug fix in reading SB_AVERAGE_CURRENTIkjoon Jang2021-03-151-1/+3
| | | | | | | | | | | | | | | Fix a bug from CL:2747559, virtual battery returns an error for SB_AVERAGE_CURRENT. virtual battery handler should call battery_get_avg_current(), not battery_get_avg_voltage(). BRANCH=none BUG=b:170921599 TEST=read current_avg knob in kukui Signed-off-by: Ikjoon Jang <ikjn@chromium.org> Change-Id: I90c26a8e1d4fa6faccc0166b9f7b63fca9baef51 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751320 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* charger: Add new APIs for measured charge valuesAseda Aboagye2021-03-112-22/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the charger ICs can provide measurements for the charge voltage and the charge current. This information is needed by the OCPC module. Previously, the charge_get_current() and charge_get_voltage() functions were modified to provide this information. However, those functions are intended to provide the set voltage and current targets for the charger IC. This commit adds a new set of APIs, charge_get_actual_current() and charge_get_actual_voltage() which provides the actual charge current and voltage if the charger IC is able to provide that information. BUG=b:182018616 BRANCH=dedede TEST=Build and flash madoo, verify that `charger` EC console command shows the set current and voltage targets instead of the measured values. Check that the `chgstate` command shows the measured values for use with the OCPC module. TEST=Verify that charging from the sub board works. TEST=Verify that resistances are still calculated and seem reasonable. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: I82565d18908d9ea0f54934787897937488e280e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2750866 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org>
* isl923x: Fix the calculation formula in raa489000_get_input_current()Raymond Chung2021-03-111-2/+3
| | | | | | | | | | | | | | | | The adapter current value is in 22.2mA increments. So must be fix calculation formula. IADP = (222 * ADC_value) / 10 BUG=None BRANCH=None TEST=make BOARD=sasuke Signed-off-by: Raymond Chung <raymondchung@ami.corp-partner.google.com> Change-Id: I4124e2a9e3c95e1b07060cbac766197886210e8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751316 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* Raa489000: Set Vbus Target Voltage lowerMike Lee2021-03-102-1/+2
| | | | | | | | | | | | | | | Set Vbus Target Voltage lower,so that meet power noise test. BUG=b:181801175 BRANCH=dedede TEST=test power noise pass, meet spec 4.75V--5.25V Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Change-Id: I7aa137b37acc678dfbba76d8e72733b8196f8c41 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2745181 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* RT1715: Reset on EC reboot instead of POREric Herrmann2021-03-091-7/+6
| | | | | | | | | | | | | | | | | | | | Currently we reset the RT1715 only when it is coming out of power-down mode; however this requires explicitly putting it into power-down mode or a full power cycle. An EC reboot will not power cycle the TCPC though, and we really should be doing the reset following an EC reboot. Do a soft_reset the 1st time we initialize the TCPC following an EC reboot. Don't check the power-down bit. BUG=b:179234089 TEST=Write to unused vendor registers such as 0x99; check that the values are reset when "reboot" is used to reset the EC. BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: I0cc05ac88ec1314c20ceb357605156292b57b7c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2698779 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* PCHG: Handle reset eventDaisuke Nojiri2021-03-091-1/+10
| | | | | | | | | | | | | | | | | | | | Currently, PCHG assumes PCHG chips are reset only on POR and ignores reset events. This can cause the state machine to be in an unexpected state when a reset happens asynchronously. This patch allows PCHG to handle chip reset events. It also makes the task explicitly reset PCHG chips at start-up so that everything will start in known & clean states. BUG=b:181745891,b:181036152,b:173235954 BRANCH=trogdor TEST=Verify PCHG behaves expectedly across cold reset, warm reset, suspend & resume. Repeat the test with and without stylus. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ia3dd1fe7ebc8dd6f4ee8149a4c25918922143fc3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2741282 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* driver/tcs3400: code cleanups for custom equationZick Wei2021-03-081-6/+11
| | | | | | | | | | | | | | | | | | This patch make tcs3400_translate_to_xyz() to overridable, let board could custom their own equation. BUG=b:176671564 BRANCH=None TEST=make BOARD=dooly Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ia475e03b995223575f9e3ff106bc12a406062c9b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2738582 Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
* delbin: Setting charger switching frequency to 724kHz.Michael5 Chen12021-03-082-0/+34
| | | | | | | | | | | | | | | Setting charger switching frequency to 724kHz. BUG=b:180779740 BRANCH=volteer TEST=manual 1. Check charger register 0x3C 2. Check waveform Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I97512742dfc778c22615f8385fbe1fecf5ff2d7b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2719786 Reviewed-by: Keith Short <keithshort@chromium.org>
* RAA489000: Clear debug accessory state on initDiana Z2021-03-041-0/+15
| | | | | | | | | | | | | | | | | | | | | | During our first boot, clear out any residual state left from past debug accessory connections. In most cases, the TC state machine or PD task init can set open in order to ensure the TCPC doesn't get wedged. However, there is still a lingering corner case when the EC is reset through the security chip on ITE platforms. Always set open during init if we have the power to survive it to catch this case. BRANCH=None BUG=b:177870522 TEST=on galtic, run refresh+power resets with servo_v4 sink plugged in and verify the port does not become stuck. Also run refresh+power resets with a charger and hub plugged in to verify they connect fine after the reset. Also verify battery-less boot still works Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia25959cae4d42163ac03280a319d785193e29422 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2733916 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* bb_retimer: Fix port bounds checkCaveh Jalali2021-03-041-1/+1
| | | | | | | | | | | | | This fixes a bounds check in the 'bb' command argument parsing. BRANCH=none BUG=none TEST=EC no longer resets when triggering the off-by-one error Change-Id: I4ff459781c047b3899150485b7fd3fe6363bdec3 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2730521 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* charger: Add support for the TI BQ25720Caveh Jalali2021-03-042-6/+34
| | | | | | | | | | | | | | | | This adds support for the BQ25720 charger using the BQ25710 driver. The only significant difference between the two chips is that the VBUS voltage register encoding has changed. The scale changed from 64mV to 96mV and there is no DC offset. BRANCH=none BUG=b:180980490 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I9ab6e066a4dec93a0ede0c22ff21b240a5021cbf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2717805 Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv1/v2: Move SOP' enabling to tcpm_set_vconnEric Herrmann2021-03-041-6/+0
| | | | | | | | | | | | | | | | | Currently SOP' enabling is done as part of the TCPCI driver when vconn is set - however if we aren't using VCONN from the TCPC, we need to enable SOP' separately. So, instead of enabling it in the TCPCI driver, enable it in the general TCPM set VCONN function. BUG=b:181692098,b:181691263,b:173459141 TEST=Make sure cable discovery works TEST=make buildall BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: Iecc06760f2b8af588c427b9565c6aa31ee719edf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2733574 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* BB retimer: Do not need B16 to be set for USB4 modeAyushee Shah2021-03-021-12/+0
| | | | | | | | | | | | | | Retimer bit16 is don't care for USB4 mode, so do not update it BUG=None BRANCH=None TEST=Tested on voxel, USB4 enumerates fine. Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: I4e161542cd6eeda5b595cf3c071aafe71b8754cb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2719197 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* cleanup: rename ite tcpm driverRuibin Chang2021-02-262-3/+5
| | | | | | | | | | | | | | | | Rename it83xx_tcpm_drv to it8xxx2_tcpm_drv for chip it8xxx2 series. BUG=none BRANCH=none TEST=1.make buildall -j 2.on hayato, connecting to adapter and dongle can go to ready state. Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: I2622e7fe0884d3ae20a63ec48219de00d5537bc6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2717430 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>
* driver/it83xx, it8xxx2: turn on PD BMC PHY for TCPMv1Ruibin Chang2021-02-262-10/+42
| | | | | | | | | | | | | | | | | | | | If explicit contract is set in bbram when EC boot up, then TCPMv1 set soft reset as first state instead of unattached.SNK, so we need to enable BMC PHY for tx module. And same as TCPMv2, we turn on/off BMC PHY and set low power mask when hook_dis/connect is called. BUG=none BRANCH=none TEST=on icarus, the explicit contract is set in bbram when EC boot up, and we can tx soft reset (won't happen tx timeout). Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw> Change-Id: I3c8d3db240d2290ced17b90aeb0420ac9f20598d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2712213 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>
* driver: tcs3400: Check for device status only onceGwendal Grignou2021-02-251-28/+31
| | | | | | | | | | | | | | | | | | Since ASIEN (interrupt on ALS saturation) and ALS threshold interrupts are disabled, we can only get interrupt on RBGC cycle read. Therefore, when using the interrupt, not need to check if RGB data is ready in post_events(). Only check while in force mode. Remove recheck when accounting for saturation. BUG=b:177860358 BRANCH=kukui,hatch,puff,volteer TEST=compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I7fc419a98828b9b188849e04a15cfefaf9e96c8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572739 Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
* driver: icm426xx: discard first data instead of sleepingJean-Baptiste Maneyrol2021-02-253-22/+98
| | | | | | | | | | | | | | | | | | | | Sleeping when turning a sensor on/off is problematic when the other sensor is running. Replace sleeping by discarding first events until sensor is stabilized. BUG=chromium:1175757 BRANCH=hatch,nami,kukui,dedede,grunt,zork,octopus,volteer TEST=turn sensor on/off when the other is running using cros-ec iio devices Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Change-Id: I61801970b12f9fbdcc2cd96cb4df1edae5ed521f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2682715 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org>
* driver: icm426xx: change accel oscillator to RC clockJean-Baptiste Maneyrol2021-02-252-1/+11
| | | | | | | | | | | | | | | | | | | When using accel low-power with WakeUp oscillator, turning gyro on switch directly to PLL mode and provokes glitch on ODR. Use RC clock oscillator for accel low-power to avoid this glitch. BUG=chromium:1175757 BRANCH=hatch,nami,kukui,dedede,grunt,zork,octopus,volteer TEST=turn gyro on when accel is running using cros-ec iio devices and check that odr stays consistent. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Change-Id: I51435eb9533a1fa16bf695e468854156c16d3296 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2679700 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org>
* driver: icm426xx: update odr before turning sensor onJean-Baptiste Maneyrol2021-02-251-10/+10
| | | | | | | | | | | | | | | Prevent to have the first event in 1 ODR and the second in another. BUG=chromium:1175757 BRANCH=hatch,nami,kukui,dedede,grunt,zork,octopus,volteer TEST=turn sensor on/off and change odr using cros-ec iio devices Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Change-Id: I501bf14e70fd7180c7e68385ef4afb5934d7d37a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2679699 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org>
* RAA489000: Rearrange inits to sink Vbus fasterDiana Z2021-02-241-35/+37
| | | | | | | | | | | | | | | | | | | | | In order to more quickly detect and sink Vbus, move up the priority on enabling the Vbus ADC and checking our Vbus status to enable sinking. Additionally, gate this enablement on the battery not being capable of supporting the board to prevent premature Vbus sinking in normal use-cases. BRANCH=None BUG=b:178981107,b:178728138 TEST=on storo and sasukette, confirm board can boot with no battery and TCPC works as expected On galtic, confirm sinking is enabled on a no-battery boot but not automatically enabled with a charged battery attached Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I26eec09c2fa50d2425c5d6b0ef7b8847bd570da7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2715596 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* COIL: Rename GT7288 address defineDiana Z2021-02-241-3/+3
| | | | | | | | | | | | | | Rename GT7288 address definition to match current I2C naming conventions. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ief917ff36510150d2a6ea03875d6e95dcb57c350 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2697857 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* COIL: Rename MP4245 address defineDiana Z2021-02-241-12/+12
| | | | | | | | | | | | | | Rename MP4245 address define used in the driver. Note this driver is not currently in use by any boards. BRANCH=None BUG=None TEST=set up madoo with CONFIG_MP4245 and I2C defines, build Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I8cf55ac113c9dd3e7b4e46a7d047be85193aa626 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2697856 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* COIL: Rename ioexpander i2c address variableDiana Z2021-02-244-21/+21
| | | | | | | | | | | | | | Rename ioexpander i2c address to match current conventions and update any calling locations. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iddad457f73d0dd0167496b794c00e274f8985615 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2697855 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* BB Retimer: Cleanup setting USB4 speedAyushee Shah2021-02-231-13/+5
| | | | | | | | | | | | | | In the retimer_set_state_dfp() function, return either the USB4 speed or Thunderbolt speed depending on the mux setting BUG=None BRANCH=None TEST=make buildall -j Change-Id: I725386d7d23d50637b46b389082d369b09b4df66 Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2682840 Reviewed-by: Keith Short <keithshort@chromium.org>
* ln9310: set min. freq above audible rangeJohn Crossley2021-02-232-0/+7
| | | | | | | | | | | | | | | | | Set the minimum switching frequency to 25 kHz to avoid the audible frequency band. BRANCH=Trogdor BUG=b:180886790 TEST=In IDLE mode check that LN9310 switching freq. stays above the audible frequency range. Change-Id: Ia609fd002e34b6bc684385ceb8405fe84a447ae7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633442 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* tca64xxa: Add new ioexpander driver for TI TCA64xxA modulesMichał Barnaś2021-02-233-0/+252
| | | | | | | | | | | | | | | | | | | Add TI TCA64xxA (TCA6416A, TCA6424A) series driver that conforms to ioexpander_drv interface. Driver supports 16- and 24-bits versions and is configured by flags field in ioex_config (TCA64XXA_FLAG_VER_TCA6416A, TCA64XXA_FLAG_VER_TCA6424A). BUG=b:168385201 BRANCH=main TEST=Add 'CONFIG_IO_EXPANDER_TCA64XXA' to any board.h Execute make to any board, ioexpander/tca64xxa.c should be visible in compiled files list Signed-off-by: Michał Barnaś <mb@semihalf.com> Change-Id: I5ca27df3802d900c9967684403f29c33abd96f18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2700296 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* guybrush: Add ANX7451 mux/retimer driverRob Barnes2021-02-233-0/+130
| | | | | | | | | | | | | | Add basic support for ANX7451. Datasheets available in bug. Support for tuning can be added later if needed. BUG=b:179065240 BRANCH=None TEST=Build Change-Id: Ifafdec4412b73b0fd3f7de2131a8617bbfde6426 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2699667 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Virtual mux: Set disconnect latch flag only in s3/s0ixAyushee Shah2021-02-221-2/+4
| | | | | | | | | | | | | | | | | | | | | When the AP comes up after G3 and since the disconnect flag is set, EC sends disconnect info to the AP probe functions. But the DUT is still in low power mode thus the AP doesn't receive the current mux state hence enumeration of USB4/TBT device fails when hotplugged at G3. This CL ensures that disconnect flag is only set in chipset suspend states i.e. s3 and s0ix BUG=b:180377259 BRANCH=None TEST=Connected USB4 device connect in G3 and checked enumeration Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: I6992c528c7c39bf604d4e305b362ef04bc3c100e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2705561 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* raa489000 : change VBUS_CURRENT_TARGETYongBeum.Ha2021-02-211-2/+2
| | | | | | | | | | | | | | | set VBUS_CURRENT_TARGET to promised value + iOvershoot to cover overshoot BUG=b:178064507 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I22b9e2df9389b6f047d1aecc3e03df8fba06dc2b Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2670605 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Henry Sun <henrysun@google.com>
* bq25710: Allow compilation with CHARGE_RAMP_SWCaveh Jalali2021-02-191-0/+2
| | | | | | | | | | | | | | | | The bq25710 driver supports compiling without CHARGE_RAMP_HW enabled, but the exluced functions are still referenced from the driver's struct charger_drv. So, make these references conditional on CHARGE_RAMP_HW as well. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I8737c1eb465c82b5d004b778d7e80ba296742664 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2700312 Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* RT1715: Enable power saving modesEric Herrmann2021-02-172-33/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The RT1715 implements its own low-power mode (LPM) to save power. Switch from using the default I2CIdle LPM to using the RT1715-specific one. Disable the 24MHz oscillator in LPM, and enable the interrupt to wake from LPM. For interrupts, clear the WAKEUP interrupt before checking the TCPCI interrupts. Enable auto-idle to save power with a device connected. Disable when the TCPC is sourcing Vconn. BUG=b:179256608 TEST=On Voxel: while no device attached, make sure both SNK and SRC devices wake up the TCPC from LPM TEST=On Voxel: with no devices connected, measure fake G3 power consuption and make sure it has decreased TEST=On Voxel: with a pass-through hub configured as a sink, check that connecting a charger will prompt Voxel to begin charging TEST=make buildall BRANCH=None Change-Id: Ifb2fa5a7940e5862e217c04c5c1082aae6b43989 Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2676934 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* nb7v904m : Add function to control Loss Profile MatchingYongBeum.Ha2021-02-172-0/+39
| | | | | | | | | | | | | | add function to control Loss Profile Matching BUG=b:176862264 BRANCH=None TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I5b4d0ff444c07c477add101fac05d33694a33982 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2684080 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* nb7v904m : add function to control aux channelYongBeum.Ha2021-02-172-0/+11
| | | | | | | | | | | | | Add function to control aux channel BUG=b:179624712 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I0dd474b52ee9058bfed3c7caec07e691d41f84dc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2699468 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* nb7v904m : add config to disable LPMYongBeum.Ha2021-02-172-0/+11
| | | | | | | | | | | | | | Add config to disable LPM BUG=b:179624712 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: I6ae0d08709fe0799843b6e225b480ffa617dfe84 Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2684075 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* PCHG: Get SOC proactively when device is detectedDaisuke Nojiri2021-02-121-3/+27
| | | | | | | | | | | | | | | | | This patch makes PCHG send CHG_CTRL_CHARGING_INFO_CMD when a stylus is detected. This will allow the EC to report 'full' to the host even if charging doesn't start (because the stylus is already charged). BUG=b:179390065,b:173235954 BRANCH=trogdor TEST=CoachZ. Re-attach charged stylus and verify PCHG_STATE_FULL is reported. Change-Id: Id8578e2d3d21294fb08a21933f12ecee7f2bd062 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691729 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>