Commit Graph

632 Commits

Author SHA1 Message Date
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
Louis Yung-Chieh Lo
878f29330b nyan: pull up AP_RESET_L for old boards
On older boards (< Rev2.2), AP_RESET_L was connecting to PMIC reset pin.
However, after 2.2 we use the PMIC_THERM pin instead. Thus, change this
pin to pull high for old boards. T\Otherwise cannot boot up.

BUG=None
BRANCH=nyan
TEST=verified on old board by nvidia.

Change-Id: If4dccaf0bd0671c55b0d703d4d4b16a2b9c4f543
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179377
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-11 00:15:20 +00:00
Louis Yung-Chieh Lo
b38fd45000 nyan: re-factor power button to use common/power_button.c
This is the first step of tegra power state re-factoring. Move the
power button logic to common/power_button.c.

Also, the GPIO KB_PWR_ON_L is renamed to POWER_BUTTON_L.

BUG=None
BRANCH=nyan
TEST=tested on nyan rev 3.12,
reboot: PASS, power on 2
power off / power on: PASS, power on 5
lid close / power off / lid open: PASS, power on 3
button on / off: PASS, ending loop 3, power on 4
power off / button on: PASS, ending loop 4, power on 4
button off / power on: PASS, ending loop 3, power on 5
button off / lid open: PASS, ending loop 3, power on 3

Change-Id: If07806b9c11cdba2b478a9a74d2b75be1d9f7acf
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/179451
2013-12-11 00:13:51 +00:00
ChromeOS Developer
53d219f555 Rambi: Switch from g781 to tmp432 temperature sensor
BUG=chrome-os-partner:23985
BRANCH=rambi
TEST=Run 'tmp432' and 'temps' command on EC console.

Signed-off-by: Dave Parker <dparker@chromium.org>
Change-Id: I0f246c82ea5f9d5d153b7dc57f7371ea931d6189
Reviewed-on: https://chromium-review.googlesource.com/178689
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-07 00:57:28 +00:00
Vic (Chun-Ju) Yang
f9e00364ef mec1322: I2C driver
This adds the driver for MEC1322 I2C controller.

BUG=chrome-os-partner:24107
TEST=Hook up TSU6721 to eval board. Do the following tests:
      - 'i2cscan' and see TSU6721.
      - Read device ID register and get correct value.
      - Add 3 tasks randomly doing I2C read and writes. Check there is
	no error.
BRANCH=None

Change-Id: I465f73fe8177a8df6b56c57e594cd733caea37d4
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178591
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-06 05:21:41 +00:00
Louis Yung-Chieh Lo
90d83d2a67 nyan: force shutdown uses PMIC THERM instead.
Add a new pin PMIC_THERM_L (PA1) since AP_RESET_L (PA15) is removed.
To force shutdown, drive PMIC_THERM_L to low (default high) for 32us.

Also rename set_pmic_pwrok() -> set_pmic_pwron(). And add a debounce time
for PMIC_PWRON_L pin.

BUG=chrome-os-partner:24206
BRANCH=nyan
TEST=Verified on the frank's rework board.
'power off' shutdowns the AP immediately.
'reboot' reboots the EC and resets the AP as well.
'sysjump RW' still keeps AP alive.

Change-Id: I8643e19081a824e1f6adc812dfad0269222db8ea
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178631
2013-12-05 01:51:28 +00:00
Vic (Chun-Ju) Yang
06e6073491 mec1322: Fan control driver
This adds the driver for PWM duty cycle based and RPM based fan control.

BUG=chrome-os-partner:24107
TEST='fanset 5000' and fan spins up.
     'fanset 8000' and fan spins faster.
     'fanset 0' and fan stops.
     'fanduty 30' and fan spins up.
     'fanduty 50' and fan spins faster.
     'fanduty 30' and fan slows down.
     'fanset 6000' and fan goes to ~6000 RPM.
     Unplug fan power and see 'fan 0 stalled'.
     Plug power back and doesn't see stall warning anymore.
BRANCH=None

Change-Id: Ice3e5c03686cde57894e888e34ae2070c33b4e4d
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178402
2013-12-04 13:34:56 +00:00
Vic (Chun-Ju) Yang
36eb70c637 mec1322: LPC host command support
With this, basic host command functionality is working.

We don't have the correct description of LPC memory BAR register yet, so
we have to use EMI (embedded memory interface) module for 0x800-0x9ff
region. This requires a slightly different protocol, which is in the
next CL.

BUG=chrome-os-partner:24107
TEST=Wire EVB to Stumpy. 'ectool hello' and 'ectool version' working.
BRANCH=None

Change-Id: I873b4a455cf692e479321a5c6e18c8f33df60e66
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178250
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-04 13:34:50 +00:00
Yen Lin
ebb54a453d nyan: add support of different battery types
Nyan EC supports 2 different boards: Venice2 and Norrin. Venice2
uses 2S battery, and Norrin uses 3S battery. This CL is to support
2 different battery types (2S or 3S) automatically at init time by
reading battery's MANUF_NAME, DEVICE_NAME and DESIGN_VOLTAGE from
Smart Battery Interface to determine which battery type to use.

To workaround the problem that battery may not be attached at init
time, a patch is added to call battery_get_info() in PWR_STATE_INIT
state to get the current battery info. Note the battery info is only
determined once.

BUG=none
BRANCH=nyan
TEST=tested on Vencie2 with 2S battery and on Norrin with 3S battery
     attached at init time and made sure correct battery info are
     installed;
     tested on Venice2 and Norrin without battery at init time, then
     attached 2S or 3S battery and made sure correct battery info are
     installed.

Change-Id: I135909c7fe1e1dfdb0f706e0eadba6e904b6221e
Signed-off-by: Yen Lin <yelin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/178088
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-04 01:52:11 +00:00
Randall Spangler
804b24cc81 rambi: Remove proto1 workaround which leaves PP5000_EN on
proto1.5 boards should not need this workaround.

BUG=chrome-os-partner:23673
BRANCH=none
TEST=boot a proto1.5 board -> boots
     apshutdown -> off
     gpioget PP5000_EN -> 0
     powerbtn -> boots
     gpioget PP5000_EN -> 1

Change-Id: Ie7bb962a9be0934506a6a5d0aefda0282ebb15ec
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177668
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-12-03 22:15:25 +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
Duncan Laurie
a35f1b7841 samus: Don't bring up wlan_power first in S3->S0 transition
Due to the way wireless_enable works this was resulting in
WLAN_OFF_L going low briefly on S0->S3->S0 transitions.

BUG=chrome-os-partner:23752
BRANCH=none
TEST=emerge-samus chromeos-coreboot-samus

Change-Id: I4bb02b6e9acf97d501af8c40c455c9f88ffe35ee
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178422
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-12-02 22:03:58 +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
Vic (Chun-Ju) Yang
ca8289258d mec1322: Add support for CONFIG_WATCHDOG_HELP
If CONFIG_WATCHDOG_HELP is defined, a 16-bit timer is used as an
auxiliary timer to interrupt us 50ms before the watchdog expires. When
the auxiliary timer expires, the stack trace is printed. Watchdog then
expires 50ms after and reboots the system.

BUG=chrome-os-partner:24107
TEST=Define CONFIG_WATCHDOG_HELP, and see stack trace on 'waitms 2000'.
TEST=Undefine CONFIG_WATCHDOG_HELP, and check watchdog still works
without printing stack trace.
BRANCH=None

Change-Id: I2555d3f86a15c83bb03a00c6807f77d9dddaf333
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/178284
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-12-02 04:54:25 +00:00
Vic (Chun-Ju) Yang
3f82ac3579 mec1322: Add watchdog support
This implements the basic watchdog support. For now, the watchdog
doesn't warn us before it expires. This functionality will be added
later using a basic timer.

BUG=chrome-os-partner:24107
TEST='waitms 700' and the EC stays alive.
TEST='waitms 1200' and the EC reboots.
BRANCH=None

Change-Id: I1cc48978ed09577ae88cc2f7a6087867e5854973
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177736
2013-11-26 18:19:10 +00:00
Aaron Durbin
11aed2342e rambi: fix PP3300_LTE_EN gpio
The gpio table had the wrong pin assigned to
PP3300_LTE_EN. It should be D4 instead of D2.

BUG=chrome-os-partner:24201
BRANCH=None
TEST=Built and booted. Stuff shows up on lsusb, and I can confirm
     3.3V on the bulk caps of the IO board.

Change-Id: I574599645ce21c175346e2ecde35b974aa0b68f7
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177694
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
2013-11-23 05:11:26 +00:00
Yen Lin
2f084199ca nyan: change EC_BL_OVERRIDE to GPIO_ODR_HIGH
If EC_BL_OVERRIDE is low, backlight will be turned off. To allow AP to
control backlight, set EC_BL_OVERRIDE to high.

BUG=none
BRANCH=nyan
TEST=verified on nyan board 2.0 to see backlight turns on when system
     boots up

Change-Id: I04e6052fbef4b17c3f9566c8c5cf691a2710b7b0
Signed-off-by: Yen Lin <yelin@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/177553
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
2013-11-23 02:33:36 +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
Aaron Durbin
24fdf4e554 rambi: use gpio for keyboard irq
The rambi board has issues using the SERIRQ method
for triggering the keyboard IRQ. Namely, the current
level-shifter in place for the bidrectional SERIRQ
signal introduces delay resulting in the SERIRQ
being out of phase with the clock. Moreover, there
appears to be a mismatch of expectations with the
number of start frames on the SEIRQ line. Bay Trail
uses a fixed 8 while the TI docs suggest it only
supports 6.

BUG=chrome-os-partner:23965
BRANCH=None
TEST=Built and booted rambi with keyboard working in
     kernel with interrupts.
CQ-DEPEND=CL:177223

Change-Id: I05c2b113d801b3fc434a402620cebae0301839f2
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177189
Tested-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-21 07:17:19 +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
abf4fb8392 spring: Increase stack for keyscan task
The keyscan task is short enough on stack space that turning on
keyboard debugging causes a stack overflow.  This was previously not
the default, but https://chromium-review.googlesource.com/#/c/174373/
made it the default.  Reverting that change just masks the problem;
enabling keyboard debugging on Spring would still cause a stack
overflow.

Rather than reverting that change, increase the stack size of the
keyscan task so that it doesn't overflow.  There is sufficient space
to do this.  Even after increasing the keyboard stack from 256 bytes to
320 bytes and doing a 'sysjump rw' to force jump tags to populate,
'shmem' reports 132 bytes free.

BUG=chrome-os-partner:23834
BRANCH=none
TEST=Boot Spring.
     ksstate on
     Bang on keyboard for a bit
     taskinfo -> shows KEYSCAN task at 292/320 bytes free
     sysjump rw
     shmem -> shows 132 bytes free, 0 used

Change-Id: Idf9fdce5b9e6ca4d05d80a62ae9ea831ed508e3a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177355
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-11-20 01:15:43 +00:00
Aaron Durbin
02995b2d6f rambi: use gpio for SCI# assertion
For some reason the SCI# is not working properly when the
LPC module controls the pad. Instead, utilize CONFIG_SCI_GPIO
option and put that GPIO pad into open-drain mode.

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

Change-Id: I5df455bc2fc9af4c43517a93c5a35dc598fd54e9
Reviewed-on: https://chromium-review.googlesource.com/176805
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Aaron Durbin <adurbin@chromium.org>
2013-11-18 17:54:00 +00:00
Duncan Laurie
bec6b5c93c samus: Fix ACOK buffer on chipset state transitions
The ACOK buffer from EC to PCH was not being triggered when
the chipset powers up or down, instead it was only triggering
when AC state was changed.

Since we want it to be driven in S5 I added HOOK_CHIPSET_PRE_INIT
to the power sequence in the G3S5 state transition.

BUG=chrome-os-partner:23752
BRANCH=none
TEST=power on samus proto1b with AC inserted and see PCH_ACOK
go high, power off and see it go low again.  Ensure that it is
also changed with AC state transitions.

Change-Id: I4cbe123322e234dc07f10fd1cdff5a8b771a4e02
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176630
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-13 07:07:57 +00:00
Duncan Laurie
034e06febf samus: Fix backlight panel interrupt
The backlight_interrupt() function is defined to NULL if the magic
CONFIG_BACKLIGHT_REQ_GPIO is not defined.

Enabling that exposed an issue where the backlight workaround was
attempted in interrupt context and should instead be deferred since
it involves i2c transactions.

BUG=chrome-os-partner:23752
BRANCH=none
TEST=build and boot on samus proto1b and see recovery screen

Change-Id: Id1377033c791a5c279fdb4faeecc4b2c0d142eaa
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176514
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-13 05:19:05 +00:00
Bill Richardson
33f29160a0 Specify I2C channels physically, not arbitrarily
In board.c, we initialize this struct:

struct i2c_port_t {
	const char *name;  /* Port name */
	int port;          /* Port */
	int kbps;          /* Speed in kbps */
};
extern const struct i2c_port_t i2c_ports[];

The port field refers to the physical I2C bus on the EC.

Meanwhile, in board.h, we've identified the bus where each I2C device is
attached:

Up until this CL, we've been picking one of those device-to-bus macros to
initialize port fields of the i2c_ports[] array. That's wrong and confusing.

This change specifies the physical channel with the physical number.

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

Renaming only. There should be no change in observed behavior.

Change-Id: I5427c26290572133f060b6cf0d9ebea5015adba1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176176
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
2013-11-11 23:47:05 +00:00
Alec Berg
b2a2821b4d rambi: Add low power idle to rambi
Added low power idle functionality to rambi but left it off by default.
To turn it on, define CONFIG_LOW_POWER_IDLE in rambi's board.h file.

BRANCH=none
BUG=chrome-os-partner:23947
TEST=Verified that the EC does not go into deep sleep when in S0, and that
it does go into deep sleep in S3, S5, and G3. Tested to make sure that
flashec works when the EC is in low speed deep sleep. Also verified
that the EC console times out after the timeout period and that it wakes
up on the next command. Did not measure power usage.

Change-Id: I0ab1a2dc7ca7ae4577fe5d0894c1bf82205dfea6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176159
Reviewed-by: Todd Broch <tbroch@chromium.org>
2013-11-09 04:39:00 +00:00
Louis Yung-Chieh Lo
308e02195d Take XPSHOLD back.
The XPSHOLD is not floated. It connects to +1.8V_VDDIO, which indicates
high when AP is on. So, bring it back.

Also remove the duplicated GPIO definition (GPIO_PWR_LED1).

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

BUG=chrome-os-partner:23929
BRANCH=nyan
TEST=verified on nyan. successfully boot up the machine.

Change-Id: I293a899bcdf255f36f6117627f66ed8231c9a70f
Reviewed-on: https://chromium-review.googlesource.com/176046
Reviewed-by: Yen Lin <yelin@nvidia.com>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Yung-chieh Lo <yjlou@chromium.org>
Tested-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-11-08 00:53:27 +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
c47e4ec7d1 rambi: Set correct input current limit
Rambi has a 65W adapter, so shouldn't be asking for 4A @ 19V.

BUG=chrome-os-partner:23597
BRANCH=none
TEST=charger command shows I_in = 3392 mA (which is the closest step below
     3.42A that the charger can set).

Change-Id: I4b044b594566a6abcb94c3f674a0d287c8fc2b30
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175611
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-05 02:33:12 +00:00
Louis Yung-Chieh Lo
e297b72563 Refine GPIO list of Nyan.
Refine the GPIO list according to the schematic.  Comment out the XPSHOLD in
power/tegra.c for compiling. Will fix later.

BUG=None
BRANCH=None
TEST=emerge-nyan chromeos-ec &&
make runtests -j 32 && make BOARD=nyan tests -j 32

Change-Id: Id0d682fd5d48e8a8a07785e86c07f45f07d866ab
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175534
2013-11-04 20:44:50 +00:00
Randall Spangler
c1e02ca220 cleanup: Yes, even more TODO comments
Almost done.  Comment changes only.

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

Change-Id: I974dfc12aa264e2035b3bae35a089c19344e7d45
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-04 19:48:49 +00:00
Bill Richardson
2aae9d678a samus: configure both fans
Modify board.h and board.c to describe both fans.

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

Power things up, poke at the fans through the EC console. Observe that
they're both working and controllable:

faninfo
fanset 0 2000
faninfo
fanduty 1 30
faninfo
fanauto 0
faninfo
fanauto 1
faninfo

Change-Id: I2ba9356f084be12dab0fe0b9a004f66feace1878
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175369
2013-11-02 02:06:17 +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
3266ae6a7e cleanup: Even more TODO comments
Update comments with more info, or remove if no longer applicable.

No code changes.

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

Change-Id: I5b56eeb500bc0f00e84e91ef99684f4b1b310972
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175418
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-01 20:07:24 +00:00
Duncan Laurie
fa13ac76b1 samus: Changes for Proto1b
- disable PP1800_PGOOD internal pullup
- add PP3300_DSW_EN control on PF6, turned on in S5 and off in G3
- change PCH_WAKE_L and PCH_PWRBTN_L to open drain signals
- add PCH_BL_EN interrupt on PM3 for rising edge to put backlight
controller into PWM mode, remove 1 second hook
- add samus-specific extpower handler for AC_PRESENT to buffer the
AC_PRESENT input to the new PCH_ACOK output on PM6.  this is driven
high in S5/S3/S0 when AC_PRESENT is high, otherwise driven low.

BUG=chrome-os-partner:23752
BRANCH=samus
TEST=emerge-samus chromeos-ec

Change-Id: Ie8ab538610e41914212ee1f3a6287b63474fb85b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175281
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-11-01 16:16:42 +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
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
Bill Richardson
ea71b8c2a7 samus: set max input current to something safe
If the input current limit is too high the EC sees the AC_PRESENT signal
toggle rapidly, probably due to the adapter browning out. By
trial-and-error, we found a value that seems to stop that happening.

BUG=chrome-os-partner:23449
BRANCH=samus
TEST=emerge-samus chromeos-ec

Let the battery run down a bit, plug the adapter in, watch the EC console to
see what happens. Make sure it doesn't go nuts.

Change-Id: I812685efd312fce82eb117bb722425ae6276fdd1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175037
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2013-10-30 19:44:40 +00:00
Randall Spangler
8eacb8ffe2 rambi: Enable PP5000 at boot
Due to power topology, PP5000 needs to be enabled as soon after
PP3300_DSW as possible.  Since PP3300_DSW is what powers the EC, the
EC needs to turn on PP5000 by default and leave it on.

BUG=chrome-os-partner:23673
BRANCH=none
TEST=reboot ap-off (this boots the EC without doing AP power sequencing)
     gpioget -> shows PP5000_EN=1, PP5000_GOOD=1

Change-Id: I5d493877d330b2543a493f8a2f3411003d5964ca
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174989
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2013-10-30 01:04:43 +00:00
Randall Spangler
fea89f9cd9 rambi: Change WAKE and SCI lines to open-drain
These were being driven push-pull, causing leakage.

BUG=chrome-os-partner:23639
BRANCH=none
TEST=rambi still boots main processor out of reset

Change-Id: I39a18e48307b66fc767ce2c8256d828d4e6962e0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174897
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-29 17:10:22 +00:00
Bill Richardson
f20ed63c17 Rename pwm_data.h to pwm_chip.h
To conform to our mutating naming conventions, let's rename the
chip-specific PWM header file to have the string "_chip" in it.

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

Change-Id: I6584be8e54fd24c8638559817e150c707bc0edb5
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174884
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-10-28 23:38:16 +00:00
Randall Spangler
6aaab6ab0b rambi: Implement battery cutoff command
Needed for shipping systems.  Puts battery into shutdown mode until AC
reapplied.

BUG=chrome-os-partner:23634
BRANCH=none
TEST=With system on battery power, 'battcutoff'.  System will shut off
     after a few seconds.  Power button will not turn it on.  Plugging
     AC power in will turn system back on.

Change-Id: I10a28c3c21623508dc8e4dee1cc5dc8d6fb9a6af
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174888
Reviewed-by: Dave Parker <dparker@chromium.org>
2013-10-28 23:38:12 +00:00
Bill Richardson
7d9ee9a4e9 Fix comments regarding PWM GPIO use
Update the comments in several board.c files to accurately describe which
pwm control circuit is being used for what purpose.

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

No code changes, comments only.

Change-Id: I29cef5a2bfee4d7d44bedd092783d9f1d2ea5ef3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174901
2013-10-28 21:13:08 +00:00
Randall Spangler
9f4c652d40 rambi: Set LED colors based on battery and chipset state
Picked some reasonable values.  Subject to later tweaking.

BUG=chrome-os-partner:23634
BRANCH=none
TEST=On AC power, charging = yellow
     On AC power, done charging = green
     No battery = blinking red
     On battery, AP on = dim green
     On battery, AP off = off

Change-Id: I2eb901ea4de98fec8cd83e403d6ed8a06a2a9ca9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174778
Reviewed-by: Dave Parker <dparker@chromium.org>
2013-10-28 21:13:05 +00:00
Randall Spangler
02a770d5a5 rambi: Enable battery charging
Using best-guess numbers for input current limit.  Battery voltage and
temperature limits are set from actual battery spec.

BUG=chrome-os-partner:23597
BRANCH=none
TEST=battery and charger commands print reasonable info
     battery charges when system plugged in

Change-Id: I812276cbe46c8463a855c7ba3e0bfec4852e6f97
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174766
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-28 21:13:02 +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
c8bcc57aac cleanup: Re-enable keyboard console channel for ARM boards
Originally, the ARM boards printed the keyboard scan matrix whenever
it changed.  This generated a lot of output, so we filtered that at
the console channel level.  When we refactored the keyboard scan
module, that changed so that the scan matrix was not printed by
default, and the 'ksstate' debug command was used to enable printing
it.  But on ARM boards, 'ksstate on' wouldn't do anything without ALSO
using 'chan -1' to turn the keyboard console channel back on.  And
without the scan matrix printing by default, there's no reason to keep
the keyboard channel off by default.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all boards
     bang on keyboard on pit and don't see much debug output
     ksstate on
     now bang on keyboard and see matrix changes

Change-Id: I554b42e7582d507530cdecad7b35df71ca0e634f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174373
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-10-25 01:33:10 +00:00