summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfactory-4290.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/+/3155032 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@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
* spring: update PWM characterization for DVT1Vincent Palatin2013-06-111-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The new constants used to convert PWM duty cycle to input current, based on a linear regression done on Aaron's characterization data measured on DVT1 PCB. The data points are linear enough to use the linear relationship to set the current limitation. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:19281 TEST=none Original-Change-Id: I8378aaea21d5b3229d505caf4849257ded77e1ad Reviewed-on: https://gerrit.chromium.org/gerrit/58143 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit d7b9b2a088dcf129739c7a6b8a30bc292ea7234d) Change-Id: I11962991d6d7ba7b9d437fc56eb23974d30930a8 Reviewed-on: https://gerrit.chromium.org/gerrit/58198 Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org>
* stm32: add hibernate support using stm32f100 standby modeVincent Palatin2013-06-112-14/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | Implement the EC hibernate mode by using the stm32f100 standby low power mode. As we cannot de-activate the watchdog during long hibernation, the following workaround is implemented: we are woken-up once by the watchdog and go back to hibernate if we detect that condition. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=chrome-os-partner:19595 TEST=on Spring with rework on the EC wake-up pin, type "hibernate 10" and see the EC console going blank for 10s, then booting with reset cause equals to "hibernate". Press Alt+VolUp+H, then wake-up the system by pressing power key. Change-Id: I28150e69817ae80314f52977ec6b62750017c2c4 Reviewed-on: https://gerrit.chromium.org/gerrit/58086 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Only cache LP5562 status on I2C transaction successstabilize-4255.BVic Yang2013-06-111-3/+5
| | | | | | | | | | | | | | If the I2C transaction fails, we shouldn't cache the status because that status is not set correctly in LP5562. BUG=chrome-os-partner:20020 TEST=Boot and check battery LED still works. BRANCH=spring Change-Id: I3f40c2d5c85db41e4ba4b80dc5252e5d86100823 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58072 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Retry when TSU6721 initialization failsVic Yang2013-06-112-25/+44
| | | | | | | | | | | | | | Sometimes initialization may fail due to bad I2C bus status. Let's allow for maximum 3 tries of initialization 500ms apart from previous attempt. BUG=chrome-os-partner:20020 TEST=Boot and check device type detection still works. BRANCH=spring Change-Id: I6ccedf77c92c4b6014ca24c7a63534316eaa7b6a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58071 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Console input support for emulatorVic Yang2013-06-102-3/+60
| | | | | | | | | | | | | | | This creates a separate thread that keeps reading characters from stdin and feed to UART process. BUG=chrome-os-partner:19235 TEST=Start up a emulator and type 'help'. See command list. TEST=Pass all tests for 300 times. BRANCH=None Change-Id: I190c1d939b0b4ad0f8f0517d8d7b06f2f3df3832 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57866 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Revert "Add some debugging messages for unresponsive batteries"Bill Richardson2013-06-101-8/+1
| | | | | | | | | | | | | | | | This reverts commit c848e3216179ad0fb53d937da20237d4fe0266c7. Too noisy. It was supposed to only show it once, but it spews constantly instead. Debug it later - just remove it for now. BUG=chrome-os-partner:20057 BRANCH=none TEST=none Change-Id: Ie6dfd4ccb84a612bb72a0d2b758361a13644e4d9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58111 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Define watchdog_reload() to nothing if not CONFIG_WATCHDOGRandall Spangler2013-06-105-19/+18
| | | | | | | | | | | | | | | | | | | Currently, we need to have #ifdefs everywhere watchdog_reload() is called. With this fix we don't. Also don't bother including unused hardware timer watchdog code if the watchdog isn't defined. No change when CONFIG_WATCHDOG is defined (which it is for all normal builds). BUG=chrome-os-partner:20056 BRANCH=none TEST=build all platforms with CONFIG_WATCHDOG commented out in config.h Change-Id: Id3ce33af1a497eda127a4892e13651d9d2534d92 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58094 Reviewed-by: Simon Glass <sjg@chromium.org>
* Unit test for queue implementationVic Yang2013-06-104-1/+197
| | | | | | | | | | | BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I575e4a9abfd9431e3b74c36da8c3d69285e5c0fb Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58032 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* Only waste 1 byte in queue bufferVic Yang2013-06-101-2/+2
| | | | | | | | | | | | | | | For simplicity of the code, we don't allow (head == tail) when the queue is full. But currently we are wasting the size of a single unit, while we can actually just waste 1 byte. Let's fix this. BUG=None TEST=Pass the unit test. BRANCH=None Change-Id: Id09c20a9345ebb3ec0cad659afe36e25b422e688 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58058 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* Bug fix of queue empty slot calculationVic Yang2013-06-091-2/+6
| | | | | | | | | | | | | | Current implementation of queue_has_space doesn't handle the case where queue tail has wrapped around the end. This CL fixes the bug. BUG=None TEST=Pass the test in the following CL. BRANCH=link Change-Id: I774f388081af50f0e930a6cbc3a723da1c8283b0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/58031 Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* Enable ADC charger current monitor for SlippyBill Richardson2013-06-073-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IOUT pin of the smart battery charger can be used to monitor the AC adapter current (default) or the battery charging current. BUG=none BRANCH=none TEST=manual Discharge the battery a bit, and connect to the EC console. With the AC power plugged in, the "battery" command should show charging status, including current. The "adc" command will display the A-D converters, including the current measurement. For example: > battery Temp: 0x0b88 = 295.2 K (22.1 C) Manuf: SMP-COS20 Device: OC2 Chem: LION Serial: 0x0005 V: 0x4130 = 16688 mV V-desired: 0x41a0 = 16800 mV V-design: 0x39d0 = 14800 mV I: 0x008e = 142 mA(CHG) I-desired: 0x0080 = 128 mA Mode: 0x6001 Charge: 98 % Abs: 94 % Remaining: 1871 mAh Cap-full: 1923 mAh Design: 2000 mAh Time-full: 0h:23 Empty: 0h:0 > > adc ADC channel "ECTemp" = 317 ADC channel "ChargerCurrent" = 455 > That current is significantly higher than the "I:" reported by the "battery" command. But look at the charger options: > sbc 0x12 0x7904 (30980) > Bit 5 controls the IOUT Selection. When clear, it monitors the current from the AC adapter. Set bit 5 to monitor the current provided to the battery: > sbc 0x12 0x7924 > adc ADC channel "ECTemp" = 318 ADC channel "ChargerCurrent" = 128 > That matches what the smart battery sees. Change-Id: I2fe351304421dfb22d83ef13d416aa44c9f56e8a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57940 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix broken ADC gpio configuration for lm4Bill Richardson2013-06-071-4/+5
| | | | | | | | | | | | | | | | | The ADC pins were being misconfigured for quite a while now. Let's fix 'em. BUG=none BRANCH=link TEST=none The effect was that the adc values that measure GPIO pins were less accurate. Since no one noticed, there's probably not much that can be done to test it. Change-Id: I9def4eb95c89f72e5df0721e6153c8caa3ef8e2a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57939 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Initial support for Slippy batteryBill Richardson2013-06-076-8/+76
| | | | | | | | | | | | | | | | | | | | This adds the initial support for Slippy's battery. The data I have is unclear and incomplete, so this is NOT the final form. It seems to work right now, and hasn't caught fire or anything, but it will need futher tweaks. BUG=chrome-os-partner:19976 BRANCH=none TEST=manual (and watch it!) Connect the EC console and watch what happens. You should see the battery charging, discharging, etc. Keep an eye on it, though, and never leave it unattended when on AC - we don't have the full data sheets available yet. Change-Id: Id9bf93dc04a1399a9cdbc2156b3fac74be62038f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57814 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Improve 'sb' command, add 'sbc' commandBill Richardson2013-06-071-26/+52
| | | | | | | | | | | | | | | | The sbc command can be used to get/set registers from the smart battery controller. The sb command already does that for the smart battery itself. BUG=none BRANCH=none TEST=manual Try it out. Change-Id: Idaea451e58988ab2d6bc40164721cb5577d903af Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57813 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add some debugging messages for unresponsive batteriesBill Richardson2013-06-071-1/+8
| | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: Id56c2b180c670115819dd29c85ecc3d0e96bd26f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57812 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add support for TI's Smart Battery Charger BQ24707ABill Richardson2013-06-076-95/+351
| | | | | | | | | | | | | | | | This is very similar to the BQ24725. There are just enough differences to require a separate file. BUG=chrome-os-partner:19976 BRANCH=none TEST=none Nothing to test until it's enabled. Change-Id: I3247fcfde93ac75f5f9790acadc7feca28038608 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57811 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Separate battery selection from charging logicBill Richardson2013-06-071-1/+2
| | | | | | | | | | | | | | Just tweaking the build.mk file so that other batteries can be specified for use by the same charging logic. BUG=none BRANCH=none TEST=none Change-Id: I01b39a6ffc4091b9b7824cf1759b36168f6f5701 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57810 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Change i2c port configs to make BDS the special case, not Link.Bill Richardson2013-06-061-12/+11
| | | | | | | | | | | | | This matches our reference design for the EC's i2c GPIOs. BUG=none BRANCH=none TEST=none Change-Id: I8320b6234e2db8d645d0c4d4e982e3817da9f5e7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/57809 Reviewed-by: Randall Spangler <rspangler@chromium.org>