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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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
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
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
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>