Commit Graph

317 Commits

Author SHA1 Message Date
Randall Spangler
c2b94fd184 Move files in preparation for merging keyboard_scan modules
This is part one of a series to merge the keyboard scan interface to
be common across all platforms.

This change just moves and renames files and APIs and removes some
read code, and sets up protocol-specific CONFIG options.  It makes the
next CL which actually merges keyboard scanning easier to parse.

BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link

Change-Id: I815a40aae4e5d5f333b8501aff9656080533d913
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46549
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-27 11:35:20 -07:00
Todd Broch
0a2603e8ea spring: Enable low power mode.
This mode was disabled initially to make sure it didn't side-effect
things during early development.  Now that branch is cut lets
re-enable and backport when stability is proven.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=spring
BUG=chrome-os-partner:17587
TEST=manual, install & run on Spring ... system functions.

When device is plugged stays awake regardless of battery state.
When device is unplugged sleeps and power is saved.
When device is re-plugged awakes.

Change-Id: I9a85fa7376d1a94c9864beed3d053e8b49480959
Reviewed-on: https://gerrit.chromium.org/gerrit/45594
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2013-03-26 18:03:20 -07:00
Randall Spangler
10ac310605 Move keyboard dimension and key constants to keyboard_config.h
These were previously duplicated between multiple keyboard_scan.c and
board.c files, and there were a bunch of different constants #defined
to be 13.

BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link

Change-Id: I91bf9d56d2a56ff25ff307ff10883ca87b6937e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46165
2013-03-22 11:24:29 -07:00
Randall Spangler
743c05f01f Add keyboard_raw interface
This is the low-level platform-dependent interface to drive keyboard
columns, read rows, and handle keyboard interrupts.

Both lm4 and stm32 had something like this before, but the interfaces
weren't fully explicit or compatible.

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

- Build all platforms.
- Boot system and test typing on keyboard.
- Hold power+refresh+esc to test boot key detection; should go to recovery.

Change-Id: Ie3bcc1d066a4da5204f0e236daeb52c4064a6213
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46156
2013-03-22 11:24:28 -07:00
Vic Yang
89ad54d2b2 spring: minor cleanup of USB charging code
No functionality change.

This includes:
  - Breaking the way-too-long function into multiple functions
  - Less verbose logging code

BUG=none
TEST=Build and check USB charging still works.
BRANCH=spring

Change-Id: I8524cb3da9a0e90427664e839ce33d3abe0263a0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45842
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-20 23:47:46 -07:00
Vic Yang
a0661f6742 spring: disable boost when AP is off and no charger is attached
When AP is off and no charger is attached, we can safely disable boost
to save power.

BUG=chrome-os-partner:18305
TEST=1. AP off, no charger     -> BOOST_EN 0
     2. AP off, with charger   -> BOOST_EN 1
     3. AP on, no charger      -> BOOST_EN 1
     4. AP on, with charger    -> BOOST_EN 1
     5. AP on->off, no charger -> BOOST_EN 1->0
     6. AP off->on, no charger -> BOOST_EN 0->1
BRANCH=spring

Change-Id: I7ff49e51057126490d09a3f0b1be2c60ca6a9bd3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45830
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-20 23:47:43 -07:00
Vic Yang
db20e7afde spring: keep AP off when battery level is too low
When battery level is too low, we want to keep the AP off even when a
power on event is received. Current threshold is set to 1 mAh.

Note that after this change, a board without a battery will need to wait
for 15 seconds before it can boot up.

BUG=chrome-os-partner:18318
TEST=Press power button and see power on event ignored. Charge battery
to over AP off threshold and check we can power on the system.
BRANCH=spring

Change-Id: If32a1935a69be102778bde7ad8976eea0921f87e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45825
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-20 23:47:40 -07:00
Randall Spangler
447b05b828 Move asserting host keyboard interrupt signal to keyboard_scan
The implementation is identical on all stm32 hardware, so remove all
the duplicate copies from board.c files.  mccrosskey doesn't have
GPIO_EC_INT so stub it out like we do on bds.

No functional change, just moving code.

BUG=none
BRANCH=none
TEST=build mccrosskey,daisy,snow,spring

Change-Id: I7d4378650d7b4c640c15180c41459a41620f5bd3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45920
2013-03-20 17:42:04 -07:00
Randall Spangler
22ff9df913 Move battery LED code on spring to common
It's not board-specific, so move it out of board.c.

No functional changes; this is just moving code and renaming a few functions.

BUG=chrome-os-partner:18256
BRANCH=none
TEST=build spring

Change-Id: Ib004066aed93745cb0c96d3cb45d70b728545492
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45918
2013-03-20 17:42:04 -07:00
Randall Spangler
f8393fab2c Move gaia event handler declarations to gaia_power.h
This removes duplicated code in 3 different board.c files.

No functional changes, just moving declarations.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build daisy,spring,snow

Change-Id: Ie6266dca7d7d160e154fce1a09452e5cc9a1095c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45898
2013-03-20 17:42:03 -07:00
Randall Spangler
78b0e9863d Use chipset_reset() interface instead of system_warm_reboot()
We have a common chipset interface for performing a warm reset of the
AP, so move the implementation from system_warm_reboot() there.  (It
was never a system function anyway; system = EC+AP; chipset = AP)

No functional change; just renaming functions.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build daisy,snow,spring,mccroskey

Change-Id: Ibc2c5efced5660c4335cd1868470184397800acd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45891
2013-03-20 15:23:29 -07:00
Randall Spangler
34e17d4c05 Move I2C arbitration to its own file
It's only board-specific in that we've only needed it on snow so far.
But by that logic, x86_power would be board specific because we've
only needed it on link.

No functionality change, just moving code between files and renaming
the interface to indicate it's not board-specific.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build daisy,snow,spring

Change-Id: I35debdaa71829d55a2fbc5d3c62b2aaf6e467633
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45879
2013-03-20 15:23:29 -07:00
Vic Yang
19920f1f74 spring: reset TSU6721 when Toad's ID changes
When Toad's ID changes, VBUS goes low for 10ms. This, however, is not
picked up by TSU6721 and thus we need to monitor VBUS and reset TSU6721
when necessary. By resetting TSU6721, we can force it to update device
type.

BUG=chrome-os-partner:18292
TEST=manual
BRANCH=spring

Change-Id: Ib96bbb0f101c8c5f5371591603af2dee27f01cc8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45727
2013-03-20 01:02:09 -07:00
Randall Spangler
f8d5958b6f Fix spring not compiling
Apparently the presubmit queue isn't building Spring firmware?  My
change and Vic's collided and TOT doesn't compile.  This fixes it.

BUG=none
BRANCH=none
TEST=build spring

Change-Id: I3903c7dce741d4395d0d71585da4332b47f62aba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45901
2013-03-19 18:03:33 -07:00
Vic Yang
6e07f94c90 spring: More stable battery LED control
This includes:
  - Discharging with AC present now recognized as battery assist mode
  - Trigger LED update every second instead of from PMU task
  - Minor breathing effect optimization
  - Control LED power and color from the same task to prevent
    simultaneous access to LED driver

BUG=chrome-os-partner:18244
TEST=Manual
BRANCH=spring

Change-Id: I9b34934f46cd4f04aaa7ca30cbe90316aec3e61e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45632
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-19 14:59:47 -07:00
Randall Spangler
24f0d888dd Use common declaration of keyboard_scan_interrupt()
Code cleanup: declare keyboard_scan_interrupt() once, not per board;
the implementation is common anyway.

No functional changes; just renaming.

BUG=none
BRANCH=none
TEST=build daisy,snow,spring,mccrosskey

Change-Id: I1e33cbe2c868bc47b641d36d26f07c3b5a7ba3c7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45874
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-19 14:59:32 -07:00
Randall Spangler
a3c2a73226 Rename board_get_ac() to extpower_is_present()
Code cleanup; use the same function names to mean the same thing
across boards.  No functional changes; just renaming.

BUG=none
BRANCH=none
TEST=build daisy,snow,spring

Change-Id: Icbb4cfda5f5f9ba0cbbc07fee622e9c21af3f8cd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45867
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
2013-03-19 14:59:31 -07:00
Randall Spangler
9ddb7e0708 Rename tasks to HOOKS and CHIPSET
Rename tasks

TICK -> HOOKS
  The hooks task handles more than just the TICK hook now.

X86POWER -> CHIPSET
GAIAPOWER -> CHIPSET
  Kinda kludgy that the name of the task controls which chipset source gets
  included.  Change this to a CONFIG_CHIPSET_{X86,GAIA} #define to make it
  easier to support future chipsets.  Also, rename the task function to
  chipset_task() so ec.tasklist is chipset-agnostic.

No code changes, just renaming constants and functions.

BUG=none
BRANCH=none
TEST=build bds,link,daisy,snow,spring

Change-Id: I163ce1cd27b2d8d030d42bb1f7eb46b880c244fb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45805
2013-03-19 10:31:12 -07:00
ChromeOS Developer
6c285c0994 Move external power detect for link to its own file
Now that it doesn't need to leverage SWITCH_TASK to send the AC_CHANGE
notification, pure GPIO-based external power detection can move from
switch.c to its own file.

BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away

Change-Id: Id495f34185b7d971c241ac6d0a8311a6bf544507
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45789
2013-03-19 10:31:12 -07:00
Vincent Palatin
f2df09d602 spring: set boost PWM frequency to 32Khz
Push the PWM frequency outside the audio band to avoid audible whining.

Also fix the off-by-one in the PWM frequency computation.

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

BRANCH=spring
BUG=chrome-os-partner:17583
TEST=manual : probe the PWM output with a scope.

Change-Id: Ie1c8c5aed72bef46c8bac16c1bf3007e8e9573bb
Reviewed-on: https://gerrit.chromium.org/gerrit/45584
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-15 11:02:49 -07:00
Randall Spangler
744cada9d5 Rename power_led.c to onewire_led.c
No code changes, just renaming to make the filename more useful.

BUG=chromium-os:18256
BRANCH=none
TEST=build link.  Plug in AC.  See plug LED come on.

Change-Id: I00d9f222de0b097bb68ef235bc6b0015e4c62f7e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45494
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-14 15:44:15 -07:00
Vic Yang
10d845eb10 spring: Fix a bug that yellow LED is not turned off
When leaving breathing mode, we should switch yellow LED from lighting
engine back to PWM control.

BUG=chrome-os-partner:18244
TEST=Check yellow LED leaves breathing mode
BRANCH=spring

Change-Id: I39260ac9040baaf193ce95eec7941aeb6d97e7e8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45436
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-14 11:27:14 -07:00
David Hendricks
94f4bb38a0 Initial McCroskey support
This adds a board target for McCroskey. It is loosely based on
Snow.

The clock will be set up differently and the keyboard GPIOs are
not the same, so some stm32 code needed to be updated.

BUG=none
BRANCH=none
TEST=tested on McCroskey (we get to the serial console)
Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I5e11a3257fed1797f4cc4dcccf3530585b78da82
Reviewed-on: https://gerrit.chromium.org/gerrit/43414
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
2013-03-13 16:05:39 -07:00
David Hendricks
cdfbe88e92 stm32: list keyboard output ports on a per-board basis
This CL moves the keyboard port listing to board.h for each mainboard
to reduce board-specific clutter in keyboard_scan.c. Since the info
is now exposed outside of keyboard_scan.c, a more descriptive name was
chosen.

Note: GPIO_D does not need to be included in this list for any current
platform.

BUG=none
BRANCH=none
Test=tested on Snow by pressing all number and letter keys

Signed-off-by: David Hendricks <dhendrix@chromium.org>

Change-Id: I1ce924a41cafae557467997ecba9c5abeed86211
Reviewed-on: https://gerrit.chromium.org/gerrit/45284
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
2013-03-13 12:12:01 -07:00
Todd Broch
eefc0ac8c5 spring: stm32: Generate battery key when charging status changes.
In order to update charger status we have added a virtual keystroke to
signal change to the kernel via the MKBP interface.

CL creates the virtual key press and calls it from within the
USB charging code.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BUG=chrome-os-partner:17927
BRANCH=spring
TEST=manual

1. Compile for daisy,snow,spring.
2. Test on spring.

Change-Id: I0afa0fc82c96fa3fd8119523a113b5028c8f64a3
Reviewed-on: https://gerrit.chromium.org/gerrit/45126
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
2013-03-13 11:14:55 -07:00
David Hendricks
f5f30a22c6 stm32: Move KB_INPUTS to board.h
This moves KB_INPUTS from keyboard_scan.c to board.h where KB_OUTPUTS
is #defined. Although we use the same 13x8 keyboard matrix on all
platforms, KB_OUTPUTS is defined on a per-board basis due to its usage
in keyboard_test.

BUG=none
BRANCH=none
TEST=locally compiled

Change-Id: I0d66705d2959c7824b96cc8aae55368eca39a21a
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44970
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-11 22:08:56 -07:00
Vic Yang
4ac742b4d5 spring: Fix ID_MUX polarity
This reflects the change of the ID_MUX polarity.

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

Change-Id: Iea126149f8785a0f028221463d197c63b39a3bd7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44945
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-08 12:01:46 -08:00
Vic Yang
a44e0d91c8 spring: support new ID detection circuit
This enables the EC to switch the signals to ANX7808 properly.

BUG=chrome-os-partner:18165
TEST=Manual on reworked Spring board
BRANCH=none

Change-Id: Ib3ff57e17afab9ba8fc78fdb037e65aae844f38b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44897
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-08 00:07:07 -08:00
Jeremy Thorpe
f568b82321 Rename CODEC_INT to ID_MUX.
Rename CODEC_INT to ID_MUX and let it be settable on the EC command line.  This
GPIO line controls the ID line MUX in Spring.

BRANCH=spring
BUG=chrome-os-partner:16196
TEST=manual

Change-Id: Ib29f31cf5dd28f5166236b5f98560543298b083b
Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44531
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-07 20:37:33 -08:00
Vic Yang
fa144d8ac0 spring: avoid AC bad when load suddenly increase
To avoid AC bad condition when system load suddenly increase, we should:
  - Keep VBUS voltage at reasonable level on battery assist
  - Allow PWM to bring VBUS voltage up before asserting AC bad

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

Change-Id: I8058ffba9f91550f22408ea25911a1dded835584
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44612
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-05 18:42:26 -08:00
Vic Yang
03a1da3b65 spring: switch default current limit mode to aggressive mode
Measurement result for aggressive mode looks good. Let's switch to it by
default.

BUG=chrome-os-partner:14319
TEST=Boot and check current limit mode.
BRANCH=none

Change-Id: I117170aaea8c3a3304dc27815ffb429fff2f22c7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44607
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-05 18:42:26 -08:00
Vic Yang
1866d471f4 spring: battery LED breath yellow on battery assist
When in battery assit mode, show breathing yellow on battery LED slowly
to indicate battery is actually discharging.

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

Change-Id: I688470d8870b181bf2dd20b5ebcbd6e2d861c5b0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44514
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-04 16:44:48 -08:00
Vic Yang
6249a40069 spring: set maximum allowed duty cycle
We should allow a minimum amount of current input in case the
battery is dead.

BUG=chrome-os-partner:14319
TEST=Boot with a dead battery
BRANCH=none

Change-Id: I3c172d43c8190ed2dc5d421dcf2b5aaf0e88ecd9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44510
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-03-04 16:24:56 -08:00
Vincent Palatin
2cf4d02acd keep ADC reference voltage on between successive reads
To decrease the amount of time needed for PMU ADC reads, add the option
to keep the ADC reference voltage enable as its stabilization time is
the longest pole.
Also set the stabilization time to 10ms as the max defined in the
datasheet.

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

BRANCH=none
BUG=chrome-os-partner:17997
TEST=on Spring, measure EC_CMD_POWER_INFO latency and see it going from
49ms to 18ms.

Change-Id: I7ed20bcddab165250108eb9f768539b19fa251de
Reviewed-on: https://gerrit.chromium.org/gerrit/44008
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-25 22:22:34 -08:00
Vic Yang
998c0344b5 spring: a more aggressive current control approach
Currently we stop raising current input when a predefined limit is
reached. To take advantage of high power charger, we now push the limit
and detect over current shut off if any. This allows us to detect the
actual current limit of the charger.

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

Change-Id: I5aefd8c0ac02bd0ca9920e861a4fa62fc6e588e5
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43863
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-25 22:22:33 -08:00
Vic Yang
17e84f1589 spring: Avoid picking up USB power from AP
When powered device is removed, VBUS is still powered by the AP. We
should turn off power from AP and let it settle before we sense external
VBUS input.

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

Change-Id: Ie868a3df27e395c948ba8c6342e84764d182ce82
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43779
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-22 21:56:27 -08:00
Vic Yang
6492c99cca spring: Tweak current limit and voltage threshold
Fine tune current limit and voltage threshold so that we don't hit
current limit so easily.

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

Change-Id: Ia9ccd13b9e7eac7cdee83d0f488a1a83c27318c0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43716
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-21 21:16:44 -08:00
Vic Yang
517d4d771b spring: Handle AP VBUS power
The VBUS power from AP is now incorrectly recognized as AC source. Let's
gate this with device type and BOOST_EN.

BUG=chrome-os-partner:14319
TEST=Manual
BRANCH=None

Change-Id: Id8127ab6f85fb25adfadb1c2bef4c753a58cdc4f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43709
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-21 21:16:43 -08:00
Vic Yang
070943e9bf spring: Handle dead battery and booting with low power charger
This tweaks initial PWM configuration so that:
  - When battery is dead, more current is allowed to sustain the system.
  - When EC boots with a low power charger, input current is throttled
    so as not to kill the charger.

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

Change-Id: Ib52894b07fecdd533aecab312f40afa0b6df5676
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43600
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-20 09:22:43 -08:00
Vic Yang
95253a68dd spring: Add current limit loop
This monitors input voltage and adjust current limit accordingly to keep
voltage in acceptable range.

BUG=chrome-os-partner:17881
TEST=Manual on spring
BRANCH=none

Change-Id: Ie4b44844983f622ef7f648cf022c3c093597246c
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43511
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-20 09:22:40 -08:00
Vic Yang
aab9accfce spring: Add host command to read power info
Getting voltage and current can be handy when verifying hardware design.
Let's add host command to do this.

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

Change-Id: I4d4f6a42a9d0f917292d092e132ccd9ce3367fd6
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/43508
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-19 23:01:10 -08:00
Vincent Palatin
154c73f32d spring: always enable the PP3300_WWAN rail
The kernel driver to control the 3G modem LDO is not submitted yet.
Let's hardcode it for now to enable RF testing and revert this patch
later.

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

BRANCH=none
BUG=chrome-os-partner:17790
TEST=on Spring, boot and dump the TPS65090 configuration from the EC
command line by using "pmu" command.
See 0x1f in the register 0x11 for FET3.

Change-Id: I29aa7d1d7fb819ff1881a756e9592e272e87ad0b
Reviewed-on: https://gerrit.chromium.org/gerrit/43181
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2013-02-13 11:58:41 -08:00
Vic Yang
c93378dafa spring: Distinguish Apple Chargers
This uses D+/D- voltage to distinguish different Apple chargers.

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

Change-Id: I50075d466f6e6b1adf613748cf433d7f43c04bfe
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42850
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-07 22:06:05 -08:00
Vic Yang
e9c3b705d5 spring: Tweak battery LED policy
When battery is nearly full, we sometimes see:
  - Battery asks for no current, but slowly discharge (5-7 mA)
  - Battery asks for current, but not charging.
For these cases, we consider the battery full and show green LED.

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

Change-Id: I2808d4c1a89d37000244fb308197cdef473ec5be
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42688
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-05 23:20:17 -08:00
Vic Yang
e955c62792 spring: Limit USB port current
BUG=chrome-os-partner:14319
TEST=Attach different chargers and see corresponding PWM duty cycle set.
BRANCH=none

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

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

Change-Id: I7fa8242efa4d0382d8ef0cafe80f01d44c390397
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42607
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-02-05 20:16:17 -08:00
Vic Yang
a3ac2583a4 spring: Change PWM frequency
Current frequency is too low. Change it to 10kHz.

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

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

Change-Id: Ibae11a0cf8a724a38e96c5c49952799101bb5764
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41693
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-21 20:25:47 -08:00
Vincent Palatin
f0cd8251cc spring: remove hardcoded TPSchrome FET settings
Activate the pass-through for TPSchrome LDOs settings
and remove hard-coded values used for bring-up.

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

BRANCH=none
BUG=chrome-os-partner:14314
TEST=on Spring, with an updated bootloader, see the screen is still
coming up.

Change-Id: I7fe67640e66939b1a19074b54d81d64459a34f4a
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41296
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-01-18 10:56:27 -08:00
Vic Yang
92bf81948d spring: Control BOOST_EN according to device type
BOOST_EN should be turned off when attached device needs power.

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

Change-Id: Ic8d75bdad98eb33ab99792345ddfd90609a1ddbd
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40200
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-08 08:58:38 -08:00