Commit Graph

6265 Commits

Author SHA1 Message Date
Furquan Shaikh
2fc7ba9df1 common: Add new recovery mode button combination
This adds new key combination (Left_Shift+Esc+Refresh+Power) that triggers
recovery mode by setting a new host event
EC_HOST_EVENT_KEYBOARD_RECOVERY_HW_REINIT. This host event can be used
whenever user wants to request entry into recovery mode by
reinitializing all the hardware state (e.g. memory retraining).

BUG=chrome-os-partner:56643,chrome-os-partner:59352
BRANCH=None
TEST=Verified that device retrains memory in recovery mode
with (Left_Shift+Esc+Refresh+Power) on reef.

Change-Id: I2e08997acfd9e22270b8ce7a5b589cd5630645f8
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407827
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-08 20:30:07 -08:00
Gwendal Grignou
bf4e1db093 driver: sensor: Remove set_interrupt
Remove set_interrupt(), was always a noop.
Unused, interrupt is done inside the init routine.

BUG=none
BRANCH=none
TEST=buildall

Change-Id: I0ff4843212ea8140be41dcd17af130991117e3da
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407968
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 17:12:18 -08:00
Gwendal Grignou
9b67ffcd52 common: Add tablet_mode API
Simple API to set/get the tablet mode. It can be set via lid angle
calculation or if a board has a dedicated HAL sensor/GPIO.

Merged from glados branch, add MKBP switch support.

BUG=chromium:606718
BRANCH=gru
TEST=Check with Cave that both mode works.

Reviewed-on: https://chromium-review.googlesource.com/402089
Reviewed-by: Shawn N <shawnn@chromium.org>
(cherry picked from commit c940f36ceabcf2425284001298f03ebdb4c3079e)
Change-Id: I2ee5130f3e0a1307ec3ea543f7a32d66bc32b31d
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404915
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 17:11:28 -08:00
Nick Sanders
8bb2d9fbf0 usb_serial: add python console
console.py can access a Google USB serial endpoint
specified by vid:pid and serial number

BUG=chromium:608039
TEST=open console to send and receive text.
BRANCH=None

Change-Id: I735692b7031d73506be2745a2cd5225bfcefd396
Reviewed-on: https://chromium-review.googlesource.com/405030
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Kevin Cheng <kevcheng@chromium.org>
2016-11-08 17:11:15 -08:00
Wonjoon Lee
b044fba33c bd9995*: maintain VBAT voltage as battery maximum
BUG=chrome-os-partner:54248
BRANCH=gru
TEST=Manual on kevin, high temperature chamber(60C),
battery will require 0 voltage because of high temp,
then check 'chgstate' vbat maintained at 8688 mV.

Change-Id: I3b5835701c42a0cd861400ba921b3d3797152bbd
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/400088
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-08 02:53:54 -08:00
Bill Richardson
c335895df7 Cr50: Let NVMEM take more time and memory
We were getting occasional stack overflow and watchdog timeouts
when clearing NVMEM. Bump up the stack size a bit in the HOOKS
task, and pet the watchdog before invoking the tpm2 init
functions.

BUG=chrome-os-partner:59419
BRANCH=none
TEST=make buildall, manual

Lock the console, then unlock it. This will reboot the EC & AP,
but should never reboot the Cr50.

Before this CL, it did about half the time.
After, it doesn't.

Change-Id: I33adfeb7360bf7d146a55ef16c923a1a0416393d
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407847
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-05 21:03:06 -07:00
Vijay Hiremath
cc944ac92a reef: Update battery structure info as in the spec
BUG=chrome-os-partner:59285
    chrome-os-partner:55861
BRANCH=none
TEST=make buildall -j

Change-Id: I2a22f5ef0072793701f4899cd6e669b8cccca78b
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/406682
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-05 17:41:04 -07:00
Shawn Nematbakhsh
ddc3b3429f elm / kevin / oak: Don't wake from S3 on lid close
BUG=chrome-os-partner:59256
BRANCH=gru
TEST=None

Change-Id: I8e41dc131343e7639850364db27a3ff926164fba
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/407078
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-05 14:40:15 -07:00
Scott
4555fe63f5 anx74xx: Modifed tcpm_get_cc function to fix check for 3.0 A type
When attaching a dump (not PD protocol) TypeC charger, the incorrect
charger type was being selected and therefore it was not enabling 3A
charging. I tracked this issue down to the anx74xx_tcpm_get_cc()
function returning a incorrect value. The expected value was
TYPEC_CC_VOLT_SNK_3_0, but instead it was returning
TYPEC_CC_VOLT_SNK_DEF.

The reason the incorrect cc type was being returned is because the if,
else if, construct didn't work properly for the 3A case where the
upper 2 bits are set. Modified this routine to use a case statement
and consolidated the checks for both cc1 and cc2 into one helper
function.

BRANCH=none
BUG=chrome-os-partner:58738
TEST=manual
Connected zinger and guppy chargers and verified correct cc type was
being returned. In addition tested hoho/dingdong adapters as well as
suzyq. Tested both cable orientations to verify that cc1 and cc2
returned the correct values.

With guppy connected, now see this output on ec console:
C0 HARD RST TX
C0 st5
C0 st36
C0 st37
C0 HARD RST TX
C0 st5
[1921.980074 AC on]
[1922.008140 charge_request(8688mV, 9280mA)]
C0 st6
[1922.910539 Ramp p0 st5 3000mA 3000mA]

Change-Id: I8b31c7ce366f383dfcc2f6e850b76a83340a02a1
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406642
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-04 18:31:56 -07:00
Kevin K Wong
72d72ea008 host_command_pd: reduce to 5msec delay in between PD interrupt handling
Since PD task are highest priority, the 50msec delay between was intended
allow other tasks to execute if PD has continuous interrupt. With two
separate TCPC handled by host_command_pd task, interrupt from one TCPC will
block the interrupt handling of another TCPC by this 50msec and cause
error in the PD negotiation.

Reduced to 5msec to ensure TCPC interrupt is handled as soon as possible
while allow other tasks to execute if needed.

BUG=chrome-os-partner:59061
BRANCH=none
TEST=Verify zinger can negotiate to 20V, hoho can get display. Also tested
with faking PD interrupt always asserted to check for watchdog reset.

Change-Id: I9b71277a3d65923f1f5bbfd744b3399e34fd0e6c
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/407542
Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2016-11-04 18:31:49 -07:00
Scott
3405c79584 Cr50: I2CS TPM: Ensure HW read fifo is empty for register reads
This change is a safegaurd to ensure that TPM register data is always
placed in the correct location in the HW read I2CS fifo. It is only
checked for 1 or 4 byte regsiter reads. Because of the way in which a
TPM command is sent and the response is read, there are multiple reads
of the STS register prior to reading the TPM fifo register. Therefore
ensuring the fifo has zero depth when 1 or 4 byte regsiter reads,
improves the robustness of the design.

Added a counter to track the number of times the fifo is adjusted and
a new console command 'i2cs disp|rst' to display the count and reset
it to 0 if desired.

Removed section in code for TPM fifo register reads intended to handle
the case where there was a mismatch between how many bytes were copied
into the fifo and the number read by the host. Since the burstcount
field in the status register always contains a valid amount of data
that can be read by the host, there should not be cases where the
host reads less data than was copied from the TPM fifo register. In
the unexpected cases where the host may not drain all of the I2CS read
fifo data during a TPM register read, the I2CS fifo depth will be
corrected the next time that it reads either the access or STS
register which happens prior to the start of any TPM transaction.

BRANCH=none
BUG=chrome-os-partner:57338,chrome-os-partner:59191
TEST=manual
Booted Reef and verfied that TPM functionality is working.

Change-Id: I065a55e64bbcc0cb3357a2bd83447a05400b8899
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382689
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-04 18:31:46 -07:00
Mary Ruthven
f16d6e43d3 g: add permission level checks
The jittery clock and trng security features require high permissions to
be initialized. In the future these initializations and the permission
level drop may be moved to RO.

This change adds permission level checks before trying to access any
registers that require high permission, so when we update RO to change
the permission RW can still function fine.

BUG=chrome-os-partner:59107
BRANCH=none
TEST=Move the permission drop to the beginning of main and verify the
system still boots.

Change-Id: I5b7cb856decd0640288ad3476f875ec9edc42635
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/405840
2016-11-04 18:31:44 -07:00
Shawn Nematbakhsh
1f6600fd34 mkbp_event: Properly queue events during host sleep
Don't queue non-wake events, and ensure wake events (and all subsequent
events) always get queued.

BUG=chrome-os-partner:59248, chrome-os-partner:59336
BRANCH=gru
TEST=Manual on kevin, go to suspend, press volume keys dozens of times,
press 'shift', verify device wakes. Place cursor on URL bar, go to
suspend, type "google" quickly, verify device wakes and "google" appears
on URL bar. Go to suspend, press 'VolUp' key 5 times, press keyboard,
verify device wakes and no volume meter is seen on display.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ibe761187fbcefd686776a512786550970a6fc067
Reviewed-on: https://chromium-review.googlesource.com/405717
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
(cherry picked from commit aa2f01566314604404e104d7975c6c755c22a601)
Reviewed-on: https://chromium-review.googlesource.com/407958
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2016-11-04 18:31:37 -07:00
Shawn Nematbakhsh
f7d5360449 mkbp_event: Don't use memmap'd host event mask
Previously the memmap'd host event mask copy wasn't always updated. Be
consistent with other mkbp code and call host_get_event() to get our
current mask.

BUG=chrome-os-partner:59241
BRANCH=gru
TEST=Manual on kevin, close lid to suspend, press volume keys, verify
device doesn't wake. Open lid, verify device wakes. Run
'powerd_dbus_suspend', press volume keys, verify device doesn't wake.
Press keyboard key, verify device wakes.

Change-Id: I3de49efa1ebc53a9c56bed57007c48356c7e97bb
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406547
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 763d3b2c6f26d41e7147f860e59755af2fe87fe4)
Reviewed-on: https://chromium-review.googlesource.com/407957
Commit-Ready: Douglas Anderson <dianders@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
2016-11-04 18:31:36 -07:00
Jaiber John
a750b1d6b1 minute-ia: Revise macros to be version independent
A few macros that were defined for ISH3.0 were renamed to be generic for
all ISH generations - e.g, ISH30_I2C0_IRQ -> ISH_I2C0_IRQ. Similarly
macros representing base addresses were revised to add ISH_ prefix.

BUG=chrome-os-partner:51851
BRANCH=None
TEST=`make buildall -j`

Change-Id: Idf6657a112b9bd0f73a77f13d02e327c10a9a272
Signed-off-by: Jaiber John <jaiber.j.john@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/403550
Commit-Ready: Raj Mojumder <raj.mojumder@intel.com>
Tested-by: Jaiber J John <jaiber.j.john@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Jaiber J John <jaiber.j.john@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-04 18:31:30 -07:00
Jaiber John
d7b938f857 ish: Add support for ISH chip
This patch adds the initial support for ISH chip to enable the EC
firmware to boot on Intel Integrated Sensor Hub (ISH). The following are
enabled:

1. Inter-Processor Communication (IPC) driver that enables the ISH to
communicate with the host Operating system via shared registers.
2. High Precision Event Timer (HPET) driver that provides configurable
timers for the FW to use in task scheduling.
3. I2C bus driver for accessing sensors.
4. UART console driver with TX support only.

BUG=chrome-os-partner:51851
BRANCH=None
TEST=`make buildall -j`

Change-Id: I15d4c201b799cfa79bed220ee573b75f5cd7b1f7
Signed-off-by: Jaiber John <jaiber.j.john@intel.com>
Signed-off-by: Alex Brill <alexander.brill@intel.com>
Signed-off-by: Gomathi Kumar <gomathi.kumar@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/336710
Commit-Ready: Raj Mojumder <raj.mojumder@intel.com>
Tested-by: Jaiber J John <jaiber.j.john@intel.com>
Tested-by: Raj Mojumder <raj.mojumder@intel.com>
Reviewed-by: Jaiber J John <jaiber.j.john@intel.com>
Reviewed-by: Raj Mojumder <raj.mojumder@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-04 18:31:29 -07:00
Gwendal Grignou
cbae8f9b32 kevin: Add Sensor in S3, disable keyboard wakeup in tablet mode.
Let sensor be powered on in S3. It is useful for Android and if we want to
disable keyboard wakeup based on lid angle.
Allow EC to disable touchpad and not send keyboard events when lid angle
is greater than 180.

BUG=chrome-os-partner:57510,chromium:620633
BRANCH=gru
TEST=In S3, check the sensors are readable.
Check that when in S3 and lid angle is < 180 EC sends keyboard events.
Check that when in S3 and lid angle is > 180 EC does not send keyboard
events.

Change-Id: I4e7959ed37bc5dfdf9c105ecae94c314b253d77f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406739
Commit-Ready: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-04 04:54:20 -07:00
Marius Schilder
b8c1ce6700 bn_div and faster modular inverse.
We previously used binary extended Euclid. That does not perform well
when inverting a small public exponent.
We also abused that routine to perform the division of n by one of its
factors. Really did not perform well there either.

This CL introduces a classic Knuth long division and a normal extended
Euclid based on that.

This drops the execution time of the common inversions into the single
msec range (vs. multiple seconds before..)

TEST=tcg_tests pass the usual 381/391; test/tpm_test/bn_test passes.
BUG=chrome-os-partner:57422
BRANCH=none
Change-Id: Ic9b4aecd0356fcab3e823dbd60c5b228a87447d3
Reviewed-on: https://chromium-review.googlesource.com/406940
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-03 14:44:27 -07:00
Marius Schilder
a5dcd95432 Add prod RW manifest and public key.
Change-Id: If008b0dc388fdd81366e52aab8046af83a288e12
Reviewed-on: https://chromium-review.googlesource.com/407050
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-11-03 14:44:24 -07:00
philipchen
6b1f11d6b9 gru: fix the power led color
In the current implementation, it's hard to tell
when led turns from amber to green.

BUG=chrome-os-partner:57079
BRANCH=None
TEST=Verify LED is green when charging w/ nearly full battery.
Also verify LED control host commands work as expected:
ectool led battery green=1  // green
ectool led battery amber=1  // amber
ectool led battery red=1    // red
ectool led battery red=0    // off

Change-Id: Ie18162fd1608a0548e25472faeca026f1995fc8d
Reviewed-on: https://chromium-review.googlesource.com/406471
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-11-02 17:40:04 -07:00
Nick Sanders
a04fc68e72 usb_i2c: refactor into common
This combines stm32 and chip/g usb_i2c interfaces so they
will not diverge. Note that this fixes the chip/g implementation
to use 8-bit i2c addresses.

BUG=chrome-os-partner:57059
BRANCH=none
TEST=servod interacts with servo_micro and servo_v4

Change-Id: Ibff217d84b132556202c8a71e3d42c07d546c634
Reviewed-on: https://chromium-review.googlesource.com/405108
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-11-02 17:39:56 -07:00
Marius Schilder
d4bff62d36 Fix bugs.
L_fallback_32bits: section did not compute remainder correctly.
L_sub_loop1: section did not track r6 correctly.

Also correctly annotate which instructions need to set the flags.

BRANCH=none
BUG=none
TEST=now passes the tests in
http://www.hackersdelight.org/hdcodetxt/divmnu64.c.txt
Change-Id: Ib55a3bbbcee35c7f21dc67f51038783ea1d26f6c
Reviewed-on: https://chromium-review.googlesource.com/396397
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-02 09:20:18 -07:00
Kevin K Wong
180ac77e16 reef: enable tcpc-controlled drp toggle
BUG=chrome-os-partner:54668
BRANCH=none
TEST=Verified SNK is detected in S0 (toggle on), S3 (toggle off),
and S5 (force sink). SRC is detect in S0 only, stays detected when
entered S3, but unplug/plug while in S3 will not re-detect until
system back in S0. When go to S5, SRC will get disconnected until
back in S0, and hotplug SRC in S5 will not get detected. Checked
power role swap with another chromebook in the above scenario also.

Change-Id: I2a487fca5cb04c45524aa3efde84fcd10ff0579e
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/396918
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-02 06:42:04 -07:00
Scott
dd652accd0 g: i2cm: Changed the slave address assumption to 8 bits
The i2c_xfer API assumes it's getting an 8 bit slave address, but the
driver was assuming a 7 bit slave address was being passed in. Fixed
the location where this is used to shift it back to 7 bits.

BRANCH=none
BUG=chrome-os-partner:57059
TEST=manual
Cr50 console 'ccd i2c on' then
> i2cxfer r16 0 0x40 0
Unknown error
Usage: i2cxfer r/r16/rlen/w/w16 port addr offset [value | len]
> i2cxfer r16 0 0x80 0
0x2771 [10097]
Shows that it's now assuming an 8 bit address

Change-Id: I791b7c136a741856749c281dd4c8166b5cf97ef9
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/405780
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2016-11-02 04:23:21 -07:00
Gwendal Grignou
cd30d638ab driver: bmi160: Autocalibrate Accelerometer properly.
Take into account the rotation matrix to do calibration.
In particular the Z axis: if board is upside down, we need to use
MINUS_1G instead of PLUS_1G when setting online calibration.

BRANCH=kevin
BUG=none
TEST=Before, calibration would not work on the Z axis.

Change-Id: Ifaec331aac40a4be0e34fcab5dd3752d2d59b91f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/405854
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-02 04:23:07 -07:00
Nick Sanders
75b1ec6d78 usb_update: increase read timout for fw_update.py
sweetberry takes a bit longer to erase flash and seems to be timing
out. This fix gets sweetberry to update reliably.

BUG=chromium:608039
TEST=update sweetberry firmware
BRANCH=None

Change-Id: I9a0cbeae3b7ce0e4b87840fe8bf24bb2e10777e9
Reviewed-on: https://chromium-review.googlesource.com/404710
Commit-Ready: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-01 19:18:40 -07:00
Mary Ruthven
488afbd2cf cr50: remove pullups on dioa9 and a1
BUG=chrome-os-partner:59238
BRANCH=none
TEST=verify reef still boots and cr50 still goes to sleep in s3 and s5.

Change-Id: Ibea9ae5ca501dc4bd9ff87d7c702f232be24acbd
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/405837
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-01 19:18:37 -07:00
Scott
e2305b6af9 BD9995X: Fix disable case in bd9995x_select_input_port
The 'else' was missing in the for the check of
port == BD9995X_CHARGE_PORT_BOTH. So if it wasn't this port type then
it would always hit the panic.

BUG=chrome-os-partner:59189
BRANCH=none
TEST=Manual
Verfied the failure case using a type C to type A adapter. After
applying the fix verified that it no longer panics.

Change-Id: Ia5a16c39e226d5e648c20d0c8675d6433d083f22
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/405747
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-11-01 12:48:48 -07:00
Bruce
e8ab026bac Snappy: support LED behavior
Support LED behavior.

BUG=chrome-os-partner:58771, chrome-os-partner:58772
BRANCH=None
TEST=make buildall

Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Change-Id: Ieb323b5ff5e1096febef9948cf39b1fb22ff094a
Reviewed-on: https://chromium-review.googlesource.com/403674
Commit-Ready: Bruce Wan <Bruce.Wan@quantatw.com>
Tested-by: Bruce Wan <Bruce.Wan@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-31 22:40:26 -07:00
Bruce
49ed82eaa7 Pyro: Add firmware for shipping mode follow Pyro battery spec.
Add firmware for shipping mode follow Pyro battery spec.

BUG=None
BRANCH=None
TEST=The battery could enter shipping mode and wake up

Change-Id: If1b6e88192ad0a59b19b6b6b664b46780596fa18
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/403731
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-31 14:21:27 -07:00
Scott
3c39ccabda eve: Enable BMI160 and BMM150 gyro/compass sensors
Added necessary CONFIG options and board specific info to enable the
following sensors:

1. KXCJ9 Lid motion sensor
2. BMI160 motion sensor
3. BMI160 gyro sensor
4. BMM150 magnetometer sensor

BRANCH=none
BUG=chrome-os-partner:58894
TEST=manual
accelrate 2 10000 -> enable gyro
accelrate 3 10000 -> enable magnetometer
accelinfo on 1000 -> display sensor outputs once per second

See outputs like the following:
Base Accel=3022 , 1685 , -15925
Base Gyro=188  , -1404, -300
Base Mag=-253 , 218  , 1004

Moved eve board around and saw the readings change accordingly.
Have not tested lid motion sensor at this stage.

Change-Id: Ia658de4cbf441759482a053358230793550ef5ab
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404987
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
2016-10-31 11:49:35 -07:00
Scott
e852d78bc2 anx74xx: Added check for hard reset done bit in IRQ status
The check for hard reset complete was missing. Because of this, the
USB PD protocol state machine would get stuck in state 36
PD_STATE_HARD_RESET_SEND waiting for the pd_task to be woken following
the tx_complete. Instead it would always trip the 100 msec timeout.

BRANCH=none
BUG=chrome-os-partner:58738
TEST=manual
Without this CL, connect to a Guppy TypeC charger and observe:
> C0 st3
[101.946607 event set 0x00200000]
C0 st15
C0 st3
C0 st6
C0 st36
[102.466846 New chg p0]
[102.470376 Ramp reset: st1]
[102.470905 CL: p0 s2 i2000 v5000]
[103.543623 AC on]

After adding the fix for checking hard reset done:
> C0 st3
[32.880946 event set 0x00200000]
C0 st15
C0 st3
C0 st6
C0 st36
[33.410038 New chg p0]
C0 st37
[33.415641 Ramp reset: st1]
[33.416160 CL: p0 s2 i2000 v5000]
C0 HARD RST TX
C0 st5
C0 st36
C0 st37
C0 HARD RST TX
C0 st5
[34.489611 AC on]
[34.489965 event set 0x00000008]
[34.520457 event set 0x00400000]
[34.520876 charge_request(8688mV, 4608mA)]
C0 st6
[35.419391 Ramp p0 st2 500mA 0mA]

Change-Id: I6822983002fa387c85f7e55af5fe1e142c7b88e2
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404878
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-31 11:49:29 -07:00
Vincent Palatin
cf7ff32b92 kevin: set accurate current limit on USB load switch
When sourcing current on the type-C port, set the OCP limit on the VBUS
load switch according to current dynamic capability.
(3.0A when only one port is a power source, 1.5A else)

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

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

Change-Id: Ib879b1ed720b20aa702c5f3643948ba0575d1193
Reviewed-on: https://chromium-review.googlesource.com/403869
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-31 03:27:49 -07:00
philipchen
34066e92a9 gru: Enable barometer and ALS
BUG=chrome-os-partner:59084
BRANCH=gru
TEST=ec console command 'accelread' and 'als'

Change-Id: I2385799626eabef1ad7af5afe96e3d62ecaf7dd4
Reviewed-on: https://chromium-review.googlesource.com/402693
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-29 04:47:42 -07:00
Vijay Hiremath
cbc14b38f4 reef: Enable BD9995X power save mode when hibernated
Turn off the charger BGATE when the system is hibernated to
save maximum power.

BUG=chrome-os-partner:59001
BRANCH=none
TEST=Manually verified on the Reef.
     System can boot from hibernate wake sources.
     Following are the power measurement values at Battery
     voltage = 8.3V & temperature = 23 deg C.
     a. Normal operation 540uA, 3.500mW
     b. BGATE OFF        80uA, 0.592mW

Change-Id: Ia30655ccefbf0dded623246150d53b2a815df2de
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/404685
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-10-28 21:07:46 -07:00
Bruce
df028763fb Pyro: Yoga sensor setting fine tune
Fine tune matrix of base and lid.

BUG=chrome-os-partner:58798
BRANCH=None
TEST=check sceen rotate normally

Change-Id: Ib6740f0f5d6cda87d937b95dfa5788ae72b6aaaf
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/403694
Commit-Ready: Saurabh Madan <ssmadan@chromium.org>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Saurabh Madan <ssmadan@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:07:35 -07:00
Vadim Bendebury
71ad2e1625 g: usb: do not invoke reset twice
The RESETDET and USBRST USB interrupt status bits are often set
together. There is no point in resetting USB twice.

BRANCH=none
BUG=none
TEST=verified that cr50 still operates fine of Reef and ec and ap
     consoles are available (still intermittently).

Change-Id: I467d975a3a5955b6072a2a3376de7a1501e7c6c5
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404910
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-10-28 21:07:27 -07:00
Bruce
3df0f6a8d0 Pyro: modify led behaivor for Pyro spec
modify led behaivor for Pyro spec

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

Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Change-Id: I072dee0d15e83e6ea537b52e5475ed6c894e64ef
Reviewed-on: https://chromium-review.googlesource.com/403578
Commit-Ready: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-28 21:07:02 -07:00
li feng
8b0aac61dd reef: 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.
Reef Type-C port 1 follows TCPCI and has this issue.

BUG=chrome-os-partner:57689
BRANCH=none
TEST=Connect HDMI/DP type-C dongle, boot up system, OS detects HDMI/DP
monitor and extends screen to it; in console doing "sysjump RO"
or "sysjump RW", display goes out then comes back.

Change-Id: I12239a86490f29d0123fe8bad1b813d3be28d041
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/398444
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-10-28 21:07:00 -07:00
Gwendal Grignou
c457822a81 kevin: Set BMI160 interrupt
Interrupt from BMI160 was not set up.

BRANCH=gru
BUG=none
TEST=compile

Change-Id: I7d4bdb0b83ffb5de25c40e2c11b6e53b55863dcd
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404914
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:06:53 -07:00
Gwendal Grignou
f0adf18c91 driver: bma2x2/kionix remove unused fields
Remove fields that are not used anymore.

BRANCH=gru
BUG=none
TEST=make buildall

Change-Id: If4128a5db05e14314bba6c1d367774f098854ac5
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404913
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:06:51 -07:00
Shawn Nematbakhsh
690873bc75 power: rk3399: Decrease max. latency for aborted suspend
Make several calls to msleep() rather than one single call.

BUG=chrome-os-partner:58474
BRANCH=gru
TEST=S/R stress test on kevin.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Icdc8f221c51519e0f2b95d273aa0523ea3a4eeee
Reviewed-on: https://chromium-review.googlesource.com/401930
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403460
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:06:49 -07:00
Shawn Nematbakhsh
c2d60f53bc power: rk3399: Adjust power-down sequencing delays
BUG=chrome-os-partner:58474
BRANCH=gru
TEST=suspend_stress_test on kevin for 50 cycles.

Change-Id: Ice721e04c6d4389520f40c4ca72f5bec0e1bdb5b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/399992
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403459
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
2016-10-28 21:06:48 -07:00
Aseda Aboagye
ea1a8699e9 kevin: Remove PD related TODOs.
It was confirmed that these values were correct.

BUG=chrome-os-partner:59074
BUG=chrome-os-partner:59075
BRANCH=gru
TEST=make -j buildall

Change-Id: I8c63d563515c1fdcbd9f83203c193ba09f8f3447
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/404709
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-28 01:00:11 -07:00
Vadim Bendebury
e4477a7b8c cr50: bump up minor RW version field again
In preparation to a new CR50 image release one more bump up the minor
version number is required.

BRANCH=none
BUG=none
TEST=none

Change-Id: I1ac48eb01cb9d48fb796c79b2676399e7bb57b18
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403455
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-10-27 19:29:05 -07:00
Caesar Wang
8292c4c2df power: rk3399: turn off the center logic in s3
CQ-DEPEND=CL:386537
BUG=chrome-os-partner:54291
TEST=turn off the center-logic
BRANCH=None

Change-Id: I73577e15cc0a8474d8eb2ed1a48f5aba59e54c6a
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/381158
Reviewed-by: Catherine Xu <caxu@google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-27 19:28:55 -07:00
Vijay Hiremath
799c272e28 BD9995X: Disable input to port when sourcing
POR has both VCC & VBUS enabled. If the port is sourcing VBUS it will
also act as sync and AC_OK pin gets enabled. Hence disable the input
to the port when sourcing.

BUG=chrome-os-partner:59020
BRANCH=none
TEST=Manually verified on Reef. Connected HoHo and AC_OK is not
     enabled.

Change-Id: Ic51b81f45759d7dddb2c9744d1c24dbafd1e1293
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/404168
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-10-27 19:28:53 -07:00
philipchen
b6937caeeb gru/kevin: turn on flags to save code size
Turn on CONFIG_HOSTCMD_ALIGNED and
CONFIG_COMMON_GPIO_SHORTNAMES to squeeze more
space for the upcoming sensor code.

BUG=chrome-os-partner:59084
BRANCH=gru, kevin
TEST=Check the map to confirm the size reduction

Change-Id: I7a9ca8fccf6d57a797c391dc76cacb0b929e14df
Reviewed-on: https://chromium-review.googlesource.com/403485
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-10-27 19:28:43 -07:00
Aaron Durbin
52d80971c7 extra/usb_updater: don't use uninitialize variables
The 'transferred_sections' variable wasn't initialized in all paths.
Fix that.

BUG=chrome-os-partner:58794
BRANCH=None
TEST=Built.

Change-Id: If82ef1274d6a931e0cd193f276f34bfcac1fb1c7
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404548
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
2016-10-27 20:16:53 +00:00
Aaron Durbin
97158b6543 usb_updater: report running H1 firmware
Add a command line option which allows to retrieve version currently
running on the cr50 device.

BRANCH=none
BUG=chrome-os-partner:58794
TEST=run the following command:
   $ sudo ./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 0, backup RW at 0x4000
   Keyids: RO 0x3716ee6b, RW 0xb93d6539
   Current versions:
   RO 0.0.9
   RW 0.0.8

Change-Id: Ia34f455d3ca826a24992adf123a07865dccb1d57
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400418
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2016-10-27 12:42:37 -07:00