Commit Graph

712 Commits

Author SHA1 Message Date
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
Randall Spangler
760ace07a5 cleanup: Improve / remove more TODO comments
Add bug references.  Remove one assert that can no longer be triggered.

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

Change-Id: I3f4d2e4f2f3343a8d0531cb0715d151eaa4d0b50
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175293
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-01 17:13:07 +00:00
Randall Spangler
ea188ffdb7 cleanup: TODOs in ec_commands.h
Comment changes only; no code changes.

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

Change-Id: I8f6f57514886dd1fda0e44cae1b036c22be481f8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175228
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-31 21:57:29 +00:00
Randall Spangler
af8d3f9536 cleanup: TODO comments in extpower_spring
No code changes, just comment fixes.  Added config #ifdefs for the
debug commands as requested; they're enabled for Spring, so
functionality is unchanged.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build spring; see that ilim and batdebug commands still exist

Change-Id: I7c9f12281afa7ec68aa7e62dcfcd51682d88a16a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175216
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-31 21:57:24 +00:00
Randall Spangler
d16a246ea9 cleanup: mkbp keyboard module
Rather than compile it by default for host-based tests, only compile
it for the few tests that actually use it.  Since those (and all
boards) now only use if if they also have a keyscan task, we can get
rid of the #ifdefs in keyboard_mkbp.c as well.

And remove a TODO we'll never do...

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all boards; pass unit tests.  These pass:
     util/make_all.sh
     make BOARD=pit tests

Change-Id: I44d1806cfb375027a7ed0b33a5e9bdbbed8ccddc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174513
2013-10-30 23:10:13 +00:00
Bill Richardson
e48a9d9c21 Separate fan_t from pwm_t
There is a logical difference between PWM controls for things like
backlights and fan controls for actual fans. This change separates them into
two different data structures, for better abstraction.

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

make runtests, make all boards, test on Link and Falco.

Change-Id: Ib63f2d1518fcc2ee367f81bf5d803360c1aa5c76
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175151
2013-10-30 23:10:10 +00:00
Bill Richardson
034e96c128 Rename CONFIG_FAN to CONFIG_FANS
Instead of just configuring fan support as yes/no, we'll use it to specify
the number of fans on the board. Undefined (not zero!) means no fan support
at all.

Syntax change only. No new functionality.

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

make runtests, build all platforms, build and test on Link.

Change-Id: Iff65efa69e05f3e1a54fdc2a8da9001b4e8487ca
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175150
2013-10-30 23:10:07 +00:00
Bill Richardson
9dff30d466 Add more descriptive comments to include/fan.h
Just adding some comments.

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

Change-Id: Ib3955e9d97ad8aa642e6fe298c17e34d2c66fb1c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175139
2013-10-30 23:10:02 +00:00
Bill Richardson
c7b930606b Separate common fan behavior from implementation
This looks like a lot, but it's really just moving the non-board-specific
stuff from chip/lm4/fan.c into common/fan.c, updating the appropriate
headers, and renaming functions to better match the new location.

This is entirely code refactoring and renaming. No new functionality.

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

make runtests, build all platforms, build and test on Link.

Change-Id: I7dc03d6732bad83cf838a86600b42a7cff5aa7aa
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175012
2013-10-30 21:51:50 +00:00
Randall Spangler
685c45ef46 cleanup: comments in adc modules
No code changes, other than renaming a couple of static functions.

BUG=none
BRANCH=none
TEST=build falco

Change-Id: I29b835d273aa1aba66d9d40536eae2eb12207f66
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174530
2013-10-25 20:12:54 +00:00
Randall Spangler
17ea6d50f0 cleanup: eeprom and option comments
No code changes, just updating comments.

BUG=chrome-os-partner:23558
BRANCH=none
TEST=compile bds project

Change-Id: I819244acafcf89a1e983bddecd82f770b0374ee1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174512
2013-10-25 20:12:49 +00:00
Randall Spangler
5ef2054c38 cleanup: Consolidate module IDs into a single shared enum
This is tidier than every board defining its own module_id enum, and
encourages standard naming of modules.

A subsequent CL will do more cleanup (standardizing on MODULE_LED
instead of MODULE_POWER_LED and MODULE_LED_KIRBY), but it's easier to
do that as a separate CL than part of this one.

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

Change-Id: If0fcef284fb3aa2fa145bc9ff3d1f3f2d25a2e47
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174382
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-25 03:09:51 +00:00
Randall Spangler
c0fbbaefed cleanup: comments in i2c modules
No code changes; just update comments with bug links

BUG=none
BRANCH=none
TEST=build all platforms

Change-Id: I8b845f9c43315b7db5a746a16c6618c3ee96979d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174614
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-25 01:32:31 +00:00
Randall Spangler
870b7ebb78 cleanup: charge state header
Remove old TODO and function which no longer exists.

BUG=none
BRANCH=none
TEST=compile all platforms

Change-Id: I81c5ddb3d0e156d455be1af82f12d8d4f30e1bc8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174393
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-25 01:32:21 +00:00
Bill Richardson
9a6e464502 cleanup: remove obsolete declaration from header
When we cleaned up the alternate function GPIO initialization, we left a
declaration for configure_fan_gpios() in fan.h. That function doesn't exist
anywhere, so there's no point in declaring it.

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

Build everything. Nothing fails.

Change-Id: I3d1fe1ff62e523aa7c87d57c5e838b01a0c6e899
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174334
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-10-23 23:53:27 +00:00
Randall Spangler
251a80add3 throttle_ap.c should only be compiled if there's a chipset/power task
It doesn't need to be compiled if there would be nothing for it to talk to.

BUG=chrome-os-partner:20739
BRANCH=none
TEST=build all platforms, pass unit tests
     comment out chipset task in Rambi ec.tasklist; code still compiles

Change-Id: I004364b8c1fdf02c420162b5ad2843068a26b452
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174302
2013-10-23 23:53:23 +00:00
Randall Spangler
2ad076f8a0 cleanup: Rename and move header files
Device-specific headers belong in driver/ or chip/.  The include/
directory should be for common interfaces.

Code should not normally need to include driver-specific headers.  If
it does, it should use the full relative path from the EC project root
(for example, drivers/charger/bq24715.h).

Change-Id: Id23db37a431e2d802a74ec601db6f69b613352ba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173746
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-23 21:27:40 +00:00
Randall Spangler
5f26987366 cleanup: Comments about PMU powerinfo module
Document some Pit-platform-specific assumptions.

No code changes.

BUG=none
BRANCH=none
TEST=build pit

Change-Id: I601ca4a57645ba45e7db01e271556a30d334f9cd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174056
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-22 23:18:13 +00:00
Randall Spangler
9ccd9668a2 cleanup: update comments with existing bug numbers
Some of the comments no longer apply.  Others needed more info.

No code changes; just comment changes.

BUG=none
BRANCH=none
TEST=build all platforms

Change-Id: I1d52aa9a98427a78c9d9a8cf44934fb04c3c00c8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174084
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-22 22:23:53 +00:00
Randall Spangler
a318cc9068 cleanup: Remove fixme from ec_commands.h
The fixme was just a feature request.  I've moved it to a new bug.

Comment change only; no code changes.

BUG=chrome-os-partner:23457
BRANCH=none
TEST=build rambi

Change-Id: Ie3fc0482b6697c12040b868ba837073929cf5b82
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173921
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-10-22 17:55:42 +00:00
Alec Berg
10bd1db6d7 lm4: Use low speed clock in deep sleep.
Changed the low power idle task to use the low speed clock in deep
sleep. The low power idle task is currently only enabled for Peppy,
Slippy, and Falco. This change decreases power consumption when
the AP is not running.

Note that the low speed clock is slow enough that the JTAG cannot be
used and the EC console UART cannot be used. To work around that,
this commit detects when the JTAG is in use and when the EC console
is in use, and will not use the low speed clock if either is in use.
The JTAG in use never clears after being set and the console in use
clears after a fixed timeout period.

BUG=None
BRANCH=None
TEST=Passes all unit tests.
Tested that the EC console works when in deep sleep.
Tested that it is possible to run flash_ec when in deep sleep and
using the low speed clock.

Change-Id: Ia65997eb8e607a5df9b2c7d68e4826bfb1e0194c
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173326
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-10-21 23:59:38 +00:00
Randall Spangler
d9530449fd cleanup: Consolidate power interrupts
Every chipset had its own header file just to declare a GPIO interrupt
handler.  Since this seems to be a common feature of the power
interface, make a standard power_interrupt() API provided by
chipset.h.  This lets us get rid of 4 include files, and makes it
easier to add more chipsets in the future.

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

Change-Id: I1fc5612d42625ea46e0a8e16a83085b66d476664
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173745
2013-10-21 21:10:36 +00:00
Yen Lin
140404ffdf ec: add nyan board
This is to add nyan board support:
  - new files in board/nyan folder, including battery.c
  - new common/chipset_tegra.c, which is mostly based on
    chipset_gaia.c
  - new include/tegra_power.h
  - modified build.mk and flash_ec for nyan

BUG=none
BRANCH=nyan
TEST=tested on Venice 2 board

Change-Id: I36895f34f2f4d144a9440aff358c8274797ebbd6
Signed-off-by: Yen Lin <yelin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/168078
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-10-17 22:52:12 +00:00
Randall Spangler
737160dd5d cleanup: Config defines
Add some missing descriptions in config.h and rename a few defines to
be more consistent.

No functional changes, just comments and symbol renaming.

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

Change-Id: I05a9a2ed6fd7bc8b14a18a0dc57d7d22430de21a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173111
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-10-16 22:24:42 +00:00
Vic Yang
c856d14424 Do not compile Baytrail chipset code if chipset task is absent
Like other chipset code files, we shouldn't compile Baytrail chipset
code if chipset task is absent.

BUG=None
TEST=basic tests now compile on Rambi without error
BRANCH=None

Change-Id: I231de06310b2e0d7ff7b3e1e21bbff89636cd5c0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/172980
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-10-15 15:29:52 +00:00
Alec Berg
c5b90d7e77 lm4: Add a low power idle task.
First implementation of a low power idle task for the LM4 chip. The
low power mode is selected by defining CONFIG_LOW_POWER_IDLE in a
board.h file. This commit turns it on for Peppy, Slippy, and Falco
only because those are the only boards tested.

When using the low power idle task, the chip goes in to deep sleep
when it can. Deep sleep disables clocks to most peripherals and puts
the onboard flash and RAM into a low power mode. The chip is woken
out of deep sleep using the RTC in the hibernate module. Increased
the idle task stack size to handle more involved idle task.

In board.c, the array of GPIO info can be used to select which GPIO
points can wake up the EC from deep sleep. Currenlty selected are
the power button, lid open, AC present, PCH_SLP_S3, and PCH_SLP_S5.
Additionally the port with the KB scan row GPIO point is also
enabled to wake up the EC from deep sleep.

Signed-off-by: Alec Berg <alecaberg@chromium.org>

BUG=None
BRANCH=none
TEST=Passes all unit tests. Runs on slippy, peppy, and falco with no
noticeable side affects. Verified that the power consumed by the EC
is lower when in S3, S5 and G3 by scoping the sense resistor
powering the chip.

Change-Id: I83fa9a159a4b79201b99f2c32678dc4fc8921726
Reviewed-on: https://chromium-review.googlesource.com/172183
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
2013-10-15 00:27:14 +00:00
Randall Spangler
193f2298bd Enforce a minimum number of clocks between keyboard scans
When the EC CPU is running at a decreased clock frequency, frequent
keyboard scans can starve other EC tasks of CPU and lead to dropped
data or watchdog timeouts.

Enforce a minimum number of EC clocks between keyboard scans to
prevent this from happening.  The default chosen (16000 clocks) is
equal to the shortest post-scan delay (1 ms) of any current board when
the AP is in S0, so this should have no effect when the AP is in S0.
When the AP is in S3 or S5, we don't need to scan the keyboard as
frequently anyway.  This can be overridden on a per-board basis for
future boards if needed.

BUG=chrome-os-partner:23247
BRANCH=pit
TEST=apshutdown, then hold down a key for 10 seconds.  Should not see a
     watchdog reset.

Change-Id: I228f53a32ad4769f6a137a9ab06903111bea115d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/172895
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-10-14 23:27:31 +00:00
Randall Spangler
1006187c61 Add baytrail power sequencing
This is an initial version of power sequencing for the rambi rev.1
boards.  It has a workaround for a rev.1 board problem; this requires
turning on PP5000 early.

BUG=chrome-os-partner:22895
BRANCH=none
TEST=AP should power on to S0 (PLTRST# deasserts) automatically when EC boots
     Then 'apshutdown' should drag it back to G3.
     Then 'powerbtn' should take it back to S0.

Change-Id: Id9bc6fe9b55fce3eb46ce1265891724ec7a4ae20
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/172675
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-10-11 03:58:09 +00:00