summaryrefslogtreecommitdiff
path: root/driver/charger
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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-2016-48/+48
| | | | | | | | | | | | | | | | | | | 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>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-1916-52/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* isl9241: Enable support for hardware charge rampVijay Hiremath2019-07-022-0/+66
| | | | | | | | | | | | | | | | | | The input voltage regulation register 0x4B contains the voltage limit at which the input voltage loop tries to regulate when the input voltage is dropping. When the ADP is browning out or weak, the input voltage can droop and the input voltage loop tries to regulate to this setting by reducing battery charging current and then system power to try to hold up the input voltage. BUG=b:136198519 BRANCH=none TEST=Able to verify BC1.2 charge ramping on INTELRVP Change-Id: I0f712215c9323a75de71342d5ae5341c3e4e1fa6 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1672211 Reviewed-by: Jett Rink <jettrink@chromium.org>
* Nami: Add Adapter PROCHOT SettingKo2019-06-202-0/+24
| | | | | | | | | | | | | | | Currently, we use default current, 3.072A for adapter current PROCHOT# threshold, add higher prochot current to improve performance on Nami. BUG=b:130387567 BRANCH=Nami TEST=Verify Nami ac prochot set to 0XD00 (3328mA) during initial. Change-Id: Iee23920b3fd3ee76d3d12716d6381062183413cc Signed-off-by: Ko <ko_ko@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1628631 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-1914-14/+14
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* krane: Enable BC12 detection with gpio controlled.Yilun Lin2019-06-171-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support CONFIG_BC12_DETECT_POWER_ROLE_TRIGGER. Krane's BC12 detection is controlled by GPIO_BC12_DET_EN by disconnecting USB-PHY, that is: - Assert GPIO_BC12_DET_EN, then USB-PHY is disconnected - Deassert GPIO_BC12_DET_EN, then USB-PHY is connected. The current usb_chg_task will make USB devices not be enumerated, since GPIO_BC12_DET_EN is deasserted only when VBUS attached and BC12 device identified. However, peripherals won't trigger BC12 detection so GPIO_BC12_DET_EN always asserted. To fix this problem, we trigger BC12 detection only when a port is attached and hook USB_PD_CONNECTED to toggle BC12 detection. We have to - Assert GPIO_BC12_DET_EN on SRC device plugged to recognize BC12 charger. - After BC12 device detected, we have to disable BC12 to connect USB-PHY back for enumerating USB devices. - Deassert GPIO_BC12_DET_EN on SNK device plugged to enumerate USB devices. TEST=Test with https://crrev.com/c/1408751/1, and see it is able to recognize Apple 2.4A charger and 5V2A DCP charger. TEST=Boot w/ USB hub plugged (w/ and w/o external BC1.2 charger on the hub) and see USB devices are enumerated. BUG=b:122866184 BRANCH=None Change-Id: I5b3362305361c0c950288fc83072e9bc79082c08 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1575050 Tested-by: Yilun Lin <yllin@chromium.org> Auto-Submit: Yilun Lin <yllin@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org>
* rt946x: Add API for backlight LED dim.Yilun Lin2019-06-172-0/+36
| | | | | | | | | | | | | | | | Add mt6370_backlight_set_dim() for setting backlight LED dim. TEST=None BUG=b:133655155 BRANCH=None Change-Id: Ia5b80734f72c6fb8750c33f62133fc1cdd71f213 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1635137 Tested-by: Yilun Lin <yllin@chromium.org> Commit-Queue: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Yilun Lin <yllin@chromium.org>
* charger/rt946x: Support software ramping API.Yilun Lin2019-06-121-1/+14
| | | | | | | | | | | | | | | | | | Add usb_charger_ramp_allowed() and usb_Charger_ramp_max() API. Also, targets DCP ramping voltage to 2000mA(charger support maximum is 3500mA), a conservative value to prevent a bad charger. TEST=With CL:1610385, plug a DCP 5V/2.1A charger and see it ramps and drains up to 1.75A, rather than original 1.34A. BUG=b:131284131 BRANCH=None Change-Id: I1e87badbca8991862186fc37227d203cfb54bce3 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1633930 Commit-Queue: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* Flapjack: Trigger BC12 detection when AC charger is pluggedDaisuke Nojiri2019-06-102-0/+18
| | | | | | | | | | | | | | | | | | | | | | Currently, when a BC12 charger is plugged while wireless charging is taking place, rt946x does not trigger detection because VBUS is already supplied. This makes charge_manger see a BC12 charger as a WPC supplier. This patch makes EC manually trigger BC12 detection when an AC charger is plugged. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/127228934 BRANCH=none TEST=Start charging on WPC. Connect a BC12 charger. Verify the supplier switches to DCP (1.5A @5V). Change-Id: I8e3439682515bf2241f6756a5386a7ad3ab2e14c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1593742 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* charger/rt946x: Add display bias API mt6370_db_set_voltages.Yilun Lin2019-06-032-4/+84
| | | | | | | | | | | | | | | | | | | | Add mt6370_db_set_voltages to control VBST, VPOS, and VNEG. TEST=Test with CL:1632132 on krane: i2cxfer r 0 0x68 0xb1; see output 0x36 i2cxfer r 0 0x68 0xb2; see output 0x68 i2cxfer r 0 0x68 0xb3; see output 0x64 i2cxfer r 0 0x68 0xb4; see output 0x64 BUG=b:125644770 BRANCH=None Change-Id: Ia66ba91a2af3a651a71195dd8a2d531bf1ba06e9 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1613257 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* charger/rt946x: Keep backlight in linear modeNicolas Boichat2019-05-222-1/+10
| | | | | | | | | | | | | | | | | | | | | Backlight BLEN register default (and desired) setting is to keep backlight in linear mode ('1'), do not clear that bit when enabling the backlight. There is one more bit in the register (bled_config), but for that one, the default active low setting is correct. BRANCH=none BUG=b:132225489 TEST=Boot krane with software sync disabled, see that default backlight is reasonable. Change-Id: I2e8867ee6d39e2c5eabe64719105e8f463dec2a7 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1621645 Tested-by: Fei Shao <fshao@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Yilun Lin <yllin@chromium.org>
* bq25710: Allow IDCHG to be used as a prochot triggerScott Collyer2019-05-212-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kohaku units are currently using a 2S+1P battery back which is not able to provide sufficient power for peak CPU load when running on battery only. The bq25710 has various triggers for prochot and one of those is IDCHG (battery discharge current). This CL adds a new config option CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA to enable this feature in the bq25710. For prochot to be active, the bq25710 must remain in performance mode. Chispet hooks are used to request the bq25710 in/out of performace mode when the IDCHG prochot feature is active. BUG=b:132285560 BRANCH=none TEST=Manual Connected wires to VBAT, PPVAR_SYS, PROCHOT_ODL signals and had a current probe connected to measure IBAT. Verfied that without this CL, VBAT shuts off when IBAT spikes. With this CL, then verified that prochot gets asserted whenever the current spikes to values specified by CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA. In addition verified that with this CL, the system can successfully boot and remain powered on even as CPU load gets increased. Change-Id: If13d16f561b76289936d0d75a2b984d2b71b3c37 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1613797 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
* bq25710: Adjust settings to limit VSYS droop with no batteryScott Collyer2019-05-172-7/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When there is no battery present VSYS is set to the value defined in register 0x3E. The reset value of this register is based on what type of battery pack is used. In addition to this, big core systems such as CML can a peak power draw that exceeds the external USB PD adapters limit. This can lead to a VSYS collapse which then will cause the AP to sequence out of S0. This CL modifies 3 default settings for the bq25710 to reduce the likelihood of VSYS droop leading to the AP exiting S0. The primary change here is enabling prochot to be active when VSYS is operating within a threshold of VSYS_MIN. As mentioned above, in the no battery case, this will always be true which results in prochot being continuosly asserted. In addition, when a battery is present, but deeply discharged, prochot would be similarly asserted until the bq25710 exits its precharge state. In addition to the settings change, the reset register control bit is set at the beginning of the init routine to ensure that following EC resets the bq25710 always starts in the same state as it does following a power cycle event. BUG=b:130209125 BRANCH=none TEST=Verfied that when using both a 45W and 60W USB PD external charger that Hatch can boot successfully without a battery. In particular tested that without setting BQ25710_PROCHOT_PROFILE_VSYS hatch fails to boot successfully to the kernel, but does when this bit is set. Also with scope verified that prochot is continuosly asserted when there is no battery present. Change-Id: I450f735bca861baa5aae45af70fd8344a618f609 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1580184 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* charger/rt946x: Mask out display bias interrupt.Yilun Lin2019-05-121-0/+2
| | | | | | | | | | | | | | | | | Though there is display bias interrupt from mt6370, we don't need to handle this. Mask out the event. TEST=Connect a display and boot to AP, and see the BC1.2 work as expected. BUG=b:132401501 BRANCH=None Change-Id: I7e5eeb6b65890f65f67e535f0848ca289f452962 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1605665 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* charger/rt946x,krane: Enable backlight power.Yilun Lin2019-05-122-0/+29
| | | | | | | | | | | | | | | Krane's backlight power and PWM is controlled by mt6370. TEST=See the backlight is enabled on krane. BUG=b:131125903 BRANCH=None Change-Id: I9276a73d1a36e6b1eb64b39d7e9e988cda164ada Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1575051 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* bq25710: Add support for charger_dump commandFurquan Shaikh2019-05-091-0/+48
| | | | | | | | | | | | | | | | This change adds a debug command to dump all readable charger registers on bq25710. BUG=None BRANCH=None TEST=Verified that charger_dump command works on EC console. Change-Id: Ide4a39c6bb2a9410a3beb913aa6ebcb44919f844 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1566667 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* charger: Add basic driver code for ISL9241Vijay Hiremath2019-04-262-0/+467
| | | | | | | | | | | | | | | | | | The ISL9241 is a digitally configurable buck-boost battery charger that can support both Narrow Voltage Direct Charging (NVDC) and Hybrid Power Buck Boost (HPBB/Bypass) charging and switch between the modes using firmware control. BUG=b:131123775 BRANCH=none TEST=Able to boot intelrvp with charger & battery is charging Change-Id: If0736136778cbe7650ed7f03d04f4e011eedd1f6 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1579241 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* rt946x: Allow board customize initialization parametersDaisuke Nojiri2019-04-232-17/+24
| | | | | | | | | | | | | | | | | Currently, initialization parameters are fixed. This patch allows a board to customize how the chip is initialized. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/80482240 BRANCH=none TEST=buildall Change-Id: I0be0547d73de4d3f37e80e763efaf7840fd678c2 Reviewed-on: https://chromium-review.googlesource.com/1553564 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org>
* P9221: Add P9221 driverTony Zou2019-04-221-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds P9221 driver and enable it for Flapjack. The driver originates from https://android.googlesource.com/kernel /msm/+/android-msm-bluecross-4.9-pie-qpr1/drivers/power/supply/qcom /p9221_charger.c CQ-DEPEND=CL:1445133 CL:1551583 BRANCH=none BUG=b:126162615 TEST=Verify charging from PD and WPC as follows: 1. Charge with PD charger. Place DUT on WPC charger. -> PD charger continues to charge. 2. Unplug PD charger. -> WPC starts charging as GPP. 3. Plug PD charger. -> PD charger starts charging at 2A@9V TEST=Verify OTG and WPC functionality as follows: 1. Plug fan to USB port: -> Fan spins 2. Place DUT on WPC charger: -> WPC starts charging as GPP. Fan continues to spin. 3. Remove DUT from WPC charger: -> Fan continues to spin. 4. Do 1 and 2 then unplug USB fan: -> WPC starts charging. TEST=/sys/class/power_supply/CROS_USBPD_CHARGER0/usb_type is BrickID /sys/class/power_supply/sbs-12-000b/status is ok Change-Id: I5fbd0237cedd8095f98582c39973d432e733f2cd Signed-off-by: Tony Zou <zoutao@huaqin.corp-partner.google.com> Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1448193 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* common: bit change 1 << constants with BIT(constants)Gwendal Grignou2019-03-262-40/+40
| | | | | | | | | | | | | | | | | Mechanical replacement of bit operation where operand is a constant. More bit operation exist, but prone to errors. Reveal a bug in npcx: chip/npcx/system-npcx7.c:114:54: error: conversion from 'long unsigned int' to 'uint8_t' {aka 'volatile unsigned char'} changes value from '16777215' to '255' [-Werror=overflow] BUG=None BRANCH=None TEST=None Change-Id: I006614026143fa180702ac0d1cc2ceb1b3c6eeb0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-2613-250/+250
| | | | | | | | | | | | | | | | Requested for linux integration, use BIT instead of 1 << First step replace bit operation with operand containing only digits. Fix an error in motion_lid try to set bit 31 of a signed integer. BUG=None BRANCH=None TEST=compile Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* kukui: Enable MT6370 DB_POSVOUT/DB_NEGVOUTNicolas Boichat2019-03-122-0/+26
| | | | | | | | | | | | | BRANCH=none BUG=b:123669273 TEST=Boot kukui P2, panel AVDD/AVEE looks good Change-Id: Ie9b8780fdad6e061e967ebb127b27bf63a11db2f Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1482633 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* bq25710: Report VBUS as 0 when VBUS is too low to measurePhilip Chen2019-03-081-3/+7
| | | | | | | | | | | | BUG=b:124968142 BRANCH=none TEST=verify VBUS measurement via 'ectool usbpdpower' Change-Id: I1966537f394016706f96e975c7b54008ea8bfa33 Signed-off-by: Philip Chen <philipchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1509176 Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* bq25710: Disable VDPM-triggered PROCHOT by defaultPhilip Chen2019-03-062-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | PROCHOT_VDPM is triggered in every AC detach when VBUS drops. Ideally we may want to check the battery voltage when PROCHOT_VDPM is triggered. If battery voltage is not too low, we clear the flag and release PROCHOT pin. However, this PROCHOT profile isn't very useful for the case of AC detach, because EC already knows AC detach event from GPIO_AC_PRESENT pin and can check battery voltage then. PROCHOT_VDPM does provide finer-grained monitoring for VBUS, but before we come up with a good use of this profile, we may want to just disable this profile to prevent PROCHOT pin from being asserted in every AC detach. So let's disable PROCHOT_VDPM at charger initialization. BUG=b:123931545 BRANCH=none TEST=boot hatch and then unplug AC, verify bq25710 doesn't assert PROCHOT Change-Id: Icbbbb5572f26a450d0df92890d99fc216564a981 Signed-off-by: Philip Chen <philipchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1479872 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* bq25710: Add support for Vbus measurement by ADCPhilip Chen2019-03-012-35/+83
| | | | | | | | | | | | | | | | This CL factors out some existing ADC code to bq25710_adc_start() and then use it to implement charger_get_vbus_voltage(). BUG=b:124968142 BRANCH=none TEST=verify VBUS measurement via 'ectool usbpdpower' Change-Id: Ifd3108d459bef02acd20d6a6959fd586fc3a9ca6 Signed-off-by: Philip Chen <philipchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1479876 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* flapjack: Enable backlight channel for Flapjackstabilize-11839.Bstabilize-11839.3.BJessy jiang2019-02-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | flapjack requires to enable LED Bias to control LCD backlight. For C18 boards, three channels are required, and each channel has a current of 24 mA. For C19 boards, four channels are required, each channel having a current of 23.5mA. BUG=b:124465980 BRANCH=none TEST=1:)When the system boots, the backlight will light up. 2:)Use the ectool commands to check the channel and current. channle: ectool i2cread 8 0 104 0xA0 current: ectool i2cread 8 0 104 0xA5 If it's C18 board, get 0xfa in channel command and 0xc8 in current command. If it's C19 board, get 0xfe in channel command and 0xc4 in current command. If the SKU value of the board is empty or incorrect, the default value is the data of the C18 board. Change-Id: I2e51feec830c4cfd46e3eaec0f9db0e1cfdd620c Reviewed-on: https://chromium-review.googlesource.com/1475094 Commit-Ready: Jessy Jiang <jiangchao5@huaqin.corp-partner.google.com> Tested-by: Jessy Jiang <jiangchao5@huaqin.corp-partner.google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* RT946x: Make mt6370_led_set_color accept composite colorsDaisuke Nojiri2019-02-092-15/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, mt6370_led_set_color can handle only simple colors. That is, if a green LED is turned on, other LEDs are forced to be off. To allow composite colors (e.g. red+green), this change makes mt6370_led_set_color control LEDs independently. For example, to mix green and red, it can be called as mt6370_led_set_color(LED_MASK_GREEN | LED_MASK_RED); This is consistent with other RT946x LED APIs in the sense that they also control each LED independently. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/123613083 BRANCH=none TEST=Verify LED behavior doesn't change on Kukui by console command Change-Id: Idb80a124462b30adca6af86621aed136be8caa99 Reviewed-on: https://chromium-review.googlesource.com/1452617 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* hatch: Add support for charging and USB type CScott Collyer2019-01-291-0/+4
| | | | | | | | | | | | | | | | | This CL adds board specific files and functions required for both battery/charging and Type C support. BRANCH=none BUG=b:122251649 TEST=make buildall, tested both port 0/1 operation at factory. Battery can be charged via both ports. Change-Id: Ia01eabe109e3df780ec053831a71a16a41047f01 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1387585 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* kukui: Fix shipping mode VSYS leakage.Yilun Lin2018-11-192-4/+53
| | | | | | | | | | | | | | | | | | | | Follow the cut-off procedure recommended by Richtek. Also, tcpc_read/tcpc_write function will wake the TCPC up from low power mode and thus causing the TCPC re-init again, and this will break the register state we set. So, here we use mt6370_i2c_read/write to replace tcpc_read/write. TEST=boot system; Exec cutoff, and check that Vsys equals to zero. BUG=b:116682788 BRANCH=None Change-Id: I5cbd0df490ddb64b9376507e42a259c008c3ba16 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1335289 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* bq25710: Fix issue with HW ramp supportScott Collyer2018-10-022-1/+3
| | | | | | | | | | | | | | | | The HW ramp code was not being built previously. This CL fixes a macro name and adds the 2 .h files needed so it will build correctly. BUG=b:113267982 BRANCH=none TEST=make -j BOARD=dragonegg Change-Id: I3f074acea89b08f534b660e9f45019a716659272 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1208521 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* chgmgr: Allow charge_manager_update_charge to accept NULLDaisuke Nojiri2018-09-202-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, charge_manager_update_charge does not handle NULL pointer for struct charge_port_info any differently. It's not sanity-checked either (thus memory access violation can occur). This patch will make charge_manager_update_charge accept NULL pointer and set available current and voltage to zero. This also helps callers' intentions be clear because callers can explicitly specify NULL (instead of passing a pointer to chg = {0}, which is initialized somewhere else). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I518662ab6a3a07f93da5d34cf62a6f856884f67d Reviewed-on: https://chromium-review.googlesource.com/1226125 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* chgmgr: Set available voltage to 0 on disconnectDaisuke Nojiri2018-09-202-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, available current is consistently set to zero when a supplier is disconnected across BC 1.2 drivers, PD task, usb charger task but voltage is set to zero only in some places. This patch will set available voltage consistently to 0 on disconnected ports. This change should have no impact externally or internally because currently ports are treated as a disconnected port as long as available current is zero. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:841944 BRANCH=none TEST=Verify ectool usbpdpower 1 return 'Port 1: Disconnected' and 'Port 1: SNK (not charging)' without and with a BJ adapter connected respectively on Fizz. Verify ectool usbpdpower prints 'Disconnected' and 'SNK Charger PD' on Vayne without and with USB-C charger, respectively. Verify ectool usbpdpower prints 'Disconnected' and 'SNK Charger Type-C' on Vayne without and with a phone USB-C charger, respectively. Change-Id: I9aca575a4a4240ec1f669c55437decaedf758a77 Reviewed-on: https://chromium-review.googlesource.com/1222092 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* isl923x: initially disable autonomous chargingJett Rink2018-09-172-0/+14
| | | | | | | | | | | | | | | | | | | We do not use autonomous charging since it is automatically disabled when ever we set the current limits manually (which we always do). Allowing autonomous charging for the short period during initialization can cause current over protection events on devices with 2S batteries. BRANCH=none BUG=b:114318779 TEST=meep can boot without battery from daughter board USB-C port without boot looping Change-Id: Id50517d7e34bb5be171fe8b781b3ccf835db1f88 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1227411 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* charger/mt6370: Fix wrong init IRQ mask.Yilun Lin2018-08-291-1/+1
| | | | | | | | | | | | | | | | DPDM_IRQ_MASK register address should be at 0xE6, rather than 0xE5. Shift the mask init value to the right address. TEST=make BOARD=kukui flash_ec; Attach DCP. Check chgsup type=3. BUG=b:80160408 BRANCH=None Change-Id: I44eac570bf2d8fe11a3f460ed97f024f4be3813a Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1192862 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* drivers: Refactor to use high-level i2c APIsJonathan Brandmeyer2018-08-091-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | Using the high-level APIs for block transfers eliminates some code duplication and error-prone manual locking sequences. - common/cbi: Block transfers - driver/accel_bma2x2: Block transfers - driver/accel_kionix: Block transfers - driver/accelgyro_bmi160: Block transfers - driver/accelgyro_lsm6ds0: Block transfers - driver/baro_bmp280: Block and byte transfers - driver/charger/rt946x: Block transfers - driver/gyro_l3gd20h: Block transfers - driver/stm_mems_common: Block transfers - driver/tcpm: Block transfers TEST=buildall; motionsense and PD testing on Grunt convertible which exercises the bma160, kionix and tcpcm drivers. BRANCH=none BUG=chromium:871851 Change-Id: I1732253a244c3343459265ce1e1e54488cee65b8 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1167958 Reviewed-by: Jett Rink <jettrink@chromium.org>
* charger/mt6370: Init charger IRQs.Yilun Lin2018-08-012-3/+27
| | | | | | | | | | | | | | | | | Init all the mt6370 charger IRQs. We masked out all the other IRQs except VBUS detach/attach interrupts. Also, fix GPIO typo in CHARGER_INT_ODL, it should be GPIO_INT_FALLING. TEST=make flash_ec BOARD=kukui; check gpioget CHARGER_INT_ODL = 1 BUG=b:110241788 BRANCH=None Change-Id: I57beec78d74598d161c66f25ee149b3044d020ad Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1157726 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* eve: Delay charge port selection until VBUS is stable or 1s has passedSam Hurst2018-08-011-0/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a charge port is selected and VBUS is 5V, the inrush current causes VBUS to droop which could signal a sink disconnection. To mitigate this problem, charge port selection is delayed until VBUS is stable or 1s has passed. Before 1s has passed, PD will hopefully have negotiated a VBUS voltage of at least 9V. This CL is also a workaround for the issue outlined in b:74753447 Signed-off-by: Sam Hurst <shurst@chromium.org> BUG=b:69439094 BRANCH=None TEST=`make -j buildall` Manual tested with Belkin Express Dock and Moshi audio adapter. Test Belkin with following configuration: PORT0: PORT1: Belkin OPEN OPEN Belkin Belkin Blackcat Blackcat Belkin Belkin EC terminal output: Port 0: [654.645288 TCPC p0 Exit Low Power Mode] C0 st14 C0 st15 C0 st17 C0 st18 C0 st19 Requested 5000 V 3000 mA (for 900/900 mA) C0 st20 C0 st21 C0 st22 C0 st23 C0 st24 C0 st23 C0 st26 C0 st27 C0 st28 C0 st29 [655.375668 New chg p0] C0 st5 [655.380708 Ramp reset: st1] [655.381704 CL: p0 s8 i500 v5000] [655.392598 New chg p0] [655.393574 Ramp reset: st1] [655.394504 CL: p0 s2 i3000 v5000] C0 Req [4] 15000mV 3000mA [655.512126 New chg p0] [655.514456 Ramp reset: st1] C0 st715219 CL: p0 s0 ] C0 st8 [655.639762 Ramp reset: st1] [655.640301 CL: p0 s0 i3000 v15000] [656.688735 AC on] [657.385539 Ramp p0 st5 3000mA 3000mA] [657.471108 Battery 70% / 7h:36 to empty] [659.721858 charge_request(8800mV, 5376mA)] [660.973258 charge_request(8800mV, 3712mA)] [697.506594 Battery 71% / 1h:1 to full] Port 1: [729.384242 TCPC p1 Exit Low Power Mode] C1 st2 C1 st3 C1 st14 C1 st15 C1 st17 C1 st18 C1 st19 Requested 5000 V 3000 mA (for 900/900 mA) C1 st20 C1 st21 C1 st22 C1 st23 C1 st24 C1 st23 C1 st26 C1 st27 C1 st28 C1 st29 [730.339719 New chg p1] [730.340602 Ramp reset: st1] [C1 st5 730.341457 CL: p1 s8 i500 v5000] [730.356552 New chg p1] [730.357311 Ramp reset: st1] [730.358095 CL: p1 s2 i3000 v5000] C1 Req [4] 15000mV 3000mA [730.478577 New chg p1] [730.480986 Ramp reset: st1] [730.481829 CL:Cp1 s0 i500 v15] C1 st8 [730.607116 Ramp reset: st1] [730.607813 CL: p1 s0 i3000 v15000] [731.654877 AC on] [732.345420 Ramp p1 st5 3000mA 3000mA] [732.589802 Battery 71% / 10h:28 to empty] [734.340030 charge_request(8800mV, 5376mA)] [735.091263 charge_request(8800mV, 3712mA)] [767.879314 Battery 72% / 1h:1 to full] Tested Moshi with followint configuration: Port0: Port1: Moshi-pwr OPEN OPEN Moshi-pwr Moshi-pwr Blackcat Blackcat Moshi-pwr Moshi-audio OPEN OPEN Moshi-audio Moshi-audio Blackcat Blackcat Moshi-pwr Moshi-pwr-audio OPEN OPEN Moshi-pwr-audio Moshi-pwr-audio Blackcat Blackcat Moshi-pwr-audio Moshi EC terminal output: [2330.883267 TCPC p0 Low Power Mode] [2330.883664 TCPC p0 reset!] [2330.916049 TCPC p0 Low Power Mode] [2330.916475 TCPC p0 reset!] [2330.934010 TCPC p0 Exit Low Power Mode] C0 st14 C0 st15 C0 st17 C0 st18 C0 st19 Requested 5000 V 3000 mA (for 3000/3000 mA) C0 st20 C0 st21 C0 st22 C0 st23 C0 st24 C0 st23 C0 st26 C0 st23 C0 st27 C0 st28 C0 st29 [2332.398132 New chg p0] [2332.398883 Ramp reset: st1] [2332.399745 CL: p0 s8 i500 v5000] C0 st5 [2332.476132 New chg p0] [2332.476933 Ramp reset: st1] [2332.477705 CL: p0 s2 i3000 v5000] C0 Req [4] 15000mV 2970mA [2332.493597 New cCg p0C0 st7 ] [2332[2332.5001C0 st8 [2332.674727 Ramp reset: st1] [2332.675510 CL: p0 s0 i2970 v15000] [2333.668216 AC on] [2334.403481 Ramp p0 st5 2970mA 2970mA] [2334.450155 Battery 80% / 11h:18 to empty] [2335.448877 charge_request(8800mV, 5376mA)] [2336.699875 charge_request(8800mV, 3712mA)] [2356.466385 Battery 81% / 1h:1 to full] Change-Id: Iba909c252094c0e5ca4cf974aabcfe1eaf002efd Reviewed-on: https://chromium-review.googlesource.com/1130000 Commit-Ready: Sam Hurst <shurst@google.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* bq25710: Add bq25710 charger driverScott Collyer2018-07-292-0/+450
| | | | | | | | | | | | | | | | | | This CL adds a driver for the bq25710 charger chip. This is mostly copied from the bq25703 driver which is very similar. But, the bq25710 uses smbus registers instead of i2c. BUG=b:111410058 BRANCH=none TEST=make buildall Change-Id: Ic9068fdcfe91f3dd3840244ca21d2210b64c099f Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1135927 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* charger/mt6370: Support set LDO voltage function.Yilun Lin2018-07-242-0/+50
| | | | | | | | | | | | | TEST=flash kukui and manually test on kukui p0. BUG=b:80160408 BRANCH=None Change-Id: I2be4bda585babd0afe6e64837904898d46115e54 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1146418 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* bq25703: Fix charge ramp issueVijay Hiremath2018-07-192-31/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the below charge ramp sequence for BQ25703. 1. Set InputVoltage register (0x0A) value to slightly below the adaptor voltage with full load specification. 2. Disable external ILIM_HIZ by setting ChargerOption2 (0x32) bit 7 to 0. 3. Enable ICO test by setting ChargeOption3 (0x34h) bit 11 to 1. 4. Set IIN_HOST (0x0F) register value to the maximum amount of input current limit the user would like to sink on VBUS. 5. Wait for approximately 2sec, and check the ChargeStatus register (0x20) bit 14 for ICO completion. 6. Read ADC_IIN register (0x2B) after ICO is done and write this value back to IIN_HOST (0x0F) BUG=b:80279932 BRANCH=none TEST=Manually tested on BIP. Used USB Charging Voltage Current Panel Meter. Current showed on the display is same as input current read by charger command. CDP: charger rating with 5A,1.5A are ramped to 2.4A,1.5A respectively. DCP: charger rating with 5A,2A,1A are ramped to 2.4A,2.2A,1A respectively. SDP: USB3.0 -> ramped to 850mA USB2.0 (Manually modified max current to 900mA) -> ramped to 750mA Change-Id: I15e01ae033aa25890c81a4836dae809be31d313d Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1123679 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* charger/mt6370: Fix led_set_color enables wrong LED.Yilun Lin2018-07-122-2/+2
| | | | | | | | | | | | | | | | The index of LED enable bit in the register is counting from the MSB. BRANCH=None TEST=mt6370_led_set_color() on EVB, checks the LED flash accordingly. BUG=b:80160408 Change-Id: I9c748b5f91a62746adaeab59899cd0222305e06b Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1134927 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* charger/mt6370: Support RGB LED.Yilun Lin2018-07-112-0/+156
| | | | | | | | | | | | | TEST=test on EVB, and checks the led blinks accordingly. BUG=b:80160408 BRANCH=none Change-Id: Id0a06f51fd6369daa42e080af5e705321b93c732 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1132723 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* charger/mt6370: add Mediatek mt6370 charger driver.Yilun Lin2018-06-192-9/+143
| | | | | | | | | | | | | | | | BRANCH=none BUG=b:80160408 TEST=1) add MT6370 config to kukui and build the code 2) hook up mt6370 eval board with dummy load 3) verify the i2c traffic: set voltage, set current, and get device id Change-Id: I47461530f9cc490a9dc2da74eede1297ebc4443e Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1100365 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* Nami: Reduce buck-boost mode switching frequency of isl9238Daisuke Nojiri2018-06-181-0/+6
| | | | | | | | | | | | | | | | | This patch reduces buck-boost mode switching frequency of isl9238 to half. This should reduce the heat generated from the charger. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:80448805 BRANCH=none TEST=make BOARD=nami Change-Id: I38a12d60f562d828a7d186e43791a8b6aedc2500 Reviewed-on: https://chromium-review.googlesource.com/1095429 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* bq25703: Report actual input current limitVijay Hiremath2018-06-041-1/+7
| | | | | | | | | | | | | | | | | | | | | IIN_DPM register reflects the actual input current limit programmed in the register, either from host or from ICO. After ICO, the current limit used by DPM regulation may differ from the IIN_HOST register settings. BUG=b:80279932 BRANCH=none TEST=Manually tested on BIP Used BC1.2 DCP charger 'charger' command yield 900mA while charge ramp set to 2.4A. Change-Id: I6389205bd70d7729e9dd810fef3dfbf83a7d8c65 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/1080343 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>