summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* TCPMv2: Store and report sink capsDiana Z2020-11-201-0/+14
| | | | | | | | | | | | | | | | | | | | | Copy sink caps for later reference, and report them up to the AP in the TYPEC_STATUS host command return. This also moves the location of the DPM set for sink caps, to be symmetrical between source and sink inits. Set the old unit tests to clear all DPM requests. New PE tests will correctly handle our startup sequence, but the old tests may have erratic behavior based on how many states run before the connection is forced over to READY. BRANCH=None BUG=b:160009733,b:168862110 TEST=on drawcia, verify sink capabilities match those from PD traces with several docks and dongles Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Iadc6ef4c7364d7c709878a75fd5e707a965f77f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2540390 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* TCPMv2: Replace charging allow listDiana Z2020-11-201-0/+6
| | | | | | | | | | | | | | | | | | | Replace the charging allow list with a check to verify whether the partner can provide at least 27W to the DUT. This should cover existing members of the allow list, and deprecate the need to continue adding to this list. BRANCH=None BUG=b:173070679 TEST=on drawcia, verify DUT can charge from power bank, Apple 3-in-1, and servo_v4 Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Id0b516782809b6912602e9b7ab0546938e0b85ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2535217 Tested-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: rename gpio_signal.h so that we have deterministic includesJack Rosenthal2020-11-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per go/zephyr-shim-how-to, the headers under zephyr/shim/include/ need to be distinct names from those under include/, as the C compiler has no defined ordering to searching the include paths. (i.e., there is no such thing as a "header override"). Make include/gpio_shim.h include zephyr_gpio_shim.h instead, and rename the zephyr header accordingly. Without this, occasionally you can get this: In file included from include/gpio_signal.h:26, from include/espi.h:11, from zephyr/shim/src/espi.c:14: include/gpio.wrap:36:2: error: #error "Your architecture must ... 36 | #error "Your architecture must define GPIO_PIN and it did not." | ^~~~~ include/gpio.wrap:40:2: error: #error "Your architecture must ... 40 | #error "Your architecture must define GPIO_PIN_MASK and it did not." | ^~~~~ include/gpio.wrap:246:10: fatal error: gpio.inc: No such file or directory 246 | #include "gpio.inc" | ^~~~~~~~~~ compilation terminated. BUG=b:173031377 BRANCH=none TEST=compile for volteer and posix-ec Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I0eb23c41ee5c2be4f0405d3fadb71d6422d0ff40 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548303 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* common: Add EC_SUCCESS_IN_PROGRESS to enum ec_error_listDaisuke Nojiri2020-11-191-0/+3
| | | | | | | | | | | | | | EC_SUCCESS_IN_PROGRESS can be returned to indicate the operation was successful but the completion is pending. BUG=b:173235954 BRANCH=Trogdor TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I6f7816f190938aaefa4e02ed8f36edac7dcf2faf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2538538 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* power: allow eSPI virtual wires without eSPI host commands for zephyrJack Rosenthal2020-11-191-1/+6
| | | | | | | | | | | | | | | | | | | For Zephyr OS, we want to get eSPI up and going for power sequencing without having to bring in all of the host command dependencies. Right now the power sequencing code assumes that if we are using eSPI for host commands, that means we might have eSPI virtual wires too. Instead, use the separate option CONFIG_HOST_ESPI_VW_POWER_SIGNAL, which is what we actually want, and allow that to be defined without CONFIG_HOSTCMD_ESPI. BUG=b:171312361 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I2f56ef3ab9cc566f5e0e3926fea96484daa93236 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2548302 Reviewed-by: Yuval Peress <peress@chromium.org>
* extpower: replace header with forward declCaveh Jalali2020-11-191-1/+1
| | | | | | | | | | | | | this replaces the inclusion of "common.h" in favor of a forward declaration for enum gpio_signal. BRANCH=none BUG=none TEST=buildall Change-Id: I3ca832c1bec3bea6d38b1955e101fcab841d1b6a Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546801
* ioexpander: forward declare ioex_signalCaveh Jalali2020-11-191-0/+2
| | | | | | | | | | | | | this adds a forward declaration for enum ioex_signal so it can safely be used in declaring function prototypes. BRANCH=none BUG=none TEST=buildall Change-Id: I51127099151580961bc176bad1bcd5b11a705a85 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546800
* TCPC: Change SOP' disable interfaceDiana Z2020-11-181-3/+5
| | | | | | | | | | | | | | | Add the ability to enable or disable SOP' traffic through a new parameter. Name the function for "enable" to match other EC conventions. BRANCH=None BUG=b:168560801 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ife52e7d7d098825ab2163c70a4c59510da958876 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2542864 Reviewed-by: Keith Short <keithshort@chromium.org>
* berknip: update tusb544 eq settingZick Wei2020-11-181-0/+3
| | | | | | | | | | | | | | This patch update tusb544 eq setting for berknip. BUG=b:170708727, b:170708972 BRANCH=zork TEST=verify USB type C 3.0 RX , DP eq can pass, make buildall. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ief018e02090f5bc409a57a93da86f9ff095773aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2467602 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* keyboard_mkbp: Add a virtual switch EC_MKBP_FRONT_PROXIMITYWai-Hong Tam2020-11-182-0/+7
| | | | | | | | | | | | | | | Add a new virtual switch to indicate whether a nearby object is present in front of the device. The implementation will be added later. BRANCH=None BUG=b:168714440 TEST=Built the image correctly. Change-Id: I4cc71a35d8aac391719a5966ec2d57a5bb1d4761 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2543111 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* SM5803: Add overcurrent reportingDiana Z2020-11-181-1/+2
| | | | | | | | | | | | | | | | | | Report overcurrent on OTG failure interrupt. Note that this may manifest with no discharge status, or with a Vbus short discharge status. BRANCH=None BUG=b:171501161 TEST=on drawcia, connect a USB load and observe the port is shut off after too many overcurrent events, but another port partner plugged in will receive Vbus and Vconn. Observe that connecting a reasonable load of less than 1.5A can succeed after a single OTG failure. Observe sourcing out to several dongles works normally. Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I72162b32c5bacd34be599abc260b0d4156c764a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532677 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* tcpc: Cleanup usage of tcpci_set_role_ctrl()Keith Short2020-11-181-0/+6
| | | | | | | | | | | | | | Cleanup arguments for tcpci_set_role_ctrl(). BUG=b:171430855 BRANCH=firmware-volteer-13521.B-master TEST=make buildall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib58defb5f9bcd3c3fe3d7de4239aa19e5545b778 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2544802 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* i2c_master: extend i2c_xfer_no_retry to also support large writestabilize-13605.B-masterTing Shen2020-11-172-8/+8
| | | | | | | | | | | | | | | | | This CL extends CONFIG_I2C_XFER_LARGE_READ to also support large (greater than 255 bytes) write. Related config name is also updated to reflect the behavior change, BUG=b:169651794 TEST=flash fw successfully on Zed. BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Icb889013da01f48708cd0227207561b8186bac63 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2537412 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* TCPM: Add OCP moduleDiana Z2020-11-173-44/+67
| | | | | | | | | | | | | | | | | | | | Currently, the overcurrent protection is tracked in the PPC code. However, as different chips are able to report overcurrent move this code into a generic module. Logic for not sourcing Vbus or Vconn on latched ports moves into the TC layer, and an overridable board overcurrent function is provided for boards which have no special actions to take. BRANCH=None BUG=b:171501161 TEST=make -j buildall; TCPMv2 tested with following drawcia patch Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I75919e345a5b0bce4a0b67432a13515e7716cf6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532676 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* system: Add EC_REBOOT_COLD_AP_OFF commandPi-Hsun Shih2020-11-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Add EC_REBOOT_COLD_AP_OFF as a command of EC_CMD_REBOOT_EC host command, that would cold reboot EC without booting AP. BUG=chromium:1121907 TEST=With CL:2422025 CL:2459802, echo 1 > /var/lib/power_manager/reset_ec_on_next_shutdown click shutdown on UI and observe that EC is rebooted and AP is still off. TEST=With CL:2422025 CL:2459802, echo 1 > /var/lib/power_manager/reset_ec_on_next_shutdown dbus-send --system --print-reply --dest=org.chromium.PowerManager \ /org/chromium/PowerManager \ org.chromium.PowerManager.RequestRestart \ int32:0 string:test observe that EC is rebooted. Change-Id: Ifccff3831d785091b7c99def0e43a0d20bfc412b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2428361 Commit-Queue: Pi-Hsun Shih <pihsun@chromium.org> Tested-by: Pi-Hsun Shih <pihsun@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: motion_sense: Add spoofing activityChing-Kang Yen2020-11-132-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | make spoof command able to spoof activity state: ectool motionsense spoof -- NUM activity ACT [EN] [0/1] This commit also remove unused parameter |sensor_num| from list_activities, set_activity, get_activity in ectool. BRANCH=None BUG=b:123434029 TEST=buildall TEST=ectool motionsense spoof 4 activity 4 1 0 ectool motionsense spoof 4 activity 4 ectool motionsense get_activity 4 ectool motionsense spoof 4 activity 4 1 1 ectool motionsense get_activity 4 ectool motionsense spoof 4 activity 4 0 ectool motionsense get_activity 4 ectool motionsense spoof 4 activity 4 1 ectool motionsense get_activity 4 Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Change-Id: I819c156ae7fe50c5cf6216d0f44012d192fb528e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2477393 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* crc8: rename crc8 to cros_crc8 to to avoid zephyr conflictJett Rink2020-11-131-3/+4
| | | | | | | | | | | | | | | | | Zephyr already provides a robust implementation for crc8, but it conflicts with platform/ec's name of crc8. Rename platform/ec to use cros_crc8 instead since it is a special case of zephyr crc8 implementation. BRANCH=none BUG=b:168032589 TEST=builds. Just a rename Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I2dc509fe1c1d8c2a4cdec3943b63f29429919137 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532691 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* i2c_master: Add i2cxfer raw commandJan Dabros2020-11-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GL3590 USB3.1 hub has i2c interface, which behaves different from majority of i2c slaves. While write operation is the same, this chip doesn't support repeated-start sequence for reads. New command allows to create i2c frames in a more flexible way. User may specify how many (if any) bytes to write and then how many bytes to read. Since the raw option is for debugging and won't be commonly used, do not include it by default to save space on flash - use #define CONFIG_CMD_I2C_XFER_RAW built with the raw option. For now, it will be defined only for servo_v4p1. BUG=b:150323106 BRANCH=master TEST=buildall. Verify that reading i2c data from non-gl3590 devices is not affected by this change. For usual write16 (0x0201) at offset 0x4 from device 0x24: i2cxfer raw 1 0x24 0 0x4 0x1 0x2. When reading from GL3590 device, two operations will be required: i2cxfer raw 1 0x50 0 0x10 i2cxfer raw 1 0x50 8 Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: Ifd9ee5184490eb8de383c9468b0152e6f993d7c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2505780 Reviewed-by: Brian Nemec <bnemec@chromium.org> Commit-Queue: Brian Nemec <bnemec@chromium.org> Tested-by: Brian Nemec <bnemec@chromium.org>
* motion_sense: Make change in range permanentGwendal Grignou2020-11-122-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | When AP changes range, unlike offset or ODR, it was not surviving init() call. If the sensor is powered off in S3, at resume the range would be back to the default. To make it consistent with other attributes, remember range change until EC powers down. - remove get_range - add current_range to store the range currently used. This is modifiable by the AP - when the AP shutdown, revert current_range to default_range - Remove const attribute for sensor structure when init and set_range is called. BUG=chromium:1083791 BRANCH=none TEST=One eve branch, check range is preserved even after 'shutdown -h 0' Change-Id: Ia7126ac0cc9c3fef60b4464d95d6dd15e64b0fc4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215751 Reviewed-by: Yuval Peress <peress@chromium.org>
* Revert "crc8: rename crc8 to cros_crc8 to to avoid zephyr conflict"Jett Rink2020-11-111-4/+3
| | | | | | | | | | | | | | | Something slipped through CQ coverage. Need to figure out, but in the mean time, revert the 3 CLs that seemed to have caused the issue. BRANCH=none BUG=chromium:1147953 TEST=none This reverts commit befe5a9c78ff4e75db7c5cda801688c8976e95f3. Change-Id: I14e82f33646b6574b1b3da13783143e3a29d417b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2533357
* ec_command: don't assume BUILD_ASSERT is undefinedJett Rink2020-11-111-0/+3
| | | | | | | | | | | | | | | | In the scenario where we are not building from platform/ec, we define BUILD_ASSERT to a no-op. We should only do that if the BUILD_ASSERT macro is undefined; otherwise we should just leave the definition. BRANCH=none BUG=none TEST=build EC and zephyr code without issue Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I6d51106f51217279acb2dcf252ee8ac3383f9959 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532684 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: add strtoull function for 64-bit inputJett Rink2020-11-111-3/+0
| | | | | | | | | | | | | | | We do need a true 64-bit input function for common platform/ec code, and zephyr doesn't have this. Add the support to the shim BRANCH=none BUG=b:172592963,b:172512307 TEST=build EC and volteer and posix_ec Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I81f69fdbe03916f3a54091ce6c077db32ed3a73c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2532679 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* tree: rename strtoul to strtoull since it is 64-bitJett Rink2020-11-111-1/+1
| | | | | | | | | | | | | | | A long is 32-bit, but a long long is 64-bit. The function name should be strtoull if it is returning 64 bits of data. BRANCH=none BUG=b:172592963 TEST=builds Signed-off-by: Jett Rink <jettrink@chromium.org> Change-Id: I04c40f9256ed37eb1cf9b6bd1b0ef0320fe49b0c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2530874 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* crc8: rename crc8 to cros_crc8 to to avoid zephyr conflictJett Rink2020-11-111-3/+4
| | | | | | | | | | | | | | | | | Zephyr already provides a robust implementation for crc8, but it conflicts with platform/ec's name of crc8. Rename platform/ec to use cros_crc8 instead since it is a special case of zephyr crc8 implementation. BRANCH=none BUG=b:168032589 TEST=builds. Just a rename Change-Id: Idf312098cb921c8e10dcb48c5eb297801af2df8a Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2527810 Reviewed-by: Yuval Peress <peress@chromium.org>
* hammer: support vivaldi keyboardTing Shen2020-11-103-9/+12
| | | | | | | | | | | | | | | | | | | | This CL implements vivald function row config for hammer keyboard. If CONFIG_USB_HID_KEYBOARD_VIVALDI defined, STM32 HID keyboard now returns an extra 32-bit data represents the status of action keys. Additionally, if board_vivaldi_keybd_config returns a non-null pointer, driver will convert function keys to action key according to the given config. BUG=b:171156337 TEST=verify keycode is correct in `evtest` BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ide3289fd2c1bb8859a74e97134e6113441cfb967 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2508848 Reviewed-by: Nicolas Boichat <drinkcat@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* Add EC_CMD_BATTERY_GET_STATIC v1 for zorkPeter Marheine2020-11-102-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | Some zork variants have battery model names that differ only beyond the 7th character, which cannot be differentiated with the current limitation of 8 characters per battery string. Introduce a new hostcmd version that allows longer battery strings and enable it on Zork. Because allowing longer strings through the host memory map is more difficult and not required (because getting the full longer string is mostly only useful for servicing), the host memory map is unchanged. ectool is updated to use hostcmd (rather than memory map) if the new command version is available, in order to take advantage of it. BUG=b:171854783 TEST=ectool battery prints longer strings when supported by the EC; a hacked EC on morphius can return 11 characters of text. An EC running older firmware still works with a new ectool. BRANCH=zork Change-Id: I63d20d4f690b6945cb1d423aafaf55dafc039211 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2519243 Reviewed-by: Edward Hill <ecgh@chromium.org>
* Zephyr: add more compliant implementation for irq_(un)lockYuval Peress2020-11-081-9/+23
| | | | | | | | | | | | | | | | | | This change replaces the stubbed irq_(un)lock static functions defined in task.h with new functions that behave more like the Zephyr implementation of irq_(un)lock functions. This should make the migration from interrupt_(dis|en)able to Zephyr more seamless. BRANCH=none BUG=b:172060699 TEST=Added unit tests, make runtests -j, and built for various boards: eve, volteer, arcada_ish, atlas, hatch, kohaku, nocturne, samus, and scarlet Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ia7ad2b8d7d411a11699353bf5d3cc36a261fad14 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511720
* test_util: use ztest only if CONFIG_ZTEST is defined, not CONFIG_ZEPHYRJack Rosenthal2020-11-071-3/+3
| | | | | | | | | | | | | | | This header can be included from shimmed modules for an actual build (not just tests). In that case, CONFIG_ZEPHYR would be defined, but not CONFIG_ZTEST, and headers like ztest.h are not available. BUG=b:172678200 BRANCH=none TEST=compile both host_command.c and hooks test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I24c704f6288eac9a8ca53580ec00e43073a6fef0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522968 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* zephyr: move shimmed_tasks.h include to config.hJack Rosenthal2020-11-071-0/+9
| | | | | | | | | | | | | | | | | Unfortunately, many things in config.h rely on HAS_TASK_* to be defined before we start processing config.h. Move this include a little sooner so we have it then. BUG=b:172678200 BRANCH=none TEST=compiles with host_command.c added Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I791426b78777997748eff2c91210b8a426d9a8ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2522970 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: cleanup unused _ZEPHYR_WARN_UNIMPLEMENTED macroJack Rosenthal2020-11-071-11/+0
| | | | | | | | | | | | | | Tasks are implemented now, so this can go away. BUG=b:171741620 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I0ce8d680d80eb2ac1bfa3f9ca31143f7f8924af4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2523386 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Revert "topology: Add USB2 & USB3 connectivity info to tcpc_config_t"caveh jalali2020-11-062-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f5121aa5b762a68e9e2bca3c4c132cb2ffc9cfdb. Reason for revert: feature no longer used BRANCH=none BUG=b:153941950 TEST=buildall passes Original change's description: > topology: Add USB2 & USB3 connectivity info to tcpc_config_t > > Intel SoC needs which USB2/3 ports are assigned to which Type-C ports. > This patch adds USB2 and USB3 port numbers to tcpc_config_t so that > EC_CMD_LOCATE_CHIP can return it to the host. > > Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> > > BUG=b/134614710 > BRANCH=none > TEST=TBD > > Change-Id: I10206dde4d71ac6e40a71c65333db4edd3c81e7a > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1669880 > Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> > Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > Tested-by: Daisuke Nojiri <dnojiri@chromium.org> > Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org> > Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Bug: b/134614710 Change-Id: Ibd60e7e3d59e11734a3a08917be3daaae7fb569d Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427440 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: Provide parse_bool()Simon Glass2020-11-061-0/+4
| | | | | | | | | | | | | | | | | | Add this function to the shim so it can be used in the keyboard code. Drop strtoul() for now since it has the wrong signature. BUG=b:167405015 BRANCH=none TEST=zmake configure .../zephyr-chrome/projects/experimental/volteer \ -B /tmp/z/cos zmake build /tmp/z/cos See there are no errors Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I694369feb192cf49addb7444908b89b6081bffa1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521360 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* TCPMv2: Add support for linear re-driver cablesAyushee2020-11-061-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The linear re-driver cables enumerate as passive cables in the Discover mode SOP' response from the cable. But they have Active/Passive bit (B25) in the discover mode SOP' response set. Hence, if the cable is LRD, the port enters Thunderbolt mode SOP' before entering USB and it also sets the cable as active in the mux and retimer setting. USB4 PD flow for LRD cables: Is Discover mode SOP' B25? ----- N ----- Enter USB4 SOP with Gen 2 cable speed | y | Enter TBT SOP' | Enter USB4 SOP as per cable speed. TBT PD flow for LRD cables: Is Discover mode SOP' B25? ----- N ----- Enter TBT SOP | y | Enter TBT SOP' | Enter TBT SOP This CL also updates the retimer setting and Enter USB Data object for USB4 according to the type of cable detected (LRD/Active/passive) BUG=b:156749387 BRANCH=None TEST=With Linear re-driver cable, 1. Able to enter USB4 mode 2. Able to enter Thunderbolt mode 3. Able to exit and re-enter USB4 on reboot 4. Able to exit and re-enter Thunderbolt mode on reboot Change-Id: Ie5258f792e13a205dea71fc9f06b1d8987ec9194 Signed-off-by: Ayushee <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2470209 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* common: motion: add IF_ENABLED()Gwendal Grignou2020-11-063-8/+25
| | | | | | | | | | | | | | | Split some defines when necessary, add IF_ENABLED to common/motion_sense.c. Find small setting errors in some boards along the way. BUG=chromium:1140877 BRANCH=none TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I77ff528a16809088a986a2cc707aff8ae7df3906 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2488939 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
* motion: Use empty CONFIG_ variable to use IS_ENABLED()Gwendal Grignou2020-11-062-12/+23
| | | | | | | | | | | | | | | | Split information in a boolean variable and another variable that contains a property. For instance, CONFIG_GESTURE_SENSOR_DOUBLE_TAP becomes: CONFIG_GESTURE_SENSOR_DOUBLE_TAP : boolean variable CONFIG_GESTURE_TAP_SENSOR : property that contains the sensor number. BUG=chromium:1140877 BRANCH=none TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I27ba462f8a12b14882104b9f983f2dc17f917314 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2488937
* motion: orientation: update interfaceGwendal Grignou2020-11-063-8/+26
| | | | | | | | | | | | | | Enabling orientation sensor would not compile anymore. Fix interface by replacing macros with functions. BUG=chromium:718919 BRANCH=none TEST=Compile when enabled on grunt and eve. Change-Id: Ic5d6992d040cde79ef3f691db494804e160b7650 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2491266 Reviewed-by: Ching-Kang Yen <chingkang@chromium.org>
* zephyr: shim in hooks and deferredJack Rosenthal2020-11-051-7/+30
| | | | | | | | | | | | | | | | | | | | | | Implement deferred calls using the Zephyr's delayed work queues. Implement hooks using SYS_INIT and a hooks registry created during init. BUG=b:168030971 BRANCH=none TEST=provided unit tests Build instructions for unit tests: zmake configure -B/tmp/test \ ~/trunk/src/platform/ec/zephyr/test/hooks zmake build /tmp/test Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id019cd1fe7bb3354377773d171036767e7efa706 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504489 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* TCPMv2: Correct battery index detectionDiana Z2020-11-051-1/+11
| | | | | | | | | | | | | | | | | | The battery index is located in the first byte after the extended header, which is not passed up to the PE layer. Additionally, the PRL will start copying the message from byte 0 so correct the extended message population. Add condition to fill in a valid response if the battery is not currently present, and correct the battery status response initialization. BRANCH=None BUG=b:161837550 TEST=with GRL-C2, invalid battery index tests pass Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I65ebe56f197b9822a42463f8d9dfb42b34c1ffe1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357517 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zephyr: add task shimJett Rink2020-11-052-20/+7
| | | | | | | | | | | | | | | | Provide shim/translation layer for converting platform/ec tasks into zephyr threads. Provide implementation API for platform/ec task_ API BRANCH=none BUG=b:171741620 TEST=unit test provided TEST=clean_build.sh ~/chromiumos/src/platform/ec/zephyr/tests/tasks && ../build/zephyr/zephyr.elf Change-Id: Ia2a1f808ec56a89c2a08df9de318edb1b6e9f869 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518665 Reviewed-by: Simon Glass <sjg@chromium.org>
* ec_commands: unify comments from kernel ec_commandGwendal Grignou2020-11-051-6/+1
| | | | | | | | | | | | | | | | Merge changes from crrev.com/c/2044498 into ec code base. Fixes a8b2362e82e1 ("TCPMv1: Cleanup sending TBT control flags to host") Fixes 340804c765a2 ("usb_pd: Sending Thunderbolts-compatible host notification") BUG=b:147460168,b:148114593,b:140644242 BRANCH=none TEST=Compile Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I0a08c21d375d055eb010a6752807d82f5e8e0003 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2520296 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* BB retimer: Update USB4 related bitsAyushee2020-11-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | This CL updates the following bits: Bit 4: USB3 bit - If active cable V3, according to Discover Idenitity SOP response, Product VDO 2 B5. else set to 1 Bit 16: Thunderbolt support - According to B3:B5 of Discover Identity SOP response. Bit 19: VPro Support - If host is vPro capable and according to Discover Mode SOP response B26/B31. This CL also updates the thunderbolt related bits for the retimer if the thunderbolt mode SOP' and SOP'' is entered. BUG=b:156749387 BRANCH=None TEST=Able to update the retimer bits on entering USB4 mode Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: Ic083001dee73d854379f1f3dfd85bebe5ee6ef5d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2473597 Reviewed-by: Keith Short <keithshort@chromium.org>
* TCPMv2: Add support for USB4 active cableAyushee2020-11-054-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | USB4 PD flow for active cables: Structured VDM version (cable revision)-- <2.0 -------->| | | >=2.0 | | | VDO version---- <1.3 -------> Modal op? -- N --| (B21:23 of | | Discover ID SOP'- y | Active cable VDO1) | | | TBT SVID? -- N --| >=1.3 | | | y | Cable USB4 support? - N | | | | Gen4 cable? - N - Skip USB4 mode entry y Skip USB4 | | mode entry | Enter USB4 y (SOP',SOP'',SOP) | | |<---- NAK ----- Enter mode TBT SOP'<---| | | | | ACK | | | | |<---- NAK ----- Enter mode TBT SOP'' | | | | Exit TBT mode SOP ACK | | | | ACK/NAK Enter USB4 mode | | SOP | Exit TBT mode SOP'' | | | ACK/NAK | | | Exit TBT mode SOP' | | | ACK/NAK | | | |--------Retry done? ---- N ------------| | y | Skip USB4 mode entry The CL also checks if the port is VCONN source before sending Enter USB SOP' and SOP'' messages and requests for a vconn swap is it isn't In case of reboot, the port sends exit Thunderbolt mode SOP' and SOP'' and skips sending exit Thunderbolt mode for SOP, since it didn't enter Thunderbolt mode SOP prior to reboot. Note: 1. This is only applicable when the port enters USB4 mode SOP and Thunderbolt mode with the cable plug. 2. It is a temporary behaviour until data reset feature is in place (b/141363146) BUG=b:156749387 BRANCH=None TEST=1.Able to enter into USB4 with active cable. 2.Able to exit Thunderbolt mode SOP' and SOP'' on reboot and re-enter into USB4 mode with active cable. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: I828c7ca0fd9b7b1025f13bcc86c511692b9f9895 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432868 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* COIL: Rename CONFIG_I2C_PERIPHERALDiana Z2020-11-051-2/+2
| | | | | | | | | | | | | Rename CONFIG_I2C_PERIPHERAL and related comments. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I3f148e976f3a4d6a1dc6c58686368c056290d5d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518660 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* COIL: Rename CONFIG_I2C_CONTROLLERDiana Z2020-11-052-3/+3
| | | | | | | | | | | | | Rename CONFIG_I2C_CONTROLLER and related comments. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ied6a1829bf54a5c9a32e6772982a4b8aa31aaf23 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518659 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* COIL: Rename CONFIG_BOARD_I2C_ADDR_FLAGSDiana Z2020-11-051-2/+2
| | | | | | | | | | | | | Rename CONFIG_BOARD_I2C_ADDR_FLAGS and related comments. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I45d4945b5c1fa26c72d233fb9def4d9bdee1c9c9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2518657 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* zephyr: punt implementing some task functionsJack Rosenthal2020-11-031-0/+21
| | | | | | | | | | | | | | | | This makes it so that we have to ifdef out less tasks code when shimming, adding runtime warnings about the code we are skipping. BUG=b:171741620 BRANCH=none TEST=compile power sequencing code, observe warnings Change-Id: I5e6686d00c04654afe458eef2690d8f6c5bd6639 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2503787 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Replace I2C_GET_ADDR with I2C_STRIP_FLAGSYuval Peress2020-11-023-6/+3
| | | | | | | | | | | | | | | | | The new I2C_STRIP_FLAGS macro was added to avoid conflict with Zephyr's macro. This CL performs the migration to that new API. BRANCH=none BUG=b:172067439 TEST=make runtests -j and built for various boards: eve, volteer, arcada_ish, atlas, hatch, kohaku, nocturne, samus, and scarlet Change-Id: I0583b647435db96ec268f186252b367bdc4118a6 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511097 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* System: shutdown chipset before enter hibernateSue Chen2020-11-021-0/+5
| | | | | | | | | | | | | | | | | Pressing Alt + h + Volume Up cannot enter hibernate on lazor. The DUT would boot up immediately. To ensure the KB hibernate successfully, the AP needs fully shutdown before hibernating. BUG=b:171731177 BRANCH=none TEST=Pressing Alt+h+VolumeUp can enter hibernate in S0, and can wake up by plugging AC, pressing power button. make buildall -j2 Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I3c09c0d339ebbaab33635a283fd57bac61ebf08f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2497371 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* COIL: Rename SLEEP_MASK_I2C_PERIPHERALDiana Z2020-10-311-1/+1
| | | | | | | | | | | | | Rename SLEEP_MASK_I2C_PERIPHERAL and related comments. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Idaeefda102c603a38f128d820ed1f647069eaeea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511094 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* COIL: Rename CONFIG_HOSTCMD_I2C_ADDR_FLAGSDiana Z2020-10-311-2/+2
| | | | | | | | | | | | | Rename for CONFIG_HOSTCMD_I2C_ADDR_FLAGS and surrounding comments. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I49dc12753957da7baa1bb387e212d75c75e81d86 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511093 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>