Commit Graph

739 Commits

Author SHA1 Message Date
ChromeOS Developer
4015172ed1 8042: Add interface for handling off-matrix button changes
BUG=chrome-os-partner:24370
BRANCH=tot
TEST=Power key and keyboard work normally.

Signed-off-by: Dave Parker <dparker@chromium.org>
Orig-Change-Id: I291ff384ae2fc3e074132330713f0b0c2cc36a76
Reviewed-on: https://chromium-review.googlesource.com/184543
(cherry picked from commit c65f82a5b02cdecf5b62f71ef2e916795f808389)

Change-Id: I1cd02e824c97eb5909e7bff68c8ecefc89f52df0
Reviewed-on: https://chromium-review.googlesource.com/185242
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
2014-02-07 04:13:14 +00:00
ChromeOS Developer
c35251d662 Add configs for battery detect via gpio or custom function
BUG=chrome-os-partner:24649
BRANCH=baytrail
TEST=Boot target device w/o battery. There should be no 30 second
delay prior to boot.

Change-Id: If7a60919701d1c241670d0b32e04f3e188a643f1
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182921
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-06 01:22:17 +00:00
ChromeOS Developer
6fe3172ac0 Config option for using power button with lid closed
BUG=chrome-os-partner:24912
BRANCH=baytrail
TEST=Manual. Enable CONFIG_POWER_BUTTON_IGNORE_LID
on a device, boot it, and go into dock mode with
external monitor attached. Fake-close the lid with a
magnet or servo. Verify the power button still sends
press/release events to the host with evtest.

Change-Id: Idb05375eee0743a8a2c459070854c03fe3afe894
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/184493
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-01 02:48:01 +00:00
Randall Spangler
cf43a3b7be rambi: Enable low-power idle
This should reduce EC power consumption in S3 and S5.

BUG=chrome-os-partner:25377
BRANCH=baytrail
TEST=make sure jtag is not active (not running openocd via servo)
     boot system; suspend system
     wait 60 seconds; should see "Disabling console in deep sleep"
     type on console; should still allow typing
     wait 60 seconds; press spacebar; should still resume from suspend

Change-Id: I47e33e158c1b90077f944a6af4374f39efa68d94
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/184165
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-01-29 00:49:15 +00:00
Randall Spangler
75857e80d0 rambi: Leave 5V rail on in S3 if USB ports are powered
Previously, the 5V rail was disabled unconditionally in the S0->S3
transition.  Now, the rail is left powered if one or both of the USB
ports are powered.

BUG=chrome-os-partner:25178
BRANCH=rambi
TEST=Modify the OS to leave USB ports powered in S3.  Then suspend.  On
     the EC console, 'gpioget pp5000_en' should be 1.

Change-Id: I3c73f3fe228e940317c0da7330f117c7ab0a6d0c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183548
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-23 19:32:27 +00:00
Vic (Chun-Ju) Yang
7c686dd68b emulator: Move trace dump to a separate module
The implementation of trace dump has little to do with task scheduling,
so we should move it to a separate module for cleaner code. This
requires exposing some emulator-specific task info, as defined in
host_task.h.

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

Change-Id: Iba9bc0794a4e1dd4ddb92b98345162b398fa6a8d
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183238
2014-01-22 04:52:49 +00:00
Yung-Chieh Lo
8d3136f6b7 x86 & tegra: add CONFIG_POWER_COMMON.
For the better naming for power/common.h, we rename CONFIG_CHIPSET_X86
to CONFIG_POWER_COMMON (no one is actually using it). But keep
CONFIG_CHIPSER_TEGRA for power/build.mk.

BUG=chrome-os-partner:25068
BRANCH=nyan,falco,link,peppy,rambi,samus,squawks
TEST=build only

Change-Id: Ibf1a4c24088dfddac39b38a95b3b887c195152d5
Signed-off-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182732
2014-01-21 01:13:15 +00:00
Duncan Laurie
064624cc2d baytrail: Add config option to enable WiFi in suspend
Some WiFi devices do not tolerate losing power in suspend
and will not function properly after resume if they have
lost power.

Enable this on the Rambi device.

BUG=chrome-os-partner:24114
BRANCH=baytrail
TEST=complete mutiple successful suspend/resume cycles on rambi
and ensure that wifi continues to function and not cause a crash.

Change-Id: Id421f3138e429b247bfb3f5ffb92a06c0353bb97
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183047
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-17 23:59:46 +00:00
Louis Yung-Chieh Lo
2c0292958f tegra: refactor the power state machine.
Integrate with power/common.c -- a real state machine now. Also remove
duplicate and unused functions/consts.

BUG=chrome-os-partner:24831
BRANCH=nyan
TEST=on nyan rev 3.12.
re-plug AC: PASS, power on 2
reboot: PASS, power on 2
power off (S5), power on: PASS, power off 4, power on 5
power off (G3), power on: PASS, power off 4, power on 5
lid close / power off (S5)/ lid open: PASS, power on 3
lid close / power off (G3)/ lid open: PASS, power on 3
press power button and release: nothing happens after 15s.
button off (S5)/ on: PASS, power off 3, power on 4
button off (G3)/ on: PASS, power off 3, power on 4
power off (S5)/ button on: PASS, power off 4, power on 4
power off (G3)/ button on: PASS, power off 4, power on 4
button off (S5)/ power on: PASS, power off 3, power on 5
button off (G3)/ power on: PASS, power off 3, power on 4
button off (S5)/ lid open: PASS, power off 3, power on 3
button off (G3)/ lid open: PASS, power off 3, power on 3
is off, long press button (60s): power on 4, too long, shutdown, stay off
is on, long press button (60s): power off 3, stay off
apreset cold: entered to S5, power off 3, power on 5
apreset warm: power state is not changed, but reboots to BIOS.

Change-Id: Ie12fa4f79b6156f71f89155b2b01880914809c75
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182348
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-17 18:17:09 +00:00
Justin Chuang
fc91a7f7fd Support discharge on BQ24715 for Rambi and Squawks
BUG=chrome-os-partner:25031
BRANCH=rambi
TEST=Manually
  make BOARD=peppy
  make BOARD=falco
  make BOARD=rambi
  make BOARD=squawks
  On rambi and squawks, connect charger
     ectool chargecontrol discharge
     ectool i2cread 16 0 0x16 0x0a
     It should return 16-bit negative integer.

Change-Id: I8a8dfa90d2ad82595ac7a420c3c8ffc13b12cde6
Signed-off-by: Justin Chuang <jchuang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182586
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-01-16 06:43:05 +00:00
Alec Berg
5edde63ac2 ite: Watchdog module added
Watchdog module added. Off by default because of following limitations:
- When programming, the WD fires, and programming fails. For now, you
have to program twice.

BRANCH=none
BUG=chrome-os-partner:23575
TEST=Manually wrote in a while(1); and made sure watchdog warning
triggers first, prints IPC register, and then soon after the watchdog
timer resets the chip.

Signed-off-by: Alec Berg <alecaberg@chromium.org>
Change-Id: Ia83f58f3ae108f755d2f139ada22a22e2fbdc2fa
Reviewed-on: https://chromium-review.googlesource.com/177397
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-01-15 04:52:40 +00:00
Louis Yung-Chieh Lo
d32c19729e clean-up: change __CROS_EC_POWER_COMMON_H define.
To __CROS_EC_POWER_H which should be done in CL 9867f83.

BUG=None
BRANCH=nyan
TEST=build only

Change-Id: Ic3c1011e127c035c681aeb0ee2023046595b926b
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182102
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-11 01:37:03 +00:00
Randall Spangler
72481572aa Convert vboot hash calculation from task to deferred function
Vboot hash calculation takes ~350 ms during EC boot.  Since the hash
task is higher priority than the hook task, this starves all the hooks
during boot.

We could, in theory, fix that simply by swapping the priority of the
hook and hash tasks.  But then watchdog detection (in the hook task)
wouldn't detect hangs in the hash task.

A better fix (implemented here) is to convert the hashing operation to
a series of deferred function calls.  This gets rid of the hash task
entirely, and allows all pending hooks and other deferred function
calls to take place between each chunk of hashing.

On STM32-based boards, we need to bump up the hook task stack size,
since hashing is called from several layers deep in the hook task
instead of at the top of its own task, but this is still a net win of
several hundred bytes of SRAM.

BUG=chrome-os-partner:24892
BRANCH=rambi
TEST=Boot EC; look for "hash start" and "hash done" debug output.
     'taskinfo' shows at least 32 bytes of unused stack for HOOKS task.
     'hash ro' runs properly from EC console.

Change-Id: I9e580dc10fc0bc8e44896d84451218ef67578bbe
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181954
2014-01-09 20:25:11 +00:00
Louis Yung-Chieh Lo
9867f8379a x86: generalize power state machine for all platforms (2/2)
Rename x86_* to power_signal_* and X86_* to POWER_*.

BUG=chrome-os-partner:24832
BRANCH=link,falco,samus,rambi,peppy,squawks,snow,spring,nyan
TEST=make -j buildall run_tests

Change-Id: Ifaa06391da5a483851ff56eca91fbf6d038dff0a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181719
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-09 05:30:49 +00:00
Vic (Chun-Ju) Yang
61d2652ca4 Dump stack trace on emulator test failure
Emulator test failures are sometimes hard to debug, especially when the
test is stuck somewhere and times out. Let's have the emulator dump
stack trace when an assertion fails or a test times out.

The produced stack trace is in this format:
  #0  build/host/kb_8042/kb_8042.exe() [0x412421]
      /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:104
  #1  build/host/kb_8042/kb_8042.exe() [0x4124a9]
      /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:129
  #2  build/host/kb_8042/kb_8042.exe(run_test+0x3a) [0x412e2c]
      /home/victoryang/trunk/src/platform/ec/test/kb_8042.c:262
  #3  build/host/kb_8042/kb_8042.exe(_run_test+0x11) [0x4061de]
      /home/victoryang/trunk/src/platform/ec/core/host/task.c:90
  #4  build/host/kb_8042/kb_8042.exe(_task_start_impl+0x79) [0x406b72]
      /home/victoryang/trunk/src/platform/ec/core/host/task.c:408
  #5  /lib64/libpthread.so.0(+0x70b1) [0x7f6dc2fa10b1]
      ??:0
  #6  /lib64/libc.so.6(clone+0x6d) [0x7f6dc2cd8efd]
      ??:0
The file name and line number in the trace is generated by addr2line.

BUG=chrome-os-partner:19235 chromium:331548
TEST=Put in a infinite loop in a test, and see stack trace when it times
out.
TEST=Add a failing assertion, and see stack trace when it fails.
BRANCH=None

Change-Id: I4494ffd1ebc98081ce40e860a146202084aa2a1e
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181730
2014-01-08 16:39:24 +00:00
Louis Yung-Chieh Lo
5a4b239981 rename power_state* to charge_state*
Those are actually charge state, not power state. Rename the misleading
names.

BUG=chrome-os-partner:24832
BRANCH=link,falco,samus,rambi,peppy,spring,pit,snow
TEST=build only because no name conflicts.
make clean BOARD=link && make -j32 BOARD=link && \
make clean BOARD=falco && make -j 32 BOARD=falco && \
make clean BOARD=samus && make -j 32 BOARD=samus && \
make clean BOARD=rambi && make -j 32 BOARD=rambi && \
make clean BOARD=peppy && make -j 32 BOARD=peppy && \
make clean BOARD=snow && make -j 32 BOARD=snow && \
make clean BOARD=spring && make -j 32 BOARD=spring && \
make clean BOARD=pit && make -j 32 BOARD=pit && \
make clean BOARD=nyan && make -j 32 BOARD=nyan && \
make runtests -j 32 && make tests -j 32 BOARD=link && \
make tests -j 32 BOARD=falco && make tests -j 32 BOARD=samus && \
make tests -j 32 BOARD=rambi && make tests -j 32 BOARD=peppy && \
make tests -j 32 BOARD=snow && make tests -j 32 BOARD=spring && \
make tests -j 32 BOARD=pit && make tests -j 32 BOARD=nyan

Change-Id: Ie15052d5a7dbd97d519303d37260945346a27779
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181505
Reviewed-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-07 04:53:20 +00:00
Louis Yung-Chieh Lo
4e27a42ff9 x86: generalize power state machine for all platforms (1/2)
Renaming file names is the first step. Please see issue tracker
for more details.

BUG=chrome-os-partner:24832
BRANCH=link,falco,samus,rambi,peppy
TEST=build all x86 boards.
make clean BOARD=link && make -j32 BOARD=link && \
make clean BOARD=falco && make -j32 BOARD=falco && \
make clean BOARD=samus && make -j32 BOARD=samus && \
make clean BOARD=rambi && make -j32 BOARD=rambi && \
make clean BOARD=peppy && make -j32 BOARD=peppy

Change-Id: I3a296a0c14f6bebefa858438b1320061ac71dd38
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181400
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-01-07 04:53:06 +00:00
Randall Spangler
07fa71e7cc rambi: Add config option for simplified USB power control
It will be used by all variants of Rambi, so #ifdef BOARD_RAMBI is too
restrictive.

BUG=chrome-os-partner:24864
BRANCH=rambi
TEST=boot rambi 1.5 board; plug in USB mouse

Change-Id: I0ff02077388a6c6621c5746a693dde894cf8ad77
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181682
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-01-07 02:52:59 +00:00
Vic Yang
cdcaf6ed8a Add interrupt support for emulator
This provides us a way to inject interrupts during a test. If a test has
interrupt_generator() defined, it will run in a separate thread. The
generator can then trigger interrupts when it decides to. The current
running task is suspended while emulator is executing ISR.

Also fixes a bug that tasks run without scheduler notifying them during
emulator start-up.

BUG=chrome-os-partner:19235
TEST=Repeatedly run all tests.
BRANCH=None

Change-Id: I0f921c47c0f848a9626da6272d9040e2b7c5ac86
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/55671
2014-01-06 12:40:45 +00:00
Vic (Chun-Ju) Yang
4e7e33f6e7 Move pseudo random number generator to common
We have three copies of the same pseudo random number generator in our
test codes. Let's consolidate them into a single copy in test_util.

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

Change-Id: I7ea0b3476f3cfe6944855f19861e3c86af35807e
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/181085
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-27 07:50:47 +00:00
Randall Spangler
6ab8e91658 cleanup: Remove checkpatch warnings
This make minor syntactic changes and renames some camel-cased symbols
to keep checkpatch from complaining.  The goal is to reduce the
temptation to use 'repo upload --no-verify'.

This is a big furball of find/replace, but no functional changes.

BUG=chromium:322144
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180495
2013-12-19 00:12:28 +00:00
Randall Spangler
616e70998d Add AP hang detection
BUG=chrome-os-partner:24558
BRANCH=none
TEST=see procedure in bug

Change-Id: I42614a1da5f24c93b6267d81339ff9d721bf0d8f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180080
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-12-17 21:27:53 +00:00
Bill Richardson
700adf4dea Let AP read sensor IDs when DPTF thermal thresholds crossed
The spec does not mandate any way to read back the threshold settings
themselves, but when a threshold is crossed the AP needs a way to determine
which sensor(s) are responsible. Each reading of the EC_ACPI_MEM_TEMP_ID
register clears and returns one sensor ID that has crossed one of its
thresholds (in either direction) since the last read. A value of 0xFF means
"no new thresholds have tripped". Changing or enabling the thresholds for
any sensor will clear the unread event count for that sensor.

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

On the host, set a couple of thresholds to low values so they trip
immediately (I'm testing on Link):

  # dptf() {
         [ "$#" -eq "2" ] || return;
         iotools io_write8 0x66 0x81
         iotools io_write8 0x62 $1
         iotools io_write8 0x62 $2
  }
  #

  # dptf 5 0
  # dptf 6 10
  # dptf 7 3

  # dptf 5 2
  # dptf 6 10
  # dptf 7 2

On the EC console, see that two thresholds have triggered, and that there
are two bits set in the AP seen mask:

  [45.755365 DPTF sensor 0, threshold -63 C, index 1, enabled]
  [45.768940 DPTF sensor 2, threshold -63 C, index 0, enabled]
  [46.169490 DPTF over threshold [0][1]
  [46.169820 DPTF over threshold [2][0]
  > dptftemp
  sensor   thresh0   thresh1
    0       ---        210*    I2C-USB C-Die
    1       ---        ---     I2C-USB C-Object
    2       210*       ---     I2C-PCH D-Die
    3       ---        ---     I2C-PCH D-Object
    4       ---        ---     I2C-Hinge C-Die
    5       ---        ---     I2C-Hinge C-Object
    6       ---        ---     I2C-Charger D-Die
    7       ---        ---     I2C-Charger D-Object
    8       ---        ---     ECInternal
    9       ---        ---     PECI
  AP seen mask: 0x00000005
  >

Read the EC_ACPI_MEM_TEMP_ID register from the host, to get the two active
sensor IDs (0 and 2), then 0xff when those are seen.

  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 5; iotools io_read8 0x62
  0x00
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 5; iotools io_read8 0x62
  0x02
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 5; iotools io_read8 0x62
  0xff
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 5; iotools io_read8 0x62
  0xff
  #

Change-Id: I8f047a517357617f18ad59d21fa13409bc81821b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180224
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-16 22:57:54 +00:00
Bill Richardson
cddf8a545c Implement DPTF thermal thresholds
Any of the EC's temp sensors can have up to two independent thresholds
attached to them. When the temperature crosses the threshold (rising or
falling), a EC_HOST_EVENT_THERMAL_THRESHOLD event is sent to the AP. It's up
to the AP to read the sensor values and figure out why the event was sent.

The thresholds are set and enabled with ACPI writes to three registers in
the EC interface space: EC_ACPI_MEM_TEMP_ID, EC_ACPI_MEM_TEMP_THRESHOLD, and
EC_ACPI_MEM_TEMP_COMMIT. Refer to the comments in ec_commands.h for details
on their use.

ACPI does not provide any means to read the threshold settings (the AP will
just have to remember), but there is an EC console command "dptftemp", that
can be used to examine the current settings.

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

On the EC console, check the current threshold settings and temperatures:

> dptftemp
sensor   thresh0   thresh1
  0       ---        ---     PECI
  1       ---        ---     ECInternal
  2       ---        ---     I2C-Charger-Die
  3       ---        ---     I2C-Charger-Object
  4       ---        ---     I2C-CPU-Die
  5       ---        ---     I2C-CPU-Object
  6       ---        ---     I2C-Left C-Die
  7       ---        ---     I2C-Left C-Object
  8       ---        ---     I2C-Right C-Die
  9       ---        ---     I2C-Right C-Object
 10       ---        ---     I2C-Right D-Die
 11       ---        ---     I2C-Right D-Object
 12       ---        ---     I2C-Left D-Die
 13       ---        ---     I2C-Left D-Object
>
> temps
  PECI                : 318 K = 45 C
  ECInternal          : 306 K = 33 C
  I2C-Charger-Die     : 309 K = 36 C
  I2C-Charger-Object  : Not calibrated
  I2C-CPU-Die         : 309 K = 36 C
  I2C-CPU-Object      : Not calibrated
  I2C-Left C-Die      : 306 K = 33 C
  I2C-Left C-Object   : Not calibrated
  I2C-Right C-Die     : 307 K = 34 C
  I2C-Right C-Object  : Not calibrated
  I2C-Right D-Die     : 307 K = 34 C
  I2C-Right D-Object  : Not calibrated
  I2C-Left D-Die      : 306 K = 33 C
  I2C-Left D-Object   : Not calibrated
>

In this case, the PECI temp is 318 K, so let's set a threshold at 322 K. On
the AP:

       [ "$#" -eq "2" ] || return;
       iotools io_write8 0x66 0x81
       iotools io_write8 0x62 $1
       iotools io_write8 0x62 $2
}

Back on the EC console, we see that the threshold has been set:

  [768.176648 DPTF sensor 0, threshold 49 C, index 1, enabled]
  > dptftemp
  sensor   thresh0   thresh1
    0       ---        322     PECI
    1       ---        ---     ECInternal
    2       ---        ---     I2C-Charger-Die
  ...

Now do something on the AP to increase the temperature (webgl aquarium,
etc). When the temp goes above 322 K, the EC console reports it and sends a
host event, and the "dptftemp" command indicates the over-temp condition:

  [815.367442 DPTF over threshold [0][1]
  [815.367878 event set 0x00000100]
  [815.368069 sci 0x00000100]
  [815.368619 event clear 0x00000100]
  > dptftemp
  sensor   thresh0   thresh1
    0       ---        322*    PECI
    1       ---        ---     ECInternal
    2       ---        ---     I2C-Charger-Die
  ...

Log out and wait for the temp to drop. You'll see that trigger a host event
as well:

  [854.375713 DPTF under threshold [0][1]
  [854.376147 event set 0x00000100]
  [[854.376396 event clear 0x00000100]
  > dptftemp
  sensor   thresh0   thresh1
    0       ---        322     PECI
    1       ---        ---     ECInternal
    2       ---        ---     I2C-Charger-Die
  ...

Change-Id: I6bb34c615f37477ccf37163caaa94737baed8dae
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179962
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-13 20:19:05 +00:00
Bill Richardson
d3fdf5e6f3 Add stubs for DPTF thermal thresholds
This adds three new registers to the ACPI->EC interface, which will allow
the AP to set/clear two DPTF thermal threshold points for each temp sensor.

The registers are

  EC_ACPI_MEM_TEMP_ID            0x05
  EC_ACPI_MEM_TEMP_THRESHOLD     0x06
  EC_ACPI_MEM_TEMP_COMMIT        0x07

It doesn't actually do anything yet, but the AP can now write those values.

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

On the host:

  dptf() {
         [ "$#" -eq "2" ] || return;
         iotools io_write8 0x66 0x81
         iotools io_write8 0x62 $1
         iotools io_write8 0x62 $2
  }

Now watch the EC console while running on the host:

  dptf 5 1
  dptf 6 80
  dptf 7 2
  dptf 7 3

The EC should say

 DPTF sensor 1, threshold 7 C, index 0, enabled
 DPTF sensor 1, threshold 7 C, index 1, enabled

Change-Id: I71fa57e3ca7c7b5bb8892e63212bf294b44dece5
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179778
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-13 01:13:44 +00:00
ChromeOS Developer
df50fccf8e Change PECI_TJMAX to a board config option
BUG=chrome-os-partner:24455
BRANCH=none
TEST=Manual: Verify that CONIFG_PECI_TJMAX set per-board matches
the value queried over the PECI bus with the restricted
"peciprobe" command.

Change-Id: I8e99a23a66f26d6101e01cc751d0a8ca79686321
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179682
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2013-12-13 01:13:38 +00:00
Bill Richardson
e6588c803f Move ACPI stuff out of chip/lm4 and into common
The port 62/66 ACPI commands were implemented in chip/lm4/lpc.c. They should
be handled in common instead of being tied to a particular EC.

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

read EC_ACPI_MEM_VERSION

  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 0; iotools io_read8 0x62
  0x01

write & read EC_ACPI_MEM_TEST

  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 1; iotools io_write8 0x62 0xa5
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 1; iotools io_read8 0x62
  0xa5
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 2; iotools io_read8 0x62
  0x5a

  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 1; iotools io_write8 0x62 0xbb
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 1; iotools io_read8 0x62
  0xbb
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 2; iotools io_read8 0x62
  0x44

read & write EC_ACPI_MEM_KEYBOARD_BACKLIGHT

  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 3; iotools io_write8 0x62 100
  (keyboard lights up)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 3; iotools io_read8 0x62
  0x64
  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 3; iotools io_write8 0x62 50
  (keyboard dimmer)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 3; iotools io_read8 0x62
  0x32
  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 3; iotools io_write8 0x62 0
  (keyboard goes dark)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 3; iotools io_read8 0x62
  0x00

read & write EC_ACPI_MEM_FAN_DUTY

  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 4; iotools io_write8 0x62 100
  (fan on full)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 4; iotools io_read8 0x62
  0x64
  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 4; iotools io_write8 0x62 50
  (fan on half speed)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 4; iotools io_read8 0x62
  0x32
  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 4; iotools io_write8 0x62 0
  (fan off)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 4; iotools io_read8 0x62
  0x00
  # iotools io_write8 0x66 0x81; iotools io_write8 0x62 4; iotools io_write8 0x62 0xff
  (fan back to EC control)
  # iotools io_write8 0x66 0x80; iotools io_write8 0x62 4; iotools io_read8 0x62
  0xff

test EC_CMD_ACPI_QUERY_EVENT

  # iotools io_write8 0x66 0x84; iotools io_read8 0x62
  0x00

  On EC console:
  > hostevent set 0x0f000000

  # ectool eventget
  Current host events: 0x0f000000

  # iotools io_write8 0x66 0x84; iotools io_read8 0x62
  0x19
  # iotools io_write8 0x66 0x84; iotools io_read8 0x62
  0x1a
  # iotools io_write8 0x66 0x84; iotools io_read8 0x62
  0x1b
  # iotools io_write8 0x66 0x84; iotools io_read8 0x62
  0x1c
  # iotools io_write8 0x66 0x84; iotools io_read8 0x62
  0x00

  # ectool eventget
  Current host events: 0x00000000

Change-Id: I011a5a2051171ec1d37e55ce03e1ce74b93a7e14
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179692
2013-12-12 18:21:56 +00:00
Vincent Palatin
96e034f366 nds32: WORKAROUND for toolchain bug on rodata
Sometimes the toolchain tries to put a relocation which is not suitable
to access variables in a read-only section.

The nds32 gcc uses GP-relative signed 17-bit relocation to access
variables stored in .rodata (eg lwi.gp $r0, [ +gp ])
That's wrong since $gp is pointing in the middle of .data and .bss in
the SRAM, while .rodata is sitting in flash.
Since on IT8380, the flash is at 0x00000 and the SRAM is at 0x80000
(512kB further), the linker will fail trying to create the signed 17-bit
relocation (it detect that it needs to truncate it)

Force the compiler to put another relocation as a workaround for now.

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

BRANCH=none
BUG=chrome-os-partner:24378
TEST=./util/make_all.sh ; make BOARD=it8380dev
check "version" and "gpioget" on spring, link and it8380dev.

Change-Id: Ife50adf3a26be28f113292f73a1a70e8d74b5d8c
Reviewed-on: https://chromium-review.googlesource.com/176913
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-10 19:17:59 +00:00
Vincent Palatin
93cc00fde1 ite: Port OS layer to Andestar v3m architecture
This will be used to support ITE IT8380 chip which contains an Andes
N801 core.

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

BRANCH=none
BUG=chrome-os-partner:23574
TEST=make BOARD=it8380dev

Change-Id: I91f9380c51c7712aa6a6418223a11551ab0091ce
Reviewed-on: https://chromium-review.googlesource.com/175480
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-10 19:17:54 +00:00
ChromeOS Developer
d53fe7b79b Basic driver for tmp432 temperature sensor
This allows local and remote temp values to be added
to a board's list of temp sensors. It also adds a
'tmp432' EC console command to query temps
and set alert thresholds. Fractional degrees are not
supported. DPTF support is not addressed.

BUG=chrome-os-partner:23985
BRANCH=none
TEST=Add tmp432 support to a board with the sensor
then run the 'tmp432' and 'temps' EC console commands.

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

Change-Id: Ifee47cf4d4cf5eedef9ef2bfa2149f183f1d7a7b
Reviewed-on: https://chromium-review.googlesource.com/178688
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Tested-by: Dave Parker <dparker@chromium.org>
2013-12-07 00:57:24 +00:00
Vincent Palatin
1762de9d19 extract common core code
Move the non-core dependent code out of core/$(CORE) directory to
common/ directory.

Put all panic printing code in common/panic_output.c
Put timer management code in common/timer.c

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

BRANCH=none
BUG=chrome-os-partner:23574
TEST=./util/make_all.sh
use "crash divzero" and "panicinfo" on Link.

Change-Id: Ia4e1ebc74cd53da55fe24f69e96f39f512b9336d
Reviewed-on: https://chromium-review.googlesource.com/178871
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2013-12-05 22:30:58 +00:00
Randall Spangler
3b0a4055d1 Move battery temp ranges to battery_info struct
This allows boards to detect the battery and return the correct temp
ranges, which will be needed for upcoming boards.

In the board-specific implementations, it's pretty much just moving
the fields from one const struct to another, so the impact is minor.

BUG=chrome-os-partner:24310
BRANCH=none
TEST=build all platforms; verify pit and rambi still charge

Change-Id: I7be075b3abb4039577f6362316adc1860c121d5c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178424
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2013-12-03 07:28:50 +00:00
Randall Spangler
40a1e7fa75 Cleanly force battery to mAh mode when reading capacity
Smart batteries can report capacity in mAh or 10mW units.  We forced
the units to mAh in charge_state.c's main loop, but that doesn't
guarantee that they're actually set before the capacity is read.  It's
cleaner to check the capacity reporting mode when actually reading the
capacity.

BUG=chrome-os-partner:20881
BRANCH=none
TEST=battery command reports the same capacity data before/after change
     (on rambi, design=2940 mAh)

Change-Id: I4a4c80eaade72bb09627d5d65693c097e264a992
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176154
2013-12-02 22:03:54 +00:00
Randall Spangler
c0ec787ba1 Add battery_get_params()
The charge state machine asks for all of this stuff at the same time
anyway.  Bundling it into a single function removes a number of
redundant (and painfully slow) I2C reads.

Also refactor the battery debug command so it doesn't have so many
local variables all in one function; it was consuming considerably
more stack space than any other debug command.

Spring still needs low-level access to the smart battery, so move the
two functions it needs directly into the Spring implementation.

BUG=chrome-os-partner:20881
BRANCH=none
TEST=charge/discharge rambi, pit and spring; watch debug messages and
     LED and output of 'battery' debug command.  All should behave the
     same as before.  Then run 'taskinfo' and see that the console task
     has at least 20 bytes unused.

Change-Id: I951b569542e28bbbb58853d62b57b0aaaf183e3f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177797
2013-12-02 22:03:51 +00:00
Randall Spangler
7f3ed512db gpio: Make GPIO_INT_BOTH explicitly RISING|FALLING
For historical reasons on LM4, we defined GPIO_INT_F_BOTH separately
from GPIO_INT_F_RISING and GPIO_INT_F_FALLING.  This means that the
code has weird checks like BOTH || (RISING && FALLING), which have
propagated in error-prone ways across the other chips.

Instead, explcitly define BOTH to be RISING|FALLING.

Ideally, we would have called it GPIO_INT_EDGE to match
GPIO_INT_LEVEL, but changing that now would be a big find-replace.
Which might still be a good idea, but that is best done in its own CL.

BUG=chrome-os-partner:24204
BRANCH=none
TEST=build and boot pit, spring, and link; that covers STM32F, STM32L, and LM4.

Change-Id: I23ba05a3f41bb14b09af61dc52a178f710f5c1bb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177643
Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-11-23 05:11:31 +00:00
Randall Spangler
34b94121c7 Remove bolt, daisy, kirby, puppy, slippy boards
These boards are unloved and unsupported.  They'll never grow up to be
laptops, and hardware is increasingly hard to come by.

Comparable functionality is available in the other, more-loved boards.

Removing these boards speeds up util/make_all.sh by 40%.  (If you're
not running that before every upload, you should be...)

BUG=chrome-os-partner:24062
BRANCH=none
TEST=build all remaining platforms and pass unit tests

Change-Id: I4d8a49e4d52d7393471f1b1cbef059c8db4a4f77
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177373
2013-11-21 22:21:56 +00:00
Bill Richardson
f7dba327a2 Add DPTF interface for fan duty
This adds include/dptf.h to define the DPTF interface functions.

As the first DPTF feature, it also adds a register to the EC's ACPI
interface block. Register 0x04 is used to get and set the fan's target duty
cycle, as a percentage value. Writing a 0 to this register will set the
target duty cycle to 0, writing a 100 (0x64) will set it to 100%. Writing
any other value will return the fan control to the EC, rather than driving
it manually from the host.

Likewise, reading from this register returns the current fan target duty
cycle, as a percentage. If the EC is controlling the fan automatically, the
returned value will be 0xFF.

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

You can monitor the fan state from the EC console with the "faninfo"
command. From the host side, test this interface from a root shell.

Read fan duty:

  iotools io_write8 0x66 0x80
  iotools io_write8 0x62 4
  iotools io_read8 0x62

Set fan duty to 100%:

  iotools io_write8 0x66 0x81
  iotools io_write8 0x62 4
  iotools io_write8 0x62 100

Set fan duty to 50%:

  iotools io_write8 0x66 0x81
  iotools io_write8 0x62 4
  iotools io_write8 0x62 50

Set fan duty to 0%:

  iotools io_write8 0x66 0x81
  iotools io_write8 0x62 4
  iotools io_write8 0x62 0

Set fan control back to automatic:

  iotools io_write8 0x66 0x81
  iotools io_write8 0x62 4
  iotools io_write8 0x62 -1

Change-Id: I91ec463095cfd17adf452f0967da3944b254d558
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177423
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-21 22:21:34 +00:00
Aaron Durbin
8db204073a lm4: add option for using gpio as kebyoard interrupt
On certain boards it's no feasible to use the SERIRQ
method for generating the kebyboard interrupt. To that
end provide CONFIG_KEYBOARD_IRQ_GPIO option which
specifies the negative edge-triggered gpio for the
keyaboard interrupt.

BUG=chrome-os-partner:23965
BRANCH=None
TEST=Built and booted rambi using this option. Keyboard
     works in kernel with interrupts for i8042 device.

Change-Id: I64f7e9530841c184d2a33821126ec446c96bb0f0
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177188
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-21 04:31:08 +00:00
Vic (Chun-Ju) Yang
14c7191b53 mec1322: initial commit
This is the initial commit of mec1322 support. This includes:
  - Basic GPIO driver. Interrupt not supported yet.
  - Microsecond timer
  - UART driver

The script to pack the firmware binary will be checked in in
following-up CL.

BUG=chrome-os-partner:24107
TEST=Build and boot on eval board
BRANCH=None

Change-Id: I9013c908049d1f740f84bb56abca51b779f39eef
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175716
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-21 04:30:55 +00:00
Randall Spangler
5524ba7bf7 cleanup: More comments in timer.h
Indicate when usleep() and udelay() may be called.

No code changes, just comments.

BUG=none
BRANCH=none
TEST=Build any platform.  Heck, it's just comments.

Change-Id: I0182c153c29965b25d5294d838c1406c30115099
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177452
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-11-21 00:09:09 +00:00
Aaron Durbin
83ec930b36 lm4: allow the lpc module to use GPIO for SCI
The LPC module has a dedicated control for SCI#.
However, certain situations require a dedicated
GPIO for asserting the SCI# signal.

Introduce CONFIG_SCI_GPIO to meet this requirement.

BUG=chrome-os-partner:24003
BRANCH=None
TEST=Built and booted rambi with dependency change. 'lidclose' and
     'lidopen' cause ACPI interrupts.

Change-Id: I34c5f0ba5ff60151972921f251c71d3769a9ef8b
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176804
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-15 01:39:42 +00:00
Bill Richardson
eb70d3cda7 Use explicit sizes for lightbar_params fields.
The struct lightbar_params used to communicate lightbar settings between the
AP and the EC uses just "int" for some of its fields. The AP currently uses
32-bit values for "int" in both 64-bit and 32-bit mode, but that's just luck
since C only requires that "int" be at least 16 bits.

This change makes the size explicit.

BUG=none
BRANCH=none
TEST=manual

There should be no visible change.

ectool lightbar params > /tmp/foo
ectool lightbar params /tmp/foo

Change-Id: I4d77c16b3c68e179292b824938d2d012e917ad13
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176364
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
2013-11-11 22:31:16 +00:00
Bill Richardson
1d2845d2db Add EC_MEMMAP_ALS, update it once per second
This adds space for up to two ALS lux readings to be available to the AP
through the memory-mapped LPC region. If enabled, the values are updated
once a second.

The ALS will be reinitialized at every AP resume, since it's typically
unpowered otherwise. The reported value will be zero when the ALS is off.

BUG=chrome-os-partner:23380
BRANCH=samus
TEST=manual

Boot the AP, then from the EC console run "als" or just monitor the
memory-mapped region directly ("rw 0x40080780" on Samus), while pointing the
sensor at bright and dim areas. The value should change.

Change-Id: I705371fcd57345dc9adae1231ea30c7ff024aaf8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176142
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-08 00:53:12 +00:00
Bill Richardson
f23e68d721 Add ALS driver for light sensors connected to EC
This adds the driver and a console command to read an Intersil ISL29305
light sensor connected to the EC.

BUG=chrome-os-partner:23380
BRANCH=samus
TEST=manual

Run the "als" command from the EC console, while pointing the sensor in
various directions. It should give higher numbers when facing a light
source.  If you get "Error 1", it means the ALS isn't powered.

Change-Id: I855ed64dab7fc60e29126ab3e97669be24dc6a64
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176056
2013-11-07 23:42:56 +00:00
Randall Spangler
e2f851aae2 Enable stack overflow checking on all context switches
Changes somewhere in the recent past have caused I2C operations to
consume more stack space.  The current failure mode is that after some
debug command or infrequent battery operation, the system fails.

Clean up and enable stack overflow detection by default, and add a
debug command (disabled by default) to verify overflow detection
works.

This adds several instructions to each context switch, but it's still
fairly inexpensive, and represents only a few percent increase in the
size of svc_handler().  That's better than silent failures.

BUG=chrome-os-partner:23938
BRANCH=none
TEST=Enable CONFIG_CMD_STACKOVERFLOW, then run the 'stackoverflow' command.
     This should cause a stack overflow to be detected in the CONSOLE task.

Change-Id: I9303aee5bd9318f1d92838b399d15fb8f6a2bbf9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176113
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-07 22:35:56 +00:00
Bill Richardson
d64de2bb1b Show smart battery status with 'battery' command
The smart battery status register holds some useful info. This displays it
along with all the other stuff.

This decodes the alarm and status bits, but not the error code, since that
field is only valid immediately after a failed i2c transaction (that's how
the battery indicates error). Since we do all sorts of automatic battery
probing in other threads, that value will never be reliable when we run the
"battery" console command.

BUG=none
BRANCH=none
TEST=manual

Run "battery". You should see a new line amongst the output:

  Status:    0x00c0 DCHG INIT

Change-Id: I5e684198af2cf7767f89786c91a7d946ad95d4c2
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175659
2013-11-05 22:45:21 +00:00
Alec Berg
48dfd8c5ee lm4: Fixed low power idle doesn't always wake up.
Temporary fix to the bug in which we miss wake events when in deep
sleep with the LFIOSC (32kHz) clock and the EC is cold. This fix
involves simply using a faster clock, 250kHz, when in low speed
deep sleep. This fix consumes more power but solves the bug.

Renamed EC console command dsleepmask to dsleep.

BRANCH=none
BUG=chrome-os-partner:23678
TEST=Go in to low speed deep sleep by going into either S3 or G3
and letting the EC console timeout. Then freeze-spray the EC chip.
Wake up the EC via the console and make sure that the idlestats
show that we have not missed a deadline.

Change-Id: I4f9844f1937bc8c95cf1540502f7d8fb4cbc097e
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175614
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-05 03:38:08 +00:00
Randall Spangler
efb6bc7655 Pad jump tags to 4 bytes inside the system module
That way all the users of jump tags don't need to know about the
padding requirements.

BUG=chrome-os-partner:23851
BRANCH=none
TEST=enable CONFIG_CMD_JUMPTAGS, then 'jumptags'.  Output should be
     something like this:

     20007fbc: 0x5550 UP.1  2
     20007fc4: 0x4b42 KB.2  3
     20007fcc: 0x4c50 LP.1 12
     20007fdc: 0x4d54 MT.1  8

     All the addresses in the first column should be word-aligned.  The
     sizes in the last column don't need to be a multiple of 4.

Change-Id: I91f9c29701a007ef8a56b5b7e0ea09930dfbea31
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175591
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-05 02:32:40 +00:00
Bill Richardson
88503ab4ec Provide multiple fan support within the EC itself
This adds explicit "int fan" args to the exported functions from
common/fan.c: fan_set_percent_needed() and fan_percent_to_rpm(). Within that
file, multiple fans are handled independently.

This is not complete, though. Host commands and sysjump support still only
handle a single fan, so at the moment multiple fans are treated identically
in those cases.

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

All boards build, "make runtests" passes.

On a multi-fan system, the EC command "faninfo" displays multiple results:

  > faninfo
  Fan 0 Actual:    0 rpm
  Fan 0 Target:    0 rpm
  Fan 0 Duty:   0%
  Fan 0 Status: 0 (not spinning)
  Fan 0 Mode:   rpm
  Fan 0 Auto:   yes
  Fan 0 Enable: yes

  Fan 1 Actual:    0 rpm
  Fan 1 Target:    0 rpm
  Fan 1 Duty:   0%
  Fan 1 Status: 0 (not spinning)
  Fan 1 Mode:   rpm
  Fan 1 Auto:   no
  Fan 1 Enable: no
  >

and the "fanduty", "fanset", and "fanauto" all require the fan number as the
first arg:

  > fanduty 0 30
  Setting fan 0 duty cycle to 30%
  > fanset 1 2000
  Setting fan 1 rpm target to 2000
  > fanauto 0
  > fanauto 1

On single-fan systems, there is no visible change.

Change-Id: Idb8b818122e157960d56779b2a86e5ba433bee1b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175368
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-02 01:07:16 +00:00
Randall Spangler
00682eb80f cleanup: Still more TODO comments
More of same.  Comment changes only; no code changes.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; pass unit tests

Change-Id: I8c42ed7d332cd9d461067e1aeac670855106cbcd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175405
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-02 01:07:10 +00:00