Commit Graph

279 Commits

Author SHA1 Message Date
Gerrit
acfbecebe4 Merge "Add battery charge state machine and task" 2012-03-02 22:43:09 -08:00
Rong Chang
fe1f1c2d21 Add %b format output via uart_printf
Useful when debug dump binary flags.

BUG=chrome-os-partner:8287
TEST=none

Change-Id: I646d80befafca07074847f2f09eeb23126533f67
2012-03-03 14:11:35 +08:00
Rong Chang
1c70e29165 Add battery charge state machine and task
This CL adds a charge state machine for SMB compliant battery pack.
Vendor specific charge constraints can be applied through function
call, defined in battery_pack.h .

BUG=chrome-os-partner:7526
TEST=Attach EC serial console
  Unplug AC adapter: state ==> "discharge"
  Plug AC adapter:   state ==> "charge"
  Battery full:      state ==> "idle"
  Unplug battery:    state ==> "error"

Change-Id: Iabff0988a6067d37c17c11b060bbb7e66505c118
2012-03-03 14:01:52 +08:00
Vincent Palatin
5877a40923 fix version generation script
Fix the quoting for git local change detection.

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

BUG=None
TEST=run ./util/getversion.sh on a repository with and without local
changes and observe we no longer have a spurious output on stderr.

Change-Id: I40ea4505d175c9135027ba7cf2b787c08eff6f70
2012-03-02 22:37:36 +00:00
Randall Spangler
29e494d54c Refactor ectool command handling
The list of if()'s was getting long and obnoxious.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=run a few ectool commands and see that they still work

Change-Id: Ie292b50a27e98ca2c48f13e1141faf273efdd94b
2012-03-02 12:26:26 -08:00
Gerrit
98b19f00b6 Merge "Fix a bug causing ectool to return error return code." 2012-03-02 10:56:25 -08:00
Vic Yang
26ab6057d2 Fix a bug causing ectool to return error return code.
'ectool temps 0' always have non-zero return code.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8294
TEST="ectool temps 0 && echo 'test'" gives 'test' on screen.

Change-Id: I3a4eff513638c25ec68e24968ce9d1022b4c1281
2012-03-02 10:09:56 -08:00
Vincent Palatin
a94e3277b3 update versioning information stored in the EC
Add build information (date/time/builder) which can be displayed at the
EC console.

Generate a version from the board name and the branch tag.

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

BUG=chromium-os:27013
TEST=on BDS, run version command on the console.
inspect the built binary.

Change-Id: Idb1f68898ba6b811d02919f17ab4536ed9f8934a
2012-03-02 16:46:26 +00:00
Vic Yang
1db93690d9 Report error when PECI temperature read fails.
We used to have flaky PECI temperature read so we ignored failure. Now
the PECI temperature read seems to work fine so we should have it report
error on failure.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7493
TEST=When powered off, 'temps' shows error on PECI temperature reading.

Change-Id: I161a8f84f66ba06959c21838ee364b2f8d8b4945
2012-03-01 16:19:54 -08:00
Gerrit
1776aef9f5 Merge "Refactor LPC status / result codes" 2012-03-01 16:18:36 -08:00
Gerrit
72d8d99c95 Merge "Make TMP006 polling check for power first." 2012-03-01 16:18:35 -08:00
Randall Spangler
9a60f37c8d Refactor LPC status / result codes
This is necessary to support SCI/SMI events.

Note that this breaks compatibility with previous ectool builds - and
probably also breaks flashrom support.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8253
TEST='ectool hello' and 'ectool flashinfo' still work
and 'ectool usbchargemode 3 1' fails with error 2

Change-Id: If39e5b6e7cdcec1b5ec765594e8492925b430b10
2012-03-01 15:22:14 -08:00
Vic Yang
feb5a62d79 Make TMP006 polling check for power first.
Currently if ENABLE_VS is off, each time we poll TMP006 sensors, it
takes 1 second for each sensor to return ERROR. Checking for power
before polling help to reduce the time spent on temperature polling.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8275
TEST=Manual test

Change-Id: I2da83f09cccc331074f9bb5483b2ba92c0865742
2012-03-01 13:30:08 -08:00
Vic Yang
5cd0f292e9 Console command for thermal engine fan control.
Add console command 'autofan' to turn on automatic fan speed control.
Also modify 'fanset' to disable automatic control before setting fan
speed.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8250
TEST=Manual test

Change-Id: I2db85ce2e754bba21567b2c92e4476049d517627
2012-02-29 16:26:26 -08:00
Gerrit
42a9405d11 Merge "stm32l: fix new line output on the UART" 2012-02-29 15:26:25 -08:00
Gerrit
aacc1e6b5f Merge "Thermal Engine: LPC commands." 2012-02-29 15:26:25 -08:00
Gerrit
c09f6817b1 Merge "Fix a bug causing TMP006 debug message truncated." 2012-02-29 15:02:25 -08:00
Vic Yang
747b1f7520 Thermal Engine: LPC commands.
Implement LPC commands and ectool commands to
  1. Set/get threshold temperature values.
  2. Toggle on/off automatic fan speed control.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8251
TEST=Manual test

Change-Id: Ia4282a6fa47a838aed26540f33c1eb7acc92ef0e
2012-02-29 14:42:45 -08:00
Vic Yang
52ac826a2b Fix a bug causing TMP006 debug message truncated.
The debug message is larger than UART transmit buffer so we have to
flush the output manually.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8265
TEST='tmp006' shows debug message of all TMP006 sensors.

Change-Id: I81793504e1a345b172567d3e877ee8740b85640c
2012-02-29 13:46:57 -08:00
Vincent Palatin
9ecf232dbd stm32l: fix new line output on the UART
On the STM32L UART without a FIFO, the Transmit Register might need
some time before pushing its content to the shift register.

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

BUG=None
TEST=on ADV board, verify we are no longer missing most of the carriage
return on console.

Change-Id: Ic638dc452d6e30a5f127710fc964143d477fa1d6
2012-02-29 21:28:27 +00:00
Vincent Palatin
e3fbea00b7 uart: fix race condition in flow control
The previous TX might end in the middle of the buffer filling and stop
TX. So we need to check if we want to restart the transmission.

With 1-byte deep FIFO, it's easy to trigger that race condition.

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

BUG=None
TEST=run console commands with lots of traces on BDS, Link and ADV and check
we are not stuck.

Change-Id: Ia57e974a3a51af694e736d4cf36d9d01eafd2251
2012-02-29 20:33:10 +00:00
Vic Yang
d1e627926f Fix a bug causing console history to miss a character.
If the last command is saved at the beginning of the buffer, loading
this command will lead to a character missing.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8261
TEST=Manual

Change-Id: I0afd4a264f342137955075fe2950444691f79d35
2012-02-29 11:13:27 -08:00
Vic Yang
13b5c41951 Thermal Engine
The thermal engine monitors the temperature readings from all sensors.
For each sensor, five threshold temperatures can be set:
    1. Low fan speed.
    2. High fan speed.
    3. SMI warning.
    4. Shutdown CPU.
    5. Shutdown everything we can.
Each of these thresholds can be set to either a fixed value or disabled.
Currently the real implementation of SMI warning and shutting down is
left as TODO, as indicated in the comment.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8250
TEST=Manually change threshold value to test all actions can be triggered.

Change-Id: If168dcff78ef2d7a3203cb227e1739a08eca961e
2012-02-28 16:51:54 -08:00
Randall Spangler
b2b5455f32 Fix version command crashing if no image B
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8253
TEST=manual

Change-Id: Ie14465283c09029c3d2fa9a32296f32ce7304760
2012-02-28 14:29:52 -08:00
Randall Spangler
4c89ccd89e Register host commands the same clever way we do console commands
BUG=none
TEST=run assorted ectool commands

Change-Id: I830d3cbf2d1557b3ab455ec8736d3de5e5d3e697
2012-02-28 13:58:34 -08:00
Gerrit
e632029ed0 Merge "Add persistent host storage in EC EEPROM" 2012-02-28 13:34:37 -08:00
Randall Spangler
e84fc7b110 Add persistent host storage in EC EEPROM
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8247
TEST=manual

from root shell on host:
  ectool pstoreinfo   --> should print PstoreSize 1024 AccessSize 4
  echo testing 1 2 3 4 > /tmp/infile
  ectool pstorewrite 8 /tmp/infile
  ectool pstoreread 8 /tmp/outfile
  diff /tmp/infile /tmp/outfile

Change-Id: I565e580307584f7def36c5e53d360c1a897d67d2
2012-02-28 13:02:17 -08:00
Gerrit
7e40bacb1b Merge "Remove unused temperature command" 2012-02-28 11:48:18 -08:00
Vic Yang
c55b1527ae Remove unused temperature command
'tempremote' is a debug command used to assess temperature calculation of
TMP006 sensor. Remove it since we have finished TMP006 module.

Also add back the fixed-point algorithm that is lost in rebasing earlier.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7801
TEST=none

Change-Id: Ic3555c1a04d2c0483075262e3ab53842f7bd43d8
2012-02-28 10:52:32 -08:00
Gerrit
2a469c61cf Merge "Make all warnings into errors." 2012-02-28 10:08:56 -08:00
Gerrit
b4edad6922 Merge "Add APIs for thermal module to tell x86_power about overheating" 2012-02-27 18:42:52 -08:00
Gerrit
12676f45fc Merge "Have TMP006 sensor report -1 on sensor failure." 2012-02-27 18:42:51 -08:00
Randall Spangler
a395a7272d Add APIs for thermal module to tell x86_power about overheating
(implementation of APIs still todo)

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8242
TEST=none

Change-Id: Idbd38c4e873e95382ae815e1d5b827d95396be8f
2012-02-27 16:58:43 -08:00
Bill Richardson
ae8dd20d77 Make all warnings into errors.
Also fix a couple places where that makes it fail.

BUG=none
TEST=none

Change-Id: I3b434b4bfa547a579193aac67c1a9d440a2c4e51
2012-02-27 15:54:00 -08:00
Gerrit
2d94379984 Merge "EC_LPC_COMMAND_PWM_GET_FAN_RPM return target RPM" 2012-02-27 15:50:44 -08:00
Gerrit
02c8aa7898 Merge "Remove EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS" 2012-02-27 15:28:11 -08:00
Vic Yang
44140b3c57 EC_LPC_COMMAND_PWM_GET_FAN_RPM return target RPM
Actual RPM is now read from LPC mapped space. Modify this command to
return target RPM so we can verify EC receives target RPM.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8238
TEST=Get the same value after setting target RPM.

Change-Id: I9bcc9edd327cec1311b51fd0fcbc4a43b353daff
2012-02-27 15:11:42 -08:00
Vic Yang
1570eafad0 Have TMP006 sensor report -1 on sensor failure.
Temperature reading should be -1 on sensor failure.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8241
TEST="gpioset enable_vs 0" and "temps" gives "Error"
"gpioset enable_vs 1" and "temps" gives correct reading.

Change-Id: Ide82bd3433d3de12a749b0ee85f1ae1c6b12c5e5
2012-02-27 15:09:11 -08:00
Vic Yang
b9999a2c6c Remove EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS
We now read temp sensor readings using the EC mapped space.
So we don't need this command.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8239
TEST="ectool temps 0" works.

Change-Id: I47f425e45cea992b19734f39ac6d9f6db6433d39
2012-02-27 14:18:25 -08:00
Vic Yang
f40df60a9a Write current fan speed to LPC mapped value space.
Add a task to update fan speed in LPC mapped memory once per second.
Also added read_mapped_mem16 and read_mapped_mem32.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8183
TEST="ectool pwmgetfanrpm" shows same result as "faninfo" from ec
console.

Change-Id: Ibc536acd39f836ffcad0bfa7c9c14e730220bd49
2012-02-27 13:18:32 -08:00
Gerrit
944d76558b Merge "Disable fan PWM when +5VS is disabled" 2012-02-27 13:07:04 -08:00
Gerrit
2cb41491e7 Merge "Only deassert RCINn in S0" 2012-02-27 13:07:04 -08:00
Gerrit
59368ee2df Merge "x86power module is not present on bds board" 2012-02-27 13:07:03 -08:00
Randall Spangler
28b89fdf94 Disable fan PWM when +5VS is disabled
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8097
TEST=manual

faninfo
  should report fan is disabled
powerbtn
  system turns on, fan turns on
faninfo
  should report fan is enabled
powerbtn
  system turns off, fan turns off
faninfo
  should report fan is disabled again

Change-Id: I1be67004edb23ccd18ad434c9340bfbecc22e7c4
2012-02-27 12:32:20 -08:00
Randall Spangler
0592fe594a Only deassert RCINn in S0
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8231
TEST=manual:

gpioget PCH_RCINn --> should return 0
powerbtn --> should turn system on
gpioget PCH_RCINn --> should return 1

Change-Id: I6801bc2e5801ecac53a50b99cf802c00295faf0b
2012-02-27 12:29:05 -08:00
Randall Spangler
1f786bc348 x86power module is not present on bds board
On bds, always send the keyboard scan code for the power button.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=none

Change-Id: I56ad8c9dd67edfd54190d64f16742896a86b9ac1
2012-02-27 12:24:44 -08:00
Vincent Palatin
dbe80e987e Use arm-none-eabi toolchain as default for local build
Now, the arm-none-eabi toolchain is available is all chroot,
so ensure that the developers doing a local build using directly the
Makefile pick by default the same toolchain as the one used by the
automated build.

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

BUG=None
TEST=make BOARD=bds && make BOARD=link && make BOARD=adv

Change-Id: Ib9568cabed3ca77cfa5ebc60479025cbb330b024
2012-02-27 20:07:06 +00:00
Dave Tu
c5b323f995 Merge "Revert "Only deassert RCINn in S0"" 2012-02-27 11:41:32 -08:00
Dave Tu
80c2f0ff66 Revert "Disable fan PWM when +5VS is disabled"
This is causing a merge conflict on https://gerrit.chromium.org/gerrit/#change,16827.

This reverts commit 3a460ea765
2012-02-27 11:41:04 -08:00
Dave Tu
8e6d7f5fef Revert "Only deassert RCINn in S0"
This change broke the tree.

This reverts commit 1d1a38a6cc
2012-02-27 11:32:18 -08:00