summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* charge_manager: board specific callback to get vbus voltageSue Chen2021-08-272-0/+9
| | | | | | | | | | | | | | | | Add board_get_vbus_voltage to get vbus voltage by board, for ADC_VBUS maybe is only for one typec port when the DUT supports multiple typec. BUG=b:196001868 BRANCH=none TEST=show correct C1 vbus voltage on tomato Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: Ia567ec3bddf4f62a08c9902b4f0721783f2c07ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3084403 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* adc: Allow runtime config of adc_channelsCaveh Jalali2021-08-272-0/+9
| | | | | | | | | | | | | | | This adds the CONFIG_ADC_CHANNELS_RUNTIME_CONFIG config option to allow the adc_channels array to be tweaked at runtime. BRANCH=none BUG=b:183452273,b:181271666 TEST=buildall passes Change-Id: I1241012b6e36c19baa7fe80853a6c6de4affeefa Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3116990 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* adc: Include adc_chip.h from adc.hCaveh Jalali2021-08-271-0/+7
| | | | | | | | | | | | | | | | This reorganizes adc.h and adc_chip.h so that general code only needs to know about adc.h. adc_chip.h is now included by adc.h directly and does not need to be included in general code. BRANCH=none BUG=b:181271666 TEST=buildall passes (with next patch in series) Cq-Depend: chromium:3120316 Change-Id: I8bc107c6900e831a57f7a7fb8668eb08bb179d6c Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120315 Reviewed-by: Keith Short <keithshort@chromium.org>
* usb_mux: Add function to enable USB3.1 mode for UFPScott Collyer2021-08-261-0/+10
| | | | | | | | | | | | | | | | | | | | | This CL adds a new overridable function to allow boards more control over the USB mux. For type-c only connections, the mux may only be set one time based only on data role. The default function returns false, so only boards which override this function will be affected. BUG=b:195042155 BRANCH=quiche TEST=Verfied that when I connect USBC only source on gingerbread that the TUSB1064 usb mux gets configured to enable USB3.1 mode. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I5cc7466d2d13c46b1ff6cfc48af577559591f6e4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3119224 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* pd: usb: Add usb type-c USB mux handling for UFP-only platformsJan Dabros2021-08-251-0/+3
| | | | | | | | | | | | | | | | | | | | | Some platforms (e.g. servo_v4(p1)) are designed to act only as a UFP considering superspeed terminations. Add config option to properly manage usb superspeed muxer for such. BUG=b:137887386,b:182419010 BRANCH=main TEST=With servo_v4p1 connected to the DUT, unplug and replug CHG couple of times in order to force PR_SWAP on DUT port. Each time verify on the DUT console, whether all USB3 devices are visible. They should be, since servo is trying to perform DR_SWAP when it acts as a SRC. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I0a7756f0bb2192795b7489334ed01d317d3e54ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3094246 Reviewed-by: Michał Barnaś <mb@semihalf.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* common: Add Milli Kelvin conversion macrosRob Barnes2021-08-211-2/+16
| | | | | | | | | | | | | | Add macros to convert to and from milli kelvin and various temperature units. Utilize round_divide for more accurate conversions. BUG=b:176994331 TEST=Unit test BRANCH=None Change-Id: Ie6750b9d2d2b8093fdf9c14f904382e91d8d95bb Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078051 Reviewed-by: Keith Short <keithshort@chromium.org>
* system: fix system_get_scratchpad APIYuval Peress2021-08-201-2/+8
| | | | | | | | | | | | | | | The current API for system_get_scratchpad mixes the status and the value being read. Update the signature to allow both. BRANCH=none BUG=b:195481980 TEST=make testall && zmake testall Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I3a5f5ad523d507c53a5d474806f58afafb82e70c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3074828 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: drop IS_ZEPHYR_VERSION macroJack Rosenthal2021-08-191-9/+0
| | | | | | | | | | | | | | As noted in the bug, this macro is an antipattern. Drop it. BUG=b:197159539 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I2fa6515149ff31ae650ed4f3fdc65b111f62c5b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104788 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* TCPM: Remove enum pd_msg_typeAbe Levkoy2021-08-182-10/+1
| | | | | | | | | | | | | Convert usages of this enum to tcpm_sop_type. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I5fed273d72e7ad0e191db0cb0d121b70bdd9ecdb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104291 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPM: Rename enum tcpm_transmit_typeAbe Levkoy2021-08-1815-62/+76
| | | | | | | | | | | | | | | Rename tcpm_transmit_type to tcpm_sop_type to reflect that it can be used for Rx as well. Describe it in comments. This prepares to consolidate enum pd_msg_type into this enum. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ife97d4ad51c48f2e832b94e007954919e236a309 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3104290 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: provide unified method to get sku id and board versionMichał Barnaś2021-08-181-1/+20
| | | | | | | | | | | | | | | | | | | | | | Previously, functions for reading board version and sku id were defined in board.c files which are not compiled in Zephyr builds. Logic from board.c files should be moved to the DeviceTree files. This commit adds support for defining board version and sku id pins and numeral system used to decode them. BRANCH=main BUG=b:194136536 TEST=Call system_get_sku_id and system_get_board_version on CrOS EC and Zephyr, values should be correct and the same on both versions Change-Id: I61b5e205cb2a2299ad86c5dff38c05a9659eb2d3 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3048102 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com>
* driver/amd_stt: Add AMD STT driverRob Barnes2021-08-162-0/+35
| | | | | | | | | | | | | | | | | | Add a driver for writing Skin Temperature Tracking (STT) sensor readings to the SB-RMI interface. STT readings are used to maximize the SOc performance while keeping the skin temperature within specification. BUG=b:176994331 TEST=Build and run on guybrush BRANCH=None Change-Id: If655545158e7dc05946bc67686b1b0b40a40a713 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078050 Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org> Commit-Queue: Raul E Rangel <rrangel@chromium.org>
* driver/sb_rmi: Add AMD SB-RMI driverRob Barnes2021-08-161-0/+3
| | | | | | | | | | | | | | | | | | Add Side-Band Remote Management Interface driver. SB-RMI can be used to manage power limits of the SOC. SB-RMI uses a soft mail box for executing transactions. BUG=b:176994331 TEST=Build BRANCH=None Change-Id: Ie185985e4c8d2c2d915b2ae2447709ddc16adda6 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078049 Tested-by: Rob Barnes <robcb85@gmail.com> Commit-Queue: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Fanli Zhou <fanliccc@gmail.com> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* USB MUX: Introduce flag to clear mux state in G3Diana Z2021-08-161-0/+1
| | | | | | | | | | | | | | | | | | Some muxes may need to be re-set after they've power cycled, and many muxes are tied to the S5 power rails. Introduce a flag which can be used to indicate a mux needs to re-run init and is no longer in LPM after the G3 state has been hit. BRANCH=None BUG=b:195045790 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I8bd4184dbea629edf106dbee32f811620ebda0dd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093086 Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* ps8xxx: Increase FW init delay to 50msCaveh Jalali2021-08-161-1/+1
| | | | | | | | | | | | | | | The latest app note indicates the ps8815 firmware may take up to 50ms to be ready. BRANCH=none BUG=b:186189039 TEST=buildall passes Change-Id: Ibc5ee2e6030d19b91d6c0b8a493aa05dd31c77e4 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3087983 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* USB MUX: Generalize mux ACKDiana Z2021-08-142-4/+8
| | | | | | | | | | | | | | | | | | | | Currently, only the virtual mux driver uses the mux ACK feature, but the actual wait for the host command ACK is a part of the usb_mux general code. Generalize this mux ACK wait so it's available if needed in the future for more muxes. Additionally, moving this wait out of the mux set will allow us to lock the muxes intelligently between tasks, without keeping the muxes locked during the inactive ACK wait. BRANCH=None BUG=b:172222942,b:186777984 TEST=tast typec.Mode*.manual on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I61a043425a482cc6f3170548c888d91ec20c2a82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078411 Reviewed-by: Keith Short <keithshort@chromium.org>
* util: Add strcspnRob Barnes2021-08-091-0/+6
| | | | | | | | | | | | | | | Add the standard string function strcspn. strcspn calculates the length of the initial segment of s which consists entirely of bytes not in reject. BUG=None TEST=make run-utils_str BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I3eb9a4fff42cb0fdcdb288d00f8070e0f22b2179 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3057730 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* mchp: Optimize spi_flash_read() APImartin yan2021-08-061-0/+6
| | | | | | | | | | | | | | | | | | Optimize SPI flash read timing, MEC172x QMSPI controller controls CS# by hardware, it will add several system clock cycles delay between CS deassertion to CS assertion at the start of the next transaction, this guarantees SPI back to back transactions, so 1ms delay can be removed to optimze timing. BUG=none BRANCH=none TEST=Tested on ADL RVP and MCHP1727 MECC system via FAFT ECBootTime job save 720ms as EC performs 180KB RW code's SHA256 hash computation Signed-off-by: martin yan <martin.yan@microchip.corp-partner.google.com> Change-Id: I5cf9c668efb1cd008b91cdd8aa09f7351c017af0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3074767 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* DP/TBT/USB4: Retimer WA resolved Brya TBT lane bonding issue in AP modemadhusudanarao amara2021-08-061-0/+12
| | | | | | | | | | | | | | | | | In AP Mode DP exit to TBT entry is causing TBT lane bonding issue. Issue is not seen by calling the retimer reset as WA at the time of disconnect mode configuration. Revert this patch after getting the actual fix. BUG=b:193402306 BRANCH=None TEST=Checked TBT enumeration in AP Mode TOREVERT=b:195375738 Signed-off-by: madhusudanarao amara <madhusudanarao.amara@intel.corp-partner.google.com> Change-Id: Ia22e061a863940b2a13ad5a38f4fe130737c5c20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3058157 Reviewed-by: Keith Short <keithshort@chromium.org>
* lid_angle: Create a common callback for lid angle changesWai-Hong Tam2021-08-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | Each board defines its own callback lid_angle_peripheral_enable(). The implementation is very similar. Create a common implementation and reduce the duplicated code. This CL removes the board callbacks which are identifical to the common callback. If it is slightly different, keep it and add the __override tag. The check of TEST_BUILD is unnecessary as the board callback is not linked in the test build. BRANCH=None BUG=b:194922043 TEST=Build all the images. Change-Id: I73d381730f35b80eff69399cdfc5fb54f839aee0 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069175 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* COIL: Change host interface option to CONFIG_HOSTCMD_SHIKeith Short2021-08-031-2/+3
| | | | | | | | | | | | | | Update SPI host interface config option for inclusive language. BUG=b:163885307 BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I808d5960fa3e746626465bedc626a95e0f0aaa3f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3066271 Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* tcpm/rt1718s: implement software workaroundTing Shen2021-08-031-0/+1
| | | | | | | | | | | | | | | | Implement the software workarounds suggested by Richtek. See issue link for details. BUG=b:194982205 TEST=On Cherry & Tomato, manually verify PD works BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I7d9c6c5fd3c9266f27e52c1756a7ecedc75f1846 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2848280 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* ps8xxx: patch ps8805 A3 chip Device IDSue Chen2021-08-031-0/+6
| | | | | | | | | | | | | | | | | Add config option for the ps8805 to override the TCPCI Device ID field based on the page 0 register 0x62 bit 7-4. A2 chip: reg 0x62 bit7-4 = 0x0 A3 chip: reg 0x62 bit7-4 = 0xA BUG=b:193099851 BRANCH=trogdor TEST=ectool pdchipinfo can show overridden DID for both A2 and A3 chip on Lazor DUTs Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I99767c92a97c2fcefd3bbe03e3cd2b90de192ff3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3056225 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* common/keyboard_vivaldi: Add new top row action keyScott Chao2021-08-032-0/+4
| | | | | | | | | | | | | | Use codeset 1 e01b(make)/ e09b(break) for MICMUTE. Use codeset 1 e01e(make)/ e09e(break) for KBBL toggle. BUG=b:194146863 BRANCH=none TEST=make -j BOARD=gimble Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: Ide0873c32236ead87d661e36b5f9b20cfd78144b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3060242 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* COIL: I2C: Update terminologyCaveh Jalali2021-08-024-5/+5
| | | | | | | | | | | BRANCH=none BUG=b:163885307 TEST=compare_build.sh matches Change-Id: I7c1acf52cc530b5970755593c0488945c386adc7 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3060266 Reviewed-by: Boris Mittelberg <bmbm@google.com>
* COIL: onewire: Update terminologyCaveh Jalali2021-08-021-1/+1
| | | | | | | | | | | | BRANCH=none BUG=b:163885307 TEST=compare_build.sh matches Change-Id: Ie9547c450c63390f0b1e80bcb2fa75e5e748e215 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3060264 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* COIL: SPI: Update terminologyCaveh Jalali2021-08-011-1/+1
| | | | | | | | | | | BRANCH=none BUG=b:181607131 TEST=compare_build.sh matches Change-Id: Iffe3276d54ee1431d1712b7a071883a99c604a19 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3060263 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* config: Delete obsolete configsKeith Short2021-07-301-6/+0
| | | | | | | | | | | | | | | | | | | | | Delete the following configs which are no longer referenced by any source files: CONFIG_CMD_FLASH_LOG CONFIG_CMD_GSV CONFIG_CMD_GSV CONFIG_CMD_LID_ANGLE CONFIG_CMD_PMU CONFIG_CMD_USBMUX BUG=none BRANCH=none TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ia304f0579d991a0fccc7bbc7ca7427fe0ed661a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3061902 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cbi: Add CONFIG_EEPROM_CBI_WPAseda Aboagye2021-07-292-2/+32
| | | | | | | | | | | | | | | | | | | | | This commit adds the config option, CONFIG_EEPROM_CBI_WP. It is to be defined when the EC directly controls the CBI EEPROM WP signal. The EC will set the WP according to the result of `system_is_locked()`. Note that once the WP is set, the EC must be reset via EC_RST_ODL in order for the WP to become unset. This is enabled by the accompanying hardware. BUG=b:181769483 BRANCH=None TEST=`make -j buildall` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: If490594ab4dd24af98119b01299215b997913b66 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3046412 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* keyboard_scan: Add consts needed for factory test to headerRob Barnes2021-07-281-0/+10
| | | | | | | | | | | | | | | | | Add keyboard_factory_scan_pins and keyboard_factory_scan_pins_used to keyboard_scan header so they do not need to be declared as extern by individual boards. These constants need to be defined if CONFIG_KEYBOARD_FACTORY_TEST is enabled. BUG=None TEST=Build BRANCH=None Change-Id: I1a100f626b3cea251ca72703d17b2d27db0f8f28 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3053101 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* keyboard: Add strict debouncerDaisuke Nojiri2021-07-281-0/+15
| | | | | | | | | | | | | | | | | This CL adds CONFIG_KEYBOARD_STRICT_DEBOUNCE. It makes the keyboard debouncer register a key stroke after deounce is done. This CL also adds a unit test. BUG=b:193505909 BRANCH=Dedede TEST=make run-kb_scan_strict TEST=Blipper Change-Id: Ia380657021035930afab5cafffa8cc2edd7ff475 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044405 Reviewed-by: Jett Rink <jettrink@chromium.org>
* common: led_onoff_states: Add missing extern declarationsScott Chao2021-07-281-0/+3
| | | | | | | | | | | | | Add led_charge_lvl_1 and led_charge_lvl_2 in led_onoff_states.h BUG=none BRANCH=none TEST=make buildall Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: I948f7f8a18409dd210551a92415fcc3d7af8b9a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3058154 Reviewed-by: caveh jalali <caveh@chromium.org>
* zephyr: Add TCS3400 emulatorTomasz Michalec2021-07-271-0/+122
| | | | | | | | | | | | | | | | | | Add TCS3400 emulator which is emulated device on i2c bus. Emulator properties can be defined using device tree or runtime TCS emulator API. It allows to set custom handlers for write and read messages. Emulator is able to convert internal values to register values that can be obtained by driver through i2c interface. Conversion takes current state set by driver into account (gain and data acquisition time). BUG=b:184856080 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I16f25de43e047df39f84ce86044736d50c9a49c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3048094 Reviewed-by: Simon Glass <sjg@chromium.org>
* TCPMv2: Allow tests to clear PE data between runsDiana Z2021-07-271-0/+9
| | | | | | | | | | | | | | The PE stores internal state (ex. capabilities, identity responses) which should be cleared out between unit test runs. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I77b3faefd3f887a68ca9593a7398ae9c3ffb2f17 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3025864 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* primus: add LED behaviorTerry Chen2021-07-271-0/+3
| | | | | | | | | | | | BUG=b:190637023 BRANCH=None TEST=make -j BOARD=primus Signed-off-by: Terry Chen <terry_chen@wistron.corp-partner.google.com> Change-Id: Ifea88e2da7e5db53d9bb561426432ff74153b88d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2944521 Tested-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-by: caveh jalali <caveh@chromium.org>
* tablet_mode: Fix the race condition of setting the tablet modeWai-Hong Tam2021-07-231-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | There are 2 tablet mode triggers: * Lid: when the lid angle close to 360 degree, either detected by a GMR sensor or by the angle computed by 2 motion sensors. * Base: when the detachable base is detached. These 2 triggers set the tablet mode status, which as a boolean, resulting a race condition. This CL fixes the race condition. Each trigger updates its own bit. The final tablet mode status is the OR of all bits. BRANCH=Trogdor BUG=b:193873098 TEST=Attached the base, checked tablet_mode enabled; detached the base, checked tablet_mode disabled; flip base to 360 degree, checked tablet_mode disabled; move the base out of the lid, checked tablet_mode disabled. Change-Id: Ia9d9d2d66c194796c1039cc8b746c8d1f28a4496 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044414 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* keyboard: Use __override for keyboard_scan_configDaisuke Nojiri2021-07-232-7/+1
| | | | | | | | | | | | | | | | | Currently keyboard_scan_config is defined by each board using CONFIG_KEYBOARD_BOARD_CONFIG. This patch makes it defined as __override hence removes CONFIG_KEYBOARD_BOARD_CONFIG. BUG=None BRANCH=None TEST=buildall Change-Id: I53a356741ba4d00e829ca59b74ee6dc704188728 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044403 Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* zephyr: i2c: protect physical portDino Li2021-07-221-0/+14
| | | | | | | | | | | | | | | | | | If i2c devices are connected to the same port, they should use the same mutex_lock() index. So the new transaction won't break the ongoing transaction. BRANCH=none BUG=b:189855648 TEST=Enable CONFIG_SMBUS_PEC and voltage regulator function on asurada. No i2c transaction is broken. Change-Id: Ib848e3c2e60b99ce66ad5fd2fc7095f90820a15d Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3010920 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* retimer: clear unused mux bitsli feng2021-07-191-0/+7
| | | | | | | | | | | | | | | | | | | | During retimer firmware update, EC passes mux value to Coreboot/kernel. Coreboot/kernel checks mux value to know if PD port is NDA, or if port connection is set to what retimer firmware update sequence expects. Some bits of mux value are not used by Coreboot/kernel. This patch clears unused bits; and keeps alternate mode bits and safe mode bit in the mux value. BUG=none BRANCH=none TEST=On ADL RVP, verified NDA port retimer firmware update working. TEST=On Voxel DVT, verified NDA port retimer firmware update working with both Chromium solution and upstream solution. Signed-off-by: li feng <li1.feng@intel.com> Change-Id: I1becc09a0f5c5d4e1fb845c5fe33fa748d44bd4f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3010482 Reviewed-by: Keith Short <keithshort@chromium.org>
* ALT-DP: Don't send DP_ATTENTION until after DP_CONFIGScott Collyer2021-07-171-0/+7
| | | | | | | | | | | | | | | | | | | | | | | This CL adds a new variable to the hpd state that enables the pd policy layer to inform the hpd->DP_ATTENTION converter that at least one DP_CONFIG message has been received. This control is used to make sure that DP_ATTENTION messages aren't sent prior the DFP_D being configured for DP port mode. Some port partners may get confused if DP_ATTENTION is sent prior to either DP_CONFIG or DP_STATUS. BRANCH=quiche BUG=b:192051705 TEST=verifed on kasumi (grunt) that the display is extended correctly following usbc hotplug events. Previously, this case was failing 1 out of 3-4 times. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I80d576de7fc0075be2b1a838d1ed764ae7828e8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3035785 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* chgstv2: Move battery validate code to battery.cDaisuke Nojiri2021-07-151-0/+2
| | | | | | | | | | | | | | This patch moves the code validating battery parameters to battery.c. There is no functionality change. BUG=None BRANCH=None TEST=buildall Change-Id: I1706c4b504565b52964391077894665b4e5d1a86 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3007375 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fuel Gauge: Add interface for optional sleep supportDiana Z2021-07-141-0/+15
| | | | | | | | | | | | | | | Some fuel gauges may support a "sleep" mode which will enable lower power consumption in some states. Set up a structure for this along with an API which boards may use to call it. BRANCH=None BUG=b:186774653 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I155702bfb50a7353c7728445d60ecf853e39e4c2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2967037 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: bmi160: bmi260: Minor driver fixesTomasz Michalec2021-07-141-4/+4
| | | | | | | | | | | | | | | | | | | Fix three issues with BMI160 and BMI260 drivers: - get/set acclerometer/gyroscope offset will return error on failed read of offset register - BMI160 calibration function returns error when setting range fail - Invalid temperature is properly recognized by driver BUG=none BRANCH=none TEST=run zmake drivers test Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I545c0a931227ef7efc000ec97c1f6297a48e6d1a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3027039 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add BMI260 emulatorTomasz Michalec2021-07-141-0/+4
| | | | | | | | | | | | | | Add extension to support BMI260 model. BUG=b:184856157 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Iaffebdb5279001d085fd56868e81318528380380 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2997364 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: Add BMI160 emulatorTomasz Michalec2021-07-144-0/+1184
| | | | | | | | | | | | | | | | | | | | | Add BMI emulator which is emulated device on i2c bus. Emulated accelerometer and gyroscope properties are defined through device tree, but they can be changed in runtime through BMI emulator API. It allows to set custom handlers for write and read messages to emulate more complex scenarios or malfunctioning device. BMI emulator is designed to implement support for different BMI models as an extension to common emulator code. BUG=b:184856157 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I63e9d3aca98c8923372437f7a66257a4c82817f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2977559 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* cbi: Introduce CONFIG_CBI_GPIOPhilip Chen2021-07-142-0/+19
| | | | | | | | | | | | | | | | | | | For the boards where SKU_ID/BRD_ID comes from the strapping pins on EC, this new config enables AP to ask EC for those hardware configs using the CBI host command `EC_CMD_GET_CROS_BOARD_INFO`. BRANCH=None BUG=b:186264627 TEST=make buildall -j TEST=Enabled CONFIG_CBI_GPIO for lazor and manually verified with `ectool cbi get`. Change-Id: I7ec9097bab96d2076d9d42db2d003460db000113 Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3002452 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* TCPC: add flag to disable debug accessory controlBoris Mittelberg2021-07-131-0/+2
| | | | | | | | | | | | | | | | | The NCT38xx TCPC takes over the GPIO we otherwise use to control the Burnside Bridge on Brya P1 devices. To get the BB out of reset we add the flag to tcpc_config structure to take the control back to TCPM. BRANCH=none BUG=b:191516281 TEST=running deployment in the lab; running FAFT PD test Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: I73ddf26964cc6363640ddd80fbcbf353704d3198 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3016406 Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* qcom: Deprecate AP_RST_REQ in SC7280Wai-Hong Tam2021-07-131-0/+2
| | | | | | | | | | | | | | | Add guards to deprecate the AP_RST_REQ power signal. The AP_RST_REQ is power signal only valid in SC7180. BRANCH=None BUG=b:187980397, b:148246695 TEST=Built all the Chromium EC images and Zephyr EC images. TEST=Modify a board to use the SC7280 CONFIG. Change-Id: I0b12889dd2549665d2c2d6bfc06fddd9b9357175 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2993210 Reviewed-by: Keith Short <keithshort@chromium.org>
* system: Generalize system_get_board_version()Philip Chen2021-07-121-0/+5
| | | | | | | | | | | | | | | | | | Extend system_get_board_version() to support not only AP-sourced SKU ID but also EC-sourced SKU ID, whose getter function can be customized per board. BRANCH=None BUG=b:186264627 TEST=make buildall -j TEST=zmake testall Change-Id: I764868d6472fb66480a43d028e5a79933b10117d Signed-off-by: Philip Chen <philipchen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3017602 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* zephyr: add InvenSense sensorsKeith Short2021-07-121-0/+1
| | | | | | | | | | | | | | | | Add Kconfig options for the InvenSense sensor drivers ICM426xx and ICM42607. This also creates config option for CONFIG_ACCELGYRO_ICM42607 which was missed when the driver was first created (CL:2822268). BUG=b:193195946 BRANCH=none TEST=zmake testall TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I422071e749ee2e8ed3ac1997aa886ee78395d37e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015867 Reviewed-by: Denis Brockus <dbrockus@chromium.org>