summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* power: Fix host_command_hibernation_delay returnTomasz Michalec2021-09-031-1/+1
| | | | | | | | | | | | | | | host_command_hibernation_delay() should return enum ec_status and correct value of this type to indicate success is EC_RES_SUCCESS BUG=none BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I50902829a7ef5d09786ab81bff9d791bac0dfad6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140204 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* cometlake: Fix typo in header guardTomasz Michalec2021-09-031-1/+1
| | | | | | | | | | | | BUG=none BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I3999dbd4300eca80effed7a2d42e153c0ad59543 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140203 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: Use common I2C code in emulatorsTomasz Michalec2021-09-0319-2185/+866
| | | | | | | | | | | | | | | | | | | Align following emulators to use common I2C code: - bb_retimer - bma255 - bmi (both 160 and 260) - smart_battery - tcs3400 BUG=none BRANCH=none TEST=make configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I7515407b867487574a29dcae3456d96920a24979 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140202 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: emul: Add common code for I2C emulatorsTomasz Michalec2021-09-034-0/+807
| | | | | | | | | | | | | | | | | | Emulators of I2C devices have similar handling of I2C messages, locking mechanism for multithread code, custom user functions and user triggered failing on specific register. These functionalities are exported to common code which will replace current functions in emulators of I2C devices. BUG=none BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Ib2c1a6596127dad1250d0051a312a837fc03ce20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140201 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Chronicler: Remove config for firmware qualYu-An Chen2021-09-031-4/+0
| | | | | | | | | | | | | | | | | | 1.Remove CONFIG_SYSTEM_UNLOCKED 2.Remove CONFIG_USB_PD_DEBUG_LEVEL BUG=b:196012456 BRANCH=volteer TEST=make BOARD=chronicler -j 8 Signed-off-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Change-Id: I7c020fa9b95ce3339442a0158216d5d6ad04c863 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3102327 Tested-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Auto-Submit: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Reviewed-by: Isaac Lee <isaaclee@google.com> Commit-Queue: Isaac Lee <isaaclee@google.com>
* brask: Support cecDavid Huang2021-09-032-1/+8
| | | | | | | | | | | | | | Enable support cec function BUG=b:197474873 BRANCH=None TEST=make builadall -j Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: I6e626425853ef7261efdb8f40905ddcbfd4f48f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139615 Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Commit-Queue: Zhuohao Lee <zhuohao@chromium.org>
* tcpm: Mitigate EC RX circular buffer overflowNathan K2021-09-031-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | There are two FIFO buffers for USB-PD packet reception. One is located in TCPC, another was added in EC layer in crrev/c/1185727 . There are scenarios that may lead to overflow. In these scenarios, the EC RX circular buffer overflows without clearing the TCPC ALERT# signal. This in turn results in a tight-loop in the TCPC interrupt handler, leading to port "suspend". This CL is a reduced hotfix to mitigate this scenario. Further CL is needed to perform proper TCPCI spec-compliant overflow handling. BRANCH=none BUG=b:192382194 TEST=1. Connect CB282K via DP to G5 dock on old FW 2. Connect G5 dock to AKEMI on TCPMv1 3. Allow MST VDM:Attention communication to occur 4. Observe EC console prints via SuzyQ Change-Id: Ic579a3763fc595b8250d4ca78c3942675450295a Signed-off-by: Nathan K <nkolluru@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3135041 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* zephyr: drivers: add BB retimer test suiteTomasz Michalec2021-09-025-3/+472
| | | | | | | | | | | | | | | | bb_retimer driver is tested using BB retimer emulator. Set mode function is tested with different usb mux mode and cable configuration. BUG=b:184856919 BRANCH=none TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I106435262ccd9123c4fe3cb9063cce68d777cb84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110087 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* zephyr: Add test runner task idTomasz Michalec2021-09-023-0/+27
| | | | | | | | | | | | | | | | | Code calling task_get_current() requires to return from this function valid task ID. To test this code, new TASK_ID_TEST_RUNNER is introduced. Test can set current thread as test runner and guarantee that task_get_current() return valid task ID. BUG=b:184856919 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: Id5470e5337ab2419aad07f0f22de5f1576e870c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110086 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* brya: Move charger config from baseboard to boardDavid Huang2021-09-0219-3/+106
| | | | | | | | | | | | | | | Move charger config from baseboard to board. Change Kano charger to isl9241. BUG=none BRANCH=brya TEST=make buildall -j succeeded. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: Ia97424bbcf0654127e21c47d6834ad6c2c6163ee Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3132556 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* TBT: Correct is_cable_speed_gen2_capable functionTomasz Michalec2021-09-021-1/+1
| | | | | | | | | | | | | | | | | The is_cable_speed_gen2_capable() function should use information about PD revision instead of checking the VDM version. BUG=None BRANCH=None TEST=None Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I95a8bf977020b3756e5c82fde523c8ae29c455aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3113970 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: Add BB retimer emulatorTomasz Michalec2021-09-0220-22/+797
| | | | | | | | | | | | | | | | | | Add BB retimer emulator on i2c bus. Emulator properties can be defined using device tree or runtime emulator API. Emulator checks if RO registers and reserved bits are accessed correctly. API allows to set custom read/write i2c messagess handlers to emulate complex behaviour. BUG=b:184856919 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4b641a90e6fb55e89aaee388c0ac04ab7bf367ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3110085 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org>
* honeybuns: fix cbi write protect checkScott Collyer2021-09-021-0/+2
| | | | | | | | | | | | | | | | | | | This CL fixes the config options used to ignore the hardware write protection signal to the CBI EEPROM. Honeybuns is only using this to store the user MF prefence bit. The config option that had been used to flip the polarity of WP_L (the default write protect signal) has been removed. BRANCH=quiche BUG=b:164157329 TEST=Verfied that MF preference bit is stored in CBI. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I4f5cbe4b20dd2347e71429dadaf9f0c103b222de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139097 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* zephyr: Add Kconfig options for PS8xxx TCPCKeith Short2021-09-023-1/+29
| | | | | | | | | | | | | | | | | | Add Kconfig options CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8805 and CONFIG_PLATFORM_EC_USB_PD_TCPM_PS8815 to enable/disable the workaround for PS8805/PS8815 firmware reporting the incorrect device ID. BUG=none BRANCH=none TEST=zmake testall TEST=On herobrine, verify that "ectool pdchipinfo 0" reports a device ID 0x02. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I16367ae5276e974671b034294275104d5831df21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140325 Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* gooey: Initialize the vivaldi keyboardarthur.lin2021-09-022-0/+29
| | | | | | | | | | | | | | | | | | | Define vivaldi keybd for gooey. BRANCH=keeby BUG=b:198113136 TEST=make buildall -j Test the top row on gooey Test the Alt + VolUp + r combo on gooey Test the Esc + Refresh + Power combo on gooey Test all the other keys also Signed-off-by: arthur.lin <arthur.lin@lcfc.corp-partner.google.com> Change-Id: I359db5fcc47abd94415cb66d7ffdbf9c77a346ae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139618 Reviewed-by: Henry Sun <henrysun@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* primus: Switch GPIOB5 to USB_A_LOW_PWR_OD pin and GPIOB4 to USB_C2_OC_ODL pinTerry Chen2021-09-021-4/+4
| | | | | | | | | | | | BUG=b:198226222 BRANCH=none TEST=make -j BOARD=primus Signed-off-by: Terry Chen <terry_chen@wistron.corp-partner.google.com> Change-Id: Ibcd2bd8d8fac5efdf6816442ccb9b786dafa4f7e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3134886 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* it83xx/nds32: Ensure EXT_IER has been disabled before enabling CPU interruptDino Li2021-09-022-1/+12
| | | | | | | | | | | | | | | | | | This CL read (load operation) an EC's extended interrupt enable register one time after configured. The load operation will ensure chip-level's interrupt has been disabled before enabling CPU interrupt. This CL will also assert failure if EC get interrupt number 0 in ISR. BRANCH=dedede BUG=b:197308582 TEST=No system reboot on storo during the drop test. Change-Id: I593d78626d1e3bb92e5316d1ff78f0ee54711741 Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3124483 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* ps8xxx: Fix PD task hang if PS8xxx device is missingKeith Short2021-09-021-2/+3
| | | | | | | | | | | | | | | | | | | | CL:3084331 added logic to retry reading the PS8xxx FW version register to ensure the chip has woken up from low power mode. If the PS8xxx device is damaged/missing, there was an unbounded loop so the initialization never completed, hanging the corresponding PD task. BUG=b:198619831 BRANCH=none TEST=Verify herobrine boots AP when the battery and right I/O board are disconnected. Also observe "LPM recovery failed" reported on the console for the missing type-C port. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I578f20a9a63dd54fc777dcc0acc26a7540a1bb46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139975 Reviewed-by: Michał Barnaś <mb@semihalf.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* driver: ln9310: include status in error codeYuval Peress2021-09-021-1/+1
| | | | | | | | | | | BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I7963baa87d6edbd208fb8bad5c80866f26527748 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3138385 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* rt1718s: don't update charge_manager on supplier = NONETing Shen2021-09-021-1/+3
| | | | | | | | | | | | | | | | | Same bug as CL:3113487. charge_manager accidentally overwrites other global variable when supplier = -1. BUG=b:198552518 TEST=Add debug log in charge_manager.c, make sure charge_manager does not receive invalid arguments. BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I12787ab66fba7d8328440835867262e3828ac723 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3140013 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* it83xx/riscv: Ensure IER has been disabled before enabling CPU interruptDino Li2021-09-021-1/+9
| | | | | | | | | | | | | | | | | | | | | This CL read EC's IER one time after configured. The load operation will ensure chip-level's interrupt has been disabled before enabling CPU interrupt. BRANCH=asurada, icarus BUG=b:179206540 TEST=create stress test on it8xxx2 evb: - Loop calling task_disable_irq() and task_enable_irq() to enable and disable IRQ 13 (keyboard KSI interrupt). - Toggle KSI continuously. Without the patch, EC will hit IRQ 0 issue in two seconds. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I56bad182bd101d45b00368083b60aabbd9fb8bdb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3139652 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* zephyr: zmake: implement multiple toolchain support/probingJack Rosenthal2021-09-0130-128/+398
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our GitLab builder uses different toolchains than the supported ones we use for development. At present, this means that the GitLab CI needs to call -t for each build with the desired toolchain, preventing us from using the more general commands "zmake coverage" or "zmake testall". Extend the idea of toolchain in our config files to be "supported toolchains" instead (i.e., multiple toolchains can be supported instead of one. We do this by refactoring our toolchain support code to consist of two related methods: - "probe" returns True if the toolchain is detected on the system, or False otherwise - "get_toolchain_config" returns the BuildConfig associated with the toolchain for the system, mirroring the functionality previously implemented in lambda functions. Also dropped support for arm-none-eabi, as I believe this was only used early on during scarlet development, and am not aware of any current users. BUG=b:178731498 BRANCH=none TEST=./run_tests.sh TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I9b2ad508ae6703f0c3b56518fc32606c0ff1777c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3134668 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* kukui: Disable MFALLOW and TYPEC console commandsRob Barnes2021-09-011-0/+2
| | | | | | | | | | | | | | Disable CONFIG_CMD_MFALLOW and CONFIG_CMD_TYPEC commands to free up RO flash space on kukui boards. BUG=None TEST=Build all BRANCH=None Change-Id: I1d60355b4d1c60c848a3373ce7eadf74a1a73056 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3136037 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* coffeecake: Enable CONFIG_LTORob Barnes2021-09-011-0/+3
| | | | | | | | | | | | | Enable CONFIG_LTO to free up flash space. BUG=None TEST=Build BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I12b399005e55b004ffb312fef05484ee14fdfbad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3136036 Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver/sy21612: Fix sy21612 task signatureRob Barnes2021-09-011-2/+1
| | | | | | | | | | | | | | Tasks should have a void pointer parameter. BUG=None TEST=Build all BRANCH=None Change-Id: I6d8e289929862b60cef4901b59c78448173090ea Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3136035 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* primus: Switch FAN ID (EC) and USB_A1_RT_RST_ODL (PCH) pinTerry Chen2021-09-011-2/+2
| | | | | | | | | | | | | BUG=b:198226222 BRANCH=none TEST=make -j BOARD=primus Signed-off-by: Terry Chen <terry_chen@wistron.corp-partner.google.com> Change-Id: I39c37810e6532913bcc491519acf102da1ae76d2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3132554 Reviewed-by: Boris Mittelberg <bmbm@google.com> Tested-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* primus: Change USB C0 fast role swap GPIO pinTerry Chen2021-09-011-1/+2
| | | | | | | | | | | | | BUG=b:198226222 BRANCH=none TEST=make -j BOARD=primus Signed-off-by: Terry Chen <terry_chen@wistron.corp-partner.google.com> Change-Id: If672b3dd422713e0110a0eaf0dc63666b4434f85 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3132169 Reviewed-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* zmake: Handle -j1 correctly in coverageJeremy Bettis2021-09-011-1/+9
| | | | | | | | | | | | | | | | | If we are running zmake -j1 coverage, then wait after each job so that nothing runs in parallel. BUG=None TEST=zmake -j1 coverage BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ic709cd187414f3886bc28731f78748993bfac95e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3130624 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* it83xx/irq: there is no need to configure IER on nds32 core chipDino Li2021-09-011-2/+10
| | | | | | | | | | | | | | | Configure interrupt enable register is redundant on nds32 core chip (IT8320). We just need to configure extended IER. BRANCH=asurada, dedede BUG=b:197308582 TEST=buildall passes, storo and hayato boot. Signed-off-by: Dino Li <Dino.Li@ite.com.tw> Change-Id: I8f99f7b937ac98d95b2f50f5be7b461ae3e9a413 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3134888 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* flash_fp_mcu: Add support for HerobrineStephen Boyd2021-09-011-4/+20
| | | | | | | | | | | | | | Add the logic to find the gpios on herobrine. BUG=None BRANCH=None TEST=flash_fp_mcu on Herobrine Signed-off-by: Stephen Boyd <swboyd@chromium.org> Change-Id: I8ed4f0df41d36f279a6e1d3a4dab74063d489f0f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3135042 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org>
* anahera: Remove unnecessary functionDevin Lu2021-09-0110-355/+17
| | | | | | | | | | | | | | | | | | | | This patch removes unnecessary function as following: 1. Remove ALS. 2. Remove Accelerometers. 3. Remove PCHG. 4. Remove FAN2. 5. Remove tablet mode. BUG=none BRANCH=none TEST=make BOARD=anahera Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: I19c939d9b8359fc58cb56323e0a3e1537f4515a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3127822 Reviewed-by: Boris Mittelberg <bmbm@google.com> Reviewed-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* anahera: Add battery configurationDevin Lu2021-09-012-9/+38
| | | | | | | | | | | | | | | | | This patch adds battery configuration as following: 1. 996QA193H Simplo HIGHPOWER Battery 2. B00C407792D0001 CosMX Battery BUG=b:197998092 BRANCH=none TEST=make BOARD=anahera Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Icf7a8e14c42b19f033deec2ede6cb08d22a987b7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3127464 Reviewed-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* driver: ln9310: Update init function signature to return statusYuval Peress2021-09-012-9/+14
| | | | | | | | | | | | | | | Return the status of the init function. This will be used in testing to verify that initialization was correct. BRANCH=none BUG=b:184856083 TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I578b32b24b3ee59abf646307fb9670d2db74fe3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133624 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Reland "zmake: add NPCX monitor to output packer list"Keith Short2021-09-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reland of commit 769264c30d58e0b12795411e99e7d3efbbf78e2d. CL:3131701 removes the "zephyr" use flag, so the hatch and trogodr builders will no longer build both zephyr_ec and cros_ec images. Original change's description: > zmake: add NPCX monitor to output packer list > > Add the NPCX monitor binary to the output directory when using the NPCX > output packer. > > BUG=b:197162681 > BRANCH=none > TEST=Build zephyr for volteer, verify npcx_monitor.bin is present in the > output directory with the zephyr.bin image. > > Signed-off-by: Keith Short <keithshort@chromium.org> > Change-Id: I5ab29a797830b6870df5b86e70ebe86a62ff430b > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3122866 > Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> > Reviewed-by: Yuval Peress <peress@chromium.org> BUG=b:197162681 BRANCH=none TEST=Build zephyr for volteer, verify npcx_monitor.bin is present in the output directory with the zephyr.bin image. Cq-Include-Trybots: luci.chromeos.cq:cq-orchestrator Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Iee33430047257ab2eaf5f88252a91aca60ee60ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133466 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* cherry: Don't return error when disabling all charge portsTing Shen2021-09-011-1/+2
| | | | | | | | | | | | | | | | | | | | The line RETURN_ERROR(rt1718s_gpio_ctrl(...)) caused EC not able to turn on sink path on C0 when daughter board absent. To make C0 workable under this situation, ignore the error and print some error message instead like other boards do. BUG=b:198114418 BRANCH=none TEST=device charging when daughter board not connected Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I09941310370a60be6145e38395a4922df52c2b9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3135516 Tested-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* nipperkin: implement led behaviorZick Wei2021-09-011-53/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | nipperkin have charg leds on left side and right side, each side have two colors amber and white. The led behavior define as following: Charging led: led on with charging port active, other port is off. Charging: Amber. Discharging: Off. Battery Error: Blinking white (0.4 sec on, 0.4 sec off) Fuel < 10%: Blinking white on right side port (1 sec on, 1 sec off) Force idle for factory: Blinking amber (1 sec on, 1 sec off) System suspend with non-charging state: Blinking both side LED white (1 sec on, 1 sec off) BUG=none BRANCH=none TEST=make sure led behavior intended. make sure ectool led left white/amber/off/auto work correctly. make sure ectool led right white/amber/off/auto work correctly. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ice3d474dc98e050dc4db79a5ea903edbf807e084 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3124476 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Commit-Queue: Rob Barnes <robbarnes@google.com>
* nipperkin: config led related gpioZick Wei2021-09-011-4/+4
| | | | | | | | | | | | | | BUG=b:193395015 BRANCH=none TEST=make BOARD=nipperkin Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Iac675dde355eff9599cdbd20f22c777624033ec8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3122697 Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Rob Barnes <robbarnes@google.com>
* guybrush: move unuse/led gpio to varianetZick Wei2021-09-014-13/+44
| | | | | | | | | | | | | | | | | | Move test point and led gpio from base_gpio.inc to variant. BUG=none BRANCH=none TEST=make BOARD=guybrush, make BOARD=nipperkin, make BOARD=dewatt all pass. Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: Ic6ef1d74e1e751cbc39c2d63cd782c70f85d0644 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3122696 Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Rob Barnes <robbarnes@google.com>
* cappy2: Add battery swelling functionwangganxiang2021-09-011-2/+90
| | | | | | | | | | | | | | | | According to the spec, add the battery swelling function. BUG=b:196308789 BRANCH=keeby TEST=make BOARD=cappy2 pass After testing, consistent with the battery spec. Signed-off-by: wangganxiang <wangganxiang@huaqin.corp-partner.google.com> Change-Id: Ie8232d720a04974ccbb71c26b95fb0c0097b4a53 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3090226 Reviewed-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* kano: Remove unused taskDavid Huang2021-09-011-2/+0
| | | | | | | | | | | | | | Remove unused task USB_CHG_P2, PD_C2. BUG=none BRANCH=none TEST=make buildall -j succeeded. Signed-off-by: David Huang <david.huang@quanta.corp-partner.google.com> Change-Id: Id0182660bf1b4f69bf12d6b345c5675e7c90d9f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3132557 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* gimble: determine motion sensors by board idWill Tsai2021-09-014-3/+146
| | | | | | | | | | | | | | BUG=b:197924913 BRANCH=none TEST=make -j BOARD=gimble Signed-off-by: Will Tsai <will_tsai@wistron.corp-partner.google.com> Change-Id: I7b7f151fb692c091617d73133957e4adadfe77d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3121205 Reviewed-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-by: Boris Mittelberg <bmbm@google.com> Tested-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com>
* kappa: Remove tablet modeDevin Lu2021-09-012-2/+3
| | | | | | | | | | | | | | | Since Kappa didn't support tablet mode. Remove tablet mode to prevent unexpected triggering. BUG=none BRANCH=firmware-kukui-12573.B TEST=make BOARD=kappa Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Change-Id: Ic35832e73ba51e68933986a487f641f4f5fd94e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131327 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* usbpd: support dynamic PDO selectionEric Yilun Lin2021-09-0110-5/+773
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Support dynamic PDO selection CONFIG_USB_PD_DPS. This config controls the charging voltage and power according to the input power and battery configuration. DPS would continuously evaluate the system load and current charging voltage, and decide a new one by below: 1. If the PDO can fulfill system desired power. 2. If the PDO is efficient for the battery configuration. To detect if the system load cannot be fulfilled by the current PDO, it checks: 1. if the input current closes to the PDO current limit. 2. if the input power closes to the PDO maximum power. To detect if the system load can be fulfilled by a more efficient PDO, it checks: - if the voltage of a new PDO is closer to the battery voltage than the current PDO, and the power is able fulfill the system load. BUG=b:169532537 TEST=1. tested on asurada, the charging voltage is able to switch to different PDOs under different system loads 2. tested that the DPS is able to switch charge port (e.g. C1 12V -> C0 9V) based on the provided PDOs. BRANCH=asurada Change-Id: I7c7706b331dc0d4f8ac68569dc7ed852fc9308e3 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2897064 Tested-by: Eric Yilun Lin <yllin@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com>
* test: accel_cal: add setup/teardown methodsYuval Peress2021-08-311-3/+11
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=make buildall -j Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: I2df3668b826a0f5aef3b6ac5dc9a55dca965eea8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133801 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* npcx: Always print on eSPI bus errorRob Barnes2021-08-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The npcx eSPI driver only prints if eSPI_DEBUG is on. Without ESPI_DEBUG, critical eSPI errors are hidden and it may not be obvious why the system is failing. This change forces eSPI bus error messages to always print. This is inside of an interrupt_handler, so printing too much could cause other interrupts to be missed. The error message is short and it did not cause additional errors during testing. Since eSPI bus errors are often fatal, this risk is acceptable. BUG=None TEST=Boot image with known eSPI errors, see error message Boot with known good image, see no error message Remove condition, boot good image, eSPI functions normally BRANCH=None Change-Id: Ic1431800560091001b73dafcd77362e061323c1a Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3111457 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* STT: Don't talk to the SoC outside S0Rob Barnes2021-08-312-0/+10
| | | | | | | | | | | | | | | | STT interface is not available outside of S0, so report that the interface is not powered and allow the STT hook to exit quickly in this condition. BRANCH=None BUG=b:197745639 TEST=No STT errors with board in G3 state Change-Id: Id0c926ce896cdb4d3096746b3e7cc99db83bdd2d Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3126700 Tested-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver: ln9310: fix typoYuval Peress2021-08-312-1/+3
| | | | | | | | | | | | | | | | | | There's a bug in the chip_revision calculation. Also, add a missing include which causes a warning during build. BUG=none BRANCH=none TEST=make buildall -j Change-Id: Id636f4abcfffc0158d879d4b9333c7cb3ac1ee21 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3133800 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org> Tested-by: Yuval Peress <peress@chromium.org> Auto-Submit: Yuval Peress <peress@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zephyr: Removing unused varsJeremy Bettis2021-08-3114-31/+5
| | | | | | | | | | | | | | | | | | | zephyr toolchain doesn't allow unused vars, so this is preventing running tests on gitlab. Add -Werror=unused-variable to clang args so that this doesn't backslide. BUG=None TEST=zmake coverage on docker BRANCH=None Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I7749041fd0f09e5cf35e6a6c1d4555af805469c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3131880 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: test: drivers: add eSPI test using host commandYuval Peress2021-08-317-6/+87
| | | | | | | | | | | | | | | | | | | | Verify that we can call host commands from driver tests by adding a test that calls the EC_CMD_GET_PROTOCOL_INFO host command. Add a few convenience functions to host_command.h when building with CONFIG_ZTEST enabled. Also, add eSPI emulator to support the test. Coverage: - lines 17.4% -> 17.8% - functions 21.4% -> 22.0% BRANCH=none BUG=b:189954415 TEST=zmake configure --test zephyr/test/drivers Signed-off-by: Yuval Peress <peress@chromium.org> Change-Id: Ib9e750eeab555ea629a560cbf3beed28e346c460 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3031842 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* TCPM: Rename enum tcpm_sop_type and its constantsAbe Levkoy2021-08-3191-771/+779
| | | | | | | | | | | | | | | As a followup to CL:3104290, give the TCPCI TRANSMIT and RX_BUF_FRAME_TYPE types more consistent names. Most of them can be used for receiving, not just transmitting. Fix lint errors thus revealed. BUG=b:155476419 TEST=make buildall BRANCH=none Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: I399ec479eacc18622fc4d3f55f8bdabf4560fcff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3125995 Reviewed-by: Keith Short <keithshort@chromium.org>