This CL adds the flag --save_stats_json which prints the MEAN
of sweetberry readings into json format. Corresponding unit
test has been added too. Printing just the MEAN in json format
makes it easier to read it back in power_telemetry_logger,
which uploads the stats to the dashboard.
This CL is part of the effort to start sweetberry measurements
while running power autotests.
BRANCH=None
BUG=b:68956240
TEST=./powerlog.py -b xxx.board -c xxx.scenario \
--save_stats_json [directory to store it]
python -m unittest -v stats_manager_unittest
Change-Id: I8274bcac21175f6c53184ced79b6ffe5e7d7a72a
Signed-off-by: Mengqi Guo <mqg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/807636
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
ccdstate just prints state. It is very useful for debugging ccd/servo
contention issues. This change makes it a safe command so it is
accessible even when the console is locked.
BUG=none
BRANCH=cr50
TEST=make buildall
Change-Id: I2e754f5978c83fcaca737e7a590dcf5ee445522c
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/809864
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
After firmware update, cr50 toggles the EC's reset line, expecting
the system will boot. This isn't the case for Chromebox because it
sets AP_OFF flag on a clean shutdown (to restore the previous power
state after power loss & restore).
This patch adds EC_REBOOT_HIBERNATE_CLEAR_AP_OFF to EC reboot
command. It makes EC first clear AP_OFF then hibernate.
BUG=b:69721737
BRANCH=none
TEST=Verify Fizz reboot after cr50 update.
Change-Id: If3207d7284f244ca1adf0d516ef744dbc739a9c1
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/802632
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
It will be useful to determine if a FET is enabled or not. For example,
to determine if we are sourcing power to a downstream device. This
commit simply adds an API to check if a FET is enabled or not.
BUG=None
BRANCH=None
TEST=`make -j buildall`
Change-Id: I1f8198342cf225ce9a10d218607bcfbe6aef618c
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/791498
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
When the SN5S330 is powered initially, there will be certain events set
that will assert its interrupt line. As part of the initialization for
this part, we should clear all the pending interrupts and setup the
masks for the events that we care about.
This commit clears all interrupts at init time and masks all interrupts
except for overcurrent condition for PP1.
BUG=b:69139844
BRANCH=None
TEST=Flash zoombini; With nothing plugged in, verify that the interrupt
line is deasserted at boot.
TEST=Repeat the above test with a charger plugged in.
Change-Id: I7acc030184b76d6c38a729cb64658f71e376c819
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/783510
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Also added CONFI_ISH_I2C_PORT0_SPEED, CONFI_ISH_I2C_PORT1_SPEED, and
CONFI_ISH_I2C_PORT2_SPEED to define speed for each ISH I2C port. By
default, those are set to fast mode, 400kbps, I2C_SPEED_FAST.
The values can be modified in board.h.
BUG=None
BRANCH=None
TEST=On Soraka modified board for ISH, set I2C stardard mode, fast mode
and fast mode plus, measured I2C clock freq using scope respectively and
confirmed the freq matched I2C mode.
Change-Id: I426b50dc935c3760903360a50f6069e99bd0abff
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/784091
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
If VBUS toggles between 'present' and 'not-present', and fusb302 is the
arbiter of VBUS presence, wake the PD task so that it can take the
necessary protocol actions (eg. transition out of HARD_RESET_RECOVER).
BUG=b:69482362
BRANCH=None
TEST=On scarlet, issue EC reset with CableCreation source dock plugged,
verify we don't end up in hard reset loop.
Change-Id: I88d6102a6b5f4bd5151bae117c70f0a3ac0c09e7
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/804660
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This allows ec and cpu uart to start enabled,
so console or google serial can be used to log
output without servod.
Rename endpoints to be clearer in the non-servod
usecase. UART1 -> EC, UART2 -> CPU.
BUG=None
BRANCH=servo
TEST:miniterm.py -d /dev/google/Servo_Micro-2-1.2/serial/EC
Change-Id: Ifd3b753a459fdd9b80d84cc6e4ec9cde1ccb74e0
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/804899
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
The error processing logic is reversed, which results in missing error
values when errors actually happen.
BRANCH=none
BUG=none
TEST=verified that errors values are now reported properly.
Change-Id: I282920d35e978a704e8c2728a8aa71a5f1da9a00
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/802994
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
CHARGE_MAX_SLEEP_USEC was originally set to 1 minute (i.e. equal to
POLL_PERIOD_VERY_LONG) in CL:191767. However, during re-factoring in
CL:193876 it got changed to 1 second as charge_state_v1 used this
value. Looking at the way CHARGE_MAX_SLEEP_USEC is used, value of 1
minute makes more sense because sleep_usec could be set to
POLL_PERIOD_VERY_LONG when device is off or suspended. With the
current logic in suspend/off state, sleep_usec is set to
POLL_PERIOD_VERY_LONG and immediately gets reset to
CHARGE_MAX_SLEEP_USEC in charger_task.
This change fixes the above behavior by defining CHARGE_MAX_SLEEP_USEC
as 1 minute. As a side-effect of this, we might not wake up early
enough in case of critical battery. Thus, check if we need to shutdown
on critical battery and adjust sleep time accordingly.
BUG=b:69695376
BRANCH=None
TEST=make -j buildall
Change-Id: Ieba7279dc4b02c3d64022c3c5ac09fb869a3632d
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/788181
Reviewed-by: Shawn N <shawnn@chromium.org>
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:65732924,b:69334392
BRANCH=None
TEST=Verified that on the failing Lux system, PMIC VR fault is
reported:"PMIC VRFAULT: PWRSTAT1=0x00 PWRSTAT2=0x01".
Also, verified that pmic fault register info is reported correctly in
panicinfo:
cat /sys/kernel/debug/cros_ec/panicinfo > /tmp/panicinfo
hexdump -n 1 -s 0x14 -e '"0x""%02X""\n"' /tmp/panicinfo
0x00
hexdump -n 1 -s 0x15 -e '"0x""%02X""\n"' /tmp/panicinfo
0x01
Change-Id: Ic6096887cd66046d11a5eb1d942b635b3e48a236
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/674033
Reviewed-by: Shawn N <shawnn@chromium.org>
Add a hook for CHIPSET_RESET to allow the EC to indicate if there is
any new panic info present. This helps coreboot to log EC panic info
in eventlog.
Also, update the hook priority for CHIPSET_RESET and HOOK_INIT to
HOOK_PRIO_LAST to allow the EC to first log any software panic before
it is checked.
BUG=b:65732924,b:69334392
BRANCH=None
TEST=Verified following:
1. Force panic_set_reason in EC on CHIPSET_RESET
2. reboot on AP console
3. mosys eventlog list shows "EC Event | Panic Reset in previous boot"
Change-Id: I77b49cd0b3bf05b10efc708e3d81af9ed0e3aa49
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/797911
Reviewed-by: Shawn N <shawnn@chromium.org>
This change adds a new software panic type PANIC_SW_PMIC_FAULT that
can be used to report any PMIC faults during previous boot.
BUG=b:65732924,b:69334392
BRANCH=None
TEST=make -j buildall
Change-Id: I218b5d01ee145bb02a773495046f4255f1ec8986
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/797910
Reviewed-by: Shawn N <shawnn@chromium.org>
- We have more flash space to use with nds32 toolchain GCC6.3.0,
so we enable a few console commands that were disabled previously.
And we also enable LTO to reduce the size of FW image.
- Put "__wait_evt" function into ram_code section to
fill the gap of flash and improving performance of code-fetch.
BUG=none
BRANCH=none
TEST=boot to kernel on reef_it8320.
Change-Id: I3b745ff80a57ef1163794864c39c22f7e1f86634
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/788712
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Stalling reset during when CS is asserted is useful to start with, it
was added before out of abundance of caution, but come to think of it,
should the reset happen asynchronously driven be the EC, the AP would
be reset too. And when AP is reset on its own accord, it would not be
transmitting anything on the SPI interface.
On top of that it turns out that in some cases reset on ARM platforms
is accompanied by the CS line driven low, which causes infinite loop
if Cr50 is waiting for CS to deassert before proceeding.
BRANCH=cr50
BUG=b:67008109
TEST=verified that RMA reset operates properly on both ARM and x86
platforms.
Change-Id: I43efd0cefa5d6eb543dfd27e3c9fb3b4bf1a8ea6
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/791818
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Andrey Pronin <apronin@chromium.org>
Coral family has couple SKUs configured in clamshell form
factor, in order to avoid external magnetic field unexpectedly
switches clamshell device into tablet mode, this patch disables
tablet mode interrupt for SKUs in clamshell form factor.
BUG=b:67917181
TEST=emerge-coral chromeos-ec, image to clameshell device,
apply external magnetic field and examine no unexpected
switching to tablet mode through watching powerd logs;
alternately, watch the command 'ectool gpioget TABLET_MODE_L'
changes from 1 to 0 without interrupt, this requires some
hacking dump in board_set_tablet_mode() as reverse proof.
i.e.
tablet_mode_interrupt()
... (deferred hook)
enable_input_devices()
board_set_tablet_mode()
Change-Id: Iccf14cd5e2ea71ab3204aa386f476a9a0e1550c4
Signed-off-by: Harry Pan <harry.pan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/754148
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Coral family has couple SKUs configured in clamshell form
factor, in order to avoid external magnetic field unexpectedly
deasserts TABLET_MODE_L and switches device into tablet mode,
this patch ignores the TABLET_MODE_L pin status for those SKUs.
In other words, always set tablet_mode as 0 for clamshell SKUs.
BUG=b:67917181
TEST=emerge-coral chromeos-ec, image it to clamshell device,
apply external magnetic field and examine there is no unexpected
switching to tablet mode through watching powerd logs.
Change-Id: Ibbe08a00bb14144cad87fdd5a4a39cb3bfe2968e
Signed-off-by: Harry Pan <harry.pan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/748944
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Exitting the recovery insert screen requires pushing the volume up
and volume down keys simultaneously. Modifying the button command
to support multiple buttons.
BUG=b:69390675
BRANCH=None
TEST=button vup vdown 5000
button vdown vup 5000
button vup vdowne
button vdown vup
Make sure that the above command press and release both volume keys.
Make sure that there is a delay added into between presses/releases.
Change-Id: I65817ff6c9da8c422af3345b2d0878b52387b13e
Signed-off-by: Shelley Chen <shchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/783515
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Coffeecake can charge 5V at 3A current. Host high pullup should be
Rp3000 instead of Rp1500. This change sets USB_C_CC1_DEVICE_ODL to
push-pull mode.
BRANCH=none
BUG=b:67910633
TEST=manual
connect Twinkie sink and measure the CC adc
Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: I471c2f2269ad412851096acb23daf1a5b7dab437
Reviewed-on: https://chromium-review.googlesource.com/758319
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
We may as well enable this for the early builds of grunt. It changes the
initial power button state to IDLE instead of INIT_ON, adds power signal
logging, and allows port80 printing in interrupt context.
It doesn't look like we use eSPI Virtual-Wire for communication, so this
should be fine.
BUG=b:64935726
BRANCH=none
TEST=make BOARD=grunt && make buildall -j
Change-Id: Id0049dc6733a3ff8727ea9fc616ac8ce24364ae1
Signed-off-by: Justin TerAvest <teravest@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/794290
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
EN_USB_PD leaks ~1V to C0_VBUS. This change turns on PD_DISCHARGE when
C0_VBUS is low.
BRANCH=none
BUG=b:67910512
TEST=manual
load on coffeecake, boot into SRC mode, check C0_VBUS voltage.
Change-Id: Ia650ee83c8fef4228d3bb2f7ec5f9eab3e16bf4d
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/758318
Reviewed-by: Benson Leung <bleung@chromium.org>
Allocated a new PID from the spreadsheet. Change to it so that we're
different from Hoho (and don't get pushed Hoho's firmware by CrOS).
Signed-off-by: Benson Leung <bleung@chromium.org>
BRANCH=none
BUG=b:67953564
TEST=build, flash, test that Chromebooks don't try to update Coffee Cake
with Hoho's firmware.
Change-Id: Ifa7e80b38016bccdf9c797008078ee951d5e05d9
Reviewed-on: https://chromium-review.googlesource.com/726466
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This will prevent not allowed voltages (9V) applied on Vbus on initial
attach, where the voltage needs to be vSafe5V.
Signed-off-by: Benson Leung <bleung@chromium.org>
BRANCH=none
BUG=b:67910051
TEST=Plug in Yeeco loader, then walleye, then Yeeco loader. Confirm
5V when loader is attached.
Change-Id: Ic9d40b093d96a4eb8a7ac4649701269f7f55bb33
Reviewed-on: https://chromium-review.googlesource.com/724270
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
This bit needs to be set to allow Chromebooks to determine that the dock
is an externally powered DRP, so they'll try to charge from it instead of
sitting there with 5V 0A.
BRANCH=none
BUG=b:69056645
TEST=make buildall -j
Check that Chromebooks successfully charge from Coffee Cake.
Signed-off-by: Benson Leung <bleung@chromium.org>
Change-Id: I9b1f207d976ef55b4a3016ba35c99522d4d1fce6
Reviewed-on: https://chromium-review.googlesource.com/723979
Commit-Ready: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
This change applies the diff between hoho and coffeecake. I2C master
configuration is added to control buck-boost converter.
BRANCH=none
BUG=none
TEST=make buildall -j
Signed-off-by: Rong Chang <rongchang@chromium.org>
Change-Id: Ia700404ccc4e8d2bd8368a823a0cae911257cf7d
Reviewed-on: https://chromium-review.googlesource.com/673965
Reviewed-by: Benson Leung <bleung@chromium.org>
This CL fixed the issue that ec cannot enter low power mode, which
increases more power consumption in s5, by not setting ESPIRSTWE bit.
For more detail, please see the npcx5's errata rev1_7, No.2.21.
BRANCH=none
BUG=b:69351155
TEST=No build errors for "make buildall".
TEST=build and flash soraka, run commands to read the power consumption:
dut-control pp3300_dsw_ec_cfg_reg:0x7327k
dut-control pp3300_dsw_ec_mw -t 20 | grep "@@"
the average power consumption measured reduces from 42.x to 10.x mw.
TEST=do cold reboot stress test for 4 hours and no symptom occurred.
Change-Id: Ic6fd7fe14ae8acaefd4e1a99ca1625254f67d708
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/778709
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
If power-up is inhibited by charger because of battery SOC, then check
for the conditions again on BATTERY_SOC_CHANGE. This allows the EC to
boot the AP up on connecting AC power and SOC going above the minimum
required.
BUG=b:65864825
BRANCH=None
TEST=Verified following on coral and soraka:
1. Discharge battery to ~0%
2. Connect AC power ==> Power-up is inhibited
3. When battery SOC reaches 1%. AP is not taken out of reset:
"[12.974428 Battery 1% / 8h:4 to full]
[12.980439 power-up still inhibited]"
4. When battery SOC reaches 2%, AP is taken out of reset:
"[9.230148 Battery 2% / 4h:5 to full]
[9.236122 Battery SOC ok to boot AP!]"
Change-Id: Ifa89f8929987d86c9e02530b663d563dbe25ed85
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/753294
Reviewed-by: Shawn N <shawnn@chromium.org>
Similar to CL:774298, intention of chipset_force_shutdown is to power
off the AP by simulating power button press until it results in power
button override and shuts down AP. However, if AP is already in hard
or soft off conditions (i.e. G3, S5G3, G3S5 or S5) then AP is already
off, and simulating power button press results in
charge_prevent_power_on from incorrectly assuming that the power
button is pressed by user. Thus, check if the system is in soft or
hard off before shutting it down.
BUG=b:65864825
BRANCH=None
TEST=make -j buildall
Change-Id: I4b6d798af4618cbd4179f8700ebb2aa78021207e
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/791933
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Intention of chipset_force_shutdown is to power off the AP by
simulating power button press until it results in power button
override and shuts down AP. However, if AP is already in hard or soft
off conditions (i.e. G3, S5G3, G3S5 or S5) then AP is already off, and
simulating power button press results in charge_prevent_power_on from
incorrectly assuming that the power button is pressed by user. Thus,
check if the system is in soft or hard off before shutting it down.
BUG=b:65864825
BRANCH=None
TEST=Verified that apshutdown still works fine from EC console on
soraka.
Change-Id: Id892e5b2c8c1e4ce0bad95a70ea6a3ed547a7047
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/774298
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
There are two different types of suspend states that are supported on
x86 platforms -- S3 and S0ix. When AP enters S3, the chipset state is
identified as CHIPSET_STATE_SUSPEND. On the other hand, when AP enters
S0ix, the chipset state is identified as CHIPSET_STATE_STANDBY. There
are several components within the EC e.g. charger state machine, usb
pd task, motion sense task that take actions based on the chipset
suspend state (and checked only for CHIPSET_STATE_SUSPEND until
now). In order to ensure that different EC components do not have to
worry about checking for all the different types of suspend states
that are supported, introduce a new combination
CHIPSET_STATE_ANY_SUSPEND which is a combination of
CHIPSET_STATE_SUSPEND(S3) and CHIPSET_STATE_STANDBY(S0ix).
BUG=b:69690699
BRANCH=None
TEST=make -j buildall. Ruben verified that with this change, EC power
consumption in S0ix drops from 7.85mW to 6.59mW on Soraka.
Change-Id: I599a0ea2fe2f39132764a6068fa77c3aea02affa
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/786919
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This patch lowers the priorities of other chargers so that dedicated
chargers are given the highest priority.
Dedicated chargers are adapters shipped with the device and do nothing
but being the power source. Thus, when they're connected, it should be
always used even if other suppliers offer more power.
BUG=b:38321259
BRANCH=none
TEST=make runtests
Change-Id: Ida862eb31c7f9ede36cade99f53645196b6a3f70
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/762339
Reviewed-by: Shawn N <shawnn@chromium.org>