Commit Graph

1695 Commits

Author SHA1 Message Date
Randall Spangler
981208dbcf Move lpc-specific flags out of host command args
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>
2013-06-14 16:16:22 -07:00
Aaron Durbin
1bd57bba38 haswell: mark PCH_SMI_L as open drain
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>
2013-06-14 16:16:11 -07:00
Aaron Durbin
17e9c06a1a haswell: Add notes about PL6 weirdness
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>
2013-06-14 16:16:09 -07:00
Bill Richardson
7884ae4821 Fix some stupidness in ectool's comm_init() handling
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>
2013-06-14 16:16:09 -07:00
Vic Yang
6a701c5957 spring: Show green LED when 94% charged
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>
2013-06-13 22:16:06 -07:00
Bill Richardson
1695760e95 Rename GPIO_HI_Z macros to more descriptive GPIO_ODR_HIGH/LOW
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>
2013-06-13 18:13:23 -07:00
Duncan Laurie
f2fa913320 falco: fix RCIN# GPIO setting
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
2013-06-13 18:13:20 -07:00
Vic Yang
61ae739eef More queue unit test
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>
2013-06-13 18:13:19 -07:00
Vic Yang
3759746550 More hooks unit test
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>
2013-06-13 18:13:17 -07:00
Vic Yang
11e7d31dbb More utils unit test
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>
2013-06-13 18:13:16 -07:00
Vic Yang
2a270f5978 Incorporate CABLE_DET circuit change
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>
2013-06-13 17:21:36 -07:00
Bill Richardson
cc9b3464e2 Falco: Disable IFAULT_HI on the BQ24738 charger
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
2013-06-13 15:52:29 -07:00
Bill Richardson
74f5aaaa50 Use battery's precharge_current value for deep discharge recovery.
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
2013-06-13 15:52:16 -07:00
Randall Spangler
d46ea680f7 pit: AC detect signal is a simple GPIO now
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>
2013-06-13 12:51:08 -07:00
Bill Richardson
c09f37cf09 Falco: Placeholder to maybe disable IFAULT_HI on battery charger
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
2013-06-13 09:02:13 -07:00
Bill Richardson
dcbaa1c80d Falco: Add support for bq24738 charger (and guess at battery).
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
2013-06-13 09:02:08 -07:00
Bill Richardson
cab5abeb40 Falco: Measure adapter ID voltage
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
2013-06-13 09:02:04 -07:00
Bill Richardson
ffce85ac52 Slippy: Adjust battery voltages to be closer to reality.
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
2013-06-12 15:01:01 -07:00
Bill Richardson
270d92532f Add I2C port 1 for LVDS debug.
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>
2013-06-12 10:18:15 -07:00
Bill Richardson
30eb8afe03 Falco: New LED gpios
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
2013-06-11 16:56:54 -07:00
Vincent Palatin
71612e73d7 spring: update PWM characterization for DVT1
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>
2013-06-11 10:19:48 -07:00
Vincent Palatin
6fdd37c71b stm32: add hibernate support using stm32f100 standby mode
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>
2013-06-11 10:19:46 -07:00
Vic Yang
465b59342a Only cache LP5562 status on I2C transaction success
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>
2013-06-11 02:25:24 -07:00
Vic Yang
9b981bf1af Retry when TSU6721 initialization fails
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>
2013-06-11 02:25:22 -07:00
Vic Yang
572193cb9a Console input support for emulator
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>
2013-06-10 20:21:37 -07:00
Bill Richardson
2187b4d9ac Revert "Add some debugging messages for unresponsive batteries"
This reverts commit c848e32161.

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>
2013-06-10 18:08:31 -07:00
Randall Spangler
0b8f5a3a6c Define watchdog_reload() to nothing if not CONFIG_WATCHDOG
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>
2013-06-10 13:59:34 -07:00
Vic Yang
cbee574e64 Unit test for queue implementation
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>
2013-06-10 01:48:46 -07:00
Vic Yang
a9541220dc Only waste 1 byte in queue buffer
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>
2013-06-10 01:48:44 -07:00
Vic Yang
8bed9853d7 Bug fix of queue empty slot calculation
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>
2013-06-09 21:33:17 -07:00
Bill Richardson
149a8457aa Enable ADC charger current monitor for Slippy
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>
2013-06-07 13:13:48 -07:00
Bill Richardson
f32ad15e37 Fix broken ADC gpio configuration for lm4
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>
2013-06-07 12:25:33 -07:00
Bill Richardson
cf5b6daee3 Initial support for Slippy battery
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>
2013-06-07 10:52:14 -07:00
Bill Richardson
710cadde7c Improve 'sb' command, add 'sbc' command
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>
2013-06-07 10:52:13 -07:00
Bill Richardson
c848e32161 Add some debugging messages for unresponsive batteries
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>
2013-06-07 10:52:12 -07:00
Bill Richardson
124b2f1492 Add support for TI's Smart Battery Charger BQ24707A
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>
2013-06-07 10:52:11 -07:00
Bill Richardson
0fdfcda963 Separate battery selection from charging logic
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>
2013-06-07 09:46:10 -07:00
Bill Richardson
57c7d4103f Change i2c port configs to make BDS the special case, not Link.
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>
2013-06-06 14:42:25 -07:00
Bill Richardson
4ff299e29d Send STOP to clear bus when I2C encounters an error.
Reading from a nonexistant/nonresponsive smart battery fails (as it should).
But then it leaves the i2c clock line low, so that subsequent i2cscan
commands fail too.

This change just sends a STOP to clear the bus when an i2c error occurs.

BUG=chromium:247037
BRANCH=none
TEST=none

Change-Id: I599bed7149ed3dd3748f1a939c2ea8fdf65e3d72
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57808
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-06-06 14:42:25 -07:00
Bill Richardson
d0d1564434 ectool prefers /dev/cros_ec, then falls back to i2c, lpc
This is preparation for the common userspace EC interface. If/when that
appears, this will be ready.

BUG=chromium:239197
BRANCH=all
TEST=manual

Build, install, run it. Shouldn't be any change.

Change-Id: I9fa78515ec5443ba659f10a66bbaadcb7f4802b0
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56131
2013-06-05 14:12:23 -07:00
Randall Spangler
26475135b5 Pit stays on HSI instead of using PLL with the same 16MHz frequency.
Leaving the PLL turned off saves about 0.5 mW (and also presumably
speeds up boot a tiny amount, since we don't need to wait for the PLL
to lock).

BUG=chrome-os-partner:19951
BRANCH=none
TEST=system boots normally.  power consumption on P1.8V_MICOM rail is lower.

Change-Id: I93dc1efabbf6c6b0b5a43ffebe1068d18c689bef
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57645
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-06-05 14:12:13 -07:00
Randall Spangler
d5fece8ce5 Re-enable task profiling on pit
This costs 232 bytes RAM; we still have over 6KB free.

BUG=chrome-os-partner:19945
BRANCH=none
TEST=taskinfo shows timing and interrupt counts

Change-Id: I1c4e4eac44b48c66b075b8ea209b4748c55b7fcb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57511
2013-06-05 14:12:12 -07:00
Vic Yang
ea32f132f7 spring: Guard battery cut-off command with lock
The two I2C commands for battery cut-off must be sent out back to back.
Thus we need to guard them with I2C port lock to prevent being
preempted.

BUG=chrome-os-partner:19901
TEST=Check battery cutoff still works.
BRANCH=spring

Change-Id: Iac51037432b108d4cac29d5c73cafa9ce2310b12
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57598
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-06-05 11:25:10 -07:00
Vic Yang
3e0e15d185 Accept a command if it's a full match
On Spring, we now have commands 'i2c' and 'i2cscan'. Currently if we
type 'i2c', it's rejected as it's also the prefix of 'i2cscan'. Since
'i2c' is a full match of a legal command, we should accept it.

BUG=None
TEST=On Spring, check 'i2c' invokes 'i2c' command, and 'i2cs'/'i2cscan'
invokes 'i2cscan' command. Also check 'i2' is still rejected.
BRANCH=all

Change-Id: I65c4c148a5a3e9b025554fa8165ba76da7bc312f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57576
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-06-05 11:25:09 -07:00
Vic Yang
127b053109 Reset TSU6721 on initialization
Sometimes TSU6721 falls into a weird state where video dongle is
recognized as non-standard charger. Let's reset TSU6721 when EC boots,
so that we are guaranteed to have a clean state after initialization.

BUG=None
TEST=Keep doing Power+F3 reset. Doesn't see weird state anymore.
BRANCH=spring

Change-Id: Id09bb1721ae79804dc9b3300a2f3def850c2f70a
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57575
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-05 11:25:08 -07:00
Vic Yang
d07b0d5a5f spring: Update device type on video power change
This is needed to properly notify kernel of power changes.

BUG=chrome-os-partner:19925
TEST=Attach/remove power from video dongle, and see device type changes.
BRANCH=spring

Change-Id: Ic91ad43ed934be021689c4c4557914e6163e06f8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57569
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-05 11:25:07 -07:00
Aaron Durbin
72a69f6669 haswell: fix driving of WAKE# pin on power button press
The WAKE# pin was being driven low when the power button was
pressed and no other events were occuring. This causes a PCIE
wake event to be observed on the host. This is incorrect. Therefore
only assert the WAKE# pin when any other event but the power button
has occured.

The implementation introduces a board-specific callback,
board_process_wake_events(), which handles the specific logic
for the wake events.

BUG=chrome-os-partner:19810
BRANCH=None
TEST=Manual. Both power button wakeup and lid events were tested. The
     presence of PCIE Wake no longer exists for S5->S0 transitions.

Change-Id: If1311ccc36629b04d2d9e021c3e103e379836a3a
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56970
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-06-04 10:08:30 -07:00
Dave Parker
7abe696281 Peppy: Add GPIOs for power and battery LEDs
Based on 2013-05-23 schematic.

BUG=chrome-os-partner:19640
BRANCH=none
TEST=none

Signed-off-by: Dave Parker <dparker@chromium.org>

Change-Id: Iacb3bf09e7fc6b0d58148f014bc8e4e721151228
Reviewed-on: https://gerrit.chromium.org/gerrit/56502
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
2013-06-03 15:30:41 -07:00
Dave Parker
b4a9589187 Add LED GPIOs for slippy.
BUG=None
TEST=Manual. From ec console:
  gpioset BAT_LED0_L 0
  gpioset BAT_LED1_L 0
BRANCH=slippy
Signed-off-by: Dave Parker <dparker@chromium.org>

Change-Id: Icd4bf714f738507227d3476696eb8e17eff7d685
Reviewed-on: https://gerrit.chromium.org/gerrit/57282
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
2013-06-03 14:34:16 -07:00
Vic Yang
80105a9556 Enable flash unit test on emulator
BUG=chrome-os-partner:19236
TEST=Pass all tests
BRANCH=None

Change-Id: I09276292499b94b2d4810830de51e4c63a9b7342
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56704
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-03 14:34:10 -07:00