summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cherry: code cleanupstabilize-rust-14220.B-mainTing Shen2021-09-144-121/+0
| | | | | | | | | | | | | | | | | | | | | 1) remove board_overcurrent_event since CL:2532676 added a default empty implementation 2) remove GPIO_EN_KB_BL control since it's already handled in keyboard_backlight.c 3) remove unused header includes 4) remove unused it5205 sbu handler BUG=none TEST=make BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I0231ba6c6bf16fa0fc1bf52fd77815271e79dcbb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3160456 Tested-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Rong Chang <rongchang@chromium.org>
* system: Add CrOS FWID to version outputRob Barnes2021-09-1416-70/+367
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EC version does not follow the the AP and OS version. This causes confusion during development. This change augments the EC version output to include the CrOS FWID when available. The CrOS FWID will be missing when the CrOS EC is built outside of cros_sdk. When CrOS FWID is missing 'CROS_FWID_MISSING' will be used. Zephyr/zmake support will be added later, CROS_FWID32 is set to 'CROS_FWID_MISSING' in zephyr builds until then. BUG=b:188073399 TEST=version 21-05-20 16:43:18.627 Chip: Nuvoton NPCX993F A.00160101 21-05-20 16:43:18.631 Board: 1 21-05-20 16:43:18.631 RO: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.634 guybrush_13983.0.21_05_20 21-05-20 16:43:18.639 RW_A: * guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.641 * guybrush_13983.0.21_05_20 21-05-20 16:43:18.644 RW_B: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.644 guybrush_13983.0.21_05_20 21-05-20 16:43:18.647 Build: guybrush_v2.0.8770+f47439f75 21-05-20 16:43:18.651 guybrush_13983.0.21_05_20 2021-05-20 21-05-20 16:43:18.657 16:31:19 robbarnes@robbarnes0 ectool version RO version: guybrush_v2.0.8770+f47439f75 RO cros fwid: guybrush_13983.0.21_05_20 RW version: guybrush_v2.0.8770+f47439f75 RW cros fwid: guybrush_13983.0.21_05_20 Firmware copy: RO Build info: guybrush_v2.0.8770+f47439f75 guybrush_13983.0.21_05_20 2021-05-20 16:31:19 robbarnes@robbarnes0 Tool version: 1.1.9999-f47439f @robbarnes0 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Ief0a0c6e9d35edc72ac2d4780ee203be41d7305f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2894145 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* bugzzy: adjust accel sensor orientationInno.Park2021-09-141-3/+3
| | | | | | | | | | | | | | Adjust rotation matrix for two accel sensors. BUG=b:199695518 TEST=Boot and run 'ectool motionsense' on each position. *left-side, bottom-side and face-up Signed-off-by: Inno.Park <ih.yoo.park@samsung.corp-partner.google.com> Change-Id: I0429853381b93caea43a2b901de2028b4bc89506 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3156317 Reviewed-by: Henry Sun <henrysun@google.com> Commit-Queue: Henry Sun <henrysun@google.com>
* rt1718s: refactor: move gpio control to driver moduleTing Shen2021-09-143-45/+92
| | | | | | | | | | | | | | | | | | | | This CL moves RT1718S gpio control from board file to common driver codebase, and implements the set flag and get/set level functions. Note that this CL does not fully implement IOEX interface because TCPC has different init process than usual ioexpanders. BUG=none TEST=1) pass faft_pd 2) manually test pd source/sink/frs on port 1 BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: If2a0bca2b13ad4748eea54b4c8004da7dc6fc6a5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3159643 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* zephyr: Cleanup I2C initializationKeith Short2021-09-141-6/+8
| | | | | | | | | | | | | | | | Move the I2C initialization to compile time, saving a modest amount of RAM space BUG=b:199328071 BRANCH=none TEST=zmake testall TEST=boot Zephyr on Herobrine. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9d324eedca25666bcce1928b069918a357cf6081 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158973 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: I2C cleanupKeith Short2021-09-141-10/+7
| | | | | | | | | | | | | | | | | | | Zephyr does not use the GPIO based I2C recovery. Delete i2c_get_line_levels() and I2C_CONFIG_GPIO() as these symbols are no longer referenced. Move a the DT_NODE_EXISTS to the top of the file as the named-i2c-ports node is need throughout this file. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I62cec339b448b78d1e9ca150227f604f23af32f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158972 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Yuval Peress <peress@google.com>
* bmi3xx: Fix sensor_num in ec_response_motion_sensor_dataRob Barnes2021-09-141-2/+1
| | | | | | | | | | | | | | | | | | The sensor_num should match the sensor index of the sensor that produced the data. It was incorrectly set to sens_cnt, which is just the offset of the sensors on the bmi3xx. BUG=b:195264765, b:197186738 TEST=Passed the following tests on guybrush: iioservice_simpleclient --channels='accel_x' --frequency=12.5 --device_id=2 --samples=1 run cts -m CtsSensorTestCases -t android.hardware.cts.SensorBatchingTests#testAccelUncalibrated_50hz_batching BRANCH=None Change-Id: Id51ea52a0426fc50a5001437e720eedf41c333ad Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150058 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* driver: ln9310: check return codesYuval Peress2021-09-131-93/+82
| | | | | | | | | | | | | | | | | | | Allow better code coverage by checking return codes in various internal static functions. BRANCH=none BUG=b:184856083 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I28afe0538ed9ac98d4ecb9c499d218cd11cbc1ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158736 Commit-Queue: Yuval Peress <peress@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Yuval Peress <peress@google.com> Auto-Submit: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* mrbland: Modify the battery informationSiyu Qin2021-09-132-122/+35
| | | | | | | | | | | | | | | | Update the battery information for mrbland. BUG=b:197836965 BRANCH=trogdor TEST=make -j BOARD=mrbland Change-Id: I7fd3d69681152627e8bc1208b80430b91213436e Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3132161 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* mrbland: Modify type-c port C0 configuration to match HW designSiyu Qin2021-09-135-63/+20
| | | | | | | | | | | | | | | | | Mrbland only has one port which corresponds to port C1 in reference board. So the port C0 needs to modify to match the hardware design. BUG=b:197291418 BRANCH=trogdor TEST=make BOARD=mrbland Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Change-Id: I3235408dbbdfef5162fb43a66f436669fd0c1b71 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3118663 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* kukui: Enable brief asserts to free flash spaceRob Barnes2021-09-131-0/+1
| | | | | | | | | | | | | | Enable CONFIG_DEBUG_ASSERT_BRIEF in RO to free flash space. Brief asserts print only the file name and the line number. BUG=None TEST=Build all BRANCH=None Change-Id: I65334ad2c50e4c70f25af7dbbe03302d7d541bc7 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3157760 Reviewed-by: Keith Short <keithshort@chromium.org>
* garg: Enable CONFIG_LTORob Barnes2021-09-131-0/+3
| | | | | | | | | | | | | Enable CONFIG_LTO (link time optimizations) to free up flash space. BUG=None TEST=Build garg BRANCH=None Change-Id: I408adabb9e887a86d319f67f75b159f2af832ffe Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3157759 Reviewed-by: Diana Z <dzigterman@chromium.org>
* felwinter: Clear up unnecessary codeOwen_Ou2021-09-136-128/+4
| | | | | | | | | | | | | | | | | | felwinter doesn't need the brya p0 and p1, so delete it. BUG=b:197593632 BRANCH=none TEST=make -j BOARD=felwinter and flash brya p2 can boot. Signed-off-by: Owen_Ou <Owen_Ou@compal.corp-partner.google.com> Change-Id: I5babb2b629d59664f76e5c2d25f0dbf328404f42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3124480 Tested-by: Owen Ou <owen_ou@compal.corp-partner.google.com> Auto-Submit: Owen Ou <owen_ou@compal.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com> Reviewed-by: YH Lin <yueherngl@chromium.org> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* zephyr: zmake: Bound size of relative paths for resolve_build_dir testsJack Rosenthal2021-09-131-1/+4
| | | | | | | | | | | | | | | | | | | | | In Linux, both filenames and paths are not unbounded in size. The typical constants NAME_MAX and PATH_MAX specify the maximum size (in bytes) of a file name and a file path, respectively. In Linux, these constants are 256 and 4096. The regex which was previously used here assumed file names could be infinitely long. Bound it. Additionally, we need to limit to ASCII word characters, as Unicode characters may sometimes be more than one byte. BUG=b:199769823 BRANCH=none TEST=run unit tests Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I404302ea10ec27acc9c8e6988bb6dd6050deb09a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3158895 Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* zephyr: Remove herobrine_npcx7 buildJack Rosenthal2021-09-139-860/+0
| | | | | | | | | | | | | | Obsolete since the NPCX9 IOB is now widely available. BUG=b:191803008 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I3865dcf368d7542abaf5126ccb7548933b4ab25f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150053 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* zephyr: Use NOP to wait for the external reset from H1Wealian Liao2021-09-132-6/+31
| | | | | | | | | | | | | | | | The current initial stage couldn't use the kernel delay function. Use CPU nop instruction to wait for the external reset from H1. BUG=b:182875520 BRANCH=none TEST=Enable CONFIG_BOARD_RESET_AFTER_POWER_ON for evb & toggle GPIO. Check the delay is 2 seconds. Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: If221181358c2a4df758d5bb9b57c3fbba31100aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3143633 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* cherry: adjust charger input voltage limitTing Shen2021-09-131-0/+12
| | | | | | | | | | | | | | | | | | | | When the system is powered by 5V/3A adapter from C1 port, the long PPVAR_VBUS_IN trace will cause large IR drop with high input current and PPVAR_VBUS_IN voltage will hit ISL9238C input voltage limit, then ISL9238C will decrease the sink current to make PPVAR_VBUS_IN valid. See b:198707662 comment#9 for more detail. BUG=b:198707662 TEST=check the register value of 0x4B BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I148e8943b295a73d27a9bc381309d074b053fb85 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153621 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* chip: it83xx/gpio: condition for adding judgmentTim Lin2021-09-131-1/+1
| | | | | | | | | | | | | | | If there is an I/O expander driver for keyboard, there is no need to enter the keyboard_raw_interrupt(). BUG=b:199337186 BRANCH=none TEST=make buildall -j4 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: Ie24f5b5592325a76d9a36a689657bdd2e05c8fb1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3151046 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* IOEX: it8801: change the KSO mapping array to overridableTim Lin2021-09-132-3/+4
| | | | | | | | | | | | | | | KSO mapping array need to follow the different circuit design, so change this array to overridable. BUG=b:199337186 BRANCH=none TEST=make buildall -j4 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I3ee0ceffbdb50cf9282cda6039c4a44ebe445bd0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3151045 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* zephyr: shim/system: fix APIs of call BBRAM read and writestabilize-14217.B-mainTim Lin2021-09-133-214/+14
| | | | | | | | | | | | | | | | | | | | The APIs of BBRAM read and write have been renamed and moved to drivers/bbram. The related call routines of shim/system.c need to be fixed. BUG=b:195843756 BRANCH=none TEST=the board of asurada and it8xxx2_evb can boot EC and access bbram successfully after adding this CL. zmake testall --> pass Change-Id: I98e51a278a24eeb4bbc92343fe6fc97e3e758e8a Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153117 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* rammus: Add accelerometer 2nd source KX022.Michael5 Chen12021-09-115-2/+116
| | | | | | | | | | | | | | | | Add accelerometer 2nd source KX022. BUG=b:197005105 BRANCH=rammus TEST=make BOARD=rammus Using command "watch ectool motionsense lid_angle". Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: Iea7fee7766730a8c054217877abb76facb55976a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3102685 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Zhuohao Lee <zhuohao@chromium.org>
* brya: adjust default ALS calibrationBoris Mittelberg2021-09-111-3/+3
| | | | | | | | | | | | | | | Using non-zero coefficiants for initial ALS array removes the need of manual ALS calibration (ectool motionsense calibrate 3) BRANCH=none BUG=b:195332927 TEST=on brya id 2 the backlight changes depending on ambient light Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: I71932c605db0f8f1c42bc62796b5f25c5eb3cacf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155296 Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org> Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
* docs/fingerprint: Fix linkTom Hughes2021-09-101-2/+2
| | | | | | | | | | | | | The format tool was assuming the parentheses were a markdown link. BRANCH=none BUG=none TEST=view in gitiles Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Iea221310e87adaa9fbeaf046d634a57034f142c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153630 Reviewed-by: Craig Hesling <hesling@chromium.org>
* zephyr: emul: update EMUL_DEFINE call sitesYuval Peress2021-09-107-27/+28
| | | | | | | | | | | | | | | | Update the call sites of EMUL_DEFINE to include the data pointer. BRANCH=none BUG=none TEST=zmake testall Cq-Depend: chromium:3154404 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Icb1a788a2ffcbdd969c231edb2214447041ed5ca Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3153590 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: shim: set pwm_led data from device treeFabio Baltieri2021-09-1010-18/+93
| | | | | | | | | | | | | | | | Set up the pwm_leds data from the device tree, gets rid of most static map defines and sets CONFIG_LED_PWM_COUNT automatically. BRANCH=none BUG=b:177452529 TEST=build and run on volteer TEST=compared the built up pwm_leds structure with gdb Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ib41faf86ae018f5a1ed8a1c96c4b6ec081e175d9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3154256 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* driver: bmi: Merge list_activities in common codeGwendal Grignou2021-09-104-24/+14
| | | | | | | | | | | | | | | | | Put list_activities in common code, as it is used by both BMI160 and BMI260 driver. Fixes cb3771973de ("Coachz: MotionSensor: Avoid redefine gesture function list_activites") Fixes fc298a0ada0 ("driver: bmi260: integrate body detection") BUG=b:195908820 BRANCH=trogdor TEST=buildall Change-Id: I05591954c825802502328c842b03e8934c497f08 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150056 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: lsm6dso: Fix FIFO processingGwendal Grignou2021-09-102-37/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a loop in irq_handler to match datasheet documentation: """ 1. Read the FIFO_STATUS1 and FIFO_STATUS2 registers to check how many words are stored in the FIFO. This information is contained in the DIFF_FIFO_[9:0] bits. 2. For each word in FIFO, read the FIFO word (tag and output data) and interpret it on the basis of the FIFO tag. 3. Go to step 1. """ We need to read the FIFO length at the end of the IRQ handler to be sure a new item has not been put while the FIFO was being read. Otherwise, we will not get interrupt and will stop processing FIFO when the FIFO status register still shows the FIFO as not empty. However, using linux kernel st_lsm6dsx_read_tagged_fifo() as model, read only one word at a time: When reading 2 7bytes word at time, the FIFO would still claim one entry remains: The 3rd entry would be a copy of the accelerometer data, but with a corrupted z axis.That why we fail the data test, the gravity vector is not measured at 9.81m/s^2. There was a bug in the interrupt handler that would read the FIFO twice, which was presenting the data: both gyro and accel at the same ODR: [7623.475256 Base Accel FIFO status: 8002] [7623.476548 Base Gyro sending vector num: 2 raw: 0x00000007 - 0xFFFFFFF6 - 0xFFFFFFF9] [7623.477526 Base Accel sending vector num: 1 raw: 0xFFFFFFCC - 0xFFFFE275 - 0xFFFFE818] [7623.479271 Base Accel FIFO status: 8001] [7623.480333 Base Accel sending vector num: 1 raw: 0xFFFFFFCC - 0xFFFFE275 - 0x00000C18] [7623.481699 Base Accel FIFO status: 0000] We must only run the irq_hanlder for the main/accelerometer sensor. Restructure irq_hanlder to match other driver, like accelgyro_bm160.c. BUG=b:195700255,b:192219470 BRANCH=dedede TEST=Running tast run <ip> hardware.SensorIioserviceHard Check we get the right amount of samples. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I5820dec4c7c5ccb1ebeda854398738d1af60290c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150679 Reviewed-by: Keith Short <keithshort@chromium.org>
* driver: lsm6dso: Minor macro changesGwendal Grignou2021-09-102-5/+4
| | | | | | | | | | | | | | | | | | Rename LSM6DSO_FIFO_ODR_TO_REG into LSM6DSO_FIFO_ODR_MASK as the macro return the mask to use to set the FIFO ODR. Remove CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ in code, as already used in LSM6DSO_ODR_MAX_VAL. Simplify LSM6DSO_ST_DATA by using . instead of ->. BUG=none BRANCH=deded TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I4253368415635c858ce181f228591e8bf93eacb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150678 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* driver: LSM6DSM: Limit FIFO transfer buffer sizeGwendal Grignou2021-09-101-1/+1
| | | | | | | | | | | | | | | | | The buffer is allocated on the stack. It is currently 32*6 bytes. This is unnecessarily large as we set the FIFO threshold at 1. Reduce it to 8*6 bytes, the gain of long I2C transactions is negligible and we save some space in the stack. BUG=none BRANCH=none TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I8b6f9f2bdfe27206d049c1fe0b82df4caaadce09 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150677 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* TCPMv2: Separate discovery and mode initAbe Levkoy2021-09-105-10/+34
| | | | | | | | | | | | | Don't clear discovery data when resetting active modes during mode exit. BUG=b:141363146 TEST=make buildall BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I8052641bb850ce8486eb9c82641b41880cb97d65 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3123837 Reviewed-by: Diana Z <dzigterman@chromium.org>
* IOEX: it8801: Enable GPIO based interruptsVijay Hiremath2021-09-102-26/+153
| | | | | | | | | | | | | | | | Added code to enable GPIO based interrupts on it8801 I/O Expander. BUG=b:197659347 BRANCH=none TEST=Tested on ADL-RVP able to get ISR triggered Change-Id: I7f5f460f48fc21e51bb93bede5a05da89b7dc807 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3076469 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Dino Li <Dino.Li@ite.com.tw> Commit-Queue: Keith Short <keithshort@chromium.org>
* it8801: Allow configurable option to use RAW KeyboardVijay Hiremath2021-09-101-1/+3
| | | | | | | | | | | | | | | | | | To avoid BOM stuffing options on RVP, it8801 discrete keyboard with I/O expander is added on RVP as an AIC in MECC1.1. This config allows MECC vendors to easily switch between RAW keyboard or discrete keyboard. BUG=b:197659347 BRANCH=none TEST=make buildall -j Change-Id: I3b55eff0f5a1582daf63fca955954b8a42c1b7b2 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115433 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Li Feng <li1.feng@intel.com>
* ioex: it8801: Support multiple I2C addressesVijay Hiremath2021-09-1023-36/+75
| | | | | | | | | | | | | | | | | | | To avoid the I2C address contention between multiple I2C devices on same bus, added code to support multiple I2C addresses for it8801 I/O expander. BUG=none BRANCH=none TEST=make buildall -j Change-Id: I6985973f9ae3ce91383d3b568a851169e6a308af Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3115426 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Li Feng <li1.feng@intel.com>
* zephyr: driver: bbram: Migrate to upstream driverYuval Peress2021-09-1020-316/+56
| | | | | | | | | | | | | | | | | Migrate the BBRAM driver to the upstream version. BRANCH=none BUG=b:195843756 TEST=zmake testall Cq-Depend: chromium:3147080 Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I441e58f94c4874e268aad36df2f036a88187801b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147230 Tested-by: Yuval Peress <peress@google.com> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Yuval Peress <peress@google.com>
* zephyr: it8xxx2_evb: enable hibernate mode on it8xxx2_evbTim Lin2021-09-101-2/+8
| | | | | | | | | | | | | | | | | | | | | The GPIO interrupts that can be waked up in hibernate mode include GPIO_LID_OPEN and GPIO_POWER_BUTTON_L. BUG=b:198305804 BRANCH=none TEST=test1: console command: hibernate Wake-up GPIO interrupt: GPIO_LID_OPEN and GPIO_POWER_BUTTON_L test pass! test2: console command: hibernate [seconds] [microseconds] After the specified seconds, the EC will wake-up from sleep mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I4069ec13d2681015a66fddf8d52666371da6048a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146775 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: hayato: enable hibernate mode on hayatoTim Lin2021-09-101-3/+10
| | | | | | | | | | | | | | | | | | | | | | The GPIO interrupts that can be waked up in hibernate mode include GPIO_AC_PRESENT, GPIO_LID_OPEN and GPIO_POWER_BUTTON_L. BUG=b:198305804 BRANCH=none TEST=test1: console command: hibernate Wake-up GPIO interrupt: GPIO_AC_PRESENT, GPIO_LID_OPEN and GPIO_POWER_BUTTON_L test pass! test2: console command: hibernate [seconds] [microseconds] After the specified seconds, the EC will wake-up from sleep mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: Ibd19f14b3a5e2bf47f8edd9205761333d7b0318f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146774 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: cros_system: add hibernate mode to IT8xxx2 chipsetTim Lin2021-09-101-2/+69
| | | | | | | | | | | | | | | | | Add hibernate function. EC can be waked-up by a specified seconds or GPIO interrupts from sleep mode. BUG=b:198305804 BRANCH=none TEST=zmake testall Cq-Depend: chromium:3093834 Change-Id: I55fbd18b916f343b198c8ba8e5dce1bd592261f6 Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3109273 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* asurada: move the hibernate routine into separate fileTim Lin2021-09-104-23/+39
| | | | | | | | | | | | | | | | | | Move the hibernate routine from baseboard.c to separate hibernate.c files. BUG=b:198305804 BRANCH=none TEST=make BOARD=asurada -j The interrupt of GPIO_AC_PRESENT can wake up CPU in hibernate mode. Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com> Change-Id: I0aea0b812f535c907ac8963fc1f09206dfef5956 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3146773 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* gumboz: remove unused configZick Wei2021-09-101-3/+0
| | | | | | | | | | | | | | BUG=none BRANCH=zork TEST=verify DUT can power on normally. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ic9b7c953a0dda88529e2886ab1fd9e736760bb2d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3151210 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* gumboz: update AC power on limitZick Wei2021-09-101-0/+3
| | | | | | | | | | | | | | | | | This patch update AC only power on limit from 50W to 40W, and remove unused config. BUG=b:199254041 BRANCH=zork TEST=make sure AC only can auto power on with 45W adapter. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I55b6f2a91b68fd1f2bd287228719f8b9a35ba532 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147971 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr: herobrine_npcx9: adjust ~75% stack sizesDenis Brockus2021-09-101-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is still more tuning that needs to happen as development continues but this is an initial stab leaving some values the same as they are for NPCX7 when there was doubt. kernel stacks 21-09-09 12:14:06.481 0x200c0e20 PD_INT_C1 (real size 736): unused 496 usage 240 / 736 (32 %) 21-09-09 12:14:06.487 0x200c0d00 PD_INT_C0 (real size 736): unused 496 usage 240 / 736 (32 %) 21-09-09 12:14:06.493 0x200c0be0 PD_C1 (real size 1184): unused 464 usage 720 / 1184 (60 %) 21-09-09 12:14:06.500 0x200c0ac0 PD_C0 (real size 1184): unused 448 usage 736 / 1184 (62 %) 21-09-09 12:14:06.506 0x200c09a0 KEYSCAN (real size 704): unused 184 usage 520 / 704 (73 %) 21-09-09 12:14:06.513 0x200c0880 HOSTCMD (real size 704): unused 112 usage 592 / 704 (84 %) 21-09-09 12:14:06.519 0x200c0760 MOTIONSENSE (real size 816): unused 244 usage 572 / 816 (70 %) 21-09-09 12:14:06.525 0x200c0640 CHIPSET (real size 688): unused 176 usage 512 / 688 (74 %) 21-09-09 12:14:06.532 0x200c0520 CHARGER (real size 752): unused 192 usage 560 / 752 (74 %) 21-09-09 12:14:06.538 0x200c0400 USB_CHG_P1 (real size 544): unused 144 usage 400 / 544 (73 %) 21-09-09 12:14:06.544 0x200c02e0 USB_CHG_P0 (real size 544): unused 120 usage 424 / 544 (77 %) 21-09-09 12:14:06.551 0x200c01c0 HOOKS (real size 672): unused 448 usage 224 / 672 (33 %) 21-09-09 12:14:06.560 0x200c7a60 sysworkq (real size 800): unused 200 usage 600 / 800 (75 %) 21-09-09 12:14:06.564 0x200c67d0 shell_uart (real size 1536): unused 832 usage 704 / 1536 (45 %) 21-09-09 12:14:06.571 0x200c78f0 idle 00 (real size 192): unused 80 usage 112 / 192 (58 %) 21-09-09 12:14:06.577 0x200c79a8 main (real size 1024): unused 448 usage 576 / 1024 (56 %) 21-09-09 12:14:06.583 0x200cc2c8 IRQ 00 (real size 1024): unused 620 usage 404 / 1024 (39 %) BUG=b:199328071 BRANCH=none TEST=ec console command 'kernel stacks' Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I47a02a3554e066dda87c91a2335f7e89ab0e4100 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3152316 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zephyr:herobrine_npcx9: Enable kernel shell ec commandsDenis Brockus2021-09-101-0/+1
| | | | | | | | | | | | | | BUG=b:199328071 BRANCH=none TEST=ec console command 'kernel' Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I5ad1686e0a472123180587e2584ad79e29da65dd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3152315 Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* dirinboz: update AC power on limitZick Wei2021-09-091-0/+3
| | | | | | | | | | | | | | | This patch update AC only power on limit from 50W to 40W. BUG=b:199254041 BRANCH=zork TEST=make sure AC only can auto power on with 45W adapter. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ib68acc22016d0906deacd699b13dfd3af74f6c2b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147970 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* kingoftown: Initial EC imageTommy Chung2021-09-0912-0/+1193
| | | | | | | | | | | | | | | | | | | | Create the initial EC image for the kingoftown variant by copying the trogdor reference board EC files into a new directory named for the variant. (Auto-Generated by create_initial_ec_image.sh version 1.5.0). BUG=b:198365759 BRANCH=firmware-trogdor-13577.B-master TEST=make BOARD=kingoftown Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Change-Id: I56b34d317509ed74dac405492be9a035375f36e7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120609 Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org>
* zephyr: asurada: Adjust task stack sizesDenis Brockus2021-09-091-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stack sizes should be near 75% usage. kernel stacks 21-09-08 16:07:25.972 0x8010af00 PD_C1 (real size 1024): unused 248 usage 776 / 1024 (75 %) 21-09-08 16:07:25.988 0x8010add8 PD_C0 (real size 1024): unused 272 usage 752 / 1024 (73 %) 21-09-08 16:07:26.000 0x8010acb0 KEYSCAN (real size 928): unused 240 usage 688 / 928 (74 %) 21-09-08 16:07:26.013 0x8010ab88 HOSTCMD (real size 1024): unused 272 usage 752 / 1024 (73 %) 21-09-08 16:07:26.026 0x8010aa60 MOTIONSENSE (real size 928): unused 240 usage 688 / 928 (74 %) 21-09-08 16:07:26.038 0x8010a938 CHIPSET (real size 832): unused 224 usage 608 / 832 (73 %) 21-09-08 16:07:26.051 0x8010a810 CHARGER (real size 960): unused 240 usage 720 / 960 (75 %) 21-09-08 16:07:26.062 0x8010a6e8 USB_CHG_P1 (real size 800): unused 192 usage 608 / 800 (76 %) 21-09-08 16:07:26.075 0x8010a5c0 USB_CHG_P0 (real size 800): unused 272 usage 528 / 800 (66 %) 21-09-08 16:07:26.089 0x8010a498 HOOKS (real size 672): unused 352 usage 320 / 672 (47 %) 21-09-08 16:07:26.100 0x80101a08 sysworkq (real size 1024): unused 288 usage 736 / 1024 (71 %) 21-09-08 16:07:26.112 0x801017c8 shell_uart (real size 1056): unused 244 usage 812 / 1056 (76 %) 21-09-08 16:07:26.125 0x80101888 idle 00 (real size 256): unused 128 usage 128 / 256 (50 %) 21-09-08 16:07:26.137 0x80101948 main (real size 1024): unused 344 usage 680 / 1024 (66 %) 21-09-08 16:07:26.150 0x80109cf0 IRQ 00 (real size 800): unused 296 usage 504 / 800 (63 %) BUG=none BRANCH=none TEST=ec console 'kernal stacks' Signed-off-by: Denis Brockus <dbrockus@google.com> Change-Id: I69a0767e4694a386dd24c95b162d92aad5cbebc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150067 Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Denis Brockus <dbrockus@chromium.org> Auto-Submit: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: fix compilation of kx022 driverMichał Barnaś2021-09-093-2/+3
| | | | | | | | | | | | | | | Add EC root directory to include directories list and fix include directive in kx022 driver info file. BRANCH=main BUG=b:194424288 TEST=Compilation for lazor should work correctly. Change-Id: I1312b4cac8695e61936b9635c7a59c2f59907502 Signed-off-by: Michał Barnaś <mb@semihalf.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3129961 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* felwinter: not support 4th temp_sensorOwen_Ou2021-09-093-9/+0
| | | | | | | | | | | | | | | | | | felwinter not support 4th temp_sensor. BUG=b:197593632 BRANCH=none TEST=make -j BOARD=felwinter Signed-off-by: Owen_Ou <Owen_Ou@compal.corp-partner.google.com> Change-Id: I7cc2db9e0e267f5368a4d953074decf482da200b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120607 Tested-by: Owen Ou <owen_ou@compal.corp-partner.google.com> Auto-Submit: Owen Ou <owen_ou@compal.corp-partner.google.com> Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com> Reviewed-by: YH Lin <yueherngl@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* Felwinter: modified power and battery LED behaviorJosh Tsai2021-09-094-118/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Power LED (DC/AC): S0: Solid White S3: Blinking White, 1s on / 3s off S5: LED off Battery LED: Charging (0%-94%): Amber Full charged: White Discharging: LED off Battery Error (S0): Blinking Amber, 1s on / 1s off Battery Error (S0ix/S5): LED off Battery Low (S0): Blinking Amnber, 1s on / 3s off Battery Low (S0ix/S5): LED off BUG=b:197593645 BRANCH=brya TEST=make BOARD=felwinter, test on brya MB Signed-off-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Change-Id: I478e5fb5de0f1cf8d71a08a919dcbb248a55f8b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131956 Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* brya: support EC_CMD_BATTERY_GET_STATIC version 1Deepti Deshatty2021-09-091-0/+7
| | | | | | | | | | | | | | | | | ectool battery command returns the battery information correctly but returns an ioctl error as EC_CMD_BATTERY_GET_STATIC do not support version 1. Changes enable the command version 1. BRANCH=none BUG=b:197836974 TEST=Verified ectool battery command on brya. Change-Id: I2b2c4068bce1b5150d089ba08596c1191c189c2b Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120611 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* tcpm/rt1718s: fix race condition between tcpc_init and usb_chg taskTing Shen2021-09-091-3/+0
| | | | | | | | | | | | | | | | | | | | | Two different functions controls the BC12_SNK_FUNC register, one is bc12_init, another one is usb_charger_task. This causes a racing condition happens during EC soft reset: bc12_init resets the BC12_SNK_FUNC register to its initial value when usb_chg task starts bc1.2 detection. To solve this, let usb_chg task has full control of the register. BUG=b:199226158 TEST=bc1.2 detection works after ec soft reset. BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ie423e2d9ddad1e1fadb97e1b73b8b5e535121601 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3147512 Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>