summaryrefslogtreecommitdiff
path: root/common/charge_state_v2.c
Commit message (Collapse)AuthorAgeFilesLines
* pd: Fix multiple reboot for battery cut-offDivya Sasidharan2016-04-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | In case of boot after battery is cut-off without this change the battery is assumed to be present even though it is not initialized and ready to provide power in try source enable function. With this assumption charger is disconnected momentarily which causes reboot. Also make sure that try source enable is updated after battery is ready by notifying hook call HOOK_BATTERY_SOC_CHANGE. BUG=chrome-os-partner:51753 BRANCH=firmware-glados-7820.B TEST=Enter battery cutoff command from EC console to enter into ship mode and plug-in AC, verified no reboots happen. Change-Id: I6f7656125717f85851f5ad4e37dfd953a52799c6 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/335913 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit 10040ac6284efe88b74193bdbb0c05ec92b563b4) Reviewed-on: https://chromium-review.googlesource.com/336697 Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com> Tested-by: Divya Jyothi <divya.jyothi@intel.com>
* charger_state_v2: force static battery info update on battery changeKevin K Wong2016-04-131-0/+5
| | | | | | | | | | | | | | BUG=none BRANCH=none TEST=on system which has different static battery info based on battery present, when the present status has changed, verify the battery info is also changed. Change-Id: Id58c545e3315dc63c6dd6b59141b6302d767bfb7 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/331655 Reviewed-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: Settings for charger current in no battery conditionVijay Hiremath2016-02-081-1/+6
| | | | | | | | | | | | | | | | | | | | | In case of no battery condition, current code sets the charger input current to the charger maximum input current. To avoid damage to the board, set the charger input current to the maximum current that the board can support. BUG=none BRANCH=none TEST=Manually tested on kunimitsu, removed the battery & then using EC console command 'charger', verified that the current value is set to 3000mA. Change-Id: I94c40228a6362822c841a6e0c226bea0d3398b73 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/325522 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger/Kunimitsu: Fix for boot from cut-off batteryVijay Hiremath2016-02-021-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Battery in cut-off mode wakes when voltage is applied to the PACK and takes approximately 2 to 3 seconds to initialize before capable of providing the power. Hence made the battery present status to BP_NO in case of cut-off mode. Once the battery is ready new status is updated as BP_YES. When the battery status changes from BP_NO to BP_YES, charger input current is set to board specific charger input current which is not sufficient to boot the AP hence the system reboots. To avoid this issue, added code to write charger manager negotiated current to charger input current when the battery status changes from BP_NO to BP_YES. BRANCH=none BUG=chrome-os-partner:49224 TEST=Manually tested on Kunimitsu. Used console command 'cutoff' to put the battery in cut-off mode. Inserted the adopter to wake the system, system doesn't reboot & the battery charges. Change-Id: Ia5a1457506b4bef0b3dd27993e4b60ae64c8f746 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/322430 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: Change unlocked battery level ignore conditionsShawn Nematbakhsh2016-01-061-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | x86 systems will auto-power-on when power is applied to the EC. When the battery level is critically low, power-on is prevented, except when the system is unlocked. So, when unlocked, some systems will auto-power-on regardless of battery level, overcurrent the charger / battery, and then repeat forever. Prevent this reboot loop by ignoring auto-power-up when the battery is critically low, regardless of system unlocked status. BUG=chrome-os-partner:48339 TEST=Verify power-up is prevented on no-battery chell w/ donette. Then, run 'powerbtn' on EC console and verify system powers on (and overcurrents). BRANCH=None Change-Id: Ia631b5a8c45b42ec805e4a0c3f827929a0efd236 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/319187 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* charger: fix coding error in charge_prevent_power_on()li feng2015-12-161-1/+1
| | | | | | | | | | | | | BUG=none BRANCH=none TEST=make -j buildall Change-Id: If60902ab0176435b41f70ca11e0f73b430b65fe5 Signed-off-by: li feng <li1.feng@intel.com> Reviewed-on: https://chromium-review.googlesource.com/318650 Commit-Ready: Li1 Feng <li1.feng@intel.com> Tested-by: Li1 Feng <li1.feng@intel.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charge_state_v2: Set charger input current in the taskWonjoon Lee2015-11-191-4/+19
| | | | | | | | | | | | | | | | | | | | When task creating, input_current will be set as condition. But there is no more handling for this value. so it will remain even if condition is changed. This will put input current decision int the loop so that we can proper input current as battery existence. BUG=chrome-os-partner:47546 TEST=make buildall, command 'charger' with/without battery. and see it is changed dynamically BRANCH=None (cherry picked from commit d2ac89d58c34d7cc0a2a3fb591fcdcddbe2e9feb) Change-Id: Ib72e20faf7c7f302a4e39d43b23176247e5176fa Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/312950 Commit-Ready: Shawn N <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charge_state_v2: fix CONFIG_CHARGER_NARROW_VDC optionAlec Berg2015-11-111-1/+2
| | | | | | | | | | | | | | Fix missing {} when CONFIG_CHARGER_NARROW_VDC enabled. Bug introduced in CL:309289. BUG=none BRANCH=none TEST=make -j buildall Change-Id: I8b045b7231ea9916595184e468f93c879f243c42 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311796 Reviewed-by: Shawn N <shawnn@chromium.org>
* common: charge_state_v2: Add items to .bss.slow.stabilize-7628.BAseda Aboagye2015-11-091-5/+5
| | | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:46056 BUG=chrome-os-partner:46063 BRANCH=None TEST=Enable CONFIG_REPLACE_LOADER_WITH_BSS_SLOW on GLaDOS. Build, flash, and verify AP and EC boot. Plug in charger, issue 'battery' command. Verify charging still works and command shows reasonable data. TEST='sysjump rw' and repeat the above tests. TEST=make -j buildall tests CQ-DEPEND=CL:311209 Change-Id: I0661c32b641299d4be685156a4ac725267804a3e Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/311401 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* chg: add narrow VDC power path supportRong Chang2015-11-051-0/+9
| | | | | | | | | | | | | | | | | | Under NVDC, BGATE natively has a body diode. Hence there's a discharging path if VSYS is lower than VBAT. This change keeps VSYS voltage when turning off charging. BRANCH=none BUG=chrome-os-partner:46698 TEST=manual make buildall -j load on boards with isl9237 charger. charge the battery to full, and check charging voltage and current. Change-Id: I8a6046444dd40a3b57f034be124b9e8fe281de40 Signed-off-by: Rong Chang <rongchang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/309289 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charger: Add LIMIT_POWER charger param for low bat + weak chargerShawn Nematbakhsh2015-10-271-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for two new configs to specify critical energy battery percentage and critical external charger power. When we are under both thresholds, set the LIMIT_POWER charger parameter to inform the AP that it should conserve power to avoid brownout, and consider jumping to EC RW to negotiate PD. In addition, modify the existing CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON to allow power-up regardless of power level if a 15W+ charger is attached, since there is a reasonable chance it may speak PD and provide sufficient power to boot the AP. BUG=chromium:537269 TEST=Manual on Glados. Set CHG_MW thresh to 20000, BAT_PCT to 50. Verify that LIMIT_POWER charger param is set until Zinger negotiates to 20V. Also veify that system can boot with Donette. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ic963c82fea4ad10e8a5d7e476c5ce3e5ae525dad Reviewed-on: https://chromium-review.googlesource.com/306774 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* i2c: get battery information from charge stateMary Ruthven2015-10-271-0/+48
| | | | | | | | | | | | | | | | | | ARM systems currently use SBS kernel driver which talks to the battery through I2C passthu in the EC. Instead when asking for battery information try getting it from the charge state machine first, and then try the battery if charge state does not have the information. This reduces latency by cutting out the battery response time. BUG=chromium:484841 BRANCH=none TEST=check that power_supply_info works properly on Jerry Change-Id: If4da15ccabe412adc31fc94b189089ebb3e9265c Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/307905 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charge_state_v2: fix battfake command race conditionAlec Berg2015-10-061-31/+0
| | | | | | | | | | | | | | | | | | | | | | | This moves battfake console command to the battery driver. This fixes a race condition with using the 'battfake' command where charge_state_v2 could return the real battery percentage even when a faked percentage is specified, if a higher priority task uses the battery state of charge in between when the battery is read, and when the fake state of charge overwrites the battery parameter. BUG=chrome-os-partner:45878 BRANCH=none TEST=use tap for battery with a faked state of charge. the tap for battery queries the battery percentage a lot, so without this CL, the tap sequence often temporarily jumps to different percentages and colors. with this CL, the tap sequence works great. Change-Id: I3ae0866d1ff7bb8d0c51355cd6b958310766f19e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/302711 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* charge_state_v2: add option to cut-off battery when level is criticalVincent Palatin2015-10-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | Add a build option CONFIG_BATTERY_CRITICAL_SHUTDOWN_CUT_OFF to perform a battery cut-off when we reach the battery critical low level. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=none TEST=Discharge a Ryu device down to the critical level, see the message and verify we cannot restart with the power button. Also check that plugging the charger revives the device and starts charging. Change-Id: Ic132a658de5c5131a6a1dd1ce343196b68d480f6 Reviewed-on: https://chromium-review.googlesource.com/303549 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 80b3c99319771312d5733b126b6b3eb839addde9) Reviewed-on: https://chromium-review.googlesource.com/303812 Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
* Revert "Trigger lightbar pattern from charger task if necessary"Eric Caruso2015-08-131-4/+0
| | | | | | | | | | This reverts commit f4ba3b2fa32a4dd34570c2bc9b5a592727997eae. Change-Id: I97fde95480f27f80c9ec64add89fd9ab3476e4cd Reviewed-on: https://chromium-review.googlesource.com/293462 Reviewed-by: Eric Caruso <ejcaruso@chromium.org> Commit-Queue: Eric Caruso <ejcaruso@chromium.org> Tested-by: Eric Caruso <ejcaruso@chromium.org>
* Trigger lightbar pattern from charger task if necessaryEric Caruso2015-08-121-0/+4
| | | | | | | | | | | | | | | | | If we have a lightbar, but no PD, then plugging the device in will not trigger the battery-level pattern. This allows us to trigger it from the charger task instead if we change AC status and don't have a PD. BRANCH=ToT BUG=None TEST=plug and unplug charger from device, make sure the lightbar plays the right pattern Change-Id: I8f37aaff2ddb9d936e13489cb404caee822418a1 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/292943 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* acpi: Ensure continuity of memmap data with a read cacheShawn Nematbakhsh2015-07-281-18/+0
| | | | | | | | | | | | | | | | | | | | | For multi-byte ACPI memmap reads, we previously had a mutex to ensure data continuity. A better approach is to use a read cache. Since the kernel will enable burst mode before reading a multi-byte memmap variable and disable it afterward, we can populate the cache on the first read after enabling burst. This solution removes deadlock bugs, is contained entirely in acpi.c, and saves a deferred function. BUG=chromium:514283 TEST=Manual on Glados. Add prints in acpi_read, verify that multi-byte reads come from cache and non-burst reads continue to function as before. BRANCH=Cyan Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I74e4927bf2b433e31a9ff65d72820fa087c51722 Reviewed-on: https://chromium-review.googlesource.com/288871 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* charger: Inhibit power-on until charger is initializedShawn Nematbakhsh2015-07-221-2/+12
| | | | | | | | | | | | | | | | | | It's sometimes desirable to boot without a battery, but we may brown out if we don't have sufficient current. Inhibit AP power-on, even if the system is unprotected, until our charger and current limit are initialized. BUG=chrome-os-partner:41258 TEST=Manual on reworked glados with subsequent commit. Remove battery and attach Zinger. Verify EC powers on and AP doesn't boot. Run `powerbtn`, verify that AP boots. Remove all power and attach battery, verify that EC powers on and AP boots. BRANCH=None Change-Id: Ifc3d16f8288a035854e9fd05812ce6de33170d6a Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/280563 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* cleanup: remove board_discharge_on_ac() unless custom func neededAlec Berg2015-07-141-0/+4
| | | | | | | | | | | | | | | | | | Remove duplicate board_discharge_on_ac() functions and create CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM for boards that have a unique implementation of board_discharge_on_ac(). BUG=chrome-os-partner:42294 BRANCH=none TEST=make -j buildall. load on samus and test 'ectool chargecontrol discharge' forces discharging on AC, and 'ectool chargecontrol normal' resumes normal charging. Change-Id: I2b7c04b9278d07748d6d41798ceab1a7e90684e4 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/284911 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* glados: limit max input current to 1.5A to avoid i2c errorsstabilize-7155.BAlec Berg2015-06-091-0/+4
| | | | | | | | | | | | | | | | | | | | | Add workaround to limit the max input current to 1.5A due to i2c communication problems at higher currents. Note that this max should be removed when possible. This introduces a new CONFIG option to define the maximum input current limit for a board, as opposed to the already existing default input current limit. BUG=none BRANCH=none TEST=load on glados, charge with zinger, make sure input current is set to 1.5A and no recurring i2c errors talking to battery and charger. Change-Id: Ib7070772e1bf5475e98a2dc946ae75bf08047b70 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276169 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* mighty: fix the LED bug of removed batteryZhengShunQian2015-03-311-4/+20
| | | | | | | | | | | | | | | | | | | | | | | Clear curr.batt_is_charging when the battery is not present. Add a new batt_was_removed flag to track when the battery has been removed. This causes PWR_STATE_ERROR so the LED shows error state, and triggers re-reading the static parameters from the battery when it's reattached. BUG=chrome-os-partner:38235 TEST=check the LED state on mighty BRANCH=veyron Change-Id: I400c22eda4bc0043adf7217166bd9f80c557d991 Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com> Signed-off-by: Randall Spangler <rspangler@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/262007 Commit-Queue: Gediminas Ramanauskas <gedis@chromium.org> Tested-by: Gediminas Ramanauskas <gedis@chromium.org> (cherry picked from commit 6727e1dba2aafa81fa9572145413545106ae9626) Reviewed-on: https://chromium-review.googlesource.com/262140
* charge_state_v2: properly print static battery info errorsVincent Palatin2015-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | When calling problem() with 0 as value, it's never printed on the EC console since the problem() function is de-duplicating the messages by checking against the last value (which is initialized at zero). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:38401 TEST=run on the current Ryu code (which has a faulty BQ27742 driver) and see the "charge problem: static update [...]" message. Change-Id: Iedfbc95e3751bc5b22452187b404a09b633160d7 Reviewed-on: https://chromium-review.googlesource.com/262448 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* ACPI: Support accessing memmap data over ACPI CMD / DATA portsstabilize-6915.BShawn Nematbakhsh2015-03-251-0/+18
| | | | | | | | | | | | | | | | | | | | | | | Some platforms are unable to access the 900h-9ffh region over LPC and must instead access memmap data through the ACPI CMD / DATA ports. To avoid racing with data updates, disallow changes to multi-byte memmap data while in burst mode. Linux currently enables burst mode when accessing multi-byte data and disables it immediately afterward, though the ACPI spec defines burst mode in a more general way. BUG=chrome-os-partner:38224 TEST=Manual on Samus. Undefine LPC_MEMMAP and modify asl to move memmap data to ERAM at offset 0x20. Verify system boots cleanly and battery status is updated immediately on plug / unplug. BRANCH=None Change-Id: Ib848bdb491fdfece96ad0cee7a44ba85b4a1a50b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/262072 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* charge_state_v2: add battfake console commandAlec Berg2015-03-061-0/+32
| | | | | | | | | | | | | | | | | | | Add battfake console command to charge_state_v2. BUG=none BRANCH=samus TEST=load onto samus and use battfake console command to make sure it works: > battfake 100 Reporting fake battery level 100% > battfake -1 Reporting real battery level Change-Id: I038db92a4859d460b33b1c7e546bc08d5e21582b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/256070 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* charge_state_v2: return correct host command error codesAlec Berg2015-02-281-2/+2
| | | | | | | | | | | | | | | | Return host command error codes for EC_CMD_CHARGE_CONTROL instead of returning the result of EC functions which typically return element from enum ec_error_list, which is a different error list. BUG=chrome-os-partner:37171 BRANCH=samus TEST=make -j buildall Change-Id: Ia13cc8a2f747ddeafdc059c6e575dcc2f5b20b8d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/254721 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* charge_state_v2: Do not draw max input current if battery is presentVic Yang2015-02-201-12/+11
| | | | | | | | | | | | | | | | | | | | | Currently we set the input current limit to its maximum when the system is unlocked, so that we can boot the system with a powerful charger when the battery is absent. However, with a low power charger, we risk browning out the charger. If the battery is present, reduce the input current limit so that low power chargers work in this case. BRANCH=None BUG=None TEST=On Ryu, reboot EC when the a low power charger is used. Without this change, the charger browns out right after the reboot. With this fix, the problem doesn't happen anymore. Change-Id: I9d491cbe45e77f864198c97a47624918e6c272db Signed-off-by: Vic Yang <victoryang@google.com> Reviewed-on: https://chromium-review.googlesource.com/248442 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org>
* samus: automatically recover from charge circuit failuresstabilize-6752.BAlec Berg2015-02-031-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Occasionally the charge circuit on samus gets wedged and will not charge. This change detects when the charge circuit has failed and automatically recovers from it. It uses the BQ PROCHOT warning to detect the failure by setting PROCHOT to trigger when the BQ thinks input current is higher than the input current limit. When the failure is detected, the EC disables charging and tells PD MCU to disable CHARGE_EN, then a couple seconds later, it re-enables charging. This CL also adds more communication between EC and PD for the EC to be able to set the charge state for the PD. Valid charge states are: No charging allowed, 5V charging only, and max charging. The EC uses this as such: - When the EC gets AC present interrupt, it sets off a deferred function to change charge state to max charging after some delay to give time for the charge circuit to settle down. - When the EC gets AC disconnect interrupt, it disables charging briefly, enables learn mode, and then sets 5V charging allowed. This allows for the same starting conditions in the charge circuit for every AC attach. - When the EC detects a wedged charge circuit, it disables charging and waits a few seconds before re-enabling 5V only charging. Additionally, this change moves the charging cutoff in S3/S5/G3 when the battery is full to the EC. With the added control for the EC to set the PD charging state, it is more convenient for the EC to manage cutting off charging when battery is full. BUG=chrome-os-partner:36081 BRANCH=samus TEST=test the basics: - connect/disconnect zinger a bunch of times - connect and disconnect two zingers in different order - connect two zingers and charge override between the two test the automatic charge wedge recover: - wedge the charge circuit by setting charger voltage under battery voltage: "charger voltage 7000" - wait a few seconds for the system to recover and check it is charging with "battery" command test full battery charge cutoff: - added console command to change battery soc in board/samus/extpower.c: static int cmd_battfake(int argc, char **argv) { char *e; battery_soc = strtoi(argv[1], &e, 10); batt_soc_change(); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(battfake, cmd_battfake, "", "", NULL); - in S0, tested "battfake 100" does not disable charging. - in G3, tested "battfake 100" disables charging and "battfake 99" re-enables charging. - set "battfake 100" and tested transitioning to S0 enables charging and transitioning to S5 disables charging. - attached two chargers and used charge override to select active port. then toggled "battfake 100" to "battfake 99" back and forth and verified charge override port is still the same. test third-party 12V charger: - plug in a bunch of times and make sure we stay at 5V for 500ms and then transition to 12V test with no battery: - tested five different units with no battery and just zinger. 3/5 boot, while the other 2 don't. But, the 2 that don't boot without battery also can't boot w/o battery when this CL is reverted, so I don't think this change is causing the problem, I think there is an electrical limitation. test with EVT zinger: - EVT zingers (P2 - C2) negotiate very quickly after connection, which can cause INA problems w/o this CL. Tested an EVT zinger with samus and did a bunch of connections and disconnections and verified that we always wait at 5V for 500ms and that we don't wedge the INA circuit on connect. test backwards compatibility: - test new PD with old EC and make sure we can charge with zinger. (note that if the charge circuit wedges, we won't be able to unwedge it). - test old PD with new EC and make sure we can charge with zinger. Change-Id: I7703b7a2ab1209d7f559b265b03517e79c74b16a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/245253 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* hooks: add hook for battery state of charge changeAlec Berg2015-02-031-0/+1
| | | | | | | | | | | | | | Add hook for battery state of charge change. Hook will be used to cleanup the samus charging workarounds to follow. BUG=none BRANCH=samus TEST=make -j buildall Change-Id: I99cbb8264783802139cac689804b056623063695 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/245252 Reviewed-by: Shawn N <shawnn@chromium.org>
* charge_state_v2: ignore false battery SOC readingsAlec Berg2015-01-311-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ignore battery readings over 100%. This fixes a samus bug where a false battery SOC reading causes charging to stop. BUG=chrome-os-partner:36115, chrome-os-partner:36081 BRANCH=samus TEST=add following code to common/smart.c: static int reset_soc; in battery_get_params(): if (reset_soc) { batt_new.state_of_charge = 65535; reset_soc = 0; } after battery_get_params(): static int command_battsoc(int argc, char **argv) { reset_soc = 1; return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(battsoc, command_battsoc, "", "", NULL); This changes the battery state of charge to 65535% for one loop through charge state machine. w/o this CL, on samus the battery stops charging when you call this, but with this CL it is fixed. Change-Id: I44f054a4e84260bd7cd7b77e44b1698645ab6c35 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/244346 Reviewed-by: Shawn N <shawnn@chromium.org>
* samus: modify fast charging profile to avoid charge problemsAlec Berg2015-01-261-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several modifications to samus fast charging to fix bug where charging circuit stops charging the battery. - Fix bug: if we have a bad temperature reading, fast charging should ignore it. - Change the fast charging high temperature profile to set a charging voltage equal to the maximum of 8.3V and the current battery voltage. - Divide the normal temperature profile into two phases, low voltage charging and high voltage charging. Once we transition to second phase, don't allow it to go back to phase 1 unless AC is removed. On samus, we have to make sure we never command the BQ to a charging voltage that is below the present battery voltage or else the INA will lose power and we will not be able to charge the battery until AC is disconnected. This also changes charge_state_v2 so that the fast charging profile override is called even when AC is disconnected to avoid jumps in temperature as seen by the fast charging code. Also changes the voltage threshold for transitioning from phase 1 to phase 2 of normal temp charging so that the transition is taken a little earlier to match the desired profile slightly better. BUG=chrome-os-partner:35491 BRANCH=samus TEST=Added custom console command to be able to directly control the battery temperature that charger_profile_override() uses: static int command_chgtemp(int argc, char **argv) { char *e; if (argc < 2) return EC_ERROR_PARAM_COUNT; chg_temp = strtoi(argv[1], &e, 10); if (*e) return EC_ERROR_PARAM1; return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(chgtemp, command_chgtemp, "", "", NULL); Using this command, I jumped back and forth between all three temperature fast charging regions and made sure that (1) we never set a charging voltage below the present battery voltage and (2) we never stop charging the battery. I ran this test at low battery and high battery percentage and with low load (G3) and high load (S0 with webgl aquarium). Change-Id: I035603a4ab48a156ab43f8c93f21200c4b664aab Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/243143 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* charge state v2: Initialize batt params before inhibiting power-onShawn Nematbakhsh2015-01-221-2/+11
| | | | | | | | | | | | | | | | | | | If our battery params seem uninitialized when calling charge_prevent_power_on, try to retrieve them and make a decision based upon the retrieved data. This should prevent the case where power-up is incorrectly prevented early in the boot process. BUG=chrome-os-partner:35762 TEST=Manual on Samus. Write protect unit and run "reboot" from the console, verify that unit powers up. Verify that unit still correctly prevents low-power power-on and correctly allows non-low-power power-on. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I9030a2d5e526f4b03996a89bf2c801533683bb67 Reviewed-on: https://chromium-review.googlesource.com/242560 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* charge state v2: allow boot without battery when unlockedAlec Berg2015-01-191-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | Change charge_state_v2 to set the maximum input current limit when there is no battery present AND the system is not locked. This allows us to boot without a battery. Note that using the max input current limit may cause us to overcurrent our charger, but that's no worse than putting a limit on it and having the system brownout. Either way you must have a high enough power charger to boot without a battery. BUG=chrome-os-partner:35570 BRANCH=samus TEST=load on samus, remove battery and plug in zinger. check "charger" has input current limit of 8128mA, and on PD MCU jump back and forth between RO and RW and make sure system doesn't power off. Note that without this CL, if you sysjump on the PD MCU it causes input current limit to reset to 500mA and causes AP to shutoff. Change-Id: Ie13d97a6b5c0937510cff0cf05fb032898c3b131 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/241762 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* charge_state_v2: Fixes for battery present reportingDuncan Laurie2015-01-181-7/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix some issues with how the battery present flag is reported up to the host. If there is no battery presence GPIO or custom function then errors updating the smart battery info can result in the battery present flag reporting BP_NOT_SURE and indicating to the host that the battery is missing. In order to prevent spurious events require a second back-to-back read of a missing battery before the host is notified. When the battery presence does change, the host needs to be told to re-read the static battery info with EC_HOST_EVENT_BATTERY, passed to the OS via Notify command to tell the OS to re-execute _BIF/_BIX method on the ACPI battery device. When sending these events to the host the battery flags should first be updated in LPC shared memory so if the host handles the event quickly it will read the correct updated flags value. BUG=chrome-os-partner:34011 BRANCH=broadwell TEST=manual testing on samus: 1) add a console command that allows the smart battery update function to set batt.is_present to BP_NOT_SURE for a specified number of update cycles. 2) ensure that when the smart battery update only returns the battery missing for one update cycle that it does not result in an event to the host. 3) ensure that if the smart battery update indicates the battery is missing for more than one update cycle, such that the host is notified the battery is missing, that it correctly gets an event to re-read the battery info when it is indicated as present again. Change-Id: I0da004b991ea1a89b34cd7c0f8f3628b813ffe44 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/241763 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charger v2: Don't report 0 battery charge if we're running off batteryShawn Nematbakhsh2015-01-161-2/+11
| | | | | | | | | | | | | | | | | Some batteries report 0 charge when their charge level is very low. powerd has a special interpretation of 0 charge, which causes low-battery shutdown to not occur. Work-around this powerd behavior by never reporting 0 charge if our battery is discharging. BUG=chrome-os-partner:35188 TEST=Manual on Samus. Drain battery to critically low level, verify that powerd correctly shuts down system. BRANCH=Samus Change-Id: I6bd50e038f0e22de7e7de754fa2ea459dc662f35 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/241101 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* charger: Make critical battery shutdown timeout a config optionShawn Nematbakhsh2015-01-151-1/+1
| | | | | | | | | | | | | | | | Certain platforms may wish to have a longer shutdown timeout, so make the timeout a config option. BUG=chrome-os-partner:35188 TEST=Manual on Samus with subsequent CL. Set config option to increase timeout, verify that timeout is extended. BRANCH=Samus Change-Id: I69feb0d31fdc53e533671dec1e88ba96cc4553c2 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/240815 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charger v2: Combine prevent_*_discharge functionsShawn Nematbakhsh2015-01-131-58/+34
| | | | | | | | | | | | | | | | prevent_hot_discharge and prevent_deep_discharge are near-identical copies of one another, and can be combined without the loss of any useful functionality. BUG=chrome-os-partner:35188 TEST=Manual on Samus. Charge to 2% and boot system with 5V power supply. Verify that warnings print to console and AP powers down after 30s. Also pass unit tests. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I0f1da5248825a3884f7910babc742dfa7eadf5a3 Reviewed-on: https://chromium-review.googlesource.com/240033
* samus: when battery is full, and not in S0, stop chargingAlec Berg2015-01-031-8/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When battery is full and system is not in S0, then stop charging and allow battery to power the system. Once battery is no longer full and requests current, allow charging again. This is to work around power consumption issues in our AC input path. The charge override port is stored upon entering S3 and restored going back to S0 so that the charge override port is not affected by this. This also fixes lightbar so lightbar checks if battery is full instead of checking raw percentage. The lightbar is also changed to use the last tap direction if no charger is plugged in. And the lightbar tap for battery threshold for turning green is lowered to 95%. This also moves some samus_pd board code out of interrupt handlers and in to deferred functions to minimize time in interrupts. BUG=chrome-os-partner:34640, chrome-os-partner:34847 BRANCH=samus TEST=load onto samus. use battfake command from pd console to set battery percentage. when system is in G3, see that batt = 100% stops charging, and when batt < 100% it starts charging again. tested that we receive host command from EC with battery information every time battery changes SOC. Change-Id: Ia8e0721508e34ee3630f5e5b0c2f431a00329caf Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236411 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: set BQ voltage to battery voltage when AC disconnectedAlec Berg2014-12-231-7/+21
| | | | | | | | | | | | | | | | | | | | Set charge state machine voltage to just above the battery voltage when AC is disconnected. Also send new current before sending new voltage to charger when there is a change. These changes reduce input current spikes caused by current inrush into the battery and thereby decrease chance of overcurrenting power supply on connect. BUG=chrome-os-partner:33862 BRANCH=samus TEST=load onto samus instrumented with input current probe. when AC is attached note that initial current spike is much lower with this change. Change-Id: I7760cd2b709c6b3536cf2a9449bb1f46800ce10a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237245 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* power_button_x86: Inhibit AP power-on if battery level is too lowShawn Nematbakhsh2014-12-171-0/+13
| | | | | | | | | | | | | | | | | | | | Allow CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON to be defined at the board level to be the minimum battery percentage required for power-on. If the battery level is below the threshold, or if the battery is missing, power button presses will be ignored. BUG=chrome-os-partner:31127 TEST=Manual on Samus with subsequent commit. Verify that AP continues to boot normally when charge level exceeds CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON. Verify that power button presses are ignored when the charge level is below the threshold, and we return to G3. BRANCH=Samus Change-Id: I0ff3f7ddabf38080332470e172c8b2e307bf1655 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236021 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus: add high battery temp warning to charge state machineAlec Berg2014-12-151-17/+38
| | | | | | | | | | | | | | | Add high (and low) battery temperature warning which sends host event to AP. After 30 seconds of out of range temp readings force shut off AP and hibernate the EC. BUG=chrome-os-partner:27641, chrome-os-partner:33111 BRANCH=samus TEST=make buildall, and write unit tests to test this condition. Change-Id: I95b7d9d753c17e4b76218a9845aa63dd1b96a500 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/235645 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* samus: fix charge state machine's handling of low power chargersAlec Berg2014-12-151-29/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | On samus it is possible to have AC plugged in but have the battery discharging. So, add a new variable to charge state machine for battery charging status and use that where necessary. For example, the low battery shutdown code should now be based on whether or not battery is charging rather than if AC is present. This also changes the hibernate behavior when battery is low. The change is to wait 30 seconds in G3 of low battery with no charging before hibernating because for some chargers, like a USB PD charger, the charger may increase it's current limit after a little bit of time. BUG=chrome-os-partner:34485 BRANCH=samus TEST=test on samus. use low power charger and make sure that ectool battery shows the "DISCHARGING" flag. use zinger and see "CHARGING" flag. also use power_supply_info to make sure that the battery state accurately reflects reality. Change-Id: I8ac0267dd393071c4ca1fa24fbc9a13bf27848a9 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/235491 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Do not try to wake the battery after battery cut-offVic Yang2014-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | When the battery cut-off command is issued with external power present, the battery can end up in one of the following two states: 1. The battery stays responsive but is waiting for the external power to go away. 2. The battery decides to cut itself off right away. In case 1, we are already avoiding charging the battery again, so we're good. However, in case 2, the charge state machine mistakenly thinks the battery is dead and tries to revive it. Fix this by checking if the battery is cut off before starting to revive it. BRANCH=None BUG=chrome-os-partner:33372 TEST=Cut off the battery with external power connected. Wait for a while and then disconnect external power. Check the battery is sure cut off. Repeat for several times. Change-Id: Icf343b168a556a490bc1786802a8a6e230863a28 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227521 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* samus: fix false shutdown due to low batteryAlec Berg2014-10-221-1/+7
| | | | | | | | | | | | | | | | Fix bug causing unit to falsely shutdown due to low battery. The shutdown warning time was not getting reset, so two false readings of battery SOC or voltage, seperated by more than 30 seconds in time would cause "charge force shutdown due to low battery" BUG=chrome-os-partner:33111, chrome-os-partner:33144 BRANCH=samus TEST=make buildall Change-Id: I6f00187516d23aa78139e5c1565febca34176ecc Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224765
* Don't hibernate on low battery if hiberante is not supportedVic Yang2014-10-091-0/+2
| | | | | | | | | | | | | | | | | If CONFIG_HIBERNATE is explicitly undefined for a board, the EC shouldn't hibernate when the battery is running low. Otherwise, the EC reboots because of the lack of hibernate support, and this actually burns more power. BUG=chrome-os-partner:32727, chrome-os-partner:32779 TEST=Drain the battery to 2% and verify the EC is behaving. BRANCH=None Change-Id: I2f9f5fd8fb4b5be4d8da113da4ef26c062869a07 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222615 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* charge_state_v2: Send host event if charge state changesDuncan Laurie2014-09-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there is any delay between AC status and the battery charge status it is possible for the power_manager to read the battery state when the AC status event is sent and still see that the battery is not yet charging. This can cause lag in the UI battery icon because the AP is not notified when the battery charge state changes. In order for the host to be able to differentiate the dynamic battery state changing (re-read ACPI _BST by sending Notify 0x80) from the static battery info (re-read ACPI _BIX/_BIF by sending Notify 0x81) it needs a separate host event. BUG=chrome-os-partner:32196 BRANCH=samus TEST=Test AC instertion and removal while watching state on the host to ensure that an event is sent to the host which triggers power manager to re-read the battery status and notice that the charge state has changed if there is any delay after the AC status event: watch -n 0.1 "cat /sys/class/power_supply/AC/online; cat /sys/class/power_supply/BAT0/status; tail -10 /var/log/power_manager/powerd.LATEST" Change-Id: I18ce70719dc231c43c474cefad2068f949675a2b Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220257 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus: exchange status with PD MCU on bootAlec Berg2014-09-171-4/+9
| | | | | | | | | | | | | | | | | | | | | On boot, the EC should send host command to exchange status with PD MCU. This allows EC to get the correct input current limit when EC reboots and PD does not. Also had to move some of the charger state machine initialization to run with HOOK_INIT so that it runs before the tasks run. BUG=none BRANCH=none TEST=tested on EVT samus. Without this change, if you reboot EC, and run charger command, the charger input current limit is 512mA. with this change, when the EC reboots, it sends host command to PD MCU to get current limit and sets it appropriately. Change-Id: I5426f0fc3a62b6cd7a73f55cb11b895902a54903 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/216879 Reviewed-by: Todd Broch <tbroch@chromium.org>
* EC: Add smart battery firmware update driverSheng-Liang Song2014-09-031-0/+8
| | | | | | | | | | | | | | | | | | | | Ref: Common Smart Battery System Inferface Specification v8.0. - Added 2 new AP->EC Command APIs EC_CMD_SB_FW_UPDATE, EC_CMD_ENTERING_MODE - Implemented common smart battery update drivers. BUG=chrome-os-partner:24741 CQ-DEPEND=CL:210032 CQ-DEPEND=CL:210033 CQ-DEPEND=CL:215720 BRANCH=ToT,glimmer TEST=Verified on LGC & Simplo smart battery Change-Id: Ice6e60b1b04762217ae7613356d6925777c06abf Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/205323 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add hysteresis to host events for battery capacity changedAlec Berg2014-08-221-1/+3
| | | | | | | | | | | | | | | | | Adds a small threshold for sending a host event to battery whenever the full capacity changes. This helps avoid constant host events when the battery decides the capacity is going back and forth 1mAh BUG=none BRANCH=none TEST=load on samus. set LFCC_EVENT_THRESHOLD to 1 and see host events very often. set LFCC_EVENT_THRESHOLD to 5 and see no host events. Change-Id: I2dc38f04e1a634539837dfed19b10ccfcfd0a8a3 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/213668 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* samus: ryu: fix charge state machine init of input currentstabilize-6146.BAlec Berg2014-08-121-4/+20
| | | | | | | | | | | | | | | | | | | | | | Currently charge state machine resets input current limit to default every time AC is connected. Problem is by the time charge state machine gets around to setting input current, it could have already been set by successful PD negotiation, and this ends up overriding that value. This fix has the state machine store desired input current limit, as determined from PD negotation or any other place, and send last desired input current limit on AC connect. BUG=chrome-os-partner:24461 BRANCH=none TEST=load on samus, test toggling between "pd 0 dev 5" and "pd 0 dev 20", and test plugging and unplugging zinger numerous times, and verify charger command always gives the expected input current limit based on PD negotiation. Change-Id: I18d8acc9e2085739e783c9c70c682d46bcce7fdb Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211639 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* charger v2: Apply charge current to full battery in disconnect stateShawn Nematbakhsh2014-08-061-1/+12
| | | | | | | | | | | | | | | | | | | If a battery is found in disconnect state, we need to apply a charge current to get it out of that state, even if the battery is full. BUG=chrome-os-partner:29465 TEST=Manual on Samus. Put full battery into disconnect state then power-on the EC. Pull AC and verify that the battery is no longer disconnected. BRANCH=None Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I43e872e225dc5a651f566d7b190cff85a487805e Reviewed-on: https://chromium-review.googlesource.com/210343 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Shawn Nematbakhsh <shawnn@chromium.org> Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>