summaryrefslogtreecommitdiff
path: root/zephyr/Kconfig.battery
Commit message (Collapse)AuthorAgeFilesLines
* bq25710: Allow PKPWR_TOVLD_DEG to be configuredCaveh Jalali2021-11-231-0/+19
| | | | | | | | | | | | | | | | This adds support for customizing the input current overload time when in peak power mode. This means ILIM2 can momentarily be exceeded to support system power spikes. BRANCH=none BUG=b:190737958 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I8acb53372eaf63c23f5380cdbb3a4b5b1f9d5ab6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3296744 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* bq25710: Allow PP_IDCHG2 to be configuredCaveh Jalali2021-11-191-0/+9
| | | | | | | | | | | | | | | | This adds support for enabling PROCHOT assertion when the 2nd battery discharge current limit (IDCHG_TH2) is reached. BRANCH=none BUG=b:190737958 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I4e035c6437a728556804adbb142b59e62168cb4e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3292921 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* bq25710: Allow IDCHG_TH2 to be customizedCaveh Jalali2021-11-171-0/+18
| | | | | | | | | | | | | | This adds support for configuring the charger's 2nd battery discharge current limit (IDCHG_TH2). BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I84512b7a93ccea8e8b0a53e6a655f59e85845e2b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3284638 Reviewed-by: Keith Short <keithshort@chromium.org>
* bq25710: Allow VSYS_MIN to be customizedCaveh Jalali2021-11-171-0/+20
| | | | | | | | | | | | | | | | | This adds support for configuring the minimum system voltage. Since the MIN_SYSTEM_VOLTAGE register was renamed to VSYS_MIN on the bq25720, the code has been updated to reflect the new name as it is more descriptive. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: Icfa0a8c433e7ce69671b120bf00369e8c4bae1b9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3284640 Reviewed-by: Keith Short <keithshort@chromium.org>
* bq25710: Allow IDCHG_DEG2 to be customizedCaveh Jalali2021-11-161-0/+18
| | | | | | | | | | | | | | | This adds support for configuring the IDCHG_TH2 deglitch time (IDCHG_DEG2). BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I6426b46b253863a28edeb431da6c581953484db7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3284637 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* bq25710: Allow VSYS_UVP to be configuredCaveh Jalali2021-11-161-0/+17
| | | | | | | | | | | | | | | | | | | | This adds support for customizing the VSYS under voltage (VSYS_UVP) lockout threshold. This is a 3 bit field with default value 0. The actual voltage encoded is (0.8 * <value> + 2.4), allowing a range 0f 2.4 V to 8.0 V to be specified. The CONFIG_BQ25720_CHARGE_OPTION_4_VSYS_UVP_CUSTOM option specifies if this field should be set. If so, it is set to the value of CONFIG_BQ25720_CHARGE_OPTION_4_VSYS_UVP. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I81f538edc9f68ccb6236a5eb0205edfa3441664a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3283416 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* bq25710: Allow PP_ACOK to be configuredCaveh Jalali2021-11-161-0/+8
| | | | | | | | | | | | | This adds support for configuring PP_ACOK as a prochot trigger. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I183c31daf89df316f7bcb1dc7b66e89bfc66c26c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3283415 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* bq25710: Allow PP_BATPRES to be configuredCaveh Jalali2021-11-161-0/+8
| | | | | | | | | | | | | This adds support for configuring PP_BATPRES as a prochot trigger. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I83a46e597f0ed117b0e686531b00eedbeb66412a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3283414 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* bq25710: Allow PP_INOM to be configuredCaveh Jalali2021-11-161-0/+10
| | | | | | | | | | | | | This adds support for configuring PP_INOM as a prochot trigger. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I7e797cd06dac8cf15e4ec9c1704d9d6b6e56bdd5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3283413 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* bq25710: Allow BATOC threshold to be configuredCaveh Jalali2021-11-111-0/+10
| | | | | | | | | | | | | | | | This adds support for selecting the minimum BATOC protection threshold to be used with EN_BATOC. The minimum threshold is 150% of PROCHOT IDCHG on the bq25710 and 133% of PROCHOT IDCHG_TH2 on the bq25720. The default threshold is 200% on both chips. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I22576d1cf7c78bfefeb1c2582434ddc0220a1928 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3275001 Reviewed-by: Keith Short <keithshort@chromium.org>
* bq25710: Allow ACOC_VTH to be configuredCaveh Jalali2021-11-111-0/+9
| | | | | | | | | | | | | | This adds support for selecting 133% of ILIM2 for the AC over-current protection threshold. The chip default is 200% of ILIM2. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I75457185fca905519897b66d460752989b3a7ff2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3275000 Reviewed-by: Keith Short <keithshort@chromium.org>
* bq25710: Allow EN_ACOC to be configuredCaveh Jalali2021-11-111-0/+9
| | | | | | | | | | | | | | | This adds support for enabling AC over-current protection (EN_ACOC bit). The converter turns off when the OC threshold is reached. The threshold is determined by the ACOC_VTH bit. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I1bc8e34ee4e7cef0d6d796387eb4f290fada82d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3274999 Reviewed-by: Keith Short <keithshort@chromium.org>
* bq25710: Allow CMP_REF to be configuredCaveh Jalali2021-11-111-0/+9
| | | | | | | | | | | | | | | | This adds support for selecting 1.2 V for the CMP_REF field in the charge option 1 register. When CONFIG_CHARGER_BQ25710_CMP_REF_1P2 is defined, the charger chip will be initialized to use 1.2 V for CMP_REF. BRANCH=none BUG=b:185190976 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I8793506b318b61505aa7c0afbc4d8e898680b44d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3272352 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* bq25710: Fix zephyr PSYS sensing configurationCaveh Jalali2021-11-111-1/+1
| | | | | | | | | | | | | | Kconfig options don't need CONFIG_ prefixes in the Kconfig file. BRANCH=none BUG=b:195615830 TEST=buildall passes Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I5fb3f96cde57eba2b5cc0b1a2dd724650b23d0b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3272349 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* bq25710: Add PSYS sensing configurationCaveh Jalali2021-11-011-0/+11
| | | | | | | | | | | | | | | | | | | | This adds a new config option to enable the PSYS monitoring feature on the BQ25710, BQ25720 chargers. The register definition for configuring PSYS on the BQ25720 is expanded to 2 bits, giving more control to meaure battery and AC separately. We keep it simple and include both when measurement is enabled. BRANCH=none BUG=b:195615830 TEST=with rest of patch series, psys values reported by dump_intel_rapl_consumption look reasonable Change-Id: I0f299c6a24d20ef5bdcda13de74b30ba0c2d5d3c Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3253076 Reviewed-by: Ryan Lin <ryan.lin@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* cleanup: charger: Add BQ25710 sense resistor configsDeepti Deshatty2021-10-281-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | Defined different sense register configs for BQ25710. All the charger chip driver implementation uses common sense register configs i.e CONFIG_CHARGER_SENSE_RESISTOR and CONFIG_CHARGER_SENSE_RESISTOR_AC. When we enable a charger driver for a platform, it is expected that the platform define these sense register configs. But ADLRVP requires two different charger drivers i.e ISL9241 and BQ25720 to be enabled to support all the variant builds. Hence BQ25710 driver is changed to use different sense register configs so that the configs defined for ISL9241 are not affected. BRANCH=none TEST=make -j buildall has no issues Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Change-Id: If1e1422246e2e3a5cb628d9a37c23790502b5ca4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3211773 Reviewed-by: Poornima Tom <poornima.tom@intel.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Battery: Move battery code to battery_v1.c and v2.cDaisuke Nojiri2021-10-261-0/+36
| | | | | | | | | | | | BUG=b:198722643, b:203031618 BRANCH=None TEST=buildall Change-Id: I595da56412f4d30684b00d1138f7e2339c7f5204 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3227372 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: add support for virtual batteryMichał Barnaś2021-10-151-0/+11
| | | | | | | | | | | | | | | | | | Add Kconfigs to enable virtual battery and set virtual battery address. Change named-i2c from I2C_PORT_VIRTUAL to I2C_PORT_VIRTUAL_BATTERY. BRANCH=main BUG=b:185480578 TEST=When virtual battery is enabled, compilation fails if no virtual battery port is defined in device tree. TEST=Enable virtual battery and verify that its handlers are called properly. Change-Id: Ic88da28dc443beb89a32868d201072f39abb3a86 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3207991 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: add auto enabling HAS_TASK_* KconfigsMichał Barnaś2021-10-061-1/+1
| | | | | | | | | | | | | | | | This commit removes the prompt for HAS_TASK_* Kconfigs. They are enabled automatically when corresponding feature is enabled. BRANCH=main BUG=b:198777314 TEST=Verify that all tasks are created correctly. USB PD tasks should match amount or usb-c ports count. Change-Id: Ia69f9762cb8953df99d12b772f607d26df1fe379 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3197726 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* Zephyr: Separate charger and battery config optionsDiana Z2021-10-011-1/+27
| | | | | | | | | | | | | | | | Decouple the charger and battery configs, to allow boards to add components in smaller increments. BRANCH=None BUG=b:195137794 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ia4677f5c91851346acf15e6627c280e56d62cde1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3200067 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: charger: Allow multiple (different) chipsYuval Peress2021-10-011-8/+0
| | | | | | | | | | | | | | | | | There's no real restriction that the same chip needs to be used for charging. Remove 'choice' and allow multiple charging drivers to be set for the same board. This change also requires re-naming the mutex to avoid conflict because of the way Zephyr allocates them. BRANCH=none BUG=b:201602829 TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I522247bc7dbdae6d6c360a37dfbc1031f4058983 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195199 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* zephyr: add missing charger KconfigMichał Barnaś2021-09-081-10/+14
| | | | | | | | | | | | | | | Add CHARGER_MIN_BAT_PCT_IMBALANCED_POWER_ON to Kconfig BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I7672315a6938102878b5b3b87a9dcf96b0a71d46 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141561 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: add missing battery KconfigsMichał Barnaś2021-09-081-0/+32
| | | | | | | | | | | | | | | | | | | | | | Add missing Kconfigs for: - PLATFORM_EC_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF - PLATFORM_EC_BATTERY_CHECK_CHARGE_TEMP_LIMITS - PLATFORM_EC_BATTERY_MEASURE_IMBALANCE - PLATFORM_EC_BATTERY_MAX_IMBALANCE_MV Change help text in battery yamls to use Kconfigs instead of legacy CONFIGs BRANCH=main BUG=b:183544739 TEST=Define added configs to prj.conf file and verify that compilation takes them into account. Change-Id: I01716c1515350550c18bbfd4944638034a25c7b5 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3141598 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Add support for ISL9238 Rev CSimon Glass2021-06-151-0/+15
| | | | | | | | | | | | | | | This chip version cannot be detected at runtime. Add support for the Kconfig option to signal that this revision is on the board, needed for Asurada. BUG=b:189855648 BRANCH=none TEST=with other CLs, build asurada for Zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I3a86b94e4b4936dc6f6f071d6facd364555865a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2941885 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Add support for MAINTAIN_VBATSimon Glass2021-06-111-0/+7
| | | | | | | | | | | | | | | Add a Kconfig for this feature so that it can be used on Zephyr. BUG=b:189855648 BRANCH=none TEST=with other CLs, build asurada for Zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I699fe81b3f4ad8c03b90a0c8371a927df5bc3e78 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2941819 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: Add support for OTG powerSimon Glass2021-06-111-2/+22
| | | | | | | | | | | | | | | | | Add Kconfigs for this feature so it can be enabled on Zephyr. The driver determines the availability of this feature but it must be specifically enabled by the board. BUG=b:189855648 BRANCH=none TEST=with other CLs, build asurada for Zephyr Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Iaeae49039b8a76c2dd42804127644920480697a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2941818 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: add I2C_VIRTUAL_BATTERY configDawid Niedzwiecki2021-05-271-0/+9
| | | | | | | | | | | | | | Add I2C_VIRTUAL_BATTERY config to use virtual battery driver. BUG=b:188885798 BRANCH=none TEST=zmake testall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I6d1a4bfd8c950aa569ee836d9d22e438eeaef67b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2919906 Reviewed-by: Yuval Peress <peress@chromium.org> Commit-Queue: Yuval Peress <peress@chromium.org>
* bq25720: Add VSYS_TH2 tuning supportCaveh Jalali2021-04-061-0/+22
| | | | | | | | | | | | | | | | | | This adds support for tuning the bq25720 VSYS_TH2 threshold so that a custom threshold voltage can be specified. The default 3.2v for 1S batteries and 5.9v for 2S (or more) batteries may need to be adjusted to improve system stability. When VSYS droops to this threshold, PROCHOT is asserted to reduce system power demand. BRANCH=none BUG=b:183474163 TEST=with rest of patch stack, booted brya to the OS without a battery Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I7f52a369371eb93860b14ad8438b790af231c450 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2798979 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Support the amonbmon commandSimon Glass2021-04-031-0/+8
| | | | | | | | | | | | | | | | Add support for this debugging command in Zephyr. BUG=b:183296099 BRANCH=none TEST=build for lazor and check the various options in in /tmp/z/trog/build-ro/zephyr/.config Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I0849eaf2652e74751ffe938fa6696362bfa34d75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789802 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Add support for PSYSSimon Glass2021-04-021-0/+21
| | | | | | | | | | | | | | | | Add support for reading the system-power value and enabling the 'psys' command. This feature is provided by some chargers, using the ADC on the EC. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I3acbb53f47e00a07b1de4d96bac05e65f13ce628 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788840 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Add support for overriding the charger profileSimon Glass2021-04-011-0/+13
| | | | | | | | | | | | | | | | | | | Add support for CONFIG_CHARGER_PROFILE_OVERRIDE so that this feature can be enabled for lazor. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I7f3f6e6448209614489ac0b3f607404c43dd9a43 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788835 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Add support for setting charger sense-resistorsSimon Glass2021-04-011-0/+14
| | | | | | | | | | | | | | | | | We need a different value for lazor, so move this to Kconfig. We may at some point move this to device tree. BUG=b:183296099, b:175881762 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present build config for volteer and make sure it has not changed Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I7b5fa6a03ba24028006f6a1a8516e9244308fe76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788833 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add support for discharge testingSimon Glass2021-04-011-0/+41
| | | | | | | | | | | | | | | | | | | | | | | Add support for CHARGER_DISCHARGE_ON_AC and a choice for which method to use to implement it. This does not seem to be all that common, so leave it to default to off. Drop the existing hard-coded setting. This option is often implemented by the charger but the board should still select whether to use it or not as there may be multiple chargers. Enable it for volteer to keep things the same there. BUG=b:183296099, b:175881762 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present check volteer still has the option enabled Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I8b893441d7e780ff74de7778c294a3e712ed1f62 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788831 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add support for BATTERY_REVIVE_DISCONNECTSimon Glass2021-04-011-0/+7
| | | | | | | | | | | | | | | | | | Add support for this option in Kconfig. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I2e77d72059ffe86f3d24f0a2bad3b0e3438dc08c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788830 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Add support for battery chemistrySimon Glass2021-04-011-0/+17
| | | | | | | | | | | | | | | | This is used in test code. Add a Kconfig option to enable the feature and another to set the string. BUG=b:183296099 BRANCH=none TEST=with other CLs, build zephyr for lazor and see that the option is present Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Idec38f3feefc76eb64710df79a36966bd072d490 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2788829 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* common/battery: Provide function to lower input voltagePatryk Duda2021-03-291-0/+10
| | | | | | | | | | | | | | This patch introduces generic version of function that sets voltage limit when chipset is off and battery is fully charged. BUG=b:182546058 BRANCH=none TEST=make -j buildall Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ib7606c8d1ab3fe1dc650a3abcef9ebc207335ab5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2773218 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: Add BQ25710 and BQ25720 kconfigCaveh Jalali2021-03-241-0/+22
| | | | | | | | | | | | | | | This adds the BQ25710 and BQ25720 charger chips to zephyr's kconfig structure. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I0fdd08d4104991bf630221efd11c9da932e7db38 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2762527 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Tidy up BATTERY_PRESENT_GPIOSimon Glass2021-03-231-4/+14
| | | | | | | | | | | | | | | | | | | | | | This is not a boolean CONFIG in ECOS but it must be with Zephyr. There doesn't seem to be any advantage to allowing an arbitrary name here, since the mapping is controlled in the device tree anyway. So hard-code it to GPIO_BATT_PRES_ODL and document this in the Kconfig. Also drop the unnecessary logic in config_chip.h since Kconfig handles ensuring that only one option is set. This makes the code easier to follow and avoids errors. Fix the error that is there. BUG=b:183296099 BRANCH=none TEST=make BOARD=lazor -j4 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I55a9083ad01be2f6b1e9314f73fbbff1442e486c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777633 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for hardware charge-rampingSimon Glass2021-03-231-1/+31
| | | | | | | | | | | | | | | | | | | | | | | Allow this option to be selected, turning it into a choice between the two options. Make hardware ramping the default since it seems to be preferred. It was apparently not supported on volteer only due to a bug in the charger chip. Also move the software-ramp requirement for ISL9241 to Kconfig. We cannot 'select' a choice item like PLATFORM_EC_CHARGE_RAMP_SW in PLATFORM_EC_CHARGER_ISL9241, so use a 'depends on' instead. Update volteer to use software ramping since the default has changed. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor build for volteer and check that CONFIG_PLATFORM_EC_CHARGE_RAMP_SW=y Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic3ffd21cd10aa896a4c6dbe1d98d75776c89aefe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774917 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for ISL9237/8 chargersSimon Glass2021-03-221-2/+39
| | | | | | | | | | | | | | | | Enable the isl923x driver in the zephyr build. Update the volteer charger since the default has changed. This needs a Narrow VDC setting so add that as well. BUG=b:183296099 BRANCH=none TEST=build zephyr (no changes) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I1991b78263c2311c3d1f8c4f30f8d3bd823a39ac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774915 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: fix Kconfig name for console commandsKeith Short2021-03-121-1/+1
| | | | | | | | | | | | | | | Cleanup Kconfig options to match the convention of starting with CONFIG_PLATFORM_EC_CONSOLE_CMD_*. BUG=b:181794644 BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ibed3d0371483b26c17f8f8c05c088694b6f3728d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2756981 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: Add missing battery configDawid Niedzwiecki2021-01-281-0/+25
| | | | | | | | | | | | | | | | | | | There are 3 battery configs missing for Zephyr: -CONFIG_PLATFORM_EC_BATTERY_CUT_OFF -CONFIG_PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM -CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT Add them to the Kconfig.battery. BUG=b:177604307 BRANCH=none TEST=Build Zephyr with the configs enabled Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I4e3c834470b9f4977b3f779b4246868feaea4bd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2645092 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* zephyr: Enable the chgramp taskSimon Glass2021-01-091-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This task is used to ramp up charging from an external source. Add support for this along with required Kconfig options. Add one more stub in system to make it build. This is covered by the existing bug. BUG=b:175434113 BRANCH=none TEST=make BOARD=volteer -j30 build volteer on zephyr So far the output is not interesting (need more drivers): uart:~$ chgramp Chg Ramp: State: 0 Min ICL: 0 Active ICL: 0 Port 0: OC idx:0 OC 0: s-1 oc_det0 icl0 OC 1: s0 oc_det0 icl0 OC 2: s0 oc_det0 icl0 Port 1: OC idx:0 OC 0: s-1 oc_det0 icl0 OC 1: s0 oc_det0 icl0 OC 2: s0 oc_det0 icl0 Signed-off-by: Simon Glass <sjg@chromium.org> Cq-Depend: chromium:2613607 Change-Id: I603ba43d4384b62ed0c1a64b580599b42ae85e81 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2617039 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Connect HAS_TASK_CHARGER and PLATFORM_EC_BATTERYSimon Glass2021-01-061-0/+1
| | | | | | | | | | | | | | | | | | | | | These options are linked in that we cannot have one without the other. Select the charger task automatically if PLATFORM_EC_BATTERY is enabled, since that feature cannot work without the task. If PLATFORM_EC_BATTERY is not enabled there is no need for the task. BUG=b:176449230 BRANCH=none TEST=ninja -C /tmp/z/vol/build-ro menuconfig Check the operation of HAS_TASK_CHARGER and PLATFORM_EC_BATTERY Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I14ada8716053649ac13ea12a7b06c2ae1702df42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606576 Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Convert the sub-Kconfig files into menusSimon Glass2020-12-301-2/+2
| | | | | | | | | | | | | | | | | | | Use a menu for each of these since it produces a tidier top-level view for the EC. Put the function as the first word to make it easier to follow. For battery and USB-C, use menuconfig so that it works the same way as power sequencing. BUG=b:176449230 BRANCH=none TEST=ninja -C /tmp/z/vol/build-ro menuconfig See that the menus appear Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I57e58f94aeaa0783ca69b0c948b7760c2e42adbf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606571 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Enable building of the battery fuel gaugeSimon Glass2020-12-241-0/+8
| | | | | | | | | | | | | | Bring in this file needed for monitoring a battery. BUG=b:175248556 BRANCH=none TEST=build and run zephyr on volteer No visible change, except more code is compiled in Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I49a3960c62153ad0ea5c5f8121d0aa0d35e7ffe4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600228 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add support for battery presenceSimon Glass2020-12-231-0/+30
| | | | | | | | | | | | | | | Add the battery-presence settings so that a battery can be detected. BUG=b:175248556 BRANCH=none TEST=build and run zephyr on volteer No visible change, except more code is compiled in Cq-Depend: chromium:2599491 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I9a7086e6df67f7e9fe3aedb6a15f891e71b58d49 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2600337 Reviewed-by: Keith Short <keithshort@chromium.org>
* Reland "zephyr: Add battery and smart battery options"Keith Short2020-12-141-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of ac4f512e60af42efe693e6955c110a7908090e56 Original change's description: > zephyr: Add battery and smart battery options > > Shim in battery and smart battery support. > > BUG=b:175248556 > BRANCH=none > TEST=boot on volteer, run 'battery' command. > TEST=run 'ninja menuconfig' and check KConfig help text. > 20-12-10 20:08:12.778 battery > 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC > 20-12-10 20:08:13.529 Param flags:00000003 > 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C) > 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV > 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV > 20-12-10 20:08:13.541 I: 0x0000 = 0 mA > 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA > 20-12-10 20:08:13.550 Charging: Allowed > 20-12-10 20:08:13.550 Charge: 0 % > 20-12-10 20:08:13.550 Manuf: LG > 20-12-10 20:08:13.555 Device: AC17A8 > 20-12-10 20:08:13.573 Chem: LIO > 20-12-10 20:08:13.573 Serial: 0xb754 > 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV > 20-12-10 20:08:13.573 Mode: 0x6001 > 20-12-10 20:08:13.573 Abs charge:0 % > 20-12-10 20:08:13.573 Remaining: 0 mAh > 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation) > 20-12-10 20:08:13.585 Design: 5360 mAh > 20-12-10 20:08:13.594 Time-full: 0h:0 > 20-12-10 20:08:13.594 Empty: 0h:0 > > Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711 > Signed-off-by: Simon Glass <sjg@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199 Bug: b:175248556 TEST=make buildall, which fails with: /opt/coreboot-sdk/lib/gcc/nds32le-elf/8.3.0/../../../../nds32le-elf/bin/ld: __flash_dma_size < IT83XX_ILM_BLOCK_SIZE BRANCH=none Change-Id: I318fb13ba91485cd7d876b2294f20d748f47e0fd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585931 Tested-by: Simon Glass <sjg@chromium.org> Auto-Submit: Simon Glass <sjg@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Revert "zephyr: Add battery and smart battery options"Eric Yilun Lin2020-12-141-52/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit ac4f512e60af42efe693e6955c110a7908090e56. Reason for revert: This CL stops chipset_task forever, revert this to boot AP. Original change's description: > zephyr: Add battery and smart battery options > > Shim in battery and smart battery support. > > BUG=b:175248556 > BRANCH=none > TEST=boot on volteer, run 'battery' command. > TEST=run 'ninja menuconfig' and check KConfig help text. > 20-12-10 20:08:12.778 battery > 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC > 20-12-10 20:08:13.529 Param flags:00000003 > 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C) > 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV > 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV > 20-12-10 20:08:13.541 I: 0x0000 = 0 mA > 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA > 20-12-10 20:08:13.550 Charging: Allowed > 20-12-10 20:08:13.550 Charge: 0 % > 20-12-10 20:08:13.550 Manuf: LG > 20-12-10 20:08:13.555 Device: AC17A8 > 20-12-10 20:08:13.573 Chem: LIO > 20-12-10 20:08:13.573 Serial: 0xb754 > 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV > 20-12-10 20:08:13.573 Mode: 0x6001 > 20-12-10 20:08:13.573 Abs charge:0 % > 20-12-10 20:08:13.573 Remaining: 0 mAh > 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation) > 20-12-10 20:08:13.585 Design: 5360 mAh > 20-12-10 20:08:13.594 Time-full: 0h:0 > 20-12-10 20:08:13.594 Empty: 0h:0 > > Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711 > Signed-off-by: Simon Glass <sjg@chromium.org> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199 Bug: b:175248556 Change-Id: I66086d8fee46d5fd02d26938468a7d76dab71c6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589140 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@chromium.org> Tested-by: Eric Yilun Lin <yllin@chromium.org>
* zephyr: Add battery and smart battery optionsKeith Short2020-12-111-0/+52
Shim in battery and smart battery support. BUG=b:175248556 BRANCH=none TEST=boot on volteer, run 'battery' command. TEST=run 'ninja menuconfig' and check KConfig help text. 20-12-10 20:08:12.778 battery 20-12-10 20:08:13.509 Status: 0x02c0 DCHG INIT RC 20-12-10 20:08:13.529 Param flags:00000003 20-12-10 20:08:13.541 Temp: 0x0b63 = %.1d K (%.1d C) 20-12-10 20:08:13.541 V: 0x2a1e = 10782 mV 20-12-10 20:08:13.541 V-desired: 0x3390 = 13200 mV 20-12-10 20:08:13.541 I: 0x0000 = 0 mA 20-12-10 20:08:13.550 I-desired: 0x0a19 = 2585 mA 20-12-10 20:08:13.550 Charging: Allowed 20-12-10 20:08:13.550 Charge: 0 % 20-12-10 20:08:13.550 Manuf: LG 20-12-10 20:08:13.555 Device: AC17A8 20-12-10 20:08:13.573 Chem: LIO 20-12-10 20:08:13.573 Serial: 0xb754 20-12-10 20:08:13.573 V-design: 0x2d1e = 11550 mV 20-12-10 20:08:13.573 Mode: 0x6001 20-12-10 20:08:13.573 Abs charge:0 % 20-12-10 20:08:13.573 Remaining: 0 mAh 20-12-10 20:08:13.577 Cap-full: 4932 mAh (4833 mAh with 98 % compensation) 20-12-10 20:08:13.585 Design: 5360 mAh 20-12-10 20:08:13.594 Time-full: 0h:0 20-12-10 20:08:13.594 Empty: 0h:0 Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199