Commit Graph

1860 Commits

Author SHA1 Message Date
Vic Yang
bcdfbee1b6 spring: Always pull 500mA before charger type is determined
To prevent the EC browning out when the battery is too low, let's always
pull 500mA before we can determine the charger type. The correct current
limit can then be set after we know the charger type.

Also, even if the battery is not present, keep the PWM tweaking loop
going.

BUG=chrome-os-partner:21107
TEST=Plug in charger to a device with a dead battery and see it charge.
BRANCH=Spring

Change-Id: Iad5599b60d20fb405d78d30b2be74bcc98958dd5
Original-Change-Id: Iec2ec96e3c2c341f14888aa50bd84f72af75c073
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63626
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64275
2013-08-01 18:15:46 -07:00
Vic Yang
311812b569 spring: Show yellow LED for battery not fully charged in idle state
Even if the charge state machine is in idle mode, we should still show
yellow LED if the battery is not fully charged. This prevents the case
where the LED is green when the battery just comes back from cut-off
mode.

BUG=None
TEST=Cut off the battery. Plug in the charger and doesn't see green LED.
BRANCH=Spring

Change-Id: I079bcc19fcfff98a498cd9e3d2f99f0566b15fe4
Original-Change-Id: I14e6b3d32e04992bd8291da4b8b95e8e23a3acf0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63459
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64274
2013-08-01 18:15:46 -07:00
Vic Yang
19ee2c44c5 spring: Increase CABLE_DET voltage threshold
With this, we can more precisely distinguish a video dongle and an USB
host. The downside is that old boards with ID_OUT connected instead of
CABLE_DET will lose the ability to use a video dongle.

BUG=chrome-os-partner:21310
TEST=Plug in USB host in S5 and see it's detected correctly.
BRANCH=Spring

Change-Id: I26856593a9fc1ef99c60b27aef3a53538e96f482
Original-Change-Id: I1116ac447bbc0b491f88fa38c16ff57501fe0288
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63297
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64273
2013-08-01 18:15:45 -07:00
Vic Yang
075006c603 spring: Ignore battery assist mode when deciding LED color
Now we decide LED color only based on battery charge level. Remove the
logic of checking battery assist mode.

BUG=chrome-os-partner:20017
TEST=Build success
BRANCH=Spring

Change-Id: I9fc38f57c931d4a678154e097776d284eb39f6c1
Original-Change-Id: Ide770e96ead05ae96db54290627853132f7edcb3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62487
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64272
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-08-01 18:15:44 -07:00
Vincent Palatin
8f3d02ef7f Revert "spring: always enable the PP3300_WWAN rail"
This reverts commit 154c73f32d.

The kernel driver to control TPS65090 FETs is now submitted in our tree,
and turning on the FET3 connected the 3G modem by default.
So let's remove the hardcoded to allow better power management policy on
the CPU side.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=spring
BUG=chrome-os-partner:17790
TEST=on Spring, boot and dump the TPS65090 configuration from the EC
command line by using "pmu" command.
See 0x1f in the register 0x11 for FET3.

Change-Id: Ie699fef0348138a7483f0e8e7bcaebc37810eba8
Original-Change-Id: I9de0f92a561397ceb81a67b8291d1e8bf04ade38
Reviewed-on: https://gerrit.chromium.org/gerrit/57978
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64271
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
2013-08-01 18:15:43 -07:00
Randall Spangler
bebfb9431e Word-align the host memory map
This fixes unaligned access exceptions when totally-unrelated code
changes happen to move around host_command.c's global variables.

BUG=chrome-os-partner:21578
BRANCH=none
TEST=add a ccprintf() call to host_command.c; no longer causes an exception

Change-Id: I5407e5631a08ea647dc40e5bd9c7bd101868ced0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/64233
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-08-01 14:22:44 -07:00
Dave Parker
8e28efa7ac Add hook for changes in the charge state machine
BUG=chrome-os-partner:20145
BRANCH=falco,peppy
TEST=Manual. Tested with charging timeout logic.

Change-Id: Iab1c9746dcab5820fcdeb3e0d94bfcb0c47e57f2
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63537
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-01 11:07:58 -07:00
Aaron Durbin
706f121146 bolt: force SYS_PWROK and PP3300_DSW_GATED_EN to 0 in forcing G3 path
The following signals were not being initialized properly in the
forcing G3 path:
- GPIO_SYS_PWROK
- GPIO_PP3300_DSW_GATED_EN
This lead to the EC RW sysjump, but the boards wouldn't reboot
on the x86 side. Sadly, without this change, the board I have
works. However, those signals need to be driven low.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Willis tested on boards that previously didn't work.

Change-Id: I1771881485bc5be73ed2b08da91fddff9ab09167
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63845
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-08-01 00:30:24 -07:00
Bill Richardson
86bef29c3d Abstract polite AP throttling into a function
This wraps the EC_HOST_EVENT_THROTTLE_START/STOP host events in a new
function called host_throttle_cpu(), similar to chipset_throttle_cpu().

That function requests the AP to throttle itself, which is less drastic than
just smacking it down from the EC.

BUG=chrome-os-partner:20805
BRANCH=falco,peppy
TEST=manual

This is a refactoring change only. All boards should still build, all tests
should still pass.

Change-Id: I871cce8f0e13230cb52eeb5e16955266f8461374
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63909
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-31 12:33:31 -07:00
Bill Richardson
af77729737 Add build-time checks on board-specific array sizes.
We've been declaring a bunch of statically-sized arrays:

  extern struct foo_t foo[FOO_COUNT];

And then initializing them like so:

  struct foo_t foo[FOO_COUNT] = {
    /* blah */
  };

That only catches cases where we initialize with too many entries. It
doesn't catch cases where we haven't initialized enough. This change tests
for both cases like so:

  extern struct foo_t foo[];

  struct foo_t foo[] = {
    /* blah */
  };
  BUILD_ASSERT(ARRAY_SIZE(foo) == FOO_COUNT);

The affected arrays are:

  adc_channels[ADC_CH_COUNT]
  gpio_list[GPIO_COUNT]
  temp_sensors[TEMP_SENSOR_COUNT]
  x86_signal_list[X86_SIGNAL_COUNT]
  i2c_ports[I2C_PORTS_USED]

BUG=chrome-os-partner:18343
BRANCH=falco,peppy
TEST=build all platforms

All platforms should still build, all tests should still pass.

Change-Id: Ibb16dc3201f32df7cdc875648e89ba4ffb09f733
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63833
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-31 12:33:31 -07:00
Dave Parker
f6799258c3 Add led_slippy build rule back to common/build.mk
This got dropped during some of the recent clean up.

BUG=None
BRANCH=slippy
TEST=Manual. Check that the LED on slippy is working.

Change-Id: I80505c5df72410c9f25521d0c116fc59da5cb1db
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63886
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-31 12:33:00 -07:00
Rong Chang
bf71082456 Add PMU powerinfo host command and console command
Before this change, powerinfo host command supports only one target
with USB charging. This change adds a common powerinfo host command
and console command for TPSChrome based targets.

BRANCH=None
BUG=chrome-os-partner:20326
TEST=manual
  build and flash pit target, check console command 'powerinfo'.
  check ectool powerinfo with and without AC adapter.

Change-Id: I2cfd8dfa011e23f819c6bae19cf22b4a7343f044
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63350
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-07-29 11:07:31 -07:00
Aaron Durbin
1b4c5cf71e ectool: fix console command
There are a few issues with console output:

1. The EC was returning more bytes than the message's insize. The
   reason stems from a refacotring that the set the global
   ec_max_insize  variables to 'EC_PROTO2_MAX_PARAM_SIZE - 8'.
   It really should be EC_PROTO2_MAX_PARAM_SIZE to cover the
   maximum packet size returned from the EC.

2. A change was made to handle EAGAIN returning from the EC kernel
   driver's ioctl() interface. That change prevented 0 bytes received
   from being returned properly.

The first issue occurs because the EC console is always larger than
what the original ec_max_insize was set to. This caused no console
messages to be displayed. The second issue causes the console command
to potentially loop forever because the drain of the EC console is
never indicated because 0 could never be returned.

BUG=chrome-os-partner:21165
BRANCH=falco,peppy
TEST=Built and can now read 'ectool console' output as well
     as not including gargabe.

Change-Id: I3114594f0020a5198532aa78ce126f4da6caf09a
Reviewed-on: https://gerrit.chromium.org/gerrit/63445
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
2013-07-26 14:07:45 -07:00
Bill Richardson
ac78e589af Add new hostevents to ask the AP to throttle itself
Occasionally the EC wants to ask the AP to throttle itself. Currently, the
only thing that the EC can do (at least on x86) is to assert the PROCHOT#
signal, which is a fairly intrusive operation and one that Intel suggests we
save for emergencies.

This CL adds a new pair of host events to ask the BIOS to throttle the AP
politely, or stop doing so. The turbo charger code will send these events to
the AP if they become necessary.

BUG=chrome-os-partner:20739
BRANCH=falco,peppy
TEST=manual

Tests should still pass, everything else is unchanged.

  make BOARD=${BOARD} runtests

Currently, there's nothing on the BIOS/OS side that would respond to these
events, so they're just ignored. You can test that, even without this CL, by
running

  hostevent set 0x40000
  hostevent set 0x80000

Change-Id: I4a7a1b6eb87e42df94ddd09f4c6abee6ebcbd485
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63379
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-07-25 19:02:09 -07:00
Randall Spangler
245275f4b6 Pulse EC_ENTERING_RW instead of just leaving it high
The Silego chip has a 50k pulldown which will leak power if we leave
EC_ENTERING_RW high.  We don't need to leave it high, because once the
latch in the Silego gets set it ignores this signal.  This is ~100uA,
so it only really matters in S5 on pit (since x86 boards and spring
both hibernate in S5).

BUG=chrome-os-partner:20757
BRANCH=none
TEST=probe ec_in_rw signal before/after sysjump

Change-Id: Ib6b09cfc7718b35e4e93c952c3098c08d53572e2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62133
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-25 17:25:42 -07:00
Bill Richardson
298a7276c2 Add turbo mode charger support, and tests for it.
Some chargers can run in a "turbo" mode, which lets it draw from the battery
to provide extra power to the AP in short bursts. In order for this to work
properly, the EC has to watch the current closely to make sure specific
limits are observed. It also has to recognize specific adapters, since those
limits vary depending on the rated power that the adapter can provide.

This adds the basic functionality, plus a test for it.

BUG=chrome-os-partner:20739
BRANCH=falco,peppy
TEST=manual

  make BOARD=${BOARD} runtests

On Falco, you can also use the "adapter" EC command to see what's going on.
Try replacing the adapters and running that command to be sure they're
correctly identified, too:

  > adapter
  Adapter 65W (590mv), turbo 1, AP_throttled 0
  >

We currently support 45W, 65W, and 90W adapters. Unknown adapters are
treated as 65W, but don't enable turbo mode.

Change-Id: I7e5407db825ce7e596cb495fb8cb4d1dd1ff639c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63372
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-25 15:50:13 -07:00
Bill Richardson
4231660869 Change macro names used for test configurations
We can't change CONFIG_ options from the gcc commandline, because
include/configs.h explicitly undefs them again. So for some tests, we add a
-DFOO to the command line and then put this in the source:

This change just uses TEST_FOO instead of FOO, so it's more obvious what's
happening.

BUG=chrome-os-partner:20739
BRANCH=falco,peppy
TEST=manual

No functional change, just renaming. Run

  make BOARD=${BOARD} runtests

Everything should still pass.

Change-Id: I17e10180f8d779dff0961cf411f5b61cfc70c316
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63371
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-25 15:50:12 -07:00
Randall Spangler
1960b9f957 Add descriptions for lots of config options
No functional changes, no renaming options, just adding comments.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I7218f8a4465e3e27b33a1d1a5313da83e474d633
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63281
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-24 19:08:18 -07:00
Randall Spangler
b4d903487e Clean up onewire config options
Rename onewire_led to led_driver_ds2413, since we may have other LED
drivers hanging off a one-wire bus in the future.

No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I1d70b1c5778da94bda4ebef3b57f7c39bfba2322
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63273
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-24 18:08:32 -07:00
Randall Spangler
90215a4494 Clean up more config options - FMAP, etc.
CONFIG_FMAP is now defined by default, because all platforms other
than the host unit tests use it.

No functional changes, just renaming config options and removing dead code.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Ie6496310c822491068e2fa6976933486f26badb0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63271
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-24 18:08:31 -07:00
Randall Spangler
ba3733e492 Clean up more config options
No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I65b310b670e61bcb3531c581dfc57625df064df2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63248
2013-07-24 18:08:29 -07:00
Randall Spangler
e6f0c272a0 Clean up and document UART config options
No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I91584cb1f8990dd0f980abd32c04465a66243e71
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63244
2013-07-24 16:31:14 -07:00
Vic Yang
b13a2aed14 Support emulator hibernate
If we are hibernating indefinitely, just exit with hibernate exit code.
If hibernating with a delay, delay for that amount of time and then
reboot.

BUG=chrome-os-partner:19235
TEST='hibernate 1' and see emulator reboot after a second with reset
flag 'hibernate'
BRANCH=None

Change-Id: If25bf2eefbcf275f2592b92a997a9d7e1ff2384d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62970
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-24 15:50:20 -07:00
Vic Yang
99e4a97798 Reboot emulator with execv()
With this, the emulator is able to reboot itself without the help of
run_host_test script. This makes it easier for development and also
speeds up the test.

BUG=chrome-os-partner:19235
TEST=Pass all tests
BRANCH=None

Change-Id: Ifa510442de19256c671ab91b6bc75fe9e8b9dc7b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62969
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-24 15:50:19 -07:00
Rong Chang
5afcb815d6 Collect board X specific files into build.mk common-$(BOARD_X)
This change removes all CONFIG_module_FOO from board/foo/board.h .

BRANCH=None
BUG=chrome-os-partner:21302
TEST=util/ecmakeall.sh

Change-Id: If36c792d7a8587a186287eee5fa31b4c4cf1c006
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63211
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-24 15:50:17 -07:00
Randall Spangler
fe660aa372 Standardize concatenation macros
To create a token by concatenating already-defined macros and new
text, it's necessary to use multiple levels of macro.  We'd already
done that in several places in the code such as STM32_CAT; this now
standardizes it into a single place.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=Build all platforms; examine ec.RO.map to see that irq_*_handler and prio_* symbols
     evaluated the same as before.  (Other macro evaluations would simply fail to compile
     if they were incorrect, since the concatenated tokens wouldn't fully expand.)

Change-Id: Ic9bf11d27881a84507fe7b6096dab6217c6c6dc7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63231
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-24 14:05:17 -07:00
Randall Spangler
596480de06 Add a script to build all platforms and run host-based unit tests
As the number of boards grows, it's handy to have a script which
builds them all and runs host-based unit tests, to make sure that
changes are at least somewhat sane before submitting them to the
commit queue.

BUG=none
BRANCH=none
TEST=util/make_all.sh

Change-Id: Ie3fcb062caedaf36b3e350c3d9be34a9b080c76d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63230
Reviewed-by: Rong Chang <rongchang@chromium.org>
2013-07-24 14:05:08 -07:00
Rong Chang
6c280b1b32 Move TPSChrome charging temperature range to battery pack
This change moves vendor specific temperature ranges to battery pack
files or board setup files. And added a host test case to verify that
does not change x86 smart battery charging state machine behavior.

BUG=chrome-os-partner:21181
BRANCH=None
TEST=manual
  build test: util/ecmakeall.sh
  hosttests: make hosttests && make runtests

Change-Id: I48e76826b5555f64b78e3c063ce5f02416c72aa2
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62978
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-07-24 13:07:13 -07:00
Aaron Durbin
7b95d397fe bolt: add prelimnary support
The preliminary bolt support allows the board to boot
with all the necessary peripherals working except for the
following things:
- Not all board temp sensors are added.
- WLAN is not powered on because of inrush issues.
- USB power chargers are fixed to normal mode for now.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=Built and booted

Change-Id: Iea7a39e812bb396e5731f212630b7fe97c164bf2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62210
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-24 12:09:50 -07:00
Aaron Durbin
18f0bd28e2 x86: build chipset_x86_common.o conditionally
Add a CONFIG_CHIPSET_X86 option that determines if
chipset_x86_common.o is built.

BUG=chrome-os-partner:20372
BRANCH=None
TEST=built bolt and link. All other boards should be covered.

Change-Id: I980a8fc68a31162b920429e695631909c5f6a4db
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63208
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-24 12:09:49 -07:00
Randall Spangler
8cd69cfe53 Clean up and document more config options
No functional changes, just renaming config options.

Remove README, now that all options described in it have been moved to
config.h, and the remaining information is out of date.  (Yes, we
should have a README which describes the organization of the EC
repository, but that's a matter for another CL; this one's about
cleaning up config options.)

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Iafefbe94369f1217c698f11d358bc0ecac2bdfde
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63145
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-07-24 12:09:47 -07:00
Vic Yang
eda52c4ab4 Lessen timing constraints in hooks test
HOOK_TICK and HOOK_SECOND aren't firing with precise interval. Let's
lessen the timing constraints.

BUG=chromium:263288
TEST=Pass all tests
BRANCH=None

Change-Id: Ic093c2a27ed1b8621469a4097e567b80d1eeb50d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63144
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-23 19:02:33 -07:00
Randall Spangler
8b81636780 Clean up and document keyboard config options
No functional changes, just renaming config options.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Ie811066a26eeaf2a5b2002b934e25b660d29058d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63109
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-07-23 17:37:54 -07:00
Randall Spangler
cb1f7306b3 Clean up debug config options
All of these were defined on all but a few platforms, and those
explicitly #undef them.  So define them as enabled by default in
config.h so the board.h files are cleaner.

No functional changes; just rearranging/renaming config constants.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; FEATURES=test emerge-falco chromeos-ec

Change-Id: I1201a1472ae29641e9e219c2a0347691ca64cd28
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/63102
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-07-23 17:37:53 -07:00
Louis Yung-Chieh Lo
a1699727a8 Fixed two i8042 bugs.
1. The buffer for host i8042 command is too small so that a command
   is dropped (buffer full) in some cases. Enlarging it can solve bug.
2. The keystrokes are queued in buffer so that kernel driver cannot
   get stable CTR value. We workaround this by disabling the keystroke
   and clearing buffer when keyboard is disabled.

BUG=chrome-os-partner:20758
BRANCH=falco,link
TEST=Verified on link. Repeatedly press Ctrl + U during booting.
The keyboard is working after boot.

Change-Id: I7d8daef8d815b8e4d08df6f6a26ab2a471e5b150
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62986
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
Tested-by: Duncan Laurie <dlaurie@chromium.org>
2013-07-23 17:37:51 -07:00
Vic Yang
b702babbb7 Fix reset flags and sysjump time for emulator
Reset flags should be set properly according to reset type. Also, on
system jump, current time should be preserved.

BUG=chrome-os-partner:19235
TEST='sysjump rw' and check time is the same.
TEST='reboot hard' and see '[Reset cause: hard]'
BRANCH=None

Change-Id: I00fd2c652d10c237f23cc6a33e0b667422bc625d
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62958
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-23 16:06:24 -07:00
Vic Yang
f98def750d Test power button in kb_8042 test
This checks keycodes are sent correctly when power button is pressed.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Ibaa4ffce749167be5b8376aada0786f9760e7707
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62955
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-23 16:06:22 -07:00
Vic Yang
74abf36971 Test sysjump tag in kb_8042 test
This checks that keyboard state is preserved across system jump.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: I53c5bb68246fd117b351d89c3907daf028bc4ef3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62908
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-23 16:06:22 -07:00
Randall Spangler
64e38af781 Clean up and document PMU config options
No functional changes, just documenting and renaming.

All boards which use the PMU must provide pmu_board_init().  This was
already true - except that Daisy's pmu_board_init() was implemented as
part of pmu_init() instead of its code living in board.c; I've moved
the code there now.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I85ad06dc3b6287ad917fe13acf83182f24a8f23d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62906
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-07-23 11:14:16 -07:00
Randall Spangler
4288e45815 Clean up and document battery config options
No functional changes, just documenting and renaming.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I0b0d3cdce535d90ce437e82e96346fc3ca9be7b0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62673
2013-07-23 11:14:15 -07:00
Randall Spangler
345c22be08 Clean up charger config options
These are now described in config.h.  The various BQ chargers now also
use a consistent naming for their sense resistor options.

No functional changes, just renaming, and removal of obsolete
never-defined configs.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: Ie274546fe45f5ffc6fd0f26096c4622805baf8a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62540
2013-07-23 11:14:14 -07:00
Dave Parker
148a6f58d4 Add ectool chargecontrol discharge command for Slippy
BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Run ectool chargecontrol command with each option (normal,
idle, discharge) on Slippy. Verifiy battery is discharging
in discharge mode via EC console 'battery' command.

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: I0461b20fc15c99380327b9a282efff7f1ed93baf
Reviewed-on: https://gerrit.chromium.org/gerrit/62851
2013-07-22 17:57:22 -07:00
Vic Yang
8218aa1346 Add system_common unit test
This tests reboot-on-ap-shutdown.

BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Ic1a07670f82646e85d014d52a2aba0835319c212
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62855
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-22 16:09:47 -07:00
Dave Parker
2d205f97cb Slippy: Detect physical presence of battery before waking it
BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Power device without battery. It should boot with no 30
second delay. The battery LED blinks orange indicating a
battery error.

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

Change-Id: Icabc450cd44748aed694e4ed8cb81eee152cf456
Reviewed-on: https://gerrit.chromium.org/gerrit/62850
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
2013-07-22 16:09:45 -07:00
Dave Parker
89ef837224 Set Slippy write protect to active low
BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Verify correct WP value using crossystem wp_cur.

Change-Id: I1eb30584a744df7c695a06544d46b729cd4a689f
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62849
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-22 15:29:03 -07:00
Dave Parker
0fa59af9d2 Basic G781 temp sensor support for Slippy
This lets us read the internal and external values on the
G781 temp sensor.

BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=run ec 'temps' command on Slippy.

Change-Id: Ib3a2a89efd4cfbc4a49696c79daa37bc1880a3ef
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62847
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-22 15:29:01 -07:00
Dave Parker
46af344b87 Battery LED control for Slippy
BUG=chrome-os-partner:21180
BRANCH=slippy
TEST=Manual. Verify LED is amber while charging, blue when
charged, and off when external power disconnected.

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

Change-Id: If80bb9b0c70951d257621a2fe3ef20cd8749a033
Reviewed-on: https://gerrit.chromium.org/gerrit/62848
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
2013-07-22 15:28:58 -07:00
Vic Yang
935d761a39 Move .lcov_lock to /tmp/ec-lcov-lock
flock leaves the lock file and git complains about it. Let's move the
lock file to /tmp/ec-lcov-lock.

BUG=chrome-os-partner:19235
TEST=make coverage and check .lcov_lock is in /tmp
BRANCH=None

Change-Id: Id6d68af327b53aa1c0c7ae9186149126d8a5cc37
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62858
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-22 14:35:41 -07:00
Dave Parker
d7dc9de8c9 Falco: Swap battery LED colors to follow HW change
BUG=chrome-os-partner:20984
BRANCH=falco
TEST=Manual. Verify battery LED is amber when charging
and white when charged.

Change-Id: I98ba6e1839d5e07ad0c0422addc9708aadcce00f
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62678
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-19 18:01:57 -07:00
Randall Spangler
fe76b51da0 Truncate version string to 32 characters
The version struct and EC_CMD_GET_VERSION assume 32-character version
strings.  But if the git tree is dirty and the board name is long, the
version string overflows that limit.

This change truncates what's stored in the version string to fit.

The build info still contains the full version string, as it did before.

BUG=chrome-os-partner:21156
BRANCH=none
TEST=build BOARD=mccroskey with a dirty tree; it should build.
     Then cat build/mccroskey/ec_version.h to see CROS_EC_VERSION32 has
     truncated the version string.  Then build a platform of your choice
     and type 'version' to see that the version string and build info is
     still reported correctly.

Change-Id: Ie71b8efd99a83315f8b4d5ad10c51e48781b12f4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62649
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-07-19 18:01:55 -07:00