summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfirmware-enguarde-5216.201.BBrian Norris2021-09-101-0/+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/+/3155162 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* EC:KBC: Wait until LPC host senses the IRQ and gets the character.Kenji Chen2015-01-081-1/+6
| | | | | | | | | | | | | | | | BRANCH=master BUG=chrome-os-partner:29139 TEST=Buiid an EC FW image and run on Rambi to test if key loss is improved and any side effect somes with this change. Need more test units to confirm this. Signed-off-by: Kenji Chen <kenji.chen@intel.com> Change-Id: I2399e33d2ca3defe8cd9b1f94ab0af1db7f84635 Reviewed-on: https://chromium-review.googlesource.com/225557 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mohammed Habibulla <moch@chromium.org> (cherry picked from commit 8a1f1b045a2bffc0c3bf3941709acf4ba99d32e7) Reviewed-on: https://chromium-review.googlesource.com/239340 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Enguarde: Add new battery support.Hsu Henry2014-12-061-5/+104
| | | | | | | | | | | | | | | | | | | Change the battery parameters from new battery spec. The shipping commands for new battery is same as Glimmer's battery . Both old and new batteries are supported by EC BOARD ID. Also, change the charger's setting. (Disable the LDO mode, Enable SYSOVP) Enable SYSOVP is suggested by power engineer. The new battery have inertnal LDO same to glimmer. For new battery, enable the green book support. BUG=chrome-os-partner:34249 BRANCH=enguarde TEST=none Change-Id: I1266a03e887b205c7f4f320caa551c1691414e0a Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/233112 Reviewed-by: Mohammed Habibulla <moch@chromium.org>
* Cherry-Pick: Enguarde: Enable PWM module in deep sleepDave Parker2014-06-161-0/+1
| | | | | | | | | | | | | | | | | | This prevents erratic blinking of the charging LED while in G3. BUG=chrome-os-partner:29577 BRANCH=enguarde TEST=Shutdown machine and type 'dsleep 0' in the serial console to force deep sleep mode. Verify the charging LED doesn't flash erratically. Change-Id: Ie9088b3e1c0baf025716f09e16a783777de6c7eb Original-Change-Id: Ibc6af84f9f35e4ba3893269d9a306e4b5e99f70a Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/203850 Reviewed-on: https://chromium-review.googlesource.com/203922 Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
* Clapper: Modify battery LED's behaviorgit-CarryBK_Chen.compal.com2014-05-061-12/+12
| | | | | | | | | | | | | | | | Base on customer's request, change LED behavior BRANCH=clapper BUG=none TEST=Use battfake to verify each case Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: Icecd40d54ec28cdd242129cb862510914ef7616a Reviewed-on: https://chromium-review.googlesource.com/197486 Reviewed-by: Antonie Cheng <Antonie_Cheng@compal.com> Commit-Queue: Antonie Cheng <Antonie_Cheng@compal.com> Tested-by: Antonie Cheng <Antonie_Cheng@compal.com> Reviewed-by: Dave Parker <dparker@chromium.org>
* Quawks: Add pure hardware shutdown mechanism.Kenneth Lo2014-04-302-1/+48
| | | | | | | | | | | | | | | | | | | | Quawks boards need a pure hardware protection mechanism to shutdown/reset system even if EC is hanged. This is done using the ALERT# pin of TMP432 thermal IC. So EC programs TMP432 with specified temperature limit value every time when system is booted, to make sure this mechanism works as expected. BUG=chrome-os-partner:28184 BRANCH=rambi TEST=Run "make -j buildall" and "make -j BOARD=quawks tests". Tested by thermal engineers that system will shutdown when specified temperature is reached. Change-Id: I485852409153c036488eac2ae9c0a8fe4e2c5b61 Signed-off-by: Kenneth Lo <Kenneth_Lo@asus.com> Reviewed-on: https://chromium-review.googlesource.com/195120 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* baytrail: Workaround for stuck boot processRandall Spangler2014-04-295-13/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, the system will boot to S0 from the point of view of the EC, but PLTRST# will never deassert. Work around this by waiting 50 ms for PLTRST# to deassert. If it doesn't, force the chipset all the way down by deasserting RSMRST#, then pulse the power button to turn it back on. Also add a powerfail debug command to simulate this failure event, so that the recovery process can be tested. Add API to the LPC module to get the state of PLTRST#, and to the power button state machine to force it released when we shut down the chipset and and force another power button pulse as we reset the chipset. BUG=chrome-os-partner:28422 BRANCH=baytrail TEST=1. Boot system. Should boot normally. Shut system down. 2. powerfail 3. Boot system. On the EC console, should see the system come up, go back down through G3S5, then come back up. From the user's point of view, it just boots. 1. Boot system. Should boot normally. (That is, powerfail is not sticky) Change-Id: Ia7df629a2e2f017e411432d7e224a3c5eb95f8b8 Original-Change-Id: Ia57f196606f79b9f2fce7d9cd109ab932c3571aa Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/197534 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org> Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Glimmer: Support write first use day functionHenry Hsu2014-04-252-0/+41
| | | | | | | | | | | | | | | | Only support write function. BUG=chrome-os-partner:25145 BRANCH=glimmer TEST=clean correspondence register to 0, run "ectool batteryparam set 0 0x1234", and check the register. The register change to 0x1234. Command "ectool batteryparam set 0 0x1234" return 2 because we have no get function. Change-Id: I2d8c66fc41ddb45c45ff993eaed1e067689b1268 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/196973 Reviewed-by: Dave Parker <dparker@chromium.org>
* Quawks: Adjust charge thresholds for altering LED behaviorKenneth Lo2014-04-241-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The EC and host have different ways of computing and presenting the battery charge level. This change adjusts the charge levels at which the charging LED indicates a full and low battery to match what is presented to the user in the host UI. (Ported from [4e470aa]Squawks: Adjust charge thresholds for altering LED behavior) BUG=chrome-os-partner:27449 BRANCH=rambi TEST=Run "battfake 91" which charging, verify charging LED turns green and the UI reports 96%. Run "battfake 90" which charging, verify charging LED turns orange and the UI reports 94%. Run "battfake 13" while discharging, verify charging LED blinks amber (1 sec on, 1 sec off) and the UI reports 10%. Change-Id: Ib89dc4750fc4af91d0a7e706fa8c76c21823dfe8 Signed-off-by: Kenneth Lo <Kenneth_Lo@asus.com> Reviewed-on: https://chromium-review.googlesource.com/196156 Reviewed-by: Charles Yu <charles.yu@intel.com> Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org>
* Add host command to set battery vendor parametersDave Parker2014-04-245-0/+179
| | | | | | | | | | | | | | | | | | Also adds 'battparam' console command. BUG=chrome-os-partner:25145 BRANCH=ToT TEST=Run 'ectool batteryparam set 0 0x1234' 'ectool batteryparam get 0' and on the console: 'battparam 0' 'battparam 0 0x1234' on a board that implements parameter 0. Change-Id: Ib2812f57f2484309d613b23dab12ad43e0417bd2 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/195824 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Glimmer: Hard-code accelerometer power enableDave Parker2014-04-242-5/+4
| | | | | | | | | | | | | | | | This is a temporary fix to enable the accelerometers by hard-coding the power enable high until the CL to control and reset the accelerometers is landed. BUG=chrome-os-partner:27577 BRANCH=None TEST=Manual. Run on glimmer. Verify accelerometers work and are polled at the correct rate in S0 and S3 with console 'lidangle on' command. Change-Id: I619deffe6b5d1edb35c022cd0071310e2c2f1e3d Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194901
* Move battery cutoff to a shared command with config optionDave Parker2014-04-233-0/+93
| | | | | | | | | | | | | | | | | | | | | | | | | Boards can define the config option and implement a battery_cut_off() function to put their battery into "ship mode." Works with the existing "batterycutoff" host command. When using the host command, the battery is cut off 5 seconds after the system is shut down to minimize filessystem corruption issues. Also includes a "battcutoff" console command that requires AC power be removed. Cut off is immediate in this case. BUG=chrome-os-partner:28190 BRANCH=ToT TEST=Run 'ectool batterycutoff' and the console 'battcutoff' commands on a board using the CONFIG_BATTERY_CUT_OFF option. Verify the battery is cut off by pressing the power button >5 seconds after shutting down. Change-Id: I4d99a2e5aec53906416677ea44b41123b2957815 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196133 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>
* Gnawty: Init boardJimmy Lin2014-04-237-0/+721
| | | | | | | | | | | | | | | | | | | | | | | | | 1.Copy Rambi setting to init board. 2.Add entries for 'gnawty' in following two files. util/flash.ec chip/lm4/openocd/lm4x_cmds.tcl 3.Modify below battery paramemters to support 3 cell battery. input_current/charge_volatge/charge_current/temperature 4.Check the Battery of cutoff function works normally in gnawty. 5.Modify the temp_sensors of name and location. 6.Add power and battery of LED control for gnawty. BUG=none BRANCH=gnawty TEST=Run "make BOARD=gnawty" and "make buildall -j" to build code and ec.bin can be generated. Signed-off-by: Jimmy Lin <jimmy.Lin@quantatw.com> Change-Id: I5720838ef623ee3e0cb40710aeebb53599c3551d Reviewed-on: https://chromium-review.googlesource.com/195821 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Clapper: Hard-code accelerometer power enableDave Parker2014-04-232-5/+4
| | | | | | | | | | | | | | | | This is a temporary fix to enable the accelerometers by hard-coding the power enable high until the CL to control and reset the accelerometers is landed. BUG=chrome-os-partner:24894 BRANCH=None TEST=Manual. Run on clapper. Verify accelerometers work and are polled at the correct rate in S0 and S3 with console 'lidangle on' command. Change-Id: I947d4dee5d6dece4a32c9625d828e599b3167b01 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194902
* Make board names in flash_ec less prone to conflictsChromeOS Developer2014-04-221-8/+47
| | | | | | | | | | | BUG=None BRANCH=rambi TEST=Run util/flash_ec on clapper Change-Id: Ib388af6800ae208934d5b026a63f0567d31ef86e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196226 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Swanky: Add OpenOCD and flash tool configurationsHenry Hsu2014-04-222-1/+14
| | | | | | | | | | | | | | | Add some configurations for swanky, include OpenOCD and util/flash_ec. BUG=none BRANCH=swanky TEST=none Change-Id: Ibede079dcb304e0cf599df37d192a1d986549806 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/196191 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Squawks: Adjust charge thresholds for altering LED behaviorDave Parker2014-04-211-5/+12
| | | | | | | | | | | | | | | | | | | | | The EC and host have different ways of computing and presenting the battery charge level. This change adjusts the charge levels at which the charging LED indicates a full and low battery to match what is presented to the user in the host UI. BUG=chrome-os-partner:27743,chrome-os-partner:27746 BRANCH=rambi,tot TEST=Run "battfake 91" which charging, verify charging LED turns green and the UI reports 95%. Run "battfake 13" while discharging, verify charging LED blinks amber (1 sec on, 1 sec off) and the UI reports 10%. Change-Id: I326731c46e61a953b445cd9eda875d7dab3da4dd Original-Change-Id: I203c90a65e4aa2907a14077a9276674ecfa292f2 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194347 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/195847
* Glimmer: Change ADAPTER_ID pin to highHenry Hsu2014-04-212-0/+2
| | | | | | | | | | | | | | | | | Pull up adapter id pin will save power since we disable adapter id function. BUG=chrome-os-partner:28156 BRANCH=glimmer TEST=flash ec, hard reset, and run command "ectool gipoget ADAPTER_ID". It shows that GPIO ADAPTER_ID = 1. Change-Id: I37ee64f1b493e35e0181a636212c856b7755427a Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/195717 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Rename battery_vendor_params() to battery_override_params()Dave Parker2014-04-216-16/+16
| | | | | | | | | | | | | | | | This is a clearer name for the intent of the function to override the charging parameters requested by the battery. This also disabmiguates this function with a new host command to get and set arbitrary vendor parameters in the battery. BUG=chrome-os-partner:25145 BRANCH=ToT TEST=`make buildall -j` Change-Id: I1e8762d359c0e91c5b2a539553d22c12c9850c03 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/195823 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lpc: ACPI query-next-event drops masked eventsRandall Spangler2014-04-182-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. Orig-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> (cherry picked from commit d899fdaaeef175e97923b954342dad3a33c5c387) Change-Id: I69f495809a72bda77841ed16c041d0c3dbe198c2 Reviewed-on: https://chromium-review.googlesource.com/195566 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Kip: identify adapters and adjust the charger input currentDevin Lu2014-04-177-0/+323
| | | | | | | | | | | | | | | | | | | identify adapters and adjust the charger limit for each adapter. re-factored for adapter over rating. re-factored for battery over current. BUG=chrome-os-partner:27798 BRANCH=rambi TEST=manual build ec and flash to kip board. verify adapters can be identified. check AP can be throttle when battery over current. check AP can be throttle when adapter over rating. Change-Id: I1339f55d8ed523acf9543ee8acd7c7e3c9c99e9c Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194891
* 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/194097 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* accel: Add host cmd for setting lid angle threshold for disabling keyboard wakeAlec Berg2014-04-1010-41/+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>
* Add expresso board, copied from rambiDave Parker2014-04-098-1/+650
| | | | | | | | | | | BUG=chrome-os-partner:27003 BRANCH=None TEST=make buildall -j Change-Id: I2af28640db8b35de922ca60eeb176afe3e0dcb64 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193725 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* accel: Add arg to ectool motionsense to print sensor active flag.Alec Berg2014-04-081-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>
* Glimmer: Change fan rpmHenry Hsu2014-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | Only change fan rpm each step. on off RPM(FAN_ID low) RPM(FAN_ID high) 42 35 4050 4150 48 39 4400 4600 63 53 5100 5600 BUG=chrome-os-partner:25076 BRANCH=glimmer TEST=modify thermal sensor read function, the fan works fine with the above table. Change-Id: I59365c516c5c50d458ac576e307c8a7fb4aa64c6 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/193381 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Clapper: Disable keyboard in suspend if lid is open beyond ~180 degDave Parker2014-04-071-0/+13
| | | | | | | | | | | | | | | | | | | Added ability to disable the keyboard to wake from suspend when the lid is outside a certain angle range. BUG=none BRANCH=None TEST=Tested on a clapper: In S3, verified that when the lid is open past ~180 deg, the keyboard does not wake the machine. Also verified that if you align hinge with gravity, the keyboard enabled/disabled status remains the same (since we can't actually trust the lid angle value). Change-Id: I349e0fbc8def41f0280e2fb40af24fab4d465e3c Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193409 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Smart Battery: Buffer battery parameters while they are updatedDave Parker2014-04-071-20/+24
| | | | | | | | | | | | BUG=chrome-os-partner:27736 BRANCH=ToT TEST=Charge battery. Check that charging LED doesn't occasionally blink amber. 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>
* 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: I6faff3f42f541d5f8d939a8ae7ba1c9867812ae6 Original-Change-Id: Idd41b2d133267f48f959bca0cf062a18ca6551fb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/193363 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org> Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org> Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
* i8042: add a console command to dump internal state (cherry-pick).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 Original-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> (cherry picked from commit 6d8276c431b9549aa1b573bbe867342a1cdbc08b) Change-Id: I466714a547503180a6a41d1d9d1ae60999f095af Reviewed-on: https://chromium-review.googlesource.com/193208 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
* accel: refined motion sense host command interfaceAlec Berg2014-04-043-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>
* lm4: Ensure falling edges on outputs to edge-sensitive host inputsRandall Spangler2014-04-031-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. 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>
* DPTF: Don't restore charging current limit on resumeDave Parker2014-04-021-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: I1e4615d99ee9a386b25e58b991e846c5d2beaa39 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192686 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Kip: Modify adpater input current and battery configurationDevin Lu2014-04-022-4/+4
| | | | | | | | | | | | | | | | | | | Set input current to 2048mA for 45w adpater and config battery configuration for kip. BUG=chrome-os-partner:26767 BRANCH=rambi TEST=manual build ec and flash to kip board, Verify input current with 'adc' console command while system charging the battery and under heavy load. verify battery works. Change-Id: I10c4574b141236a0dd23dec0c4687e18ebdb2d98 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192560 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* accel: changed motion sense host command to be more permissive with data argsAlec Berg2014-04-011-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>
* Swanky: Init boardHenry Hsu2014-04-016-0/+637
| | | | | | | | | | | | | | Copy Rambi setting to init board. BUG=none BRANCH=swanky TEST=Run "make BOARD=swanky" and "make buildall -j" to build code and ec.bin can be generated. Change-Id: I36fbd44f31a9ac995b7807914dd56dd36515f16e Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/192225 Reviewed-by: Dave Parker <dparker@chromium.org>
* accel: add host command to modify accel params and add ectool commandAlec Berg2014-03-3113-112/+795
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Kip: Implement the power and battery LED behaviorDevin Lu2014-03-293-76/+137
| | | | | | | | | | | | | | | | | | | | Just copy falco's LEDs behavior, becuase HW's schematic was the same with falco. BUG=chrome-os-partner:26767 BRANCH=rambi 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: I2d0d330d750156053bad16f196e32566260544aa Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191243 Commit-Queue: Dave Parker <dparker@chromium.org>
* Add presubmit check for unit testVic (Chun-Ju) Yang2014-03-284-0/+22
| | | | | | | | | | | | | | | | | | | | | This enforces that "make buildall" runs at least once after the last file change. TEST=Try to upload without running "make buildall" TEST=Change a file without re-running "make buildall", and try to upload. BUG=None BRANCH=None Change-Id: If2b23cb036bb0f220d570eb12d8569824a4edf84 Original-Change-Id: Ia4abb3c0e17cf4d559975574f398d74c7986c89f Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185116 Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192168 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Stop hang detect timer when flags are set to 0Randall Spangler2014-03-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, setting flags=0 would disable any future timers from being started, but not stop any timer currently in progress. With this change, it does. BUG=chromium:298983 BRANCH=rambi,nyan TEST=manual on ap, ectool hangdetect 1 60000 0 on ec, hangdet -> status=inactive press power button on ec, hangdet -> status=active for event on ap, ectool hangdetect 0 0 0 on ec, hangdet -> status=inactive Change-Id: Ied3dd4f8a49b9d6a5968837fd859fca7c7b128ba Original-Change-Id: Icf8c6e0e95ae3780d250f9f01ec6a4dda6c56176 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184950 Reviewed-by: Daniel Erat <derat@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/192147 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Optimize memsetDaisuke Nojiri2014-03-283-11/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This speeds up memset by copying a word at a time. Ran the unit test on Peppy: > runtest ... Running test_memset... (speed gain: 141532 -> 32136 us) OK ... Ran make buildall: ... Running test_memset... (speed gain: 1338 -> 280 us) OK ... TEST=Described above. BUG=None BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Change-Id: If34b06ad70f448d950535a4bea4f6556627a9b6f Tested-by: Daisuke Nojiri <dnojiri@google.com> Reviewed-on: https://chromium-review.googlesource.com/185936 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@google.com> Change-Id: Icc26937a9490178b48224fd06954f6f5a8925ac7 Reviewed-on: https://chromium-review.googlesource.com/192144 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Optimize memmoveDaisuke Nojiri2014-03-282-16/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This speeds up memmove by copying a word at a time. Ran the unit test on Peppy: > runtest ... Running test_memmove... (speed gain: 2156 -> 592 us) OK ... Ran make buildall: ... Running test_memmove... (speed gain: 143918 -> 32367 us) OK ... TEST=Described above. BUG=None BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@google.com> Original-Change-Id: I6a3ac6aed27a404c3bef227b6c886a59414b51d7 Reviewed-on: https://chromium-review.googlesource.com/186020 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ifdb4fe710f7579d60b545f555196647247a22e7c Reviewed-on: https://chromium-review.googlesource.com/192143 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Optimize memcpyDaisuke Nojiri2014-03-282-7/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This speeds up memcpy by copying a word at a time if source and destination are aligned in mod 4. That is, if n and m are a positive integer: 4n -> 4m: aligned, 4x speed. 4n -> 4m+1: misaligned. 4n+1 -> 4m+1: aligned in mod 4, 4x speed. Ran the unit test on Peppy: > runtest ... Running test_memcpy... (speed gain: 120300 -> 38103 us) OK ... Ran make buildall -j: ... Running test_memcpy... (speed gain: 2084 -> 549 us) OK ... Note misaligned case is also optimized. Unit test runs in 298 us on Peppy while it takes about 475 with the original memcpy. TEST=Described above. BUG=None BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Change-Id: Ic12260451c5efd0896d6353017cd45d29cb672db Tested-by: Daisuke Nojiri <dnojiri@google.com> Reviewed-on: https://chromium-review.googlesource.com/185618 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@google.com> Change-Id: I973d080480741df4bb97c807ca011602cb732e7d Reviewed-on: https://chromium-review.googlesource.com/192142 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clapper: fix battery led's behavior when 0% battery on chargegit-CarryBK_Chen.compal.com2014-03-271-22/+22
| | | | | | | | | | | | | | | | | | | Condition : charge & 0% battery Battery LED : 500ms off, 1 sec amber BRANCH=clapper BUG=none TEST=Let battery in 0% and plug-in AC, the behavior of battery led is "500ms off, 1 sec amber" Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I5330baec7325c179f9b5e4c7ebac2e5b3527ed8a Reviewed-on: https://chromium-review.googlesource.com/191665 Reviewed-by: Carry Chen <CarryBK_Chen@compal.com> Tested-by: Carry Chen <CarryBK_Chen@compal.com> Reviewed-by: Antonie Cheng <Antonie_Cheng@compal.com> Commit-Queue: Antonie Cheng <Antonie_Cheng@compal.com> Tested-by: Antonie Cheng <Antonie_Cheng@compal.com> Reviewed-by: Dave Parker <dparker@chromium.org>
* BQ24715: Disable 40kHz audio frequency limit optionDave Parker2014-03-271-2/+2
| | | | | | | | | | | | | | | | | | | | | The audio frequency limit function requires additional power to keep the FET swtiching frequency above 40kHz. On some systems it is also reported to cause additional audible noise. Although the power-on setting is to disable this feature, we need to ensure the charge controller options are updated from running earlier versions of the driver. BUG=chrome-os-partner:27063 BRANCH=None TEST=Verify bit 10 is not set in the charger option register using the 'charger' EC console command. Change-Id: Ifab16ef3b53e25b5e82225040e7ab315d8760986 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191770 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
* lm4: Use a special task event for ADC conversionsChromeOS Developer2014-03-262-6/+19
| | | | | | | | | | | | | | | | | | | This prevents other task events from continuing the ADC conversion prematurely; potentially leading to a panic if the conversion interrupt occurs after the ADC has been powered down. BUG=chrome-os-partner:26919 BRANCH=rambi TEST=Perform ADC conversions while running a deferred function calling itself on a 10mSec delay. Verify no panics after ~6 hours. Change-Id: If44c43b08a7ac0a9514b1a5efb10fa8feee6c919 Original-Change-Id: Ic3894849c154b3f058e812b2da816e7cffb12cbf Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191302 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191709
* lm4: Update i2c handler to use task_wait_event_maskChromeOS Developer2014-03-261-25/+1
| | | | | | | | | | | | | BUG=chrome-os-partner:27180 BRANCH=rambi TEST=Verify i2c devices are still working (battery, charger) Change-Id: I07d21f31b6f4e48598ee5fe05e1181766bd0a162 Original-Change-Id: I9dc70454df35be9c9be3d9020c8dc3b760de5e07 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191301 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191708
* cortex-m: Add task_wait_event_mask() helper functionChromeOS Developer2014-03-262-1/+49
| | | | | | | | | | | | | | | BUG=chrome-os-partner:27180 BRANCH=rambi TEST=Tested indirectly via subsequent patches to use this call in the adc and i2c handlers for the lm4. Change-Id: I7ac1df290127898559f403344d437c4b4135e1b1 Original-Change-Id: I53501fdf47d606ea6c7705facb66e945e25d9745 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191300 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191707
* rambi: EC take control on charger to make sure charge batteryKein Yuan2014-03-261-0/+24
| | | | | | | | | | | | | | | | | | | | | in non-S0 states when work with DPTF. If user sleeps/shutdown system when on battery(or when TCHG is throttled), system will never charge while in S3 or S5. BUG=chrome-os-partner:355015 BRANCH=rambi TEST=with the same test system will charge in S3 or S5. Change-Id: I13b0667dcf94123f02e8f5c2945a532fe76be719 Original-Change-Id: Idc68b2f533da0a55ad07d0ff8e3e5294c1e2143c Signed-off-by: Kein Yuan <kein.yuan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/191153 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191723 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* rambi: glimmer: Disable key scanning in suspend when lid is openAlec Berg2014-03-2512-19/+193
| | | | | | | | | | | | | | | | | | | | | | | Added ability to disable the keyboard to wake from suspend when the lid is outside a certain angle range. This has been added to glimmer by defining CONFIG_LID_ANGLE_KEY_SCAN in its board.h. Also modified the lid angle calculation to include a reliability flag which can be used to tell when the hinge aligns too closely with gravity and the lid angle value is unreliable. BUG=none BRANCH=rambi TEST=Tested on a glimmer: In S3, verified that when the lid is open past ~180 deg, the keyboard does not wake the machine. Also verified that if you align hinge with gravity, the keyboard enabled/disabled status remains the same (since we can't actually trust the lid angle value). Change-Id: If1a1592d259902d38941936961854b81b3a75b95 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190061