summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix some stupid.stabilize-5511.Bstabilize-5500.71.Bstabilize-5500.26.Bstabilize-5500.130.Bstabilize-5500.100.Brelease-R34-5500.BBill Richardson2014-02-171-1/+1
| | | | | | | | | | | | | | Off-by-one error in read() call. BUG=chromium:239205 BRANCH=none TEST=none Change-Id: Ifec3dacfa07e83d70b2582036cab0cfc1ee9e8f7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186738 Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Update util/lbplay.c to use the sysfs interface.Bill Richardson2014-02-151-171/+138
| | | | | | | | | | | | | | | | | | | | | | | | This is just an example, demonstrating how a userspace program can access and control the Pixel lighbar. This change reflects the new unprivileged access methods. You can run this program to drive the lightbar without being root. BUG=chromium:239205 BRANCH=none TEST=manual Nothing builds this by default, but you can test it with cd src/platform/ec gcc -static util/lbplay.c then copy a.out to your Pixel and run it (from /tmp, since other directories are mounted noexec). Change-Id: I7c07512087c924d16c1c03df6176fba995fcd4f4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186672 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* cleanup: nyan: remove unnecessary dependence to pmu_tpschrome.hLouis Yung-Chieh Lo2014-02-143-2/+6
| | | | | | | | | | | | | | Nyan uses common/charge_state instead. So, fix the dependence. Since snow/spring/pit are using common/pmu_tps65090_charger, keep them. BUG=None BRANCH=Nyan TEST=build and works fine on Nyan 3.2 Change-Id: I985f7980578ac22602b1fbffa51edf039078bc05 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186337 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Optimize memmoveDaisuke Nojiri2014-02-132-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=chrome-os-partner:23720 BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@google.com> 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>
* Pit: Change the temperature range in discharging state.Jaehoon Kim2014-02-131-2/+2
| | | | | | | | | | | | | | | | | Samsung change the temperature range in battery discharing state from (0 <=temp < 100) to (-20 <= temp < 70) from this year. That's why we have to change the battery_temperature_range structure value as soon as possible so that our reliability team check the battery. BUG=chrome-os-partner:25731 TEST=Boot on the pit / pi and then check the battery is working or not in the oven. BRANCH=pit Change-Id: I3289d22176af043e80a881f1626da386e823d857 Signed-off-by: Jaehoon Kim <jh228.kim@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/186040 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Optimize memcpyDaisuke Nojiri2014-02-122-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=chrome-os-partner:23720 BRANCH=none Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> 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>
* Add comment about matching temp sensor index and name with corebootChromeOS Developer2014-02-122-2/+10
| | | | | | | | | | | BUG=None BRANCH=rambi TEST=None Change-Id: I702173af23e6207129149bdb83ec7116fec8af66 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185394 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* baytrail: Battery cutoff return codes were backwardsstabilize-5463.BRandall Spangler2014-02-112-2/+2
| | | | | | | | | | | | | | cutoff() returns 0 on success, not non-zero. BUG=chrome-os-partner:25646 BRANCH=rambi TEST=ectool batterycutoff succeeds Change-Id: Icca0c53aba82381b73dd679de5df3a97153d0662 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185737 Reviewed-by: Benson Leung <bleung@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org>
* Remove deprecated make_all.shVic (Chun-Ju) Yang2014-02-091-9/+0
| | | | | | | | | | | | | | This script has been deprecated for more than a month. It's time to remove it. BUG=None TEST=None BRANCH=None Change-Id: I6604d556e37ad90d9e9bec01664cbfaafcfb7a51 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185541 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Include battery fuel gauge temp sensor in temperature sensorsRandall Spangler2014-02-085-0/+30
| | | | | | | | | | | | | | | | | | | | This gives the AP a way to see that temperature for DPTF. Alarm thresholds were defined on a per-sensor basis, so they come along for free. BUG=chrome-os-partner:25585 BRANCH=rambi TEST=temps command shows same temp for battery as battery command (other than rounding error; battery command shows with 0.1C accuracy). 'ectool temps all' shows the battery temp as the last temperature. Unplug battery and temps command shows error for the battery temp, as does 'ectool temps all'. Change-Id: I1bce72f164d9fb1be631e7241a4ea24ddf409d7a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185444 Reviewed-by: Dave Parker <dparker@chromium.org>
* Samus: Support capsense input as keyboard events.Bill Richardson2014-02-088-5/+123
| | | | | | | | | | | | | | | | | | | | | | This is experimental for now; the capsense chip simply reports its buttons as the number keys on the keyboard (1-8). BUG=chrome-os-partner:23382 BRANCH=samus,ToT TEST=manual To test, you'll need a reworked and correctly programmed capsense module. Boot the system, and switch to VT2. Touch the capsense bar and you'll see the input appear on the console as though you were typing numbers. Note that the capsense hardware is still buggy. Refer to the bug for workarounds. Change-Id: I4c3a8b70b8197ffd538c38c59c9336383365afa7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185434 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org>
* Support DPTF charger current limitingRandall Spangler2014-02-084-6/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables the AP to limit charging current via ACPI. BUG=chrome-os-partner:23971 BRANCH=rambi TEST=manual drain battery down to <90%, then plug into AC (charger commands at EC console, iotools at root shell) iotools io_write8 0x66 0x81 iotools io_write8 0x62 0x08 iotools io_write8 0x62 3 charger -> dptf limit 192, I_batt=192 charger dptf 320 charger -> dptf limit 320, I_batt=320 iotools io_write8 0x66 0x80 iotools io_write8 0x62 0x08 iotools io_read8 0x62 -> 0x05 iotools io_write8 0x66 0x81 iotools io_write8 0x62 0x08 iotools io_write8 0x62 0xff charger -> dptf disabled, I_batt=(something > 192) iotools io_write8 0x66 0x80 iotools io_write8 0x62 0x08 iotools io_read8 0x62 -> 0xff Change-Id: Iace2ebbbc018143c0154310d7acd02d16a6b7339 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185411 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Fix set2 scancode for volume up media keyChromeOS Developer2014-02-081-2/+1
| | | | | | | | | | | | | | | | Also removes a useless BUILD_ASSERT. BUG=None BRANCH=None TEST=Boot kernel with cmdline arg i8042.direct=1 to force set2 mode. Push volume up/down & power key. Change-Id: I1689f06c5ae690624733c0625ce043cb1462abd0 Original-Change-Id: Ifc735d66b2f707e68b5c59959c47a0e295a7688c Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185392 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185315
* lm4: Remove 500k clock delay in clock_init()Randall Spangler2014-02-071-10/+0
| | | | | | | | | | | | | | | | | We copied that delay because it seemed to be necessary on early LM4 chips to avoid glitching the UART. But on current boards (e.g. rambi) this does not seem to be necessary, and delays boot by 31ms. So, remove the delay. BUG=chrome-os-partner:23794 BRANCH=rambi TEST=boot system; see little to no glitching on EC uart, and system boots ok hibernate 1; see little to no glitching on EC uart, and system boots ok Change-Id: I9d4b5927da4282e47e1b09be838104c64f25268c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185232 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* rambi: Update LED charging algorithmRandall Spangler2014-02-071-39/+9
| | | | | | | | | | | | | | | | | | | Green when charged and ext. power plugged in. Orange when charging. Blinking orange if there is a charging/battery related error. Blinking green if in "charge force idle mode" in the factory. Off otherwise. BUG=chrome-os-partner:23634 BRANCH=rambi TEST=test each of the states above To fake battery error, unplug battery and wait 30 secs To force idle, 'ectool chargecontrol idle' Change-Id: I85fff72d1df85bbbaa1da66572f44f58a960244e Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185240 Reviewed-by: Dave Parker <dparker@chromium.org>
* Run KEYPROTO task during the button unit testChromeOS Developer2014-02-072-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change 18baa15 made a call to keyboard keyboard_update_button conditional on running the KEYPROTO task. This call is needed for the button unit test. This fixes a test breakage when running "make buildall" BUG=None BRANCH=ToT TEST=Run "make buildall -j32" "make BOARD=glimmer tests -j32" and "make BOARD=rambi tests -j32" successfully with a "make clobber" in between. Signed-off-by: Dave Parker <dparker@chromium.org> Orig-Change-Id: I6f10577ffd189fee7081aa65cf5adb9075c95373 Reviewed-on: https://chromium-review.googlesource.com/185104 Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> (cherry picked from commit c267054850c4b296a364e975063c634f34d701e9) Change-Id: I92932577e83561530ef288c6ede211fa809962f8 Reviewed-on: https://chromium-review.googlesource.com/185245 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* Only call button handler if keyboard protocol task definedChromeOS Developer2014-02-071-0/+2
| | | | | | | | | | | | | | | | | | | | This fixes a breakage when building tests. BUG=None BRANCH=None TEST=Manual. Run "make BOARD=clapper tests" and "emerge-clapper chromeos-ec" (having cros_worked on it) Change-Id: Icdfa655b7fc246b103111f957d9c3f9e7f49c736 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184931 Reviewed-by: Bernie Thompson <bhthompson@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 18baa15cc10d1d0906a47fa60ab3fb1eb2cf484e) Reviewed-on: https://chromium-review.googlesource.com/185244 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* Add support for extra buttons not on the keyboardChromeOS Developer2014-02-0712-2/+389
| | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:24370 BRANCH=tot TEST=Run button unit test. Orig-Change-Id: I61b4a6624d62831ce0bfdf7a0f36a45349b37f96 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184544 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit f6426cc21c20a4f876cff28b9ce7e3115f0b054a) Change-Id: I4face9bf0797a91ec8bef390093aab8e3d8f97ab Reviewed-on: https://chromium-review.googlesource.com/185243 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* 8042: Add interface for handling off-matrix button changesChromeOS Developer2014-02-073-61/+129
| | | | | | | | | | | | | | | | | BUG=chrome-os-partner:24370 BRANCH=tot TEST=Power key and keyboard work normally. Signed-off-by: Dave Parker <dparker@chromium.org> Orig-Change-Id: I291ff384ae2fc3e074132330713f0b0c2cc36a76 Reviewed-on: https://chromium-review.googlesource.com/184543 (cherry picked from commit c65f82a5b02cdecf5b62f71ef2e916795f808389) Change-Id: I1cd02e824c97eb5909e7bff68c8ecefc89f52df0 Reviewed-on: https://chromium-review.googlesource.com/185242 Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org>
* Add presubmit check for unit testVic (Chun-Ju) Yang2014-02-064-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: 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>
* baytrail: reduce delay before SYS_PWROK assertion to 5 msRandall Spangler2014-02-061-2/+5
| | | | | | | | | | | | | Since we have only mini-PCIe devices, and no PCIe devices, we don't need a 100 ms delay. BUG=chrome-os-partner:25264 BRANCH=rambi TEST=boot system; AP boots normally Change-Id: I3dd537154d70b8379ebc36cb71474420cba43d7d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185046 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* baytrail: Ensure touchscreen is in reset on S3->S5 transitionRandall Spangler2014-02-061-1/+2
| | | | | | | | | | | | | | | | If the lid is open during shutdown, we were leaving the touchscreen out of reset. That increased S5 power consumption. BUG=chrome-os-partner:25168 BRANCH=rambi TEST=boot system, then power off with lid open 'gpioget TOUCHSCREEN_RESET_L' --> 0 Change-Id: Ibcd4718f0e4197a8cbcf2bb88cfbfa38ed345ead Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185027 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org>
* Pit: Add Green LED function in tps65090 charger driverJaehoon Kim2014-02-063-2/+21
| | | | | | | | | | | | | | | | From DV2 board of pit, we'll use 3 color-LED instead of power LED on keyboard. So, we have to add the function to control 3 color-LED in pmu driver. BUG=chrome-os-partner:24855 TEST=Tested on the pi and pit board about all power status. BRANCH=pit Change-Id: I7b1df39de8fa56eab73779abfa52cf8f72427b44 Signed-off-by: Jaehoon Kim <jh228.kim@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/181588 Tested-by: Katie Roberts-Hoffman <katierh@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Wonjoon Lee <woojoo.lee@samsung.com>
* Add configs for battery detect via gpio or custom functionChromeOS Developer2014-02-0610-34/+48
| | | | | | | | | | | | BUG=chrome-os-partner:24649 BRANCH=baytrail TEST=Boot target device w/o battery. There should be no 30 second delay prior to boot. Change-Id: If7a60919701d1c241670d0b32e04f3e188a643f1 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182921 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Stop hang detect timer when flags are set to 0Randall Spangler2014-02-051-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: 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>
* Add vim filetype tag for Makefile.rulesVic (Chun-Ju) Yang2014-02-051-0/+1
| | | | | | | | | | | | | | | | | Vim cannot tell the file type of Makefile.rules by itself. Adding this tag to save myself from the nightmare of reading the file without syntax highlighting. BUG=None TEST=Open the file with vim and emacs. Both get the correct file type. BRANCH=None Change-Id: Ibcc920c0fb7c9575427b29a90b9973ecf3420b3c Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184791 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Doug Anderson <dianders@chromium.org>
* Config option for using power button with lid closedstabilize-5414.Bstabilize-5412.BChromeOS Developer2014-02-012-1/+10
| | | | | | | | | | | | | | | BUG=chrome-os-partner:24912 BRANCH=baytrail TEST=Manual. Enable CONFIG_POWER_BUTTON_IGNORE_LID on a device, boot it, and go into dock mode with external monitor attached. Fake-close the lid with a magnet or servo. Verify the power button still sends press/release events to the host with evtest. Change-Id: Idb05375eee0743a8a2c459070854c03fe3afe894 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184493 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix watchdog in keyboard scan if key outside mask pressedtest-5394.BRandall Spangler2014-01-291-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If a key is pressed which is not in actual_key_mask, this triggers the keyboard scan interrupt. But read_matrix() would use the key mask to decide that no *real* keys were pressed. So it would immediately drop out of scan mode back to interrupt mode. Which would again be triggered. Lather, rinse, repeat, watchdog. The fix is to use the unmasked key matrix to decide whether to stay in scan mode. This way, the keyboard task sleeps between scans, and the watchdog isn't triggered. (Note that the only way you can hit this bug in real life is to have a keyboard attached which can trigger keys not in actual_key_mask. Which is hard to do, unless you've got a new prototype keyboard with extra keys, or you've spilled lemon juice on your Chromebook...) BUG=chrome-os-partner:25333 BRANCH=rambi TEST=Zero out actual_key_mask in keyboard_scan.c. Press a key. Should not trigger a watchdog. Change-Id: I8c2fbc3e06fa12dfae5c06614814af8f04e24a8a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184323 Reviewed-by: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* rambi: Enable low-power idleRandall Spangler2014-01-292-0/+7
| | | | | | | | | | | | | | | | | This should reduce EC power consumption in S3 and S5. BUG=chrome-os-partner:25377 BRANCH=baytrail TEST=make sure jtag is not active (not running openocd via servo) boot system; suspend system wait 60 seconds; should see "Disabling console in deep sleep" type on console; should still allow typing wait 60 seconds; press spacebar; should still resume from suspend Change-Id: I47e33e158c1b90077f944a6af4374f39efa68d94 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184165 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* mec1322: hibernation supportstabilize-5339.BVic (Chun-Ju) Yang2014-01-284-4/+163
| | | | | | | | | | | | | | | This adds hibernation support. The chip can be waken by either GPIO or a timer. The maximum delay allowed is ~2 hours. BUG=chrome-os-partner:24107 TEST=hibernate and wake by GPIO TEST=hibernate and wake by timer BRANCH=None Change-Id: I1e064638a5008894a002a06a738bf6104f18636d Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/181202 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Check for valid i2c port number on i2c host commandsChromeOS Developer2014-01-281-2/+18
| | | | | | | | | | | | BUG=chrome-os-partner:25052 BRANCH=baytrail TEST=Run ectool i2cread, i2cwrite, and i2cxfer commands with invalid port numbers. Verify machine doesn't reboot. Change-Id: Ifef062cb4a7548278f69689072324704f2f66317 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182911 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rambi: Add delay between PP5000 and PP3300_DX enablesRandall Spangler2014-01-241-0/+1
| | | | | | | | | | | | | This may improve stability with power chaining. BUG=chrome-os-partner:25271 BRANCH=rambi TEST=boot system Change-Id: Ia3d4776b7e47c4d3cbaa4d6f937241fd230243f2 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183739 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Fix leaving SUSP_VR_EN enabled if S5 rails fail to come upRandall Spangler2014-01-243-1/+9
| | | | | | | | | | | | | | | | | | | | We noticed this on a baytrail board, but the same problem exists in haswell as well. And while looking there, found that we skipped the S5G3 state if the 5V rail failed to come up. Fortunately, these are all rare corner cases; rails will always come up on a good system. So this only affects systems during bringup and factory, not devices in the field. BUG=chrome-os-partner:24915 BRANCH=rambi (and technically haswell, but may not be worth merging) TEST=Try booting a system with a bad power rail; see that SUSP_VR_EN=0 after the system fails to boot. Change-Id: Ifd10841d298a0f2510a8b182250b717ea5643c99 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183733 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* rambi: Increase REST# pulse length for warm rebootRandall Spangler2014-01-241-3/+3
| | | | | | | | | | | | | | | The PCH uses a 16 ms debounce, so need to assert the signal for twice that to be assured of a reboot. BUG=chrome-os-partner:25088 BRANCH=rambi TEST=Alt+VolUp+R reboots the system Change-Id: I51fd54fd992e4e54e6c3bc9c13f9fd59e9bf55ac Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183726 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Benson Leung <bleung@chromium.org>
* rambi: Leave 5V rail on in S3 if USB ports are poweredRandall Spangler2014-01-235-0/+43
| | | | | | | | | | | | | | | | | Previously, the 5V rail was disabled unconditionally in the S0->S3 transition. Now, the rail is left powered if one or both of the USB ports are powered. BUG=chrome-os-partner:25178 BRANCH=rambi TEST=Modify the OS to leave USB ports powered in S3. Then suspend. On the EC console, 'gpioget pp5000_en' should be 1. Change-Id: I3c73f3fe228e940317c0da7330f117c7ab0a6d0c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183548 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Squawks: Disable ectool i2c commands when write protectedChromeOS Developer2014-01-221-0/+1
| | | | | | | | | | | | | | | | BUG=None BRANCH=None TEST=Verify ectool i2cwrite, i2cread, i2cxfer commands fail when EC is write protected. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Ie7c3a6ba1985c09f0cf05171eb32320191aebd8a Original-Change-Id: Ibde29c92a1487932eb273701bdf017b4f92c646d Reviewed-on: https://chromium-review.googlesource.com/182757 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Rambi: Disable ectool i2c commands when write protectedChromeOS Developer2014-01-221-0/+1
| | | | | | | | | | | | | | BUG=None BRANCH=None TEST=Verify ectool i2cwrite, i2cread, i2cxfer commands fail when EC is write protected. Change-Id: I1dc09d77e54928c2e3122f724ce340717c4bf066 Original-Change-Id: I0393ea64c704dfc4ad1f234b39bccf2de1546c60 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182638 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182756
* emulator: Move trace dump to a separate moduleVic (Chun-Ju) Yang2014-01-2210-97/+174
| | | | | | | | | | | | | | | The implementation of trace dump has little to do with task scheduling, so we should move it to a separate module for cleaner code. This requires exposing some emulator-specific task info, as defined in host_task.h. BUG=chrome-os-partner:19235 TEST=Pass all tests BRANCH=None Change-Id: Iba9bc0794a4e1dd4ddb92b98345162b398fa6a8d Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183238
* emulator: Use udelay() for usleep() if task hasn't startedVic (Chun-Ju) Yang2014-01-211-0/+6
| | | | | | | | | | | | | | If the task scheduler hasn't started yet, use udelay() for any call to usleep(). This is what we do for real core now. BUG=chrome-os-partner:19235 TEST=Call usleep() in init hook BRANCH=None Change-Id: Ia5d14ee165ab25bfa231497af1aa8c87fbc324f0 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183271 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
* x86 & tegra: add CONFIG_POWER_COMMON.Yung-Chieh Lo2014-01-2110-16/+17
| | | | | | | | | | | | | | For the better naming for power/common.h, we rename CONFIG_CHIPSET_X86 to CONFIG_POWER_COMMON (no one is actually using it). But keep CONFIG_CHIPSER_TEGRA for power/build.mk. BUG=chrome-os-partner:25068 BRANCH=nyan,falco,link,peppy,rambi,samus,squawks TEST=build only Change-Id: Ibf1a4c24088dfddac39b38a95b3b887c195152d5 Signed-off-by: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182732
* baytrail: Add config option to enable WiFi in suspendstabilize-5254.BDuncan Laurie2014-01-173-0/+15
| | | | | | | | | | | | | | | | | | | Some WiFi devices do not tolerate losing power in suspend and will not function properly after resume if they have lost power. Enable this on the Rambi device. BUG=chrome-os-partner:24114 BRANCH=baytrail TEST=complete mutiple successful suspend/resume cycles on rambi and ensure that wifi continues to function and not cause a crash. Change-Id: Id421f3138e429b247bfb3f5ffb92a06c0353bb97 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/183047 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* tegra: refactor the power state machine.Louis Yung-Chieh Lo2014-01-175-218/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Integrate with power/common.c -- a real state machine now. Also remove duplicate and unused functions/consts. BUG=chrome-os-partner:24831 BRANCH=nyan TEST=on nyan rev 3.12. re-plug AC: PASS, power on 2 reboot: PASS, power on 2 power off (S5), power on: PASS, power off 4, power on 5 power off (G3), power on: PASS, power off 4, power on 5 lid close / power off (S5)/ lid open: PASS, power on 3 lid close / power off (G3)/ lid open: PASS, power on 3 press power button and release: nothing happens after 15s. button off (S5)/ on: PASS, power off 3, power on 4 button off (G3)/ on: PASS, power off 3, power on 4 power off (S5)/ button on: PASS, power off 4, power on 4 power off (G3)/ button on: PASS, power off 4, power on 4 button off (S5)/ power on: PASS, power off 3, power on 5 button off (G3)/ power on: PASS, power off 3, power on 4 button off (S5)/ lid open: PASS, power off 3, power on 3 button off (G3)/ lid open: PASS, power off 3, power on 3 is off, long press button (60s): power on 4, too long, shutdown, stay off is on, long press button (60s): power off 3, stay off apreset cold: entered to S5, power off 3, power on 5 apreset warm: power state is not changed, but reboots to BIOS. Change-Id: Ie12fa4f79b6156f71f89155b2b01880914809c75 Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182348 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove obsolete TODOVic (Chun-Ju) Yang2014-01-171-3/+1
| | | | | | | | | | | | | | LPC mapped memory is not supported for MEC1322. We'll need a separate communication module. Update comment to reflect this. BUG=chrome-os-partner:24280 TEST=None BRANCH=None Change-Id: I1863c7c230f895cb2cef65459406ffcf1e2b515d Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182798 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mec1322: Speed up LPC transfer with auto-increment modeVic (Chun-Ju) Yang2014-01-171-37/+54
| | | | | | | | | | | | | | | | | | | The main bottleneck on current LPC transfer speed is the delay required between address write and data read/write. Using auto-increment mode, we can not only skip most of the delay but also skip repeated address write. This gives about 30x speed-up (comparing the time spent on 4096-byte read test.) BUG=chrome-os-partner:24107 TEST=Measure speed of 'ectool readtest' BRANCH=None Change-Id: Ib34661474b149b19a900c60db884bd474881f742 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182797 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mec1322: Use EMI module for port 80Vic (Chun-Ju) Yang2014-01-172-12/+19
| | | | | | | | | | | | | | | EMI module is the only LPC module suitable for port 80 implementation, and thus let's move it to 0x80. Consequently the EMI mapped memory is moved to 0x82-0x87. BUG=chrome-os-partner:24107 TEST=Write to port 80 and see the data printed to console BRANCH=None Change-Id: I7d749650d6d109af2941a1db6e6c4a32e7482f61 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182796 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* mec1322: disable host write to mapped memoryVic (Chun-Ju) Yang2014-01-171-1/+1
| | | | | | | | | | | | | | EMI module has the ability to set different read and write ranges. Let's disable write on mapped memory. BUG=chrome-os-partner:24107 TEST=Write to mapped memory has no effect BRANCH=None Change-Id: I88654bde9208376103d3c084ee54991d886ea4cc Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182795 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Support discharge on BQ24715 for Rambi and SquawksJustin Chuang2014-01-168-4/+49
| | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:25031 BRANCH=rambi TEST=Manually make BOARD=peppy make BOARD=falco make BOARD=rambi make BOARD=squawks On rambi and squawks, connect charger ectool chargecontrol discharge ectool i2cread 16 0 0x16 0x0a It should return 16-bit negative integer. Change-Id: I8a8dfa90d2ad82595ac7a420c3c8ffc13b12cde6 Signed-off-by: Justin Chuang <jchuang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182586 Reviewed-by: Dave Parker <dparker@chromium.org>
* lm4: move I2C transfer state machine to interrupt handlerRandall Spangler2014-01-161-184/+183
| | | | | | | | | | | | | | | | | | | | | | This significantly decreases the task swapping overhead when doing many transfers. Also fix a bug where on error, i2c_xfer() would issue a stop condition, but not actually wait for it to complete before returning; this could interfere with the next transfer in a back-to-back scenario. BUG=chrome-os-partner:25015 BRANCH=lm4 (more specifically, rambi and derivatives) TEST=battery command should show the same info as before i2cscan should show devices at bus 0 0x12, 0x16, bus 5 0x98 no charger errors on boot Change-Id: I2195f0f9800b03a54fa33170dbae6705382578c7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182503 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
* Clean up run_host_test scriptVic (Chun-Ju) Yang2014-01-151-8/+10
| | | | | | | | | | | | | | | | | | This includes: - Remove an unused function argument - Style fix - Handle EOF by pexpect instead of catching exception BUG=chrome-os-partner:19235 TEST=Run all tests TEST=Make a test crash and check EOF is handled properly BRANCH=None Change-Id: I3636cdab6e68cacf97c4b245b14b2d57613a1674 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/182049 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ite: Watchdog module addedAlec Berg2014-01-153-0/+107
| | | | | | | | | | | | | | | | | Watchdog module added. Off by default because of following limitations: - When programming, the WD fires, and programming fails. For now, you have to program twice. BRANCH=none BUG=chrome-os-partner:23575 TEST=Manually wrote in a while(1); and made sure watchdog warning triggers first, prints IPC register, and then soon after the watchdog timer resets the chip. Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: Ia83f58f3ae108f755d2f139ada22a22e2fbdc2fa Reviewed-on: https://chromium-review.googlesource.com/177397 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>