Commit Graph

431 Commits

Author SHA1 Message Date
Randall Spangler
695289cfe6 Add console command to fake battery state of charge
The new 'battfake' command is really handy for testing low-battery
shutdown logic.

BUG=chrome-os-partner:17124
BRANCH=link
TEST=from EC console:
	  reboot
	  battfake -> using real battery level
	  power on system -> lightbar should be blue
	  battfake 5
	  lightbar turns red after a few seconds
	  UI shows battery is very low
	     (shows <5% due to different kernel math)
	  'ectool battery' from root shell shows present capacity ~5% of
	  	  design capacity
	  remove AC power
	  battfake 4
	  UI shows low-battery screen and shuts down (may take a minute)
	  battfake 50
	  power on system
	  UI shows battery at 45-55%
	  battfake 2 -> system shuts down immediately
	  battfake -1
	  power on system
	  UI shows actual battery level

Change-Id: I3180e321241c0f586f3baad2150fb6a2b2d2e242
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43151
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-02-12 18:10:14 -08:00
Randall Spangler
9fde14da9b Rename and document battery constants
In preparation for cleaning up low-battery logic.  Make clear what
comparison operator is used for each constant (<=, <, >=, >).

Also remove hard-coded and unused display of design warning/low
battery levels from ectool.  Verified via code search that these are
not used anywhere.  Even if we later care about these levels, they
should be battery-specific and not hard-coded as a
platform-independent percentage of full capacity when ectool is
compiled.

BUG=chrome-os-partner:17124
BRANCH=link
TEST=compile link; 'ectool battery' from root shell prints valid info

Change-Id: I3650e27a08f4cc77067beb0685ee1488cc56d02f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43119
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-02-12 13:46:44 -08:00
Vic Yang
c93378dafa spring: Distinguish Apple Chargers
This uses D+/D- voltage to distinguish different Apple chargers.

BUG=chrome-os-partner:14319
TEST=Manual on Spring
BRANCH=none

Change-Id: I50075d466f6e6b1adf613748cf433d7f43c04bfe
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42850
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-07 22:06:05 -08:00
Vic Yang
f4a9ffdee3 spring: Control battery LED
This implements a basic battery LED policy:
  - Charged: green
  - Charging: yellow
  - Error: red
  - No charger: off

BUG=chrome-os-partner:17561
TEST=Manual
BRANCH=none

Change-Id: I7fa8242efa4d0382d8ef0cafe80f01d44c390397
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42607
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-05 20:16:17 -08:00
Vic Yang
c06e987c1b Tweak lp5562 driver interface
This makes it possible to define color constants so as to reduce code
size when called.

BUG=chrome-os-partner:17561
TEST=Build success.
BRANCH=none

Change-Id: I800b8d4b84749907b071febfea58d27fef7cc2b7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42617
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-05 09:45:44 -08:00
Vic Yang
17dae824d2 spring: Add LP5562 driver
BUG=chrome-os-partner:17341
TEST=Set LED color on Spring board
BRANCH=none

Change-Id: Ibae11a0cf8a724a38e96c5c49952799101bb5764
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41693
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-21 20:25:47 -08:00
Vincent Palatin
c8a61c39ef Add a pass-through for the smart battery
Allow to send commands to the smart battery using EC commands when the
battery is connected to an I2C bus behind the EC.

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

BRANCH=none
BUG=chrome-os-partner:14314
TEST=on Spring, with a kernel including patch to use the pass-through
for the sbs-battery driver, run "power-supply-info" and see the correct
information.

Change-Id: Ie10f1c95afe4a33cf0b55d5a0de7640d5971ebb3
Reviewed-on: https://gerrit.chromium.org/gerrit/41289
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-19 10:59:20 -08:00
Vincent Palatin
b24b745f81 Add a pass-through for TPSchrome LDOs
Allow to send commands to switch on/off the TPSchrome LDOs by using EC commands
when the TPSchrome chip is connected to an I2C bus behind the EC.

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

BRANCH=none
BUG=chrome-os-partner:14314
TEST=on Spring, with an updated bootloader, switch on screen FETs from
U-Boot instead of hardcoding them in the EC board code.

Change-Id: Ic6cebf04ba73a7c0ca2c54f532f8cf4c953ac0c1
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41288
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-01-16 08:35:03 -08:00
Vic Yang
fd29230988 spring: Add a host command for USB mux switching
To make test and bring-up easier, adds a host command for USB mux
switching.

BUG=chrome-os-partner:17111
TEST=manual
BRANCH=none

Change-Id: I9da43fe934881ce24f326275ef312c4e6a474f11
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40586
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-08 09:30:00 -08:00
Vic Yang
40c79398a6 spring: Sense attached device type
This adds USB port control to charger task. For now, it only senses
attached device type and log it to console.

BUG=chrome-os-partner:14319
TEST=Attach/detach charger and see console output.
BRANCH=none

Change-Id: I1218d520c292d9d398c868122ae3876d3fc889bc
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40078
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-08 08:58:36 -08:00
Vic Yang
6eb8a6e999 tps65090: Throttle PMU interrupt instead of charger task
This is a prepartory work for integrating USB port control into PMU
task.

Currently TPS65090 charger task is throttled to only waken by event once
per 500 ms. This in a way makes it hard to integrate other functionality
into this task. This CL moves the throttling mechanism to interrupt
handler so as to provide better control of when to throttle the
interrupt event.

BUG=chrome-os-partner:14319
TEST=Build success and boot on spring.
BRANCH=none

Change-Id: I72e63180442b379a379e1a87c10ef62395434872
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40189
Reviewed-by: Rong Chang <rongchang@chromium.org>
2012-12-28 07:48:24 -08:00
Vic Yang
4d7820f4ad spring: Add interrupt and device type support for TSU6721
This adds functions to control interrupt and get device type from
TSU6721.
Also expose initialization function so that we can initialize TSU6721
before we solve the initialization problem.

BUG=chrome-os-partner:14318
TEST=Build success.
BRANCH=none

Change-Id: Ia50f1c93309360d35902a707090694e94a3f7a74
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40077
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-12-21 08:23:24 -08:00
Vincent Palatin
e927d1506a spring: add basic TSU6721 driver
for now, just control the USB pins muxing.

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

BRANCH=none
BUG=chrome-os-partner:14318
TEST=on Spring, put the EC UART on the micro-B connector and read it
using a modified FTDI cable.

Change-Id: Ib0c87e483fb0bbe1835bd6ea008176b88d6f12f8
Reviewed-on: https://gerrit.chromium.org/gerrit/38361
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-12-13 09:01:09 -08:00
Randall Spangler
ad2adc4022 Invalidate hash if flash operation changes the hashed region
This prevents the EC from returning a stale hash.

BUG=chrome-os-partner:16668
BRANCH=link,snow
TEST=manual, with WP disabled

From EC console
- Boot system and wait a second
- hash --> prints valid hash
- flasherase 0x20000 0x1000
- hash --> invalid
- hash rw
- hash --> prints valid hash
- flashwrite 0x20000 0x1000
- hash --> invalid
- hash rw
- flasherase 0x38000 0x1000
- flashwrite 0x38000 0x1000
- hash --> still valid (since 0x38000 is outside the rw section)

From root shell
- ectool hash --> prints valid hash
- ectool flasherase 0x20000 0x1000
- ectool hash --> invalid
- ectool hash recalc RW
- ectool hash --> prints valid hash
- echo 'Making a hash of this' > /tmp/hashofthis
- ectool flashwrite 0x20000 /tmp/hashofthis
- ectool hash --> invalid
- ectool hash recalc RW
- ectool flasherase 0x38000 0x1000
- ectool flashwrite 0x38000 /tmp/hashofthis
- ectool hash --> still valid (since 0x38000 is outside the rw section)

Change-Id: Id915a504a7bc70b8b8c339b5ce55dc5bad5838fe
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-10 15:14:38 -08:00
Vincent Palatin
3c575ccb02 link: allow to decrease maximum battery charging current
Add an interface to allow the CPU to cap the maximum battery charging
current.
The maximum is removed every time the machine goes to S3 or S5.

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

BRANCH=link
BUG=chrome-os-partner:16041
TEST=on Link, plug AC to charge the battery,
then run "ectool chargecurrentlimit 1200" and see
the charging current in "power-supply-info" decreasing to 1.2 A.

Change-Id: I10900e1c264d2db67809638ec0dcb836d721fa75
Reviewed-on: https://gerrit.chromium.org/gerrit/37532
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-11-07 23:48:04 -08:00
Louis Yung-Chieh Lo
25bbb6b5de More supports for A20 enable/disable
Add i8042 output port commands (0xf0-0xff), I8042_ENABLE_A20 and
I8042_DISABLE_A20.

BUG=chrome-os-partner:13119,
BRANCH=None
TEST=Tested on W7 installer. No KB error shown on EC console.

Change-Id: I9ad1fd7baa10683ef18ccf13faf09dc0cefcca0a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34994
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2012-11-04 20:27:57 -08:00
Randall Spangler
e9e02762dd Move reset/overheat/shutdown funcs to chipset interface
They're not x86-specific, so move to the chipset interface.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=x86reset warm, then x86reset cold.  Should reboot OS in each case.

Change-Id: Ib571ab916bab16179198a0d054320e59afbae124
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36785
2012-11-01 12:45:28 -07:00
Randall Spangler
d83f42bdc8 Switch temp sensor polling to use hooks instead of task
This reduces memory / code size, and gets rid of ifdefs in temp_sensor.c.

BUG=chrome-os-partner:15714
BRANCH=none
TEST=boot system and run 'ectool temps all' every few seconds
    - ectool temps all
The numbers should update over time.

Change-Id: Idaac7e6e4cbc1d6689f5d3b607c623a5cc536a4f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36940
2012-11-01 12:45:22 -07:00
Randall Spangler
e3c5f77924 link: Fix overflow in hibernate time calculation
The time out value passed to task_wait_event() is signed 32-bit and
thus waiting for 24 hours will cause overflow.  Limit max wait time.

BUG=chrome-os-partner:15797
BRANCH=link

TEST=Disconnect AC, shut down system, and close lid.  From ec console,
do 'hibdelay 8000' and then wait 2.5 hours.  EC should have
hibernated.  (8000 is more than twice the max time for
task_wait_event())

Change-Id: I5fa505554182e8bad6399c12a382ff71bb123d8f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37095
Reviewed-by: Vic Yang <victoryang@chromium.org>
2012-11-01 10:08:54 -07:00
Simon Glass
f3c88fa1ab stm32: Implement keyscan test infrastructure
Support the keyscan test functionality on stm32.

Note: This is enabled by default so that it continues to build. But it
is unlikely that we will want this in a shipping image. I suggest we add
the facility for a dev build.

Secondly, the stack has to be larger due to a printf (which admittedly I
could just remove). Should we make the stack size conditional on the
CONFIG? Seems a bit ugly, on the other hand we don't want to waste IRAM.

BUG=chrome-os-partner:12179
BRANCH=none
TEST=manual for now:
On snow:
./ectool keyscan 20000 key_sequence.txt

See that the test passes.

Change-Id: Ic441ca0bde1be9589a924374605e2f146d16f423
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35118
2012-10-31 17:21:00 -07:00
Randall Spangler
433f98c6b6 Add per-second hook
PWM and temp sensor monitoring want to happen every second,
vs. several times a second for watchdog and LPC.

This is still considerably simpler than having tick functions declare
an interval at which they want to be called, which would require a
RAM-based array of pending tick functions and alarm times.  If you
need that level of complexity, you still need a task.

BUG=chrome-os-partner:15714
BRANCH=none

TEST=temporarily add HOOK_TICK and HOOK_SECOND hooks and see that on
LM4, HOOK_TICK is called 4x a second and HOOK_SECOND is called every
second.

Change-Id: I5c09842fd356d3254021486949b2799142068b4f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36938
Commit-Ready: Simon Glass <sjg@chromium.org>
2012-10-30 15:33:25 -07:00
Randall Spangler
8b3a242ff0 Watchdog is reloaded by HOOK_TICK, not its own task
This reduces memory footprint.

BUG=chrome-os-partner:15714
BRANCH=none
TEST=system still boots; 'waitms 1500' prints watchdog error dump

Change-Id: Ieb0248a34655514b03d919cc36c2b369691da716
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36937
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-30 15:33:24 -07:00
Randall Spangler
a21ea56e76 Rename power_button module to switch
Since it handles not just power button, but also lid switch, AC
detect, and other switches.

No functional changes; just renaming.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system, power on/off with power button

Change-Id: I51628a52293f7207715f5f6bf368a08fe6c3dbce
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36821
2012-10-30 14:50:03 -07:00
Randall Spangler
80467aff91 Clean up clock module
No functional changes; just code cleanup.  On LM4 this also #ifdef's
out the 'sleep' and 'pll' commands since they're big and we don't use
them.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system

Change-Id: I1b72d07d6cca2c783d7ac4c880119df3e88e356e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36799
2012-10-30 12:42:47 -07:00
Randall Spangler
ef89439cc0 Clean up GPIO module.
No functional changes, just code cleanup.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=gpioget returns reasonable values

Change-Id: I4301ccc68ade775f78f4ccd84710d2cd4bc25252
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36800
2012-10-30 12:42:46 -07:00
Randall Spangler
e82b68bcb9 Clean up jtag module
No functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system; use gdb to connect to EC

Change-Id: I2817d04e4de102e4201506cfe51cdf0bd939fcdb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36802
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-30 12:42:46 -07:00
Randall Spangler
f76cb374f8 Clean up LPC module
Tidied comments, and removed handling of ACPI events on host command
port (not needed since EVT hardware is now EOL'd).

BUG=chrome-os-partner:15579
BRANCH=none
TEST='ectool hello' succeeds

Change-Id: I063382b9981f713ba23f7714b4ccb7faa957b411
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36804
2012-10-30 12:42:45 -07:00
Randall Spangler
d5ade1b2ed Clean up UART module
And change some direct uart_printf()/uart_puts() output to console
output methods instead.  Disable unused comxtest debug command.  No
other functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system; should still see debug output with reset flags

Change-Id: I57fe6bb781a1ba7884afa6d090b74a92f45a53cc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36835
2012-10-30 12:42:43 -07:00
Randall Spangler
4a0b4262d3 Add tick task
Adds a new HOOK_TICK event which is called every 250ms (LM4) or 500ms
(STM32).  This will be used to consolidate a number of tasks which do
small amounts of work infrequently, and previously needed their own
task functions.

This CL adds the tick task; subsequent CLs will consolidate watchdog
and other tasks into tick hooks.

BUG=chrome-os-partner:15714
BRANCH=none
TEST=taskinfo shows TICK task as lowest priority

Change-Id: I9068ee99d56a5bf5c12afd86ad51998c013f4954
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36908
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-30 12:42:40 -07:00
Randall Spangler
c795ea69ff Clean up power button module
No functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system, power off with power button, power on with power button

Change-Id: I25aa5c527b7b9f9db6f5c539cecb37ac4bc197f8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36820
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-30 12:00:45 -07:00
Randall Spangler
fdd3d90bd7 Clean up ADC module
ADC config structs are now chip-specific; this saves code size
(several hundred bytes on LM4, since no need for 24-entry ADC channel
to GPIO mapping table).

BUG=chrome-os-partner:15579
BRANCH=none
TEST='adc' with system on and off; ChargerCurrent should be bigger when on.

Change-Id: Ia88b3f043438bec049f2d2ad39fc42dcf86d9424
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36798
2012-10-30 10:45:07 -07:00
Randall Spangler
1d916d7c6b Use SECOND and MSEC constants
We'd defined them in a number of different files.  This moves
definitions to timer.h, and uses them everywhere we have large delays
(since 10*SECOND is less typo-prone than 10000000).

Also add msleep() and sleep() inline functions.  No need for mdelay()
or delay(), since any delays that long should use sleep funcs instead
of spin-waiting.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system; taskinfo displays similar numbers to before

Change-Id: I2a92a9f10f46b6b7b6571759b1f8ab4ecfbf8259
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36726
2012-10-29 16:52:49 -07:00
Randall Spangler
67aadcf614 Clean up core routines - cpu, task, watchdog
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system

Change-Id: I55cf9c60e92177fd441614a8f9fce2d3acca3d0e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36706
2012-10-29 12:02:41 -07:00
Randall Spangler
fc6b412589 Consolidate emergency debug output
This removes the duplicate uart_emergency_printf() vs. panic_printf()
/ uart_emergency_puts() vs. panic_puts() implementation and saves
~0.5kb of code size.

The other significant change is that uart_flush_output() is now smart
enough to determine if it's in an interrupt; if so, it will spin-flush
the output buffer instead of waiting on the uart interrupt.  This
removes the need for a separate panic_flush().

BUG=chrome-os-partner:15579
BRANCH=none
TEST=crash unaligned; should print well-formatted crash dump

Change-Id: Ifae756203dd1881806be563308077c1d68302e1f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36695
2012-10-29 10:36:05 -07:00
Randall Spangler
bff5a49e6d Clean up thermal modules
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST='temps' should print good temperatures

Change-Id: I20bd2376b86f1e9d2f9a91016ed90bb933235021
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36611
2012-10-26 13:10:57 -07:00
Randall Spangler
e158bd5422 Clean up a few modules in common/
Just code cleanup; no functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=build link and snow

Change-Id: Ib62f805777994b39cd9f47a721f52529bb9399c5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36573
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-26 09:49:38 -07:00
Randall Spangler
cf7f33d158 Clean up uart buffering code
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=help version -> prints help on version command

Change-Id: I79c4b668513b6037aa6cf3fa1a2a8c0fc9856f41
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36612
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-26 09:49:38 -07:00
Randall Spangler
7cf92c140d Clean up USB charging module
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=plug in USB mouse; is powered when system is on

Change-Id: Icbad3035f384191daa2b6dfae61d78f18ece1d76
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36613
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-26 09:49:37 -07:00
Randall Spangler
2df9ba8814 Clean up pwm module
No functional changes.  But hey, I'm having lots of fun reformatting comments.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=fanset -1; fanset 0; fanset 4000

Change-Id: Iddcea5b8e59fa6668cdd347b6d31155c28991521
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36585
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 17:03:44 -07:00
Randall Spangler
00b344ddbb Clean up vboot hash support
This copies the parts of sha256.c that we need from vboot_reference,
and removes the explicit dependency on vboot_reference.  That
dependency was a good idea when we were doing full verified boot in
the EC, but is now overkill and makes it harder for others to reuse
the EC code.  This also lets us call EC functions directly instead of
needing vboot_stub.cc; that reduces code size by ~100 bytes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=vboot_hash ro, then compare with result of sha256sum build/link/ec.RO.flat

Change-Id: I0f236174291df3e7f3c75e960fe9ab32af305a61
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36589
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 17:03:44 -07:00
Randall Spangler
f48f9a6228 Clean up system module
No functional changes.  (it might look like
SYSTEM_HIB_MINIMUM_DURATION is a change, but it's not used at present)

BUG=chrome-os-partner:15579
BRANCH=none
TEST=version; chip info should print successfully

Change-Id: Idd7f60a29528e9f6af4f91cd5a556e7336acee9f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36599
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 17:03:43 -07:00
Randall Spangler
d4bd167c33 Clean up LED and onewire modules
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=powerled red, then powerled green

Change-Id: I595b725c14d94133f7f151d0b92cabe0e0bcf4ca
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36577
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 14:12:11 -07:00
Randall Spangler
e228692eb2 Clean up printf module
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=boot system; debug output still shows up on EC console

Change-Id: I63f4f9481f5393aaff065b37a274236bd78622d9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36581
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-25 14:12:10 -07:00
Randall Spangler
61b2c4397e Cleanup: flash module
No functional changes; just clean up comments and remove dead code

BUG=chrome-os-partner:15579
BRANCH=none
TEST=code compiles

Change-Id: Id006ae18f2b26cea1720196f696f937811b6ba5b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36448
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-25 11:24:04 -07:00
Randall Spangler
2957c3cf8b Clean up GPIO module
Just code cleanup; no functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=build code; boot link; gpioget still works

Change-Id: If0770c1a5ce0d5c51ba528fbe2944a73fafa949b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36556
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-25 11:24:02 -07:00
Randall Spangler
dc53e4db7f Clean up console module
Code cleanup and reformatting.  No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=compile code; type a debug command like 'help list'.

Change-Id: I641215ba3333628f658eec86d9d99718c43b111f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36387
2012-10-24 12:55:46 -07:00
Randall Spangler
935824d617 Cleanup: battery
Tidy code.  No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=discharge battery, then plug AC in and make sure it charges

Change-Id: I4cff018940ecb665be96655d6722f74dd6674f6d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36359
2012-10-24 10:09:20 -07:00
Randall Spangler
cc263093d3 Clean up keyboard_scan module
We only have one scan mask and no capability to change scan masks, so
don't reserve space for masks we're not using.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=type on keyboard; should still work

Change-Id: I8ad0c5c894f93c2a79ca646e7666b3279c90a63c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36347
2012-10-23 17:32:02 -07:00
Randall Spangler
090e4f5f8e Clean up i8042 module
Remove unused code paths.  Simplify interfaces.  Clarify comments.
Split the protocol constants into their own header file (since they're
used only by keyboard.c, not i8042.c, which is really keyboard
buffering... and will be renamed so in a followup CL.)

This cleanup reduces binary size by about 200 bytes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=type on the keyboard; it should still work.

Change-Id: I6acbab5fe5604b4b0c516ba3622e6f41820985d1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36271
2012-10-23 17:32:01 -07:00
Randall Spangler
e72788ef96 Hook functions no longer return values
Previously, all hook functions returned EC_SUCCESS, which was
meaningless because nothing ever looked at the return value.  Changing
the return value to void saves ~100 bytes of code size and an equal
amount of source code size.

BUG=none
BRANCH=none
TEST=code still builds; link still boots

Change-Id: I2a636339894e5a804831244967a9c9d134df7d13
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36372
2012-10-23 16:49:29 -07:00