summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfactory-nyan-5772.BBrian Norris2021-09-102-10/+1
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155072 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* Big: Correct the charger IC drivercloud_lin2014-04-254-1/+242
| | | | | | | | | | | | | | | | | | | | Add bq24735 driver and move to here for further developing BRANCH=big BUG=None TEST=test basic charing/discharging function Reviewed-on: https://chromium-review.googlesource.com/196541 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Lin Cloud <cloud_lin@compal.com> Commit-Queue: Lin Cloud <cloud_lin@compal.com> (cherry picked from commit 295e409ea9ab10adb34b13330a2b9948e43da58c) Change-Id: I6dee1d05fbd9b54c2dbb10ebd42607d197107633 Original-Change-Id: I2af8dabda34ebc9d6fbdbd6c781258973b4b565a Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/197006
* battery: don't talk to battery after cut-offLouis Yung-Chieh Lo2014-04-255-7/+86
| | | | | | | | | | | | | | | | | | | | | | | | Add a shortcut in smart battery driver and i2c passthru. Once the battery cut-off order is submitted (in the factory line), the EC will no longer talk to battery. BUG=chrome-os-partner:28248 BRANCH=tot,nyan TEST=See below > remove AC, cutoff: expect system is off. > cutoff, then remove AC: expect system is off. > cutoff, wait for 1 min, then remove AC: expect system is off. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> (cherry picked from commit 401901a83bd8b876a1033742b838311ca584d2a9) Change-Id: Ic8a9ff847f903be0d0f2319572c23aa0d513567a Original-Change-Id: I1726784d9f5e9dd63acd846538443808b424c031 Reviewed-on: https://chromium-review.googlesource.com/196948 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* charger v2: only configure charger when AC is on.Louis Yung-Chieh Lo2014-04-251-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CL fcf26a4 enabled periodically charge_request(). However, that could fail and generates lots of error message in the EC console if the AC is not on and charger refuses the request (even it is 0v/0mA). BUG=none BRANCH=tot,nyan TEST=make runtests. Tested on big. Expect NO below annoying error message [1.353104 charge_request(0mV, 0mA)] [1.453170 charge_request(0mV, 0mA)] [1.553281 charge_request(0mV, 0mA)] [1.653317 charge_request(0mV, 0mA)] in the follwing cases: AC on, battery attached, power on, then remove/plug in AC. AC on, battery attached, power on, then remove/plug in battery. AC on, battery removed, power on, then plug in and remove battery. AC off, battery attached, power on, then plug in and remove AC. 'chgstate' also shows good state. At final, charge for 10 mins. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196678 Reviewed-by: Lin Cloud <cloud_lin@compal.com> Tested-by: Lin Cloud <cloud_lin@compal.com> Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit b0409436adcf68cda3bf70a2964b9fdee599189a) Change-Id: I7d89a8ce8c4de3d35fb7e540813e296f8a764cf3 Original-Change-Id: I22cbf13debcb55a64f50af0e774e6934f07dbeda Reviewed-on: https://chromium-review.googlesource.com/196947 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* battery: move cut-off commands to common/battery.cLouis Yung-Chieh Lo2014-04-239-26/+58
| | | | | | | | | | | | | | | | | | | | | | | So that host and EC commands will be defined in common/battery.c. The board-specific battery.c can focus on the proprietary method. BUG=chrome-os-partner:28248 BRANCH=tot,nyan TEST=make buildall runtest Tested "cutoff" in EC console on big. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196621 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 2e7ea4efdb56af411f13e0224a945a67dd6f0dcb) Change-Id: I89efcd0e85fadc4bed5601628cfffb73334f2adc Original-Change-Id: I435d7ccdab920215b047c36e5d3a054a315aacad Reviewed-on: https://chromium-review.googlesource.com/196686 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* charger v2: supports charger watchdogLouis Yung-Chieh Lo2014-04-232-23/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some chargers support a timeout mechanism that it would stop charging if no voltage/current setting comes from battery or EC. This is designed for safety. In charger v1, it always updates charger periodically. But in v2, old code only updates charger when needed. New code updates the charger periodically. Also keep the ability for debugging. A manual mode is introduced so that any requested volt/curr from host and force idle mode request would trigger this mode. To leave this mode, just disable the force idle mode. BUG=chrome-os-partner:28201,chrome-os-partner:28208 BRANCH=nyan TEST=See below. Plug AC and battery. Wait for 10 mins and the battery is charged normally. 'chgstate idle on': the charger doesn't charge the battery. 'chgstate idle off': charge again. Plug in AC and remove battery: No annoying repeated message and works fine. Plug in battery and remove AC: No annoying repeated message and works fine. Power up machine with battery only: No annoying repeated message and works fine. Power up machine with AC only: No annoying repeated message and works fine. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196385 (cherry picked from commit fcf26a43ab1737acc873afcc1b61b4fb20389966) Change-Id: I2da870f688ddd791223a179452394e0f5efe25b2 Original-Change-Id: I544594f4c532b05a021f2c6828072fe66d8fff1f Reviewed-on: https://chromium-review.googlesource.com/196685 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* nyan: add info_precharge for drained batteryLouis Yung-Chieh Lo2014-04-224-15/+107
| | | | | | | | | | | | | | | | | | | | | | Charger v2 assumes the battery_get_info() always returns non-NULL even if the battery is not detected, for example, in the over-drained situation. Thus, add a new struct so that we know what the conservative setting is to pre-charge the unknown battery. BUG=chrome-os-partner:28112 BRANCH=nyan,big,blaze TEST=See issue tracker for the test procedure. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> (cherry picked from commit c423615cfd11400e1e4f35c97337abd16bd17150) Change-Id: I5bf6d6ef7ea68dea3cce72d5f554c045c7688606 Original-Change-Id: I4957f3a53f64edec721b9b1ddbacc17e7eca2926 Reviewed-on: https://chromium-review.googlesource.com/196273 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* Fixed the stack overflow bug in 'battery' console command.Louis Yung-Chieh Lo2014-04-225-15/+61
| | | | | | | | | | | | | | | | | | | | | | | | | On the Nyan EC, we almost run out of the stack of console task. Instead of making that struct static or global, we print the cached data. Read the issue tracker for more detailed discussion. BUG=chrome-os-partner:28027 BRANCH=tot TEST=verified on nyan with/without battery. The "battery" console command doesn't crash the system. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194875 Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 58878e79e07f33050d6ff8d280e5db63b5902e10) Change-Id: I358932fe9b8d652f019d6a88ffc1409c58d94bf9 Original-Change-Id: Ie54637a3c0e75346c7c405863ac0a777c7594c3f Reviewed-on: https://chromium-review.googlesource.com/196272 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* blaze: add ectool discharge commandDevin Lu2014-04-222-0/+13
| | | | | | | | | | | | | | | | | | | | | | just picks up this commmand for factory. BRANCH=ToT BUG=None TEST=Run ectool chargecontrol command with each option (normal, idle, discharge) on blaze. Verifiy battery can discharge. Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/195535 (cherry picked from commit 35b214c1b3559d97663a3c3eecdab7689b29255a) Change-Id: If7d2302496c622b780a7133fefd0806dc62f7a32 Original-Change-Id: I22b18c70e11085910ba95c31cdd8ca57925807c8 Reviewed-on: https://chromium-review.googlesource.com/196271 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* tegra: move to charger v2.Louis Yung-Chieh Lo2014-04-224-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This would move all tegra boards to charger v2. Also removed the unnecessary charge_keep_power_off(), which was designed for USB power port and doesn't apply to Tegra platform. BUG=none BRANCH=nyan,big,blaze TEST=build and run on nyan. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194384 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Tested-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 2e41eb9eb9e9b816a12e58a42fb9b2a2ceeb8a36) Change-Id: Ic3e6362198ee1d86dc3d27c9079c39195650844f Original-Change-Id: I1d29328441c85342b977fd3069651cddbffc882c Reviewed-on: https://chromium-review.googlesource.com/196270 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* lpc: ACPI query-next-event drops masked eventsRandall Spangler2014-04-172-6/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, you could use EC_CMD_ACPI_QUERY_EVENT to read events that were masked off (that is, events which would not generate SCI/SMI/wake signals). The handlers for those signals on the host would still act on the masked-off events - for example, causing unwanted power button keypresses/releases. Now, EC_CMD_ACPI_QUERY_EVENT will only return events which are unmasked. This does not affect storing of events at event generation time. Events are still queued; they won't be dropped until the host attempts to read the next event. This gives the host a chance to set a mask later in boot (but before querying any events) to capture events which happened early in the boot process. BUG=chrome-os-partner:26574 BRANCH=rambi TEST=At EC console, type 'hostevent set 0x80' but don't press enter. Hold down the power button; UI starts fading to white. Press enter at the EC console to issue the hostevent command. System should continue shutting down, not fade back as if the power button were released. Change-Id: Id2cb14b0979f49cdd42424b9a61b310a2bb506f5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194935 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* blaze: implement the power and battery LED behaviorDevin Lu2014-04-175-6/+199
| | | | | | | | | | | | | | | | | | | Add LED behavior for blaze that will the same as falco and kip. BUG=None BRANCH=ToT TEST=manual Check battery LED show Amber when battery in charging. Check battery LED show white when battery fully. Check battery LED show blinking every 500ms when charging error. Check PWR LED light when system power on. Check PWR LED off when system power down. Check PWR LED will blinking every 1sec when system into suspend. Change-Id: I830952361d3282ff78d29a9a33bd09b64b093ee1 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/193744 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
* blaze: add battery configurationDevin Lu2014-04-171-45/+30
| | | | | | | | | | | | | | | | | Set battery cut off command and config battery configuration for blaze. BUG=chrome-os-partner:27120 BRANCH=ToT TEST=manual build ec and flash to blaze board, verify battery works. Verify battery cut off function is workable. Change-Id: I2e1f7de9c6370a2a02fb56fc4520f4bc062b4d6b Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193000 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
* big: Modify LGC battery setting based on battery speccloud_lin2014-04-122-5/+8
| | | | | | | | | | | | | | | | 1. Modify voltage_max 2. Set CP point BUG=chrome-os-partner:27859 BRANCH=Big TEST=Plug in AC and battery, use UART command "charger" to check v_batt and I_in and the values are correct. Change-Id: If83a444338e8d520e6c2f4d04ca6016c14cea8bd Reviewed-on: https://chromium-review.googlesource.com/193584 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Lin Cloud <cloud_lin@compal.com> Tested-by: Lin Cloud <cloud_lin@compal.com>
* Smart Battery: Buffer battery parameters while they are updatedDave Parker2014-04-121-33/+34
| | | | | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:27736 BRANCH=ToT TEST=Verify battery charges and 'battery' console command returns sane values. Original-Change-Id: I57d9d432bce4ed28678dddc43fa5166905525557 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193338 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Conflicts: driver/battery/smart.c Change-Id: Idae79859961da888e652b3af306ba49c467b412e Reviewed-on: https://chromium-review.googlesource.com/193655 Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org>
* Zinger board configurationVincent Palatin2014-04-128-187/+502
| | | | | | | | | | | | | | | | | | Add the USB Power delivery PHY configuration, and all the pins and details to use the real Zinger board. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: Ic2d3616c9fd2bf3ebeccba74a5519697e7c3e899 Reviewed-on: https://chromium-review.googlesource.com/194220 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* FruitPie board configurationVincent Palatin2014-04-128-16/+455
| | | | | | | | | | | | | | | | | Add all the pins configuration to use the real FruitPie board and the USB Power Delivery configuration. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make BOARD=fruitpie Change-Id: I8c20118400cb6a2e26b541a9ee2da5b706299fcf Reviewed-on: https://chromium-review.googlesource.com/189862 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* stm32: USB Power Delivery physical layerVincent Palatin2014-04-123-0/+497
| | | | | | | | | | | | | | | | | Implementation of the physical layer for USB Power Delivery communication using the STM32 chip. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: I2a4adeef572b97a284bf52ab9d14d23246c56d18 Reviewed-on: https://chromium-review.googlesource.com/189867 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* USB Power Delivery core codeVincent Palatin2014-04-125-0/+1086
| | | | | | | | | | | | | | | | The protocol layer implementation for USB Power Delivery messaging. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: I7db75b004cf9dbf13fa1df95336f206e93236fc9 Reviewed-on: https://chromium-review.googlesource.com/189866 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Refactored keyboard scan enable flag to allow for multiple disable reasonsAlec Berg2014-04-117-62/+77
| | | | | | | | | | | | | | | | | | | | | | Refactored keyboard scan enable/disable flag such that it is a mask of potential disable sources. When all disable sources are off, scanning is enabled, otherwise scanning is disabled. This fixes a recently introduced bug in which enabling/disabling keyboard scanning due to lid angle in S3 was interfering with enabling/disabling keyboard scanning due to power button. This also allows for easy expansion for future causes for disabling keyboard scanning. BUG=chrome-os-partner:27851 BRANCH=rambi TEST=Manual tests with a glimmer. Used the ksstate console command to check state of keyboard scanning under all permutations of power button pressed/unpressed, lid switch open/closed, and lid angle in tablet position vs. laptop positon. Change-Id: Ied4c5ebb94510b1078cd81d71373c0f1bd0d6678 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194287 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cortex-m0: add more thumb1 helpersVincent Palatin2014-04-111-11/+53
| | | | | | | | | | | | | | | | Add other helpers for compact switch on ARMv6-M. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: I711ee8361ff1545acd978974d9f9fc306ca43b78 Reviewed-on: https://chromium-review.googlesource.com/190711 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Stop charge_state_v2 from spewing problems with no battery.Bill Richardson2014-04-111-9/+29
| | | | | | | | | | | | | | | | | | | | | When the battery pack is missing, don't constantly spew console messages about it. Just note it once, and move on. But if we're precharging to try to awaken a dead battery, say so and also say so when we either give up or the battery awakens. BUG=chrome-os-partner:20881 BRANCH=ToT TEST=manual I unplugged and replugged the battery while watching the EC console. It stops the whining. Also tested without CONFIG_BATTERY_PRESENT_CUSTOM defined. It precharges, gives up, continues, etc. Change-Id: I5d4224cd1a6bf90ed6a1cf404260cdf6c61fc125 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194113
* Increase test coverage of charge_state_v2.cBill Richardson2014-04-115-34/+474
| | | | | | | | | | | | | | | This improves some of the smart battery mocks, and adds some more tests for the new change state machine. BUG=chrome-os-partner:20881 BRANCH=ToT TEST=make coverage Line coverage of this file jumps from 53% to 93%. Change-Id: I4a9b8818cefaffd3022cebe08a36d592b0611295 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193690
* Move common charge_state time constants to a common headerBill Richardson2014-04-114-44/+42
| | | | | | | | | | | | | | | | We had duplicate values in both v1 and v2 headers. Let's consolidate them in one place, and prefix the constants with "CHARGE_", so people don't use them randomly. BUG=chrome-os-partner:20881 BRANCH=ToT TEST=make buildall -j No functionality changes, refactor/rename only. Change-Id: I0ee599a2e3bf0835c2c0a7e57872ad9015701a4b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193876
* flash_ec: Only kill -9 as a last resortDoug Anderson2014-04-111-3/+20
| | | | | | | | | | | | | | | | When we use 'kill -9' to kill other users of the serial port then we end up with stale lockfile warnings. Try to use a normal kill first to be a little nicer. BRANCH=ToT BUG=None TEST=flash_ec and no longer get stale lockfile messages from cu. Change-Id: Idb39ca803a9c54b6fe972f6854515ea5a8bdab03 Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194190 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* accel: Add host cmd for setting lid angle threshold for disabling keyboard wakeAlec Berg2014-04-118-17/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a sub-command to the motionsense host command (0x2b) for getting/setting the lid angle at which the keyboard is disabled as a wake source in S3. The value can be anywhere from 0 to 360 degrees, default set to 180. Note, this only takes affect for boards that have CONFIG_LID_ANGLE_KEY_SCAN defined. Modified ectool motionsense command to use new host sub-command. Also modified the lid angle measurement in the EC to be in the range [0, 360], instead of [-180, 180], and changed casting of lid angle as an int to round to nearest. BUG=none BRANCH=rambi TEST=Tested on a glimmer: Using default keyboard disable lid angle of 180, made sure that when lid angle is past 180, key presses do not wake system, and when lid angle is less than 180, key presses do wake up system. Used ectool motionsense kb_wake to set the keyboard disable lid angle to 0. Made sure that keyboard never wakes up the system. Set keyboard disable lid angle to 360 and made sure that the keyboard always wakes up the system. Change-Id: I437164c6e38c29169ef6e20e86c9cf2a1c78f86e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193663 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194172
* accel: Add arg to ectool motionsense to print sensor active flag.Alec Berg2014-04-101-0/+26
| | | | | | | | | | | | | | | Added arg to ectool motionsense command to print the active flag. BUG=none BRANCH=rambi TEST=Tested ectool command on glimmer Change-Id: I4066302d388857b2646a4ee778aa7f671e9b7d2a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193630 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 6c09268ca19d7d3db497beff65a5db79f33657cb) Reviewed-on: https://chromium-review.googlesource.com/194082
* Small bugfix in low-battery notification (charge_state_v2.c)Bill Richardson2014-04-091-1/+1
| | | | | | | | | | | | | I used '&&' instead of '&' for bitfield operations. Hooray for test coverage! BUG=chrome-os-partner:20881 BRANCH=ToT TEST=make buildall -j Change-Id: I7e6343df4aead456d4984bf77667aa5cf852aa15 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193735 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* DPTF: Don't restore charging current limit on resumeDave Parker2014-04-081-18/+3
| | | | | | | | | | | | | | | | | | | | | | | The host should be responsible for setting any required charge throttling at resume. EC the should not restore the previous charge current limit as the the charging and thermal state of the device are likely to be different when the device resumes. BUG=chrome-os-partner:27369 BRANCH=ToT TEST=Suspend the device with the adapter unplugged. Plug in the adapter and resume. Verify that the charging LED doesn't flash two or three times at resume. (tested on squawks) Change-Id: I1fbba0652419501193e713e130830a005c6b5a22 Origianl-Change-Id: I1e4615d99ee9a386b25e58b991e846c5d2beaa39 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192686 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193341 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* accel: refined motion sense host command interfaceAlec Berg2014-04-053-23/+94
| | | | | | | | | | | | | | | | | | | | | | Added enum for motion sensor ID's into ec_commands.h so that the host can easily send host commands targeting the desired accelerometer. Changed sensor present flag to just senosr flags, currently with only a single mask defined for sensor present. This allows for easier future expansion of various flags. Also, added a motion sense module flags to the dump sub-command for flags that represent all sensors, such as is the motion sense task active. BUG=chrome-os-partner:27321 BRANCH=rambi TEST=Manual test on a glimmer by testing ectool motionsense command Change-Id: Iac052269a60db9ff4506f0490c3a0c6daad5b626 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193122 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193309
* accel: changed motion sense host command to be more permissive with data argsAlec Berg2014-04-051-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Changed the ec_rate sub-command of the motion sense command. Now it permits any value for the rate as an argument and then bounds that to within the min and max. This matches the behavior of the other sub-commands such that for any argument the command will return success, but if the arg is not valid, it finds the closest valid value. BUG=none BRANCH=rambi TEST=Tested on a glimmer by using the ectool motionsense command. Made sure if you give it a value outside of the range [5, 1000], then it simply bounds it to the closest value in that range: > ectool motionsense ec_rate 0 5 > ectool motionsense ec_rate 100 100 > ectool motionsense ec_rate 1100 1000 Change-Id: If71299e3ab27bcfac87103c672793ac61f88100e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192525 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193308
* accel: add host command to modify accel params and add ectool commandAlec Berg2014-04-059-106/+789
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Created a host command to set/get various motion sensor parameters and added an ectool command to use that host command. The host command is created such that the first argument is a sub-command. Sub-commands created include: dump: dumps all current motion sensor data info: returns general information about each motion sensor ec_rate: set/get the EC sampling rate of sensors sensor_range: set/get the sensor range (ie +/- 2G,4G,8G) sensor_odr: set/get the sensor output data rate (ie 50Hz, 100Hz, ...) For sensor_range and sensor_odr parameters, since the host doesn't know what are valid values for the parameter, the host can specify to round up or down to the nearest valid value. For example, the host can specify to set the output data rate to at least 100Hz, and the EC will return the closest valid output data rate that is at least 100Hz. BUG=chrome-os-partner:27321 BRANCH=rambi TEST=Test on a glimmer using ectool from vt-2 prompt: > ectool motionsense help Usage: motionsense - dump all motion data motionsense info NUM - print sensor info motionsense ec_rate [RATE_MS] - set/get sample rate motionsense odr NUM [ODR [ROUNDUP]] - set/get sensor ODR motionsense range NUM [RANGE [ROUNDUP]]- set/get sensor range > > ectool motionsense Sensor 0: 0, 0, 1024 Sensor 1: 1024, 0, 0 Sensor 2: None > ectool motionsense info 0 Type: accel Location: base Chip: kxcj9 > ectool motionsense ec_rate 10 > ectool motionsense ec_rate 1000 1000 > ectool motionsense odr 0 100000 > ectool motionsense odr 0 40000 1 50000 > ectool motionsense range 0 8 8 After running this I verified on the EC console that all the parameters were set appropriately. I tested the EC sampling rate was 1000ms by running lidangle on and making sure samples were displayed roughly every second. I verified the sensor odr and range by defining CONFIG_CMD_ACCELS and typing: > accelrange 0 8 > accelrate 0 50000 Change-Id: I444e2f0eafabd607f1c7aa78b5c4e91f6cb06387 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192064 Reviewed-on: https://chromium-review.googlesource.com/193307 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add host command to control charge state v2Bill Richardson2014-04-056-42/+325
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the obsolete and temporary (ha!) EC_CMD_CHARGE_DUMP host command with EC_CMD_CHARGE_STATE. This is used to monitor and adjust the new charge state implementation, including any board-specific customizations. This command is a single catch-all command with multiple subcommands (similar to EC_CMD_LIGHTBAR_CMD) so that we don't have to keep adding new top-level host commands just to support incremental changes. BUG=chrome-os-partner:23776 BRANCH=ToT TEST=manual From the AP, try these commands: ectool chargestate show ectool chargestate param ectool chargestate param <NUM> ectool chargestate param <NUM> <VALUE> Watch the EC console and use its "chg" command to verify the effects of setting various params. Note: the Samus-specific fast-charging profile override is param 0x10000. You can check it with the EC console "fastcharge" command. Change-Id: Iad2f773a085bc25c05073b3eed9866f122ae9d78 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193305 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Samus: Workaround for flaky battery temp readingBill Richardson2014-04-052-0/+25
| | | | | | | | | | | | | | | | | | | | | | Sometimes the battery happily reports that it's current temperature is 6280C, which is just a little bit high. This just treats unreasonably high temperatures as an error. BUG=chrome-os-partner:27527 BRANCH=ToT TEST=manual Make the change, watch the EC console while the AP is running and the battery charges and discharges. The problem is intermittent, but when it occurs it shuts the AP down immediately. With this change, it just prints a warning instead. I've also added a check for this to test/sbs_charging_v2.c Change-Id: Ibfa53cf0244499ec52d4887bcd06fb9126c07a6c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193277 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Retry 8042 keyboard interrupts if host isn't respondingRandall Spangler2014-04-051-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the host somehow fails to see an edge on the keyboard IRQ line, it won't read the 8042 data register. The EC won't ever send another IRQ, because it only does so after filling the register. So the keyboard will hang. Work around this with a retry mechanism. If the AP hasn't responded after 3 additional keyboard events, generate another IRQ. So a stuck key will get unstuck if you tap it a few times. That's reasonable, and matches what people do already if they have a sticky key due to crud accumulating in the keyboard. I've tested this when the system is booted to the OS. I don't see any additional IRQs generated on the EC console ("KB extra IRQ"), so the host is keeping up with the keyboard input stream. If I'm in dev or recovery mode and bang on the keyboard right after powering the system on (when the BIOS isn't yet paying attention to the keyboard), I can see extra IRQs generated. This shows the retry mechanism is working. The extra IRQs have no negative effect on the boot process, and the keyboard works normally when the OS does eventually boot. BUG=chrome-os-partner:27222 BRANCH=rambi TEST=Bang on the keyboard like a monkey. Keyboard should still work. Change-Id: Idd41b2d133267f48f959bca0cf062a18ca6551fb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193272 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
* Fix idle task deep sleep on Samus.Bill Richardson2014-04-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Samus' power sequence is not in common/power, so it was overlooked when enabling deep sleep support. Fix it. BUG=chrome-os-partner:27705 BRANCH=ToT TEST=manual Verify that the EC is not going into deep sleep while the AP is on by looking at the EC console: With the AP on: > idlestat Num idle calls that sleep: 1518647 Num idle calls that deep-sleep: 414 Time spent in deep-sleep: 0.000000s Total time on: 316.642174s Deep-sleep closest to wake deadline: 698us > sleepmask sleep mask: 00020001 > With the AP off (or in S3): > idlestat Num idle calls that sleep: 1846586 Num idle calls that deep-sleep: 831 Time spent in deep-sleep: 11.089183s Total time on: 388.695558s Deep-sleep closest to wake deadline: 698us > sleepmask sleep mask: 00020000 > Change-Id: Iba708b6d53f96ef6d49d42bcf6d21db4732399b0 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193223 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Add detailed comments about EC_MEMMAP area to ec_commands.hBill Richardson2014-04-041-10/+20
| | | | | | | | | | | | | | | | | This clarifies the use of the EC's memory-mapped interface to the AP. We always end up reverse-engineering this, so I'm just documenting what bytes are actually used. BUG=none BRANCH=ToT TEST=make buildall No code changes, only comments. Change-Id: Icfaa794626d2f656ab5d8a8d067b3e2663cc8882 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193052 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* i8042: add a console command to dump internal state.Louis Yung-Chieh Lo2014-04-041-6/+89
| | | | | | | | | | | | | | | To help i8042 debug, add a new "8042" command. It also integrates other 8042-related command in one place to dump all 8042 state. Also few fixes to re-format the output. BUG=none BRANCH=none TEST=Buidl and tested on squawks Change-Id: I23d0522aa9d32b38efc864cb97217852a5ad1ea0 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193123 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lm4: Ensure falling edges on outputs to edge-sensitive host inputsRandall Spangler2014-04-041-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The KBD_IRQ#, SMI#, and SCI# lines on the host are sensitive to falling edges. When generating an interrupt, wait long enough to make sure the lines are high before pulling them low, so that it reliably generates a falling edge. This solves a problem where calling the IRQ-generation function twice in rapid succession could cause two low pulses without an intervening logic-high as seen by the host (and thus not a falling edge as seen by the host). This is most visible on the keyboard line, because it can generate back-to-back events on multi-byte scan codes. Once the keyboard mailbox is full, the EC will never attempt to fill it, and thus it also won't attempt to generate another keyboard IRQ. And since the host missed the IRQ, it doesn't know it needs to empty the mailbox. It could theoretically happen for the other lines, so fix them now just to be safe. This change should be low-impact and free from side effects. 4 usec is a very small additional delay. Even 65 usec added delay for SCI/SMI is small, given that SCI/SMI events are typically much less frequent (if they're happening very frequently, something else is tragically wrong with the system...) BUG=chrome-os-partner:27222 BRANCH=rambi TEST=Bang on the keyboard like a monkey. Keyboard shouldn't get stuck. Orig-Change-Id: Id4e6de793b1f007f713bac8aa195ddd78feeea3e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193173 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org> (cherry picked from commit 569651b82e309ddd86b9c165d131e34cb7f7b2b5) Change-Id: I62a9ad0fa85121b3345c057f0e3fc6b3cc29e97e Reviewed-on: https://chromium-review.googlesource.com/193174 Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org>
* More info in console messages from charge state v2Bill Richardson2014-04-021-1/+12
| | | | | | | | | | | | | | | | Instead of printing "problem 2", print "problem 2 (set current)". BUG=none BRANCH=ToT TEST=manual Let the battery charge, watch the EC console for problems. Observe the new messages. Change-Id: I787c2fba4630421cdbd02050e96d8203b0268b3f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192873 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Samus: LIGHTBAR_RESET_L should be open-drain.Bill Richardson2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This GPIO was configured as TTL. It should be open drain instead. BUG=chrome-os-partner:27280 BRANCH=ToT TEST=manual Hard reboot, lightbar still works. Try turning it off and on from the EC console: > gpioset LIGHTBAR_RESET_L 0 lightbar goes dark. > gpioset LIGHTBAR_RESET_L 1 > lightbar init > lightbar on lightbar comes on again. Change-Id: If4d4beade8c95f3f231eeed435e35350ce866cea Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192871 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Update some comments to reflect newly-filed bugsBill Richardson2014-04-021-22/+12
| | | | | | | | | | | | | | | | | | I've filed several new bugs for things that need doing to common/charge_state_v2.c. This just adds those bug numbers to the comments. BUG=none BRANCH=ToT TEST=make buildall No new functionality; changes to comments only. Change-Id: I980d743e2bcad81e469a4dd99b542b7cf223ef60 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192882 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add OWNERS filesRandall Spangler2014-04-023-1/+11
| | | | | | | | | | | | | | | | | These are not currently checked by gerrit, but will be at some point in the not-too-distant future. The board/ directory gets additional owners to make it easier for partner eng to make changes in ToT. BUG=chrome-os-partner:27404 BRANCH=none TEST=none (since gerrit doesn't check owners yet) Change-Id: Ie21b9530fcc6d708ab987d9de80676f91faa72b9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191947 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add charge_state_v2 algorithm for use by SamusBill Richardson2014-04-0114-16/+1266
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a complete rewrite of the charge_state task used by x86 platforms. Rather than having a bunch of state-specific functions, each with their own error handling and special cases, this is organized like so: Forever: 1. Read everything we can from the battery and charger. 2. Figure out what we'd like to do (including error handling). 3. Allow for customization to override that. 4. Do it. Things I need to file bugs for are marked with "TODO(wfrichar)". I'll file the bugs after this CL goes in, so that they'll have something relevant to refer to. BUG=chrome-os-partner:20881 BRANCH=ToT TEST=manual make buildall -j Try it on Samus, watch it charge from nearly empty to full, both with and without fastcharge enabled. Also undefine CONFIG_BATTERY_PRESENT_CUSTOM, plug and unplug the battery to be sure the trickle charging logic is correct when it can't tell if the battery is present. Change-Id: I3935cd3b87f322eb52178f8a675a886c16b75d58 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191767 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: "temps all" lists nothing if no sensor connects to EC.Louis Yung-Chieh Lo2014-04-011-1/+7
| | | | | | | | | | | | | | | | | | | On some boards, the temperature sensor doesn't route to EC. Thus the 'ectool temps all' would get "200" for every temp sensor. This is misleading information. So, check the EC_MEMMAP_THERMAL_VERSION before we dump. If it is 0, then the temp data is not filled (and properly will not be filled). BUG=chrome-os-partner:27460 BRANCH=all TEST=Tested on big, which doesn't have sensor routed to EC. Change-Id: I03e9736054ed602b7cc126e9fd958e0cecea79b4 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192149 Reviewed-by: Mao Huang <littlecvr@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* big: fixed a LED corner case while almost fullLouis Yung-Chieh Lo2014-04-011-1/+10
| | | | | | | | | | | | | | | | | | Vic points out a corner case that the battery LED could be off by the followng steps: 1. charge the battery to very full 2. disconnact the AC so that the LED is off for discharge. 3. plug AC again, then charger enters INIT state --> IDLE0 --> IDLE where those states don't toggle LED. BUG=none BRANCH=big TEST=Reproduced this bug on big. Verified this has been fixed by this CL. Change-Id: I7125acd6b11953675ac6d4085e31e0560b384015 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189757
* Rambi, Squawks: Clean up old comment on keyboard IRQChromeOS Developer2014-04-012-8/+0
| | | | | | | | | | | | | | | | | The comment about cleaning up _NEW signals related to the keyboard IRQ was taken care of by https://chromium-review.googlesource.com/#/c/181718/4 BUG=None BRANCH=ToT TEST=make buildall -j 32 Change-Id: I635ec910b0c2f7fe686c9a7480095a65085e8a91 Original-Change-Id: I97e6f66340d9f8683ed69548cdbbe7c243c3b764 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185020 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192199
* Squawks: Fix manual control of the power LEDChromeOS Developer2014-04-011-1/+1
| | | | | | | | | | | | | | | | | BUG=chrome-os-partner:25531 BRANCH=None TEST=Run the following: ectool led power off ectool led power green ectool led power green=20 ectool led power auto Change-Id: I0f6808290a495666dc5c048c9a2198fc6dd337d5 Original-Change-Id: I6d2ad424da12b7db5b6a33acd281eecfe56f61e0 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189603 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192198
* Squawks: Set adapter input current to 1575mAChromeOS Developer2014-04-011-1/+1
| | | | | | | | | | | | | | | | | Requested by ODM. BUG=chrome-os-partner:24933 BRANCH=ToT TEST=Verify input current with 'adc' console command while system charging the battery and under heavy load. Change-Id: I66a98852678758b4e73a7231d318b073ea5416c5 Original-Change-Id: I797a06cf4a3325c3895c6567d3e64465121efc70 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189387 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192197 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Squawks: Add smart battery temp sensor to temp sensors listChromeOS Developer2014-04-012-0/+6
| | | | | | | | | | | | | | | BUG=None BRANCH=ToT TEST=Run "ectool temps all". Verify battery temp reported. Remove battery, verify an error is reported. Change-Id: Ib20a0fda29f7cb88f0415efa5ae0b58ecf912a72 Original-Change-Id: Id8e5c26dde3e1332208a1ea2744f14a56808caea Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186414 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192196 Reviewed-by: Randall Spangler <rspangler@chromium.org>