Commit Graph

765 Commits

Author SHA1 Message Date
Vic Yang
7dd3ee4db3 Keyborg: Switch to HSE
We have a 16MHz oscillator input, so let's use it to save HSI power.

BUG=None
TEST=Build and boot
BRANCH=None

Change-Id: Ia2d97cfc8b97b7f8661112ebbd84952e41b955f2
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200650
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-21 04:07:57 +00:00
Vic Yang
724cfbc6c4 Keyborg: fix bug in slave data processing
This fixes two bugs:
  - The row order on the slave is reversed
  - The last value is missed when transferring data to the master

BUG=None
TEST=Build and check the heatmap
BRANCH=None

Change-Id: Ic51ad1132d948ec6ec68dc673288ec6f29c6ebe7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200621
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-21 04:07:54 +00:00
Louis Yung-Chieh Lo
9e2fac8390 nyan: don't compile in shorthelp of console commands
Since stm32l has smaller flash size, undef CONFIG_CONSOLE_CMDHELP to
remove short descripton to save 2560 byes.
If you need to read the description, grep that in the code.

BUG=chromium:374575
BRANCH=tot,nyan
TEST=buildall and
% grep hey build/big/ec.RO.map
0x000000000000ef48
After shrink -->
0x000000000000e548

Change-Id: I856e89def6456607ade610134bf318d8522f5e4d
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200472
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-05-20 07:34:54 +00:00
Vic Yang
4cb6971daf Keyborg: encode the scanned heat map to fit into RAM
A single frame of the scanned heat map is too big to fit into RAM. Let's
encode it so that we can get the whole frame.

BUG=None
TEST=Touch on various places on the panel and see corresponding results.
BRANCH=None

Change-Id: I8c7c72d5d4a83ebc2018c0abd57075697c931bef
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199940
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-18 02:41:39 +00:00
Alec Berg
09ad49c2bd samus_pd: PD configuration bug fixes
Fix bug to get PD transmit working. Fix config bug
for reading the CC ADCs.

BUG=chrome-os-partner:28350
BRANCH=none
TEST=connect fruitpie and samus via USB-C and run
pd dev on samus and pd charger on fruitpie.

Change-Id: Ic981a1f1e621ef4b69dedc61a02751346274aa4e
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200159
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-18 00:52:02 +00:00
Alec Berg
98af4df0dc samus_pd: remove battery config
Remove battery config since PD chip doesn't talk to battery.

BUG=chrome-os-partner:28350
BRANCH=none
TEST=load on samus and make sure console running normally.

Change-Id: I97174aa3796eaa10b3a5a2bf0aa79a39ba8640ac
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200142
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-18 00:51:59 +00:00
Vincent Palatin
dc37d4a1d5 zinger: fast over-current protection
When the supply output is enabled, ensure that we detect quickly any
over-current situation by setting an analog watchdog in continuous
conversion mode.

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

BRANCH=none
BUG=chrome-os-partner:28331
TEST=plug an electronic load to Zinger and see the OCP triggered
quickly when we go above the current threshold.

Change-Id: I7da50ef242addbd2f4f48f624494daa321ac22b2
Reviewed-on: https://chromium-review.googlesource.com/199924
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-05-17 20:17:25 +00:00
Vincent Palatin
5fd3341077 zinger: add support to flash RW firmware
Allow flashing the RW firmware by sending Vendor-Defined Messages over
the USB-PD link.

This is not the secure update whose design is still under discussion,
it's a simple update with integrity check.

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

BRANCH=none
BUG=chrome-os-partner:28330
TEST=using the following CLs,
./util/flash_pd.py ./build/zinger/ec.RW.flat
and see Zinger booting on RW, repeat the operations with different
builds of the RW firmware.

Change-Id: Icd90eb92f7321ccd66341a50b9dabd73c59c68c1
Reviewed-on: https://chromium-review.googlesource.com/197948
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-05-17 20:14:23 +00:00
Vincent Palatin
006a3f58b0 firefly: update VBUS voltage sensing
The voltage divider resistor values have changes to 10K/100K,
update the code to take this into account.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: I2a1469e3441c4bea2bfe3f3a3b7f8ac2225cca51
Reviewed-on: https://chromium-review.googlesource.com/200343
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-17 06:48:23 +00:00
Vincent Palatin
f025bb66cc firefly: voltage button debouncing
Add a debouncing period on the mechanical switches event detection to
avoid issues in the noisy factory environment.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: I40316c8e32948f92cb92f8743003d5be8cbe8e11
Reviewed-on: https://chromium-review.googlesource.com/200342
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-17 06:48:20 +00:00
Alec Berg
a8688f5e14 samus_pd: fix DMA init bug
Enable clock to syscfg in order to write DMA remapping
registers in pre_init().

BUG=chrome-os-partner:28350
BRANCH=none
TEST=test on a samus board.

Change-Id: I71b7f9b2bdc45f138f404997ccde65f54a1125d0
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200039
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-16 01:56:59 +00:00
Alec Berg
0869221e4f samus: add PD MCU interrupt signal to gpio list
Add PD MCU interrupt signal to gpio list, currently with a dummy
interrupt function which prints a message to let us know it is
occuring.

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

Change-Id: I1fab016b84b1abaced905e0ea0bd35dbd67b30bb
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199792
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-14 22:53:49 +00:00
Alec Berg
6d01f2e169 samus: add PD MCU board
Initial patch for samus PD board. This configures GPIOs to match
samus 1.9.

BUG=chrome-os-partner:28350
BRANCH=none
TEST=none, no boards yet.

Change-Id: Ibc9d67325a1d9699b4e76e2998ab830ddbd0fb98
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199660
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-14 22:53:44 +00:00
Alec Berg
ac78a35cf1 fruitpie: disable battery charging chip ILIM pin
Typically bq24xxx charging chip limits input current to minimum of
register value and ILIM pin. For fruitpie, the current limit will
be decided solely in software, and the hardware pin will be ignored.

BUG=chrome-os-partner:28611,chrome-os-partner:28311
BRANCH=none
TEST=Tested on fruitpie. Verified that current limit can be set
above the ILIM pin value of 500mA.

Change-Id: Ia687446f95f9d18fde9d2b4ebb0e1c093aebf885
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/198940
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-14 20:53:03 +00:00
Alec Berg
ca55e1a6bb samus: disable battery charging chip ILIM pin
Ignore ILIM pin for charging which allows EC to set the input
current limit to anything it desires. This is necessary for
1.9 build because the hardware sets the ILIM to something
like 0.5A.

BUG=chrome-os-partner:28611
BRANCH=none
TEST=none
CQ-DEPEND=CL:198940

Change-Id: I43c57d0040e341e091ee36c97ec601d6bd174606
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199661
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-14 20:52:58 +00:00
Vincent Palatin
aa115bca43 zinger: increase OCP threshold
As per hardware team request, use a higher over-current limit to avoid
false positives due to measurement precision margin.

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

BRANCH=none
BUG=chrome-os-partner:28331
TEST=use a Zinger connected to an electronic load and trigger the
protection.

Change-Id: If031f6f58b9b7119c6fa3fa3273c08f16cbbbebb
Reviewed-on: https://chromium-review.googlesource.com/199552
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-14 18:09:36 +00:00
Bill Richardson
18dcf0989e Samus: Punt on BQ_IBAT measurements for now
Nothing looks at this except for an EC console command, so leave it at unity
gain until we've confirmed that it's working correctly.

BUG=chrome-os-partner:28721
BRANCH=ToT
TEST=make buildall

Change-Id: I81085743535f4664ac8bf1d016bb7562046ab49b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199243
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-05-12 20:02:38 +00:00
Bill Richardson
3f94eba930 Samus: Update configuration for proto1.9
Start of changes to Samus' board.h and board.c to support proto1.9

BUG=chrome-os-partner:28721
BRANCH=ToT
TEST=make buildall

Change-Id: I70590c1f9845430801a6c2939ac92be289750ca3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199242
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-05-12 20:02:34 +00:00
Bill Richardson
9e0cd7b162 Samus: Move single-use constant into the file that uses it.
There's a constant defined in board/samus/board.h that's only used in
board/samus/panel.c. Let's just put it in that file, so it doesn't clutter
up the config.

BUG=chrome-os-partner:28721
BRANCH=ToT
TEST=make buildall

Change-Id: I23d61aff16726a11a0408957cd109b49c3bf954c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199241
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-05-12 20:02:31 +00:00
Vincent Palatin
58c50a970a zinger: invert output control
The electrical design has changed :
the output enable GPIO (PF0) has switched from being the LM5050 shutdown
pin to controlling directly the FET enabling. We need to invert the
control logic and use it in push-pull mode rather than open-drain.

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

BRANCH=none
BUG=chrome-os-partner:28332
TEST=plug a reworked Zinger to a firefly and check the firefly LED is
displaying a solid ON (meaning the voltage is right).

Change-Id: Iee79b07f49eade1fee7cac1986bc38ba21e04b25
Reviewed-on: https://chromium-review.googlesource.com/198240
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-07 03:39:24 +00:00
Vincent Palatin
165c7375da fruitpie: handle dead battery
ensure that the board will get power from VBUS by default, so it can
start-up if it's own battery is fully drained.

Also increase the console stack as the battery code footprint is growing
over time.

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

BRANCH=none
BUG=chrome-os-partner:28311
TEST=plug a Fruitpie without battery to a Zinger.

Change-Id: I971040da9bedb7bf46363787a13220c39a78100d
Reviewed-on: https://chromium-review.googlesource.com/198557
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-05-07 03:39:20 +00:00
Vincent Palatin
b0d1d11655 zinger: implement fault protection
Detect over-current and over-voltage and trigger a fault.

The over-current threshold is 10% over 3A (3.3A).

Only currently implement the slow protection,
the fast interrupt-based one will be done later.

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

BRANCH=none
BUG=chrome-os-partner:28331
TEST=with Zinger connected to an electronic load, adjust the current to
3.35A and see the output voltage cut.

Change-Id: I0e848192392fd73f0839d4bcb806528b2a6b9122
Reviewed-on: https://chromium-review.googlesource.com/197947
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-05-05 18:35:37 +00:00
Louis Yung-Chieh Lo
8980e9a53a blaze: remove from ToT.
Since we already created the firmware-nyan-5771.B branch, we can
remove this from ToT now. But for sure we are still able to
cherry-pick changes back to ToT or from ToT.

BUG=none
BRANCH=tot
TEST=make buildall

Change-Id: I637d27b9f8672c5d17b60e210a5211ab8e19b54a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197165
2014-05-03 02:11:02 +00:00
Bill Richardson
3000fa71a6 Increase some task stack sizes to handle more FP regs.
With change b610695b61, we fixed a problem
with the number of FP regs that were being saved on the stack. That change
decreased the required stack size for non-FP tasks by 64 bytes, but
increased the size needed for FP tasks (such as the lightbar).

The lightbar task was previously using within 64 bytes of its alloted stack,
so handling the task switching correctly meant that it now overflowed.

The hooks task had the same problem, but was hidden by the lightbar task.

This CL bumps the LARGER_TASK_STACK_SIZE up a bit, and switches the lightbar
task to use it instead of the default size.

BUG=chrome-os-partner:27971, chrome-os-partner:28407
BRANCH=ToT
TEST=Try it on both Link and Samus.

Before this change, the Samus lightbar was overflowing its stack every time
the AP booted (causing the lightbar to do things). With this change, it
doesn't. Here are typical stack sizes after this CL:

Task Ready Name         Events      Time (s)  StkUsed
   0 R << idle >>       00000000   28.394913  328/512
   1   HOOKS            00000000    0.534085  640/768
   2 R LIGHTBAR         10000000    5.359356  520/768
   3   CHARGER          00000000    0.094674  384/512
   4   CHIPSET          00000000    0.003353  320/512
   5   KEYPROTO         00000000    0.002814  312/512
   6   HOSTCMD          00000000    0.002942  244/512
   7 R CONSOLE          00000000    0.193776  340/768
   8   POWERBTN         00000000    0.000392  248/512
   9   KEYSCAN          00000000    0.409337  332/512

Change-Id: Ica93608c8adb225410a62ec3a0a27944c479270a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197733
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-05-01 05:47:27 +00:00
Vic (Chun-Ju) Yang
870d15f4d1 Keyborg: Fix column ordering
Column 0 is on the slave side. Fix this.

BUG=None
TEST=Press a finger at the center of the panel. See a single shape in
touch data.
BRANCH=None

Change-Id: Ic3a9a4fafc6e7ee39a1c3422905cf3b1758f335a
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197641
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 21:03:10 +00:00
Vic (Chun-Ju) Yang
306e9a88b9 Keyborg: Disable SWD ports
Most of the time we don't need to use a debugger during runtime. Let's
disable SWD ports so that we can use the two pins for touch scan.

We can still re-flash the chips as long as we hold the reset pin when
entering SWD mode.

BUG=None
TEST=Check we can still re-flash the chips
BRANCH=None

Change-Id: Ieb34406f4bc6d6a753ec840b3072f363c7b17c08
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197196
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:52:07 +00:00
Vic (Chun-Ju) Yang
a0d6ac7166 Keyborg: Refine master slave identification
The current identification method uses SPI_NSS as master/slave
indication. However, if the other chip is not reset at the same time, it
would drive SPI_NSS and fails the identification.

Since the master chip is equipped with USB connection, we can identify
the chips with USB pull up pin, which doesn't suffer from this problem.

Also updates the comments on pin usage.

BUG=None
TEST=Reset the chips repeatedly.
BRANCH=None

Change-Id: Iccd7e73fca85abfa554f90dcb7e354cc4cc04626
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197194
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:49:05 +00:00
Vic (Chun-Ju) Yang
1b7573c3e9 Keyborg: implement matrix scanning
This implements dual chip matrix scanning. Now the scan result is only
dumped to debug output.

BUG=None
TEST=Put a finger on the panel and see its shape.
BRANCH=None

Change-Id: I015c901b42e24fe4a6249c12c37bc5bfcb308c9f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196468
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:49:01 +00:00
Vincent Palatin
ac4238c299 Add support for the Firefly board
Firefly is the test/burn-in board for Zinger production.
It's acting a Power Delivery sink.

The plug polarity is not managed correctly yet.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: I57f525ad04c519f2fa458635a1c6cc45a503e5ac
Reviewed-on: https://chromium-review.googlesource.com/195586
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:45:54 +00:00
Vincent Palatin
bc72ea3e17 pd: handle plug polarity
Use the plug polarity detected by the ADCs to do the PD communication on
the right CCx line.

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

BRANCH=none
BUG=chrome-os-partner:28339
TEST=make buildall
on Firefly, plug Zinger connector in both direction and see it can
control it either way.
on Fruitpie, use CC1 or CC2 and see it can communicate on both.

Change-Id: I81cb00f164cb8194fba73b383014e81c37d975e2
Reviewed-on: https://chromium-review.googlesource.com/197520
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:42:52 +00:00
Vincent Palatin
439bfbdded pd: update policy, timeout and board callbacks
Slightly modify interfaces for better sink-only devices implementation
(eg Firefly)

update the host mode management and the voltage selection
and add a hook for board checks.

Simplify the reception timeout and fix other timeout detections.

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

BRANCH=none
BUG=none
TEST=make buildall
and use with the follow-up firefly board configuration CL.

Change-Id: I0240295764c8605793dc80a2fc21357af1740744
Reviewed-on: https://chromium-review.googlesource.com/195585
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-30 09:42:48 +00:00
Alec Berg
b57137dcac stm32: pd: add config option to use SPI master for USB PD trasmit
Added config option CONFIG_USB_PD_TX_USES_SPI_MASTER which switches
to use SPI master for PD transmit. The advantage of SPI master mode
is at the end of the tranmission, we don't have to send any dummy 0
bits. When the option is set, the CPU_CLOCK must be set to 38.4MHz,
so that the SPI master can generate the correct clock frequency.

BUG=chrome-os-partner:28309
BRANCH=none
TEST=Tested by connecting two fruitpies together across CC1. One
fruitpie has been modified such that the MISO and MOSI lines are
swapped and is running PD TX in SPI master mode with 38.4MHz clock,
while the other is running PD TX in SPI slave mode. On EC console
ran pd charger on one board and pd dev on other board. Verified
that communication works with no errors. Ran for 10 minutes in each
configuration.

Change-Id: Ib24030d34d95d59f4ac6c2dae98bf7adda1ada01
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197215
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-29 03:11:12 +00:00
Dave Parker
6f21e3f5c1 Rename battery_vendor_params() to battery_override_params()
Charger V1 only. This is a clearer name for the intent of
the function to override the charging parameters requested
by the battery. This also disabmiguates this function with
a new host command to get and set arbitrary vendor
parameters in the battery.

BUG=chrome-os-partner:25145
BRANCH=ToT
TEST=`make buildall -j`.

Change-Id: I1e8762d359c0e91c5b2a539553d22c12c9850c03
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195823
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197164
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-04-29 03:11:05 +00:00
Vincent Palatin
5aeff69cdc zinger: remove race condition in event handling
In the micro runtime for Zinger, wait for events with interrupt disabled
to avoid race conditions where the event interrupt happens just after we
tested it and before going to sleep.

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

BRANCH=none
BUG=none
TEST=make BOARD=zinger, test Zinger PD communication from Firefly.

Change-Id: I10b919450a61fac7ea50e84dd73bcc568150e179
Reviewed-on: https://chromium-review.googlesource.com/197051
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-29 03:10:59 +00:00
Vic (Chun-Ju) Yang
e99512a456 Keyborg: increase UART baud rate to 38400
We are running a minimal runtime with less overhead. This allows us to
run UART at 38400 bps. Let's update the config for easier debugging.

Also fix a potential underflow bug.

BUG=None
TEST=See debug output at 38400 bps
BRANCH=None

Change-Id: Ic9e4f9d545f5dbc4a0816a843b0f01a4cf219666
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196190
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-24 11:36:53 +00:00
Vic (Chun-Ju) Yang
632d005090 Keyborg: chip-to-chip SPI communication
This implements a simple SPI driver for the two chips to exchange
packets.

There are both sync interface and async interface. Sync interface is
easier to use, and async interface frees the CPU while the DMA takes
care of the communication.

BUG=None
TEST=Hello test passed
BRANCH=None

Change-Id: I9823bad5cae6d1fa8f3658d17af4b998d3735a3e
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195533
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-24 11:36:49 +00:00
Vic (Chun-Ju) Yang
d02e8c2090 Keyborg: Implement master/slave identification
The two chips work together, so let's teach them how to tell master from
slave. After identification, the two chips shake hands through the two
sync signals.

BUG=None
TEST=Disable handshake on master. See slave fail. Vice versa.
BRANCH=None

Change-Id: Idb6a56128f608dd2ee5c453f75abea475fe1779f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195395
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-24 11:36:43 +00:00
cloud_lin
295e409ea9 Big: Correct the charger IC driver
Add bq24735 driver and move to here for further developing

BRANCH=big
BUG=None
TEST=test basic charing/discharging function

Change-Id: I66c22a29cf94383cec86c5cf53db82494504fa77
Reviewed-on: https://chromium-review.googlesource.com/196541
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Tested-by: Lin Cloud <cloud_lin@compal.com>
Commit-Queue: Lin Cloud <cloud_lin@compal.com>
2014-04-24 08:35:03 +00:00
Louis Yung-Chieh Lo
2e7ea4efdb battery: move cut-off commands to common/battery.c
So that host and EC commands will be defined in common/battery.c.
The board-specific battery.c can focus on the proprietary method.

BUG=chrome-os-partner:28248
BRANCH=tot,nyan
TEST=make buildall runtest
Tested "cutoff" in EC console on big.

Change-Id: I213c0d601d0241c8dea309d6ac60c72452d2d100
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196621
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-04-23 22:59:51 +00:00
Louis Yung-Chieh Lo
67698db7da nyan: add info_precharge for drained battery
Charger v2 assumes the battery_get_info() always returns non-NULL even
if the battery is not detected, for example, in the over-drained
situation. Thus, add a new struct so that we know what the conservative
setting is to pre-charge the unknown battery.

BUG=chrome-os-partner:28112
BRANCH=nyan,big,blaze
TEST=See issue tracker for the test procedure.

Change-Id: Ica4fe75d154e2f195eb1da19ba045346da383b6c
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195596
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
2014-04-22 20:27:01 +00:00
Dave Parker
4b530d9fce Squawks: Adjust charge thresholds for altering LED behavior
The EC and host have different ways of computing and presenting
the battery charge level. This change adjusts the charge levels
at which the charging LED indicates a full and low battery to
match what is presented to the user in the host UI.

BUG=chrome-os-partner:27743,chrome-os-partner:27746
BRANCH=rambi,tot
TEST=Run "battfake 91" which charging, verify charging LED turns
green and the UI reports 95%.
Run "battfake  13" while discharging, verify charging LED blinks
amber (1 sec on, 1 sec off) and the UI reports 10%.

Change-Id: Iaffffb57a7fbfd14ebb90363cbd4aa1a9becf022
Original-Change-Id: I203c90a65e4aa2907a14077a9276674ecfa292f2
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194347
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195848
2014-04-22 00:47:29 +00:00
Vic (Chun-Ju) Yang
bd1a3ffeaf Add STM32TS60 support
This chip got small flash and RAM, so the common runtime is disabled.
Now the code only boots and print something every second to check debug
console and timer are good.

BUG=None
TEST=Boot and see console output
TEST=make buildall
BRANCH=None

Change-Id: I01150e8250a404628d1a3b81e677ac4c29782d7f
Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195382
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-20 17:52:28 +00:00
Devin Lu
35b214c1b3 blaze: add ectool discharge command
just picks up this commmand for factory.

BRANCH=ToT
BUG=None
TEST=Run ectool chargecontrol command with each option (normal,
 idle, discharge) on blaze. Verifiy battery can discharge.

Change-Id: Id57b42796a26aaf85258048260d06923b78f0773
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195535
2014-04-18 21:32:57 +00:00
Louis Yung-Chieh Lo
2e41eb9eb9 tegra: move to charger v2.
This would move all tegra boards to charger v2.

Also removed the unnecessary charge_keep_power_off(), which was
designed for USB power port and doesn't apply to Tegra platform.

BUG=none
BRANCH=nyan,big,blaze
TEST=build and run on nyan.

Change-Id: I9517a8885726ad6dce5a2865402da4b9551e009f
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/194384
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2014-04-18 21:32:53 +00:00
Devin Lu
21d46dc03e blaze: implement the power and battery LED behavior
Add LED behavior for blaze that will the same as falco and kip.

BUG=None
BRANCH=ToT
TEST=manual
  Check battery LED show Amber when battery in charging.
  Check battery LED show white when battery fully.
  Check battery LED show blinking every 500ms when charging error.
  Check PWR LED light when system power on.
  Check PWR LED off when system power down.
  Check PWR LED will blinking every 1sec when system into suspend.

Change-Id: I830952361d3282ff78d29a9a33bd09b64b093ee1
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/193744
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
2014-04-17 16:38:51 +00:00
Devin Lu
bb16a63539 blaze: add battery configuration
Set battery cut off command and config battery configuration for blaze.

BUG=chrome-os-partner:27120
BRANCH=ToT
TEST=manual
  build ec and flash to blaze board,
  verify battery works.
  Verify battery cut off function is workable.

Change-Id: I2e1f7de9c6370a2a02fb56fc4520f4bc062b4d6b
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193000
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
2014-04-17 16:38:47 +00:00
cloud_lin
ccdce3f83d big: Modify LGC battery setting based on battery spec
1. Modify voltage_max
2. Set CP point

BUG=chrome-os-partner:27859
BRANCH=Big
TEST=Plug in AC and battery, use UART command "charger" to check
v_batt and I_in and the values are correct.

Change-Id: If83a444338e8d520e6c2f4d04ca6016c14cea8bd
Reviewed-on: https://chromium-review.googlesource.com/193584
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Lin Cloud <cloud_lin@compal.com>
Tested-by: Lin Cloud <cloud_lin@compal.com>
2014-04-12 05:54:04 +00:00
Vincent Palatin
a1e8b316db Zinger board configuration
Add the USB Power delivery PHY configuration,
and all the pins and details to use the real Zinger
board.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: Ic2d3616c9fd2bf3ebeccba74a5519697e7c3e899
Reviewed-on: https://chromium-review.googlesource.com/194220
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-12 01:45:51 +00:00
Vincent Palatin
6c6276fd45 FruitPie board configuration
Add all the pins configuration to use the real FruitPie board
and the USB Power Delivery configuration.

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

BRANCH=none
BUG=none
TEST=make BOARD=fruitpie

Change-Id: I8c20118400cb6a2e26b541a9ee2da5b706299fcf
Reviewed-on: https://chromium-review.googlesource.com/189862
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-12 01:45:47 +00:00
Bill Richardson
9814e54204 Increase test coverage of charge_state_v2.c
This improves some of the smart battery mocks, and adds some more tests for
the new change state machine.

BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=make coverage

Line coverage of this file jumps from 53% to 93%.

Change-Id: I4a9b8818cefaffd3022cebe08a36d592b0611295
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193690
2014-04-11 15:37:53 +00:00