summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfirmware-squawks-5216.152.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/+/3155256 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 Chen2014-10-301-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/226652
* 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> (cherry picked from commit d95fcdc457a51dff8003b8cb29b32319f4fdd8ca) Reviewed-on: https://chromium-review.googlesource.com/197535 Reviewed-by: Shawn Nematbakhsh <shawnn@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-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: I19d6c5f25ea682d64b3125342276285d06b0cebc Orig-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> Reviewed-on: https://chromium-review.googlesource.com/195604 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-111-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: I203c90a65e4aa2907a14077a9276674ecfa292f2 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/194347 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Smart Battery: Buffer battery parameters while they are updatedDave Parker2014-04-091-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> Previous-Reviewed-on: https://chromium-review.googlesource.com/193338 (cherry picked from commit 3e4114921efb380074a575cf243f9fb173a9c283) Reviewed-on: https://chromium-review.googlesource.com/193791 Reviewed-by: Benson Leung <bleung@chromium.org> Commit-Queue: Bernie Thompson <bhthompson@chromium.org> Tested-by: Bernie Thompson <bhthompson@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
* Glimmer: Use HOOK_INIT to disable battery cuttoffChromeOS Developer2014-03-252-2/+15
| | | | | | | | | | | | | | | | | | | Previously the battery cutoff disable code was relying on an extra AC change event that was sent at power-on. BUG=None BRANCH=None TEST=Enable ship mode with "ectool batterycutoff" or "battcutoff" on the EC console. Disconnect AC power (if connected) to turn off. Pluc AC power back in for 1 second and unplug again. System should stay powered. Change-Id: Icb566fb0fecb350f3fc5d4ebcad134d2cc488925 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191297 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clapper: Use HOOK_INIT to disable battery cuttoffChromeOS Developer2014-03-251-3/+13
| | | | | | | | | | | | | | | | | | | Previously the battery cutoff disable code was relying on an extra AC change event that was sent at power-on. BUG=chrome-os-partner:27160 BRANCH=None TEST=Enable ship mode with "ectool batterycutoff" or "battcutoff" on the EC console. Disconnect AC power (if connected) to turn off. Pluc AC power back in for 1 second and unplug again. System should stay powered. Change-Id: I390aebc2d486bb9513914781eb68dc9e6c22fb89 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191099 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Initialize extpower module prior to modules with default priorityChromeOS Developer2014-03-252-1/+3
| | | | | | | | | | | | | | | | | | | | | | This ensures that modules with default priority (or later) get an accurate response from extpower_is_present(). BUG=chrome-os-partner:27160 BRANCH=ToT TEST=Add a default priority initializer. Verify it gets the correct value for extpower_is_present() with and without external power connected. static void extpower_init_check(void) { CPRINTF("[%T Extpower %s]\n", extpower_is_present() ? "on" : "off"); } DECLARE_HOOK(HOOK_INIT, extpower_init_check, HOOK_PRIO_DEFAULT); Change-Id: I13edc32b2a4609fad12982fd710fa95f9e81c9c2 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191296 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* accel: added mutex to protect critical code in kxcj9 accel driverAlec Berg2014-03-242-40/+143
| | | | | | | | | | | | | | | | | | | | | Added a mutex in kxcj9 accelerometer driver to prevent concurrent accesses when writing to critical registers on sensor. Also added more console debugging functions behind CONFIG_CMD_ACCELS to allow writing a new range, resolution, or data rate to each sensor. BUG=chrome-os-partner:26884 BRANCH=rambi TEST=Tested by defining CONFIG_CMD_ACCELS and playing around with writing/reading various parameters on each sensor and making sure that the accelerometer is still reporting data every so often using the lidangle on command. Change-Id: I2038f167fc8ca51723b0d1330aa090ab5158cf15 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191173 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clapper: Remove side volume buttonsChromeOS Developer2014-03-232-16/+0
| | | | | | | | | | | BUG=chrome-os-partner:27085 BRANCH=None TEST=Verify side mounted volume buttons no longer work on early revision of clapper. Change-Id: I15c144bafb833751f37b9cc4f15a9e806e5d6267 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190868
* Conditionally define accelerometer interrupt GPIOsChromeOS Developer2014-03-214-0/+8
| | | | | | | | | | | | | | | | | | | | motion_sense.c is only included for the MOTIONSENSE task which is set as a 'NOTEST' task. BUG=None BRANCH=None TEST=Run the following: make -j buildall make -j BOARD=clapper tests make -j BOARD=glimmer tests Change-Id: Ia6cc4452e60aedecd68ada76214a3b6f4251956e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/191069 Reviewed-by: Bernie Thompson <bhthompson@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org> Tested-by: Alec Berg <alecaberg@chromium.org>
* accel: Add disable and re-enable accel around critical register writesAlec Berg2014-03-201-24/+138
| | | | | | | | | | | | | | | | According to the kionix datasheet, you are supposed to disable the accel before writing to various critical registers. We haven't had a problem thus far, but better to match the datasheet to avoid future problems. BUG=none BRANCH=rambi TEST=ran on glimmer. made sure accels still work using lidangle command. Change-Id: If2d86c39c24c6ba13e118850c5e3f6c0174f4eb7 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190486 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* accel: clapper: glimmer: Add support for accelerometer interrupt.Alec Berg2014-03-2011-13/+196
| | | | | | | | | | | | | | | | | | | | | | | Adding in support for accelerometer interrupt for use currently in clapper and glimmer. This is disabled by default and can be enabled with CONFIG_ACCEL_INTERRUPTS. BUG=none BRANCH=rambi TEST=Manual test on a glimmer using accelint console command. On console enter: accelint 0 32 When you tap the lid, it should fire the interrupt and print msg to console. accelint 1 32 Tap the base and it will fire another interrupt. Change-Id: I0329112fdcae3c8adc0ca07e74fef7a591d4b9a1 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190099 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: rename accelerometer sampling interval macrosAlec Berg2014-03-201-5/+5
| | | | | | | | | | | | | rename accelerometer sampling interval macros BUG=none BRANCH=rambi TEST=make buildall Change-Id: Icd6127395c1da76e1d29618b2525f7b2174842bc Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190870 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* baytrail: Increase time after all voltages good to 15 msRandall Spangler2014-03-181-3/+3
| | | | | | | | | | | | | | | | | | | | | We had decreased this from 100 ms to 5 ms, but apparently we need at least 10 ms. Use 15 ms to give us some margin. BUG=chrome-os-partner:25264 BRANCH=rambi TEST=boot system Orig-Change-Id: I4d96aeb1040a042bac46fa8701a073d3355bfd2a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190485 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit b81c9779140fb19ec9d5d7150f1b0335a6dfce36) Change-Id: I09b6be7f5034ca332964131437164de63c5449b5 Reviewed-on: https://chromium-review.googlesource.com/190517 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* accel: glimmer: Fixed sign of accel z-axisAlec Berg2014-03-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The accelerometer calibration routine came up with the wrong sign for the z-axis. Fixed that bug and flipped the sign for glimmer in the standard reference frame rotation matrix. BUG=none BRANCH=rambi TEST=Tested on a glimmer. Ran calibration routine and then verified that if the unit is sitting flat on a table with lid open to 90, the accelometer data send to host should read: base = 0, 0, 1024 lid = -1024, 0, 0 When the laptop is closed and flipped over, the data should read: base = 0, 0, -1024 lid = 0, 0, -1024 Change-Id: If3bb7a095e400f5a247fab64b0050a44f4947e6c Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190400 Reviewed-by: Dave Parker <dparker@chromium.org>
* Clapper: Accel: Update std. reference frame transformChromeOS Developer2014-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | BUG=None BRANCH=None TEST=Sit the DUT on a flat surface and open the lid to 90 degrees. Check the memory-mapped values exported to the host in /sys/bus/iio/devices/iio:device0/ look something like: in_accel_x_base_input 0 in_accel_x_lid_input -1024 in_accel_y_base_input 0 in_accel_y_lid_input 0 in_accel_z_base_input 1024 in_accel_z_lid_input 0 Change-Id: Id22db5489db441150f890930487d514d406cfb05 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190388 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Charge State: Update memory-mapped AC status in the hook handlerChromeOS Developer2014-03-171-6/+28
| | | | | | | | | | | | | | | | | Update the AC status immediately in the AC_CHANGE_HOOK handler so the memmory-mapped value shared with the host is correct prior to the host receiving an "AC changed" ACPI notification. BUG=chromium:349681 BRANCH=ToT TEST=Plug/unplug AC power. Verify that the host 'ACEX' bit is set prior to it receiving ACPI event 4 (or cleared before ACPI event 5). See crbug.com/349681#c12 Change-Id: I1496efe1cfac9995e88bf9d84414ee903886d9ed Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/190345 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Debounce external power change eventsChromeOS Developer2014-03-172-11/+24
| | | | | | | | | | | | | | BUG=chrome-os-partner:26838 BRANCH=ToT TEST=Verify only one ACPI 4 event is generated when attaching external power and that only one ACPI 5 event is generated when removing external power. (using the ec console) Change-Id: Icaec298bd0f41708260117c26f83fe9158a7ad4e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189930 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add kip boardDevin Lu2014-03-178-1/+650
| | | | | | | | | | | | | | | BUG=chrome-os-partner:26767 BRANCH=rambi TEST=manual Run "make -j buildall" Run "make -j BOARD=kip tests" Change-Id: I920bdc92d8192307f368ef070530ed6691e52f85 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/190001 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Add Quawks boardKenneth Lo2014-03-178-1/+712
| | | | | | | | | | | | | | | Cloned board files from Squawks. BUG=chrome-os-partner:26688 BRANCH=rambi TEST=Run "make -j buildall" and "make -j BOARD=quawks tests" Change-Id: I4544fd6136ca7667016ffcf5ca1a93d39bcdb80e Reviewed-on: https://chromium-review.googlesource.com/189774 Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-by: Charles Yu <charles.yu@intel.com> Commit-Queue: Charles Yu <charles.yu@intel.com> Tested-by: Charles Yu <charles.yu@intel.com>
* Glimmer: Thermal policy changeHenry Hsu2014-03-151-1/+1
| | | | | | | | | | | | | | Remove throttle and change EC shutdown point to 70 degree. BUG=none BRANCH=glimmer TEST=none Change-Id: I8bae9e97d76d53debdfe439016da3994a2eaa42a Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/190000 Reviewed-by: Keith Tzeng <keith.tzeng@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org>
* Enguarde: Modify battery/adapter parameter.Henry Hsu2014-03-133-9/+4
| | | | | | | | | | | | | | | Change battery to 3S1P and configure the input current around 90%. Others are the same as rambi. (include ship mode, sensor location) BUG=chrome-os-partner:26748 BRANCH=None TEST=Run "make BOARD=enguarde" Change-Id: I2760f88a5704a356e283be9282f9e8e2e4d6a4dc Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/189749 Reviewed-by: Dave Parker <dparker@chromium.org>
* Enguarde: Initial EC commit based on rambiChromeOS Developer2014-03-128-1/+656
| | | | | | | | | | | BUG=chrome-os-partner:26748 BRANCH=None TEST=Run "make -j buildall" and "make -j BOARD=enguarde tests" Change-Id: I4b29c07b08f29f3897b43a06d86a0f6153ec0811 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189641 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Squawks: Flash charging LED orange if battery unresponsiveChromeOS Developer2014-03-121-1/+1
| | | | | | | | | | | | BUG=chrome-os-partner:26228 BRANCH=None TEST=Boot system with battery removed. Charging LED should immediately start quickly blinking orange. System will boot 30 seconds later. Change-Id: I5703e568f5fa7365a187519ceb2ebfa2d2e743c4 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189631 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Add function to check if battery is respondingChromeOS Developer2014-03-122-0/+15
| | | | | | | | | | | BUG=None BRANCH=ToT TEST=None. Requires subsequent change. Change-Id: I766974467363a56f484b29852feeff64f85f9922 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189630 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* rambi: change EC accel sampling rate and default sensor output data rate.Alec Berg2014-03-122-4/+26
| | | | | | | | | | | | | | | | | | Two accelerometer changes: - Lower accel sampling rate when chipset is off to 10Hz. Increase sampling rate back up to 100Hz when transitioning to S0. - Change the default output data rate of the accelerometers to 100Hz which matches the EC sampling rate when in S0. BUG=none BRANCH=rambi TEST=manual testing. used lidangle command to verify that in S0, EC is sampling at 100Hz, and in S3 or lower it is sampling at 10Hz. Change-Id: Ie4e20f45f9371d674c3325a362d2729c331fac4f Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189610 Reviewed-by: Dave Parker <dparker@chromium.org>