Commit Graph

8460 Commits

Author SHA1 Message Date
Daisuke Nojiri
044cc72496 Enable PD communication in RO for external display
This patch makes EC enable PD communication if it's running in
manual recovery mode. This is required to show recovery screen
on a type-c monitor.

This patch also makes EC-EFS ignore power availability. It will
make EC verify & jump to RW even if power is sourced by a barrel
jack adapter. This should allow depthcharge to show screens
(e.g. broken, warning) on a type-c monitor.

BUG=b:72387533
BRANCH=none
TEST=On Fizz with type-c monitor, verify
- Recovery screen is displayed in manual recovery mode.
- Critical update screen is displayed in normal mode.
- Warning screen is displayed in developer mode.
Monitors tested: Dingdong, Dell S2718D

Change-Id: Ib53e02d1e5c0f5b2d96d9a02fd33022f92e52b04
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/898346
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-03 02:38:10 -08:00
Daisuke Nojiri
cd5173dfe0 Fizz: Suppress EC_CMD_PD_GET_LOG_ENTR debug log
Host command handler prints every single host command except when
commands are repeated back-to-back. Some commands do not provide
useful info when studying feedback reports or what is worse they
may hide critical info by flooding the EC log.

BUG=chromium:803955
BRANCH=none
TEST=Observe 'HC 0x115' is not printed.

Change-Id: I4901b27bbfedd54dc0d364b16c49d4ed0dea0fc4
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896694
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-02-03 02:38:07 -08:00
Dino Li
30bf5c1b84 reef_it8320: don't pull-up tx/rx of uart
Because H1 monitor tx/rx signals to detect servo board,
so we can't pull-up tx/rx or the DETECT_SERVO of H1 will
be always high even the servo board isn't connected.

BUG=none
BRANCH=none
TEST=H1 detect servo board correctly.

Change-Id: I2f2dfa220ed77478e6e622a0ed1189f559044aa3
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/897315
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-02-02 23:53:41 -08:00
Nicolas Boichat
f0532aa93a charge_state_v2: Safer power transfer between lid and base
To avoid issues where adapter would drive against OTG of lid or
base, and to make sure that we do not over-current the adapter,
we disconnect the base/lid power transfer whenever a new
adapter is connected.

We reenable power transfer as needed.

We also separate out base current control as a new function,
that allows us to record the previous base current only when
the base charge control command is successful, and ignore
errors until the base is responsive for the first time.

Finally, we make sure that
charge_allocate_input_current_limit is only called from a
single location in charger_task.

BRANCH=none
BUG=b:71881017
TEST=Plug/unplug base, reset lux EC, connect charger.
     Base is detected, power allocation works as expected.

Change-Id: I8b206d5b0fbcf0fe868b56a0336745aebe2a6dc2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/880021
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-02 23:53:40 -08:00
Mary Ruthven
4d3c8c1776 cr50: create ap_uart state machine
This change creates a state machine to handle ap uart detection. It
removes all of the ap_uart stuff from ap_state.c and moves it to
ap_uart_state.c. All boards will now use ap_uart to enable/disable ap
uart and tpm_rst_l to detect the ap state.

Separate ap uart detection from ap detection, so we can disable the ap
uart without enabling deep sleep. If the ap is in S3 on ARM devices,
Cr50 wont be in deep sleep, but the AP UART RX signal wont be pulled up.
In this case we need cr50 ap rx to be disabled and deep sleep to be
disabled.

BUG=b:35647982
BRANCH=cr50
TEST=run firmware_Cr50DeviceState on scalet and electro

Change-Id: I81336a9e232df8d44b325eef59327a1c06a80cba
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/884307
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-02-02 23:53:33 -08:00
Duncan Laurie
9b406da2dc eve: Add support for dumping PMIC fault registers
If during PMIC initialization, it is identified that there was a VR
fault, then dump fault registers 0x16 and 0x17 to EC console. This
information is very useful during debugging sudden power losses in
field and so it is printed out to EC console.

Additionally, add panic reason with these register values as panic
data so that OS can provide this information in cros ec
panicinfo. This helps in retaining the information even if EC console
logs overflow.

BUG=b:65026806
BRANCH=eve
TEST=Verified that on a VCCIO shutdown, PMIC VR fault is
reported: "PMIC VRFAULT: PWRSTAT1=0x80 PWRSTAT2=0x00"

Change-Id: I583e513f865aeefc7dfc9860ce0ce9789808dea2
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/896163
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-02-02 13:19:25 -08:00
Nicolas Boichat
76927bdc5a stm32/usb: Add HOOK_USB_PM_CHANGE, called when USB is resumed/suspended
In particular, this will allow touchpad driver and keyboard matrix
scanning to be powered off/disabled when the USB interface is
disabled without setting the remote wake feature
(USB_REQ_FEATURE_DEVICE_REMOTE_WAKEUP), as events would be
ignored anyway.

BRANCH=none
BUG=b:72683995
TEST=With next CLs, touchpad and keyboard matrix scanning are disabled
     when lid is closed.

Change-Id: I3750bfaf8c31cde075adf9da4fef39753b8981c5
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/897067
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-02-02 10:17:30 -08:00
YB.Ha
c721ad9162 nautilus : clean up gpios
clean up unused gpios

BUG=none
BRANCH=none
TEST=build/flash nautilus

Change-Id: Ifdebc885d7f81b560b27bfed5abb93d8976e9641
Signed-off-by: YB.Ha <ybha@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/897305
Commit-Ready: YongBeum Ha <ybha@samsung.com>
Tested-by: YongBeum Ha <ybha@samsung.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-02-01 21:29:42 -08:00
Edward Hill
5bfeef6bb3 grunt: Set USB-C DP HPD GPIOs correctly.
Change the EC to drive the Hotplug Detect (HPD) GPIOs.

Grunt HW has these driven from EC to SOC, unlike coral which had
the TCPCs drive the HPD signals to SOC.

BUG=b:71810897
BRANCH=none
TEST=external display works using USB-C to DP adapter on both ports

Change-Id: I22ec9eecc5bdf9c6463dd3ce208d051faf15c57a
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/892099
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 21:29:38 -08:00
Daisuke Nojiri
ebb34ee92f CBI: Return ACCESS_DENIED on write failure due to WP
This patch makes EC_CMD_SET_CROS_BOARD_INFO return
EC_RES_ACCESS_DENIED if the command fails due to write-protect
switch.

BUG=b:70294260
BRANCH=none
TEST=Verify 'ectool cbi set 2 4' prints 'WP enabled?' when WP
is enabled.

Change-Id: I7c27ee748caf32e57f22ab79edcbff96e42c44ad
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/897683
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-02-01 21:29:33 -08:00
Jett Rink
74e2f686a9 cleanup: formatting debug message
Adding newline to separate messages better

BRANCH=none
TEST=none
BUG=none

Change-Id: Ie454dfc532310c480f350c9b15280bf96634b322
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/897909
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-02-01 18:08:48 -08:00
Vadim Bendebury
8dba841b4e ccd: fix scan-admin warnings
Automated code scanner highlighted a few problems in the recent ode
additions. This patch fixes the problems.

BRANCH=cr50
BUG=none
TEST=none

Change-Id: I1f199eb5d2af992384ab04f3010b4b646464a70f
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/897993
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-02-01 18:08:45 -08:00
Martin Roth
69b592426c Grunt: Set AP reset pin to open drain
By setting this GPIO to open drain, we don't need to make any board
changes as it won't conflict with the warm reset pin from the servo
header.

TEST=Warm reset works
BUG=B:72751599
BRANCH=None

Change-Id: I29d976851fc011fcb130a1747e4a39c8bf80a4ed
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/898075
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 18:08:42 -08:00
Simon Glass
c23e632984 grunt: Rename orange LED to amber
'Amber' seems to be more common in the code base. Rename it for grunt.

BUG=b:71902053
BRANCH=none
TEST=make BOARD=grunt -j10

Change-Id: I73a6bff4f113f5c49e70fde6d1f4667b8324a6d8
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896401
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 18:08:40 -08:00
Aseda Aboagye
e127855f27 ppc: Add Vconn and CC polarity settings.
BUG=b:72292985
BRANCH=None
TEST=Flash meowth; Verify with twinkie that Vconn is provided for a sink
that requires it.

Change-Id: I8168d2e4c46e04810dcf5c2898b2c337424eefec
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/888224
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 18:08:36 -08:00
Jett Rink
1b87ee65ac cleanup: Removing unnecessary CONFIG_USB_PD_DISCHARGE define
CONFIG_USB_PD_DISCHARGE is now defined automatically if you specify one of
the specified options such as CONFIG_USB_PD_DISCHARGE_TCPC

BRANCH=none
BUG=none
TEST=grunt still discharges using PPC

Change-Id: I94086cfc58bebce9c62ad6aa52b7740b25276d89
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/894676
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-02-01 14:55:19 -08:00
Shawn Nematbakhsh
f80b0f31c5 poppy / soraka: Decrease input current limit to prevent OC
Based on measurements, Soraka can pull more current than desired.
Decrease the programmed current limit by an additional factor,
determined by taking the worst-case power measurements across several
different Soraka devices, to ensure that Soraka never pulls more
current than desired.

BRANCH=None
BUG=b:67944740
TEST=Verify with `charger` that input current limit becomes 472mA when a
5V / 500mA charger is plugged, and 2896mA when a 5V / 3000mA charger is
plugged.

Change-Id: I2b2cb6f445533476d173cd7f5fb825d8b11d1405
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/890102
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Benson Leung <bleung@google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-02-01 14:55:18 -08:00
Alexandru M Stan
c870c87f2d motion_sense: Check presence of {set,get}_{range,offset}
Prevents a null pointer dereference when the AP asks the EC
for nonexistent settings of a sensor.

BUG=chromium:761758
TEST="ectool motionsense offset ${ID of baro_bmp280 sensor}"
And see no null pointer dereference, but an invalid command error
BRANCH=master

Change-Id: I3050feaa3c9752abebc30237dac1befa4e5775cc
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/850639
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-02-01 14:55:17 -08:00
Aseda Aboagye
61b602d292 isl923x: Don't initialize ICL on sysjump.
The ISL923x init function would initialize the charger's input current
to the board's defined default.  For some boards like meowth and
zoombini, the default input current was set quite low, 128mA.  When
sysjumping, all HOOK_INITs are called again and therefore the input
current limit would be reset even thought it would have been set
correctly prior to jumping.  Setting the current limit so low, without a
battery, would cause a power failure and the PMIC would drop its power
OK signal and go into emergency shutdown.

This commit simply adds a check to whether the EC jumped to this image.
If it has, the charger input current limit is left unchanged.  It will
be updated to the correct value by charge manager later on after
determine the attached charge supplier.

BUG=b:72129338
BRANCH=None
TEST=Flash meowth; Boot to S0 without a battery; Verify that PMIC_DPWROK
remains high.
TEST=Repeat above test for zoombini.

Change-Id: I7e5bbbbf3ec604c876cc4fa0163f8bb7feff4cc9
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/896960
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Caveh Jalali <caveh@google.com>
2018-02-01 02:41:55 -08:00
Jett Rink
d138e4dc63 cleanup: Correcting VBUS discharge comment
BRANCH=none
BUG=none
TEST=none

Change-Id: I0e7f21bd56a796d2261ffafa26f603924ac0d66d
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896395
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-02-01 02:41:54 -08:00
Jett Rink
aa2a4695ae grunt: enabling PPC vbus discharge path
Grunt uses a PPC, so we want it to discharge VBUS instead of the TPCP

BRANCH=none
BUG=b:72179253
TEST=Verified grunt board fall time is within spec now

Change-Id: I556cd2945ee191e3f423ee0a93c35eb2ccff9016
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/886564
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-31 22:39:01 -08:00
Edward Hill
11bda19561 sn5s330: Enable VBUS interrupts
If the sn5s330 PPC is being used to detect VBUS presence
(CONFIG_USB_PD_VBUS_DETECT_PPC), then enable interrupts and call
usb_charger_vbus_change when VBUS_GOOD changes.

BUG=b:72007153,b:72007492
BRANCH=none
TEST=Connect 3A and 1A USB-A chargers to each of Grunt's USB-C ports,
check that BC1.2 detection is working:
	With 1A:
	> chgsup
	port=0/1, type=7, cur=500mA, vtg=5000mV, lsm=1
	With 3A:
	> chgsup
	port=0/1, type=7, cur=2400mA, vtg=5000mV, lsm=1
TEST=Boot Grunt to OS, then connect USB2 mouse or USB3 flash drive to each
of Grunt's USB-C ports. Devices do not work due to b:71772180, but gpioget
shows EC is setting USB_C0/1_BC12_VBUS_ON_L correctly.

Change-Id: Iffc352105a321997adb364b9fbb8bafef248c224
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/887938
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-31 22:38:56 -08:00
Aseda Aboagye
eb60e291e8 led: Only report auto control for supported LEDs.
BUG=None
BRANCH=None
TEST=make -j buildall

Change-Id: I6508d2bfa01919c89a9b5c1129af35919deb1557
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/888219
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-01-31 18:01:04 -08:00
Aseda Aboagye
e578304b9a flash_ec: Wait 1s before flashing meowth.
Meowth also seems to take enough power when flashing without a battery.
Zoombini has a similar issue, and the fix is to wait 1s to let the
voltage level stabilize before flashing.

This commit just waits 1 second before flashing.

BUG=b:65694390
BRANCH=None
TEST=./util/flash_ec --board meowth;  Verify it succeeds without a battery.

Change-Id: Ida34a7eb923187940afe05a32d200b48e71aaa9f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/894370
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Caveh Jalali <caveh@google.com>
2018-01-31 18:01:00 -08:00
Vadim Bendebury
cdd2c95284 g: protect flash operations
Flash operations in do_flash_op() involve waiting polling for the chip
to complete the operation. If a concurrent operation is started while
another operation is in progress, flash gets confused and locks up.

Let's add a mutex to ensure that flash operation runs to completion
before another operation starts.

BRANCH=cr50
BUG=b:67651754
TEST=multiple times ran firmware update while the device was coming up
     and saving TPM status in NVMEM. Observed no failures.

Change-Id: I777a38f8a63cf17d60edb11cc3f916a4ea904741
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/894180
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-01-31 13:47:15 -08:00
Anatol Pomazau
5a910a86be Add support for HW alerts
- Add a vendor command that provides alert counter. Userspace can use
   it e.g. for user metric analysis.
 - Add 'alerts' debug console command. It provides information about
   chip alerts: supported alerts, fuse status, interrupt status, alert
   counter.
 - Add 'alerts fire [INT]' command to fire a software defined alert
   (globalsec/fwN where N is 0,1,2,3).

Signed-off-by: Anatol Pomazau <anatol@google.com>

BUG=b:63523947
TEST=ran the FW at Pyro and checked alerts data sent to host

Change-Id: I7cec0c451ed71076b44dad14a151b147ff1337e8
Reviewed-on: https://chromium-review.googlesource.com/817639
Commit-Ready: Anatol Pomazau <anatol@google.com>
Tested-by: Anatol Pomazau <anatol@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-01-31 13:47:15 -08:00
Jett Rink
760caca89b usb pd: Adding PPC vbus discharge path
Boards with a PPC will use the PPC to discharge the VBUS line instead
of the TCPC or GPIO discharge path.

BRANCH=none
BUG=b:72179253
TEST=Fall time after device removal on grunt within spec now

Change-Id: I822923a1cedb32a20efc3610cce4437ade3387f0
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/886563
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-31 11:14:01 -08:00
Wei-Han Chen
b245e71e82 stm32: add usb_isochronous
Templates for USB isochronous implementation.  Current implementation
only supports TX transmit.  Example of usage can be found in CL:803414.

Basically, declare an USB isochronous interface by

USB_ISOCHRONOUS_CONFIG_FULL(<NAME>,
                            <INTERFACE_NUM>,
                            <USB_CLASS>,
                            <USB_SUBCLASS>,
                            <SUB_PROTOCOL>,
                            <USB_STR_FOR_INTERFACE_NAME>,
                            <USB_EP_NUM>,
                            <PACKET_SIZE>,
                            <TX_CALLBACK>,
                            <SET_INTERFACE>)

where <PACKET_SIZE> is size of each USB packet, <TX_CALLBACK> is called
when USB hardware has completed a packet.  The buffer that USB is not
currently using will be passed to <TX_CALLBACK>, allow applications to
write next packet to it.

When a SET_INTERFACE packet is received, <SET_INTERFACE> will be called
with bAlternateSetting and bInterfaceNumber.

We will declare interface descriptor with bAlternateSetting = 0 and 1
for you, if you need more alternate settings, you need to declare by
yourself.

BUG=b:70482333
TEST=manually on reworked staff board
Signed-off-by: Wei-Han Chen <stimim@google.com>

Change-Id: Ic6d41da6ddd7945edf0bdfff55ede38a97661783
Reviewed-on: https://chromium-review.googlesource.com/818853
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-01-31 08:29:46 -08:00
Vincent Palatin
924d21d904 test: store persistence files in RAM
On VM-based builders, the nvmem unittest was sometimes missing the
10-second deadline, likely being stuck in slow I/Os.
Try to move the persistent storage files used for flash 'emulation' on
host from the build directory to a RAM-backed filesystem in /dev/shm
in order to mitigate this bottleneck.

Store the new backing files in a path like:
/dev/shm/EC_persist__mnt_host_source_src_platform_ec_build_host_nvmem_nvmem.exe_flash
in order to keep the properties of the old system:
subsequent runs of the same build will use the same persistent storage
but 2 different trees won't mix up.

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

BRANCH=none
BUG=chromium:715011
TEST=make runtests
TEST=run the following command with and without this change:
'for i in 0 1 2 3 4 5 6 7 8 9 ; do time make run-nvmem ; done'
and see the average test time around 500 ms without the change
and around 320 ms with it on an idle and beefy workstation.

Change-Id: Ic2ff6511b81869171efc484ca805f8c0d6008595
Reviewed-on: https://chromium-review.googlesource.com/893380
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-31 05:58:03 -08:00
Jongpil Jung
62d94fc2a9 nautilus: Implement workaround for broken reset flags for rev3.
Issue will fix next board revision. It was not fixed in rev3 yet.
So, we neet to add workaround for rev3 as well.

BUG=b:67062902
BRANCH=None
TEST=None

Change-Id: I033df22f342a2c8f0ddf4b1883d99018db1df16d
Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/893578
Commit-Ready: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com>
Tested-by: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-31 05:58:00 -08:00
Nicolas Boichat
7ffcd686db whiskers: Enable LM3630A LED driver
Used to control keyboard backlight.

BRANCH=none
BUG=b:68934906
TEST=make BOARD=whiskers -j

Change-Id: Ie793ebe91670965a434896530084561a7f1c57d4
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/892842
Reviewed-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Wei-Han Chen <stimim@chromium.org>
2018-01-31 03:36:25 -08:00
Aseda Aboagye
7368aff427 meowth: zoombini: Enable CONFIG_ALS.
This allows the acpi_light sysfs entry to be populated with the actual
ALS data.

BUG=b:70290036
BRANCH=None
TEST=Flash meowth; read both illuminance values for the ALS devices
under iio and verify that they are both operational.

Change-Id: Ia22633629195d5bdeedc70a908ceca1411110b7d
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/888218
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-30 17:47:20 -08:00
Philip Chen
5e63c7b22e charger/rt946x: Reset VBUS by default
In the system, RT946x is always powered by the battery.
So even in battery cutoff mode, the reg values on RT946X are not reset.

We don't want RT946x to supply VBUS when DUT boots, which could mess up
PD state. So we need to disable VBUS output when RT946x initializes.

BUG=b:72228350
BRANCH=none
TEST=Confirm OPA_MODE (bit0 in reg 0x01) is clear after RT946x
finishes initialization

Change-Id: I32795b3bea64860b164c14b06aa1cd2551ebd8a0
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/890028
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
2018-01-30 17:47:15 -08:00
Philip Chen
df229ee8e6 charger/rt946x: Clear irq flags correctly
rt946x_block_read() is not implemented right.
It not only makes rt946x_init_irq() fail but also put
RT946x i2c module in an erroneous state temporarily.

BUG=b:72228350
BRANCH=none
TEST=manually on scarlet rev3:
1)Insert Plugable USB-C hub w/o AC
2)Run cutoff command on ec console
3)Hold Pwr button for a few seconds to wake up DUT
4)Repeat 2 - 3 for 10 times without seeing PD loops

Change-Id: I9304617f924e44288483afca5ab1b2923eb68ff0
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/890027
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
2018-01-30 17:47:14 -08:00
Philip Chen
3a95a68292 charger/rt946x: Log the init failure
BUG=b:72228350
BRANCH=none
TEST=See the error message when init fails

Change-Id: Ib9b1906cb2d0b2427a96ea4823eb3325912f344b
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/890026
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
2018-01-30 14:54:24 -08:00
Shawn Nematbakhsh
9afcd8d602 cleanup: Remove CONFIG_USB_PD_TCPC_BOARD_INIT
It's no longer necessary to call board_tcpc_init() from PD tasks, since
HOOK_INIT completion is guaranteed before the task starts. Also, calling
board_tcpc_init() for each PD task without a port arg is a bad idea.

BUG=b:72229154
BRANCH=none
TEST=`make buildall -j`

Change-Id: I6fba07771693b8343568041960a263e02775a8fc
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/881538
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-30 14:54:23 -08:00
Philip Chen
1c90656d03 scarlet: Remove unused macros in battery.c
The macros were added for debug and not used anymore.
Let clean it up.

BUG=none
BRANCH=none
TEST=make BOARD=scarlet

Change-Id: I859fd3ddf2d5271ba26d23696013c83dec98a966
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/891547
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
2018-01-30 14:54:23 -08:00
Shawn Nematbakhsh
8d29b3dae7 stm32: Fix bkpdata accounting
stm32f0 has 20 bytes (not 20 words) of VBAT-backed RAM. Make more
efficient use of our limited storage to prevent trying to use storage
that doesn't exist.

BUG=b:71333840
BRANCH=None
TEST=Negotiate PD, run "reboot" on scarlet EC console, verify reset path
is taken in pd_partner_port_reset().

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie4c303b74a1b82b84ec971cdcc19c2b21a0032e7
Reviewed-on: https://chromium-review.googlesource.com/885461
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-30 14:54:17 -08:00
Shawn Nematbakhsh
9362b06201 samus_pd: Remove 'adc' console command
Remove console command for flash / RAM savings.

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

Change-Id: Ibfccbdf45e5c86260cc55237387994fdf094c19c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/885463
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-30 14:54:17 -08:00
Vijay Hiremath
f543a8e798 glkrvp: Switch from NPCX5 EC to NPCX7 EC
BUG=b:68987606, b:72483287
BRANCH=glkrvp
TEST=GLKRVP can boot to OS

Change-Id: If4b99ca60005b97c59a1d8dc16c4065af63d34d8
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/750365
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-01-30 09:02:13 -08:00
YB.Ha
313220c87d nautilus : fix white led shown issue on ec reset
set gpios of LED to output high(off) when ec reset

BUG=b:72485879
BRANCH=none
TEST=build/flash nautilus

Change-Id: I187dc82839fe7000e004cf58c4811656c905c00a
Signed-off-by: YB.Ha <ybha@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/892679
Commit-Ready: YongBeum Ha <ybha@samsung.com>
Tested-by: YongBeum Ha <ybha@samsung.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-30 06:32:43 -08:00
Elmo_Lan
87a1268ef5 Nami: force to set RESET_FLAG_RESET_PIN
Like other KBL designs (eve, poppy and followers).
EC is not able to distinguish between power up and reset.

BUG=b:71839731
BRANCH=none
TEST=Verify Nami power on flag by EC console.

Change-Id: Ice8b80259b8405f28b508918d5b3cfe37a8b1eb9
Signed-off-by: Elmo_Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/891042
Commit-Ready: Raymond Chou <raymond_chou@compal.corp-partner.google.com>
Tested-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
2018-01-30 06:32:38 -08:00
Nicolas Boichat
cbd086d13b charge_state_v2: Fix current limit when lid has no battery
The logic of drawing as much current as possible when no battery
is connected (on the lid), and system unlocked, makes sense during
early bringup.

However, it will not work when the base is also connected, as we
did not implement the required no-battery logic in the base/lid
power allocation algorithm (nor do we plan to, as it is only
required during very early bringup, when we should not expect
power transfer between lid and base to work properly).

Also, we need to record input_voltage in
charge_set_input_current_limit, even when lid battery is not
present (yet), otherwise the algorithm gets confused and believes
no power is available.

BRANCH=none
BUG=b:71881017
TEST=Boot lux from dead battery and base connected, lux does not
     attempt to drive OTG to the base.

Change-Id: I0cdd0956a82a724dbbf9c010760dcb956a58c1bf
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/874982
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-30 03:56:25 -08:00
Mary Ruthven
4d0eb3be49 cr50: fix ec and servo detection
This change reenables the gpio interrupts if the signal is not high.

BUG=none
BRANCH=cr50
TEST=firmware_Cr50DeviceState

Change-Id: Iae4e18594954789cd6841e01d1c943de3b389415
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/884306
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-29 16:38:33 -08:00
Furquan Shaikh
8160d1ae86 poppy: Enable dptf device orientation
This is required to support mode-aware DPTF. Also, there is no need to
send mode change event in board specific code as that is already done
by dptf common code.

BUG=b:65467566
BRANCH=None
TEST=Verified that trip point temperatures get updated in the OS
depending upon the device mode.

Change-Id: I854628bcde755bdb1c6c1b73fbfa0948e1d7e420
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/887725
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-01-29 16:38:32 -08:00
Mary Ruthven
a4e1e47630 cr50: add properties to BOARD_ALL_PROPERTIES
Add BOARD_DEEP_SLEEP_DISABLED and BOARD_DETECT_AP_WITH_UART to
BOARD_ALL_PROPERTIES, so they will be updated after cr50 reboots.

BUG=b:35647982
BRANCH=cr50
TEST=test deep sleep on scarlet

Change-Id: I8999ae7c6c1dad6799b5fdb99ebf5d7618a21c2b
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/882343
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-29 16:38:26 -08:00
Gwendal Grignou
051aebf5e0 sensors: Remove debug printf
Remove prints when activity triggers.

BUG=b:72533440
BRANCH=eve
TEST=compile

Change-Id: I047e14990ef734c35161293b9c5fbbece0ddab0c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/890632
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-01-29 16:38:26 -08:00
Nicolas Boichat
a954cecd3e charge_state_v2: Fetch static battery information when flags change
Instead of fetching static battery information all the time, we
first fetch the dynamic information, and see if the flags changed.
If they did, refetch the static information.

This also covers the cases when the base is disconnected/reconnected.

BRANCH=none
BUG=b:71881017
TEST=ectool battery 1 shows correct static battery information after
     plug/unplug.

Change-Id: I936983fc0fdc4dae0494e8a24f890927e30555dc
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/872813
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-29 05:24:48 -08:00
Nicolas Boichat
31c1fc6d43 whiskers: Update GPIO for next revision
Looks more similar to original hammer.

BRANCH=none
BUG=b:68934906
TEST=make BOARD=whiskers -j

Change-Id: I0f10240f8c3237b20f60a1217e167ad9539e3953
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/853574
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-29 05:24:45 -08:00
YB.Ha
14e6afb4f2 nautilus : fix abnormal led operation
The charge state is set to IDLE when battery temperature
is under 0 or over 50 degrees and led is set to green although
external power does not present.
This CL fix this issue.

b:72423182
BRANCH=none
TEST=build/test in nautilus

Change-Id: I238096d46a426dd3ad579540c06eb306f2d1b490
Reviewed-on: https://chromium-review.googlesource.com/888358
Commit-Ready: YongBeum.Ha <ybha@samsung.corp-partner.google.com>
Tested-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-01-29 03:06:35 -08:00