Commit Graph

16504 Commits

Author SHA1 Message Date
Sean Abraham 1e800ac838 docs: point md files in master to main/HEAD
Master md files are out of date. Point to main branch in case someone
lands in master branch from an old link.

BUG=b:180952272,b:180921286
BRANCH=None
TEST=Preview changes with gerrit

Exempt-From-Owner-Approval: fixing docs
Change-Id: I6583b6c7fc21248eb49a6cd71e077fbdb5de2435
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727846
Reviewed-by: Sean Abraham <seanabraham@chromium.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
Auto-Submit: Sean Abraham <seanabraham@chromium.org>
Tested-by: Sean Abraham <seanabraham@chromium.org>
2021-03-01 22:59:54 +00:00
amber.chen ef6a915de0 boten: fix FAFT test item firmware_ECChargingState
modify for FAFT test item firmware_ECChargingState fail
to make sure the charging state will be 0 or 1

BUG=b:160097052
BRANCH=firmware-dedede-13606.B-master
TEST=make -j BOARD=boten
test_that -b dedede IP firmware_ECChargingState

Signed-off-by: amber.chen <amber.chen@lcfc.corp-partner.google.com>
Change-Id: I17a65f80d6b4434607a11c1ca80716eaa290ad64
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589146
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-16 02:14:51 +00:00
Scott Chao 8bdfbe6017 eldrid: fix eldrid_npcx796fc name
change eldrid_npcx796fc to eldrid_npcx796 to meet config.star.

BUG=b:173754312
BRANCH=firmware-volteer-13521.B-master
TEST=make buildall
TEST=Boot up on Eldrid

Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Change-Id: If8025ce4e512c00722a269eeb57643218723915b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592530
Reviewed-by: Keith Short <keithshort@chromium.org>
2020-12-16 00:33:55 +00:00
Patryk Duda 0bfbb5c932 usb_pd_dual_role: Respect max voltage limit when processing capabilities
To process source capabilities received from charger we just find the
most appropriate PDO and inform charge manager about our choice
(pd_process_source_cap() function). This function doesn't respect any
voltage limits, so even when such a limit exists charge manager will be
informed about higher voltage. Of course PD stack will request correct
voltage from charger and charge manager will be notified about that
fact, but providing wrong information about voltage can cause
unnecessary new power requests.

This issue was found during debugging EC hibernate issue on casta.

BUG=b:161775827
BRANCH=none
TEST=Flash EC ToT on casta. Set voltage limit to 5V. Observe if
     charge manager reports voltage changes from 5V to 15V (in my case)
     when received capabilities from ServoV4.
     NOTE: ServoV4 will send capabilities to DUT as a result of voltage
     transition (requested by ServoV4).

Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I5fe30f7a1b86fb1d934a29429147d9d7c9a84337
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592496
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2020-12-15 23:50:38 +00:00
Divya Sasidharan 5316af00b3 virtual mux: Wait for mux config ACK from the kernel
This CL:
1. Add a new config CONFIG_USB_MUX_AP_ACK_REQUEST to enable request
   for ACK from AP
1. Adds a new feature flag to inform the AP that an ACK is needed
   for boards supporting Burnside bridge retimer.
2. Adds a new host command for the EC to wait for mux config ACK
   for entering and exiting the safe mode.
3. Adds 12.5msec delay after configuring retimer and SoC as
   recommended.

BUG=b:166300460,b:161327513
BRANCH=none
TEST=Verify Type-C dock is functional with multiple hotplugs
     and flipped orientation.
     Verify USB3.0 is detected and not downgraded.
     Verify no regression with TBT3 and USB4 dock.

Cq-Depend: chromium:2530517
Change-Id: I5b8224648f0fc36b30e24ca3e7254d708c676149
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Signed-off-by: Ayushee Shah <ayushee.shah@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2366127
Commit-Queue: YH Lin <yueherngl@chromium.org>
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
2020-12-15 22:00:42 +00:00
Craig Hesling 49a18c25f8 util/ide-config.sh: Fix invalid cStandard c18
I'm not sure what changed, but VSCode doesn't recognize "c18".
The next best option is c17 or gnu17.

The original change to c18 was
commit 971e1b069f.

BRANCH=none
BUG=none
TEST=./util/ide-config.sh vscode all:RW all:RO | tee .vscode/c_cpp_properties.json
     # Check that VSCode is happy with gnu17 in
     # .vscode/c_cpp_properties.json.

Signed-off-by: Craig Hesling <hesling@chromium.org>
Change-Id: I6797898dc7b546f805de43e07457a98ba22cc9ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2593917
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2020-12-15 21:35:09 +00:00
Jack Rosenthal 30ba1a28dc zephyr: put project(...) after find_package(Zephyr)
When including the Zephyr source, this will change the values of
CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, causing cmake to execute
again having forgotten about some of the command (since these are
cached variables).

BUG=b:175248887
BRANCH=none
TEST=zmake testall, no "cached variables have changed" from cmake

Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I7eb1004060b0ba51d8c336dfe507ad747abe80ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2591627
Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-15 21:12:15 +00:00
Jack Rosenthal 88530597d9 zephyr: clear a few compiler warnings
BUG=b:174871569
BRANCH=none
TEST=compile, observe less warnings

Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: Id45ebc740344ec9261e28454a966e22a1cd6f629
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2591788
Commit-Queue: Keith Short <keithshort@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
2020-12-15 19:37:24 +00:00
Dawid Niedzwiecki 76b6c1082a zephyr: fix misspeling in eSPI shim
Use CONFIG_PLATFORM_EC_POWERSEQ instead of CONFIG_PLATFORM_EC_POWERseQ.

BUG=b:171815541
BRANCH=none
TEST=volteer power sequencing to S0

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: If61717da8e0d80e1d55ea3d7f627105909c1650e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2592491
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
2020-12-15 17:41:08 +00:00
Yicheng Li 11dda529f9 fingerprint: Only link FPC libraries if there's a FPC sensor
If a board doesn't have a FPC sensor, don't build FPC.

BRANCH=none
BUG=b:171812737, b:175158241
TEST=Change the sensor config on nocturne_fp to ELAN and build with
     ELAN's driver and library.

Signed-off-by: Yicheng Li <yichengli@chromium.org>
Change-Id: I90eca478b6eadfbd373154c52e13f734473abfdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2591868
Commit-Queue: Tom Hughes <tomhughes@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
2020-12-15 16:26:16 +00:00
Diana Z 470074fc8a TCPMv2: Handle message discard in snk_give_sink_cap
If a port partner sends a message while we're attempting to send sink
capabilities, then send a soft reset with the SOP of the incoming
message.

BRANCH=None
BUG=b:157228506
TEST=on drawcia with Apple A2119, PE does not get stuck in
snk_give_sink_cap state when interrupted

Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ic4d184ac731c44b8a604a38cfd6c0cfcd3df1127
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558909
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
2020-12-15 16:02:39 +00:00
Diana Z 7365b16a1e TCPMv2: Handle message discard in vcs_evaluate_swap
If the port partner sent a message while we were attempting to reply to
a Vconn swap, soft reset with the incoming message's SOP.

BRANCH=None
BUG=b:157228506
TEST=on drawcia with Apple A2119, PE does not get stuck in
vcs_evaluate_swap

Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: Ifb40ee6bec02b88d96088d72b1a9371417b3338a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558908
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
2020-12-15 16:02:37 +00:00
Abe Levkoy 4c6709899b tcpci: Base retry count on active PD rev
Retry twice when operating at PD 3.0 and thrice when operating at PD
2.0. Provide a TCPM-agnostic interface to get the number of retries.

BUG=b:173025773,b:173025737
TEST=Pass TD.PD.LL.E3 Soft Reset Usage and TD.PD.LL.E4 Hard Reset Usage
BRANCH=firmware-volteer-13521.B-master

Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: I422447718f1bfc9a9d4f8ffc5b284723a5332833
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578201
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
2020-12-15 15:39:20 +00:00
Abe Levkoy 0a561def48 mock: Clean up TCPMv2 mocks
Place mock functions in the mock libraries corresponding to the layers
of the real implementations. Broadly, move towards one layer of the TCPM
stack as a UUT, with mocks for the other layers as needed. There should
be a one-to-one correspondence between real modules and mock modules.
usb_pd_mock.c does not correspond to any real implementation module or
TCPM stack layer, so remove it and move its contents to the layers
corresponding to their real implementations.

Also clean up some redundant or misplaced mocks inside tests.

BUG=b:153071799,b:173791979
TEST=make buildall
BRANCH=none

Signed-off-by: Abe Levkoy <alevkoy@chromium.org>
Change-Id: Ic44df8675de2b9f1f8c7669cd97dcdc296bf107f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2578200
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
2020-12-15 15:39:18 +00:00
Mike Lee 160208413d Cerise: Enable DC-DC mode ctrl
Enable DC-DC mode ctrl to solve S3 power consumption over spec

BUG=b:173343526
BRANCH=firmware-kukui-12573.B
TEST=test S3 power consumption meet spec.

Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com>
Change-Id: Ia9df2bbe9b86030243c399b8e2ffc2f9993f5e9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2584542
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
2020-12-15 09:52:40 +00:00
Tommy Chung 713535b5af lantis: Increase task stack sizes
This CL increases task stack sizes along with crrev.com/c/2587794
since lantis was initialed with drawcia's image.

BUG=None
BRANCH=dedede
TEST=Verify that new task stacks sizes are present and that there
is plenty of free RAM left.

Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Change-Id: I0e1e18e23fdd1aa90db0588d8f4e859e781edc40
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2591830
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-15 08:35:03 +00:00
Samsp_Liu 7d4139ac58 vilboz: Enable LTE GPIO control
Power-on and Resume form S3:
Delay 10ms to pull high LTE_FCPO after LTE_EN is high.

Suspend and Power-off:
Delay 20ms to pull down LTE_FCPO after SLP_S3_L is low.
Delay 100ms to pull down LTE_EN after LTE_FCPO is low.

BUG=b:173490220
BRANCH=Zork
TEST=Measure waveform for LTE_FCPO GPIO control

Signed-off-by: Samsp_Liu <Samsp_Liu@compal.corp-partner.google.com>
Change-Id: I2dd66ea1030be805b376e6875a4570f2fea55a26
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2573663
Tested-by: SamSP Liu <samsp_liu@compal.corp-partner.google.com>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Commit-Queue: SamSP Liu <samsp_liu@compal.corp-partner.google.com>
2020-12-15 04:45:16 +00:00
Aseda Aboagye b1c2f9ba00 sm5803a: Enable IBAT_CHG ADC for all chargers
In order for the charger IC to measure and report battery charge
current, the ADC needs to enabled.  Only the primary charger has a
sense resistor for measuring the battery charge current.

This commits simply enables the IBAT_CHG ADC for all charger ICs upon
init.  The primary charger needs it for measuring the battery charge
current where the auxiliary chargers need it for calculating system
resistance.

BUG=b:175280922
BRANCH=dedede
TEST=Build and flash drawlat. Plug in charger in C0, issue `charger`
command, verify that battery charge current is shown.

Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: Id7ec930eb69d09a5d3388c7260d6d4f9515e8546
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2590503
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
2020-12-15 04:24:45 +00:00
Ruibin Chang e0db691a8d tcpm/it83xx: use PD_VCONN_SWAP_DELAY delay time for Vconn drop
The Vconn doesn't drop to 0v before we disable 5v tolerant on cc,
so I use the already existent baseboard configuration
PD_VCONN_SWAP_DELAY to increase delay time for Vconn drop.

BUG=none
BRANCH=none
TEST=on drawcia, Vconn drop to 0v before we disable 5v tolerant on cc.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
Change-Id: I526d7f36cba6082e7e644ea0923cc4bae365da16
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2584559
Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-15 03:30:33 +00:00
Keith Short 6dc2111008 Reland "zephyr: Add battery and smart battery options"
This is a reland of ac4f512e60

Original change's description:
> zephyr: Add battery and smart battery options
>
> Shim in battery and smart battery support.
>
> BUG=b:175248556
> BRANCH=none
> TEST=boot on volteer, run 'battery' command.
> TEST=run 'ninja menuconfig' and check KConfig help text.
> 20-12-10 20:08:12.778 battery
> 20-12-10 20:08:13.509   Status:    0x02c0 DCHG INIT RC
> 20-12-10 20:08:13.529   Param flags:00000003
> 20-12-10 20:08:13.541   Temp:      0x0b63 = %.1d K (%.1d C)
> 20-12-10 20:08:13.541   V:         0x2a1e = 10782 mV
> 20-12-10 20:08:13.541   V-desired: 0x3390 = 13200 mV
> 20-12-10 20:08:13.541   I:         0x0000 = 0 mA
> 20-12-10 20:08:13.550   I-desired: 0x0a19 = 2585 mA
> 20-12-10 20:08:13.550   Charging:  Allowed
> 20-12-10 20:08:13.550   Charge:    0 %
> 20-12-10 20:08:13.550   Manuf:     LG
> 20-12-10 20:08:13.555   Device:    AC17A8
> 20-12-10 20:08:13.573   Chem:      LIO
> 20-12-10 20:08:13.573   Serial:    0xb754
> 20-12-10 20:08:13.573   V-design:  0x2d1e = 11550 mV
> 20-12-10 20:08:13.573   Mode:      0x6001
> 20-12-10 20:08:13.573   Abs charge:0 %
> 20-12-10 20:08:13.573   Remaining: 0 mAh
> 20-12-10 20:08:13.577   Cap-full:  4932 mAh (4833 mAh with 98 % compensation)
> 20-12-10 20:08:13.585     Design:  5360 mAh
> 20-12-10 20:08:13.594   Time-full: 0h:0
> 20-12-10 20:08:13.594     Empty:   0h:0
>
> Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199

Bug: b:175248556
TEST=make buildall, which fails with:
/opt/coreboot-sdk/lib/gcc/nds32le-elf/8.3.0/../../../../nds32le-elf/bin/ld: __flash_dma_size < IT83XX_ILM_BLOCK_SIZE
BRANCH=none

Change-Id: I318fb13ba91485cd7d876b2294f20d748f47e0fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585931
Tested-by: Simon Glass <sjg@chromium.org>
Auto-Submit: Simon Glass <sjg@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
2020-12-14 22:39:12 +00:00
Rob Barnes 5f0df61bad guybrush: power and chipset configuration
Basic power and chipset configuration for guybrush.
Using stoney chipset, which is missing support for S0ix.
S0ix support will be added later (b/175234270).

BUG=b:175118237
BRANCH=None
TEST=build

Change-Id: I6aaa224b9ef554487a428db069d43922168baceb
Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585924
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
2020-12-14 21:39:43 +00:00
hanwenchao 4309f89db8 Coachz: correct g_sensor orientation
Correct the g-sensor oriention to match the latest board.

BRANCH=none
BUG=none
TEST=make BOARD=coachz -j
TEST=check the screen oriention.

Signed-off-by: hanwenchao <hanwenchao@huaqin.corp-partner.google.com>
Change-Id: Ia0a62cbf7abd64a6a89c300dcbd6f1b74c4616d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589693
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Commit-Queue: Bob Moragues <moragues@chromium.org>
2020-12-14 20:28:35 +00:00
Dawid Niedzwiecki f96f176c30 task_set_event: remove the wait argument
There is an option in the task_set_event function which force
the calling task to wait for an event. However, the option is never
used thus remove it.

This also will help in the Zephyr migration process.

BUG=b:172360521
BRANCH=none
TEST=make buildall

Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
2020-12-14 19:59:09 +00:00
Aseda Aboagye a23ef3d074 drawcia: Increase task stack sizes
After running the analyzestack target, I noticed that some of
drawcia's stack usage may exceed the currently defined sizes.  This
commit simply increases those that were under the usage shown by the
tool.

BUG=None
BRANCH=dedede
TEST=Build and flash drawlat, verify that new task stacks sizes are
present and that there is plenty of free RAM left.

Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I813ffe2463f9bece5047a9a633db22f2e1c61fa4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587794
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-14 19:52:13 +00:00
Aseda Aboagye ca355523ad OCPC: Expand resistance statistics
Previously, some statistics were added to the combined system and
battery resistance OCPC parameter. Namely, calculating the mean and
standard deviation in order to filter out outliers.  However, for OCPC
systems which can calculate both resistances separately, similar
statistics should be performed.

This commit expands the resistance statistics to cover the individual
Rsys and Rbatt OCPC parameters.

Additionally, fixes were made to ensure that the resistance could
never become negative.

BUG=b:170974274 b:175063502
BRANCH=dedede
TEST=Build and flash drawcia, charge from the sub board, enable OCPC
debug output and verify that resistance is still calculated, never
negative, and statistics are computed.
TEST=Repeat above test for madoo.

Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I57a4af0cbbd0fa9f4bc1354a79b4ba97ffbad6d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587817
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Diana Z <dzigterman@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
2020-12-14 19:52:10 +00:00
Craig Hesling bce4e485bb ide-support: Add vscode default settings.json and gitignores
This adds a .default settings.json file for vscode, so that you
do not need to copy/paste form the ide-support.md doc. This also
makes it easier for people that don't known that the ide-support.md
doc exists.

This also adds the .vscode directory to the gitignores, so that local
customization/settings are not always in the git status.

BRANCH=none
BUG=none
TEST=Checked in Gitiles
TEST=Check that my settings.json is not in "git status".
TEST=Check that ec.code-workspace is not in "git status".

Change-Id: I4dd8cfcd79c291a6f4fb0d573df131f0cb0d9844
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586041
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2020-12-14 18:45:51 +00:00
Craig Hesling d76cd68529 docs/ide-support.md: Run mdformat
mdformat -w --compatibility docs/ide-support.md

BRANCH=none
BUG=none
TEST=Check in Gitiles

Change-Id: I5c381679bff894b48a49c7a5a20e8e5268678762
Signed-off-by: Craig Hesling <hesling@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586040
Commit-Queue: Jett Rink <jettrink@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2020-12-14 18:45:50 +00:00
Tommy Chung 51c9774be2 lantis: Update OCPC PID constants
This CL updates the OCPC PID constants along with crrev.com/c/2567036
since lantis was initialed with drawcia's image.

BUG=b:174167890
BRANCH=dedede
TEST=Verify that at low SOC, charging from the sub board results in
lower overshoot and reduced time to correct steady state error.

Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com>
Change-Id: If4f40913e533901fa6b8280857b480adb8c68e11
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589134
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-14 18:29:16 +00:00
Sue Chen 04f7c1ed1b Ezkinil: Using fw_config to choose base accelgyro driver
Add new ec_cfg_base_gyro_sensor_type "BASE_GYRO_ICM426XX = 3" for
support ICM-426XX on ezkinil.

BUG=b:175169469
BRANCH=zork
TEST=Write fw_config bit15-11 to 011b on the Ezkinil DUT with ICM chip.
     Check the motion function is workable.

Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
Change-Id: If72746a1b7b44714aa39f7d48fd94d0c63d4f876
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581122
Reviewed-by: Edward Hill <ecgh@chromium.org>
2020-12-14 08:01:48 +00:00
Eric Yilun Lin 0172656723 Revert "zephyr: Add battery and smart battery options"
This reverts commit ac4f512e60.

Reason for revert: This CL stops chipset_task forever, revert this to boot AP.

Original change's description:
> zephyr: Add battery and smart battery options
>
> Shim in battery and smart battery support.
>
> BUG=b:175248556
> BRANCH=none
> TEST=boot on volteer, run 'battery' command.
> TEST=run 'ninja menuconfig' and check KConfig help text.
> 20-12-10 20:08:12.778 battery
> 20-12-10 20:08:13.509   Status:    0x02c0 DCHG INIT RC
> 20-12-10 20:08:13.529   Param flags:00000003
> 20-12-10 20:08:13.541   Temp:      0x0b63 = %.1d K (%.1d C)
> 20-12-10 20:08:13.541   V:         0x2a1e = 10782 mV
> 20-12-10 20:08:13.541   V-desired: 0x3390 = 13200 mV
> 20-12-10 20:08:13.541   I:         0x0000 = 0 mA
> 20-12-10 20:08:13.550   I-desired: 0x0a19 = 2585 mA
> 20-12-10 20:08:13.550   Charging:  Allowed
> 20-12-10 20:08:13.550   Charge:    0 %
> 20-12-10 20:08:13.550   Manuf:     LG
> 20-12-10 20:08:13.555   Device:    AC17A8
> 20-12-10 20:08:13.573   Chem:      LIO
> 20-12-10 20:08:13.573   Serial:    0xb754
> 20-12-10 20:08:13.573   V-design:  0x2d1e = 11550 mV
> 20-12-10 20:08:13.573   Mode:      0x6001
> 20-12-10 20:08:13.573   Abs charge:0 %
> 20-12-10 20:08:13.573   Remaining: 0 mAh
> 20-12-10 20:08:13.577   Cap-full:  4932 mAh (4833 mAh with 98 % compensation)
> 20-12-10 20:08:13.585     Design:  5360 mAh
> 20-12-10 20:08:13.594   Time-full: 0h:0
> 20-12-10 20:08:13.594     Empty:   0h:0
>
> Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199

Bug: b:175248556
Change-Id: I66086d8fee46d5fd02d26938468a7d76dab71c6e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2589140
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Commit-Queue: Eric Yilun Lin <yllin@chromium.org>
Tested-by: Eric Yilun Lin <yllin@chromium.org>
2020-12-14 05:11:24 +00:00
Sue Chen 6cc11c09ba driver: fix build error in accelgyro_icm426xx.c
Remove const attribute in icm426xx_set_range and icm426xx_init.
Remove struct accelgyro_saved_data_t *data in icm426xx_set_range
for no used.

BUG=none
BRANCH=none
TEST=change the base motionsensor in Ezkinil and build the code
     successfully. The motion function is workable on Ezkinil DUT
     with the ICM chip.

Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com>
Change-Id: I183bdd9de2d148466e5ba57ba6917108b04ce332
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581160
Reviewed-by: Edward Hill <ecgh@chromium.org>
2020-12-14 03:52:59 +00:00
Ruibin Chang 85ecd7589b usb_pe_drp_sm: clear PE_FLAGS_PS_RESET_COMPLETE after reset complete
We should clear the PE_FLAGS_PS_RESET_COMPLETE after PE get the flag
, or this flag is always set.

BUG=none
BRANCH=none
TEST=on drawcia, console cmd "pd 0 hard" second times and later
     pe stays in pe_snk_transition_to_default_run state to wait
     PE_FLAGS_PS_RESET_COMPLETE set.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
Change-Id: I95c5a627e6b289d4405dc695eeaa97d369e1d92f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2577149
Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2020-12-14 03:34:39 +00:00
Jacky Wang 803743a9de copano: Initial TCPC configuration
Update TCPC configuration from TUSB422 to RT1715

BUG=b:175185468
BRANCH=firmware-volteer-13521.B
TEST=make BOARD=copano
Plug-AC and check EC log and pd state.
Check EC console message "TCPC init ready".

Signed-off-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
Change-Id: If450047939bebf1315c729935380a998fccdac59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581698
Reviewed-by: Keith Short <keithshort@chromium.org>
2020-12-14 03:12:29 +00:00
Zick Wei 2cff51ff85 dooly: ignore c10_gate
Implementing the recommendation
from BUG=b:172412549 to fix idle hang up issue.

BUG=b:172412549
BRANCH=puff
TEST=verify DUT will not hang up when idle enter S0ix.

Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>

Change-Id: Ib6b2e1d27cf0faa98d11082919e1b85420b459b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2583598
Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Reviewed-by: Peter Marheine <pmarheine@chromium.org>
Commit-Queue: Zick Wei <zick.wei@quanta.corp-partner.google.com>
2020-12-14 02:35:06 +00:00
Samsp_Liu 10498f0ba4 vilboz: Change power LED behavior
Change Power LED from turn off to blink (500ms off/3s on)
when system in S3 with DC only.

BUG=b:175274739
BRANCH=Zork
TEST=LED behavior test

Signed-off-by: Samsp_Liu <Samsp_Liu@compal.corp-partner.google.com>
Change-Id: I2bea88fc626d9860d61d7604ffbc10467af57e10
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2584546
Tested-by: SamSP Liu <samsp_liu@compal.corp-partner.google.com>
Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: SamSP Liu <samsp_liu@compal.corp-partner.google.com>
2020-12-14 02:30:08 +00:00
Scott Collyer ff4f8fd9a4 stm32g4: ucpd: Add support for USB-PD messaging
This CL adds routines required to support USB-PD messaging to the UCPD
driver. UCPD is performs TCPC type functions, but is not a TCPC. UCPD
does utilize the common TCPCI APIs as entry points called from the
port's PD task. In addition, UCPD has its own task to manage more
easily transmit requests from TCPM layer and GoodCRC messages which
must be intiated in the UCPD driver itself.

BUG=b:167601672
BRANCH=None
TEST=verfied type-c attaches properly on quiche

Signed-off-by: Scott Collyer <scollyer@google.com>
Change-Id: I0c02bee4badc479125832a6b5a6fa156e998c201
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247117
Tested-by: Scott Collyer <scollyer@chromium.org>
Auto-Submit: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
2020-12-13 02:56:49 +00:00
Dossym Nurmukhanov 3a03483f80 EC: Removing an unused i2cm_init function signature
BUG=none
TEST=built several boards
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: I4e9b52fb5c7ef6dab4db30f98cece9b5635f699c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587805
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2020-12-12 20:39:38 +00:00
Dossym Nurmukhanov 8223f2d538 COIL: Clean up controller/peripheral language in headers
BUG=none
TEST=verify builds are still working
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: I8925a7ffd3ab4e47dfed213438f601d673188259
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2588008
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2020-12-12 20:39:35 +00:00
Dossym Nurmukhanov 52863374ad COIL: Standardize i2c peripheral language
BUG=none
TEST=validate volteer build (i2c_peripheral.c is not used by any boards)
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: Ib2d78dc3fc9f4f189f84409cf43ab96788c429be
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587227
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2020-12-12 20:15:38 +00:00
Dossym Nurmukhanov c03b3d8174 COIL: Rename i2c_peripheral files
BUG=none
TEST=build and run on volteer
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: I11a75e4954e918b2d4ff575dee14dec621a619b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587226
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2020-12-12 20:15:35 +00:00
Dossym Nurmukhanov abd894e1c9 COIL: Rename EC-EC comm config to be inclusive
Use server/client nomenclature instead

BUG=none
TEST=build and run on volteer
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: I2cf4a82291134378ed21bbc068361f1be25e8176
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2587574
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2020-12-12 12:55:46 +00:00
Dossym Nurmukhanov 61022575d3 COIL: Use inclusive language for EC-EC communication code
Replace with server/client nomenclature

BUG=none
TEST=build and run on volteer
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: I23fe7de9228a9611b49eef1362bf15159b25aab7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586038
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2020-12-12 12:55:43 +00:00
Dossym Nurmukhanov a86aecb2de COIL: Rename ec_ec_comm* files to inclusive language
Rename the files to server/client instead

BUG=none
TEST=Rebuild and run on volteer
BRANCH=none

Signed-off-by: dossym@chromium.org
Change-Id: Ibcbdcddfab1b878ff48fc4cb76307efe6de4fac0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586037
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2020-12-12 12:55:40 +00:00
Simon Glass e9be6c5c1b zephyr: Update the I2C table
Something has happened since this code was written and now it doesn't
work. The current code checks the status of each of the named-i2c-ports
nodes, which always seems to return 0, then ends up searching for a
device called "".

Obviously this code did work and should work, but I'm uploading this
just because it makes the battery command work for me:

On the other hand, I don't think we need to check the status. After
all, we are searching for a device by its node label and if the node
is disabled it will not have a device anyway.

BUG=b:175248556
BRANCH=none
TEST=verify with debugging that the i2c_devices[] array is now inited
correctly

Signed-off-by: Simon Glass <sjg@chromium.org>
Change-Id: I709421be86027e0e6166a7658fe59ba68783cbe7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2586614
Reviewed-by: Yuval Peress <peress@chromium.org>
2020-12-11 23:53:19 +00:00
Keith Short ac4f512e60 zephyr: Add battery and smart battery options
Shim in battery and smart battery support.

BUG=b:175248556
BRANCH=none
TEST=boot on volteer, run 'battery' command.
TEST=run 'ninja menuconfig' and check KConfig help text.
20-12-10 20:08:12.778 battery
20-12-10 20:08:13.509   Status:    0x02c0 DCHG INIT RC
20-12-10 20:08:13.529   Param flags:00000003
20-12-10 20:08:13.541   Temp:      0x0b63 = %.1d K (%.1d C)
20-12-10 20:08:13.541   V:         0x2a1e = 10782 mV
20-12-10 20:08:13.541   V-desired: 0x3390 = 13200 mV
20-12-10 20:08:13.541   I:         0x0000 = 0 mA
20-12-10 20:08:13.550   I-desired: 0x0a19 = 2585 mA
20-12-10 20:08:13.550   Charging:  Allowed
20-12-10 20:08:13.550   Charge:    0 %
20-12-10 20:08:13.550   Manuf:     LG
20-12-10 20:08:13.555   Device:    AC17A8
20-12-10 20:08:13.573   Chem:      LIO
20-12-10 20:08:13.573   Serial:    0xb754
20-12-10 20:08:13.573   V-design:  0x2d1e = 11550 mV
20-12-10 20:08:13.573   Mode:      0x6001
20-12-10 20:08:13.573   Abs charge:0 %
20-12-10 20:08:13.573   Remaining: 0 mAh
20-12-10 20:08:13.577   Cap-full:  4932 mAh (4833 mAh with 98 % compensation)
20-12-10 20:08:13.585     Design:  5360 mAh
20-12-10 20:08:13.594   Time-full: 0h:0
20-12-10 20:08:13.594     Empty:   0h:0

Change-Id: Ie782e75ee4027ab2a5c6a0ae7f4ad81e9c360711
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2575199
2020-12-11 23:53:17 +00:00
Ruibin Chang d421419f1a tcpm/it83xx: don't enable/disable Tx when Rx_enable() called
Register BMC PHY (00h bit4) enable/disable both Tx and Rx module,
and we shouldn't enable/disable Tx module when Rx_enable() called,
So I change to set Rx decode enable/disable only in Rx_enable().

Setting PD sleep mask shouldn't tie with Rx_enable(), so I change
to set sleep mask by HOOK_CONNECT/DISCONNECT. Enable deep sleep mode,
when all ITE ports are in Unattach.SRC/SNK state and other ports
aren't pd_capable(). Disable deep sleep mode, when one of ITE port is
in Attach.SRC/SNK state or one of other ports is pd_capable().

BUG=b:174151372
BRANCH=none
TEST=on drawcia, plug-in dongle and adapter:
     1.console cmd "pd 0 hard", hard reset tx done is set within 1ms.
     2.check PD sleep mask: nothing attached = 0, one port attached = 1
     3.lid close to G3(Rd_5.1k), then plug-in adapter, can go to
       SNK_READY state
     4.can send SOP' to E-mark cable
     5.console cmd "sysjump rw", can go to SNK/SRC_READY

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
Change-Id: Ibbf2f2d3d086be0bad4f3430c78f5ac3a26f8b1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2573667
Tested-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-11 22:16:49 +00:00
Yicheng Li e92c7a2a33 nucleo-dartmonkey: Build the same tests as dartmonkey
This would enable us to test dartmonkey's on-device tests on
nucleo-h743zi.

BRANCH=none
BUG=b:157692395
TEST=make -j buildall

Signed-off-by: Yicheng Li <yichengli@chromium.org>
Change-Id: I9251a177a1c9bb5996906aaca6682207b706d9cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2585746
Reviewed-by: Craig Hesling <hesling@chromium.org>
2020-12-11 21:41:47 +00:00
Jacky Wang edd893be3e galtic: Config the EC battery setting.
Config the EC battery setting depend on battery spec.

BUG=b:175350831
BRANCH=firmware-dedede-13606.B
TEST=BOARD=galtic
1. Check battery found on EC log.
2. Check battery cutoff function on EC console.
3. Check battery charging FET status when battery full.

Signed-off-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
Change-Id: I691a4726791522e6dd548ef482665f231eb2d656
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2584549
Reviewed-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Reviewed-by: Henry Sun <henrysun@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
2020-12-11 21:29:13 +00:00
Edward Hill 46826ee4fc usbc: Remove pd_ts_dts_plugged() check from PD_DRP_FORCE_SINK
PD_DRP_FORCE_SINK had an exception (since crrev.com/c/277275),
allowing role to remain source on S5 entry if DTS (debug accessory)
is connected. Remove this exception.

rddkeepalive on cr50 (set when servod starts) ensures CCD mode stays
enabled across power and role changes.

BUG=b:173457150
BRANCH=none
TEST=servo_v4_role:snk, AP S0/S5/G3, EC reboot/hibernate
	-> CCD keeps working

Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: Iccdfb504c6269ee2ba072e9818920e3e10a56739
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542578
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2020-12-11 20:51:13 +00:00
Will 87d6897906 eldrid: change power LED flicker frequency.
Extend power led off time to 6sec in s0ix to save more power consumption.

BUG=b:170842004
BRANCH=firmware-volteer-13521.B-master
TEST=make buildall

Signed-off-by: Will <Will_Tsai@wistron.com>
Change-Id: I6676ed8f152b0b199c222bb92efab0261acfa7e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581123
Tested-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Scott Chao <scott_chao@wistron.corp-partner.google.com>
Commit-Queue: Keith Short <keithshort@chromium.org>
2020-12-11 20:26:50 +00:00