When interrupts are interleaved from the TCPC and charger, we can get
into a state where the interrupt line for the board ends up stuck low.
Improve on this situation by setting a deferred function to check on the
interrupt line after we get a signal in, and notify chips on that line
there may be more to process.
BRANCH=None
BUG=b:173345295
TEST=on madoo, plug in powered PD hub to C1, generating interrupts
from both the charger and TCPC and verify C1 interrupt line goes high
once connection is ready
Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com>
Change-Id: I3d29df28f94cb6c352adf05b9204ab4ff52a9726
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2557758
Reviewed-by: Henry Sun <henrysun@google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com>
Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
Analysis of motionsense shutdown revealed a race condition,
as function that change sensor state can run on parallel tasks, namely
CHIPSET and HOOK:
motion_sense_shutdown (CHIPSET) ---> (motion_sense_switch_sensor_rate)
suspend/resume (HOOK) ----> (motion_sense_switch_sensor_rate)
motion_sense_process (MOTIONSENSE) ---> motion_sense_set_data_rate (ACTIVE)
\-> motion_sense_set_motion_intervals
/----------- motion_sense_init --\
| |
motion_sense_switch_sensor_rate ---> motion_sense_set_data_rate (ACTIVE)
| \----------- sensor->collection_rate = odr...; (ACTIVE)
\------------> sensor->collection_rate = 0; (INACTIVE)
\-----------> motion_sense_set_motion_intervals
Running motion_sense_switch_sensor_rate() on HOOK task is necessary because
on some platform, the power line may be already off, when the device is going to S5.
- Always run motion_sense_switch_sensor_rate() on hook.
- When changing ODR is needed (sensor active), schedule MOTIONSENSE task.
The new sequencing is simplified:
suspend/resume/shutdown (HOOK) ----> (motion_sense_switch_sensor_rate)
/----------- motion_sense_init --\
| |
motion_sense_switch_sensor_rate ---> schedule MOTIONSENSE.
\------------> sensor->collection_rate = 0; (INACTIVE)
motion_sense_process (MOTIONSENSE) ---> motion_sense_set_data_rate (ACTIVE)
\-> motion_sense_set_motion_intervals
BUG=b:170703322
BRANCH=kukui
TEST=Check on Volteer the sequence at suspend/resume/shutdown.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I0238cae9b4720e487a1e70788296a4db1b1e186b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2553347
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Set collection_rate to 0 when sensor is not in initialized state anymore.
It will prevent the motion_sense task to be neededlessly scheduled.
Export wait_us to be tested.
BUG=b:170703322
BRANCH=kukui
TEST=unit test
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I1dc4c7a07ff30fa10997ef87784114c725f100d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2520297
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Yuval Peress <peress@chromium.org>
This commit remove sensors and tablet mode, since Elemi doesn't
support that.
BUG=b:163012636
BRANCH=firmware-volteer-13521.B-master
TEST=Verified boot without sensors initial.
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: Icf23456763699024d934d78ac2cc20fcfcc5b9bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2554171
Reviewed-by: Keith Short <keithshort@chromium.org>
This commit enlarge keyboard scan task stack to prevent stack
overflow.
BUG=b:174190303
BRANCH=firmware-dedede-13606.B-master
TEST=On drawcia. Make sure KEYSCAN is not overflow with volup+H+alt
keys.
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: I99e180eca8e6665c5ab9f52d8bc7dcd5ec55e678
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2557772
Reviewed-by: Diana Z <dzigterman@chromium.org>
Chagne EC chip to npcx7m7fc to board version 1.
BUG=b:169118044, b:174275667
BRANCH=firmware-volteer-13521.B-master
TEST=Verified boot with npcx7m7fc re-worked board.
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: I334f56b2f47c21ff38aeccc346b6be43fb71b7ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2554172
Reviewed-by: Keith Short <keithshort@chromium.org>
Update Startup sequence to fully address SC_OUT over voltage issue.
BRANCH=master
BUG=170591575
TEST=Build successfully.
Change-Id: I31cbd839a7943ee19c19601bf178db6911f3dffd
Signed-off-by: Sean Hou <seanhou@lionsemi.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2520279
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Commit-Queue: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
CL:2542865 adds calls to tcpm_sop_prime_enable() function but there is no
implementation of sop_prime_enable() provided in anx74xx_tcpm_drv.
This causes EC crashes during firmware_PDTrySrc test.
This patch adds tcpci_tcpm_sop_prime_enable() and implementation of
sop_prime_enable() in anx74xx_tcpm_drv, similarly to other ANX drivers.
BUG=b:168560801, b:162254118
BRANCH=none
TEST=Flash eve with EC ToT, run firmware_PDTrySrc test.
Make sure that EC doesn't crash during test.
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I7cb2738f2a238901d03e3d8cb98ee39ce26bf38a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2560635
Reviewed-by: Jett Rink <jettrink@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
Remove unused configuration and gpio pin and reconfig tcpc/ppc config for voema typec port.
BUG=b:169356808
BRANCH=master
TEST=Check C0/C1 port workable.
Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com>
Change-Id: I0ff2322b1cf19e24f66745c1509b811eeff69161
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550118
Reviewed-by: Keith Short <keithshort@chromium.org>
This patch update led on/off level by board version
and USB-C port:
1.board version >= 3 && USB-C right port
led on: gpio set high
led off: gpio set low
2. board version < 3
led on: gpio set low
led off: gpio set high
BUG=b:161210524
BRANCH=zork
TEST=verify on rework board, led behavior as intended.
Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com>
Change-Id: I6fec6968b2599702d61e9f2f1b7151ccd5c06a09
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2545913
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>
Remove power_led and EC_SKU_ID,and use white battery_led to show power
state in DC state
BUG=b:174282565
BRANCH=firmware-kukui-12573.B
TEST=make build all pass
test firmware branch ,battery led can work normal
Signed-off-by: Mike Lee <mike5@huaqin.corp-partner.google.com>
Change-Id: Ie046588ef608294836ce0bffccfd2d68e8c77e78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2563426
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
This CL implements a feature report defined in [1] that describes the
keyboard's top row layout.
[1] http://doc/1NTxSGv3WA2Vn4dlPLOcvKBvPytWOF0UAcIYQaFctTug
BUG=b:171156337
TEST=Verify feature report content using test code in CL:2530156.
BRANCH=none
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: I28a93f1b926d58602eb66d1b090e89384cb09f77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522641
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Making it easier to follow the code with
regard to the VIF spec for DR_Swap_To_DFP_Supported
and add is_alt_mode_controller in the SNK path
decision.
BUG=b:172293518
BRANCH=none
TEST=verify XML output
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I06b4b86ef3e08f5768ae7396a50abff579aaaff7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2560613
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Tested-by: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
This is a helper running on the host, so should use host tooling.
Changing this avoids a build failure on cheza where chromeos-ec the
would fail to build before the openssl package (which is supposed to
work given that chromeos-ec doesn't list openssl in its dependencies,
and this pkg-config invocation is not a reason to start doing so).
BUG=None
BRANCH=None
TEST=emerge-cheza -v1 chromeos-ec
Signed-off-by: Mattias Nissler <mnissler@chromium.org>
Change-Id: I45161285db17a56b29a36549d3b113f42dff9362
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2550660
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
GENMASK is used in ec_commands.h, but is not defined if not compiling in
kernel or Chrome OS EC environments.
BRANCH=none
BUG=b:144959033
TEST=make buildall
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I439b0d77c47f3921f7bf2afd04c62cc72d668ea6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2558857
Reviewed-by: Keith Short <keithshort@chromium.org>
Build target to test Magolro boards reworked
with the NPCX797FC EC.
BUG=b:168608382
BRANCH=none
TEST=make buildall, workable on the re-worked Board.
Change-Id: I74f3da25f5f968bad715d773b034f025e01e90d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2554657
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Henry Sun <henrysun@google.com>
Commit-Queue: Justin TerAvest <teravest@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
This CL adds the battery configuration from interlrvp baseboard
to board specific file for Alderlake, Tigerlake and jasperlake
platform so that same manufacturer battery but with different
config params can be used on intended platforms.
BUG=b:174129818
BRANCH=None
TEST=Able to see correct battery configuration in "battery" EC command
and can see the battery charging and discharging.
Signed-off-by: Ayushee Shah <ayushee.shah@intel.com>
Change-Id: I639eb4466c49dbdc01d31feb4ace8844a6b1ac87
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2557763
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Instead of having the policy logic spread over a
few locations, us pd_can_source_from_device to
localize that policy
BUG=none
BRANCH=zork
TEST=verify PR_Swaps to SNK only if partner can source
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I402abcf4c9e864203d580b37218859e68e74bf2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555866
Tested-by: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
TCPMv1 used PD_FLAGS_CHECK_PR_ROLE and
pd_check_pr_role() to accomplish this. This was
missing from TCPMv2.
In the TCPMv2 implementation, policy
pd_can_source_from_device was added to put the
logic in one place to detect if the PDO for a
partner device can and should be the source
Using this policy the AP resume code will check
to see if an already attached partner that we
are sinking from should be sinking from us instead.
BUG=b:169299049
BRANCH=zork
TEST=verify DRP phone will swap back to SNK on AP resume
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I8e584446445c8ee2e1c91973a58a04405cdf9e1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555865
Tested-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Support for decode SOP' & and SOP'' enable function in the driver
to avoid system reboot when tcpm_sop_prime_enable() is called.
Refer to https://crrev.com/c/2381030 .
BRANCH=None
BUG=b:173081501
TEST=Connect Gatex to ADLP-RVP. No reboot and USB4 connection
is established.
Signed-off-by: Poornima Tom <poornima.tom@intel.com>
Change-Id: I418f7dfdf488289f27d7b0becf012f6cf554a025
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2517261
Reviewed-by: Keith Short <keithshort@chromium.org>
This CL increased clock's Tlow to 1.51 us (1.3 us minimum) and
reduced Thigh to 1.087 us (0.6 us minimum).
BUG=b:163384683
BRANCH=none
TEST=i2c clock meet timing at 400kHz.
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Change-Id: Id62b2370018ba2d41e0dbc715a4c40629260d66b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2557281
Reviewed-by: Diana Z <dzigterman@chromium.org>
Reviewed-by: Mike Goodey <mgoodey@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
fine tune lid and base accel sensor matrices
BUG=b:172290264
BRANCH=none
TEST=buildall, check the sreen rotation degree is correct on tablet mode
and desktop mode
Signed-off-by: jerry2.huang <jerry2.huang@lcfc.corp-partner.google.com>
Change-Id: I5e3ba275484dc2ecc178ef114cc27c9dc6392745
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2556731
Reviewed-by: Henry Sun <henrysun@google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
CTN730 is a NFC/WLC transmitter (a.k.a. poller), which communicates
with a receiver (a.k.a. listener) to transfer power wirelessly.
BUG=b:173235954
BRANCH=Trogdor
TEST=See the description of CL:2538536.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: Icf5df30d2dffe617887ff6a591ea5b4a753cb3d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2538539
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Peripheral charge manager communicates with peripheral charge chips
to charge batteries of peripheral devices.
Tested using Coachz proto and a listener evaluation board from NXP demo
kit as follows:
1. Attach device then battery percentage is reported periodically.
2. Detach device then re-attach device to stop and resume charging.
3. Disable port by 'pchg 0 disable' to stop charging.
4. Enable disabled port by 'pchg 0 enable' to resume charging while
device is in proximity.
5. When port is disabled, a device isn't detected or charged.
BUG=b:173235954
BRANCH=Trogdor
TEST=See the description above.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I0c2b583e5f7736b26ec7d1fb9cd9b6c59c7e8177
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2538536
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
When plug in AC to right side (MB), only LEDs on the right should be
working according to designated behavior, and the left side should be
off. Vice versa.
Right side LEDs:
GPIO_EC_CHG_LED_R_W
GPIO_EC_CHG_LED_R_Y
Left side LEDs:
GPIO_BAT_LED_WHITE_L
GPIO_BAT_LED_AMBER_L
BUG=b:173464588
BRANCH=None
TEST=when plug in AC to left side, LEDs works correctly. When plug
in AC to right side, use gpioget to make sure LEDs are set.
Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com>
Change-Id: I837caf2d69853316941f6d4a91e86e71c6844ef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2553993
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com>
Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
When device at USB-C port happen short, the RAA489000 charger IC have
current limit function with OTG UVP function. In order to enable OTG
UVP function, the registers of 0x92 and 0x94 has to be set. Since normal
output is 5V, set register 0x94 to 4.75V (0xBE) for detection, and set
0x92 to 3.104A (0x61) for better protection.
BUG=b:169788521
BRANCH=None
TEST=build and flash on madoo
Signed-off-by: Ko_Ko <Ko_Ko@compal.corp-partner.google.com>
Change-Id: Ia20febce9be2ac26530c30c42f9a292602dec63c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2489704
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Ko Ko <ko_ko@compal.corp-partner.google.com>
Tested-by: Ko Ko <ko_ko@compal.corp-partner.google.com>
Config the EC battery setting depend on battery spec.
BUG=b:173534296
BRANCH=firmware-volteer-13521.B
TEST=manual
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: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Change-Id: I4fbdcc18a5d8727ee2d1f2571310b3b7cc4b3c21
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546720
Reviewed-by: Jacky Wang <jacky5_wang@pegatron.corp-partner.google.com>
Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
Added check for USB4_Supported in is_usb_pd_supported
because USB4_Supported is a must be YES for PD_Support
Also split up PD_Port_Type from Type_C_State_Machine
because PD_Port_Type should not appear if this
component does not support USB PD and the same exclusion
can not be said about Type_C_State_Machine
BUG=b:172293518
BRANCH=none
TEST=verify XML output
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I3d1a8f603693d90673ea3e610ca751f8d9c027a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552858
Tested-by: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
set_range is now called all the time at init to set the current range
at resume. Set one for tcs3400 otherwise the EC crashes.
fixes: commit d28c10498c ("motion_sense: Make change in range permanenti")
CL:2215751
BUG=chromium:1083791
BRANCH=none
TEST=check on Volteer EC is not crashing in
motion_sense_switch_sensor_rate() at resume.
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Change-Id: I172d3289bb69c14fa757d761b0099fea312292e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2553346
Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
Commit 7dec638eb5 introduced two polarity
modes POLARITY_CC1_DTS, POLARITY_CC2_DTS in enum tcpc_cc_polarity, but
in many places there was an assumption that value other than 0 means
that cable is inverted, the most notable example is usb_mux_set(). As a
result kernel sometimes was not reporting SuperSpeed depending on if
cable was inverted or not.
This patch adds mapping from polarity with DTS to polarity without DTS
where necessary.
BUG=b:162254118
BRANCH=none
TEST=Connect ServoV4 to eve and run servod. Make sure that USB-C muxer
is connects USB3.0 lines (servod should set it).
Flash EC ToT on eve. Boot ChromeOS and go to Developer Console.
Run 'dmesg -w', check if device (eg. ethernet adapter) is attached as
SuperSpeed device. Unplug cable, invert and plug again. Kernel
should report that device is attached as SuperSpeed.
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I354ef7047240cc8b5db01936b3780fae7387edb5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555157
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Commit-Queue: Jett Rink <jettrink@chromium.org>
This commit updates some of the charger IC settings to help reduce the
current ripple. These settings including enable hysteresis for
DCM/CCM as well as reducing the switching frequency to 600KHz.
BUG=b:163056834
BRANCH=dedede
TEST=Build and flash waddledoo, verify that input current ripple is
reduced.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: I8c19ed040b92cf833d132ad247e761849985a919
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2552860
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Diana Z <dzigterman@chromium.org>