Commit Graph

4191 Commits

Author SHA1 Message Date
Gwendal Grignou
34677eed4e motion_sense: Fix init routines
active state is global, remove it from motion_sensor structure.

Reinit sensors when entering RW, fix regression introduced by CL:284616.

Improve EC polling rate calculation by excluding suspended sensors.

Wake up sensor thread in case the motion task was in deep sleep.

Do not send sense interrupt while suspened. Will revisit once wakeup
sensors are implemented.

BRANCH=smaug
TEST=Check when in RW the sensors are exposed.
Check EC rate are correct in different power state.
Check when jumping from RO to RW and back, after setting the
frequencies parameters via sysfs properly, AndroSensor acquires
the data properly.

BUG=chrome-os-partner:43132,chrome-os-partner:40741

Change-Id: Ie70732b135a432d64935eead4200ddc0e1a7c0b4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288201
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-27 22:19:26 +00:00
Gwendal Grignou
324a2716d4 stm32: Define second DMA controller present on STM32F3
Define second DMA controller, to be used by SPI3 on STM32F373.

BRANCH=smaug
TEST=Check with dmahelp the DMA engine is activated.
BUG=chrome-os-partner:42304

Change-Id: Id2490ab91092b1ed738f5318bdeebfbe93f09171
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288511
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-27 22:19:21 +00:00
Gwendal Grignou
909fccfd5a common: Change interface to dma_test
Allow to test any DMA channel.

BRANCH=smaug
TEST=Use dmahelp on Ryu
BUG=chrome-os-partner:42304

Change-Id: I68606cdd34aa03bbeed9b5a4ababcad780384cc0
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288510
Reviewed-by: Sheng-liang Song <ssl@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-27 22:19:16 +00:00
Scott
198fd7f2c2 oak: Fix issue with pc_send_ec_int() function
There was a bug in this function where the bit for host_command was
being set in the ec_status variable. This caused the ALERT# GPIO
line to be held low which in turn caused the EC MCU to loop
and keep reading the ALERT register.

BUG=none
BRANCH=none
TEST=manual Tested against Zinger in both ports and Zinger and Samus
at connected into each port. Verified that it established a PD contract
for both ports and that the alert line was no longer being held low

Change-Id: I5540440a68581521eb002411f728a4eac2f22caf
Signed-off-by: Scott Collyer <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288252
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
2015-07-27 19:30:55 +00:00
Anton Staaf
af7fb66ae3 Discovery: Add OpenOCD configuration file
This allows the "make flash" command to work for the Discovery board.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     cd board/discovery
     make flash

Change-Id: Ifa3c1eca58b80093b47a8fe25b47d29dba923d6b
Reviewed-on: https://chromium-review.googlesource.com/287439
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2015-07-27 19:30:49 +00:00
Anton Staaf
4626177c3b Atomic: Mark the modified uint32_t volatile
The atomic_* functions are often used in contexts where the data they
will operate on are volatile (due to being shared between tasks or a
task and an interrupt handler).  Adding volatile here makes using the
atomic_* functions a little easier in those cases and removes a cast
from the call sites (which could be obscuring a bug, if for instance
the variable was modified to be a uint16_t).

Signed-off-by: Anton Staaf <robotboy@chromium.org>

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

Change-Id: I71356eb3cf2c0506df38532eee767c7d78f9240e
Reviewed-on: https://chromium-review.googlesource.com/287516
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2015-07-27 19:30:44 +00:00
Vijay Hiremath
3e9bd8027c Strago: add HPD handling to policy layer
Ported the HPD handling to policy from Glados
 Change-Id: I293224fa5189c8827f1837877ffb791fddc7fb77
 Reviewed-on: https://chromium-review.googlesource.com/285743

BUG=none
TEST=make buildall -j
BRANCH=none

Change-Id: I982c6bd162b5ba239d4c9d066995c3d2fcaa97fd
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287812
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-25 23:49:06 +00:00
Vijay Hiremath
aff095dd9b Strago: Add support for USB-C muxes
Ported the USB-C muxes from Glados
 Change-Id: I9d42108688a9070b982ae77f77633654bc6505ed
 Reviewed-on: https://chromium-review.googlesource.com/282281

BUG=none
TEST=Tested the USB & DP status from "typec" console command.
     Observed usb_mux_set() & usb_mux_get() function are getting called
     and also the polarity of the USB-C is getting detected properly.
BRANCH=none

Change-Id: I0b169032ff77af9895311680413aed6c7d0fd4e2
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287464
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-25 23:48:59 +00:00
Myles Watson
065b177a4d Jerry: add "cleanup: fix all the header guards"
104f811e67

BUG=chromium:511324
TEST=make buildall -j
BRANCH=none

Change-Id: I994e11c94413d7b8683b64e86807ba45b61c7eea
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288239
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2015-07-25 17:45:33 +00:00
Myles Watson
3348557d82 Jerry: add "cleanup: remove board_discharge_on_ac"
Apply ac1cba419a to Jerry.

BUG=chromium:511324
TEST=make buildall -j
BRANCH=none

Change-Id: I04f168f8e1a8e6a1e7c21cc3ce8c06315d9e7495
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288238
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-25 17:45:28 +00:00
Myles Watson
2476e6c9a4 Pinky: Remove obsolete board
Jerry is being used for FAFT in the lab.  Remove Pinky instead.

BUG=chromium:511324
TEST=make buildall -j
BRANCH=none0
CQ-DEPEND=CL:288258

Change-Id: I03ddc74a4e72353f3408da8e374ad925baf00a35
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288237
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2015-07-25 17:45:22 +00:00
Kevin K Wong
43671e0348 strago: add initial PD support
Ported the PD support from Kunimitsu.
 kunimitsu: add initial PD support
 Change-Id: I0cb1edcf1703f55882f81c65e6359a45be4c1629
 Reviewed-on: https://chromium-review.googlesource.com/281833

BUG=none
TEST=Verified the PD negotiation on BCRD2.
     Device boots after plugging in the USB charger.
     Battery is getting charged.
BRANCH=none

Change-Id: If4efb0463118414fb02ad8e53700eac578a4954a
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287124
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-07-25 17:45:10 +00:00
li feng
1c7baaf71f I2C: i2c_raw_mode() should only touch I2C port specified
After I2C unwedge, *all* I2C ports will be re-initialized in
i2c_raw_mode() by gpio_config_module(MODULE_I2C, 1);
This means *all* I2C pins will be programmed as	GPIO then enable I2C
alternate function.

If I2C Unwedge happened while there is an active I2C transacation on
another port, the active I2C transaction will be corrupted, since the
pins will be temporary programmed as GPIO Output High.

BUG=chrome-os-partner:40519
TEST=Warm-reboot test on Cyan EVT and no discharging while AC is on.
BRANCH=none

Change-Id: I3be1d5c60bf4ab385bc077202406ec7abd8b2add
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287493
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Denny Iriawan <denny.iriawan@intel.com>
2015-07-25 14:49:31 +00:00
Vadim Bendebury
15135076e2 Cr50: Enable TPM-protocol data over the SPI bus
This patch adds a module which runs on top of the SPS driver and
implements the TCG SPI TPM protocol.

Basic register read and write functions are implemented as well as
rudimentary TPM state machine (claiming/releasing locality).

An enhancement is made to the SPS driver to ensure that when the CS is
deasserted the transmit FIFO is reset too, on the off chance of the CS
going away mid transaction for whatever reason.

In this implementation the slave is guaranteed to stall the master for
a few bytes in both receive and transmit transactions, which is
further aggravated by the fact that RX FIFO threshold is set to 8
(this is the minimum number of bytes the master has to send to wake up
the slave). This could be fine tuned later, for instance made a
parameter of the receive callback registration function.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=trunksd initialization (with minor changes to accommodate new
     VID/DID and some status bits, to be published) succeeds with the
     cr50 connected to the USB/SPI cable.

Change-Id: I28d37c3b57dde9adf59e81426efe4f58880cf0b0
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/285252
2015-07-25 08:47:37 +00:00
Vadim Bendebury
3a77fd7332 tpm: add a console channel for TPM subsystem
With conditional compilation in place more channels can be created.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=none yet

Change-Id: Ia5aa5dba054b53adeabf7bd49d1111f65e87e924
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287129
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-07-25 08:47:31 +00:00
Vadim Bendebury
e0d27dd603 sps: expose RX FIFO write pointer
This is necessary for proper TPM SPI flow control operation.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=none yet

Change-Id: I571cab87c843aebaac24657d340ae3b51a5560b4
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287128
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-07-25 04:20:33 +00:00
Vadim Bendebury
605b0f50d0 console: compile some channels in conditionally
As new features come along the console channel space limited at 32
becomes very tight. But not all features are present all the time.
Let's make some of the channels compile time configurable. This makes
for uglier code but allows to support more channels.

BRANCH=none
BUG=none
TEST=make buildall -j

Change-Id: Id21560d4aa05c0e5245872c50ae19340cda8fd3e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/286610
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-07-25 04:20:28 +00:00
Vadim Bendebury
6f13628e7f cr50: Use distinct configuration option for SPI Slave support
SPI slave and master interfaces require very different code to
support, they should have separate configuration options.

Host command code printouts should use their own console channel.

Using SPS to designate SPI Slave interface is not universally
acceptable, a bug has been opened to discuss the alternatives and
clean up the code.

BRANCH=none
BUG=chromium:512613
TEST=make buildall -j

Change-Id: I6683286a221c4689ecc247fdfe8ebca529f3f458
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/286469
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-07-25 04:20:23 +00:00
Myles Watson
24a0b31732 Jerry: Revert "Remove obsolete EC targets"
Jerry is being used for FAFT in the lab.  Remove Pinky instead.

This reverts part of commit bdc680d8ed.

BUG=chromium:511324
TEST=make buildall -j
BRANCH=none

Change-Id: I034a814ffe3397728e443f99ed270d412be1bc1d
Signed-off-by: Myles Watson <mylesgw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288236
Reviewed-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@chromium.org>
2015-07-25 01:22:42 +00:00
Gwendal Grignou
60482a8179 driver: bmi160: fix FIFO pollution at boot
FIFO should not collect events of suspended sensors.
It could still happen at boot, when sensors are set up suspended.

BRANCH=smaug
TEST=Check for invalid FIFO events in HAL code.
BUG=none

Change-Id: Ie363afc3f3263bb10e03a8d0a8ee34b8b92bb6b4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288200
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-25 01:22:37 +00:00
Ian Chao
14bd917343 nuc:
Add ECST tool to modify the header used by npcx booter.

Modified drivers:
1. i2c.c: Modify for i2c_port design.
2. i2c.c: Fixed bugs when mutil-tasks use the same i2c port and pull-up issue.
3. hwtimer.c: Fixed bug whcih event expired time is behide current timer.
4. lpc.c: Add intializing host settings after pltrst is deasserted.
5. uart.c/clock.c/register.h: Fixed bug which cannot enter deep-idle
   when gpio is any-edge trigger mode.
6. task.c: Add workaround method for hard fault issue.
7. keyboard_raw.c: Modified for support CONFIG_KEYBOARD_KSO_BASE
8. lpc.c: Modified for support CONFIG_KEYBOARD_IRQ_GPIO
9. lpc.c: fixed obe interrupt bug during 8042 initialization
10.Adjust path of flat files for new Makefile rules
11.Fixed build error on lpc.c without CONFIG_KEYBOARD_IRQ_GPIO

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

Change-Id: Icf9494174b245b4026e396be877d578f36b6f6a5
Signed-off-by: Ian Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/284036
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
2015-07-25 01:22:32 +00:00
Shawn Nematbakhsh
7de0037538 glados: Make SPI chip select a GPIO
The mec1322 SPI driver toggles CS manually (CONFIG_SPI_CS_GPIO), so the
pin needs to be a normal GPIO, not functional.

BUG=chrome-os-partner:43160
TEST=Run "flashrom -p internal:bus=lpc -r read.bin" on glados, verify
that read.bin contains actual flash data and not all zeros.
BRANCH=None

Change-Id: Ibaee03b43b4d9c25f6c074c02688d1cba20c7a02
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288321
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-25 00:10:11 +00:00
Shawn Nematbakhsh
08546e3540 glados: V2 Board Changes
Changes for glados proto 2 build. These changes are behind GLADOS_BOARD_V2,
which is not defined by default in order to support existing boards.

BUG=chrome-os-partner:42933
TEST=Verify that Glados v1 board continues to boot AP. Verify
compilation on GLADOS_BOARD_V2.
BRANCH=None

Change-Id: I68634f95f94d3d37f18d676c01219f92b6ddfc45
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287291
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-24 21:54:31 +00:00
Aseda Aboagye
96888b2f9b util: Enhanced config_option_check.py.
This commit enhances the config option check python script to
significantly reduce the number of false positives.

 - Now only checks committed changes.
 - Only checks additions, not the whole file.
 - Only checks uses of CONFIG_* not in a comment for both C-style and
   Make-style files.
 - Suports a whitelist.

BUG=chromium:510672
BRANCH=None
TEST=Detected missing configs in Makefiles and C source files.
TEST=/* CONFIG_FOO */ was not detected.
TEST=' board-$(CONFIG_OPT)=board.o # CONFIG_OPT2' only CONFIG_OPT was
detected.
TEST=Changes in working dir were not detected.
TEST=Changes to config_option_check.py were not detected.
TEST=cros lint --debug util/config_option_check.py
TEST=CONFIG_FOO in a multi-line C comment was not detected.

Change-Id: I5fc2ccc77bb4f319a3c85b7d81c83027959dc96b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/287519
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@google.com>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2015-07-24 21:54:27 +00:00
Alec Berg
e85a3fa0d4 tcpc: move tcpc initialized bit into error status register
Move TCPC initialized bit from alert register into error status
register. This is not part of the TCPCI spec, but the existing
code creates a bug that if TCPM reboots without TCPC also rebooting,
then we will never get the initialized alert from TCPC since
it has already happened, so the TCPM will loop indefinitely
waiting for TCPC to be ready. This fixes the bug by moving the
bit to a status register, which is more appropriate.

BUG=none
BRANCH=none
TEST=load on glados, reboot and make sure TCPM see's that the
TCPC is initialized.

Change-Id: I8e96b59031e01a4faec8f519727df1fa95f498bc
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288342
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-24 21:54:18 +00:00
Alec Berg
b339fdf6c1 tcpc: update TCPCI register map
Update TCPCI register map to match version 0.64 of spec.

BUG=none
BRANCH=none
TEST=load on glados, test can make power contract with zinger.

Change-Id: I62e6428b5836aeb018fa7b4f38b6f3b419aed0c6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288341
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-24 21:54:12 +00:00
Vincent Palatin
79fe9ee1a5 ryu: update closed lid detection algorithm
use (LID_OPEN == 0 && BASE_PRES_L == 0) as the lid closed condition to
avoid false triggers.

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

BRANCH=smaug
BUG=chrome-os-partner:42110
TEST=on Smaug EVT2, play with magnets and the genuine lid,
check we get the right "lid open" / "lid close" messages on the console.

Change-Id: Ie0a34fb7e45e8a424ff1cfda7662543d4f336f1a
Reviewed-on: https://chromium-review.googlesource.com/287853
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-07-23 22:38:11 +00:00
Vincent Palatin
a834638b29 lid_switch: allow to specify several lid GPIOs
Add a X-macro CONFIG_LID_SWITCH_GPIO_LIST to be able to optionally
specify more than one GPIO to check to find out whether the lid is open.
By default, use GPIO_LID_OPEN as before.

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

BRANCH=smaug
BUG=chrome-os-partner:42110
TEST=on Smaug EVT2, define CONFIG_LID_SWITCH_GPIO_LIST as
LID_GPIO(GPIO_LID_OPEN) LID_GPIO(GPIO_BASE_PRES_L) and play with magnets
and the genuine lid, check we get the right "lid open" / "lid close"
messages on the console.

Change-Id: I9e7c67bb39f36f254d31d5861d535d69db754faa
Reviewed-on: https://chromium-review.googlesource.com/287852
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-07-23 22:38:06 +00:00
Alec Berg
bcb8e11c63 lucid: change charger sense resistor to 5mOhm
BUG=none
BRANCH=none
TEST=make -j buildall

Change-Id: I7c87398ff85fc241162f2bf62c05108a498ce8d6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287783
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-23 20:46:29 +00:00
Shawn Nematbakhsh
8cb7670b00 glados: Add LED control GPIOs
LEDs should be under control of the mec1322 specialized LED control
unit, but it's not yet functional. In order to test LEDs for the
upcoming build, add GPIOs which can be toggled through the EC console or
ectool.

BUG=chrome-os-partner:40848
TEST=Verify `gpioset CHARGE_LED_1 1` turns LED red. Verify `gpioset
CHARGE_LED_2 1` turns LED green.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I64b5109e10aeb6a1f38ae9410dc5205f4cc6a117
Reviewed-on: https://chromium-review.googlesource.com/287675
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-23 20:46:24 +00:00
Vincent Palatin
a14029e672 pdeval-stm32f072: update documentation
Add more details about adding a new source file.
Add a reminder for pull-ups on the I2C bus.
Decode PD state machine.
Remove unused second I2C port configuration.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: If94a0f47921dac7d3fb9dc1e9879a7c69699d224
Reviewed-on: https://chromium-review.googlesource.com/287830
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-23 19:32:01 +00:00
Gwendal Grignou
709676bfe1 driver: bmm150 measurement compensation
Using Bosh reference document, compensate X,Y,Z axis
based on internal registers and R HALL values.

Change compass unites to 1/16 uT per LSB.

Reference:
https://github.com/suribi/Thunder-Kernel/blob/master/mediatek/custom/common/kernel/magnetometer/bmm150/bmm150.c

BRANCH=smaug
TEST=Check compass value in user space.
BUG=chrome-os-partner:39900

Change-Id: I0c480521771ef6004ac6e5182cc1d27e82c5bc7c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/285020
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-22 23:50:31 +00:00
Shawn Nematbakhsh
d286fbd7f8 cleanup: Clarify usage of CONFIG_CHARGER_INPUT_CURRENT
Add additional comments on the usage of CONFIG_CHARGER_INPUT_CURRENT for
type-C.

BUG=chrome-os-partner:42933
TEST=Passes pre-submit check
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I00458c16fa4671f26fb00fe3ca1265ebc22a74c8
Reviewed-on: https://chromium-review.googlesource.com/287377
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-22 23:50:24 +00:00
Shawn Nematbakhsh
4578166a89 charger: Inhibit power-on until charger is initialized
It's sometimes desirable to boot without a battery, but we may brown out
if we don't have sufficient current. Inhibit AP power-on, even if the system
is unprotected, until our charger and current limit are initialized.

BUG=chrome-os-partner:41258
TEST=Manual on reworked glados with subsequent commit. Remove battery and
attach Zinger. Verify EC powers on and AP doesn't boot. Run `powerbtn`,
verify that AP boots. Remove all power and attach battery, verify that EC
powers on and AP boots.
BRANCH=None

Change-Id: Ifc3d16f8288a035854e9fd05812ce6de33170d6a
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/280563
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-22 22:30:00 +00:00
Tom Wai-Hong Tam
e5f7583cc6 flash_ec: Add a chip argument
The flash_ec uses the given board name to select a proper flashing
method. It keeps a mapping from board name to chip name.
This approach is not scalable if we want this script to work on
all supported board variants, like the pinky family which has many
boards: jerry, minnie, speedy, etc.

This change adds a new argument of chip name, such that we can only
keep the mapping of major boards. Other boards not listed can use
the chip argument to select a proper flashing method.

BRANCH=none
BUG=chromium:505003
TEST=Ran the script on Beaglebone/Servo v3 connected with Jerry:
$ flash_ec --chip stm32 --image ec.bin

Change-Id: I553ee68f82a7985a37548dfb6e89b364eaffd0f1
Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287445
Reviewed-by: Dan Shi <dshi@chromium.org>
Reviewed-by: Myles Watson <mylesgw@chromium.org>
2015-07-22 22:29:54 +00:00
Vincent Palatin
90741a36a5 bq2598x: implement "discharge on AC"
Allow to force discharging the battery while a power source is plugged
for factory testing.

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

BRANCH=smaug
BUG=chrome-os-partner:42509
TEST=On Smaug EVT2 with USB-C cable plugged, issue "fwtool ec
chargecontrol discharge" or "ectool chargecontrol discharge"
and monitor the battery level for 10 min.

Change-Id: I0c4daa8ab442726cd398c121467718c50dbf0bef
Reviewed-on: https://chromium-review.googlesource.com/287590
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-22 19:31:01 +00:00
Alec Berg
642fa3f3bc ryu: plankton: allow plankton to send VDM to enter CCD
Create new custom VDM to notify DUT to enter case closed
debugging mode. Send this VDM from Plankton when the case
closed debugging enable button is pressed. Once DUT
receives the CCD enable VDM, CCD remains enabled until
a reboot. Note, this is polarity dependent, so cable
might need to be flipped.

BUG=chrome-os-partner:42569
BRANCH=smaug
TEST=load on plankton and ryu. attach full feature C to C
cable (must have USB3.0 wires). make sure plankton is in
USB mode (USB_SS_USB_MODE light should be set, which can be
done by pressing DP_USB_TOGGLE button). Press CASE_CLOSE_EN
button to send VDM, and then attach micro-B to debug port
CN14 on plankton. See that VID/PID for Ryu show up in lsusb
on host, and EC console works. If device does not show up,
flip polarity of cable.

Change-Id: Ifa469e4a43e32089becd75fe6cdfe0ed462d950b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287441
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-22 18:04:36 +00:00
Alec Berg
0115834bb6 plankton: allow use of double CC cable
Add ability for Plankton to detect whether a single or double
CC cable is used to connect to DUT. This is done by toggling
the active CC line until a connection is detected, then toggling
once more and checking if we still have a connection. If we
can connect to the DUT in both CC polarities, then it is a
double CC cable. Before we know the cable type, keep PD
communication disabled to avoid partially negotiating and then
disconnecting. Note, this increases the time it takes for
us to connect a form a stable PD contract with the DUT.

When we detect a double CC cable, the cable flip button actually
flips the active CC polarity, thus testing all pins in the
opposite polarity.

BUG=chrome-os-partner:42569
BRANCH=smaug
TEST=test with plankton and samus. test that we form a PD
contract with both single and double CC cables as both sink
and source. also test the cable flip button for both cables.

Change-Id: I522369302848d4cdbb70c55a40af3ad0b7c3fb8a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/286589
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-22 18:04:29 +00:00
Dino Li
2f4a590379 it8380dev: fix reset cause
symptom: there are many reset cause while chip power on.
root cause: there is no default value for bram.

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

BRANCH=none
BUG=none
TEST=1. "power-on" reset cause still exist.
     2. console "reboot" hard, preserve, and ap-off.
     3. console "sysjump" rw and ro.

Change-Id: Ie190ade4990bfaf46e73746ac5019f61307c81e5
Reviewed-on: https://chromium-review.googlesource.com/286281
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
2015-07-22 06:26:20 +00:00
Gwendal Grignou
57ec5805fe ryu: Fix orientation of accel and compass
Add matrices to align sensors vectors with the device reference.
Move rotation in read routines, to allow fifo to contains processed
information.

BRANCH=smaug
TEST=Worsk on smaug
BUG=chrome-os-partner:39900

Change-Id: I009e7f24ef6ee0574ed664aeb5fd649fcd7039fd
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/286659
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-22 05:02:53 +00:00
Vijay Hiremath
2302647f57 kunimitsu: add HPD handling to policy layer
Ported the HPD handling to policy from Glados
 Change-Id: I293224fa5189c8827f1837877ffb791fddc7fb77
 Reviewed-on: https://chromium-review.googlesource.com/285743

BUG=none
TEST=make buildall -j
BRANCH=none

Change-Id: I72e2f0853902bfa3536ba083f8ece5785be625c4
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287410
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-07-22 05:02:48 +00:00
Vijay Hiremath
dfcb1dc9e1 Kunimitsu: Add support for USB-C muxes
Ported the USB-C muxes from Glados
 Change-Id: I9d42108688a9070b982ae77f77633654bc6505ed
 Reviewed-on: https://chromium-review.googlesource.com/282281

BUG=none
TEST=Tested the USB & DP status from "typec" console command.
     Observed usb_mux_set() & usb_mux_get() function are getting called
     and also the polarity of the USB-C is getting detected properly.
BRANCH=none

Change-Id: I56da12f4fe20a05a73e8b93893ba5a425a20808f
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/287360
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-07-22 05:02:42 +00:00
Gwendal Grignou
d1002e798e common: Untie math_util from motion sense.
math library can be set independentely.
It is implied when motion sensor drivers are compiled in.

BRANCH=smaug
TEST=Build strago board specific tests, host test and ran
ryu image.
BUG=chromium:512329

Change-Id: I743ea7b44e4a3783602c11f3928cb3fa4b105ec4
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/287371
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-22 03:39:52 +00:00
Vincent Palatin
d6614b0954 ryu: remove host command trace
Do not display host commands on the EC console by default.
It's too noisy with the sensor readings.

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

BRANCH=smaug
BUG=none
TEST=run on smaug EVT2 and get less spam on the console

Reviewed-on: https://chromium-review.googlesource.com/287303
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Gwendal Grignou <gwendal@google.com>
(cherry picked from commit 077052445551dd607416ee5f923da18a1cd6db13)

Change-Id: I6b33c6f24680438b57ef3fd992f894c6165603bf
Reviewed-on: https://chromium-review.googlesource.com/287288
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-22 02:03:08 +00:00
Anton Staaf
6051f28527 Discovery: Add Forward and Loopback USART configurations
Add example uses of the multi USART driver with DMA transmission and interrupt
based reception.  USART1 is setup as a loopback device, it just echo's any
characters received.  USART4 is forwarded over USB.

Also fix the alternate function mappings for USART3 and USART4, and add
comments for each section of board.c.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     Crosswire USART1 to USART4 and cut and paste chunks of text over USB

Change-Id: I79170c78e61328caf8067ae8db8810db38880839
Reviewed-on: https://chromium-review.googlesource.com/287195
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2015-07-21 22:36:28 +00:00
Vincent Palatin
048436c6d3 ryu: remove P4/P5 code leftover
Remove remaining conditional code for ryu_p4p5 board which is gone.

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

BRANCH=smaug
BUG=chrome-os-partner:38333
TEST=make buildall

Change-Id: I1630fab5355d10018dab7f0fed7e35f240422ddd
Reviewed-on: https://chromium-review.googlesource.com/287142
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2015-07-21 19:56:24 +00:00
Anton Staaf
1e3d00ff7a USART: Add DMA based transmitter
This adds a new transmission implementation for the multi UART driver.
It is a DMA based transmitter that can directly read from the TX queue
with zero copy overhead.  The DMA channel used as well as the maximum
DMA transmission size are configurable per UART at the board level.

This also updates the Ryu AP UART to use DMA transmission.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     Manually verify that the AP UART forwarding works

Change-Id: I3cb27d0f9015043d75a38c12919388afe90dc4af
Reviewed-on: https://chromium-review.googlesource.com/286274
Trybot-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Anton Staaf <robotboy@chromium.org>
2015-07-21 18:30:40 +00:00
Vijay Hiremath
ff99342641 Kunimitsu: Initial support for FAB3
Following features are enabled.
1. ALS OPT3001 is enabled
2. Charger ISL9237 is enabled
3. Sleep mode in G3 is enabled
4. CMD_HASH, CMD_TIMERINFO, CONSOLE_HISTORY, CMD_ACCEL_INFO, CMD_ACCES
   are disabled to save the memory.

BUG=none
TEST=Device boots to UI.
BRANCH=none

Change-Id: I225dcafdb5b066b6d9b9b2b00bd06586d33d3527
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/286783
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-07-21 01:34:33 +00:00
Vijay Hiremath
cd0df39ba5 Driver: OPT3001: Add TI OPT3001 light sensor driver
BUG=none
BRANCH=none
TEST=Added OPT3001 config to test the sensor in Kunimitsu.
     Able to read the als data from "als" console command.
     Varied the light intensity and the als reading are changing.
     Driver fits into the existing ALS framework.

Change-Id: Idb2e6f9f50b6d0d6c8f64c11336efd3f2c76d498
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/286782
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-07-21 01:34:27 +00:00
Vijay Hiremath
26db470b39 Skylake: Add G3 sleep mode support
BUG=none
TEST=Enabled the config and tested on Kunimitsu.
     Enter "shutdown -h now" form the Kernel console.
     Device goes to Sleep mode in G3 and charger LED turns off.
BRANCH=none

Change-Id: I962018dcfac2998ee0a11784adeceb09931b930d
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/286781
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-07-21 01:34:21 +00:00