Commit Graph

1889 Commits

Author SHA1 Message Date
Bruce
7b3032b1c7 Chell: modify led setting for OEM spec
Modify the led blink white at battery capacity less than 12%.

BUG=None
BRANCH=None
TEST=check the led blink white at battery capacity less than 12%

Change-Id: I3494ed7d207e769fe081b4442fd298b4e481e0a7
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/319729
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-01-05 23:39:06 -08:00
Mulin Chao
8d99bd9345 wheatley: Add CONFIG_LTO definition to reduce FW size.
Add CONFIG_LTO definition to reduce the size of FW image.

Modified drivers:
1. board.h: Add CONFIG_LTO definition.
2. header.c: Add __keep keyword to prevent linker ignore header during
optimization.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I6205af37572a68f35f90dbd9b28d86230533ca8b
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/319799
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-30 20:40:48 -08:00
Kevin K Wong
eebef1b8fd kunimitsu: add debug assert flag
Restore debug assert flag which was previously removed due to limited
code space.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I9617b1221bc6217e8f8ed745ea0ce12418233440
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/319606
Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-30 15:29:06 -08:00
Shawn Nematbakhsh
2c0843e845 chell / chell_pd: Use power-optimized GPIO defaults
Pull floating pins high, don't duplicate external pull ups, and make a
few other minor changes.

BUG=chrome-os-partner:48109
TEST=Verify chell continues to boot and S5 power is reduced to
~5.5 mW.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Iaee0cc926149dae1f4189e6b9e4f7e3a4da6ba1c
Reviewed-on: https://chromium-review.googlesource.com/319165
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-24 01:43:00 -08:00
Mary Ruthven
8b3090c1bd lucid: add LED support
Implement LED control for lucid with red, blue, and green LEDs.

BUG=chrome-os-partner:48661
BRANCH=none
TEST=make sure lucid builds

Change-Id: I97ed56daa8fdb40daf8ab06e53913dcff2e41dea
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/319224
Commit-Ready: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-22 21:07:25 -08:00
Mary Ruthven
68a4b3a4b2 lucid: implement fast charging
Use custom charging profile to enable charging at a faster rate.

BUG=chrome-os-partner:48662
BRANCH=none
TEST=load on lucid and charge at room temp. Use "chgstate" command to
verify that battery current matches the expected fast charging current
for the given temp range and voltage.

Change-Id: Ie508d29db091593ff2cfda9d135c73f6a3de5a9a
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/319493
Commit-Ready: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-22 21:07:24 -08:00
Alec Berg
861ead29bb lucid: remove some unnecessary features to save space
Remove ADC watchdog and i2cscan console command to save
flash space.

BUG=none
BRANCH=none
TEST=make BOARD=lucid

Change-Id: I3da8a13fdd962041ccdc830cb1b9b5803917bc2b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/319611
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2015-12-22 21:07:24 -08:00
nagendra modadugu
617fb66fc7 Move rand_bytes implementation from tpm2 to chip/g.
BRANCH=none
TEST=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
Signed-off-by: nagendra modadugu <ngm@google.com>

Change-Id: Ic7a850fdf2594ac1981237edda8dceb16cc7cbe6
Reviewed-on: https://chromium-review.googlesource.com/319155
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-12-22 13:12:53 -08:00
Ryan Zhang
8623942335 Lars: Update battery settings
Update battery settings from battery spec.

BUG=chrome-os-partner:48571
BRANCH=lars
TEST=`make -j BOARD=lars`, OS and EC shutdown normally without AC,
Charging normally.

Change-Id: I4b8fad8ab993f2ea5190898088bd1bd8c2bd7abb
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/318611
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2015-12-18 04:45:40 -08:00
li feng
51811325d2 Kunimitsu: enable power threshold checking in power up
In 0% battery case, if the charger can provide power at least
15 Watt(CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW), will allow system to
boot up.

BUG=chrome-os-partner:48339
BRANCH=none
TEST=Verified in Kunimitsu system, system with 0% battery can boot up
normally once charger power is 15 Watt.

Change-Id: I0c7b23d4ac1e7bd2807ceeb068fc9018a99a03c4
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/318891
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-16 21:49:26 -08:00
Ryan Zhang
c14a2c3e72 Lars: Update LED settings
LEDs are high active now.

BUG=chrome-os-partner:48552
BRANCH=lars
TEST=`make -j BOARD=lars`, LEDs blink normally.

Change-Id: I9a96d4347ebfaa698c762f3c55db0c8d2133ec73
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/318603
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-16 15:07:20 -08:00
Bruce
c48f8c3af3 Chell: modify led setting for led test command.
BUG=None
BRANCH=None
TEST=the test command can control led.

Change-Id: Iaae49f35953448e2472196ba9b6411fe8d9487b4
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/318165
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-16 03:35:41 -08:00
Ryan Zhang
d270d40d10 Lars: Add ALS console-command
To make debug easier.

BUG=None
BRANCH=lars
TEST=`make -j BOARD=lars`, OS can boot up normally

Change-Id: I9f73342e3201fef79b99426939f1a2b308be3cb7
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/318143
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-16 03:35:14 -08:00
Dino Li
57e703ea24 it8380dev: Implement GPIO mode for KBS pins and fix gpio_set_level()
1. KSO[0-15] and KSI[0-7] can be used as GPIO input if they are not set for
keyboard scan function.
2. Critical section for gpio_set_level().

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=console commands: gpioset, gpioget, and version.

Change-Id: I8edae122525e6dcebaa3489116642d8e48520569
Reviewed-on: https://chromium-review.googlesource.com/318112
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-12-14 20:04:54 -08:00
Shawn Nematbakhsh
3a1b5d5acb stm32: Don't use HSI48 clock for chips which don't support it
stm32f03x and stm32f070 officially do not support an HSI48 clock, so
configure our 48MHz clock using HSI8 and PLL.

BUG=chromium:568717
BRANCH=None
TEST=Verify snoball 1us timer is accurate and we can execute
approximately 48 million NOPs in a second.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ice74de98f18908e53e94f2d95a2ec3cae53e2347
Reviewed-on: https://chromium-review.googlesource.com/317459
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-12-11 17:03:22 -08:00
Vincent Palatin
229bc28b06 honeybuns: enable updates over USB-PD
Enable the RSA verification of the RW partition,
so we are using the RW partition by default and
the USB PD flashing VDMs are able to update
the firmware over the Control Channel.

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

BRANCH=samus
BUG=chrome-os-partner:47823
TEST=run the following sequence on a Samus connected to Honeybuns :
ectool --name=cros_pd infopddev 1
ectool --name=cros_pd flashpd 5 1 ec.RW.bin
ectool --name=cros_pd version
and see the honeybuns properly updated and running the new version.

Change-Id: I8f1612ee153a412620bae5822d1b354ad8072916
Reviewed-on: https://chromium-review.googlesource.com/312998
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2015-12-11 00:47:56 -08:00
Vadim Bendebury
432ea75d92 cr50: add ability to include two identical RW sections in the EC image
A typical EC image includes two similar in their functionality
subsections, RO and RW. CR50 has a small RO subsection, all it does -
detects a proper RW image to run and starts it up. To provide for
reliable firmware updates, the CR50 image needs to include two RW
sections, while the code is running from one RW subsection, the other
one can be upgraded.

This patch adds the ability to generate two identical RW sections,
mapped half flash size apart, and include them into the resulting EC
image.

To keep things simple the previously existing RW section's name is not
being changed, while the new (identical) RW section is named RW_B.

Two configuration options need to be defined to enable building of the
new image type: CONFIG_RW_B to enable the feature and
CONFIG_RW_B_MEM_OFF to define where RW_B should be mapped into the
flash.

A new rule added to Makefile.rules allows to generate a different lds
file from the same source (core/cortex-m/ec.lds.S) by defining a
compile time variable to pick a different base address for the
rewritable section, when RW_B is built.

BRANCH=none
BUG=chromium:43025
TEST=as follows:
    - make buildall -j still succeeds
    - verified that regular CR50 image starts successfully

    - modified chip/g/loader/main.c to launch RW_B first, re-built and
      re-run the image, observed on the console:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  cr50 bootloader, 20151118_11218@80881, no USB, full crypto
  Valid image found at 0x00084000, jumping

  --- UART initialized after reboot ---
  [Reset cause: power-on]
  [Image: unknown, cr50_v1.1.4160-4c8a789-dirty 2015-12-07 18:54:27 vbendeb@eskimo.mtv.corp.google.com]
  [0.001148 Inits done]
  This FPGA image has no USB support
  Console is enabled; type HELP for help.
  > [0.002212 task 2 waiting for events...]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    (note that the image base address is 0x840000, which is RW_B).

Change-Id: Ia2f90d5e5b7a9f252ea3ecf3ff5babfad8a97444
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/316703
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-12-09 06:36:22 -08:00
Duncan Laurie
a41d5c84ca glados/chell: Do not pull-up RSMRST to PCH in hibernate
If deep sleep S5 is supported RSMRST to the PCH should not be high
when the PCH is in S5 unless the board is sequencing out of deep sleep
and S5 state. Therefore, ensure RSMRST is low when the EC goes into
hibernate. This assumes deep sleep S5 is employed. A more appropriate
fix is to honor RMSRST state prior to going into hibernate state.
Without this change the behavior on certain platforms do not sequence
out of S5 when coming out of hibernate.

BUG=chrome-os-partner:48133
BRANCH=none
TEST=tested on a failing EVT chell board at the factory

Change-Id: Ia4a1cdb59c25a3fc704c64fbe6beb01ede90d777
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/317070
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-12-09 05:14:14 +00:00
Ryan Zhang
7ef9d3c349 Lars: Add Keyboard COL2 Invert
The silego in Lars is supposed to be inverted.

This CL can not be compiled because of 'MODULE_PWM_KBLIGHT'.
I didn't modify this to prevent a merge conflict from
https://chromium-review.googlesource.com/#/c/316351/ in ToT.

BUG=chrome-os-partner:48205
BRANCH=lars
TEST=None

Change-Id: Iee6fa996440287fd1f1af456f9842d810597bd23
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/316360
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-07 13:49:32 -08:00
Shawn Nematbakhsh
51daa37c5a lars: Fix build
MODULE_PWM_KBLIGHT no longer exists.

BUG=None
TEST=`make buildall -j`
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I801bdf153771f77a4c2704df82a62a7d21e25625
Reviewed-on: https://chromium-review.googlesource.com/316451
2015-12-07 17:35:10 +00:00
Ryan Zhang
565db4519c Lars: Add PWM keyboard backlight support
+ pwm settings

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`, OS can boot up normally

Change-Id: I8703261736802a81323077a85262da7d7a80cbc1
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/315911
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-06 20:41:33 -08:00
Ryan Zhang
5c8edccb94 Lars: Remove second port of PD firmware
two port PD will keep interrupt low, and cause
EC.PDCMD task stuck with exchange status loop before
entering task-while-loop

BUG=chrome-os-partner:48232
BRANCH=lars
TEST=`make BOARD=lars -j`, OS can boot up normally

Change-Id: I493c6d02170c731af430f28abf8ade38b47aff0f
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/315362
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-06 19:00:51 -08:00
Shawn Nematbakhsh
b2945c1ce2 snoball: Enable PWMs for post-regulator voltage control
BUG=chrome-os-partner:48044
TEST=Manual with snoball w/ subsequent commit. Run `pwm <ch> 50` for
each channel, verify with `adc` that each PD output voltage is
approximately VBUCK / 2.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I0c791fa4de47f92423c4cfd6ef5013495f5a5019
Reviewed-on: https://chromium-review.googlesource.com/315142
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-04 11:33:43 -08:00
Scott
aad615c80d honeybuns: Allow 20v charging
Previous HW didn't correctly support 20V charging. The HW has been
corrected and now there is no need to keep 20V mode disabled in FW.

BUG=chrome-os-partner:48217
BRANCH=none
TEST=Tested in the lab by jguerin@ against Samus

Change-Id: I952872affb302c7aa2ddb97466cd5ce459d2ac54
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/315219
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-12-04 11:33:42 -08:00
Shawn Nematbakhsh
743a9ea7cd pwm: Add common initialization for PWM pins
Rather than having various PWM module groups initialized from various
HOOK_INIT functions, group them all into a single module and initialize
them all from a common function in pwm.c.

BUG=chromium:563708
TEST=Manual on samus / samus_pd (with CONFIG_ADC enabled). Verify that
samus fan + KB backlight control is functional and samus_pd correctly
sets PWM output.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9f9b09bfa544cd9bc6b7a867e77757dff0505941
Reviewed-on: https://chromium-review.googlesource.com/314882
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-04 01:20:33 -08:00
li feng
6b75bfee7e kunimitsu: modify charge LED gpio control to match FAB4 schematic
Also set LED gpio output low by default so no more pink color LED at the
beginning of boot up

BUG=none
BRANCH=none
TEST=Verified on Kunimitsu LED show correct color on differnt charging
states.

Change-Id: Ibc7ead862b9c1d16b08ccb1400bffeccf2326fde
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/315740
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-03 18:01:57 -08:00
Vadim Bendebury
5de8d35d11 cr50: add extension command for testing hash primitives
A new extended subcommand code (1) is being added to handle hash
testing.

The new subcommand handler keeps track of multiple sha1 and sha256
contexts the host might want to exercise. The number of available
contexts is limited by the amount of available free memory.

One of four hash operations could be requested by the host: 'Start',
'Continue', 'Finish' - when hashing a single stream over multiple
extended command messages, and 'Single' when the entire message to be
hashed is included in one extended command payload.

The command payload had the following format:

 * field     |    size  |                  note
 * ===================================================================
 * mode      |    1     | 0 - start, 1 - cont., 2 - finish, 3 - single
 * hash_mode |    1     | 0 - sha1, 1 - sha256
 * handle    |    1     | seassion handle, ignored in 'single' mode
 * text_len  |    2     | size of the text to process, big endian
 * text      | text_len | text to hash

As soon as the first 'Start' message is encountered, the handler tries
to allocate shared memory to keep track of the test contexts, the
amount of available memory determines how many contexts the handler
can support concurrently.

As soon as the last 'Finish' command is encountered, the handler
returns the shared memory to the 'heap'.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=after adding the host side implementation and fixing a couple of
     bugs, hash tests pass (see upcoming patches).

Change-Id: Iae18552d6220d670d1c6f32294f0af1a8d0d5c90
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314692
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-12-03 16:08:39 -08:00
Vadim Bendebury
d1f1e7722d cr50: reduce hash implementation stack requirements
Stack space is pretty tight on cr50, and since there is no need to
support SHA digest sizes in excess of 256 bits, the digest buffer size
should be reduced.

This patch makes the maximum expected digest size dependent on the set
of configured hash algorithms, moves hash size related asserts from
run time to compile time, and passes compile time definition to the
TPM2 library to increase its hash state container (it became too small
when SHA384 was disabled).

The sw context requirements should be reduced, but this is a task for
another day. We also do not have to store a local digest copy if the
API allowed reading a partial digest.

CQ-DEPEND=CL:314883
BRANCH=none
BUG=chrome-os-partner:43025, chromium:564862
TEST=all tests pass:
  $ ./test/tpm_test/tpmtest.py
  Starting MPSSE at 800 kHz
  Connected to device vid:did:rid of 1ae0:0028:00
  SUCCESS: AES:ECB common
  SUCCESS: AES:ECB128 1
  SUCCESS: AES:ECB192 1
  SUCCESS: AES:ECB256 1
  SUCCESS: AES:ECB256 2
  SUCCESS: AES:CTR128I 1
  SUCCESS: AES:CTR256I 1
  SUCCESS: sha1:single 0
  SUCCESS: sha256:single 0
  /New max timeout: 1 s
  SUCCESS: sha256:finish 1
  SUCCESS: sha1:finish 3
  SUCCESS: sha256:finish 2

Change-Id: Iaef3a230469de129e72418814e1d113b447c0137
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314695
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2015-12-03 02:21:57 -08:00
Ryan Zhang
25b573bdae Lars: Add ALS support
+ als settings
+ i2c ports for als

BUG=chrome-os-partner:48206
BRANCH=lars
TEST=`make BOARD=lars -j`, OS can boot up normally

Change-Id: I3a0cdf3f07b3b164fae8e393f86c1a2d0b4fc1da
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/315470
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-03 02:21:53 -08:00
Ryan Zhang
f184c0ba4b Lars: Refactoring PD port count setting
usb_pd_policy.c : update & remove duplicate code

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`, OS can boot up normally

Change-Id: I82729edf89b6ce719c8f6897b877ee57ee0daefe
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/315030
Commit-Ready: 志偉 黃 <David.Huang@quantatw.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-03 02:21:48 -08:00
Duncan Laurie
0e9cd95664 chell: Keep keyboard backlight off in hibernate
If pulled up the backlight will be at 100% brightness instead of off.

BUG=chrome-os-partner:48130
BRANCH=none
TEST=hibernate on chell, see keyboard backlight stay off

Change-Id: I30cd289b9492356407aa54e6a84b04add647bd9a
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314936
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-01 22:37:00 -08:00
Ben Lok
ca6e4836a6 oak: pd: increase stack size of PDCMD task
Stack of PDCMD task may be overflow during plug/unplug stree test
with Apple's AV Multiport Adapter. Enlarge the stack size to avoid
system reboot.

BUG=chrome-os-partner:47728
BRANCH=none
TEST=Manual
1.Connect DUT to sink monitor via HDMI dongle.
2.Unplug HDMI USB from DUT side.
3.Plug HDMI USB cable to DUT USB socket.
4.Repeat (Plug and unplug) USB from DUT for 10 times.

Change-Id: Ib6a1fbd0a552b2c6d4656c12554e1306c21adb8a
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/315020
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-01 22:36:58 -08:00
Shamile Khan
f748a7fbd5 common: adc/i2c: Mark task_waiting volatile
When Link Time Optimization is turned on, functions that set
task_waiting multiple times have one of the sets removed
by the linker leading to undesired results.

Marking task_waiting volatile alleviates this issue.

BUG=chrome-os-partner:46063
TEST=Manually tested on Kunimitsu.
         Console command adc shows correct value of approx
         20000 mV for VBUS.
BRANCH=none

Change-Id: I85a6e5c9688ae72c45d90fb58296f94b74a301aa
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/314233
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-12-01 18:52:53 -08:00
Ryan Zhang
be47beb539 Lars: update fan settings
Add control pin to fan

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: I9fa3c387af12c305d2eabbe01ebdd835a147a162
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/315010
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-01 14:02:01 -08:00
Ben Lok
744f7c2782 oak: enable HW charge ramping
refer to commit 75f740fa, enabling the option on oak too.

BUG=none
BRANCH=none
TEST=plug in CDP, SDP, DCP, type-C, and PD charger. Make sure
we ramp to a reasonable value for the correct suppliers.
Make sure we don't ramp for type-C and PD chargers.

Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Change-Id: I9c6a0726e9cb23af59d5841c63a81897ae624998
Reviewed-on: https://chromium-review.googlesource.com/314436
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-01 08:14:21 -08:00
Mulin Chao
e803e81114 nuc: Add i2cscan and kbpress commands for FAFT.
Add i2cscan and kbpress commands for FAFT.
Remove unnecessary i2c reading since there is no race condition.

Bugs fixed:
Fixed i2c_read_string bug since we shouldn't enable NACK if flag doesn't
contain I2C_XFER_STOP.
Fixed i2c_unwedge bug since the parameter should be port not controller.
Fixed state machine bug since we should restore bus state back to idle
if bus encountered timeout.

Modified drivers:
1. board.h: Add i2cscan and kbpress commands for FAFT.
2. i2c.c: Remove unnecessary reading since there is no race condition.
3. i2c.c: Fixed i2c_read_string and i2c_unwedge bugs.
4. i2c.c: Restore to idle state if bus encountered timeout.
5. board.h: Add CONFIG_LOW_POWER_IDLE for better power consumption.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I98974f852cbbaec270c697feb8016b52550005bc
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/313393
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-12-01 01:11:13 -08:00
Ryan Zhang
6ebcb4b272 lars_pd: preparing new PD firmware for one-typeC-port PD
Since two port may cause some unexpected problem in a
one port board.

I've cloned this from glados_pd without any code changes
and I'll remove the second port settings at another CL.

BUG=None
BRANCH=lars
TEST=`make BOARD=lars_pd -j`

Change-Id: I84b3d2fa705ff089aabd52ab71d9fb59eecdd027
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314637
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-12-01 01:11:08 -08:00
Ben Lok
9ea7ca8d87 pd: send power change event to AP whenever input power is changed
Send power change event to AP whenever input power is changed,
ensure that AP gets the latest power charging info.

BUG=chrome-os-partner:47677
BRANCH=none
TEST=tested on Oak by plug/unplug AC adapter to type-C ports and
verifying the UI battery icon shows the correct status instantly.

Change-Id: I7465afcd8bc9b1c56ecf70fc74446866a8ab1b9a
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/313926
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-12-01 01:11:04 -08:00
Shawn Nematbakhsh
af3172cd7e mec1322_evb: Remove board
This board is no longer in use.

BUG=None
TEST=`make buildall -j`
BRANCH=None

Change-Id: Ie0d03e0a817ba101c01909f95955d51f8dfae03c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314920
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-30 18:54:16 -08:00
Ryan Zhang
1051a7e2d5 Lars: update for proto board
Following kunimitsu settings of
https://chromium-review.googlesource.com/#/c/312559/

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: If226f5b8a46cfb8ffb19015a0a7cc684d1b61175
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314643
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-30 14:30:24 -08:00
Ryan Zhang
29467c60c6 Lars: update I2C port MACRO
Since Lars has only one usb charge port

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: If164dfd90e3536a2e6a3097c8a7f7add408c8da9
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314638
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-30 14:30:24 -08:00
Mike M Hsieh
0c4408efdc kunimitsu: Modify battery LED colour
Use one gpio instead of two to show amber colour to indicate charging state

BUG=none
BRANCH=none
TEST=checked and verified LED colour while charging
Signed-off-by: Mike Hsieh <mike.m.hsieh@intel.com>

Change-Id: Id3897eea4213efeea96c3e261f9f43e1b96e8dd0
Reviewed-on: https://chromium-review.googlesource.com/304700
Commit-Ready: Mike M Hsieh <mike.m.hsieh@intel.com>
Tested-by: Mike M Hsieh <mike.m.hsieh@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2015-11-30 02:18:45 -08:00
Bruce
2a09bf95e5 Chell: support LED behavior
Add firmware to support LED behavior for following OEM spec.

BUG=None
BRANCH=None
TEST=check led behavior follow the spec

Change-Id: Ib4250a47a153fbe7de0e1cd4a5869fd3efbcfd1d
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/313898
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-29 18:46:26 -08:00
Ryan Zhang
356c9c5104 Lars: update type-C switch port count
BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: Ieb3bd091096cb70b8b58e539992c4b17fcbfb20d
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/313949
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-27 20:17:42 -08:00
Ryan Zhang
921630d404 Lars: update i2c.mux speed
BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Change-Id: I8e9c581891cfae6b21f94f536f043adc8eb2b4a3
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/314546
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-27 20:17:41 -08:00
Ryan Zhang
1d0785da90 Lars: update GPIO setting
Expected PIN macros to expand in Decimal instead of Octal.

BUG=None
BRANCH=lars
TEST=`make BOARD=lars -j`

Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Change-Id: I1c469a6031a6b2c64db75c362d1915b7a390f81e
Reviewed-on: https://chromium-review.googlesource.com/314411
Commit-Ready: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-25 23:53:48 -08:00
Ben Lok
cefe19e08f oak: add VCONN swap ability
refer to commit 776bedc3, enable VCONN swap option for oak.

BUG=chrome-os-partner:41838
BRANCH=none
TEST=test on oak. ask for vconn swap and make sure vconn swap
is successful.

Change-Id: I2afa68e073d088302c2c6ba2315a6c9f4551ef87
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/313913
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-25 20:08:07 -08:00
Shawn Nematbakhsh
767e132d13 pd: Add support for multiple distinct TCPC alert signals
If multiple TCPCs are present on a system then we may have multiple
alert signals, each of which alerts us to the status of a different
TCPC. Make boards with external non cros-ec TCPCs define
tcpc_get_alert_status, which returns alert status based upon any alert
GPIOs present, and then service only ports which are alerting.

BUG=chromium:551683,chrome-os-partner:47851
TEST=Verify snoball PDCMD task sleeps appropriately when no devices are
inserted, and verify ports go to PD_DISCOVERY state when we attach
samus. Also verify that glados / glados_pd can still negotiate PD.
BRANCH=None

Change-Id: Iae6c4e1ef4d6685cb5bf7feef713505925a07c8c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/313209
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-25 12:59:17 -08:00
Vadim Bendebury
9665d0b1df cr50: fix _cpri__DrbgGetPutState and _cpri__EccCommitCompute stubs
These functions are mostly no-ops it turns out, maybe something will
be needed to be done for RSA and ECC initialization, for now leaving
those functions commented out as a reminder.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=tests passing before this change still pass.

Change-Id: Iee9aaf133a55a6197c9896ed48efb34a4b3340c6
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314096
Reviewed-by: Nagendra Modadugu <ngm@google.com>
2015-11-25 11:17:15 -08:00
Vadim Bendebury
9b11d70956 cr50: increase tpm task size
Let's increase it to 4K, this seems to be adequate for tests so far,
but with the enabled stack size monitoring we should find out quickly
if in certain cases this is not enough.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=the test involving the use of SHA hardware does not fail in
     mysterious ways any more.

Change-Id: I86da89ccca42d1a60ce7c1dfef08d21bf44f1eee
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/314095
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-25 11:17:14 -08:00