Commit Graph

4504 Commits

Author SHA1 Message Date
Alec Berg
e5ec074dfa ryu: fix max lightbar brightness
Fix max brightness for Ryu. The max brightness must be less than
0x80 because the top bit in the lightbar current registers is
reserved. Writing the top bit seems to have undefined behavior.

This fixes the hiccups in the tap for battery sequence which was
ramping brightness to above 0x80 and producing weird results.

BUG=chrome-os-partner:45835, chrome-os-partner:44029
BRANCH=smaug
TEST=test tap for battery looks smooth.
test that the google colors match the desired current levels:
> lightbar
 ...
 15     0f     06
 16     0f     20
 17     16     08
 18     06     21
 19     26     11
 1a     1d     0b

Change-Id: Iecf1c770f986064b9b4d2d3d54fab0ea1242af01
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302146
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 133dab0c36160d0e54820cce9e97071df34340f8)
Reviewed-on: https://chromium-review.googlesource.com/302446
2015-09-25 09:13:34 -07:00
Furquan Shaikh
f4ef486fc2 motion_sense: Fix issues in SET_ACTIVITY / LIST_ACTIVITIES
1. ret always evaluated to INVALID_PARAM and so SET_ACTIVITY bailed out
early and returned an error to host command.

2. No need to verify sensor id since SET_ACTIVITY / LIST_ACTIVITIES
identify the correct sensor to operate on.

BUG=chrome-os-partner:45710
BRANCH=None
TEST=Compiles successfully. Disable double-tap works as expected.

Change-Id: I58ae9cd5009fadedb3ea78a4eec0452124747707
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/301990
Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
(cherry picked from commit 2a3a120c8f7cca1e032f4be2a198748f0e8b5fb1)
Reviewed-on: https://chromium-review.googlesource.com/302409
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-25 00:19:00 -07:00
Shawn Nematbakhsh
0dde6ad443 glados: Swap pericom usb2 charge detector ports
Swap the charge detector i2c ports since the association between pericom
chips and ports seems backward.

BUG=chrome-os-partner:45118
TEST=Plug usb2 keyboard into usb-c port through A-C adapter, verify
keyboard is functional.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I7c78dc5f915126bb61cf27543ea1626c831e5981
Reviewed-on: https://chromium-review.googlesource.com/300643
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Ryan Lin <ryan.lin@intel.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-24 21:08:36 -07:00
Vincent Palatin
bd34af5d78 ryu: change charging temperature limits
Do not charge below 5 C or above 50 C.
Still charge at 0.1C between 5 C and 10 C.

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

BRANCH=smaug
BUG=chrome-os-partner:45631
TEST=none

Change-Id: I6788088054ef4a5eb176eb2185b5e1c576128e09
Reviewed-on: https://chromium-review.googlesource.com/302232
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-24 19:36:20 -07:00
Shawn Nematbakhsh
854d5a6e7f cleanup: Remove CONFIG_FW_IMAGE_SIZE
Since CONFIG_RO_SIZE and CONFIG_RW_SIZE now exist (which may
theoretically be different sizes), it is no longer useful to globally
define the size of an image.

BUG=chromium:535027
BRANCH=None
TEST=`make buildall -j`. Also, verify glados / glados_pd continue to
function as expected.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie29959923bc5d02b4d7d6d507ff2191bcb7d24c8
Reviewed-on: https://chromium-review.googlesource.com/301743
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-09-24 18:07:01 -07:00
Gwendal Grignou
324d6b807f driver: bmi160: Reenable FIFO when EC wants it.
Code has been added to not send data to AP ring when the
AP does not want data, but we should still enable the BMI160 FIFO if the
EC wants the data.

BRANCH=smaug
BUG=chromium:513458
TEST=Disable sensor at AP (sysfs frequency) enable in EC (accelrate).
Check with accelinfo we are collecting sensor info.

Change-Id: I962fecad0e8cea899e4d788d25982e8bc7e7fb88
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301795
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-24 18:06:58 -07:00
Bill Richardson
5d138b379d Make builds repeatable.
We have been using the time of compilation to determine the
version string. This CL will keep doing that if the git repo has
uncommitted changes, but if the repo is clean we'll just use the
author date of the last commit. This ensures that the same source
will produce bitwise-identical builds (assuming no toolchain
changes, of course).

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

  cd src/platform/ec
  make buildall
  mv build build.one
  make buildall
  md5sum build{,.one}/*/ec.bin | sort

Observe that successive builds produce identical binaries.

Change-Id: Ie2ef44b216586097589c9c15f12e05c87a53f991
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302140
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-24 12:46:28 -07:00
Alec Berg
6190e15597 flash_ec: restore boot_mode for all MCUs
Make sure to restore boot_mode gpio for all MCUs. Previously,
only usbpd_boot_mode was restored, but not ec_boot_mode which
is used on lucid.

BUG=none
BRANCH=none
TEST=flashed lucid (ec_boot_mode), glados_pd (usbpd_boot_mode),
and zinger (boot_mode) and verified that the boot_mode gpio was
restored to off at the end of flashing.

Change-Id: Ib6fcddcac6d00465e31a0e710bae3b8318bac659
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301338
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2015-09-24 12:46:27 -07:00
Gwendal Grignou
dac76cc8d0 common: add command spixfer
Similar to i2c_xfer: allow access to a SPI device registers.
We assume the protocol use is set MSB bit to the offset for read
operation.
id is the index of the device in spi_devices.

BRANCH=smaug
TEST=Read/Write SPI registers.
BUG=none

Change-Id: Id4aaffbb6f514fd47086aee240b556ea23298d33
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/289857
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-23 21:26:22 -07:00
Bill Richardson
4ae115e145 Fix typo when building with CONFIG_SHAREDLIB
The board-specific board.h defines things like this:

  #define CONFIG_RO_SIZE 1000
  #define CONFIG_RW_SIZE 1000
  #define CONFIG_SHAREDLIB_SIZE 200

And in the linker scripts we define some preprocessor macros like
so:

  #define FW_SIZE_(section) CONFIG_##section##_SIZE
  #define FW_SIZE(section) FW_SIZE_(section)

So that we can say things like this:

    FLASH (rx) : ORIGIN = FW_OFF(SECTION), LENGTH = FW_SIZE(SECTION)

Note that we have to use FW_SIZE, not FW_SIZE_

The difference is only noticeable when SECTION is #defined. If
${CFLAGS} has

  -DSECTION=RW

Then the expansion is this:

  FW_SIZE_(SECTION)    =>   CONFIG_SECTION_SIZE
  FW_SIZE_(RW)         =>   1000

There's no difference in the output for this particular CL, but
we should use the correct macro anyway to avoid confusion.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I61edc76a1aaeb1c675b384371700f37dda39ed47
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302150
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-09-23 21:26:21 -07:00
Gwendal Grignou
bcb5fb2320 board: ryu: Use CONFIG_SPI_ACCEL_PORT instead of numerical
spi_devices array needs the SPI master port used.
It is defined as CONFIG_, use it.

BUG=none
BRANCH=smaug
TEST=Check the sensors still work.

Change-Id: I6ce978caa32f4135dced59417a81ae280777fe57
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302021
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-23 15:58:45 -07:00
Ben Lok
6a11d9ae70 oak: updates GPIO setting for rev4
Modify the GPIO seeting according to the Oak rev4 schematic.

BRANCH=none
BUG=none
TEST=manual
Confirm all reversion of oak can be built pass:
make -j EXTRA_CFLAGS=-DBOARD_REV=4 BOARD=oak
make -j BOARD=oak clean
make -j EXTRA_CFLAGS=-DBOARD_REV=3 BOARD=oak
make -j BOARD=oak clean
make -j EXTRA_CFLAGS=-DBOARD_REV=2 BOARD=oak
make -j BOARD=oak clean
make -j EXTRA_CFLAGS=-DBOARD_REV=1 BOARD=oak

Change-Id: Ib1051f29df9d1919f0ae3ecaf55dc0997ea29c3e
Signed-off-by: Ben Lok <ben.lok@mediatek.com>
Reviewed-on: https://chromium-review.googlesource.com/300728
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-09-23 05:02:30 -07:00
Alec Berg
c6deb91139 tcpc: don't allow tcpc write command until initialized
Don't act on a TCPC write command until we are done initializing.
This fixes an issue where if the TCPC reboots while the TCPM (EC
in our case) is still functioning, then we can get into a weird
state where we are changing the CC termination as we are still
initializing, which can cause us to get stuck with a phantom
connection (we apply one CC termination, but think we are applying
the opposite termination, causing us to 'see' a connected device).

BUG=none
BRANCH=none
TEST=load on glados. make sure dual-role toggling is on on the EC
and reboot PD MCU a bunch of times and make sure the EC doesn't
detect a phantom connection.

Change-Id: I2dffc3c2a1ca70903e17db0e012e994835cb9962
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300681
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-21 22:12:41 -07:00
Mulin Chao
95ea672601 nuc: Fixed flash layout issue for npcx
Fixed flash layout issue for npcx

Modified drivers:
1. config_flash_layout.h: Fixed layout issue for npcx
2. flash_ec: add flashrom support for boards without JTAG in servo
connector

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

Change-Id: I0b9b679c52b8a8e2a26c278b5024d0350fb77338
Reviewed-on: https://chromium-review.googlesource.com/300392
Commit-Ready: Mulin Chao <mlchao@nuvoton.com>
Tested-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-21 20:50:56 -07:00
Shawn Nematbakhsh
b03f92fbcc cleanup: Fix mapped storage accesses
1. Don't assume that images are present in program memory, just because
storage is mapped (npcx case).
2. Use CONFIG_MAPPED_STORAGE_BASE correctly, rather than
PROGRAM_MEMORY_BASE.

BUG=chrome-os-partner:23796
TEST=make buildall -j
BRANCH=none

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I99c2b382def2a211241d401bbdc39a88ceedca5b
Reviewed-on: https://chromium-review.googlesource.com/300254
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Mulin Chao <mlchao@nuvoton.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-21 11:23:31 -07:00
Shawn Nematbakhsh
85110d5bcb gpio: i2c: Correctly restore pins after i2cunwedge
Set pins as inputs when going to hi-Z, and restore them to default when
returning to functional.

BUG=chrome-os-partner:45520
TEST=`i2cunwedge` on samus, verify that i2c bus is still functional
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie19d4e5afdee7f0b2437afdfaa8175ff77b73c78
Reviewed-on: https://chromium-review.googlesource.com/300785
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-21 11:23:28 -07:00
Bill Richardson
735e5a6ee2 Define SECTION=* and SECTION_IS_* when compiling
The linker scripts are passed through the preprocessor so that
they can distinguish between RO and RW images. This change makes
the same macros available when compiling, so that code can
contain directives like

  #ifdef SECTION_IS_RO

or

  #define FW_SIZE_(section) CONFIG_##section##_SIZE
  #define FW_SIZE(section) FW_SIZE_(section)

  int size = FW_SIZE(SECTION);

BUG=none
BRANCH=none
TEST=make buildall

Nothing uses this yet, so there's no change to the images.

Change-Id: I6e03cd07c134f4b86aeddd9d516b74bbdb95b8a8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301255
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-21 11:23:27 -07:00
Bill Richardson
f4b65c5d95 cleanup: Remove old vboot cruft from Makefile.rules
This removes an unused vboot recipe left over from long, long ago.

It was added with commit 8101b71 (May 2012) to enable vboot on
EC. It should have been removed with commit 45cd846 (Aug 2012),
but wasn't. It hasn't been useful since then.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I1176898064c4e714639dc63f041fb0fd85d73bab
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301254
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-21 11:23:27 -07:00
Bill Richardson
7323fd8fda cleanup: Put chip-specific configs in config_chip.h
include/config_std_internal_flash.h is an optional header that
can be used to implement the most common EC flash layout.

However, CONFIG_INTERNAL_STORAGE, CONFIG_MAPPED_STORAGE, and
CONFIG_MAPPED_STORAGE_BASE are fixed by the SoC, so they belong
in config_chip.h, not in the optional header.

BRANCH=none
BUG=chrome-os-partner:23796
TEST=make buildall

Refactoring only, no behavioral differences.

Change-Id: I114c3e194837041920e6f228a2bed6747be8231c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301330
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-21 10:04:35 -07:00
Gwendal Grignou
40e20adefb driver: bmi160: Fix for significant motion while in suspend.
- Add interrupt latching: notice that interrupt register
was cleared before entering the task irq handler.
Add a 5ms latching time address the issue.
Check it was not a problem for regular operation.
- Fix FIFO interrupt setting: interrupt when FIFO was full was
missing from one register
- Really disable FIFO when AP does not want data from sensors.

BRANCH=smaug
BUG=b:23570481
TEST=check that significant motion and double tap are reliable in S3.

Change-Id: Iec3681da00462b1aa392056eecea4ee6862d42ee
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298689
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-21 01:13:57 -07:00
Gwendal Grignou
241c2cb429 driver: bmi160: Allow double tap to be set by the host.
In S0, allow the host to enable/disable double tap.
Set S0 accel frequency to 100Hz to track double tap event.

BRANCH=smaug
BUG=chrome-os-partner:44754
TEST=check CTS results are identical to previous runs.
Check we can enable/disable double tap from the host.

Change-Id: Ic36bdd77005a1152fd413fb3869c8a77ef680117
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298685
2015-09-21 01:13:56 -07:00
Gwendal Grignou
8839b30b25 common: motion: Fix accelgyro interface
Use const struct motion_sensor when needed.

BRANCH=smaug
BUG=chrome-os-partner:44754
TEST=compile

Change-Id: Ib1e92b91439e6af83aa7b6b49ac9e6271d4ed3d9
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298684
2015-09-21 01:13:56 -07:00
Gwendal Grignou
4e8120a364 common: motion: Add double tap gesture host interface
Allow the host to enable/disable double tap.
Send event when double tap is present.
Also fix a bug when scanning for gestures.

BRANCH=smaug
BUG=chrome-os-partner:44754
TEST=compile. Check on Ryu.

Change-Id: I50d008cd3823072ab1c1e2d21f1276cd2185d797
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298683
2015-09-21 01:13:55 -07:00
Gwendal Grignou
6f06cd5f7b ryu: Enable Significant motion
Enable significant motion in BMI160 and from the host.

BRANCH=smaug
BUG=b:23570481
TEST=On Ryu, check significant motion (not still) is detected.

Change-Id: I7d524576f18829f79991d731c5691b3d2bba5d36
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296215
2015-09-21 01:13:55 -07:00
Gwendal Grignou
8139114897 driver: bmi160: Add Significant motion support.
Add support for significant motion.

BRANCH=smaug
BUG=b:23570481
TEST=On Ryu, check significant motion (not still) is detected.

Change-Id: I5760a1ba3624490a0297de82371b1d15f05df5dc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296214
2015-09-21 01:13:54 -07:00
Gwendal Grignou
1d8fcfcd0d common: Add __fls function
Returns the most significant bit set.
Replace 31 - __builtin_clz(x), so x must be different from 0.
Use get_next_bit when not on the performance path,
on performance path set the bit field just after reading it.

BRANCH=smaug
BUG=none
TEST=compile, check Ryu still works.

Change-Id: Ie1a4cda4188f45b4bf92d0549d5c8fb401a30e5d
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301300
2015-09-21 01:13:54 -07:00
Gwendal Grignou
dbfb5c1dee stm32: Define a larger task size for HOST_CMD
The current largest task size is not big enough,
we get stack overflow after one or several calibration requests.

BRANCH=smaug
BUG=chrome-os-partner:45570
TEST=After the change a loop of calibrate does not crash the EC.

Change-Id: I9681a890eddf274ab496e8ca6249c7ebca5edab5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/301215
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-20 23:33:18 -07:00
Gwendal Grignou
56670f5d8d driver: bmm150: fix repetiton registers
Rereading the spec, the repetition registers are massaged by the chip
to produce the repetition value: for XY: 1 + 2 * REPxy, Z axis: 1 + REPz

BRANCH=smaug
BUG=chrome-os-partner:39900
TEST=check the registers matches the spec.

Change-Id: Ic8618d70c18b4f408e3c95acdbe7fcdf6d95e39e
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299582
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-20 12:33:23 -07:00
Gwendal Grignou
b98e33c950 common: motion: Fix oversampling calculation.
Was setting frequency radix at 1 mHz.
That would limit frequency to 32Hz, which is not enough for
accelerometor.
Set radix as a fixed point or float variable, to calculate
the rate properly.

BRANCH=smaug
BUG=None
TEST=Check that when Ryu set accelerometer to 100Hz internally (for
double tap), that AP gets data when requested frequency is 15Hz.

Change-Id: I84e0ea784f8bd04566aa91bc4300cf4ff30b350c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298688
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-19 15:18:09 -07:00
Gwendal Grignou
1ce66908fb driver: si114x: fix typo
If/When si1142/si1143 are used, we would upload 2/3 IR LED data.

BRANCH=smaug
BUG=None
TEST=compile, data still valid for si1141.

Change-Id: I39cd15d3c791ed514e4e122ddab3d3571edc43f9
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298687
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-19 15:18:08 -07:00
Gwendal Grignou
33046e7d51 common: accel: Add error code for irq handler
When IRQ handler is not processing any event raised,
return NOT_HANDLED.

Without this change, any event would set the light sensor
process timestamp and, if the light sensor frequency was lower
than BM160 fifo interrupt frequency, we would never read from
the light sensor.

BRANCH=smaug
BUG=chrome-os-partner:43800
TEST=Compile. Check that light sensor data get updated.

Change-Id: I302f80c5cd9b4f3c926362fdafdc8b5074cabb60
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/298686
2015-09-19 15:18:08 -07:00
Bill Richardson
9d1910f5a0 Let private repos define their own subdirectories
Private repos should be as independent as possible. This change
makes it easier for them to declare their own subdirectories.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I590e8c035f05ab157eb63c552ced5995f25cabc9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300609
Commit-Ready: Bill Richardson <wfrichar@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-19 13:52:40 -07:00
Bill Richardson
b205b3e1a3 cleanup: Cr50: remove duplicated compiler args
The board-specific build.mk is included twice (by design). This
change moves the "+=" terms inside the guard so that the variables
are only extended on the second pass.

BUG=none
BRANCH=none
TEST=make buildall V=1

By inspection, notice that CFLAGS and dirs-y don't have duplicate
terms anymore.

Change-Id: I4a5d05df5a7f9516d7379a627bee034bcb396582
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300655
Commit-Ready: Bill Richardson <wfrichar@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2015-09-19 13:52:39 -07:00
Gwendal Grignou
e24cca580e common: lightbar: put multiple commands under i2c_lock
If other i2c traffic happens around the time the light bar is
initialized, the i2c bus is wedged.

Instead of waiting 500ms in the motion task loop for the tap sequence to
complete, set under i2c lock the lp power and init sequence.

BRANCH=smaug, samus
BUG=chrome-os-partner:45223
TEST=With msleep(500) removed and With lb_power + lb_init + 100ms, I don't see the wedge at TAP
sequence.

Change-Id: I931eb25bcc5e3237b6c569f2330f72f9fc415964
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299543
Reviewed-by: Bill Richardson <wfrichar@google.com>
2015-09-19 12:27:21 -07:00
Aseda Aboagye
d341615383 GLaDOS: Add base accel & gyro.
This commit adds the base accelerometer as well as the gyroscope to the
list of motion sensors on the board.  They are currently wrapped behind an
ifdef for HAS_TASK_MOTIONSENSE due to space constraints.

BUG=chrome-os-partner:43494
BRANCH=None
TEST=Build GLaDOS EC with driver enabled and verify that we can calcuate
a valid lid angle.
TEST=Verify that signs of accelerometer conform to those shown in the
Chrome/Android/HTML5 doc/spec. See description in accelerometer_types.h
TEST=Verify that signs of gyroscope conform to those shown in the
"Sysfs interface to EC accelerometers" document.
TEST=make buildall tests

CQ-DEPEND=CL:299504
CQ-DEPEND=CL:300510

Change-Id: I34026813431f0df6211f9c781ab5b8c7b4dd8403
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/299886
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2015-09-19 02:00:54 -07:00
Alec Berg
f46c115a28 pd: set USB communications capable flag in PDO
Set USB communications capable flag in source/sink
capabilities PDO on boards that support USB. This
signals to other side that we are capable of
communication over D+/D- or SS Tx/Rx.

BUG=chrome-os-partner:34982
BRANCH=samus,smaug
TEST=load on samus, use twinkie to sniff traffic,
verify that USB comms capable bit is set in source
cap packet

Change-Id: I0f49cf19eb141512298c3439a4708c53101d674f
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300637
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-18 20:57:39 -07:00
Alec Berg
c7eaa0a81c pd: add more flags to USB_PD_CONTROL host command
Add more flags to EC_CMD_USB_PD_CONTROL including whether
the port partner is PD capable, and if the port partner has
any of the following flags set in its capabilities: dual-role
power, dual-role data, USB comms capable, and externally
powered.

BUG=none
BRANCH=smaug
TEST=tested on samus using 'ectool --dev=1 usbpd 0'. Tested
with zinger, guppy, another samus, and other third party
devices to verify the flags are set as advertised in src/snk
capabilities packet

Change-Id: I4d78d1880073fdacce57516111ac6cab37b93f27
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/300953
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-18 20:57:38 -07:00
Gwendal Grignou
6b5a49ef15 motion: Add Gesture Interface
Add an interface with the host to set up gesture recognition.
Today, only significant motion is supported.

Add a virtual sensor for concentrating gesture support from host.

BRANCH=smaug
BUG=b:23570481
TEST=On ryu, enable significant motion from host.

Change-Id: I906fa2d2d7b4ca2771ea2f58b91de8d97bf4e2e3
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296213
2015-09-18 20:57:22 -07:00
Gwendal Grignou
13a7ae7b6f motion: Add wake up sensor support.
Add a flag in the FIFO event to tell that the sensor
want to wake up the AP.
Use this flag in the EC and let it reach the AP
for debugging.
Move fifo_flush as well, use only when FIFO present.

BRANCH=smaug
TEST=compile.
BUG=b:23570481

Change-Id: I5ff567b0f9f1e37a3dae16bfa7859c341f1a9b17
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296212
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 19:21:12 -07:00
Gwendal Grignou
5254d5687c driver: bmi160: add code for setting double tap
Macro and code to set double tap parameters.
Enable double tap in Ryu.

BRANCH=smaug
TEST=double works: interrupt detected.
BUG=b:23570481

Change-Id: I11a84186f6dc49b75d0f09afb4b03dcbeea6066f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295949
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 19:21:12 -07:00
Gwendal Grignou
d2d67fae1e ryu: Enable FPU
To use magnetometer online calibration, use Cortex PFU.

BRANCH=smaug
BUG=chrome-os-partner:39900
TEST=No regression with new image.

Change-Id: Id52d348bd0a4c180bfe6a9b02040882f33266a88
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299580
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 19:21:10 -07:00
Gwendal Grignou
1bee6648c1 nuc: use fix point math for timer calculation
Remove needs for FPU unit for calculating timer.

BRANCH=none
BUG=none
TEST=compile

Change-Id: Ice12c2d2f914974f7b4db5dadfca77257557e5a5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299519
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-18 19:21:10 -07:00
Gwendal Grignou
dd06ad921e samus: Set CONFIG_FPU for tmp6 driver.
tmp6 driver requires floating point. Enable it on Samus.

BRANCH=samus
BUG=none
TEST=compile.

Change-Id: Iacd83fe5e04ed555db19187d3cb7037af397410b
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299518
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-18 19:21:09 -07:00
Gwendal Grignou
c4f441f056 chip: Set CONFIG_FPU on a board basis.
Only few boards need FPU. Not enabling FPU saves on stack memory.

BRANCH=none
BUG=chrome-os-partner:36126
TEST=compile all boards.

Change-Id: I1fed9920f9d64664be303e9e2a74673416c05365
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299517
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 19:21:09 -07:00
Gwendal Grignou
d896a005d4 common: math: Use float when CONFIG_FPU is set.
When hardware FPU is set, use it.

BRANCH=smaug
BUG=chrome-os-partner:39900
TEST=compile.

Change-Id: I5b42bd23a7ee7549e538eff075756b58f79756f2
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299516
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 19:21:08 -07:00
Aseda Aboagye
4ef6aabe07 common: Move tps65090 PMIC driver to driver/.
The driver directory is the natural place for drivers.

BUG=chromium:472173
BRANCH=None
TEST=make buildall tests

Change-Id: Iba85b643f20eb9607db16c7e6ad9a67443d78a3d
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/300789
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-18 17:55:35 -07:00
Vincent Palatin
03f11f6549 honeybuns: ensure we are always a data UFP
The dock hub upstream port is wired to the type-C captive cable, so we
can only be a data UFP :
- ensure we reject data swap request to become a DFP
(e.g. from dual role devices preferring to be a UFP such as Ryu)
- swap to data UFP at startup (we will start as data DFP since we are a
  power source only).

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

BRANCH=none
BUG=none
TEST=connect Honeybuns to Ryu and see Ryu becoming a power sink and a
data DFP all the time.

Change-Id: I876536451a327e04df0a81d8217ef19963d204b6
Reviewed-on: https://chromium-review.googlesource.com/300952
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2015-09-18 17:55:34 -07:00
Gwendal Grignou
bde89ebc20 common: motion: move gesture actions in motion task.
Change the IRQ interface to allow adding events.
Move code to send the lightbar sequence from gesture.c to motion task.

TEST=compile, works on Ryu.
BRANCH=smaug
BUG=chrome-os-partner:44754

Change-Id: I981ea123ebef0e8e3d6aa320eade89f10e83b6fc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/296822
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-09-18 17:55:32 -07:00
Gwendal Grignou
3788806149 driver: si114x: Fix compilation when ACCEL_FIFO is disabled
Fix compilation error when we are not using the FIFO

BUG=none
TEST=compile
BRANCH=none

Change-Id: I50e12fe4ebc6a626638d6f9ae555a324f366fef9
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299947
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-09-18 17:55:32 -07:00
Gwendal Grignou
a2ef386ee7 common: motion: print return of drv->init()
In motion_sense_init, gather the result of the sensor init routine.

BUG=none
BRANCH=smaug
TEST=Get the result of init() when calling accelinit.

Change-Id: I8d0219a2b81fdf6d512976db5a28646ee5f6b994
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299946
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-09-18 17:55:31 -07:00