summaryrefslogtreecommitdiff
path: root/board/scarlet/battery.c
Commit message (Collapse)AuthorAgeFilesLines
* ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ishJack Rosenthal2021-11-051-301/+0
| | | | | | | | | | | | | | | | | | | | | | In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* scarlet: Lower the charging voltagePhilip Chen2019-01-241-2/+2
| | | | | | | | | | | | | | | | | | | The battery spec states the maximal charging voltage is 4.42V. Considering +-1% of voltage accuracy from rt9467, we should lower the charging voltage to ensure it never hits 4.42V. BUG=b:118799175 BRANCH=scarlet TEST=make BOARD=scarlet Change-Id: I8a2f01d64ccb0750b1d5e4d4af586faf307d7b9d Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1431552 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* scarlet: Don't disable idle mode in S3Philip Chen2018-05-311-2/+1
| | | | | | | | | | | | | | | | | | | | | I heard we only want to disable idle mode in S5, when battery is full. BUG=b:78792296 BRANCH=scarlet TEST=manually test on scarlet, and confirm when battery is full, idle mode is disabled in S5 but not in S3. Change-Id: I5809da581dd3fc3d382f606168a88263740256c0 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1077496 Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> (cherry picked from commit 8746200bb7c71bdee057580447c78ffb53520fae) Reviewed-on: https://chromium-review.googlesource.com/1079732 Commit-Ready: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
* scarlet: Disable idle mode in a special casePhilip Chen2018-05-301-1/+19
| | | | | | | | | | | | | | | | | | | | | | | When AC is plugged, battery is full and AP is off, there is a small chance that rt946x would be damaged. I'm told that consuming more current in this case would mitigate the issue. So let's disable idle mode in this case. BUG=b:78792296 BRANCH=scarlet TEST=manually test on scarlet and confirm idle mode is disabled in the described special case Change-Id: Idc3a3165ebaa2f99bdd5df56675c3945eaeae9fa Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1071124 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> (cherry picked from commit 37168486d3f5543b5dd7a8e5d819c68c4c68c5b0) Reviewed-on: https://chromium-review.googlesource.com/1076709 Commit-Ready: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
* scarlet: Clamp reported battery SOC when charge terminatesPhilip Chen2018-05-141-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | After we set TE (CL:958295), rt946x terminates charging when the charge current is below IEOC in constant-voltage mode. When AC is plugged and rt946x terminates, we see cases that battery SOC falls below BATTERY_LEVEL_NEAR_FULL but rt946x doesn't re-enable charging yet, which leads to amber LED. The Chrome OS UI might also show battery is not full in this case. Let's clamp the reported battery SOC in this scenario to avoid user confusion. BUG=b:77870927 BRANCH=scarlet TEST=When AC is on, charge terminates, and BATTERY_LEVEL_NEAR_FULL is hit, confirm battery SOC is overwritten. Change-Id: I4575e562873d149d6f349ddb578334d107e21776 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/1055194 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* scarlet: Enable charge termination only when battery is presentPhilip Chen2018-03-311-0/+14
| | | | | | | | | | | | | | | | | If we enable charge termination when booting w/o battery, charge termination would trigger and cut the power for max17055. BUG=b:72697658 BRANCH=scarlet TEST=Read rt946x reg 0x02, confirm charge termination is disabled when booting w/o battery, and enabled otherwise. Change-Id: I5780196ad993299ddfb37621bee5e941aa9b0d14 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/989314 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
* scarlet: Enable 4A charging for Simplo batteryPhilip Chen2018-03-021-3/+14
| | | | | | | | | | | | | | | | | Simplo update battery spec again - the maximal charging current can be 4A now. BUG=b:70820167 BRANCH=scarlet TEST=build scarlet Change-Id: I52e295b83563240aed73944107b00649c9b422b1 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/942370 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org>
* scarlet: Update battery profile for Simplo batteryPhilip Chen2018-02-231-8/+13
| | | | | | | | | | | | | BUG=b:69634899 BRANCH=scarlet TEST='battery' command shows the full cap is updated to 8734 mAh Change-Id: I090d80e7c889c044ba2dfbdf02527a0791419320 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/933861 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* scarlet: Remove unused macros in battery.cPhilip Chen2018-01-301-3/+0
| | | | | | | | | | | | | | | | The macros were added for debug and not used anymore. Let clean it up. BUG=none BRANCH=none TEST=make BOARD=scarlet Change-Id: I859fd3ddf2d5271ba26d23696013c83dec98a966 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/891547 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* scarlet: Update the charging current for Simplo batteryPhilip Chen2018-01-191-2/+2
| | | | | | | | | | | | | | | Simplo updated the datesheet and limited the charging current to 3A. BUG=b:70820167 BRANCH=none TEST=none Change-Id: I88b9e0ac3ebba401530e2bb6ae08438c56d8506e Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/875145 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* scarlet: Implement custom charging profilePhilip Chen2017-12-281-20/+113
| | | | | | | | | | | | | | | | | | | Because Scarlet doesn't use smart battery, in the current implementation of charging algorithm, we simply provide constant voltage/current to the battery. However, the datasheets of Scarlet battery packs do state different desired voltage/current in different temperature range. So we should implement the custom charging profile for the battery. BUG=b:65597565 BRANCH=none TEST=override measured temperature to confirm zone changing is fine on rev2 Change-Id: I188578fd46e28f1f05fbce2150af23aaae457cc5 Signed-off-by: Philip Chen <philipchen@google.com>
* scarlet: Support different battery packs for different SKUsPhilip Chen2017-12-111-27/+69
| | | | | | | | | | | | | | | BUG=b:70298995 BRANCH=none TEST=Insert a few printf() in max17055 driver to ensure the right battery profile is used. Change-Id: I3af05fa6da2ea021f8c55f6ceb0e1a40cd04dbed Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/816079 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* scarlet: Define battery profilePhilip Chen2017-12-111-0/+22
| | | | | | | | | | | | | | | | | | Also updated the basic parameters (design_cap, ichg_term, and v_empty) based on the characterization result. BUG=b:69634899 CQ-DEPEND=CL:813038 BRANCH=none TEST=manually test on Scarlet rev2, 'battery' command shows reasonable reading no matter is_ez_config is set as 0 or not. Change-Id: I55889efe39cc43e38c0285d298bcf39f0a4e49a1 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/812481 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* scarlet: Add max17055 fuel gauge for rev1 boardPhilip Chen2017-07-271-58/+9
| | | | | | | | | | | | | | | BUG=b:63870414 BRANCH=none TEST=build scarlet, and test battery console command on scarlet rev0 Change-Id: I58171058d70a94734ce69cac860f8a1849083dfb Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/578301 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* scarlet: Add rt946x charger for the new boardPhilip Chen2017-07-271-9/+2
| | | | | | | | | | | | | | BUG=b:63739819 BRANCH=none TEST=build scarlet Change-Id: I8710412a591170d077dc217c192ec3b231e54659 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/573585 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* scarlet: Migrate to stm32 chipPhilip Chen2017-07-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This will officially kill the support for rev0 boards. The major changes include: 1) Massive GPIO rename/reallocation 2) New power sequencing 3) Reconfigure peripherals (e.g. I2C, SPI, ADC) 4) Drop usb_charger_task 5) Remove lid switch 6) Display BL not driven by PWM 7) Move bmp280 from I2C to SPI 8) Remove SPI flash 9) Some placeholders for follow-up changes. BUG=b:62640322, b:62269890 BRANCH=none TEST=build scarlet Change-Id: Idc0a854a0935089295b67da106ba1b35359f146d Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/572684 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: David Schneider <dnschneid@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* scarlet: Adapt to the master branchPhilip Chen2017-06-061-21/+12
| | | | | | | | | | | | | | | | To port Scarlet from firmware-gru-8785.B to master, we need some change in naming/definition of variables/functions. BUG=b:62307687 CQ-DEPEND=CL:524034, CL:524973, CL:524981 BRANCH=gru TEST=build image and boot Scarlet Change-Id: I20c1a4f311c9250a3bf1a2a5b0c70dd0f7c7e45b Reviewed-on: https://chromium-review.googlesource.com/524987 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* scarlet: initial mainboardphilipchen2017-06-061-0/+146
Copied board-related files from gru folder and updated some minor changes to make it compilable. Will do more follow-up modification based on this work. BUG=chrome-os-partner:62207, b:62307687 CQ-DEPEND=CL:524973, CL:524981, CL:524987 BRANCH=gru TEST=make BOARD=scarlet Change-Id: Ib508ef69e448028809276fe010c3f5fbef0500b4 Reviewed-on: https://chromium-review.googlesource.com/430965 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> (cherry picked from commit 63592fef936909fe97af487f4ded44b9daa5847f) Reviewed-on: https://chromium-review.googlesource.com/524034 Commit-Ready: Philip Chen <philipchen@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>