summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* keyboard: Preserve keystroke enable state.stabilize-daisy-4319.96.Brelease-R29-4319.BShawn Nematbakhsh2013-06-241-2/+5
| | | | | | | | | | | | | | | Preserve the state of keystroke_enabled to prevent keystrokes from being initially disabled on RO --> RW transition. This will allow us to use the keyboard on EC cold boot. BUG=chrome-os-partner:20430. TEST=Manual. Verify keyboard works on EC cold boot on Peppy. BRANCH=None. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I603a73ee0f8435c91d430a64803add345c92f025 Reviewed-on: https://gerrit.chromium.org/gerrit/59798 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* peppy: Set GPIO_WP to active low.Shawn Nematbakhsh2013-06-242-3/+2
| | | | | | | | | | | | | WP GPIO is active low on peppy. TEST="gpioget WP" with hole24 open shows 1, with hole24 shorted shows 0. BUG=chrome-os-partner:20429. BRANCH=none. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Idf3de192c500edcb40b37269b1b66e6a5df4dd1f Reviewed-on: https://gerrit.chromium.org/gerrit/59703 Reviewed-by: Dave Parker <dparker@chromium.org>
* Power and battery LED control for Peppy.Dave Parker2013-06-243-0/+99
| | | | | | | | | | | BUG=chrome-os-partner:20328 BRANCH=peppy TEST=manual and constrained by hw issues. Change-Id: I7df19ad410ef2a85c170980150bf226a7407642e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59663 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* pit: Fix watchdog help for STM32LRandall Spangler2013-06-246-34/+86
| | | | | | | | | | | | | | | | | Clean up timer initialization code to be more general, so that we can use timer 9 for the LSB on STM32L. Then use timer 4 for the watchdog helper. BUG=chrome-os-partner:18781 BRANCH=none TEST=From EC console: timerinfo -> current time still counts up properly waitms 2000 -> prints watchdog info before rebooting Change-Id: Ib0ba496b0eadb93756dcd1841857546910baf2a9 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59612 Reviewed-by: Simon Glass <sjg@chromium.org>
* Add charger/battery support for PeppyDave Parker2013-06-244-4/+69
| | | | | | | | | | | | BUG=chrome-os-partner:19949 BRANCH=peppy TEST=Manual. Observe output from "battery" and "charger" on EC console. No smoke or fire observed (yet). Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Ibac55bb58ebfc25de5cb625d4f503cf6e3ecec62 Reviewed-on: https://gerrit.chromium.org/gerrit/59624 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* spring: Wait 80ms for CABLE_DET to be assertedVic Yang2013-06-221-1/+2
| | | | | | | | | | | | | | | | | | | From our measurement, it takes ~80ms for CABLE_DET to be asserted. Let's wait for that long before giving up and declare it an USB host. BUG=chrome-os-partner:20405 TEST=Manual BRANCH=Spring Original-Change-Id: I71568ed8011f9b3f2c9c2ee67aea3c771a5dbf37 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59566 (cherry picked from commit 3c1b2b757546c022d0ae0eb22e3db9feb41055c4) Change-Id: Id2329d477f17f1db0309960ee9faeb770b2c50a0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59667 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Check USB device type periodicallyVic Yang2013-06-221-0/+11
| | | | | | | | | | | | | | | | | | | | | | The device type reported by TSU6721 changed rapidly in some cases, and we miss the change after the first one. We need to check device type change periodically. BUG=chrome-os-partner:20336 TEST=Plug and unplug DCP charger in suspend. Check device type is detected correctly. BRANCH=Spring Original-Change-Id: Iaab4168f99637b736b8ba42f4313e248b84bdd44 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59535 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 69b18e5fb9890f3a638c1587968b110dc1110ba1) Change-Id: I3cb86b0bfeb7bb02d750197405ffe385b06808e9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59666 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Clear pending interrupt on disabling TSU6721 interruptVic Yang2013-06-221-1/+5
| | | | | | | | | | | | | | | | | | | | If we disable TSU6721 interrupt without clearing pending interrupt, we get bogus interrupt after. Let's clear it. BUG=chrome-os-partner:20336 TEST=Log interrupt. Check there's none after disabling interrupt. BRANCH=Spring Original-Change-Id: Ic8e5bcdcea894cccfbdf4b7d9afd43084b0c3309 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59534 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 0412f17aaf20887fc6ec2598f269841e03b760e4) Change-Id: I18ba0e4bbfd81e59d30b2d5723f8859e42acadaa Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59665 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Avoid I2C transaction in interrupt contextVic Yang2013-06-211-1/+7
| | | | | | | | | | | | | | | | When the device suspends with video dongle plugged in, the EC tries to turn off VFET output. However, the I2C command issued in interrupt context causes an assertion error. BUG=chrome-os-partner:20351 TEST=Plug in video dongle, and suspend. Wake the device up successfully. BRANCH=spring Change-Id: I135075e83ad0c40ecfdc9a1d8d7c2585a583a916 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59406 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Power and battery LED control for Falco.Dave Parker2013-06-213-1/+102
| | | | | | | | | | | BUG=chrome-os-partner:19914 BRANCH=falco TEST=manual and constrained by hw issues. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Ief919c5ecf296ee358556d65260f245916c1ecb1 Reviewed-on: https://gerrit.chromium.org/gerrit/59513 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* pit: Disable SPI output when AP is suspendedRandall Spangler2013-06-201-0/+2
| | | | | | | | | | | | | | | This fixes the problem where the EC consumes too much power during suspend. BUG=chrome-os-partner:20223 BRANCH=none TEST=from root shell, 'powerd_suspend'. 1.8V_MICOM should not go up. after resume, 'ectool hello' should still work. Change-Id: I93b781e96bea633419e923a83f1f6d7300ae8c54 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59474 Reviewed-by: Derek Basehore <dbasehore@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* drop: Ignore command version for FLASH_PROTECT commandVadim Bendebury2013-06-201-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ec driver does not yet pass the command version properly from app to the EC. This causes a failure when trying to read flashrom write protect status (command 0x15). The thing is that the command version is not even important for this command, as it was never implemented differently. As a quick fix - mark the command descriptor as supporting both versions. BRANCH=none BUG=chromium:239197 TEST=manual . on peach_pit (with fixed flashrom, coming under a separate fix): # flashrom -p ec --wp-status flashrom v0.9.4 : : on Linux 3.8.11 (armv7l), built with libpci 3.1.10, GCC 4.7.x-google 20130114 (prerelease), little endian WP: status: 0x00 WP: status.srp0: 0 WP: write protect is disabled. WP: write protect range: start=0x00000000, len=0x00000000 # Change-Id: I8302457cc2afdfe3bdcb50cfa2bea29969d0c107 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59462 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add EC_CMD_TEST_PROTOCOL to fake certain responses.Bill Richardson2013-06-205-3/+78
| | | | | | | | | | | | | | | | | | | | | | This lets us force the EC to return various error codes, so that we can be sure we're seeing them. BUG=chromium:242706 BRANCH=none TEST=none Trigger various errors like so: ectool test 0 14 ectool test 1 14 ectool test 5 14 ectool test 8 14 ectool test 0 33 Change-Id: Ia951cd7afacdcce6c8ec7d35d3bfb5b113dea694 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59327 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* drop: Ignore command version for VBNV CONTEXT commandVadim Bendebury2013-06-201-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | The ec driver does not yet pass the command version properly from app to the EC. This causes a failure when trying to use the vbnvram context command (23). The thing is that the command version is not even important for this command, as it was never implemented differently. As a quick fix - mark the command descriptor as supporting both versions. I wonder if we should implement a "don't care" option for situations like this. BRANCH=none BUG=chromium:239197 TEST=manual . on peach_pit: localhost ~ # mosys nvram vboot read 70000000000000000000000000000020 localhost ~ # Change-Id: I16fcc0d6752d9e778a026717208d8d6487d5dc77 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59348
* Refactor host command interface to support version 3 packetsRandall Spangler2013-06-206-18/+578
| | | | | | | | | | | | | | | | | | | | | | | | | This will fix EC flash commands on pit, once the host side (u-boot and cros_ec driver) are upgraded to match. This change is backwards-compatible the EC still supports the existing version 2 protocols for talking to existing AP/kernel/ectool. Once the AP-side supports version 3 for SPI (and existing systems are upgraded), we will remove older SPI support since we haven't shipped a product which uses SPI. BUG=chrome-os-partner:20257 BRANCH=none TEST=disable cros_ec driver support in ectool; 'ectool hello' works on link And with an old ectool which predates this CL, 'ectool hello' also works. On pit, from u-boot prompt, 'crosec test' and 'crosec version' work, and keyboard works. Change-Id: I01f193e316e9aa442fe50d632dc8a4681723e282 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58908 Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Doug Anderson <dianders@chromium.org>
* falco: peppy: slippy: mark LPC_CLKRUN_L as open drainAaron Durbin2013-06-203-3/+3
| | | | | | | | | | | | | | | | | | | The LPC_CLKRUN_L signal on these boards has an external pull up to the correct PCH rail. Therefore, configure the pin controlling LPC_CLKRUN_L as open drain. BUG=chrome-os-partner:19811 BUG=chrome-os-partner:20331 BRANCH=None TEST=Built and flashed. Interrogated GPIOODR register for port M: > rw 0x4006350c read 0x4006350c = 0x00000004 Change-Id: I50dc90d784bd1d1f318b401e5d7d6e06bf0f1e47 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59416 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Sameer Nanda <snanda@chromium.org>
* Enhance host command debug outputVadim Bendebury2013-06-201-1/+2
| | | | | | | | | | | | | | | | | Add code to print out command version and command mask. BRANCH=none BUG=none TEST=manual . see this in on the EC console when hcdebug is on [1022.289347 HC V:0 VM:3 0x17:00000000] [1022.289728 HC resp:70000000000000000000000000000020] Change-Id: I443401966b81349f41246d3a118f5f145ed4b160 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59347 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* spring: new TPS65090 parameters to avoid cap ringingVincent Palatin2013-06-191-19/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting DVT, Spring boards have updated hardware to prevent cap ringing when a charger is plugged. Adjust T01, T12, T23 and T34 current limit to 87.5% as expected by this mechanism. Push all termination voltages to 2.1v as the actual temperature range is not related to the real charge temperature. On pre-DVT boards, this will just reduce the max charging rate by 12.5%. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:18987 TEST=on Spring EVT, use "pmu" command on the EC console and see registers 0x5 to 0x9 contain : "3e 5e be fe ff" Original-Change-Id: Ie078a38251cd2cb50ee605c34a6818bf994d148d Reviewed-on: https://gerrit.chromium.org/gerrit/49484 Commit-Queue: Jon Salz <jsalz@chromium.org> Reviewed-by: Jon Salz <jsalz@chromium.org> Tested-by: Jon Salz <jsalz@chromium.org> (cherry picked from commit 4122b222859db34cb6eee827cba4988df458d916) Change-Id: I78355651f5f7abc0546fec0c4df8d38ea3549b2d Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59197 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Hard-limit current draw from ToadVic Yang2013-06-191-1/+9
| | | | | | | | | | | | | | | | The Toad cable is browning out from time to time. Let's limit its current in aggressive mode. Also fix a bug in hard current limit calculation. BUG=None TEST=Plug-in Toad cable and see PWM duty cycle starts higher. BRANCH=Spring Change-Id: I06d64418989aa32a99545986fe841914f054acde Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59161 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Falco WP is active low, not active highBill Richardson2013-06-183-3/+6
| | | | | | | | | | | | | | | | | | | Read the value of the WP GPIO correctly. BUG=chrome-os-partner:20091 BRANCH=none TEST=manual On the EC console, run gpioget WP_L Short the WP pin, run it again. You should see it change. Change-Id: Id85c1d69c88ea3df4e529e844aa2455643f1a41b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58948 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Actually USE the falco battery for falco.Bill Richardson2013-06-181-1/+1
| | | | | | | | | | | | | I just noticed that we've not been using the falco battery on falco. Not sure how this slipped by. BUG=chrome-os-partner:18788,chrome-os-partner:20213 BRANCH=none TEST=none Change-Id: Ia1d0f322ce8e296db49f91a3bf8eab593db97638 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/59085
* More keyboard scan testVic Yang2013-06-182-16/+134
| | | | | | | | | | | BUG=chrome-os-partner:19236 TEST=Pass the test BRANCH=None Change-Id: Ie0b0657c0bca2ec459cc8b04d9e06199b70414d9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58795 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Update USB device type before notifying hoststabilize-4287.BVic Yang2013-06-171-1/+1
| | | | | | | | | | | | | Otherwise the host might get the old device type. BUG=None TEST=None BRANCH=Spring Change-Id: Ia77f5c06ffb28c8ace4587e07aed776eae477b75 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58969 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* More flash unit testVic Yang2013-06-171-14/+95
| | | | | | | | | | BUG=chrome-os-partner:19236 TEST=Pass the test BRANCH=None Change-Id: Idfbbdd40948ea4f8468cf9de95eee17e0d0773ed Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58794
* A method to mock host commandVic Yang2013-06-173-35/+32
| | | | | | | | | | | | This will be used often, so let's move it to test_util.c. BUG=chrome-os-partner:19235 TEST=Pass flash test. BRANCH=None Change-Id: I2f685f657f8742c2b29e3b9c88ba01daacf982f8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58793
* Redetect USB device type on non-standard chargerVic Yang2013-06-171-2/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the device type is non-standard charger, it could be the user plugging in the connector too slowly and TSU6721 BCD timer expired before the connector is fully plugged in. Extending TSU6721 BCD timer causes a big delay in Apple charger detection, and breaks how we detect over-current. Let's do this by a re-detection instead. If we see a different device type, just update the device type we have. Otherwise, we reset TSU6721 to force a re-detection. BUG=chrome-os-partner:19765 TEST=Plug in a charger half way in. Wait for a second, plug it in all the way. See device type changed after few seconds. TEST=Plug in a charger half way in and leave it there. Only see redetection once. TEST=Plug in a charger all the way in. See correct device type. TEST=Plug in an Apple charger. See correct device type within a second. TEST=Plug in a Nexus 10 charger. See correct device type after 5 seconds. BRANCH=spring Change-Id: Ia7733972842e6040b545670df043058c55ae3c01 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58799 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Revert "Extend TSU6721 BCD timer to 3.6 seconds"Vic Yang2013-06-171-1/+1
| | | | | | | | | | | | | | | | This reverts commit 6759fdc3e6dd7e8901fcf8e25490e4e20273cbcb. Extending TSU6721 BCD timer causes problems on Apple charger detection. BUG=chrome-os-partner:19765 TEST=Check Apple charger detection and over-current handling work properly. BRANCH=spring Change-Id: Ie3111477e3614410bd96d65ad2a0b430bd240835 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58798 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Peppy: Update LED color names in comment. Mark active low.Dave Parker2013-06-172-9/+8
| | | | | | | | | | | | | | | BUG=None BRANCH=peppy TEST=make BOARD=peppy gpioset PWR_LED0_L 0 gpioset PWR_LED1_L 0 gpioset BAT_LED0_L 0 gpioset BAT_LED1_L 0 Change-Id: I9342198678465367f92758921fa84cd253e983fd Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58345 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Make target for test coverage report generationVic Yang2013-06-168-6/+73
| | | | | | | | | | | | | By 'make coverage', lcov is used to generate test coverage report in HTML format stored in coverage_rpt folder. BUG=chrome-os-partner:19235 TEST=Generate a report. BRANCH=None Change-Id: I44142eaaeb897cf09179764781120370920144cd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58203
* Move i2c_old_response flag to i2c interface moduleRandall Spangler2013-06-142-4/+4
| | | | | | | | | | | | | | It's not used by the host command module or handlers, so shouldn't be exposed to them. BUG=chrome-os-partner:20185 BRANCH=none TEST='ectool hello' still works Change-Id: I0122bd9ef33e71afab7e5cc035fb3b9d220334c6 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58632 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Move lpc-specific flags out of host command argsRandall Spangler2013-06-142-5/+5
| | | | | | | | | | | | | | | The flags are specific to the LPC interface and not used by the host command module, so shouldn't be present at that level. BUG=chrome-os-partner:20185 BRANCH=none TEST='ectool hello' still works Change-Id: I6b2c3208fc398ea40d9e7cc7bf5ec206b3e317d8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58631 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* haswell: mark PCH_SMI_L as open drainAaron Durbin2013-06-143-3/+3
| | | | | | | | | | | | | | | | In order not to leak power to the PP3300_PCH rail mark the PCH_SMI_L as open drain. BUG=chrome-os-partner:19811 BUG=chrome-os-partner:20175 BUG=chrome-os-partner:20054 BRANCH=None TEST=Built and booted Faloc. No ill effects. Change-Id: Ia4071067af177684579e146199f9ea174788b933 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58681 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* haswell: Add notes about PL6 weirdnessAaron Durbin2013-06-144-3/+10
| | | | | | | | | | | | | | | It was found that PL6 behaves in an inverted way when it is configured as open drain. Add notes about determining why this is. Apparently PL6 is an oddity w.r.t. the other pins. BUG=chrome-os-partner:19811 BRANCH=None TEST=built Change-Id: I2d5b27f49c4e51ba4eb75cda9c798b9a5793f767 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58679 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Fix some stupidness in ectool's comm_init() handlingBill Richardson2013-06-141-1/+1
| | | | | | | | | | | | | | | | | | | ectool was checking for negative return values on comm_init(). It should have been checking for nonzero. Or comm_init should have been returning negative. Whatever. The ectool utility was supposed to be a quick-n-dirty debugging tool, so it's not very well tested. BUG=chromium:249218 BRANCH=none TEST=manual Fired up VM instance, tried old version and new version. Old version coredumps, new version doesn't. Change-Id: I0e27d78eead562a16ff826fb80de9e6b07476e12 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58712 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* spring: Show green LED when 94% chargedVic Yang2013-06-131-2/+6
| | | | | | | | | | | | | | | | | | For Spring, we cannot rely on the battery current to decide if it's fully charged. Therefore, we just use the battery charge level as the sole indicator. The battery spec says it might stop charging when charge level is 95%+, so we should show green LED when it reaches 94%. Otherwise, show yellow LED. BUG=chrome-os-partner:20017 TEST=Manual. Monitor the battery level and see LED turns green when it goes from 93% to 94%. BRANCH=spring Change-Id: Ia525b2e89ebe36cc2ccce1ea0b798ba03be258a7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58059 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Rename GPIO_HI_Z macros to more descriptive GPIO_ODR_HIGH/LOWBill Richardson2013-06-1312-40/+40
| | | | | | | | | | | | | | | | | | | | | | | GPIO_HI_Z was a bit misleading (it's high impedance by default, but it's actually an output not an input), but when we added GPIO_HI_Z_OPEN to mean "open-drain output, pulled low by default", it got too confusing. This renames those macros to: #define GPIO_ODR_HIGH (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_HIGH) #define GPIO_ODR_LOW (GPIO_OUTPUT | GPIO_OPEN_DRAIN | GPIO_LOW) BUG=chrome-os-partner:18788 BRANCH=none TEST=none No functional change, just renaming some macros. If it compiles, it should be unchanged in behavior. Change-Id: Ic84d7be8531f2b240a8eca4f6cfe5291ebd2d5ef Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58596 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* falco: fix RCIN# GPIO settingDuncan Laurie2013-06-131-1/+1
| | | | | | | | | | | | | | The gpio pin used for RCIN# should be configured as open drain as the rail is pulled up by a non-EC rail. Driving it high would leak power. BUG=chrome-os-partner:19355,chrome-os-partner:20173 BRANCH=none TEST=manual: boot on falco without RCIN# causing reset and the 'apreset warm' EC command works as expected. Change-Id: I197928fd3cac27db3add9dd842e3171f23c9d71e Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58590
* More queue unit testVic Yang2013-06-131-0/+1
| | | | | | | | | | | | | Check queue_remove_unit returns 0 on queue empty. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I3162ba5e57e9111e1896954d815c26882fa372eb Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58331 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* More hooks unit testVic Yang2013-06-131-0/+10
| | | | | | | | | | | | | Checks we cannot call non-registered deferred functions. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I6cf67f85c7749632627819cc05e6809c040fb697 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58330 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* More utils unit testVic Yang2013-06-131-3/+114
| | | | | | | | | | | BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I4075f3fb0ef23a54b4ca249a21fe28e698e595cb Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58329 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Incorporate CABLE_DET circuit changeVic Yang2013-06-131-21/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | Now that when ID_MUX=1, DP_SNS can be connected to either ID_OUT or CABLE_DET, we need to handle the case where a video dongle is not reflected by DP_SNS going low. This is done by leaving ID_MUX=1 for USB host and monitor its detachment by sensing VBUS. As for unpowered dongle, we just ignore it when it's not recognized. Note that due to the polarity of CABLE_DET, we now sense dongle detachement by DP_SNS < 0.25V. To support older boards with ID_OUT connected, we also disconnect video dongle on system suspend and shutdown. BUG=chrome-os-partner:19911 TEST=Powered/unpowered video dongle detected correctly. TEST=Add a console command to simulate CABLE_DET being high. With that, check battery charges with powered video dongle. Check nothing happens with unpowered video dongle. TEST=Check video dongle considered disconnected when OTG dongle plugged in or system shutdown. BRANCH=spring Change-Id: If7b530b67c98c85017ca663d43c5148f0eb9163c Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58070 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Falco: Disable IFAULT_HI on the BQ24738 chargerBill Richardson2013-06-131-4/+1
| | | | | | | | | | | | | | | | Partners are adamant that this needs doing. Whatever... BUG=chrome-os-partner:19868 BRANCH=none TEST=none You can run the "charger" command on the EC console to see that the option bits have been changed. I couldn't reproduce the original complaint, so I don't know if this solves it. Change-Id: I428697f69a7ba1b360e2acb123b42ed41244ebc5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58576
* Use battery's precharge_current value for deep discharge recovery.Bill Richardson2013-06-133-9/+5
| | | | | | | | | | | | | | | | | | | | We've been providing the battery's max voltage and the charger's minimum current to try to awaken a deep-discharged battery. For some batteries, that doesn't appear to be enough. This change will use the battery's preconfigured precharge_current value instead. BUG=chrome-os-partner:20142 BRANCH=none TEST=manual I don't have a deep-discharged battery to try it on. I've been using these values manually in order to get the battery away. With no battery connected, you can run the "charger" command on the EC console to see what values it's using. They should match what the battery wants. Change-Id: I16d06011103ba70682397859d9844a37938d3e90 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58575
* pit: AC detect signal is a simple GPIO nowRandall Spangler2013-06-132-3/+4
| | | | | | | | | | | | | | | | | | | | | Frank's reworks turn AC_PWRBTN_L from a signal which co-mingled AC-detect and pwower button press to a straight AC detect signal. Switch from the hacky snow version of extpower to the simple gpio version. BUG=chrome-os-partner:20034 BRANCH=none TEST=manual, using gpioget command 1. With AC plugged in, AC_PRESENT=1 2. Press power button. Still AC_PRESENT=1 3. Unplug AC, AC_PRESENT=0 4. Press power button. Still AC_PRESENT=0 Change-Id: I35df4ba80d0003310f3e01d9815158cfa3d0cb51 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58550 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Falco: Placeholder to maybe disable IFAULT_HI on battery chargerBill Richardson2013-06-131-2/+16
| | | | | | | | | | | | | | | | | We've been asked to disable the IFAULT_HI protection for the Falco battery charger, with no explanation. This change adds the code to do that, but leaves it ifdef'd out. If/when we get confirmation that we really want to do that, we can. BUG=chrome-os-partner:19868 BRANCH=none TEST=none No functional change yet, nothing to test. Change-Id: I02a71461f55849a2fdb5ec220fe00e3c812ddf0b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58467
* Falco: Add support for bq24738 charger (and guess at battery).Bill Richardson2013-06-137-8/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the BQ24738 smart battery charger, and a placeholder for the Falco battery pack. I don't have either documentation or a battery to use to test, so the battery pack stuff is just a guess (see crosbug.com/p/20142). BUG=chrome-os-partner:20098 BRANCH=none TEST=none Well, if you like, from the EC console, run "charger". It should say something like this: > charger Name : bq24738 Option: 1111100100010010 (0xf912) Man id: 0x0040 Dev id: 0x000f V_batt: 0 (1024 - 19200, 16) I_batt: 0 ( 128 - 8128, 64) I_in : 3968 ( 128 - 8064, 128) > But since I don't have either a battery or a spec, I had to guess at the battery configuration. To test the charger, we kind of need a battery. Change-Id: I6e63d6b5aa8be4ba15e2c427d2e86364ef6251b3 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58466
* Falco: Measure adapter ID voltageBill Richardson2013-06-132-7/+10
| | | | | | | | | | | | | | | | | | This measures the analog voltage from the AC adapater's ID pin. The values don't seem to match what we expected, so there's more work to come. Still, here it is. BUG=chrome-os-partner:19594 BRANCH=none TEST=manual From the EC console, run "adc". You should see a line like this: ADC channel "AdapterIDVoltage" = 553 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Idf84ceb6cd85d66d879f07bf4f26881ec078f638 Reviewed-on: https://gerrit.chromium.org/gerrit/58465
* Slippy: Adjust battery voltages to be closer to reality.Bill Richardson2013-06-121-3/+3
| | | | | | | | | | | | | | I'm still not convinced that the Slippy battery voltages are right for all cases, but these are closer to what seems to be working. It matches what the battery we've tested with seems to want. BUG=chrome-os-partner:18825 BRANCH=none TEST=none Change-Id: I2d86c5ef39a70d3826fec31207250617596baa33 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58415
* Add I2C port 1 for LVDS debug.Bill Richardson2013-06-122-4/+5
| | | | | | | | | | | | | | | BUG=chrome-os-partner:18788 BRANCH=none TEST=none The connection to the LVDS controller is unstuffed, so there's nothing to test without some soldering. Change-Id: I5e6d9a3705554335512611b6b463568251b848b6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58268 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Falco: New LED gpiosBill Richardson2013-06-112-0/+12
| | | | | | | | | | | | | | I don't think there are any power-sequencing changes. BUG=chrome-os-partner:18788 BRANCH=falco TEST=none Nothing to test yet. Change-Id: I2d0b7085fb5a5b853385049b61fe7796709702ae Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/56137