Commit Graph

6339 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
c7574ffbe7 tcpm: fusb302: Mask BC_LVL interrupt when PD is enabled
Avoid needless alerts due to CC lines toggling during PD communication.

BUG=chrome-os-partner:58298
BRANCH=gru
TEST=Manual on kevin. Verify PD communication with Apple USB-C dongle is
functional. Verify Source caps are sent with 100ms-200ms delay. Verify
Rp change on Donette is still detected.

Signed-off-by; Shawn Nematbakhsh <shawnn@chromium.org>

Change-Id: I83fcd1b3235969c8462d23c5159564db2c6a8392
Reviewed-on: https://chromium-review.googlesource.com/409693
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
(cherry picked from commit ae9691d0225c78bb183774d585d34de0e7399d7d)
Reviewed-on: https://chromium-review.googlesource.com/412033
Commit-Ready: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-17 16:09:37 -08:00
Bruce
a1ec4e2d59 pyro/snappy: Add force wake for PS8751.
If PS8751 goes into low power mode during sysjump, then tcpm_init will
fail since PS8751 is not accessible via I2C, so force it to wake up
during hook_init.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I5edfef2ac4524310d4cb5485dec68999bed08210
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/411646
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-17 16:09:35 -08:00
Bruce
342bf53465 pyro/snappy: enable tcpc low power mode
BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I28210f753cb596762facc3f2f3a2bde49d0e40df
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/411604
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-17 16:09:30 -08:00
Nicolas Boichat
ff9c5dd0d2 keyboard: Always call keyboard_state_changed
8042 and USB HID keyboard will both use that function. Let's just
make it a no-op in the MKBP case.

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

Change-Id: Iaee1bf2c6edff3db28f3db89fc292f9d1064483b
Reviewed-on: https://chromium-review.googlesource.com/411602
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-17 07:08:25 -08:00
Nicolas Boichat
dfc9b86c82 chip/stm32/usb_hid_keyboard: Fix set_keyboard_report race
We always want set_keyboard_report to send the freshest possible
data. For this purpose, we use double-buffering on the USB
endpoint.

When the endpoint is currently busy, we sneak in an address change,
hoping that the hardware will pick it up. There is no guarantee
about which buffer was transferred, so we queue another transfer
anyway. This means that the code will send a duplicate (harmless)
report in that case.

BRANCH=none
BUG=chrome-os-partner:59083
TEST=make buildall -j
TEST=make BOARD=hammer -j && util/flash_ec --board=hammer

Change-Id: I9d14541b8b05017c1d5051b9a315db381a89dcea
Reviewed-on: https://chromium-review.googlesource.com/411741
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-17 07:08:23 -08:00
Vincent Palatin
e9584bc6ce reef/pyro/eve/snappy: source 3A on one port
Add a new source policy to provide 3A if there is only one port used
as a source.
Also ensure that the load switch on VBUS when sourcing power is properly
configured to limit the current to 1.5A or 3.0A depending on the case.

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

BRANCH=none
BUG=chrome-os-partner:56110
TEST=manual: connect the laptop to a type-C sink with Twinkie in between,
without anything else connected on the laptop, see 3A flowing when measuring
with Twinkie ('tw vbus'), plug a dangling C-to-A receptacle dongle on the other
port and see 1.5A flowing through Twinkie.
Force the input current limit on the sink to 3.0A and see the laptop cutting
VBUS.

Change-Id: Ic94ba186fc0648e770c8d13be0f96b23e968f855
Reviewed-on: https://chromium-review.googlesource.com/403851
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-17 04:35:32 -08:00
Nicolas Boichat
64f1823a74 chip/stm32/usb_hid: Separate HID keyboard support
In the future, we'd like to have different HID devices on different
endpoints (keyboard, trackpad, etc.), so we'd like to separate the
keyboard handling.

For other chip implementing usb_hid.c (namely, chip/g), we, for now
just rename the config option and endpoint/interface definitions.
Making the code more generic can be done at a later stage.

BRANCH=none
BUG=chrome-os-partner:59083
TEST=make buildall -j
TEST=make BOARD=hammer -j && util/flash_ec --board=hammer

Change-Id: Iad1b00fa226f7635c0f34aae6a435dc53a3ea555
Reviewed-on: https://chromium-review.googlesource.com/409256
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-11-16 19:04:47 -08:00
Bruce
b565e9223d Snappy: Enable BD9995X power save mode when hibernated
Turn off the charger BGATE when the system is hibernated to
save maximum power.

BUG=None
BRANCH=None
TEST=make buildall

Change-Id: I8fc6ffd4e87035f8c861f6a1963b2c546f516aae
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409871
Commit-Ready: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-16 19:04:45 -08:00
Bruce
41dea76433 Snappy: clear hpd bit in board level tcpc init
PD alternate mode is covered in tcpc interface. So tcpci_tcpm_init()
doesn't reset HPD. If keeping HDMI/DP type-C cable connected, doing
sysjump sets HPD signal to high while it's already high(this high comes
from previous state), then OS doesn't output to HDMI/DP monitor.

BUG=None
BRANCH=none
TEST=make buildall

Change-Id: I9b23cee82716d9073c98b6b53a0e54d587baf0ea
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409732
Commit-Ready: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-16 19:04:44 -08:00
Bill Richardson
35ad88f618 Cr50: Bump the watchdog timeout up a bit
Wiping and restarting the TPM, including regenerating the
endorsement certs can take over a second. The default watchdog
timeout is only 1.6 seconds, so let's make sure we don't
accidentally hit that limit.

BUG=chrome-os-partner:59902
BRANCH=none
TEST=make buildall; run on Reef

It wasn't firing before; it's still not firing.

Change-Id: I3c1e27156c4423fd6cb7b768be4b987b00bdd607
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/411983
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-16 19:04:38 -08:00
Bruce
8f8d635dcb Snappy: Yoga sensor setting fine tune
Fine tune matrix of base and lid.

BUG=None
BRANCH=None
TEST=check sceen rotate normally

Change-Id: I7bf2918cec1718a5bf872f1d29588df9226ef776
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/411020
Commit-Ready: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-16 19:04:36 -08:00
Martin Roth
0e0a9589ec upgrade_fw.c: Initialize variable before using it.
block offset was being used in a printf before it was being
initialized.  Initialize it earlier to fix the problem.

This does not change the size of any ec.*.flat file.

BRANCH=none
BUG=none
TEST=build succeeds under GCC 4.9.2, 5.3 and 6.2

Change-Id: I3233ca3b10d35a6f61036c2e30224dc3747618fd
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403501
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-16 19:04:33 -08:00
Martin Roth
d961991d67 btle_ll.c: Initialize variables to fix GCC warnings
The variable last_rx_time shouldn't be able to be used without being
initialized, so initialize it to make GCC 5.x & 6.x happy.

common/btle_ll.c: In function 'bluetooth_ll_task':
common/btle_ll.c:835:25: error: 'last_rx_time' may be used uninitialized
in this function [-Werror=maybe-uninitialized]

This does not change the size of any ec.*.flat file.

BRANCH=none
BUG=none
TEST=build succeeds under GCC 4.9.2, 5.3, and 6.2

Change-Id: I99f716fcb3c8c871e4f325eca3bf3cd622e727d1
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/411406
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-16 19:04:31 -08:00
Martin Roth
3298310a1b btle_ll.c: Initialize variable "offset" before it's used
The variable "offset" gets configured if it's not the first data packet,
but gets used even on the first data packet.

common/btle_ll.c: In function 'connected_communicate':
common/btle_ll.c:729:15: error: 'offset' may be used uninitialized
in this function [-Werror=maybe-uninitialized]

This does not change the size of any ec.*.flat file.

BRANCH=none
BUG=none
TEST=build succeeds under GCC 4.9.2, 5.3, and 6.2

Change-Id: Ib3882aab3e081afc4b00dc02b002ba4c590cb0f9
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403500
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-16 19:04:30 -08:00
Martin Roth
645e4ceef4 cr50: Init variable before sending to function that uses it
Although the variable "hashing" is not used for PADDING_MODE_NULL or
PADDING_MODE_PKCS1, the functions DCRYPTO_rsa_encrypt and
DCRYPTO_rsa_decrypt use it for other padding types.

Because of this, GCC 5.3 and newer throws warnings when the variable is
passed in to those functions without being initialized.  To fix this,
always initialize the variable, even if it's not going to be used.

This does not increase the size of any ec.*.flat file.

BRANCH=none
BUG=none
TEST=build succeeds under GCC 4.9.2, 5.3 and 6.2

Change-Id: Iafaaaed8b05080f70f2b1c2f0dbf1ee22227fd78
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403499
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-16 19:04:28 -08:00
Martin Roth
2bdc25c2e1 Update Makefile.rules with a showboards target
This prints all the boards that are part of the build.  This will be
used on coreboot's build system for running coverity.  This allows
the builds to keep in sync as platforms are added, and as anything is
added to the "skip_boards" list.

for board in $(make showboards); do
   make proj-$board CROSS_COMPILE="arm-eabi-"
done

BUG=none
BRANCH=none
TEST=make showboards shows boards, and excludes skip_boards list

Change-Id: I34d8bc95cc5c7d05b4f2ec38b16b75f9f0c72c6f
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403498
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-16 19:04:27 -08:00
Bruce
2051adae6d Pyro: Add battery FUD support
Add battery FUD support

BUG=chrome-os-partner:59771
BRANCH=None
TEST=make buildall

Change-Id: I0969b3c25d187f1de025f53f9a61fd298c9631c4
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/410963
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-16 16:47:46 -08:00
Martin Roth
8feb3ab4ec makefile: Add help target
This just adds some basic output as a reminder of what targets
do what.

BUG=none
BRANCH=none
TEST=make help shows useful output

Change-Id: Ic46f153ce8ed0b39294644a01eba8e06f2abe1c6
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403497
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-16 16:47:42 -08:00
Manoj Gupta
b2bc234197 Fix EC build for latest llvm
BRANCH=none

util/ectool.c:1158 merror: taking address of packed member 'size' of class
or structure 'ec_params_usb_pd_fw_update' may result in an unaligned
pointer value [-Werror,-Waddress-of-packed-member]

For this case, the pointer is always aligned but clang complains.
Workaround using double pointer casts to char and uint.

       uint32_t *data = &(p->size) + 1;

BUG=chromium:665240
TEST=Builds now

Change-Id: Ibccf0f6e409b9724fc9e5acf28dde570e9d341e3
Reviewed-on: https://chromium-review.googlesource.com/411384
Commit-Ready: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
2016-11-16 07:10:41 -08:00
Vincent Palatin
173d77a63d kevin: keep the pull-up on the USB load switch enable
Keep the pull-up enabled all the time on the GPIO connected to the load
switch enable pin.
This is not ideal but the pull-up bit is no-op in output mode on npcx
and this avoids glitching the enable when transition from the 3A mode
(output strong one) to the 1.5A mode (input with a weak pull-up).

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

BRANCH=gru
BUG=chrome-os-partner:59679
TEST=on Kevin, plug a USB key on port 0, then plug another USB device on
port 1 and see that the key on port 0 is no longer
disconnecting/re-enumerating.

Change-Id: I075dacb1549239f1b60763659dac006f5b838e2c
Reviewed-on: https://chromium-review.googlesource.com/411220
Reviewed-by: Shawn N <shawnn@chromium.org>
Tested-by: David Schneider <dnschneid@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 16ab6c66c957832c5943f4750dd1970355a697e1)
Reviewed-on: https://chromium-review.googlesource.com/411760
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-16 07:10:13 -08:00
Mary Ruthven
75232b40ac cr50: remove hid endpoint
We don't use the hid endpoint and any work we do now to get it to
suspend would probably need to be done again when adding the full
functionality. This change removes the hid endpoint entirely.

BUG=chrome-os-partner:57726
BRANCH=none
TEST='cat /sys/bus/usb/devices/1-7/power/runtime_status' shows the
device is suspended

Change-Id: Id948fb02cf1a8ab605a35d028c563c2f78b91a64
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/411531
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-16 07:10:10 -08:00
Archana Patni
edaedfaab4 npcx: set and clear wake masks in S0 <-> S0ix transitions
In the S0 <-> S3 transition, Coreboot sends EC messages to set/clear
the wake masks when the SMI is invoked. For S0ix, EC sets and clears
the wake mask via this patch.

These functions are directly invoked from the state machine transition
states. During S0ix entry, the wake mask for lid open is enabled.
During S0ix exit, the wake mask for lid open is cleared. All pending
events are also cleared.

BRANCH=none
BUG=chrome-os-partner:58740
TEST=test lidopen in S0ix

Change-Id: I398fdba2b9bba1f6caef46f8dc71c7de3b669d08
Signed-off-by: Archana Patni <archana.patni@intel.com>
Signed-off-by: Subramony Sesha <subramony.sesha@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/401070
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2016-11-16 07:10:03 -08:00
Gwendal Grignou
430dd5e644 reef: Add matrix for lid accelerometer.
No matrix was set, the reported data by the accelerometer
was not in the proper referential.

BUG=chrome-os-partner:58792
BRANCH=none
TEST=with ectool motionsense, check the data matches the standard.

Change-Id: I25aa3a1774ba80f1a0f8a41adc976af832436c63
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/411358
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2016-11-16 07:09:49 -08:00
Nicolas Boichat
bd60328a6e include/host_command: Conditionally define host event functions
Some functions are only defined if CONFIG_HOSTCMD_EVENTS is set,
leading to link-time failures.

In particular, do not call these functions from keyboard_scan,
and do not define PD host event commands if the configuration
option is not set.

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

Change-Id: I0da31cdec08f86f148aa883698a44f462de46d8e
Reviewed-on: https://chromium-review.googlesource.com/410923
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-16 07:09:28 -08:00
Martin Roth
c66d36761f Makefile.rules: Add targets to see file size differences
Since the ec binaries are so tight on space, it would be nice to be
able to see just how much changes are affecting the size.  This allows
users to easily do before/after comparisons.

Sample output:
build/sweetberry/RW/ec.RW.flat shrank by 44 bytes: (43828 to 43784)
build/twinkie/RO/ec.RO.flat shrank by 64 bytes: (46312 to 46248)
build/twinkie/RW/ec.RW.flat shrank by 40 bytes: (45900 to 45860)
build/wheatley/RW/ec.RW.flat shrank by 40 bytes: (102692 to 102652)
Compared 156 of 156 files.
81 files changed.
Total size change: -3100 bytes.
Average size change: -38 bytes.

BRANCH=none
BUG=none
TEST=make clobber buildall -j; make savesizes
[change some code that changes file sizes]
make clobber buildall -j ; make newsizes
[Shows size differences]

Change-Id: I48b440063eb6eb6c00900af3d0dfa075be6f9ec7
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410860
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:43:21 -08:00
Vadim Bendebury
ae632fa21e cr50: add a function to tell between prod and dev keys
To keep things simple it has been decided to use a certain key ID bit
as an indication of a prod versus dev key type.

The key ID value is derived from the key value, and is easy to enforce
(by generating another key in case the value does not match the
required key type).

This information will also be available through the cr50 userspace
tool.

BRANCH=none
BUG=chrome-os-partner:58230
TEST=ran the new code on prod and dev devices; On prod:
   > sysinfo
   Reset flags: 0x00000800 (hard)
   Chip:        g cr50 B2
   RO keyid:    0x3716ee6b(dev)
   RW keyid:    0xb93d6539(dev)
   DEV_ID:      0x015bb2a9 0x04656742

    on dev:
   > sysinfo
   Reset flags: 0x00000800 (hard)
   Chip:        g cr50 B2
   RO keyid:    0xaa66150f(prod)
   RW keyid:    0xde88588d(prod)
   DEV_ID:      0x0180305d 0x04656742

Change-Id: I37b12e02eb62f4f86bb58468ee301e77446451da
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410291
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-15 17:42:44 -08:00
Aseda Aboagye
703d134977 mec1322: Place idlestats behind config option.
The `idlestats` command was not behind the CONFIG_CMD_IDLE_STATS option;
this commit fixes that.

BUG=None
BRANCH=glados
TEST=build a board that uses mec1322.  Undef CONFIG_CMD_IDLE_STATS;
verify that the command isn't present in the build.

Change-Id: Id17c8377f812ee2a63dc4507766c1c557704dcb1
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/411518
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-15 17:42:41 -08:00
Martin Roth
ab6a4897b6 extra/usb_gpio: fix misspelled variable name
This should be 'transferred'.

BUG=None
BRANCH=None
TEST=make buildall passes

Change-Id: I40c3c456256eb1d4ae553545497566afae929e32
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403422
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:42:01 -08:00
Martin Roth
3d738b88ab board/kevin: fix misspelled #define
This should be 'THRESHOLD'.

BUG=None
BRANCH=None
TEST=make buildall passes

Change-Id: Ib80c21edde6890ec51b809896acd9a6cedf49a87
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403421
Reviewed-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:59 -08:00
Martin Roth
680e4fff2b include/btle_hcl_int.h: Fix misspellings in #defines and struct name
These are not used anywhere else in the EC codebase.

Fix VERSION, OCCURRED, Response, & Supported

BUG=None
BRANCH=None
TEST=make buildall passes

Change-Id: I078a8b613fffac0029723cf3c8a5666e71d4a9ac
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403420
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Myles Watson <mylesgw@chromium.org>
2016-11-15 17:41:58 -08:00
Martin Roth
b3bc41c2fe util/ecst: Fix misspelling in #defines
This should be 'default'

BUG=None
BRANCH=None
TEST=make buildall passes

Change-Id: I58a960ed48f8ea42529682cef4d99c98ac1aa2dc
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403419
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
2016-11-15 17:41:56 -08:00
Martin Roth
651f8b9acd chip/g to chip/lm4: fix more misspellings in comments
No functional changes.

BUG=none
BRANCH=none
TEST=make buildall passes

Change-Id: I0c4fcc900ec0326d6904aa14f298206e62be0fda
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403418
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:55 -08:00
Martin Roth
897ce78bdd Fix various misspellings in comments
No functional changes.

BUG=none
BRANCH=none
TEST=make buildall passes

Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403417
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:53 -08:00
Mario Tesi
64b57efebd accel: add accel driver for LSM6DSM
This add basics for acc and gyro sensor ST lsm6dsm
Still need to add interrupt management for embedded
functions and FIFO

BUG=none
BRANCH=master
TEST=Tested on discovery BOARD with sensor connected on
EC i2c master bus. Added motion sense task on discovery
board task list, added gpio info in board configuration
file and tested with motion sense console commands. Data
for acc/gyro seems ok, can successfully change ODR and
full scale range for acc and gyro.

Change-Id: Ie50c8c0ee366994ed97f7ff3252633893b813ac2
Signed-off-by: Mario Tesi <mario.tesi@st.com>
Reviewed-on: https://chromium-review.googlesource.com/406947
Commit-Ready: mario tesi <mario.tesi@st.com>
Tested-by: mario tesi <mario.tesi@st.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-11-15 07:04:30 -08:00
Aseda Aboagye
1d093deb54 motion_lid: Make tablet mode great (again).
Chrome seems to pay attention to the tablet mode switch reported by the
EC.  However, for some devices that don't actually have a switch and use
the lid angle as a "virtual" switch, it's possible for invalid tablet
mode change events to be reported.  This is because a single reading
could flip the switch.

This commit adds some debouncing to the tablet mode event changes.
Instead of having a single event be able to change the tablet mode
switch, we will now perform TABLET_MODE_DEBOUNCE_COUNT number of
calculations of the new tablet mode value.  If those calculations all
agree, then we'll flip the switch.  This should help mitigate false
tablet mode change events caused by spurious forces.

BUG=chrome-os-partner:59203
BUG=chrome-os-partner:59480
BRANCH=gru
TEST=flash kevin; open lid to pi/2 rad; rotate device counter-clockwise
pi/2 rad; shake device and verify that tablet mode doesn't change
easily.
TEST=verify that tablet mode still works.

Change-Id: Id020f7db28e93e53b276b3f0d28a40251f035f0b
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/410942
Commit-Ready: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2016-11-15 03:09:02 -08:00
Vijay Hiremath
cfe12b90bc reef: Enable high current on type-A ports by default
BUG=chrome-os-partner:59309
BRANCH=none
TEST=Able to draw 1.5A from Type-A ports

Change-Id: I9c598f77a542650edf15f407ec4a10d0e7e7465e
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/411345
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-15 00:53:29 -08:00
Ryan Zhang
7618346aaa Electro: modify battery cutoff command
Follow Banon's setting

BUG=chrome-os-partner:59535
BRANCH=master
TEST=`make -j buildall`, shipping mode works well.

Change-Id: Idf4b253ddb86a82752fca0f872ddb9603dee256c
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/411023
Commit-Ready: Ryan Zhang <ryan.zhang.quanta@gmail.com>
Tested-by: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-14 22:47:44 -08:00
Divya Sasidharan
af848fcce3 anx74xx: Fix typo in anx74xx_check_cc_type function
BRANCH=none
BUG=none
TEST=manual, On Reef connected hoho and made sure it is
properly detected instead of as an accessory.

Change-Id: I1c271a8c5c2800dd88bf0e63a7c7aa2e23551510
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/411382
Commit-Ready: Kevin K Wong <kevin.k.wong@intel.com>
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-14 22:47:43 -08:00
Ryan Zhang
4a1f5b0927 Electro: Support 360 Degree rotation
Follow Cyan's & Glados's setting.

BUG=chrome-os-partner:59536
BRANCH=master
TEST=system can boot up normally.

Change-Id: I6abfcef06e5b46cb974706b7472c73f00a644544
Signed-off-by: Ryan Zhang <Ryan.Zhang@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/408497
Commit-Ready: Ryan Zhang <ryan.zhang.quanta@gmail.com>
Tested-by: 志偉 黃 <David.Huang@quantatw.com>
Reviewed-by: Mohammed Habibulla <moch@google.com>
Reviewed-by: Vincent Wang <vwang@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-14 22:47:31 -08:00
Mary Ruthven
9495ea7564 cr50: Stop disabling the AP/EC uart when ccd is disabled
This change removes the uart disable in rdd_disconnect. It used to be
necessary because we used to disable device state detection in
rdd_disconnect. Without device state detect we had to disable the AP and
EC uart to make sure there were no interrupt storms. Now we keep device
state detection running all the time. It handles enabling/disabling the
AP and EC uart when it senses the RX signals aren't pulled up.

UART is only enabled/disabled when cr50 detects that the AP or EC state
changed from off to on or on to off. If the debug cable is detached and
then reattched the uart will be disabled on detach, but it won't be
reenabled until the AP/EC are rebooted.

BUG=chrome-os-partner:58222
BRANCH=none
TEST=Detach and reattach suzyq without rebooting the AP or EC and make
sure both consoles come back after reattaching the cable.

Change-Id: Id104e12dc533e8d7047f32aebd41abd1c959d267
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410269
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-14 20:00:40 -08:00
Vijay Hiremath
f61da52856 reef: Enable fast charging profile
Enable fast charging profile config (CONFIG_CHARGER_PROFILE_OVERRIDE)
so that the battery desired current & voltage can be selected for given
rated performance values.

BUG=chrome-os-partner:59779
BRANCH=none
TEST=Manually overrode the temperature and voltage. Observed correct
     charge profile config is selected for each tests.

Change-Id: I080a3ace6d2f77bb6b97911b7705a44ec563258b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410824
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-14 20:00:09 -08:00
Bruce
3af2f5e0d4 Snappy: enable tcpc-controlled drp toggle
BUG=None
BRANCH=None
TEST=make buildall

Change-Id: Icdeb4c67234c863128d1d3dd9bdecd149ee866ce
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409733
Commit-Ready: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-13 21:58:31 -08:00
Vijay Hiremath
9b47a0812d skylake: Add support to S0iX based on host commands from Kernel
Picked the code from Glados branch.
 Change-Id: I4bf114235c4d542dd7cf0dad6427c771e54d4611
 https://chromium-review.googlesource.com/#/c/331358/

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

Change-Id: Ib79f1209dfd9e6a9de0438cb1866bba2939e5393
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410036
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
2016-11-13 10:58:58 -08:00
Vijay Hiremath
98402bb466 smart_battery: Add console command to read ManufacturerAccess() data
Added console command to read ManufacturerAccess() data on a given
register block.

BUG=chrome-os-partner:59660
BRANCH=none
TEST=Enabled config on Reef.
     Successfully able to read ManufacturerAccess() data

Change-Id: Ic86ae1b44ca8016634c48b54b1130d30fdd2d3fa
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/409638
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-12 23:55:08 -08:00
Bruce
4975e8db75 Pyro: Enable BD9995X power save mode when hibernated
Turn off the charger BGATE when the system is hibernated to
save maximum power.

BUG=None
BRANCH=None
TEST=make buildall

Change-Id: Ifd5d50bbdfde1383538e3ce86f002845798940ac
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409853
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-12 20:33:10 -08:00
Bruce
b7c2f5c295 Pyro: enable tcpc-controlled drp toggle
BUG=None
BRANCH=None
TEST=make buildall

Change-Id: I9a37cffc6018a34ba865d718f488206f06d96087
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409895
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-12 20:33:08 -08:00
Bruce
c6273b6145 Pyro: clear hpd bit in board level tcpc init
PD alternate mode is covered in tcpc interface. So tcpci_tcpm_init()
doesn't reset HPD. If keeping HDMI/DP type-C cable connected, doing
sysjump sets HPD signal to high while it's already high(this high comes
from previous state), then OS doesn't output to HDMI/DP monitor.

BUG=None
BRANCH=none
TEST=make buildall

Change-Id: Ic3bc75b1e5579816d8c1b294fe2eb65a20e3eae3
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/409751
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-12 20:33:07 -08:00
Vijay Hiremath
3f728b4ca6 bd9995x: Battery charging profile settings
Added battery charging profile settings as given in the datasheet.

BUG=chrome-os-partner:58553
BRANCH=none
TEST=Manually verified on reef. VBAT is equal to battery voltage.
     Previous/current Charge status is equal to the conditions given
     in the datasheet.

Change-Id: Ie04619a122fe52d6768c03ff5156b368e3f2d340
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/398080
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2016-11-12 01:50:27 -08:00
Mary Ruthven
732dced60f cr50: request 0mA instead of 500mA for CCD
This changes the usb descriptor to set the MaxPower to 0mA instead of
500mA.

BUG=chrome-os-partner:59564
BRANCH=none
TEST=Verify 'lsusb -vd 18d1:5014 | grep MaxPower' shows the power is 0mA

Change-Id: Ieeb8dec6c205f4fe51392f8106b3a0ed7d3ea0a5
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/410288
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
2016-11-11 23:12:02 -08:00
Bill Richardson
12da6c23fb Cr50: Add TPM-compliant commands for console lock
This allows custom TPM commands to be declared using the a
DECLARE_VENDOR_COMMAND macro instead of the original (and still
unchanged) DECLARE_EXTENSION_COMMAND macro.

The new commands are nearly identical, but they are encapsulated
using the vendor-specific protocols described in the TPMv2 spec.
Our original extensions use a non-standard command code, and
return a non-standard struct on completion, which can be
confusing to standard TPM drivers and tools.

Demonstrating the use of the new macros, this adds commands to
obtain the state of the Cr50 restricted console lock, or to set
the lock. There is intentionally no command to unlock the
console.

Note that this CL just adds the commands to the Cr50. We still
need to provide a nice userspace utility for the AP to use.

BUG=chrome-os-partner:58230
BUG=chrome-os-partner:57940
BRANCH=none
TEST=make buildall; load, boot, test, and update again on Reef

On Reef, I can use the trunks_send tool to send the raw TPM bytes
to invoke these commands:

Get the lock state:

  # trunks_send 80 01 00 00 00 0C 20 00 00 00 00 10
  80010000000D00000000001000

The last byte 00 indicates that the lock is NOT set, so set it:

  # trunks_send 80 01 00 00 00 0C 20 00 00 00 00 10
  80010000000C000000000011

Success. On the Cr50 console, I see it take effect:

  [480.080444 The console is locked]

Query the state again:

  # trunks_send 80 01 00 00 00 0C 20 00 00 00 00 10
  80010000000D00000000001001

and now the last byte 01 indicates that the console is locked.

And of course the existing extension commands still work as
before. In addition to uploading firmware, I can use the
usb_updater from my build machine to query the running firmware
version:

  $ ./extra/usb_updater/usb_updater -f
  open_device 18d1:5014
  found interface 4 endpoint 5, chunk_len 64
  READY
  -------
  start
  Target running protocol version 5
  Offsets: backup RO at 0x40000, backup RW at 0x4000
  Keyids: RO 0x3716ee6b, RW 0xb93d6539
  Current versions:
  RO 0.0.10
  RW 0.0.9
  $

Change-Id: I7fb1d888bf808c2ef0b2b07c782e926063cc2cc4
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409692
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-11 23:11:51 -08:00