summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* hibernate: allow AP_PWRSEQ to indicate AP power statePeter Marheine2022-04-011-2/+3
| | | | | | | | | | | | | | | | | Firmwares using the new Zephyr ap_pwrseq subsystem don't enable HAS_TASK_CHIPSET, but use CONFIG_AP_PWRSEQ for the same function. Testing both ensures that systems using the new subsystem won't incorrectly attempt to hibernate when connected to power. BUG=b:226325993 TEST=Nereid now aborts hibernating when connected to external power with the "skip hibernate" message. BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: If1347cf9ffc4dd7a2e2e4369f8090110e65787b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3561602 Reviewed-by: Andrew McRae <amcrae@google.com>
* tcpc: fix DUT shutdown when low battery during update TBT FWScott Chao2022-03-311-8/+8
| | | | | | | | | | | | | | | | Some batteries have large capacity that 100mAh not map to 5% of RSOC. So change to use RSOC directly. BUG=b:222637797 BRANCH=none TEST=make -j BOARD=primus TEST=When battery is lower than 10%, plug in AC and boot to OS. No TBT FW update occurred. Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Change-Id: Iffb363554ef1d04f488f544aa711521f6e87ab0a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3559969 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* Zephyr: Separate temp_sensor_read()Diana Z2022-03-311-4/+2
| | | | | | | | | | | | | | | Zephyr's implementation will be diverging from the ECOS implementation for this function, so move it into the zephyr shim layer. BRANCH=None BUG=b:223837802 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I8037bcb8c1c88836a1b07974d5ca506666a351be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3546932 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* RGBKBD: Add EC_CMD_RGBKBD commandDaisuke Nojiri2022-03-301-0/+19
| | | | | | | | | | | | | | | | | | Host programs call EC_CMD_RGBKBD to set or get data, config, etc. of an RGB keyboard. This patch adds EC_RGBKBD_SUBCMD_CLEAR sub-command. localhost ~ # ectool --device 18d1:5022 rgbkbd clear 0xff0000 BUG=b:223465912 BRANCH=None TEST=Prism/Vell. See above. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I20013a2b3c7b831ce0f8dcee5833c9c4017795da Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3558056 Reviewed-by: caveh jalali <caveh@chromium.org>
* test_util: Add function to set next state without rebootPatryk Duda2022-03-301-1/+6
| | | | | | | | | | | | | | | | | | Some tests (eg. panic data tests) will require to set the next state without immediate reboot. In this case the test is responsible to reboot the board with one of the following ways - crash, hard reboot and soft reboot. BUG=b:221087395 BRANCH=none TEST=Run some EC tests. Make sure test passes Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Idf75fb4c2f4313c03f68ed99e95b14d0e0807b0d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3555748 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* RGBKBD: Add EC_CMD_RGBKBD_SET_COLOR commandDaisuke Nojiri2022-03-291-0/+78
| | | | | | | | | | | | | | | | | | | | | | | | Host programs call EC_CMD_RGBKBD_SET_COLOR to change the LED colors of an RGB keyboard. Example command execution on Vell against Prism: localhost ~ # ectool --device 18d1:5022 rgbkbd 10 0x010203 EC prints: HC resp:080000000002000101000000 HC 0x13a.0:0a01010203 RGBKBD: Set [10,0] to color=[1,2,3] (gid=0 offset=60) BUG=b:223465912 BRANCH=None TEST=Prism/Vell. See above. make run-rgb_keyboard. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Ic6235ca575ed488fe166b0873f8a5596c63dc2b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3546569 Reviewed-by: caveh jalali <caveh@chromium.org>
* tree: Replace __attribute__((used)) with __keepTom Hughes2022-03-291-4/+4
| | | | | | | | | | | | | | The two are equivalent, so use __keep everywhere for consistency. BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ie2d15e8fa00dbe35a190060c80f15f4ba720e3a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3556497 Reviewed-by: Eric Yilun Lin <yllin@google.com>
* hooks: add HOOK_PRIO_POST_POWER_BUTTONKeith Short2022-03-291-1/+1
| | | | | | | | | | | | | | | Add the HOOK_PRIO_POST_POWER_BUTTON alias for (HOOK_PRIO_INIT_POWER_BUTTON+1). This more clearly identifies the intent of this priority level. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Icc009a74cb87d3fdec1360e00bb41fdbb10a6e8a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553678 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* hooks: add HOOK_PRIO_PRE_DEFAULTKeith Short2022-03-291-1/+1
| | | | | | | | | | | | | | | Add the HOOK_PRIO_PRE_DEFAULT alias for (HOOK_PRIO_DEFAULT-1). This more clearly identifies the intent of this priority level. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I96d2a9951b3585ea07c28aa518204d1e20f306de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553676 Reviewed-by: Sam Hurst <shurst@google.com>
* hooks: add HOOK_PRIO_POST_CHIPSETKeith Short2022-03-291-1/+1
| | | | | | | | | | | | | | | Add the HOOK_PRIO_POST_CHIPSET alias for (HOOK_PRIO_INIT_CHARGE_CHIPSET+1). This more clearly identifies the intent of this priority level. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2fee7c2c055d6b361871620aea74b92977dd31d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553675 Reviewed-by: Al Semjonovs <asemjonovs@google.com>
* hooks: add HOOK_PRIO_POST_CHARGE_MANAGERKeith Short2022-03-291-1/+1
| | | | | | | | | | | | | | | Add the HOOK_PRIO_POST_CHARGE_MANAGER alias for (HOOK_PRIO_INIT_CHARGE_MANAGER+1). This more clearly identifies the intent of this priority level. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Id21405148cae59d8c2cf3a0519124b45e03a2c39 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553674 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* hooks: rename charger init priority to match othersKeith Short2022-03-292-2/+2
| | | | | | | | | | | | | | Rename HOOK_PRIO_CHARGE_MANAGER_INIT to HOOK_PRIO_INIT_CHARGE_MANAGER, matching the pattern used for the other initialization priorities. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Icb80b3cb1297888fcde2eb7d6de86fbc215fe212 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553673 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* hooks: add HOOK_PRIO_POST_LIDKeith Short2022-03-292-4/+4
| | | | | | | | | | | | | | Add the HOOK_PRIO_POST_LID alias for (HOOK_PRIO_INIT_LID+1). This more clearly identifies the intent of this priority level. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I7042b7f4244b5ed48dac67dc9eb4deaca81000b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553672 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* hooks: add HOOK_PRIO_POST_PWMKeith Short2022-03-291-1/+1
| | | | | | | | | | | | | | Add the HOOK_PRIO_POST_PWM alias for (HOOK_PRIO_INIT_PWM+1). This more clearly identifies the intent of this priority level. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2a589f0841c713d34434d9aae89b05db0a42c86e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553671 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* hooks: add HOOK_PRIO_POST_I2CKeith Short2022-03-292-2/+2
| | | | | | | | | | | | | | | | | Add the HOOK_PRIO_POST_I2C alias for (HOOK_PRIO_INIT_I2C+1). This more clearly identifies the intent of this priority level. Applied only to common code and to Zephyr boards. BUG=none BRANCH=none TEST=compare_build.sh TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ia5b8c594e1f06ae1a982770f75b63bb4ba44191f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3553669 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* USBHC: Add USB host command interfaceDaisuke Nojiri2022-03-292-0/+273
| | | | | | | | | | | | | | This patch adds a host command interface for USB. BUG=b:211496726 BRANCH=None TEST=Prism on Vell. Change-Id: Icead7a1bdc593b3c4740ede0ddd5fc2cf5700bfa Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3354039 Reviewed-by: caveh jalali <caveh@chromium.org> Commit-Queue: caveh jalali <caveh@chromium.org>
* zephyr: Add mock for system_jumped_late() functionTristan Honscheid2022-03-281-1/+1
| | | | | | | | | | | | | | | | | | Certain drivers behave differently when the system has performed a late jump. For example, the SN5S330 skips certain initialization steps if its init function runs a second time under a late-jump situation. To allow testing these different branches in unit tests, add around this function. By default, its return value is `0`, indicating no late jump. BRANCH=None BUG=b:225245353 TEST=zmake -D configure --test test-drivers Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: I2dc2132db3363606f0896d9c817e271ff3912190 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3552704 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* util: Remove implementation of strtoull in Zephyr buildYuval Peress2022-03-281-0/+2
| | | | | | | | | | | | | | | | Zephyr defines it's own implementation of strtoull in a libc minimal implementation so this implementation causes a conflict. BRANCH=none BUG=none TEST=zmake build brya Cq-Depend: chromium:3552896 Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I6529639238adbf2baa75f699fe64df09c35910fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3554122 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Commit-Queue: Keith Short <keithshort@chromium.org>
* util: align the IN_RANGE implementation with zephyrTing Shen2022-03-231-2/+2
| | | | | | | | | | | | | | | | | | | | The design of IN_RANGE() is slightly different between CrosEC and Zephyr's. Zephyr IN_RANGE() includes both upper and lower bound. (Ref: https://docs.zephyrproject.org/latest/reference/util/index.html#c.IN_RANGE) Update legacy code to work with CONFIG_ZEPHYR. BUG=none TEST=manually verify that all occurarence of IN_RANGE is updated BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I67e83a92be574be96535a3fe1b14454754e32072 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3534749 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* common: vivaldi: modify key struct to be overridableLeo-Tsai2022-03-221-1/+1
| | | | | | | | | | | | | | | | change common struct key to be overridable let board layer can customize row col struct. BUG=b:220996030 BRANCH=none TEST=build make -j BOARD=Banshee pass Signed-off-by: Leo-Tsai <leocx_tsai@compal.corp-partner.google.com> Change-Id: Ic86a24b82ddee1c59474971e042ff06d69f6d69a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3535539 Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com>
* i2c: Add addr_flags and cmd to board_allow_i2c_passthru()Ricardo Quesada2022-03-171-5/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds addr_flags and cmd_id (AKA offset) to board_allow_i2c_passthru(). This CL is a kind-of-cherrypick of this other CL: https://crrev.com/c/1588492 BRANCH=none BUG=b:135642493 TEST=make buildall passes tested in Madoo where I manually added a board_allow_i2c_passthru() function that was blocking port 5 (battery) and did: With EC unlocked: dut # ectool i2cread 8 0x05 22 1 Read from I2C port 5 at 0x16 offset 0x1 = 0x67 With EC locked: dut # ectool i2cread 8 0x05 22 1 EC result 4 (ACCESS_DENIED) Change-Id: Ifba59f21f63f99345b81dd250296214a5cd29eba Signed-off-by: Ricardo Quesada <ricardoq@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3466422 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Ricardo Quesada <ricardoq@chromium.org> Auto-Submit: Ricardo Quesada <ricardoq@chromium.org> Commit-Queue: Ricardo Quesada <ricardoq@chromium.org>
* i2c: move PASSTRHU_RESTRICTED check to check_i2c_paramsRicardo Quesada2022-03-171-8/+6
| | | | | | | | | | | | | | | | | | | | | | This CL moves the check about allowing PASSTHRU_RESTRICED checks from i2c_command_passthru() to check_i2c_params(). The rationale, is that we already have a function to check whether the params are valid and/or allowed. This is similar to what this CL did: https://crrev.com/c/1588492 BRANCH=none BUG=b:135642493 TEST=make buildall passes Change-Id: I5902feae8f5b626e10053f279cb2fe2cdbba2585 Signed-off-by: Ricardo Quesada <ricardoq@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3466415 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Ricardo Quesada <ricardoq@chromium.org> Auto-Submit: Ricardo Quesada <ricardoq@chromium.org> Commit-Queue: Ricardo Quesada <ricardoq@chromium.org>
* dps: ensure DPS task waited for enough timeEric Yilun Lin2022-03-161-0/+1
| | | | | | | | | | | | | | | | | | DPS task will be waken up if new srccaps received, but the DPS should wait enough time and then start the next evaluation, or we might measure the starting up current and power and the value will be underestimated. BUG=b:169532537 TEST=enable DPS, and it won't sample starting up current and power BRANCH=cherry Change-Id: I995639b4d9f88ef4eaae02ad07b49fb9b6ffee0a Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3527895 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
* gpio: Cleanup CONFIG_CMD_GPIO_EXTENDEDKeith Short2022-03-161-16/+11
| | | | | | | | | | | | | | | Cleanup the GPIO flag descriptios used by GPIO_CMD_GPIO_EXTENDED. This doesn't save any code size, but simplifies the logic. BUG=none BRANCH=none TEST=make buildall TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I71f0db12a2b65bcc2e2bdf6dc48fb643c5cd6c6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3526272 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Directly map GPIO flagsKeith Short2022-03-161-0/+6
| | | | | | | | | | | | | | | | Directly map legacy GPIO flags to the Zephyr equivalent when possible. The interrupt flags are still handled separately. BUG=b:224821728 BRANCH=none TEST=zmake testall TEST=compare_build.sh TEST=verify Herobrine boots the AP Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I379d95036dbf5630a0a6aed708c49cfcfc084802 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3526271 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* ectool: support dps enable/disable commandEric Yilun Lin2022-03-151-0/+12
| | | | | | | | | | | | | | | | Support dps host command for factory test. BUG=b:223937130 TEST=ectool usbpddps disable|enable BRANCH=cherry Change-Id: I050c724b5caab41644248a6f72704edbc76554a0 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3522247 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Rong Chang <rongchang@chromium.org>
* dps: move disable process to dps_enable()Eric Yilun Lin2022-03-151-3/+6
| | | | | | | | | | | | | | | | Move the code to an appropriate place. BUG=none TEST=dps dis, and DUT issue a new power request BRANCH=none Change-Id: Ice41f0b77c1867c0742fc9f517089c2da879e118 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3522246 Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Reviewed-by: Rong Chang <rongchang@chromium.org> Commit-Queue: Rong Chang <rongchang@chromium.org>
* fpsensor: Tidy up fp_match_successAndrea Grandi2022-03-141-10/+4
| | | | | | | | | | | | | | Simplify logic and replace #ifdef with the compiler hint that the function might not be used in certain builds (e.g. tests). BRANCH=none BUG=b:222592305 TEST=make buildall -j Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I8091cd2bd8e2770d9aa62a80a67d654ddfea1c75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3508717 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* Revert "battery: Do not return display_soc if data is bad"Daisuke Nojiri2022-03-121-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b135e45447ba42f276b6f5232e2573d166320b31. Reason for revert: Due to its side effect. We're fixing the bug differently: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3514489/. Original change's description: > battery: Do not return display_soc if data is bad > > If BATT_FLAG_BAD_FULL_CAPACITY or BATT_FLAG_BAD_REMAINING_CAPACITY > flags are set, then display_charge value is also bad. > Return UNAVALIABLE error rather than 0%. > > BUG=b:217401040 > BRANCH=guybrush > TEST=Force battery glitch, do not observe 0% battery in OS > > Change-Id: Iea861582dde1f7db3d6a4c40e88169d7f74ca159 > Signed-off-by: Rob Barnes <robbarnes@google.com> > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3496464 > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > Reviewed-by: Diana Z <dzigterman@chromium.org> Cq-Depend:chromium:3514489 Bug: b:217401040 Change-Id: Ic0481d17e49ae275f7d85deed91f251e975e09d6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3518070 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Auto-Submit: Daisuke Nojiri <dnojiri@chromium.org>
* battery: Set EC_BATT_FLAG_INVALID_DATA correctlyDaisuke Nojiri2022-03-122-2/+2
| | | | | | | | | | | | | | | | | | | | There is a typo in the logic where EC_BATT_FLAG_INVALID_DATA is set. Because of this, currently, EC_BATT_FLAG_INVALID_DATA is reported to the host only if BATT_FLAG_BAD_CURRENT is set. BATT_FLAG_BAD_CURRENT happens to be 0x20 which is equal to EC_BATT_FLAG_INVALID_DATA. (This originates from I3c428c850020a29b3f452504b60b52946a04c503.) This patch corrects the logic by changing EC_BATT_FLAG_INVALID_DATA to BATT_FLAG_BAD_ANY. BUG=b:65697962,b:65697620 BRANCH=None TEST=None Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I7504932f078ce797daf8e5c017b7835c90220a99 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3516912 Reviewed-by: caveh jalali <caveh@chromium.org>
* usbpd: Advertise USB COMM_CAP in RDOCaveh Jalali2022-03-111-3/+25
| | | | | | | | | | | | | | | This sets the USB Communication Capable bit in packets we generate based on our ability to do USB data instead of discovered partner capabilities. BRANCH=none BUG=b:213021159 TEST=buildall passes Change-Id: Ib1704c5142835039b031399652f8a71e4753e825 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3503145 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_pd_timer: use atomic_*_bit functionsDawid Niedzwiecki2022-03-101-108/+47
| | | | | | | | | | | | | | | | | | | There are many atomic operations on the timer_active and timer_disabled variables. Change their type to atomic_t and use atomic_*_bit functions. It simplifies and unifies the bit operations. Also, the change saves memory 240-512B of FLASH depending on a board. BUG=b:208435177 TEST=zmake testall & make buildall & run faft_pd and make sure there is no regression BRANCH=none Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I880d07b2fe51b27bea1aacba884eacaede6476c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3488374 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
* Banshee:implement LED behaviorLeo-Tsai2022-03-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement side charger LED and Power breath LED behavior. Power LED: S0 - On S3 - Breath 0.5Hz - Max duty (percentage) = 55 - Fade time (second) = 550ms(In) / 550ms(Out) - Duration time (second) = 500ms - Interval time (second) = 2000ms S5 - Off Charge LED: Charge - Amber Full Charge - Green Low battery - Blink Red Battery error - Blink Red BUG=b:208182468,b:220954645 BRANCH=brya TEST=build make -j BOARD=Banshee pass, verified the side charger LED is working and s0ix can show breath LED Signed-off-by: Leo-Tsai <leocx_tsai@compal.corp-partner.google.com> Change-Id: If58fd9e123c4096c840a8e8b5009f8f1bc5ef39f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3506045 Reviewed-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* usbc: define CONFIG_AP_PWRSEQ in usbc common filesDeepti Deshatty2022-03-093-4/+4
| | | | | | | | | | | | | | | | Enable code implemented under HAS_TASK_CHIPSET in usbc common files for the platforms which defines CONFIG_AP_PWRSEQ. This change helps in USB Pd enumeration of bus powered devices. BUG=b:219891340 BRANCH=None TEST=Nivviks build is successful. Change-Id: If9ea1c5282ceefee5f4031dae06534aea9a55648 Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3476654 Reviewed-by: Andrew McRae <amcrae@google.com>
* mrbland: Disable lid detect when the base is detachedSiyu Qin2022-03-091-0/+15
| | | | | | | | | | | | | | | | According to the OEM requirement, the lid detection should be closed when the folio keyboard is detached. BUG=b:198509824 BRANCH=trogdor TEST=make BOARD=mrbland -j Change-Id: I5c595a9a85dff1107aea7b3008165c46cc6fb51f Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3499778 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* zephyr: test enabling charge state debuggingYuval Peress2022-03-091-0/+16
| | | | | | | | | | | | | | | | | Verify that the charging progress was printed. This is not 100% ideal, since it relies on an additional variable being set in order to expose whether or not the function has been called. Ideally, we'd be watching the logs in the test and verifying that the correct information was printed, but we do not yet have that capability. BRANCH=none BUG=b:221471404 TEST=zmake configure --clobber --test test-drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Iec1dd156ce7711f7550b142c528bd2374ed99258 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3501411 Reviewed-by: Sam Hurst <shurst@google.com>
* common: pwm: drop Zephyr support codeFabio Baltieri2022-03-081-23/+5
| | | | | | | | | | | | | | | This file is not used in Zephyr anymore, drop the preprocessor conditionals and partially rollback the kblight change from 3639eb8ab6, as that is not needed anymore and the original code was simpler. BRANCH=none BUG=b:217741090 TEST=make buildall Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I25b3e34f0dee19556b8f04beb16a62d40573083d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500315 Reviewed-by: Yuval Peress <peress@google.com>
* usbpd: Add source PDO vector helperCaveh Jalali2022-03-081-6/+17
| | | | | | | | | | | | | | | This moves the block of code that determines the current PDO vector into its own helper function so it can be reused. BRANCH=none BUG=b:213021159 TEST=buildall passes Change-Id: Idf86de4a592659f9d77f9875ef34fbed37c1cb5d Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3503144 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: test: Add tests for chgstate idle commandYuval Peress2022-03-071-1/+1
| | | | | | | | | | | | | | Add tests to verify both on/off cases of the idle command BRANCH=none BUG=b:221471404 TEST=zmake configure --clobber --test test-drivers Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I02ae8a70e8b1d8eddaf4c06961ad2189a1fb4cfb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500122 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* fpsensor: Fix build error in public-postsubmitAndrea Grandi2022-03-071-11/+13
| | | | | | | | | | | | | | | | | | Function fp_match_success() is wrapped around #ifdef that are not defined in certain use cases. Move the function definition outside #ifdef. BRANCH=none BUG=b:222592305 TEST=rename ./private folder to simulate public build, then run: make buildall -j Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I56c7616142054371e0c9b749bd3b3071975e55c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3500989 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Bob Moragues <moragues@chromium.org>
* dps: do not evaluate a SRC portEric Yilun Lin2022-03-041-0/+4
| | | | | | | | | | | | | | | | | If the port is connected to a DRP device, and we are sourcing the device, do not evaluate it as a power source or we might sink from the port. BUG=b:206601685 TEST=Ensure the PDO is not evaluated if the power role is SRC BRANCH=cherry Change-Id: Ia70b39d88467b2835f1903ae1c8b0af168688cd8 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3448056 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* USB: Enable port power to use IOEX pinsDiana Z2022-03-041-1/+1
| | | | | | | | | | | | | | | | | In the zephyr build, the API gpio_or_ioex_set_level() must be used to set something which may be a GPIO pin or may be an IOEX pin. BRANCH=None BUG=b:208515128 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I5817abd5f7920f958021f136d260d61077c3116b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3499292 Reviewed-by: Rob Barnes <robbarnes@google.com> Commit-Queue: Rob Barnes <robbarnes@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* fpsensor: Fix output of "fpmatch" commandAndrea Grandi2022-03-041-3/+3
| | | | | | | | | | | | | | | | | | | | | The result of the console command "fpmatch" is compared using bit-wise operation. However, the MACROs with possible outcomes are not defined as bitmask. Replace result comparison with proper function to make sure match results (yes/no) are correctly printed on the console. BRANCH=none BUG=b:141564256 TEST=On dragonclaw rev 0.2 Execute console command "fpmatch" with no fingers enrolled. Verified that match result is NO. Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I0a3a8cb9c59c466ad1f70b75415c0ef4e9e56736 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3491410 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com>
* test-drivers: Fix comparison warningsAbe Levkoy2022-03-021-1/+1
| | | | | | | | | | | | | Avoid out of range comparisons. BUG=none TEST=zmake testall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I1cdcc094e5e5a746eb43a00a0199cdfd3cae95b1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3498711 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* battery: Do not return display_soc if data is badRob Barnes2022-03-011-0/+10
| | | | | | | | | | | | | | | | If BATT_FLAG_BAD_FULL_CAPACITY or BATT_FLAG_BAD_REMAINING_CAPACITY flags are set, then display_charge value is also bad. Return UNAVALIABLE error rather than 0%. BUG=b:217401040 BRANCH=guybrush TEST=Force battery glitch, do not observe 0% battery in OS Change-Id: Iea861582dde1f7db3d6a4c40e88169d7f74ca159 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3496464 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* RGBKBD: Add RGB Keyboard taskDaisuke Nojiri2022-03-012-0/+316
| | | | | | | | | | | | | | This patch introduces a RGB keyboard task and a IS31FL3743B driver. BUG=b:203664745, b:213921985, b:199995751 BRANCH=None TEST=Vell and unit test. Change-Id: Iefc1714efca9a4dc70db5a024d1ab020ec7b69b6 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3342506 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* virtual_battery: support RunTimeToEmpty 0x11 commandEric Yilun Lin2022-03-011-0/+12
| | | | | | | | | | | | | | | | | | This command is used but unimplemented. Furthermore, enable this command in smart battery only for now, the respective gaguges should implement their functions. BUG=none TEST=EC doesn't complain "Unhandled VB reg 11" BRANCH=none Change-Id: I476968eed6300dbdecc72f3c1abe3a9c67bd852e Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3400769 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Eric Yilun Lin <yllin@google.com> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* gpio: cleanup header usage for i2cKeith Short2022-02-256-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | i2c.h only requires the enum gpio_signal, so use gpio_signal.h instead of gpio.h. The builld doesn't compare due to an ASSERT() calls in i2c-stm32f4.c because the line numbers changed. Before this change: 80068b2: f240 2332 movw r3, #562 80068b6: 48a4 ldr r0, [pc, #656] 80068b8: f7fc fb1a bl 8002ef0 <panic_assert_fail> After this change: 80068b2: f44f 730d mov.w r3, #564 80068b6: 48a4 ldr r0, [pc, #656] 80068b8: f7fc fb1a bl 8002ef0 <panic_assert_fail> BUG=b:218856245 BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0f9f428d5c575c444b9df69f71a0ed6c4b3e378c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3489094 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* gpio: cleanup header usage for chipset taskKeith Short2022-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | chipset.h only requires the enum gpio_signal, so use gpio_signal.h instead of gpio.h. The build doesn't compare due to an ASSERT() call in throttle_ap.c after the number of lines increased by 1. From prochot_input_deferred() before the change: 1009b592: 2158 movs r1, #88 ; 0x58 1009b594: f7fd ff76 bl 10099484 <panic_assert_fail> After the change 1009b592: 2159 movs r1, #89 ; 0x59 1009b594: f7fd ff76 bl 10099484 <panic_assert_fail> BUG=b:218856245 BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I30dcdec6985d51279512c25889f03b5f9b1955e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3489093 Reviewed-by: Tristan Honscheid <honscheid@google.com>
* gpio: cleanup header usage for buttonsKeith Short2022-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | button.h only requires the enum gpio_signal, so use gpio_signal.h instead of gpio.h. The build compare doesn't match due to the ASSERT() call in keyboard_vivaldi.c. The line number increases by 1, changing the assert output text. From vivaldi_init(), before the change: 21a1 movs r1, #161 ; 0xa1 f7fe f856 bl 10099484 <panic_assert_fail> After the change: 21a2 movs r1, #162 ; 0xa2 f7fe f856 bl 10099484 <panic_assert_fail> BUG=b:218856245 BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ib0aae4e7b66dd9f83071095b7db233444f6dc4be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3489092 Reviewed-by: Aaron Massey <aaronmassey@google.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>