summaryrefslogtreecommitdiff
path: root/zephyr
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr')
-rw-r--r--zephyr/CMakeLists.txt8
-rw-r--r--zephyr/Kconfig63
-rw-r--r--zephyr/Kconfig.adc4
-rw-r--r--zephyr/Kconfig.battery2
-rw-r--r--zephyr/Kconfig.body_detection97
-rw-r--r--zephyr/Kconfig.cbi16
-rw-r--r--zephyr/Kconfig.charger30
-rw-r--r--zephyr/Kconfig.defaults12
-rw-r--r--zephyr/Kconfig.i2c5
-rw-r--r--zephyr/Kconfig.ioex3
-rw-r--r--zephyr/Kconfig.keyboard37
-rw-r--r--zephyr/Kconfig.led5
-rw-r--r--zephyr/Kconfig.led_dt22
-rw-r--r--zephyr/Kconfig.motionsense10
-rw-r--r--zephyr/Kconfig.panic8
-rw-r--r--zephyr/Kconfig.pd23
-rw-r--r--zephyr/Kconfig.pmic4
-rw-r--r--zephyr/Kconfig.retimer4
-rw-r--r--zephyr/Kconfig.system36
-rw-r--r--zephyr/Kconfig.temperature18
-rw-r--r--zephyr/Kconfig.usb_charger2
-rw-r--r--zephyr/Kconfig.usb_mux1
-rw-r--r--zephyr/Kconfig.usba2
-rw-r--r--zephyr/Kconfig.usbc46
-rw-r--r--zephyr/app/ec/Kconfig26
-rw-r--r--zephyr/app/ec/chip/riscv/riscv-ite/it8xxx2-espi.c7
-rw-r--r--zephyr/app/ec/ec_app_main.c10
-rw-r--r--zephyr/app/ec/main_shim.c3
-rw-r--r--zephyr/boards/arm/mec1727/mec1727_defconfig4
-rw-r--r--zephyr/boards/arm/npcx7/npcx7.dts3
-rw-r--r--zephyr/boards/arm/npcx7/npcx7_defconfig4
-rw-r--r--zephyr/boards/arm/npcx9/npcx9.dtsi109
-rw-r--r--zephyr/boards/arm/npcx9/npcx9m3f_defconfig4
-rw-r--r--zephyr/boards/arm/npcx9/npcx9m7f_defconfig4
-rw-r--r--zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig8
-rw-r--r--zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig11
-rw-r--r--zephyr/boards/riscv/it8xxx2/it81202bx_defconfig4
-rw-r--r--zephyr/boards/riscv/it8xxx2/it81302bx_defconfig4
-rw-r--r--zephyr/boards/riscv/it8xxx2/it8xxx2.dts3
-rw-r--r--zephyr/cmake/compiler/clang/compiler_flags.cmake12
-rw-r--r--zephyr/cmake/compiler/clang/generic.cmake1
-rw-r--r--zephyr/cmake/compiler/gcc/compiler_flags.cmake3
-rw-r--r--zephyr/cmake/compiler/gcc/generic.cmake5
-rw-r--r--zephyr/cmake/linker/ld/clang/linker_flags.cmake7
-rw-r--r--zephyr/cmake/linker/ld/gcc/linker_flags.cmake4
-rw-r--r--zephyr/cmake/toolchain/host/generic.cmake18
-rw-r--r--zephyr/cmake/toolchain/host/target.cmake5
-rw-r--r--zephyr/cmake/toolchain/llvm/target.cmake4
-rw-r--r--zephyr/drivers/cros_displight/cros_displight.c21
-rw-r--r--zephyr/drivers/cros_flash/Kconfig4
-rw-r--r--zephyr/drivers/cros_flash/cros_flash_it8xxx2.c13
-rw-r--r--zephyr/drivers/cros_flash/cros_flash_npcx.c13
-rw-r--r--zephyr/drivers/cros_flash/cros_flash_xec.c13
-rw-r--r--zephyr/drivers/cros_kb_raw/Kconfig6
-rw-r--r--zephyr/drivers/cros_kb_raw/cros_kb_raw_ite.c17
-rw-r--r--zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c32
-rw-r--r--zephyr/drivers/cros_kb_raw/cros_kb_raw_xec.c17
-rw-r--r--zephyr/drivers/cros_kblight/pwm_kblight.c28
-rw-r--r--zephyr/drivers/cros_rtc/Kconfig14
-rw-r--r--zephyr/drivers/cros_rtc/cros_rtc_npcx.c22
-rw-r--r--zephyr/drivers/cros_rtc/cros_rtc_xec.c13
-rw-r--r--zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.c21
-rw-r--r--zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.h1
-rw-r--r--zephyr/drivers/cros_rtc/renesas_rtc_idt1337ag.c11
-rw-r--r--zephyr/drivers/cros_shi/Kconfig11
-rw-r--r--zephyr/drivers/cros_shi/cros_shi_it8xxx2.c18
-rw-r--r--zephyr/drivers/cros_shi/cros_shi_npcx.c20
-rw-r--r--zephyr/drivers/cros_system/cros_system_it8xxx2.c11
-rw-r--r--zephyr/drivers/cros_system/cros_system_native_posix.c6
-rw-r--r--zephyr/drivers/cros_system/cros_system_npcx.c17
-rw-r--r--zephyr/drivers/cros_system/cros_system_xec.c15
-rw-r--r--zephyr/dts/bindings/battery/battery-fuel-gauge.yaml2
-rw-r--r--zephyr/dts/bindings/battery/battery-info.yaml2
-rw-r--r--zephyr/dts/bindings/battery/battery-smart.yaml1
-rw-r--r--zephyr/dts/bindings/battery/cosmx,ap20cbl-2.yaml12
-rw-r--r--zephyr/dts/bindings/battery/ganfeng,sg20.yaml53
-rw-r--r--zephyr/dts/bindings/cbi/named-cbi-ssfc-value.yaml (renamed from zephyr/dts/bindings/cbi/cros-ec,cbi-ssfc-value.yaml)4
-rw-r--r--zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml (renamed from zephyr/dts/bindings/cbi/cros-ec,cbi-ssfc.yaml)10
-rw-r--r--zephyr/dts/bindings/charger/richtek,rt9490.yaml11
-rw-r--r--zephyr/dts/bindings/cros_pwr_signal/mt8186,power-signal-list.yaml (renamed from zephyr/dts/bindings/cros_pwr_signal/mediatek,mt8186-power-signal-list.yaml)2
-rw-r--r--zephyr/dts/bindings/cros_pwr_signal/mt8192,power-signal-list.yaml (renamed from zephyr/dts/bindings/cros_pwr_signal/mediatek,mt8192-power-signal-list.yaml)2
-rw-r--r--zephyr/dts/bindings/emul/cros,anx7447-tcpc.yaml (renamed from zephyr/dts/bindings/emul/cros,anx7447-tcpc-emul.yaml)2
-rw-r--r--zephyr/dts/bindings/emul/cros,bb-retimer-emul.yaml30
-rw-r--r--zephyr/dts/bindings/emul/zephyr,bma255.yaml (renamed from zephyr/dts/bindings/emul/zephyr,bma255-emul.yaml)2
-rw-r--r--zephyr/dts/bindings/emul/zephyr,bmi.yaml (renamed from zephyr/dts/bindings/emul/zephyr,bmi-emul.yaml)2
-rw-r--r--zephyr/dts/bindings/emul/zephyr,pi3usb9201-emul.yaml9
-rw-r--r--zephyr/dts/bindings/emul/zephyr,smart-battery.yaml (renamed from zephyr/dts/bindings/emul/zephyr,smart-battery-emul.yaml)2
-rw-r--r--zephyr/dts/bindings/emul/zephyr,tcs3400.yaml (renamed from zephyr/dts/bindings/emul/zephyr,tcs3400-emul.yaml)2
-rw-r--r--zephyr/dts/bindings/emul/zephyr,tusb1064.yaml (renamed from zephyr/dts/bindings/emul/zephyr,tusb1064-emul.yaml)0
-rw-r--r--zephyr/dts/bindings/fan/cros-ec,fan-steps.yaml27
-rw-r--r--zephyr/dts/bindings/fan/cros-ec,fans.yaml6
-rw-r--r--zephyr/dts/bindings/gpio/gpio-enum-name.yaml1
-rw-r--r--zephyr/dts/bindings/gpio/named-gpios.yaml5
-rw-r--r--zephyr/dts/bindings/keyboard/cros-keyscan.yaml (renamed from zephyr/dts/bindings/keyboard/cros-ec,keyscan.yaml)2
-rw-r--r--zephyr/dts/bindings/led/maxim,max695x.yaml18
-rw-r--r--zephyr/dts/bindings/led/maxim,seven-seg-display.yaml19
-rw-r--r--zephyr/dts/bindings/leds/cros-ec,gpio-led-pins.yaml19
-rw-r--r--zephyr/dts/bindings/leds/cros-ec,pwm-led-pins.yaml21
-rw-r--r--zephyr/dts/bindings/leds/cros-ec,pwm-pin-config.yaml19
-rw-r--r--zephyr/dts/bindings/power/intel,ap-pwr-signal-emul.yaml124
-rw-r--r--zephyr/dts/bindings/power/intel,ap-pwr-test-platform.yaml18
-rw-r--r--zephyr/dts/bindings/switchcap/switchcap-gpio.yaml (renamed from zephyr/dts/bindings/switchcap/cros-ec,switchcap-gpio.yaml)2
-rw-r--r--zephyr/dts/bindings/switchcap/switchcap-ln9310.yaml (renamed from zephyr/dts/bindings/switchcap/lion,ln9310.yaml)4
-rw-r--r--zephyr/dts/bindings/usbc/bc12/richtek,rt9490-bc12.yaml15
-rw-r--r--zephyr/dts/bindings/usbc/tcpc/renesas,raa489000.yaml16
-rw-r--r--zephyr/dts/board-overlays/native_posix.dts3
-rw-r--r--zephyr/dts/it8xxx2_emul.dts10
-rw-r--r--zephyr/emul/CMakeLists.txt1
-rw-r--r--zephyr/emul/Kconfig35
-rw-r--r--zephyr/emul/emul_bb_retimer.c24
-rw-r--r--zephyr/emul/emul_bma255.c17
-rw-r--r--zephyr/emul/emul_bmi.c21
-rw-r--r--zephyr/emul/emul_bmi160.c15
-rw-r--r--zephyr/emul/emul_bmi260.c15
-rw-r--r--zephyr/emul/emul_clock_control.c8
-rw-r--r--zephyr/emul/emul_common_i2c.c52
-rw-r--r--zephyr/emul/emul_flash.c16
-rw-r--r--zephyr/emul/emul_isl923x.c23
-rw-r--r--zephyr/emul/emul_kb_raw.c11
-rw-r--r--zephyr/emul/emul_lis2dw12.c19
-rw-r--r--zephyr/emul/emul_ln9310.c17
-rw-r--r--zephyr/emul/emul_pct2075.c107
-rw-r--r--zephyr/emul/emul_pi3usb9201.c10
-rw-r--r--zephyr/emul/emul_rt9490.c4
-rw-r--r--zephyr/emul/emul_rtc.c14
-rw-r--r--zephyr/emul/emul_smart_battery.c25
-rw-r--r--zephyr/emul/emul_sn5s330.c25
-rw-r--r--zephyr/emul/emul_syv682x.c19
-rw-r--r--zephyr/emul/emul_tcs3400.c17
-rw-r--r--zephyr/emul/emul_tusb1064.c4
-rw-r--r--zephyr/emul/i2c_mock.c6
-rw-r--r--zephyr/emul/pwm_mock.c6
-rw-r--r--zephyr/emul/tcpc/CMakeLists.txt1
-rw-r--r--zephyr/emul/tcpc/Kconfig16
-rw-r--r--zephyr/emul/tcpc/emul_anx7447.c15
-rw-r--r--zephyr/emul/tcpc/emul_ps8xxx.c23
-rw-r--r--zephyr/emul/tcpc/emul_tcpci.c13
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_generic.c15
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_common.c140
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_drp.c12
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c12
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_snk.c12
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_src.c14
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_vpd.c125
-rw-r--r--zephyr/fake/include/system_fake.h4
-rw-r--r--zephyr/fake/system_fake.c4
-rwxr-xr-xzephyr/firmware_builder.py76
-rw-r--r--zephyr/include/drivers/cros_flash.h2
-rw-r--r--zephyr/include/drivers/cros_kb_raw.h42
-rw-r--r--zephyr/include/drivers/cros_rtc.h2
-rw-r--r--zephyr/include/drivers/cros_shi.h2
-rw-r--r--zephyr/include/drivers/cros_system.h2
-rw-r--r--zephyr/include/dt-bindings/native-posix-gpio.h12
-rw-r--r--zephyr/include/emul/emul_isl923x.h2
-rw-r--r--zephyr/include/emul/emul_kb_raw.h2
-rw-r--r--zephyr/include/emul/emul_ln9310.h4
-rw-r--r--zephyr/include/emul/emul_pct2075.h32
-rw-r--r--zephyr/include/emul/emul_power_signals.h49
-rw-r--r--zephyr/include/emul/emul_smart_battery.h7
-rw-r--r--zephyr/include/emul/emul_syv682x.h3
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci.h5
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_common.h21
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h3
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h3
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h5
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_src.h5
-rw-r--r--zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h49
-rw-r--r--zephyr/linker/CMakeLists.txt4
-rw-r--r--zephyr/linker/end-of-ram.ld29
-rw-r--r--zephyr/mock/power.c7
-rw-r--r--zephyr/program/corsola/BUILD.py52
-rw-r--r--zephyr/program/corsola/krabby/project.overlay19
-rw-r--r--zephyr/program/corsola/magikarp/project.overlay20
-rw-r--r--zephyr/program/corsola/steelix/project.overlay298
-rw-r--r--zephyr/program/corsola/tentacruel/project.overlay21
-rw-r--r--zephyr/program/corsola/voltorb/project.conf41
-rw-r--r--zephyr/program/corsola/voltorb/project.overlay309
-rw-r--r--zephyr/program/herobrine/BUILD.py49
-rw-r--r--zephyr/program/herobrine/evoker/gpio.dtsi309
-rw-r--r--zephyr/program/herobrine/evoker/project.overlay59
-rw-r--r--zephyr/program/herobrine/herobrine/CMakeLists.txt6
-rw-r--r--zephyr/program/herobrine/herobrine/project.overlay64
-rw-r--r--zephyr/program/herobrine/hoglin/project.overlay54
-rw-r--r--zephyr/program/herobrine/villager/project.overlay33
-rw-r--r--zephyr/program/herobrine/zoglin/project.overlay6
-rw-r--r--zephyr/program/herobrine/zombie/project.overlay30
-rw-r--r--zephyr/program/nissa/craask/fan.dtsi38
-rw-r--r--zephyr/program/nissa/craask/keyboard.dtsi54
-rw-r--r--zephyr/program/nissa/craask/project.overlay15
-rw-r--r--zephyr/program/nissa/craask/src/kb_backlight.c34
-rw-r--r--zephyr/program/nissa/craask/src/keyboard.c45
-rw-r--r--zephyr/program/nissa/nivviks/overlay.dtsi439
-rw-r--r--zephyr/program/nissa/nivviks/src/fan.c42
-rw-r--r--zephyr/program/nissa/nivviks/src/form_factor.c46
-rw-r--r--zephyr/program/nissa/xivu/motionsense.dtsi252
-rw-r--r--zephyr/program/nissa/xivu/project.conf25
-rw-r--r--zephyr/program/nissa/xivu/src/form_factor.c78
-rw-r--r--zephyr/program/nissa/xivu/src/usbc.c343
-rw-r--r--zephyr/program/nissa/xivur/cbi.dtsi30
-rw-r--r--zephyr/program/nissa/xivur/generated.dtsi291
-rw-r--r--zephyr/program/nissa/xivur/keyboard.dtsi48
-rw-r--r--zephyr/program/nissa/xivur/power_signals.dtsi220
-rw-r--r--zephyr/program/nissa/xivur/pwm_leds.dtsi62
-rw-r--r--zephyr/program/nissa/xivur/src/charger.c56
-rw-r--r--zephyr/program/nissa/xivur/src/led.c51
-rw-r--r--zephyr/program/nissa/yaviks/fan.dtsi71
-rw-r--r--zephyr/program/nissa/yaviks/src/fan.c37
-rw-r--r--zephyr/program/nissa/yaviks/src/thermal.c108
-rw-r--r--zephyr/program/skyrim/BUILD.py48
-rw-r--r--zephyr/program/skyrim/CMakeLists.txt43
-rw-r--r--zephyr/program/skyrim/crystaldrift/CMakeLists.txt12
-rw-r--r--zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi209
-rw-r--r--zephyr/program/skyrim/crystaldrift/project.conf26
-rw-r--r--zephyr/program/skyrim/crystaldrift/project.overlay19
-rw-r--r--zephyr/program/skyrim/crystaldrift/src/alt_charger.c31
-rw-r--r--zephyr/program/skyrim/crystaldrift/src/fan.c62
-rw-r--r--zephyr/program/skyrim/crystaldrift/src/form_factor.c38
-rw-r--r--zephyr/program/skyrim/crystaldrift/src/ppc_config.c46
-rw-r--r--zephyr/program/skyrim/frostflow/CMakeLists.txt15
-rw-r--r--zephyr/program/skyrim/frostflow/frostflow.dtsi223
-rw-r--r--zephyr/program/skyrim/frostflow/motionsense.dtsi135
-rw-r--r--zephyr/program/skyrim/frostflow/project.overlay19
-rw-r--r--zephyr/program/skyrim/frostflow/src/thermal.c109
-rw-r--r--zephyr/program/skyrim/frostflow/src/usb_mux_config.c62
-rw-r--r--zephyr/program/skyrim/include/keyboard_customization.h78
-rw-r--r--zephyr/program/skyrim/morthal/CMakeLists.txt8
-rw-r--r--zephyr/program/skyrim/morthal/motionsense.dtsi135
-rw-r--r--zephyr/program/skyrim/morthal/project.overlay19
-rw-r--r--zephyr/program/skyrim/motionsense.dtsi135
-rw-r--r--zephyr/program/skyrim/skyrim/CMakeLists.txt13
-rw-r--r--zephyr/program/skyrim/skyrim/led_policy.dtsi103
-rw-r--r--zephyr/program/skyrim/skyrim/motionsense.dtsi135
-rw-r--r--zephyr/program/skyrim/skyrim/project.overlay19
-rw-r--r--zephyr/program/skyrim/skyrim/skyrim_vif.xml346
-rw-r--r--zephyr/program/skyrim/winterhold/CMakeLists.txt12
-rw-r--r--zephyr/program/skyrim/winterhold/led_pins.dtsi59
-rw-r--r--zephyr/program/skyrim/winterhold/project.conf47
-rw-r--r--zephyr/program/skyrim/winterhold/project.overlay19
-rw-r--r--zephyr/program/skyrim/winterhold/src/battery_present.c81
-rw-r--r--zephyr/program/skyrim/winterhold/src/sensor.c37
-rw-r--r--zephyr/projects/.pylintrc (renamed from zephyr/program/.pylintrc)0
-rw-r--r--zephyr/projects/brya/BUILD.py (renamed from zephyr/program/brya/BUILD.py)0
-rw-r--r--zephyr/projects/brya/CMakeLists.txt (renamed from zephyr/program/brya/CMakeLists.txt)0
-rw-r--r--zephyr/projects/brya/Kconfig (renamed from zephyr/program/brya/Kconfig)0
-rw-r--r--zephyr/projects/brya/adc.dts (renamed from zephyr/program/brya/adc.dts)0
-rw-r--r--zephyr/projects/brya/battery.dts (renamed from zephyr/program/brya/battery.dts)0
-rw-r--r--zephyr/projects/brya/battery_present.c (renamed from zephyr/program/brya/battery_present.c)4
-rw-r--r--zephyr/projects/brya/brya.dts (renamed from zephyr/program/brya/brya.dts)0
-rw-r--r--zephyr/projects/brya/fan.dts (renamed from zephyr/program/brya/fan.dts)0
-rw-r--r--zephyr/projects/brya/gpio.dts (renamed from zephyr/program/brya/gpio.dts)0
-rw-r--r--zephyr/projects/brya/i2c.dts (renamed from zephyr/program/brya/i2c.dts)3
-rw-r--r--zephyr/projects/brya/interrupts.dts (renamed from zephyr/program/brya/interrupts.dts)0
-rw-r--r--zephyr/projects/brya/kblight_hooks.c (renamed from zephyr/program/brya/kblight_hooks.c)8
-rw-r--r--zephyr/projects/brya/keyboard.dts (renamed from zephyr/program/brya/keyboard.dts)0
-rw-r--r--zephyr/projects/brya/motionsense.dts (renamed from zephyr/program/brya/motionsense.dts)0
-rw-r--r--zephyr/projects/brya/prj.conf (renamed from zephyr/program/brya/prj.conf)27
-rw-r--r--zephyr/projects/brya/prj_brya.conf (renamed from zephyr/program/brya/prj_brya.conf)0
-rw-r--r--zephyr/projects/brya/pwm_leds.dts (renamed from zephyr/program/brya/pwm_leds.dts)0
-rw-r--r--zephyr/projects/brya/temp_sensors.dts (renamed from zephyr/program/brya/temp_sensors.dts)0
-rw-r--r--zephyr/projects/brya/usbc.dts (renamed from zephyr/program/brya/usbc.dts)0
-rw-r--r--zephyr/projects/corsola/BUILD.py139
-rw-r--r--zephyr/projects/corsola/CMakeLists.txt (renamed from zephyr/program/corsola/CMakeLists.txt)9
-rw-r--r--zephyr/projects/corsola/Kconfig (renamed from zephyr/program/corsola/Kconfig)6
-rw-r--r--zephyr/projects/corsola/adc_kingler.dts (renamed from zephyr/program/corsola/npcx_adc.dtsi)0
-rw-r--r--zephyr/projects/corsola/adc_krabby.dts (renamed from zephyr/program/corsola/ite_adc.dtsi)0
-rw-r--r--zephyr/projects/corsola/adc_magikarp.dts (renamed from zephyr/program/corsola/adc_magikarp.dtsi)0
-rw-r--r--zephyr/projects/corsola/adc_tentacruel.dts (renamed from zephyr/program/corsola/adc_tentacruel.dtsi)8
-rw-r--r--zephyr/projects/corsola/battery_kingler.dts15
-rw-r--r--zephyr/projects/corsola/battery_krabby.dts (renamed from zephyr/program/corsola/battery_krabby.dtsi)0
-rw-r--r--zephyr/projects/corsola/battery_magikarp.dts (renamed from zephyr/program/corsola/battery_magikarp.dtsi)0
-rw-r--r--zephyr/projects/corsola/battery_steelix.dts24
-rw-r--r--zephyr/projects/corsola/battery_tentacruel.dts (renamed from zephyr/program/corsola/battery_tentacruel.dtsi)0
-rw-r--r--zephyr/projects/corsola/cbi_magikarp.dts (renamed from zephyr/program/corsola/cbi_magikarp.dtsi)0
-rw-r--r--zephyr/projects/corsola/cbi_steelix.dts (renamed from zephyr/program/corsola/steelix/cbi.dtsi)10
-rw-r--r--zephyr/projects/corsola/cbi_tentacruel.dts (renamed from zephyr/program/corsola/cbi_tentacruel.dtsi)0
-rw-r--r--zephyr/projects/corsola/common.dts (renamed from zephyr/program/corsola/common.dtsi)0
-rw-r--r--zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts (renamed from zephyr/program/corsola/npcx_default_gpio_pinctrl.dtsi)0
-rw-r--r--zephyr/projects/corsola/gpio_kingler.dts (renamed from zephyr/program/corsola/npcx_gpio.dtsi)0
-rw-r--r--zephyr/projects/corsola/gpio_krabby.dts (renamed from zephyr/program/corsola/ite_gpio.dtsi)0
-rw-r--r--zephyr/projects/corsola/gpio_magikarp.dts (renamed from zephyr/program/corsola/gpio_magikarp.dtsi)0
-rw-r--r--zephyr/projects/corsola/gpio_steelix.dts255
-rw-r--r--zephyr/projects/corsola/gpio_tentacruel.dts (renamed from zephyr/program/corsola/gpio_tentacruel.dtsi)0
-rw-r--r--zephyr/projects/corsola/host_interface_npcx.dts (renamed from zephyr/program/trogdor/lazor/host_interface_npcx.dts)0
-rw-r--r--zephyr/projects/corsola/i2c_kingler.dts (renamed from zephyr/program/corsola/npcx_i2c.dtsi)0
-rw-r--r--zephyr/projects/corsola/i2c_krabby.dts (renamed from zephyr/program/corsola/i2c_krabby.dtsi)5
-rw-r--r--zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi (renamed from zephyr/program/corsola/ite_i2c.dtsi)7
-rw-r--r--zephyr/projects/corsola/i2c_magikarp.dts (renamed from zephyr/program/corsola/i2c_magikarp.dtsi)5
-rw-r--r--zephyr/projects/corsola/i2c_tentacruel.dts (renamed from zephyr/program/corsola/i2c_tentacruel.dtsi)5
-rw-r--r--zephyr/projects/corsola/include/baseboard_usbc_config.h (renamed from zephyr/program/corsola/include/baseboard_usbc_config.h)3
-rw-r--r--zephyr/projects/corsola/include/variant_db_detection.h (renamed from zephyr/program/corsola/include/variant_db_detection.h)4
-rw-r--r--zephyr/projects/corsola/interrupts_kingler.dts (renamed from zephyr/program/corsola/npcx_interrupts.dtsi)0
-rw-r--r--zephyr/projects/corsola/interrupts_krabby.dts (renamed from zephyr/program/corsola/ite_interrupts.dtsi)0
-rw-r--r--zephyr/projects/corsola/interrupts_magikarp.dts (renamed from zephyr/program/corsola/interrupts_magikarp.dtsi)0
-rw-r--r--zephyr/projects/corsola/interrupts_steelix.dts (renamed from zephyr/program/corsola/steelix/interrupts.dtsi)2
-rw-r--r--zephyr/projects/corsola/interrupts_tentacruel.dts (renamed from zephyr/program/corsola/interrupts_tentacruel.dtsi)0
-rw-r--r--zephyr/projects/corsola/keyboard_steelix.dts (renamed from zephyr/program/corsola/ite_keyboard.dtsi)5
-rw-r--r--zephyr/projects/corsola/led_it81202_base.dtsi (renamed from zephyr/program/corsola/led_it81202_base.dtsi)40
-rw-r--r--zephyr/projects/corsola/led_kingler.dts (renamed from zephyr/program/corsola/kingler/project.overlay)25
-rw-r--r--zephyr/projects/corsola/led_krabby.dts (renamed from zephyr/program/corsola/led_krabby.dtsi)0
-rw-r--r--zephyr/projects/corsola/led_magikarp.dts (renamed from zephyr/program/corsola/led_magikarp.dtsi)5
-rw-r--r--zephyr/projects/corsola/led_steelix.dts55
-rw-r--r--zephyr/projects/corsola/led_tentacruel.dts (renamed from zephyr/program/corsola/led_tentacruel.dtsi)5
-rw-r--r--zephyr/projects/corsola/motionsense_kingler.dts (renamed from zephyr/program/corsola/npcx_motionsense.dtsi)0
-rw-r--r--zephyr/projects/corsola/motionsense_krabby.dts (renamed from zephyr/program/corsola/ite_motionsense.dtsi)0
-rw-r--r--zephyr/projects/corsola/motionsense_magikarp.dts (renamed from zephyr/program/corsola/motionsense_magikarp.dtsi)0
-rw-r--r--zephyr/projects/corsola/motionsense_steelix.dts (renamed from zephyr/program/skyrim/winterhold/motionsense.dtsi)103
-rw-r--r--zephyr/projects/corsola/motionsense_tentacruel.dts (renamed from zephyr/program/corsola/motionsense_tentacruel.dtsi)0
-rw-r--r--zephyr/projects/corsola/npcx_keyboard.dts (renamed from zephyr/program/corsola/npcx_keyboard.dtsi)0
-rw-r--r--zephyr/projects/corsola/power_signal.dts (renamed from zephyr/program/corsola/power_signal.dtsi)2
-rw-r--r--zephyr/projects/corsola/prj.conf (renamed from zephyr/program/corsola/program.conf)13
-rw-r--r--zephyr/projects/corsola/prj_it81202_base.conf (renamed from zephyr/program/corsola/ite_program.conf)8
-rw-r--r--zephyr/projects/corsola/prj_kingler.conf (renamed from zephyr/program/corsola/kingler/project.conf)3
-rw-r--r--zephyr/projects/corsola/prj_krabby.conf (renamed from zephyr/program/corsola/krabby/project.conf)0
-rw-r--r--zephyr/projects/corsola/prj_magikarp.conf (renamed from zephyr/program/corsola/magikarp/project.conf)5
-rw-r--r--zephyr/projects/corsola/prj_npcx993_base.conf (renamed from zephyr/program/corsola/npcx_program.conf)11
-rw-r--r--zephyr/projects/corsola/prj_steelix.conf (renamed from zephyr/program/corsola/steelix/project.conf)4
-rw-r--r--zephyr/projects/corsola/prj_tentacruel.conf (renamed from zephyr/program/corsola/tentacruel/project.conf)5
-rw-r--r--zephyr/projects/corsola/src/board.c (renamed from zephyr/program/corsola/src/board.c)3
-rw-r--r--zephyr/projects/corsola/src/board_chipset.c (renamed from zephyr/program/corsola/src/board_chipset.c)6
-rw-r--r--zephyr/projects/corsola/src/hibernate.c (renamed from zephyr/program/corsola/src/hibernate.c)4
-rw-r--r--zephyr/projects/corsola/src/kingler/board_steelix.c (renamed from zephyr/program/corsola/src/kingler/board_steelix.c)6
-rw-r--r--zephyr/projects/corsola/src/kingler/button.c (renamed from zephyr/program/corsola/src/kingler/button.c)0
-rw-r--r--zephyr/projects/corsola/src/kingler/i2c.c (renamed from zephyr/program/corsola/src/kingler/i2c.c)2
-rw-r--r--zephyr/projects/corsola/src/kingler/led.c (renamed from zephyr/program/corsola/src/kingler/led.c)0
-rw-r--r--zephyr/projects/corsola/src/kingler/led_steelix.c (renamed from zephyr/program/corsola/src/kingler/led_steelix.c)6
-rw-r--r--zephyr/projects/corsola/src/kingler/usb_pd_policy.c (renamed from zephyr/program/corsola/src/kingler/usb_pd_policy.c)3
-rw-r--r--zephyr/projects/corsola/src/kingler/usbc_config.c (renamed from zephyr/program/corsola/src/kingler/usbc_config.c)22
-rw-r--r--zephyr/projects/corsola/src/krabby/charger_workaround.c (renamed from zephyr/program/corsola/src/krabby/charger_workaround.c)4
-rw-r--r--zephyr/projects/corsola/src/krabby/hooks.c (renamed from zephyr/program/corsola/src/krabby/hooks.c)11
-rw-r--r--zephyr/projects/corsola/src/krabby/i2c.c (renamed from zephyr/program/corsola/src/krabby/i2c.c)2
-rw-r--r--zephyr/projects/corsola/src/krabby/keyboard_magikarp.c (renamed from zephyr/program/corsola/src/krabby/keyboard_magikarp.c)0
-rw-r--r--zephyr/projects/corsola/src/krabby/ppc_krabby.c (renamed from zephyr/program/corsola/src/krabby/ppc_krabby.c)2
-rw-r--r--zephyr/projects/corsola/src/krabby/ppc_magikarp.c (renamed from zephyr/program/corsola/src/krabby/ppc_magikarp.c)0
-rw-r--r--zephyr/projects/corsola/src/krabby/ppc_tentacruel.c (renamed from zephyr/program/corsola/src/krabby/ppc_tentacruel.c)0
-rw-r--r--zephyr/projects/corsola/src/krabby/sensor_magikarp.c (renamed from zephyr/program/corsola/src/krabby/sensor_magikarp.c)2
-rw-r--r--zephyr/projects/corsola/src/krabby/sensor_tentacruel.c (renamed from zephyr/program/corsola/src/krabby/sensor_tentacruel.c)2
-rw-r--r--zephyr/projects/corsola/src/krabby/temp_tentacruel.c (renamed from zephyr/program/corsola/src/krabby/temp_tentacruel.c)6
-rw-r--r--zephyr/projects/corsola/src/krabby/usb_pd_policy.c (renamed from zephyr/program/corsola/src/krabby/usb_pd_policy.c)0
-rw-r--r--zephyr/projects/corsola/src/krabby/usbc_config.c (renamed from zephyr/program/corsola/src/krabby/usbc_config.c)11
-rw-r--r--zephyr/projects/corsola/src/usb_pd_policy.c (renamed from zephyr/program/corsola/src/usb_pd_policy.c)5
-rw-r--r--zephyr/projects/corsola/src/usbc_config.c (renamed from zephyr/program/corsola/src/usbc_config.c)128
-rw-r--r--zephyr/projects/corsola/src/variant_db_detection.c (renamed from zephyr/program/corsola/src/variant_db_detection.c)101
-rw-r--r--zephyr/projects/corsola/thermistor_tentacruel.dts (renamed from zephyr/program/corsola/thermistor_tentacruel.dtsi)0
-rw-r--r--zephyr/projects/corsola/usba.dts (renamed from zephyr/program/corsola/usba.dtsi)0
-rw-r--r--zephyr/projects/corsola/usba_steelix.dts10
-rw-r--r--zephyr/projects/corsola/usbc_kingler.dts (renamed from zephyr/program/corsola/npcx_usbc.dtsi)0
-rw-r--r--zephyr/projects/corsola/usbc_krabby.dts (renamed from zephyr/program/corsola/ite_usbc.dtsi)4
-rw-r--r--zephyr/projects/corsola/usbc_magikarp.dts (renamed from zephyr/program/corsola/usbc_magikarp.dtsi)4
-rw-r--r--zephyr/projects/corsola/usbc_tentacruel.dts (renamed from zephyr/program/corsola/usbc_tentacruel.dtsi)4
-rw-r--r--zephyr/projects/herobrine/BUILD.py124
-rw-r--r--zephyr/projects/herobrine/CMakeLists.txt (renamed from zephyr/program/herobrine/CMakeLists.txt)3
-rw-r--r--zephyr/projects/herobrine/Kconfig (renamed from zephyr/program/herobrine/Kconfig)0
-rw-r--r--zephyr/projects/herobrine/adc.dts (renamed from zephyr/program/herobrine/adc.dtsi)0
-rw-r--r--zephyr/projects/herobrine/battery_evoker.dts15
-rw-r--r--zephyr/projects/herobrine/battery_herobrine.dts12
-rw-r--r--zephyr/projects/herobrine/battery_hoglin.dts12
-rw-r--r--zephyr/projects/herobrine/battery_villager.dts (renamed from zephyr/program/skyrim/crystaldrift/battery.dtsi)8
-rw-r--r--zephyr/projects/herobrine/battery_zombie.dts15
-rw-r--r--zephyr/projects/herobrine/common.dts (renamed from zephyr/program/herobrine/common.dtsi)0
-rw-r--r--zephyr/projects/herobrine/default_gpio_pinctrl.dts (renamed from zephyr/program/herobrine/default_gpio_pinctrl.dtsi)0
-rw-r--r--zephyr/projects/herobrine/display.dts (renamed from zephyr/program/trogdor/lazor/display.dts)0
-rw-r--r--zephyr/projects/herobrine/gpio.dts (renamed from zephyr/program/herobrine/gpio.dtsi)14
-rw-r--r--zephyr/projects/herobrine/gpio_evoker.dts329
-rw-r--r--zephyr/projects/herobrine/gpio_hoglin.dts (renamed from zephyr/program/herobrine/hoglin/gpio.dtsi)10
-rw-r--r--zephyr/projects/herobrine/gpio_villager.dts (renamed from zephyr/program/herobrine/villager/gpio.dtsi)10
-rw-r--r--zephyr/projects/herobrine/gpio_zombie.dts (renamed from zephyr/program/herobrine/zombie/gpio.dtsi)10
-rw-r--r--zephyr/projects/herobrine/i2c_common.dtsi (renamed from zephyr/program/herobrine/i2c.dtsi)24
-rw-r--r--zephyr/projects/herobrine/i2c_evoker.dts46
-rw-r--r--zephyr/projects/herobrine/i2c_herobrine.dts39
-rw-r--r--zephyr/projects/herobrine/i2c_hoglin.dts34
-rw-r--r--zephyr/projects/herobrine/i2c_villager.dts34
-rw-r--r--zephyr/projects/herobrine/i2c_zombie.dts34
-rw-r--r--zephyr/projects/herobrine/include/board_chipset.h (renamed from zephyr/program/herobrine/include/board_chipset.h)2
-rw-r--r--zephyr/projects/herobrine/interrupts.dts (renamed from zephyr/program/herobrine/interrupts.dtsi)0
-rw-r--r--zephyr/projects/herobrine/keyboard.dts (renamed from zephyr/program/herobrine/keyboard.dtsi)0
-rw-r--r--zephyr/projects/herobrine/led_pins_evoker.dts (renamed from zephyr/program/herobrine/evoker/led_pins.dtsi)38
-rw-r--r--zephyr/projects/herobrine/led_pins_herobrine.dts (renamed from zephyr/program/herobrine/herobrine/led_pins.dtsi)30
-rw-r--r--zephyr/projects/herobrine/led_pins_hoglin.dts (renamed from zephyr/program/herobrine/hoglin/led_pins.dtsi)15
-rw-r--r--zephyr/projects/herobrine/led_pins_villager.dts (renamed from zephyr/program/herobrine/villager/led_pins.dtsi)15
-rw-r--r--zephyr/projects/herobrine/led_pins_zombie.dts (renamed from zephyr/program/herobrine/zombie/led_pins.dtsi)15
-rw-r--r--zephyr/projects/herobrine/led_policy_evoker.dts (renamed from zephyr/program/herobrine/evoker/led_policy.dtsi)0
-rw-r--r--zephyr/projects/herobrine/led_policy_herobrine.dts (renamed from zephyr/program/herobrine/herobrine/led_policy.dtsi)0
-rw-r--r--zephyr/projects/herobrine/led_policy_hoglin.dts (renamed from zephyr/program/herobrine/hoglin/led_policy.dtsi)0
-rw-r--r--zephyr/projects/herobrine/led_policy_villager.dts (renamed from zephyr/program/herobrine/villager/led_policy.dtsi)0
-rw-r--r--zephyr/projects/herobrine/led_policy_zombie.dts (renamed from zephyr/program/herobrine/zombie/led_policy.dtsi)0
-rw-r--r--zephyr/projects/herobrine/motionsense.dts (renamed from zephyr/program/herobrine/motionsense.dtsi)0
-rw-r--r--zephyr/projects/herobrine/motionsense_evoker.dts (renamed from zephyr/program/herobrine/evoker/motionsense.dtsi)0
-rw-r--r--zephyr/projects/herobrine/motionsense_hoglin.dts (renamed from zephyr/program/herobrine/hoglin/motionsense.dtsi)0
-rw-r--r--zephyr/projects/herobrine/motionsense_villager.dts (renamed from zephyr/program/herobrine/villager/motionsense.dtsi)0
-rw-r--r--zephyr/projects/herobrine/motionsense_zombie.dts (renamed from zephyr/program/herobrine/zombie/motionsense.dtsi)0
-rw-r--r--zephyr/projects/herobrine/prj.conf (renamed from zephyr/program/herobrine/program.conf)22
-rw-r--r--zephyr/projects/herobrine/prj_evoker.conf (renamed from zephyr/program/herobrine/evoker/project.conf)8
-rw-r--r--zephyr/projects/herobrine/prj_herobrine.conf (renamed from zephyr/program/herobrine/herobrine/project.conf)0
-rw-r--r--zephyr/projects/herobrine/prj_hoglin.conf (renamed from zephyr/program/herobrine/hoglin/project.conf)0
-rw-r--r--zephyr/projects/herobrine/prj_villager.conf (renamed from zephyr/program/herobrine/villager/project.conf)0
-rw-r--r--zephyr/projects/herobrine/prj_zoglin.conf (renamed from zephyr/program/herobrine/zoglin/project.conf)0
-rw-r--r--zephyr/projects/herobrine/prj_zombie.conf (renamed from zephyr/program/herobrine/zombie/project.conf)0
-rw-r--r--zephyr/projects/herobrine/src/board_chipset.c (renamed from zephyr/program/herobrine/src/board_chipset.c)5
-rw-r--r--zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c (renamed from zephyr/program/herobrine/herobrine/src/alt_dev_replacement.c)7
-rw-r--r--zephyr/projects/herobrine/src/i2c.c (renamed from zephyr/program/herobrine/src/i2c.c)2
-rw-r--r--zephyr/projects/herobrine/src/usb_pd_policy.c (renamed from zephyr/program/herobrine/src/usb_pd_policy.c)4
-rw-r--r--zephyr/projects/herobrine/src/usbc_config.c (renamed from zephyr/program/herobrine/src/usbc_config.c)24
-rw-r--r--zephyr/projects/herobrine/switchcap.dts (renamed from zephyr/program/herobrine/switchcap.dtsi)2
-rw-r--r--zephyr/projects/herobrine/switchcap_hoglin.dts (renamed from zephyr/test/system_shim/default.overlay)8
-rw-r--r--zephyr/projects/herobrine/usbc_evoker.dts (renamed from zephyr/program/herobrine/usbc.dtsi)4
-rw-r--r--zephyr/projects/herobrine/usbc_herobrine.dts43
-rw-r--r--zephyr/projects/herobrine/usbc_hoglin.dts42
-rw-r--r--zephyr/projects/herobrine/usbc_villager.dts42
-rw-r--r--zephyr/projects/herobrine/usbc_zombie.dts42
-rw-r--r--zephyr/projects/intelrvp/BUILD.py (renamed from zephyr/program/intelrvp/BUILD.py)0
-rw-r--r--zephyr/projects/intelrvp/CMakeLists.txt (renamed from zephyr/program/intelrvp/CMakeLists.txt)0
-rw-r--r--zephyr/projects/intelrvp/Kconfig (renamed from zephyr/program/intelrvp/Kconfig)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/CMakeLists.txt (renamed from zephyr/program/intelrvp/adlrvp/CMakeLists.txt)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/adlrvp_mchp.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/adlrvp_mchp.dts)5
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/bb_retimer.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/bb_retimer.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/gpio.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/gpio.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/interrupts.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/interrupts.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/keyboard.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/keyboard.dts)2
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/prj.conf (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/prj.conf)9
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/usbc.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_mchp/usbc.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/adlrvp_npcx.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/adlrvp_npcx.dts)5
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/fan.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/gpio.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/gpio.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/interrupts.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/interrupts.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/keyboard.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/keyboard.dts)2
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/prj.conf (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/prj.conf)11
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm_leds.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/pwm_leds.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/temp_sensor.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/temp_sensor.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/usbc.dts (renamed from zephyr/program/intelrvp/adlrvp/adlrvp_npcx/usbc.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/battery.dts (renamed from zephyr/program/intelrvp/adlrvp/battery.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/include/adlrvp_zephyr.h (renamed from zephyr/program/intelrvp/adlrvp/include/adlrvp_zephyr.h)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/ioex.dts (renamed from zephyr/program/intelrvp/adlrvp/ioex.dts)0
-rw-r--r--zephyr/projects/intelrvp/adlrvp/prj.conf (renamed from zephyr/program/intelrvp/adlrvp/prj.conf)12
-rw-r--r--zephyr/projects/intelrvp/adlrvp/src/adlrvp.c (renamed from zephyr/program/intelrvp/adlrvp/src/adlrvp.c)14
-rw-r--r--zephyr/projects/intelrvp/include/intel_rvp_board_id.h (renamed from zephyr/program/intelrvp/include/intel_rvp_board_id.h)0
-rw-r--r--zephyr/projects/intelrvp/include/intelrvp.h (renamed from zephyr/program/intelrvp/include/intelrvp.h)0
-rw-r--r--zephyr/projects/intelrvp/led.md (renamed from zephyr/program/intelrvp/led.md)0
-rw-r--r--zephyr/projects/intelrvp/legacy_ec_pwrseq.conf (renamed from zephyr/program/intelrvp/legacy_ec_pwrseq.conf)0
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/CMakeLists.txt (renamed from zephyr/program/intelrvp/mtlrvp/CMakeLists.txt)0
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/ioex.dts (renamed from zephyr/program/intelrvp/mtlrvp/ioex.dts)0
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/fan.dts (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/fan.dts)0
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/gpio.dts (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/gpio.dts)0
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/interrupts.dts (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/interrupts.dts)5
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/keyboard.dts (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/keyboard.dts)2
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx.dts (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx.dts)9
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx_power_signals.dts (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx_power_signals.dts)0
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/prj.conf (renamed from zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/prj.conf)10
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/prj.conf (renamed from zephyr/program/intelrvp/mtlrvp/prj.conf)13
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/src/board_power.c (renamed from zephyr/program/intelrvp/mtlrvp/src/board_power.c)10
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/src/mtlrvp.c (renamed from zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c)5
-rw-r--r--zephyr/projects/intelrvp/mtlrvp/usbc.dts (renamed from zephyr/program/intelrvp/mtlrvp/usbc.dts)0
-rw-r--r--zephyr/projects/intelrvp/prj.conf (renamed from zephyr/program/intelrvp/prj.conf)10
-rw-r--r--zephyr/projects/intelrvp/src/chg_usb_pd.c (renamed from zephyr/program/intelrvp/src/chg_usb_pd.c)7
-rw-r--r--zephyr/projects/intelrvp/src/chg_usb_pd_mecc_1_1.c (renamed from zephyr/program/intelrvp/src/chg_usb_pd_mecc_1_1.c)0
-rw-r--r--zephyr/projects/intelrvp/src/intel_rvp_board_id.c (renamed from zephyr/program/intelrvp/src/intel_rvp_board_id.c)3
-rw-r--r--zephyr/projects/intelrvp/src/intel_rvp_led.c (renamed from zephyr/program/intelrvp/src/intel_rvp_led.c)0
-rw-r--r--zephyr/projects/intelrvp/src/intelrvp.c (renamed from zephyr/program/intelrvp/src/intelrvp.c)0
-rw-r--r--zephyr/projects/intelrvp/src/usb_pd_policy_mecc_1_1.c (renamed from zephyr/program/intelrvp/src/usb_pd_policy_mecc_1_1.c)0
-rw-r--r--zephyr/projects/intelrvp/zephyr_ap_pwrseq.conf (renamed from zephyr/program/intelrvp/zephyr_ap_pwrseq.conf)1
-rw-r--r--zephyr/projects/it8xxx2_evb/BUILD.py (renamed from zephyr/program/it8xxx2_evb/BUILD.py)0
-rw-r--r--zephyr/projects/it8xxx2_evb/CMakeLists.txt (renamed from zephyr/program/it8xxx2_evb/CMakeLists.txt)0
-rw-r--r--zephyr/projects/it8xxx2_evb/adc.dts (renamed from zephyr/program/it8xxx2_evb/adc.dts)0
-rw-r--r--zephyr/projects/it8xxx2_evb/fan.dts (renamed from zephyr/program/it8xxx2_evb/fan.dts)0
-rw-r--r--zephyr/projects/it8xxx2_evb/gpio.dts (renamed from zephyr/program/it8xxx2_evb/gpio.dts)0
-rw-r--r--zephyr/projects/it8xxx2_evb/i2c.dts (renamed from zephyr/program/it8xxx2_evb/i2c.dts)0
-rw-r--r--zephyr/projects/it8xxx2_evb/include/i2c_map.h (renamed from zephyr/program/it8xxx2_evb/include/i2c_map.h)4
-rw-r--r--zephyr/projects/it8xxx2_evb/interrupts.dts (renamed from zephyr/program/it8xxx2_evb/interrupts.dts)0
-rw-r--r--zephyr/projects/it8xxx2_evb/prj.conf (renamed from zephyr/program/it8xxx2_evb/prj.conf)11
-rw-r--r--zephyr/projects/it8xxx2_evb/pwm.dts (renamed from zephyr/program/it8xxx2_evb/pwm.dts)0
-rw-r--r--zephyr/projects/minimal/BUILD.py (renamed from zephyr/program/minimal/BUILD.py)0
-rw-r--r--zephyr/projects/minimal/CMakeLists.txt (renamed from zephyr/program/minimal/CMakeLists.txt)0
-rw-r--r--zephyr/projects/minimal/README.md (renamed from zephyr/program/minimal/README.md)0
-rw-r--r--zephyr/projects/minimal/it8xxx2.dts (renamed from zephyr/program/minimal/it8xxx2.dts)0
-rw-r--r--zephyr/projects/minimal/npcx9.dts (renamed from zephyr/program/minimal/npcx9.dts)0
-rw-r--r--zephyr/projects/minimal/prj.conf (renamed from zephyr/program/minimal/prj.conf)2
-rw-r--r--zephyr/projects/nissa/BUILD.py (renamed from zephyr/program/nissa/BUILD.py)7
-rw-r--r--zephyr/projects/nissa/CMakeLists.txt (renamed from zephyr/program/nissa/CMakeLists.txt)19
-rw-r--r--zephyr/projects/nissa/Kconfig (renamed from zephyr/program/nissa/Kconfig)15
-rw-r--r--zephyr/projects/nissa/cbi.dtsi (renamed from zephyr/program/nissa/cbi.dtsi)0
-rw-r--r--zephyr/projects/nissa/craask/cbi.dtsi (renamed from zephyr/program/nissa/craask/cbi.dtsi)55
-rw-r--r--zephyr/projects/nissa/craask/generated.dtsi (renamed from zephyr/program/nissa/craask/generated.dtsi)1
-rw-r--r--zephyr/projects/nissa/craask/keyboard.dtsi32
-rw-r--r--zephyr/projects/nissa/craask/motionsense.dtsi (renamed from zephyr/program/nissa/craask/motionsense.dtsi)9
-rw-r--r--zephyr/projects/nissa/craask/overlay.dtsi (renamed from zephyr/program/nissa/craask/overlay.dtsi)84
-rw-r--r--zephyr/projects/nissa/craask/power_signals.dtsi (renamed from zephyr/program/nissa/craask/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/craask/project.conf (renamed from zephyr/program/nissa/craask/project.conf)2
-rw-r--r--zephyr/projects/nissa/craask/project.overlay (renamed from zephyr/program/nissa/joxer/project.overlay)0
-rw-r--r--zephyr/projects/nissa/craask/pwm_leds.dtsi (renamed from zephyr/program/nissa/craask/pwm_leds.dtsi)0
-rw-r--r--zephyr/projects/nissa/craask/src/charger.c (renamed from zephyr/program/nissa/craask/src/charger.c)6
-rw-r--r--zephyr/projects/nissa/craask/src/form_factor.c (renamed from zephyr/program/nissa/craask/src/form_factor.c)24
-rw-r--r--zephyr/projects/nissa/craask/src/keyboard.c (renamed from zephyr/program/nissa/xivur/src/keyboard.c)4
-rw-r--r--zephyr/projects/nissa/craask/src/led.c (renamed from zephyr/program/nissa/craask/src/led.c)0
-rw-r--r--zephyr/projects/nissa/craask/src/usbc.c (renamed from zephyr/program/nissa/xivur/src/usbc.c)0
-rw-r--r--zephyr/projects/nissa/include/nissa_common.h (renamed from zephyr/program/nissa/include/nissa_common.h)0
-rw-r--r--zephyr/projects/nissa/include/nissa_hdmi.h (renamed from zephyr/program/nissa/include/nissa_hdmi.h)0
-rw-r--r--zephyr/projects/nissa/it8xxx2_program.conf (renamed from zephyr/program/nissa/it8xxx2_program.conf)3
-rw-r--r--zephyr/projects/nissa/joxer/cbi.dtsi (renamed from zephyr/program/nissa/joxer/cbi.dtsi)0
-rw-r--r--zephyr/projects/nissa/joxer/generated.dtsi (renamed from zephyr/program/nissa/joxer/generated.dtsi)0
-rw-r--r--zephyr/projects/nissa/joxer/joxer_vif.xml (renamed from zephyr/program/nissa/joxer/joxer_vif.xml)0
-rw-r--r--zephyr/projects/nissa/joxer/keyboard.dtsi (renamed from zephyr/program/nissa/joxer/keyboard.dtsi)0
-rw-r--r--zephyr/projects/nissa/joxer/motionsense.dtsi (renamed from zephyr/program/nissa/joxer/motionsense.dtsi)5
-rw-r--r--zephyr/projects/nissa/joxer/overlay.dtsi (renamed from zephyr/program/nissa/joxer/overlay.dtsi)20
-rw-r--r--zephyr/projects/nissa/joxer/power_signals.dtsi (renamed from zephyr/program/nissa/joxer/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/joxer/project.conf (renamed from zephyr/program/nissa/joxer/project.conf)0
-rw-r--r--zephyr/projects/nissa/joxer/project.overlay (renamed from zephyr/program/nissa/nivviks/project.overlay)0
-rw-r--r--zephyr/projects/nissa/joxer/pwm_leds.dtsi (renamed from zephyr/program/nissa/joxer/pwm_leds.dtsi)0
-rw-r--r--zephyr/projects/nissa/joxer/src/charger.c (renamed from zephyr/program/nissa/joxer/src/charger.c)6
-rw-r--r--zephyr/projects/nissa/joxer/src/fan.c (renamed from zephyr/program/nissa/joxer/src/fan.c)9
-rw-r--r--zephyr/projects/nissa/joxer/src/keyboard.c (renamed from zephyr/program/nissa/joxer/src/keyboard.c)8
-rw-r--r--zephyr/projects/nissa/joxer/src/led.c (renamed from zephyr/program/nissa/joxer/src/led.c)4
-rw-r--r--zephyr/projects/nissa/joxer/src/usbc.c (renamed from zephyr/program/nissa/joxer/src/usbc.c)38
-rw-r--r--zephyr/projects/nissa/nereid/generated.dtsi (renamed from zephyr/program/nissa/nereid/generated.dtsi)0
-rw-r--r--zephyr/projects/nissa/nereid/keyboard.dtsi (renamed from zephyr/program/nissa/nereid/keyboard.dtsi)0
-rw-r--r--zephyr/projects/nissa/nereid/motionsense.dtsi (renamed from zephyr/program/nissa/nereid/motionsense.dtsi)0
-rw-r--r--zephyr/projects/nissa/nereid/nereid_vif.xml (renamed from zephyr/program/nissa/nereid/nereid_vif.xml)0
-rw-r--r--zephyr/projects/nissa/nereid/overlay.dtsi (renamed from zephyr/program/nissa/nereid/overlay.dtsi)9
-rw-r--r--zephyr/projects/nissa/nereid/power_signals.dtsi (renamed from zephyr/program/nissa/nereid/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/nereid/project.conf (renamed from zephyr/program/nissa/nereid/project.conf)0
-rw-r--r--zephyr/projects/nissa/nereid/project.overlay (renamed from zephyr/program/nissa/nereid/project.overlay)0
-rw-r--r--zephyr/projects/nissa/nereid/pwm_leds.dtsi (renamed from zephyr/program/nissa/nereid/pwm_leds.dtsi)0
-rw-r--r--zephyr/projects/nissa/nereid/src/charger.c (renamed from zephyr/program/nissa/nereid/src/charger.c)6
-rw-r--r--zephyr/projects/nissa/nereid/src/hdmi.c (renamed from zephyr/program/nissa/nereid/src/hdmi.c)3
-rw-r--r--zephyr/projects/nissa/nereid/src/keyboard.c (renamed from zephyr/program/nissa/nereid/src/keyboard.c)0
-rw-r--r--zephyr/projects/nissa/nereid/src/usbc.c (renamed from zephyr/program/nissa/yaviks/src/usbc.c)38
-rw-r--r--zephyr/projects/nissa/nissa.csv (renamed from zephyr/program/nissa/nissa.csv)0
-rw-r--r--zephyr/projects/nissa/nivviks/cbi.dtsi (renamed from zephyr/program/nissa/nivviks/cbi.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/generated.dtsi (renamed from zephyr/program/nissa/nivviks/generated.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/keyboard.dtsi (renamed from zephyr/program/nissa/nivviks/keyboard.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/motionsense.dtsi (renamed from zephyr/program/nissa/nivviks/motionsense.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/overlay.dtsi (renamed from zephyr/program/nissa/xivur/overlay.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/power_signals.dtsi (renamed from zephyr/program/nissa/nivviks/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/project.conf (renamed from zephyr/program/nissa/nivviks/project.conf)0
-rw-r--r--zephyr/projects/nissa/nivviks/project.overlay (renamed from zephyr/program/nissa/xivur/project.overlay)0
-rw-r--r--zephyr/projects/nissa/nivviks/pwm_leds.dtsi (renamed from zephyr/program/nissa/nivviks/pwm_leds.dtsi)0
-rw-r--r--zephyr/projects/nissa/nivviks/src/charger.c (renamed from zephyr/program/nissa/nivviks/src/charger.c)6
-rw-r--r--zephyr/projects/nissa/nivviks/src/fan.c (renamed from zephyr/program/nissa/xivur/src/fan.c)0
-rw-r--r--zephyr/projects/nissa/nivviks/src/form_factor.c (renamed from zephyr/program/nissa/xivur/src/form_factor.c)0
-rw-r--r--zephyr/projects/nissa/nivviks/src/keyboard.c (renamed from zephyr/program/nissa/nivviks/src/keyboard.c)0
-rw-r--r--zephyr/projects/nissa/nivviks/src/led.c (renamed from zephyr/program/nissa/nivviks/src/led.c)0
-rw-r--r--zephyr/projects/nissa/nivviks/src/usbc.c (renamed from zephyr/program/nissa/nivviks/src/usbc.c)40
-rw-r--r--zephyr/projects/nissa/npcx_program.conf (renamed from zephyr/program/nissa/npcx_program.conf)9
-rw-r--r--zephyr/projects/nissa/program.conf (renamed from zephyr/program/nissa/program.conf)41
-rw-r--r--zephyr/projects/nissa/pujjo/cbi.dtsi (renamed from zephyr/program/nissa/pujjo/cbi.dtsi)10
-rw-r--r--zephyr/projects/nissa/pujjo/generated.dtsi (renamed from zephyr/program/nissa/pujjo/generated.dtsi)4
-rw-r--r--zephyr/projects/nissa/pujjo/keyboard.dtsi (renamed from zephyr/program/nissa/pujjo/keyboard.dtsi)0
-rw-r--r--zephyr/projects/nissa/pujjo/motionsense.dtsi (renamed from zephyr/program/nissa/pujjo/motionsense.dtsi)6
-rw-r--r--zephyr/projects/nissa/pujjo/overlay.dtsi (renamed from zephyr/program/nissa/pujjo/overlay.dtsi)25
-rw-r--r--zephyr/projects/nissa/pujjo/power_signals.dtsi (renamed from zephyr/program/nissa/pujjo/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/pujjo/project.conf (renamed from zephyr/program/nissa/pujjo/project.conf)0
-rw-r--r--zephyr/projects/nissa/pujjo/project.overlay (renamed from zephyr/program/nissa/pujjo/project.overlay)0
-rw-r--r--zephyr/projects/nissa/pujjo/pujjo_vif.xml (renamed from zephyr/program/nissa/pujjo/pujjo_vif.xml)0
-rw-r--r--zephyr/projects/nissa/pujjo/src/charger.c (renamed from zephyr/program/nissa/pujjo/src/charger.c)12
-rw-r--r--zephyr/projects/nissa/pujjo/src/fan.c (renamed from zephyr/program/nissa/pujjo/src/fan.c)9
-rw-r--r--zephyr/projects/nissa/pujjo/src/form_factor.c (renamed from zephyr/program/nissa/pujjo/src/form_factor.c)24
-rw-r--r--zephyr/projects/nissa/pujjo/src/hdmi.c (renamed from zephyr/program/nissa/pujjo/src/hdmi.c)0
-rw-r--r--zephyr/projects/nissa/pujjo/src/keyboard.c (renamed from zephyr/program/nissa/pujjo/src/keyboard.c)0
-rw-r--r--zephyr/projects/nissa/pujjo/src/led.c (renamed from zephyr/program/nissa/pujjo/src/led.c)4
-rw-r--r--zephyr/projects/nissa/pujjo/src/usbc.c (renamed from zephyr/program/nissa/pujjo/src/usbc.c)27
-rw-r--r--zephyr/projects/nissa/src/board_power.c (renamed from zephyr/program/nissa/src/board_power.c)10
-rw-r--r--zephyr/projects/nissa/src/common.c (renamed from zephyr/program/nissa/src/common.c)87
-rw-r--r--zephyr/projects/nissa/src/led.c (renamed from zephyr/program/nissa/src/led.c)0
-rw-r--r--zephyr/projects/nissa/src/sub_board.c (renamed from zephyr/program/nissa/src/sub_board.c)34
-rw-r--r--zephyr/projects/nissa/xivu/cbi.dtsi (renamed from zephyr/program/nissa/xivu/cbi.dtsi)56
-rw-r--r--zephyr/projects/nissa/xivu/generated.dtsi (renamed from zephyr/program/nissa/xivu/generated.dtsi)0
-rw-r--r--zephyr/projects/nissa/xivu/keyboard.dtsi (renamed from zephyr/program/nissa/xivu/keyboard.dtsi)0
-rw-r--r--zephyr/projects/nissa/xivu/led_pins.dtsi (renamed from zephyr/program/nissa/xivu/led_pins.dtsi)32
-rw-r--r--zephyr/projects/nissa/xivu/led_policy.dtsi (renamed from zephyr/program/nissa/xivu/led_policy.dtsi)0
-rw-r--r--zephyr/projects/nissa/xivu/motionsense.dtsi (renamed from zephyr/program/nissa/xivur/motionsense.dtsi)22
-rw-r--r--zephyr/projects/nissa/xivu/overlay.dtsi (renamed from zephyr/program/nissa/xivu/overlay.dtsi)28
-rw-r--r--zephyr/projects/nissa/xivu/power_signals.dtsi (renamed from zephyr/program/nissa/xivu/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/xivu/project.conf (renamed from zephyr/program/nissa/xivur/project.conf)10
-rw-r--r--zephyr/projects/nissa/xivu/project.overlay (renamed from zephyr/program/nissa/xivu/project.overlay)0
-rw-r--r--zephyr/projects/nissa/xivu/src/charger.c (renamed from zephyr/program/nissa/xivu/src/charger.c)6
-rw-r--r--zephyr/projects/nissa/xivu/src/keyboard.c (renamed from zephyr/program/nissa/xivu/src/keyboard.c)0
-rw-r--r--zephyr/projects/nissa/xivu/src/usbc.c (renamed from zephyr/program/nissa/craask/src/usbc.c)46
-rw-r--r--zephyr/projects/nissa/yaviks/cbi.dtsi (renamed from zephyr/program/nissa/yaviks/cbi.dtsi)0
-rw-r--r--zephyr/projects/nissa/yaviks/gpio.dtsi (renamed from zephyr/program/nissa/yaviks/gpio.dtsi)0
-rw-r--r--zephyr/projects/nissa/yaviks/keyboard.dtsi (renamed from zephyr/program/nissa/yaviks/keyboard.dtsi)0
-rw-r--r--zephyr/projects/nissa/yaviks/overlay.dtsi (renamed from zephyr/program/nissa/yaviks/overlay.dtsi)55
-rw-r--r--zephyr/projects/nissa/yaviks/power_signals.dtsi (renamed from zephyr/program/nissa/yaviks/power_signals.dtsi)0
-rw-r--r--zephyr/projects/nissa/yaviks/project.conf (renamed from zephyr/program/nissa/yaviks/project.conf)1
-rw-r--r--zephyr/projects/nissa/yaviks/project.overlay (renamed from zephyr/program/nissa/yaviks/project.overlay)1
-rw-r--r--zephyr/projects/nissa/yaviks/src/charger.c (renamed from zephyr/program/nissa/yaviks/src/charger.c)8
-rw-r--r--zephyr/projects/nissa/yaviks/src/fan.c (renamed from zephyr/program/nissa/craask/src/fan.c)7
-rw-r--r--zephyr/projects/nissa/yaviks/src/keyboard.c (renamed from zephyr/program/nissa/yaviks/src/keyboard.c)4
-rw-r--r--zephyr/projects/nissa/yaviks/src/led.c (renamed from zephyr/program/nissa/yaviks/src/led.c)6
-rw-r--r--zephyr/projects/nissa/yaviks/src/usbc.c (renamed from zephyr/program/nissa/nereid/src/usbc.c)38
-rw-r--r--zephyr/projects/nissa/yaviks/yaviks_vif.xml (renamed from zephyr/program/nissa/yaviks/yaviks_vif.xml)0
-rw-r--r--zephyr/projects/npcx_evb/npcx7/BUILD.py (renamed from zephyr/program/npcx_evb/npcx7/BUILD.py)0
-rw-r--r--zephyr/projects/npcx_evb/npcx7/CMakeLists.txt (renamed from zephyr/program/npcx_evb/npcx7/CMakeLists.txt)0
-rw-r--r--zephyr/projects/npcx_evb/npcx7/fan.dts (renamed from zephyr/program/npcx_evb/npcx7/fan.dts)0
-rw-r--r--zephyr/projects/npcx_evb/npcx7/gpio.dts (renamed from zephyr/program/npcx_evb/npcx7/gpio.dts)0
-rw-r--r--zephyr/projects/npcx_evb/npcx7/interrupts.dts (renamed from zephyr/program/npcx_evb/npcx7/interrupts.dts)0
-rw-r--r--zephyr/projects/npcx_evb/npcx7/keyboard.dts (renamed from zephyr/program/npcx_evb/npcx7/keyboard.dts)2
-rw-r--r--zephyr/projects/npcx_evb/npcx7/prj.conf (renamed from zephyr/program/npcx_evb/npcx7/prj.conf)4
-rw-r--r--zephyr/projects/npcx_evb/npcx9/BUILD.py (renamed from zephyr/program/npcx_evb/npcx9/BUILD.py)0
-rw-r--r--zephyr/projects/npcx_evb/npcx9/CMakeLists.txt (renamed from zephyr/program/npcx_evb/npcx9/CMakeLists.txt)0
-rw-r--r--zephyr/projects/npcx_evb/npcx9/fan.dts (renamed from zephyr/program/npcx_evb/npcx9/fan.dts)0
-rw-r--r--zephyr/projects/npcx_evb/npcx9/gpio.dts (renamed from zephyr/program/npcx_evb/npcx9/gpio.dts)0
-rw-r--r--zephyr/projects/npcx_evb/npcx9/interrupts.dts (renamed from zephyr/program/npcx_evb/npcx9/interrupts.dts)0
-rw-r--r--zephyr/projects/npcx_evb/npcx9/keyboard.dts (renamed from zephyr/program/npcx_evb/npcx9/keyboard.dts)2
-rw-r--r--zephyr/projects/npcx_evb/npcx9/prj.conf (renamed from zephyr/program/npcx_evb/npcx9/prj.conf)4
-rw-r--r--zephyr/projects/rex/BUILD.py (renamed from zephyr/program/rex/BUILD.py)0
-rw-r--r--zephyr/projects/rex/CMakeLists.txt (renamed from zephyr/program/rex/CMakeLists.txt)0
-rw-r--r--zephyr/projects/rex/Kconfig (renamed from zephyr/program/rex/Kconfig)0
-rw-r--r--zephyr/projects/rex/battery.dts (renamed from zephyr/program/rex/battery.dts)0
-rw-r--r--zephyr/projects/rex/fan.dts (renamed from zephyr/program/rex/fan.dts)0
-rw-r--r--zephyr/projects/rex/generated.dts (renamed from zephyr/program/rex/generated.dts)0
-rw-r--r--zephyr/projects/rex/include/gpio_map.h (renamed from zephyr/program/rex/include/gpio_map.h)0
-rw-r--r--zephyr/projects/rex/interrupts.dts (renamed from zephyr/program/rex/interrupts.dts)0
-rw-r--r--zephyr/projects/rex/keyboard.dts (renamed from zephyr/program/rex/keyboard.dts)0
-rw-r--r--zephyr/projects/rex/led.dts (renamed from zephyr/program/rex/led.dts)28
-rw-r--r--zephyr/projects/rex/motionsense.dts (renamed from zephyr/program/rex/motionsense.dts)0
-rw-r--r--zephyr/projects/rex/power_signals.dts (renamed from zephyr/program/rex/power_signals.dts)16
-rw-r--r--zephyr/projects/rex/prj.conf (renamed from zephyr/program/rex/prj.conf)33
-rw-r--r--zephyr/projects/rex/prj_rex.conf (renamed from zephyr/program/rex/prj_rex.conf)3
-rw-r--r--zephyr/projects/rex/rex.dts (renamed from zephyr/program/rex/rex.dts)12
-rw-r--r--zephyr/projects/rex/rex0_gpio.csv (renamed from zephyr/program/rex/rex0_gpio.csv)0
-rw-r--r--zephyr/projects/rex/src/board_power.c (renamed from zephyr/program/rex/src/board_power.c)8
-rw-r--r--zephyr/projects/rex/src/usb_pd_policy.c (renamed from zephyr/program/rex/src/usb_pd_policy.c)4
-rw-r--r--zephyr/projects/rex/src/usbc_config.c (renamed from zephyr/program/rex/src/usbc_config.c)16
-rw-r--r--zephyr/projects/rex/temp_sensors.dts (renamed from zephyr/program/rex/temp_sensors.dts)0
-rw-r--r--zephyr/projects/rex/usbc.dts (renamed from zephyr/program/rex/usbc.dts)0
-rw-r--r--zephyr/projects/skyrim/BUILD.py86
-rw-r--r--zephyr/projects/skyrim/CMakeLists.txt62
-rw-r--r--zephyr/projects/skyrim/Kconfig (renamed from zephyr/program/skyrim/Kconfig)8
-rw-r--r--zephyr/projects/skyrim/adc.dts (renamed from zephyr/program/skyrim/adc.dtsi)6
-rw-r--r--zephyr/projects/skyrim/battery_frostflow.dts (renamed from zephyr/program/skyrim/frostflow/battery.dtsi)0
-rw-r--r--zephyr/projects/skyrim/battery_morthal.dts (renamed from zephyr/program/skyrim/morthal/battery.dtsi)0
-rw-r--r--zephyr/projects/skyrim/battery_skyrim.dts (renamed from zephyr/program/skyrim/skyrim/battery.dtsi)0
-rw-r--r--zephyr/projects/skyrim/battery_winterhold.dts (renamed from zephyr/program/skyrim/winterhold/battery.dtsi)12
-rw-r--r--zephyr/projects/skyrim/fan.dts (renamed from zephyr/program/skyrim/fan.dtsi)2
-rw-r--r--zephyr/projects/skyrim/frostflow.dts136
-rw-r--r--zephyr/projects/skyrim/gpio.dts (renamed from zephyr/program/skyrim/gpio.dtsi)2
-rw-r--r--zephyr/projects/skyrim/i2c_common.dtsi (renamed from zephyr/program/skyrim/i2c.dtsi)12
-rw-r--r--zephyr/projects/skyrim/include/frostflow/keyboard_customization.h (renamed from zephyr/program/skyrim/frostflow/include/keyboard_customization.h)0
-rw-r--r--zephyr/projects/skyrim/interrupts.dts (renamed from zephyr/program/skyrim/interrupts.dtsi)0
-rw-r--r--zephyr/projects/skyrim/keyboard.dts (renamed from zephyr/program/skyrim/keyboard.dtsi)2
-rw-r--r--zephyr/projects/skyrim/led_pins_frostflow.dts (renamed from zephyr/program/skyrim/crystaldrift/led_pins.dtsi)18
-rw-r--r--zephyr/projects/skyrim/led_pins_morthal.dts (renamed from zephyr/program/skyrim/skyrim/led_pins.dtsi)20
-rw-r--r--zephyr/projects/skyrim/led_pins_skyrim.dts (renamed from zephyr/program/skyrim/frostflow/led_pins.dtsi)20
-rw-r--r--zephyr/projects/skyrim/led_pins_winterhold.dts (renamed from zephyr/program/skyrim/morthal/led_pins.dtsi)20
-rw-r--r--zephyr/projects/skyrim/led_policy_frostflow.dts (renamed from zephyr/program/skyrim/frostflow/led_policy.dtsi)0
-rw-r--r--zephyr/projects/skyrim/led_policy_morthal.dts (renamed from zephyr/program/skyrim/crystaldrift/led_policy.dtsi)0
-rw-r--r--zephyr/projects/skyrim/led_policy_skyrim.dts (renamed from zephyr/program/skyrim/morthal/led_policy.dtsi)0
-rw-r--r--zephyr/projects/skyrim/led_policy_winterhold.dts (renamed from zephyr/program/skyrim/winterhold/led_policy.dtsi)0
-rw-r--r--zephyr/projects/skyrim/morthal.dts (renamed from zephyr/program/skyrim/morthal/morthal.dtsi)4
-rw-r--r--zephyr/projects/skyrim/motionsense.dts (renamed from zephyr/program/skyrim/crystaldrift/motionsense.dtsi)0
-rw-r--r--zephyr/projects/skyrim/prj.conf (renamed from zephyr/program/skyrim/program.conf)33
-rw-r--r--zephyr/projects/skyrim/prj_frostflow.conf (renamed from zephyr/program/skyrim/frostflow/project.conf)15
-rw-r--r--zephyr/projects/skyrim/prj_morthal.conf (renamed from zephyr/program/skyrim/morthal/project.conf)6
-rw-r--r--zephyr/projects/skyrim/prj_skyrim.conf (renamed from zephyr/program/skyrim/skyrim/project.conf)6
-rw-r--r--zephyr/projects/skyrim/prj_winterhold.conf26
-rw-r--r--zephyr/projects/skyrim/skyrim.dts (renamed from zephyr/program/skyrim/skyrim/skyrim.dtsi)4
-rw-r--r--zephyr/projects/skyrim/src/common.c (renamed from zephyr/program/skyrim/src/common.c)0
-rw-r--r--zephyr/projects/skyrim/src/frostflow/keyboard.c (renamed from zephyr/program/skyrim/frostflow/src/keyboard.c)0
-rw-r--r--zephyr/projects/skyrim/src/frostflow/keyboard_customization.c (renamed from zephyr/program/skyrim/frostflow/src/keyboard_customization.c)4
-rw-r--r--zephyr/projects/skyrim/src/frostflow/ppc_config.c (renamed from zephyr/program/skyrim/frostflow/src/ppc_config.c)6
-rw-r--r--zephyr/projects/skyrim/src/frostflow/usb_mux_config.c (renamed from zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c)25
-rw-r--r--zephyr/projects/skyrim/src/morthal/ppc_config.c (renamed from zephyr/program/skyrim/morthal/src/ppc_config.c)6
-rw-r--r--zephyr/projects/skyrim/src/morthal/usb_mux_config.c (renamed from zephyr/program/skyrim/morthal/src/usb_mux_config.c)4
-rw-r--r--zephyr/projects/skyrim/src/power_signals.c (renamed from zephyr/program/skyrim/src/power_signals.c)2
-rw-r--r--zephyr/projects/skyrim/src/skyrim/alt_charger.c (renamed from zephyr/program/skyrim/skyrim/src/alt_charger.c)6
-rw-r--r--zephyr/projects/skyrim/src/skyrim/fan.c (renamed from zephyr/program/skyrim/skyrim/src/fan.c)8
-rw-r--r--zephyr/projects/skyrim/src/skyrim/form_factor.c (renamed from zephyr/program/skyrim/skyrim/src/form_factor.c)7
-rw-r--r--zephyr/projects/skyrim/src/skyrim/keyboard.c (renamed from zephyr/program/skyrim/skyrim/src/keyboard.c)0
-rw-r--r--zephyr/projects/skyrim/src/skyrim/ppc_config.c (renamed from zephyr/program/skyrim/skyrim/src/ppc_config.c)6
-rw-r--r--zephyr/projects/skyrim/src/skyrim/usb_mux_config.c (renamed from zephyr/program/skyrim/skyrim/src/usb_mux_config.c)4
-rw-r--r--zephyr/projects/skyrim/src/stt.c (renamed from zephyr/program/skyrim/src/stt.c)0
-rw-r--r--zephyr/projects/skyrim/src/usb_pd_policy.c (renamed from zephyr/program/skyrim/src/usb_pd_policy.c)4
-rw-r--r--zephyr/projects/skyrim/src/usbc_config.c (renamed from zephyr/program/skyrim/src/usbc_config.c)21
-rw-r--r--zephyr/projects/skyrim/src/winterhold/kb_backlight.c (renamed from zephyr/program/skyrim/winterhold/src/kb_backlight.c)6
-rw-r--r--zephyr/projects/skyrim/src/winterhold/keyboard.c (renamed from zephyr/program/skyrim/winterhold/src/keyboard.c)0
-rw-r--r--zephyr/projects/skyrim/src/winterhold/ppc_config.c (renamed from zephyr/program/skyrim/winterhold/src/ppc_config.c)4
-rw-r--r--zephyr/projects/skyrim/src/winterhold/usb_mux_config.c (renamed from zephyr/program/skyrim/winterhold/src/usb_mux_config.c)56
-rw-r--r--zephyr/projects/skyrim/usbc.dts (renamed from zephyr/program/skyrim/usbc.dtsi)0
-rw-r--r--zephyr/projects/skyrim/winterhold.dts (renamed from zephyr/program/skyrim/winterhold/winterhold.dtsi)56
-rw-r--r--zephyr/projects/trogdor/lazor/BUILD.py (renamed from zephyr/program/trogdor/lazor/BUILD.py)0
-rw-r--r--zephyr/projects/trogdor/lazor/CMakeLists.txt (renamed from zephyr/program/trogdor/lazor/CMakeLists.txt)0
-rw-r--r--zephyr/projects/trogdor/lazor/adc.dts (renamed from zephyr/program/trogdor/lazor/adc.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/battery.dts (renamed from zephyr/program/trogdor/lazor/battery.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/default_gpio_pinctrl.dts (renamed from zephyr/program/trogdor/lazor/default_gpio_pinctrl.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/display.dts (renamed from zephyr/program/herobrine/display.dtsi)0
-rw-r--r--zephyr/projects/trogdor/lazor/gpio.dts (renamed from zephyr/program/trogdor/lazor/gpio.dts)10
-rw-r--r--zephyr/projects/trogdor/lazor/gpio_led.dts33
-rw-r--r--zephyr/projects/trogdor/lazor/host_interface_npcx.dts (renamed from zephyr/program/corsola/npcx_host_interface.dtsi)0
-rw-r--r--zephyr/projects/trogdor/lazor/i2c.dts (renamed from zephyr/program/trogdor/lazor/i2c.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/include/sku.h (renamed from zephyr/program/trogdor/lazor/include/sku.h)0
-rw-r--r--zephyr/projects/trogdor/lazor/interrupts.dts (renamed from zephyr/program/trogdor/lazor/interrupts.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/keyboard.dts (renamed from zephyr/program/trogdor/lazor/keyboard.dts)2
-rw-r--r--zephyr/projects/trogdor/lazor/led.dts (renamed from zephyr/program/trogdor/lazor/led.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/motionsense.dts (renamed from zephyr/program/trogdor/lazor/motionsense.dts)0
-rw-r--r--zephyr/projects/trogdor/lazor/prj.conf (renamed from zephyr/program/trogdor/lazor/prj.conf)17
-rw-r--r--zephyr/projects/trogdor/lazor/pwm_led.dts (renamed from zephyr/program/trogdor/lazor/pwm_led.dts)20
-rw-r--r--zephyr/projects/trogdor/lazor/src/hibernate.c (renamed from zephyr/program/trogdor/lazor/src/hibernate.c)0
-rw-r--r--zephyr/projects/trogdor/lazor/src/i2c.c (renamed from zephyr/program/trogdor/lazor/src/i2c.c)2
-rw-r--r--zephyr/projects/trogdor/lazor/src/power.c (renamed from zephyr/program/trogdor/lazor/src/power.c)9
-rw-r--r--zephyr/projects/trogdor/lazor/src/sku.c (renamed from zephyr/program/trogdor/lazor/src/sku.c)2
-rw-r--r--zephyr/projects/trogdor/lazor/src/switchcap.c (renamed from zephyr/program/trogdor/lazor/src/switchcap.c)6
-rw-r--r--zephyr/projects/trogdor/lazor/src/usb_pd_policy.c (renamed from zephyr/program/trogdor/lazor/src/usb_pd_policy.c)4
-rw-r--r--zephyr/projects/trogdor/lazor/src/usbc_config.c (renamed from zephyr/program/trogdor/lazor/src/usbc_config.c)19
-rw-r--r--zephyr/projects/trogdor/lazor/usbc.dts (renamed from zephyr/program/trogdor/lazor/usbc.dts)0
-rw-r--r--zephyr/shim/chip/it8xxx2/clock.c7
-rw-r--r--zephyr/shim/chip/it8xxx2/gpio.c5
-rw-r--r--zephyr/shim/chip/it8xxx2/keyboard_raw.c9
-rw-r--r--zephyr/shim/chip/it8xxx2/power_policy.c7
-rw-r--r--zephyr/shim/chip/mchp/clock.c7
-rw-r--r--zephyr/shim/chip/mchp/gpio.c3
-rw-r--r--zephyr/shim/chip/mchp/keyboard_raw.c9
-rw-r--r--zephyr/shim/chip/mchp/system.c6
-rw-r--r--zephyr/shim/chip/mchp/system_download_from_flash.c7
-rw-r--r--zephyr/shim/chip/mchp/system_external_storage.c11
-rw-r--r--zephyr/shim/chip/npcx/clock.c7
-rw-r--r--zephyr/shim/chip/npcx/gpio.c11
-rw-r--r--zephyr/shim/chip/npcx/keyboard_raw.c9
-rw-r--r--zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c6
-rw-r--r--zephyr/shim/chip/npcx/power_policy.c9
-rw-r--r--zephyr/shim/chip/npcx/shi.c15
-rw-r--r--zephyr/shim/chip/npcx/system.c6
-rw-r--r--zephyr/shim/chip/npcx/system_download_from_flash.c9
-rw-r--r--zephyr/shim/chip/npcx/system_external_storage.c6
-rw-r--r--zephyr/shim/core/cortex-m/irq_command.c3
-rw-r--r--zephyr/shim/core/cortex-m/mpu.c7
-rw-r--r--zephyr/shim/include/board_led.h4
-rw-r--r--zephyr/shim/include/charger/chg_isl923x.h3
-rw-r--r--zephyr/shim/include/charger/chg_isl9241.h3
-rw-r--r--zephyr/shim/include/charger/chg_rt9490.h3
-rw-r--r--zephyr/shim/include/charger/chg_sm5803.h3
-rw-r--r--zephyr/shim/include/charger_chips.h1
-rw-r--r--zephyr/shim/include/config_chip.h129
-rw-r--r--zephyr/shim/include/cros_cbi.h7
-rw-r--r--zephyr/shim/include/fpu.h6
-rw-r--r--zephyr/shim/include/gpio/gpio.h1
-rw-r--r--zephyr/shim/include/motionsense_sensors.h3
-rw-r--r--zephyr/shim/include/motionsense_sensors_defs.h4
-rw-r--r--zephyr/shim/include/power/power.h34
-rw-r--r--zephyr/shim/include/temp_sensor/temp_sensor.h6
-rw-r--r--zephyr/shim/include/usbc/bc12_rt9490.h2
-rw-r--r--zephyr/shim/include/usbc/ppc.h7
-rw-r--r--zephyr/shim/include/usbc/tcpc_anx7447.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_anx7447_emul.h5
-rw-r--r--zephyr/shim/include/usbc/tcpc_ccgxxf.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_fusb302.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_generic_emul.h4
-rw-r--r--zephyr/shim/include/usbc/tcpc_it8xxx2.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_nct38xx.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_ps8xxx.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h3
-rw-r--r--zephyr/shim/include/usbc/tcpc_raa489000.h21
-rw-r--r--zephyr/shim/include/usbc/tcpc_rt1718s.h3
-rw-r--r--zephyr/shim/include/usbc/tcpci.h4
-rw-r--r--zephyr/shim/include/usbc/usb_muxes.h9
-rw-r--r--zephyr/shim/include/zephyr_hooks_shim.h6
-rw-r--r--zephyr/shim/include/zephyr_host_command.h3
-rw-r--r--zephyr/shim/include/zephyr_shim.h3
-rw-r--r--zephyr/shim/include/zephyr_write_protect.h1
-rw-r--r--zephyr/shim/src/CMakeLists.txt14
-rw-r--r--zephyr/shim/src/adc.c5
-rw-r--r--zephyr/shim/src/battery.c6
-rw-r--r--zephyr/shim/src/bb_retimer_usb_mux.c13
-rw-r--r--zephyr/shim/src/bc12.c5
-rw-r--r--zephyr/shim/src/bc12_pi3usb9201.c10
-rw-r--r--zephyr/shim/src/bc12_rt9490.c7
-rw-r--r--zephyr/shim/src/cbi/CMakeLists.txt7
-rw-r--r--zephyr/shim/src/cbi/cbi_eeprom.c37
-rw-r--r--zephyr/shim/src/cbi/cros_cbi.c3
-rw-r--r--zephyr/shim/src/cbi/cros_cbi_fw_config.c16
-rw-r--r--zephyr/shim/src/cbi/cros_cbi_ssfc.c29
-rw-r--r--zephyr/shim/src/charger.c3
-rw-r--r--zephyr/shim/src/chipset_api.c3
-rw-r--r--zephyr/shim/src/chipset_state_check.h2
-rw-r--r--zephyr/shim/src/console.c31
-rw-r--r--zephyr/shim/src/console_buffer.c4
-rw-r--r--zephyr/shim/src/crc.c4
-rw-r--r--zephyr/shim/src/espi.c24
-rw-r--r--zephyr/shim/src/fan.c32
-rw-r--r--zephyr/shim/src/flash.c11
-rw-r--r--zephyr/shim/src/gpio.c40
-rw-r--r--zephyr/shim/src/gpio_id.c20
-rw-r--r--zephyr/shim/src/gpio_int.c12
-rw-r--r--zephyr/shim/src/hooks.c11
-rw-r--r--zephyr/shim/src/host_command.c4
-rw-r--r--zephyr/shim/src/hwtimer.c5
-rw-r--r--zephyr/shim/src/i2c.c11
-rw-r--r--zephyr/shim/src/ioex.c9
-rw-r--r--zephyr/shim/src/ioex_drv.c47
-rw-r--r--zephyr/shim/src/keyboard_raw.c17
-rw-r--r--zephyr/shim/src/keyscan.c12
-rw-r--r--zephyr/shim/src/led_driver/CMakeLists.txt4
-rw-r--r--zephyr/shim/src/led_driver/led.c20
-rw-r--r--zephyr/shim/src/led_driver/led.h10
-rw-r--r--zephyr/shim/src/led_driver/led_gpio.c19
-rw-r--r--zephyr/shim/src/led_driver/led_pwm.c22
-rw-r--r--zephyr/shim/src/log_backend_console_buffer.c8
-rw-r--r--zephyr/shim/src/motionsense_sensors.c7
-rw-r--r--zephyr/shim/src/panic.c8
-rw-r--r--zephyr/shim/src/power.c30
-rw-r--r--zephyr/shim/src/ppc.c7
-rw-r--r--zephyr/shim/src/pwm_hc.c12
-rw-r--r--zephyr/shim/src/pwm_led.c1
-rw-r--r--zephyr/shim/src/rtc.c6
-rw-r--r--zephyr/shim/src/switchcap_gpio.c31
-rw-r--r--zephyr/shim/src/switchcap_ln9310.c26
-rw-r--r--zephyr/shim/src/system.c13
-rw-r--r--zephyr/shim/src/tasks.c46
-rw-r--r--zephyr/shim/src/tcpc.c10
-rw-r--r--zephyr/shim/src/tcpc_nct38xx.c6
-rw-r--r--zephyr/shim/src/temp_sensors.c69
-rw-r--r--zephyr/shim/src/thermal.c2
-rw-r--r--zephyr/shim/src/usb_muxes.c11
-rw-r--r--zephyr/shim/src/usba.c5
-rw-r--r--zephyr/shim/src/watchdog.c10
-rw-r--r--zephyr/shim/src/ztest_system.c2
-rw-r--r--zephyr/subsys/CMakeLists.txt1
-rw-r--r--zephyr/subsys/ap_pwrseq/include/signal_adc.h2
-rw-r--r--zephyr/subsys/ap_pwrseq/include/x86_common_pwrseq.h1
-rw-r--r--zephyr/subsys/ap_pwrseq/power_host_sleep.c7
-rw-r--r--zephyr/subsys/ap_pwrseq/power_signals.c10
-rw-r--r--zephyr/subsys/ap_pwrseq/signal_gpio.c6
-rw-r--r--zephyr/subsys/ap_pwrseq/signal_vw.c7
-rw-r--r--zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c4
-rw-r--r--zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c5
-rw-r--r--zephyr/subsys/emul/CMakeLists.txt2
-rw-r--r--zephyr/subsys/emul/Kconfig5
-rw-r--r--zephyr/subsys/emul/ap_pwrseq/CMakeLists.txt1
-rw-r--r--zephyr/subsys/emul/ap_pwrseq/Kconfig34
-rw-r--r--zephyr/subsys/emul/ap_pwrseq/emul_power_signals.c550
-rw-r--r--zephyr/test/ap_power/CMakeLists.txt2
-rw-r--r--zephyr/test/ap_power/boards/alderlake.dts269
-rw-r--r--zephyr/test/ap_power/boards/native_posix.overlay125
-rw-r--r--zephyr/test/ap_power/include/test_mocks.h23
-rw-r--r--zephyr/test/ap_power/include/test_state.h2
-rw-r--r--zephyr/test/ap_power/prj.conf9
-rw-r--r--zephyr/test/ap_power/src/ap_pwrseq.c141
-rw-r--r--zephyr/test/ap_power/src/board.c29
-rw-r--r--zephyr/test/ap_power/src/console_command.c6
-rw-r--r--zephyr/test/ap_power/src/events.c15
-rw-r--r--zephyr/test/ap_power/src/hibdelay.c37
-rw-r--r--zephyr/test/ap_power/src/hibernate.c39
-rw-r--r--zephyr/test/ap_power/src/host_command.c28
-rw-r--r--zephyr/test/ap_power/src/main.c5
-rw-r--r--zephyr/test/ap_power/src/signals.c20
-rw-r--r--zephyr/test/ap_power/src/test_mocks.c30
-rw-r--r--zephyr/test/ap_power/testcase.yaml8
-rw-r--r--zephyr/test/crc/main.c4
-rw-r--r--zephyr/test/drivers/CMakeLists.txt7
-rw-r--r--zephyr/test/drivers/Kconfig31
-rw-r--r--zephyr/test/drivers/anx7447/prj.conf1
-rw-r--r--zephyr/test/drivers/anx7447/src/low_power_mode.c6
-rw-r--r--zephyr/test/drivers/anx7447/tcpc_policy.dts2
-rw-r--r--zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c8
-rw-r--r--zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c247
-rw-r--r--zephyr/test/drivers/bc12_pi3usb9201/CMakeLists.txt6
-rw-r--r--zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201_interrupt.c119
-rw-r--r--zephyr/test/drivers/boards/native_posix.overlay181
-rw-r--r--zephyr/test/drivers/button/src/main.c10
-rw-r--r--zephyr/test/drivers/chargesplash/src/chargesplash.c23
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/stubs.h7
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/test_mocks.h6
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/test_state.h2
-rw-r--r--zephyr/test/drivers/common/include/test/drivers/utils.h76
-rw-r--r--zephyr/test/drivers/common/src/main.c5
-rw-r--r--zephyr/test/drivers/common/src/stubs.c88
-rw-r--r--zephyr/test/drivers/common/src/test_mocks.c10
-rw-r--r--zephyr/test/drivers/common/src/test_rules.c4
-rw-r--r--zephyr/test/drivers/common/src/utils.c36
-rw-r--r--zephyr/test/drivers/common_cbi/src/test_common_cbi.c221
-rw-r--r--zephyr/test/drivers/common_cbi_gpio/src/test_common_cbi_gpio.c4
-rw-r--r--zephyr/test/drivers/common_charger/CMakeLists.txt7
-rw-r--r--zephyr/test/drivers/common_charger/src/test_charge_state_v2.c129
-rw-r--r--zephyr/test/drivers/common_charger/src/test_common_charger.c10
-rw-r--r--zephyr/test/drivers/common_charger/src/test_common_charger_mocked.c598
-rw-r--r--zephyr/test/drivers/console/src/shell.c8
-rw-r--r--zephyr/test/drivers/default/CMakeLists.txt10
-rw-r--r--zephyr/test/drivers/default/boards/native_posix.overlay34
-rw-r--r--zephyr/test/drivers/default/prj.conf1
-rw-r--r--zephyr/test/drivers/default/src/battery.c233
-rw-r--r--zephyr/test/drivers/default/src/bb_retimer.c30
-rw-r--r--zephyr/test/drivers/default/src/bc12.c (renamed from zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201.c)26
-rw-r--r--zephyr/test/drivers/default/src/bma2x2.c13
-rw-r--r--zephyr/test/drivers/default/src/bmi160.c19
-rw-r--r--zephyr/test/drivers/default/src/bmi260.c15
-rw-r--r--zephyr/test/drivers/default/src/bmi_common.c8
-rw-r--r--zephyr/test/drivers/default/src/charge_manager.c4
-rw-r--r--zephyr/test/drivers/default/src/charge_state_prevent_power_on.c91
-rw-r--r--zephyr/test/drivers/default/src/chipset.c101
-rw-r--r--zephyr/test/drivers/default/src/console.c12
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelinfo.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelinit.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelrange.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelrate.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelread.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelres.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/accelspoof.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/adc.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/battery.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/button.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/cbi.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/charge_manager.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/charge_state.c34
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/chargen.c17
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/charger.c14
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/crash.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/cutoff.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/ec_features.c16
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/gpio.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/hcdebug.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/hibdelay.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/hostevent.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/i2c_portmap.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/md.c16
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/panic_output.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/port80.c11
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/power_button.c1
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/powerindebug.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/pwr_avg.c47
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/rtc.c4
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/rw.c18
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/shared_mem.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/sleepmask.c10
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/sleeptimeout.c6
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/switch.c31
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/sysinfo.c12
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c8
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/usb_pd_console.c37
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/vboot_hash.c13
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/version.c10
-rw-r--r--zephyr/test/drivers/default/src/console_cmd/waitms.c7
-rw-r--r--zephyr/test/drivers/default/src/cros_cbi.c6
-rw-r--r--zephyr/test/drivers/default/src/espi.c13
-rw-r--r--zephyr/test/drivers/default/src/flash.c88
-rw-r--r--zephyr/test/drivers/default/src/gpio.c86
-rw-r--r--zephyr/test/drivers/default/src/i2c.c25
-rw-r--r--zephyr/test/drivers/default/src/i2c_passthru.c225
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb.c10
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c14
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c13
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c64
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c30
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c14
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c11
-rw-r--r--zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c44
-rw-r--r--zephyr/test/drivers/default/src/isl923x.c14
-rw-r--r--zephyr/test/drivers/default/src/led.c11
-rw-r--r--zephyr/test/drivers/default/src/lid_angle.c4
-rw-r--r--zephyr/test/drivers/default/src/lid_switch.c19
-rw-r--r--zephyr/test/drivers/default/src/lis2dw12.c5
-rw-r--r--zephyr/test/drivers/default/src/ln9310.c16
-rw-r--r--zephyr/test/drivers/default/src/locate_chip.c10
-rw-r--r--zephyr/test/drivers/default/src/motion_sense/motion_sense.c20
-rw-r--r--zephyr/test/drivers/default/src/panic.c11
-rw-r--r--zephyr/test/drivers/default/src/panic_output.c4
-rw-r--r--zephyr/test/drivers/default/src/port80.c11
-rw-r--r--zephyr/test/drivers/default/src/power_common.c42
-rw-r--r--zephyr/test/drivers/default/src/ppc_sn5s330.c16
-rw-r--r--zephyr/test/drivers/default/src/ppc_syv682x.c92
-rw-r--r--zephyr/test/drivers/default/src/ps8xxx.c23
-rw-r--r--zephyr/test/drivers/default/src/smart.c17
-rw-r--r--zephyr/test/drivers/default/src/stm_mems_common.c11
-rw-r--r--zephyr/test/drivers/default/src/tablet_mode.c66
-rw-r--r--zephyr/test/drivers/default/src/task.c84
-rw-r--r--zephyr/test/drivers/default/src/tcpci.c23
-rw-r--r--zephyr/test/drivers/default/src/tcpci_test_common.c9
-rw-r--r--zephyr/test/drivers/default/src/tcpm_header.c235
-rw-r--r--zephyr/test/drivers/default/src/tcs3400.c13
-rw-r--r--zephyr/test/drivers/default/src/temp_sensor.c111
-rw-r--r--zephyr/test/drivers/default/src/thermistor.c47
-rw-r--r--zephyr/test/drivers/default/src/uart_hostcmd.c8
-rw-r--r--zephyr/test/drivers/default/src/usb_mux.c58
-rw-r--r--zephyr/test/drivers/default/src/util.c8
-rw-r--r--zephyr/test/drivers/default/src/vboot_hash.c9
-rw-r--r--zephyr/test/drivers/default/src/virtual_battery.c155
-rw-r--r--zephyr/test/drivers/default/src/vstore.c15
-rw-r--r--zephyr/test/drivers/default/src/watchdog.c17
-rw-r--r--zephyr/test/drivers/dps/src/dps.c8
-rw-r--r--zephyr/test/drivers/host_cmd/CMakeLists.txt1
-rw-r--r--zephyr/test/drivers/host_cmd/src/adc.c8
-rw-r--r--zephyr/test/drivers/host_cmd/src/battery_cut_off.c6
-rw-r--r--zephyr/test/drivers/host_cmd/src/battery_display_soc.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/battery_v2.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/charge_manager.c48
-rw-r--r--zephyr/test/drivers/host_cmd/src/get_cmd_versions.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/get_panic_info.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c8
-rw-r--r--zephyr/test/drivers/host_cmd/src/host_command.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/host_command_test_protocol.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/host_event_commands.c3
-rw-r--r--zephyr/test/drivers/host_cmd/src/host_event_commands_deprecated.c187
-rw-r--r--zephyr/test/drivers/host_cmd/src/host_request_expected_size.c4
-rw-r--r--zephyr/test/drivers/host_cmd/src/keyboard_mkbp.c3
-rw-r--r--zephyr/test/drivers/host_cmd/src/motion_sense.c16
-rw-r--r--zephyr/test/drivers/host_cmd/src/pd_chip_info.c12
-rw-r--r--zephyr/test/drivers/host_cmd/src/pd_control.c30
-rw-r--r--zephyr/test/drivers/host_cmd/src/pd_log.c39
-rw-r--r--zephyr/test/drivers/host_cmd/src/tablet_mode.c111
-rw-r--r--zephyr/test/drivers/host_cmd/src/usb_pd_control.c10
-rw-r--r--zephyr/test/drivers/host_cmd/src/usb_pd_host_cmd.c6
-rw-r--r--zephyr/test/drivers/host_cmd_read_memmap/CMakeLists.txt7
-rw-r--r--zephyr/test/drivers/host_cmd_read_memmap/src/read_memmap.c96
-rw-r--r--zephyr/test/drivers/host_command_thread/CMakeLists.txt5
-rw-r--r--zephyr/test/drivers/host_command_thread/src/main.c83
-rw-r--r--zephyr/test/drivers/i2c_controller/include/basic_i2c_device_emul.h4
-rw-r--r--zephyr/test/drivers/i2c_controller/src/basic_i2c_device_emul.c7
-rw-r--r--zephyr/test/drivers/i2c_controller/src/i2c_controller.c122
-rw-r--r--zephyr/test/drivers/isl923x/src/charge_ramp_hw.c4
-rw-r--r--zephyr/test/drivers/isl923x/src/console_cmd_amon_bmon.c10
-rw-r--r--zephyr/test/drivers/keyboard_scan/include/keyboard_test_utils.h2
-rw-r--r--zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c43
-rw-r--r--zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c34
-rw-r--r--zephyr/test/drivers/keyboard_scan/src/keyboard_test_utils.c5
-rw-r--r--zephyr/test/drivers/keyboard_scan/src/mkbp_event.c121
-rw-r--r--zephyr/test/drivers/keyboard_scan/src/mkbp_info.c11
-rw-r--r--zephyr/test/drivers/led_common/CMakeLists.txt5
-rw-r--r--zephyr/test/drivers/led_common/src/main.c31
-rw-r--r--zephyr/test/drivers/led_driver/led_pins.dts32
-rw-r--r--zephyr/test/drivers/led_driver/led_policy.dts2
-rw-r--r--zephyr/test/drivers/led_driver/src/led.c3
-rw-r--r--zephyr/test/drivers/led_driver/src/led_common.c6
-rw-r--r--zephyr/test/drivers/locate_chip/src/locate_chip.c6
-rw-r--r--zephyr/test/drivers/memmap/CMakeLists.txt5
-rw-r--r--zephyr/test/drivers/memmap/src/main.c89
-rw-r--r--zephyr/test/drivers/mkbp/src/mkbp_fifo.c12
-rw-r--r--zephyr/test/drivers/power_host_sleep/src/test_power_host_sleep.c8
-rw-r--r--zephyr/test/drivers/prj.conf29
-rw-r--r--zephyr/test/drivers/rt9490/charger.dts13
-rw-r--r--zephyr/test/drivers/rt9490/prj.conf2
-rw-r--r--zephyr/test/drivers/rt9490/src/bc12.c26
-rw-r--r--zephyr/test/drivers/rt9490/src/charger.c4
-rw-r--r--zephyr/test/drivers/shim_gpio_id/gpio_id.dts8
-rw-r--r--zephyr/test/drivers/shim_gpio_id/src/test_shim_gpio_id.c4
-rw-r--r--zephyr/test/drivers/shim_pwm_hc/src/test_shim_pwm_hc.c16
-rw-r--r--zephyr/test/drivers/shim_rtc/src/test_shim_rtc.c10
-rw-r--r--zephyr/test/drivers/system/src/system.c10
-rw-r--r--zephyr/test/drivers/system/src/system_board_version_cbi.c8
-rw-r--r--zephyr/test/drivers/system/src/system_board_version_default.c4
-rw-r--r--zephyr/test/drivers/system/src/system_not_board_ap_set_sku_id.c4
-rw-r--r--zephyr/test/drivers/testcase.yaml69
-rw-r--r--zephyr/test/drivers/timer/src/timer.c8
-rw-r--r--zephyr/test/drivers/usb_common/CMakeLists.txt2
-rw-r--r--zephyr/test/drivers/usb_common/src/suite.c4
-rw-r--r--zephyr/test/drivers/usb_common/src/usb_common.c298
-rw-r--r--zephyr/test/drivers/usb_common/src/usb_pd_discharge.c8
-rw-r--r--zephyr/test/drivers/usb_common/src/usb_pd_flags.c6
-rw-r--r--zephyr/test/drivers/usb_malfunction_sink/src/usb_malfunction_sink.c13
-rw-r--r--zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c17
-rw-r--r--zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c8
-rw-r--r--zephyr/test/drivers/usbc_alt_mode/include/test_usbc_alt_mode.h7
-rw-r--r--zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c129
-rw-r--r--zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c12
-rw-r--r--zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode_ec_mode_entry.c10
-rw-r--r--zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c21
-rw-r--r--zephyr/test/drivers/usbc_ctvpd/CMakeLists.txt7
-rw-r--r--zephyr/test/drivers/usbc_ctvpd/include/test_usbc_ctvpd.h29
-rw-r--r--zephyr/test/drivers/usbc_ctvpd/src/main.c169
-rw-r--r--zephyr/test/drivers/usbc_ocp/src/usbc_ocp.c8
-rw-r--r--zephyr/test/drivers/usbc_ppc/src/usbc_ppc.c10
-rw-r--r--zephyr/test/drivers/usbc_svdm_dfp_only/boards/native_posix.overlay23
-rw-r--r--zephyr/test/drivers/usbc_svdm_dfp_only/prj.conf1
-rw-r--r--zephyr/test/drivers/usbc_svdm_dfp_only/src/usbc_svdm_dfp_only.c8
-rw-r--r--zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c19
-rw-r--r--zephyr/test/drivers/usbc_usb4_mode/CMakeLists.txt5
-rw-r--r--zephyr/test/drivers/usbc_usb4_mode/src/usbc_usb4_mode.c269
-rw-r--r--zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c21
-rw-r--r--zephyr/test/ec_app/prj.conf1
-rw-r--r--zephyr/test/ec_app/src/main.c8
-rw-r--r--zephyr/test/herobrine/CMakeLists.txt6
-rw-r--r--zephyr/test/herobrine/Kconfig2
-rw-r--r--zephyr/test/herobrine/README.md2
-rw-r--r--zephyr/test/herobrine/boards/native_posix.overlay2
-rw-r--r--zephyr/test/herobrine/prj.conf2
-rw-r--r--zephyr/test/herobrine/src/board_chipset.c8
-rw-r--r--zephyr/test/herobrine/testcase.yaml2
-rw-r--r--zephyr/test/hooks/hooks.c7
-rw-r--r--zephyr/test/i2c/prj.conf4
-rw-r--r--zephyr/test/i2c/src/main.c31
-rw-r--r--zephyr/test/i2c_dts/prj.conf3
-rw-r--r--zephyr/test/jump_tags/CMakeLists.txt13
-rw-r--r--zephyr/test/jump_tags/boards/native_posix.overlay33
-rw-r--r--zephyr/test/jump_tags/prj.conf14
-rw-r--r--zephyr/test/jump_tags/src/jump_tags.c176
-rw-r--r--zephyr/test/jump_tags/testcase.yaml13
-rw-r--r--zephyr/test/kingler/CMakeLists.txt13
-rw-r--r--zephyr/test/kingler/README.md2
-rw-r--r--zephyr/test/kingler/common.dts18
-rw-r--r--zephyr/test/kingler/prj.conf4
-rw-r--r--zephyr/test/kingler/src/alt_sensor.c12
-rw-r--r--zephyr/test/kingler/src/ccd.c10
-rw-r--r--zephyr/test/kingler/src/clamshell.c8
-rw-r--r--zephyr/test/kingler/src/db_detect_hdmi.c58
-rw-r--r--zephyr/test/kingler/src/db_detect_none.c11
-rw-r--r--zephyr/test/kingler/src/db_detect_typec.c8
-rw-r--r--zephyr/test/kingler/src/fakes.c3
-rw-r--r--zephyr/test/kingler/src/tablet.c8
-rw-r--r--zephyr/test/kingler/testcase.yaml14
-rw-r--r--zephyr/test/krabby/CMakeLists.txt10
-rw-r--r--zephyr/test/krabby/README.md2
-rw-r--r--zephyr/test/krabby/adc_temp.dts23
-rw-r--r--zephyr/test/krabby/common.dts71
-rw-r--r--zephyr/test/krabby/pinctrl.dts2
-rw-r--r--zephyr/test/krabby/prj.conf24
-rw-r--r--zephyr/test/krabby/src/charger_workaround.c10
-rw-r--r--zephyr/test/krabby/src/stubs.c58
-rw-r--r--zephyr/test/krabby/src/temp_tentacruel.c26
-rw-r--r--zephyr/test/krabby/src/usb_mux_init.c8
-rw-r--r--zephyr/test/krabby/src/usbc_config.c131
-rw-r--r--zephyr/test/krabby/testcase.yaml7
-rw-r--r--zephyr/test/math/src/fixed_point_int_sqrtf.c4
-rw-r--r--zephyr/test/math/src/mask.c7
-rw-r--r--zephyr/test/math/src/math_util.c6
-rw-r--r--zephyr/test/math/src/vector.c4
-rw-r--r--zephyr/test/qcom_power/boards/native_posix.overlay14
-rw-r--r--zephyr/test/qcom_power/prj.conf4
-rw-r--r--zephyr/test/qcom_power/src/main.c341
-rw-r--r--zephyr/test/rex/CMakeLists.txt6
-rw-r--r--zephyr/test/rex/README.md2
-rw-r--r--zephyr/test/rex/boards/native_posix.overlay2
-rw-r--r--zephyr/test/rex/src/usb_pd_policy.c7
-rw-r--r--zephyr/test/rex/testcase.yaml2
-rw-r--r--zephyr/test/system_common/prj.conf1
-rw-r--r--zephyr/test/system_common/src/build_info.c6
-rw-r--r--zephyr/test/system_common/src/get_version.c6
-rw-r--r--zephyr/test/system_common/src/reboot.c6
-rw-r--r--zephyr/test/system_common/src/system_is_locked.c4
-rw-r--r--zephyr/test/system_shim/CMakeLists.txt15
-rw-r--r--zephyr/test/system_shim/boards/native_posix.overlay5
-rw-r--r--zephyr/test/system_shim/include/fakes.h31
-rw-r--r--zephyr/test/system_shim/prj.conf13
-rw-r--r--zephyr/test/system_shim/src/no_chosen.c24
-rw-r--r--zephyr/test/system_shim/src/suite.c50
-rw-r--r--zephyr/test/system_shim/test_system.c (renamed from zephyr/test/system_shim/src/test_system.c)82
-rw-r--r--zephyr/test/system_shim/testcase.yaml15
-rw-r--r--zephyr/test/tasks/main.c9
-rw-r--r--zephyr/test/test_utils/tasks_fakes.c5
-rw-r--r--zephyr/test/uart_printf/CMakeLists.txt20
-rw-r--r--zephyr/test/uart_printf/include/common.h12
-rw-r--r--zephyr/test/uart_printf/include/printf.h23
-rw-r--r--zephyr/test/uart_printf/include/uart.h28
-rw-r--r--zephyr/test/uart_printf/prj.conf9
-rw-r--r--zephyr/test/uart_printf/src/fakes.cc36
-rw-r--r--zephyr/test/uart_printf/src/main.cc101
-rw-r--r--zephyr/test/uart_printf/testcase.yaml8
-rw-r--r--zephyr/test/vboot_efs2/boards/native_posix.overlay16
-rw-r--r--zephyr/test/vboot_efs2/prj.conf10
-rw-r--r--zephyr/test/vboot_efs2/src/main.c25
-rw-r--r--zephyr/zmake/tests/test_jobserver.py201
-rw-r--r--zephyr/zmake/zmake/__main__.py9
-rw-r--r--zephyr/zmake/zmake/jobserver.py149
-rw-r--r--zephyr/zmake/zmake/multiproc.py45
-rw-r--r--zephyr/zmake/zmake/zmake.py691
1149 files changed, 6711 insertions, 19716 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 0b36bcc24e..ae882e5640 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -182,8 +182,6 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSM
"${PLATFORM_EC}/driver/accelgyro_lsm6dsm.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ACCEL_FIFO
"${PLATFORM_EC}/common/motion_sense_fifo.c")
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_BODY_DETECTION
- "${PLATFORM_EC}/common/body_detection.c")
zephyr_library_sources_ifdef(CONFIG_ADC
"${PLATFORM_EC}/common/adc.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_ALS_TCS3400
@@ -246,9 +244,10 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CPS8100
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_OCPC
"${PLATFORM_EC}/common/ocpc.c")
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_EEPROM
"${PLATFORM_EC}/common/cbi.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_GPIO
+ "${PLATFORM_EC}/common/cbi.c"
"${PLATFORM_EC}/common/cbi_gpio.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CONSOLE_CMD_MEM
"${PLATFORM_EC}/common/memory_commands.c")
@@ -363,9 +362,6 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_SC7180
"${PLATFORM_EC}/power/qcom.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_POWERSEQ_SC7280
"${PLATFORM_EC}/power/qcom.c")
-if (CONFIG_PLATFORM_EC_HIBERNATE AND CONFIG_AP_PWRSEQ)
- zephyr_library_sources( "${PLATFORM_EC}/power/hibernate.c")
-endif ()
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_PANIC
"${PLATFORM_EC}/common/panic_output.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_SHA256_SW
diff --git a/zephyr/Kconfig b/zephyr/Kconfig
index 6b0a512328..f4d274ca1d 100644
--- a/zephyr/Kconfig
+++ b/zephyr/Kconfig
@@ -8,7 +8,6 @@ rsource "emul/Kconfig"
rsource "fake/Kconfig"
rsource "mock/Kconfig"
rsource "subsys/Kconfig"
-rsource "subsys/emul/Kconfig"
if ZTEST
@@ -333,14 +332,6 @@ config PLATFORM_EC_EXTPOWER_GPIO
project should define a GPIO pin named GPIO_AC_PRESENT, with
extpower_interrupt configured as the handler.
-config PLATFORM_EC_EXTPOWER_DEBOUNCE_MS
- int "Debounce time for external power signal"
- default 30
- help
- Enable external power signal debounce time. Extend the
- debounce time to ensure that the external power signal can
- supply stable power.
-
config PLATFORM_EC_FLASH_CROS
bool
help
@@ -349,6 +340,16 @@ config PLATFORM_EC_FLASH_CROS
e.g. to support auto-update. Various write-protection features are
also provided.
+config PLATFORM_EC_FPU
+ bool "Support floating point"
+ depends on FPU && (CPU_CORTEX_M || RISCV) && !NEWLIB_LIBC
+ default y
+ help
+ This enables support for floating point. This is generally already
+ provided in Zephyr, but the EC side expects a few functions to be
+ available which are not available with Zephyr's minimal lib: sqrtf()
+ and fabsf(). Enabling this options defines them.
+
config PLATFORM_EC_HOOKS
bool "Hooks and deferred compatibility shim"
default y
@@ -455,14 +456,6 @@ config PLATFORM_EC_POWER_COMMON
help
Compile common code for AP power state machine.
-config CROS_EC_POWER_SIGNAL_LIST
- bool "Define the power signal list from the devicetree"
- default y
- depends on $(dt_nodelabel_enabled,power_signal_list)
- help
- Define the global power_signal_list[] from the devicetree. Requires a
- node with nodelabel power_signal_list.
-
config PLATFORM_EC_MKBP_EVENT
bool "MKBP event"
help
@@ -551,7 +544,6 @@ config PLATFORM_EC_PWM_DISPLIGHT
bool "PWM display backlight"
default y
depends on DT_HAS_CROS_EC_DISPLIGHT_ENABLED
- select PWM
select PLATFORM_EC_PWM_HC
help
Enables display backlight controlled by a PWM signal connected
@@ -599,7 +591,7 @@ endchoice # PLATFORM_EC_SHA256_MODE
config PLATFORM_EC_SHA256_UNROLLED
bool "Manually unroll sha256 transform"
- depends on PLATFORM_EC_SHA256_SW
+ depends on PLATFORM_EC_SHA25_SW
default n
help
Enable loop unroll to improve the performance of sha256 software
@@ -622,17 +614,25 @@ config PLATFORM_EC_SWITCH
This also enables the "mmapinfo" console command to report the current
state of all switches.
+choice PLATFORM_EC_SWITCHCAP_TYPE
+ prompt "Enable switchcap support"
+ optional
+ help
+ Enable support for switchcap used to power on the AP.
+ If enabled, type of switchcap must be selected and node in device
+ tree must be added that describes the driver and pins used to control
+ the switchcap.
+
config PLATFORM_EC_SWITCHCAP_GPIO
bool "GPIO controlled switchcap"
- default y
- depends on DT_HAS_CROS_EC_SWITCHCAP_GPIO_ENABLED
help
Enable support for the GPIO controlled switchcap.
Pins used for controlling the switchcap must be defined in board's
device tree.
config PLATFORM_EC_SWITCHCAP_LN9310
- bool "LN9310 switchcap common code"
+ bool "LN9310 switchcap driver"
+ depends on PLATFORM_EC_I2C
help
Enable support for the LION Semiconductor LN9310 switched
capacitor converter. This will export definitions for
@@ -640,14 +640,7 @@ config PLATFORM_EC_SWITCHCAP_LN9310
project-specific code should call appropriately if there's
no switchcap node in device tree.
-config CROS_EC_SWITCHCAP_LN9310
- bool "LN9310 switchcap generic driver"
- default y
- depends on DT_HAS_LION_LN9310_ENABLED
- help
- Enable support for the generic driver for the LION Semiconductor
- LN9310 switched capacitor converter. This requires a lion,ln9310 node
- to be defined.
+endchoice
config PLATFORM_EC_SYSTEM_UNLOCKED
bool "System unlocked: allow dangerous commands while in development"
@@ -807,14 +800,4 @@ config PLATFORM_EC_MATH_UTIL
Math utilities including bitmask manipulation, division rounding,
trigonometric function, etc.
-config PLATFORM_EC_GPIO_ID
- bool "Enable GPIO ID handling for board and sku ids"
- default y
- depends on DT_HAS_CROS_EC_GPIO_ID_ENABLED
- help
- Enable setting board and sku IDs using GPIOs. Defines the
- board_get_sku_id and board_get_version functions based on the
- devicetree node using the known nodelabels gpio_id_sku and
- gpio_id_board.
-
endif # PLATFORM_EC
diff --git a/zephyr/Kconfig.adc b/zephyr/Kconfig.adc
index 5efc1a9bd5..40ec1e4e89 100644
--- a/zephyr/Kconfig.adc
+++ b/zephyr/Kconfig.adc
@@ -2,10 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-config ADC
- default y
- depends on DT_HAS_NAMED_ADC_CHANNELS_ENABLED
-
# Note - CONFIG_ADC is defined in upstream Zephyr
if ADC
diff --git a/zephyr/Kconfig.battery b/zephyr/Kconfig.battery
index 2aedc00dca..92bce6b618 100644
--- a/zephyr/Kconfig.battery
+++ b/zephyr/Kconfig.battery
@@ -4,8 +4,6 @@
menuconfig PLATFORM_EC_BATTERY
bool "Battery support"
- default y
- depends on DT_HAS_BATTERY_SMART_ENABLED
help
Enables battery support on the board. Requires selection of a battery
and a charger IC.
diff --git a/zephyr/Kconfig.body_detection b/zephyr/Kconfig.body_detection
deleted file mode 100644
index 85386a68c1..0000000000
--- a/zephyr/Kconfig.body_detection
+++ /dev/null
@@ -1,97 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-menuconfig PLATFORM_EC_BODY_DETECTION
- bool "Sensor body detection"
- help
- Enable the body detection function.
-
- The Power Reduction Algorithm is based on the Motion Detector
- output of In Motion (on body) state or Stationary (off body) state.
- The input of the Motion Detector is the X and Y axis signal
- from an accelerometer.
-
-if PLATFORM_EC_BODY_DETECTION
-
-config PLATFORM_EC_BODY_DETECTION_MAX_WINDOW_SIZE
- int "Maximal sensor data rate"
- default 250
- help
- Sets the maximum sensor data rate, in Hz. Note that larger data rate
- values consume more memory and computing resource.
-
-config PLATFORM_EC_BODY_DETECTION_VAR_THRESHOLD
- int "The threshold of acceleration variance for confidence calculation"
- default 550
- help
- The unit is (mm/s^2)^2
-
- The motion confidence is calculated if the variance is within
- variance_threshold +/- confidence_delta. Otherwise, if variance is
- too high/low, confidence will be 100%/0%
-
-config PLATFORM_EC_BODY_DETECTION_CONFIDENCE_DELTA
- int "The delta of acceleration variance for confidence calculation"
- default 525
- help
- The unit is (mm/s^2)^2
-
- The motion confidence is calculated if the variance is within
- variance_threshold +/- confidence_delta. Otherwise, if variance is
- too high/low, confidence will be 100%/0%
-
-config PLATFORM_EC_BODY_DETECTION_VAR_NOISE_FACTOR
- int "How much noise affects the threshold of variance"
- default 120
- help
- The unit is percentage
-
- This is used for mitigate the effect of the noise from the sensor.
- If set to 100%, the average noise is canceled out. This is set to
- 120% by default because the noise might get larger than average
- sometimes.
-
-config PLATFORM_EC_BODY_DETECTION_ON_BODY_CON
- int "The confidence limit of on_body"
- default 50
- help
- The unit is percentage
-
- Higher the value, more diffcult to enter the on-body from off-body
-
-config PLATFORM_EC_BODY_DETECTION_OFF_BODY_CON
- int "The confidence limit of off body"
- default 10
- help
- The unit is percentage
-
- Lower the value, more diffcult to enter the off-body from on-body.
- Should be set less than the PLATFORM_EC_BODY_DETECTION_ON_BODY_CON
-
-config PLATFORM_EC_BODY_DETECTION_STATIONARY_DURATION
- int "The threshold duration to change to off_body"
- default 15
- help
- The unit is seconds
-
- How long should we stay in on-body state before entering to off-body
- state when the motion confidence is less than
- PLATFORM_EC_BODY_DETECTION_OFF_BODY_CON
-
-config PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE
- bool "Notify host with a specific host event when body status is changed"
- default n
- help
- Notify the host via SCI events EC_HOST_EVENT_MODE_CHANGE when body
- status is changed, in addition to adding an event in the motion sensor
- FIFO queue.
-
-config PLATFORM_EC_BODY_DETECTION_ALWAYS_ENABLE_IN_S0
- bool "Always enable body detection function in S0"
- default n
- help
- Always enable the body detection function in S0
- w/o the host command
-
-endif # PLATFORM_EC_BODY_DETECTION
diff --git a/zephyr/Kconfig.cbi b/zephyr/Kconfig.cbi
index db54c87fbb..a2be51375e 100644
--- a/zephyr/Kconfig.cbi
+++ b/zephyr/Kconfig.cbi
@@ -19,9 +19,9 @@ config PLATFORM_EC_EEPROM_CBI_WP
signal. The accompanying hardware must ensure that the CBI WP gets
latched and is only reset when EC_RST_ODL is asserted.
-config PLATFORM_EC_CBI
- bool "CBI support"
- default y
+choice PLATFORM_EC_CBI_STORAGE_TYPE
+ prompt "Select CBI storage Type"
+ optional
help
CBI is a means for accessing board information, typically set
during the factory process. This allows selection of the physical
@@ -31,14 +31,6 @@ config PLATFORM_EC_CBI
https://chromium.googlesource.com/chromiumos/docs/+/HEAD/design_docs/cros_board_info.md
-if PLATFORM_EC_CBI
-
-choice PLATFORM_EC_CBI_STORAGE_TYPE
- prompt "CBI storage type"
- default PLATFORM_EC_CBI_EEPROM if $(dt_nodelabel_enabled,cbi_eeprom)
- help
- Select the backing storage type for CBI data.
-
config PLATFORM_EC_CBI_EEPROM
bool "CBI EEPROM support"
depends on EEPROM
@@ -54,5 +46,3 @@ config PLATFORM_EC_CBI_GPIO
CBI for AP to query.
endchoice
-
-endif # PLATFORM_EC_CBI
diff --git a/zephyr/Kconfig.charger b/zephyr/Kconfig.charger
index c2c6eeb3f4..f408797d17 100644
--- a/zephyr/Kconfig.charger
+++ b/zephyr/Kconfig.charger
@@ -63,21 +63,6 @@ config PLATFORM_EC_CHARGE_MANAGER
source is available on the hardware, so cannot be built without
PLATFORM_EC_USBC.
-config PLATFORM_EC_CHARGE_STATE_DEBUG
- bool "Debug information about the charge state"
- depends on PLATFORM_EC_CHARGE_MANAGER
- help
- Enables debug information regarding the current charge state. Enabling
- this config will allow the EC_CMD_CHARGE_STATE host command to use the
- CHARGE_STATE_CMD_GET_PARAM command to query the current charge state.
-
-config PLATFORM_EC_CMD_PWR_AVG
- bool "Enable the console command to print power average"
- depends on PLATFORM_EC_CHARGE_MANAGER
- help
- Enables the console command which prints out the current (past 1
- minute) power average.
-
config PLATFORM_EC_CHARGESPLASH
bool "Charging splashscreen support"
help
@@ -186,8 +171,6 @@ config PLATFORM_EC_CHARGER_RAA489000
config PLATFORM_EC_CHARGER_RT9490
bool "Use the RT9490 charger"
- default y
- depends on DT_HAS_RICHTEK_RT9490_ENABLED || DT_HAS_ZEPHYR_RT9490_EMUL_ENABLED
depends on PLATFORM_EC_I2C
select PLATFORM_EC_CHARGER_OTG_SUPPORTED
help
@@ -204,12 +187,6 @@ config PLATFORM_EC_CHARGER_SM5803
Enables the driver for the SM5803.
The SM5803 is the Silicon Mitus SM5803 Buck-Boost Charger.
- This charger is known to be very inefficient when operating in buck-boost
- mode (when input voltage is close to output voltage), such that permanent
- damage may be done to the charger. Users should exercise caution around
- choice of supported configurations: see b:260271871, b:258754576, and
- b:230712704 for more information.
-
if PLATFORM_EC_OCPC
@@ -222,13 +199,6 @@ config PLATFORM_EC_OCPC_DEF_RBATT_MOHMS
This should be at a minimum the Rds(on) resistance of the BFET plus
the series sense resistor.
-config PLATFORM_EC_OCPC_DEF_DRIVELIMIT_MILLIVOLTS
- int "Drive Limit for the OCPC PID control loop"
- default 10
- help
- Sets how agressively the OCPC PID control loop can adjust VSYS to drive
- the battery with the correct current.
-
endif # PLATFORM_EC_OCPC
config PLATFORM_EC_CHARGER_DISCHARGE_ON_AC
diff --git a/zephyr/Kconfig.defaults b/zephyr/Kconfig.defaults
index a7497ca9a4..e0992f91fa 100644
--- a/zephyr/Kconfig.defaults
+++ b/zephyr/Kconfig.defaults
@@ -13,6 +13,9 @@ config LOG
default y
imply LOG_DEFAULT_MINIMAL
+config GPIO_EMUL
+ default y if ARCH_POSIX
+
config GPIO
default y if ARCH_POSIX
@@ -22,9 +25,6 @@ config THREAD_MAX_NAME_LEN
config SHELL_PROMPT_UART
default "ec:~$ "
-config SHELL_VT100_COLORS
- default n
-
config SHELL_THREAD_PRIORITY_OVERRIDE
default y
@@ -34,10 +34,4 @@ config SHELL_THREAD_PRIORITY
config EXTRA_EXCEPTION_INFO
default y if ARCH_HAS_EXTRA_EXCEPTION_INFO
-config EEPROM_SHELL
- default n
-
-config PWM_SHELL
- default n
-
orsource "Kconfig.defaults-$(ARCH)"
diff --git a/zephyr/Kconfig.i2c b/zephyr/Kconfig.i2c
index 9fa1d274aa..0187409b31 100644
--- a/zephyr/Kconfig.i2c
+++ b/zephyr/Kconfig.i2c
@@ -3,10 +3,7 @@
# found in the LICENSE file.
config PLATFORM_EC_I2C
- bool "EC I2C Support"
- default y
- depends on DT_HAS_NAMED_I2C_PORTS_ENABLED
- select I2C
+ def_bool I2C
help
Enable compilation of the EC i2c module. Once enabled, it will be
possible to make calls using the old platform/ec i2c APIs defined
diff --git a/zephyr/Kconfig.ioex b/zephyr/Kconfig.ioex
index 9be34197db..e9bb8065e1 100644
--- a/zephyr/Kconfig.ioex
+++ b/zephyr/Kconfig.ioex
@@ -4,8 +4,7 @@
menuconfig PLATFORM_EC_IOEX_CROS_DRV
bool "IO expander support"
- default y
- depends on I2C && DT_HAS_CROS_IOEX_CHIP_ENABLED
+ depends on I2C
help
Enable support for CrOS EC ioex drivers.
diff --git a/zephyr/Kconfig.keyboard b/zephyr/Kconfig.keyboard
index c425d7af0d..e0f1b2517e 100644
--- a/zephyr/Kconfig.keyboard
+++ b/zephyr/Kconfig.keyboard
@@ -19,15 +19,6 @@ menuconfig PLATFORM_EC_KEYBOARD
if PLATFORM_EC_KEYBOARD
-config CROS_EC_KEYSCAN
- bool "Devicetree based keyscan map"
- default y
- depends on DT_HAS_CROS_EC_KEYSCAN_ENABLED
- help
- Define a keyscan_config data structure based on a the keyscan
- configuration found in devicetree. Requires a cros-ec,keyscan node to
- be defined.
-
choice PLATFORM_EC_KEYBOARD_PROTOCOL_MODE
prompt "Select the keyboard protocol to use"
help
@@ -59,8 +50,6 @@ endchoice # PLATFORM_EC_KEYBOARD_PROTOCOL_MODE
config PLATFORM_EC_KEYBOARD_DISCRETE
bool "Support discrete Keyboard"
- default y
- depends on $(dt_nodelabel_enabled,kb_discrete)
help
Enable support for a discrete Keyboard if the platform needs one
or the raw Keyboard support is not built-in in the EC.
@@ -73,13 +62,6 @@ config PLATFORM_EC_KEYBOARD_DEBUG
if the board is currently headless and keyboard functionality is being
checked.
-config PLATFORM_EC_KEYBOARD_FACTORY_TEST
- bool "Support keyboard factory test"
- help
- Enable support "ectool kbfactorytest" command.
- Need to map keyboard connector pins to EC GPIO pins in
- keyboard_factory_scan_pins table.
-
config PLATFORM_EC_KEYBOARD_KEYPAD
bool "Support a numeric keypad"
help
@@ -103,17 +85,17 @@ config PLATFORM_EC_KEYBOARD_VIVALDI
config PLATFORM_EC_KEYBOARD_CUSTOMIZATION
bool "Support keyboard customization"
help
- Enable support for customization keyboard, some boards need to custom matrix
- because those board keyboard layout doesn't follow a common matrix.
+ Enable support for customization keyboard, some boards need to custom matrix
+ because those board keyboard layout doesn't follow a common matrix.
- If define, the board layer
- needs to implement:
- 1. the scancode_set2 and keycap_label array
- 2. keyboard_customization.h which is similar to keyboard_config.h
+ If define, the board layer
+ needs to implement:
+ 1. the scancode_set2 and keycap_label array
+ 2. keyboard_customization.h which is similar to keyboard_config.h
- Note that if your board has the standard chromeos keyboard layout other
- than the top row, and you are looking only for top row customization,
- then you should be looking at overriding board_vivaldi_keybd_config() instead.
+ Note that if your board has the standard chromeos keyboard layout other
+ than the top row, and you are looking only for top row customization,
+ then you should be looking at overriding board_vivaldi_keybd_config() instead.
choice PLATFORM_EC_KEYBOARD_PWRBTN_MODE
prompt "Select the impact of pressing the power button"
@@ -217,7 +199,6 @@ config PLATFORM_EC_PWM_KBLIGHT
bool "PWM keyboard backlight"
default y
depends on DT_HAS_CROS_EC_KBLIGHT_PWM_ENABLED
- select PWM
select PLATFORM_EC_PWM_HC
help
Enables a PWM-controlled keyboard backlight controlled by a PWM signal
diff --git a/zephyr/Kconfig.led b/zephyr/Kconfig.led
index da00d6ff9c..d3d50ccc56 100644
--- a/zephyr/Kconfig.led
+++ b/zephyr/Kconfig.led
@@ -19,9 +19,6 @@ if PLATFORM_EC_LED_COMMON
config PLATFORM_EC_LED_PWM
bool "PWM (Pulse Width Modulation) LEDs"
- default y
- depends on DT_HAS_CROS_EC_PWM_LEDS_ENABLED
- select PWM
help
Enable PWM (Pulse Width Modulation) controlled LEDs that conform to
the Chromium OS LED behavior specification.
@@ -170,8 +167,6 @@ endif # PLATFORM_EC_LED_COMMON
config PLATFORM_EC_MAX695X_SEVEN_SEGMENT_DISPLAY
bool "MAX695X Seven Segment Display"
- default y
- depends on DT_HAS_MAXIM_MAX695X_ENABLED
help
Enable this to support MAX6958/MAX6959 7-Segment LED Display.
The MAX6958/MAX6959 is a compact multiplexed common - cathode display
diff --git a/zephyr/Kconfig.led_dt b/zephyr/Kconfig.led_dt
index adedfb16b6..25993802a3 100644
--- a/zephyr/Kconfig.led_dt
+++ b/zephyr/Kconfig.led_dt
@@ -3,27 +3,7 @@
# found in the LICENSE file.
menuconfig PLATFORM_EC_LED_DT
- bool "DT LED Support"
+ bool "LED Support"
help
Enable devicetree based LED module supporting automatic control of the
battery and power LEDs.
-
-if PLATFORM_EC_LED_DT
-
-config PLATFORM_EC_LED_DT_GPIO
- bool "DT LED Support (GPIO)"
- default y
- depends on DT_HAS_CROS_EC_GPIO_LED_PINS_ENABLED
- help
- Enable support for devicetree GPIO LEDs, requires a node using the
- cros-ec,gpio-led-pins compatible.
-
-config PLATFORM_EC_LED_DT_PWM
- bool "DT LED Support (PWM)"
- default y
- depends on DT_HAS_CROS_EC_PWM_LED_PINS_ENABLED
- select PWM
- help
- Enable support for devicetree PWM LEDs, requires a node using the
- cros-ec,pwm-led-pins compatible.
-endif
diff --git a/zephyr/Kconfig.motionsense b/zephyr/Kconfig.motionsense
index 86a7fb08bc..7cf991918b 100644
--- a/zephyr/Kconfig.motionsense
+++ b/zephyr/Kconfig.motionsense
@@ -93,9 +93,10 @@ config PLATFORM_EC_LID_ANGLE
peripheral devices(refer "Lid Angle Update" below).
# TODO(b/173507858): add more detail after .dts change
+if PLATFORM_EC_LID_ANGLE
+
config PLATFORM_EC_LID_ANGLE_UPDATE
bool "Lid Angle Update"
- depends on PLATFORM_EC_LID_ANGLE
help
Enable this to allow using the lid angle measurement to determine if
peripheral devices should be enabled or disabled, like key scanning,
@@ -126,6 +127,7 @@ config PLATFORM_EC_GMR_TABLET_MODE
in common/tablet_mode.c.
endif # PLATFORM_EC_TABLET_MODE
+endif # PLATFORM_EC_LID_ANGLE
config PLATFORM_EC_CONSOLE_CMD_ACCELS
bool "Console commands: accels, accelrate, accelinit, accelinfo, etc."
@@ -172,10 +174,4 @@ config PLATFORM_EC_CONSOLE_CMD_ACCEL_SPOOF
endif # PLATFORM_EC_ACCEL_SPOOF_MODE
-config PLATFORM_EC_GESTURE_HOST_DETECTION
- bool "Gesture host detection"
- help
- Enable gesture host interface
-
rsource "Kconfig.sensor_devices"
-rsource "Kconfig.body_detection"
diff --git a/zephyr/Kconfig.panic b/zephyr/Kconfig.panic
index 4bffa64b39..c402fc1e70 100644
--- a/zephyr/Kconfig.panic
+++ b/zephyr/Kconfig.panic
@@ -2,14 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-config PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE
- int "Size of preserved ram for panic and jump data"
- default 1024
- help
- Size of preserved non-initialized memory at end of ram for panic and
- jump data. The linker will ensure at least this much space is
- unallocated.
-
if PLATFORM_EC_PANIC
config PLATFORM_EC_SOFTWARE_PANIC
diff --git a/zephyr/Kconfig.pd b/zephyr/Kconfig.pd
index c84c57d3c0..f6508c2da0 100644
--- a/zephyr/Kconfig.pd
+++ b/zephyr/Kconfig.pd
@@ -161,15 +161,11 @@ menuconfig PLATFORM_EC_USB_PD_DPS
default n
select HAS_TASK_DPS
help
- Enable this to permit dynamic PDO selection (DPS). DPS can select different
- USB PDOs depending on system load and battery configuration to select input
- characteristics (particularly voltage) that allow the system to operate more
- efficiently.
-
- This should not be enabled without evaluating charger efficiency against
- input voltage and overriding `dps_config` as necessary to accurately reflect
- actual platform behavior: untuned behavior is likely to be worse than
- leaving DPS disabled.
+ Enable this if the board needs dynamic PDO selection.
+ DPS picks a power efficient PDO regarding to the underlying battery
+ configuration and the system loading.
+ Default configuration can be overridden by `dps_config` to adapt
+ to each board's need.
config PLATFORM_EC_USB_PD_DUAL_ROLE_AUTO_TOGGLE
bool "Board can use TCPC-controlled DRP toggle"
@@ -308,15 +304,6 @@ config PLATFORM_EC_USB_PE_SM
USB devices. You should normally define this unless you want to
override it in your board code, which is not recommended.
-config PLATFORM_EC_USB_DPM_SM
- bool "Device Policy Manager (DPM) state machine"
- default y
- help
- This enables the device policy manager portion of the power-delivery
- (PD), protocol which is used to define port policy decision. You
- should normally define this unless you want to override it in your
- board code, which is not recommended.
-
config PLATFORM_EC_USB_PD_DECODE_SOP
def_bool y # Required for TCPMV2
help
diff --git a/zephyr/Kconfig.pmic b/zephyr/Kconfig.pmic
index ef1df085c8..831767c546 100644
--- a/zephyr/Kconfig.pmic
+++ b/zephyr/Kconfig.pmic
@@ -15,8 +15,8 @@ if PLATFORM_EC_PMIC
config PLATFORM_EC_MP2964
bool "Enable MP2964 PMIC support"
- default y
- depends on DT_HAS_MPS_MP2964_ENABLED
+ depends on AP_X86_INTEL
+ depends on PLATFORM_EC_I2C
help
Enables support for the MPS MP2964 PMIC (Power Management IC).
This is a dual rail IMVP8 - IMVP9.1 compatible Digital
diff --git a/zephyr/Kconfig.retimer b/zephyr/Kconfig.retimer
index 3a052f1f1a..9ce134dc13 100644
--- a/zephyr/Kconfig.retimer
+++ b/zephyr/Kconfig.retimer
@@ -6,8 +6,6 @@ if PLATFORM_EC_USBC
config PLATFORM_EC_USBC_RETIMER_INTEL_BB
bool "Support Intel Burnside Bridge retimer"
- depends on PLATFORM_EC_USB_MUX
- depends on DT_HAS_INTEL_JHL8040R_ENABLED
select PLATFORM_EC_USB_PD_USB4
select PLATFORM_EC_USB_PD_TBT_COMPAT_MODE
help
@@ -31,8 +29,6 @@ config PLATFORM_EC_USBC_RETIMER_INTEL_BB
config PLATFORM_EC_USBC_RETIMER_INTEL_HB
bool "Support Intel Hayden Bridge retimer"
- depends on PLATFORM_EC_USB_MUX
- depends on DT_HAS_INTEL_JHL8040R_ENABLED
select PLATFORM_EC_USB_PD_USB4
select PLATFORM_EC_USB_PD_TBT_COMPAT_MODE
help
diff --git a/zephyr/Kconfig.system b/zephyr/Kconfig.system
index ec0333ec35..5467bc7422 100644
--- a/zephyr/Kconfig.system
+++ b/zephyr/Kconfig.system
@@ -18,50 +18,16 @@ config PLATFORM_EC_CONSOLE_CMD_SYSINFO
Enable the sysinfo console command, which shows statistics
about the current image copy running, reset flags, etc.
-config PLATFORM_EC_HIBERNATE
- bool
- help
- Enable system hibernation.
- The type of hibernation supported must be selected.
-
-choice PLATFORM_EC_HIBERNATE_TYPE
- prompt "Choose a hibernate type"
- default PLATFORM_EC_HIBERNATE_PSL if DT_HAS_NUVOTON_NPCX_POWER_PSL_ENABLED && SOC_FAMILY_NPCX
- default PLATFORM_EC_HIBERNATE_WAKE_PINS if !DT_HAS_NUVOTON_NPCX_POWER_PSL_ENABLED || !SOC_FAMILY_NPCX
- help
- Select the type of hibernation supported. Either
- PLATFORM_EC_HIBERNATE_PSL (for power switch logic support) or
- PLATFORM_EC_HIBERNATE_WAKE_PINS (using wake pins) are
- supported.
-
config PLATFORM_EC_HIBERNATE_PSL
bool "System hibernating with PSL (Power Switch Logic) mechanism"
+ default y
depends on DT_HAS_NUVOTON_NPCX_POWER_PSL_ENABLED
depends on SOC_FAMILY_NPCX
- select PLATFORM_EC_HIBERNATE
help
Use PSL (Power Switch Logic) for hibernating. It turns off VCC power
rail for ultra-low power consumption and uses PSL inputs rely on VSBY
power rail to wake up ec and the whole system.
-config PLATFORM_EC_HIBERNATE_WAKE_PINS
- bool "System hibernating with wake-source pins"
- select PLATFORM_EC_HIBERNATE
- help
- Use wake source pins for hibernating. It turns off VCC power
- rail for ultra-low power consumption and uses a low power
- power rail. Changes on wake source pins will wake up the EC.
-
-endchoice # PLATFORM_EC_HIBERNATE_TYPE
-
-config PLATFORM_EC_HIBERNATE_DELAY_SEC
- int "Delay in seconds from AP power off to hibernate"
- depends on PLATFORM_EC_HIBERNATE
- default 3600
- help
- This value is the delay in seconds from when the AP enters G3
- to when the system is hibernated.
-
config PLATFORM_EC_SYSTEM_PRE_INIT_PRIORITY
int "System pre-initialization priority"
default 20
diff --git a/zephyr/Kconfig.temperature b/zephyr/Kconfig.temperature
index 82bac6922f..09756663bc 100644
--- a/zephyr/Kconfig.temperature
+++ b/zephyr/Kconfig.temperature
@@ -4,8 +4,6 @@
menuconfig PLATFORM_EC_TEMP_SENSOR
bool "Temperature sensors"
- default y
- depends on DT_HAS_CROS_EC_TEMP_SENSORS_ENABLED
help
Support for temperature sensors. Once enabled, "temps" console
command and EC_CMD_TEMP_SENSOR_GET_INFO host command are available.
@@ -35,8 +33,6 @@ config PLATFORM_EC_DPTF
config PLATFORM_EC_THERMISTOR
bool "Thermistor support"
- default y
- depends on DT_HAS_CROS_EC_THERMISTOR_ENABLED
depends on ADC
help
Enables support for thermistors (resistor whose resistance is
@@ -44,24 +40,18 @@ config PLATFORM_EC_THERMISTOR
config PLATFORM_EC_TEMP_SENSOR_PCT2075
bool "PCT2075 support"
- default y
- depends on DT_HAS_NXP_PCT2075_ENABLED
help
Enables support for the CrosEC PCT2075 sensor, an i2c peripheral
temperature sensor from NXP.
config PLATFORM_EC_TEMP_SENSOR_SB_TSI
bool "SB TSI support"
- default y
- depends on DT_HAS_AMD_SB_TSI_ENABLED
help
Enables support for the Side Band Temperature Sensor Interface,
an i2c peripheral available on AMD platforms.
config PLATFORM_EC_TEMP_SENSOR_TMP112
bool "TMP112 support"
- default y
- depends on DT_HAS_CROS_EC_TEMP_SENSOR_TMP112_ENABLED
help
Enables support for the CrosEC TMP112 driver, an i2c peripheral
temperature sensor from TI.
@@ -91,7 +81,6 @@ config PLATFORM_EC_FAN
bool "Fan support"
default y
depends on DT_HAS_CROS_EC_FANS_ENABLED
- select PWM
help
Enables support for fans. Allows periodic thermal task to
automatically set the fan speed (control temperature).
@@ -101,13 +90,6 @@ config PLATFORM_EC_FAN
available. Also enables a periodic task (1s) to verify fan is
running (is not stalled).
-config PLATFORM_EC_CUSTOM_FAN_CONTROL
- bool "Fan custom control support"
- default n
- help
- Enable fan custom control to let projects define
- their own fan control mechanism by EC.
-
if PLATFORM_EC_FAN
config PLATFORM_EC_NUM_FANS
diff --git a/zephyr/Kconfig.usb_charger b/zephyr/Kconfig.usb_charger
index fa17f6c020..1c58753412 100644
--- a/zephyr/Kconfig.usb_charger
+++ b/zephyr/Kconfig.usb_charger
@@ -40,8 +40,6 @@ config PLATFORM_EC_BC12_CLIENT_MODE_ONLY_PI3USB9201
config PLATFORM_EC_BC12_DETECT_PI3USB9201
bool "Enable support for Pericom PI3USB9201"
select PLATFORM_EC_BC12_DETECT_DATA_ROLE_TRIGGER
- default y
- depends on DT_HAS_PERICOM_PI3USB9201_ENABLED
help
This is a Dual-Role USB Charging-Type Detector. It can operate in
host or client mode. It supports Battery Charging Specification, rev
diff --git a/zephyr/Kconfig.usb_mux b/zephyr/Kconfig.usb_mux
index 376a28f9b2..6f4e31a2cf 100644
--- a/zephyr/Kconfig.usb_mux
+++ b/zephyr/Kconfig.usb_mux
@@ -7,7 +7,6 @@ if PLATFORM_EC_USBC
menuconfig PLATFORM_EC_USB_MUX
bool "USB muxes"
default y
- depends on DT_HAS_CROS_EC_USB_MUX_CHAIN_ENABLED
help
Enables support for USB muxes. These allow multiplexing
diff --git a/zephyr/Kconfig.usba b/zephyr/Kconfig.usba
index b5413d2c83..8abbe839f6 100644
--- a/zephyr/Kconfig.usba
+++ b/zephyr/Kconfig.usba
@@ -4,8 +4,6 @@
menuconfig PLATFORM_EC_USBA
bool "USB Type-A support"
- default y
- depends on DT_HAS_CROS_EC_USBA_PORT_ENABLE_PINS_ENABLED
help
Enable USB Type A ports
diff --git a/zephyr/Kconfig.usbc b/zephyr/Kconfig.usbc
index 082f96ca7f..903cf575c6 100644
--- a/zephyr/Kconfig.usbc
+++ b/zephyr/Kconfig.usbc
@@ -31,54 +31,18 @@ rsource "Kconfig.usb_charger"
if PLATFORM_EC_USBC
-config PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT
+config PLATFORM_EC_CHARGER_INPUT_CURRENT
int "Charger input current in mA"
depends on PLATFORM_EC_CHARGE_MANAGER
default 512
help
- Default input current limit for the board in mA.
+ This is the default input current for the board in mA. Many boards
+ also use this as the least maximum input current during transients.
This value should depend on external power adapter, designed charging
voltage, and the maximum power of the running system. For type-C
- chargers, this should be set to no more than 512 mA in order to not
- brown-out low-current USB charge ports in accordance with USB-PD r3.0
- Sec. 7.3.
-
-config PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT
- int "Minimum charger input current limit in mA"
- default 0
- depends on PLATFORM_EC_CHARGE_MANAGER
- help
- Minimum current limit in mA that will ever be set for chargers, even if a
- lower limit is requested.
-
- If set, this should usually be set to no more than 2.5W divided by the
- maximum supported input voltage in order to satisfy USB-PD pSnkStdby
- requirements. Higher values may help devices stay alive under low-battery
- conditions at the cost of violating standby power limits.
-
- Many boards set this to large values, since historically this number was
- usually equal to the default current limit. New boards should avoid doing
- so if possible, and usually leave this unset: customization of
- board_set_charge_limit() should be considered instead if a device sometimes
- requires amounts of power in violation of specs, to limit those violations
- only to situations where they are necessary.
-
-config PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT
- int "Charger input current derating percentage"
- default 0
- depends on PLATFORM_EC_CHARGE_MANAGER
- help
- Setting this to a nonzero value causes actual charger current limits
- to be adjusted by the given percentage. For example, setting this to
- 4 and requesting a current limit of 1000 mA causes the charge manager
- to program an actual current limit of 960 mA.
-
- This is useful if a charger consistently draws more current than the
- programmed limit, or if it is desired to derate for other
- safety-related reasons. If a more complex (non-linear) adjustment is
- required, boards should override the board_set_charge_limit()
- function instead of configuring this option.
+ chargers, this should be set to 512 mA in order to not brown-out
+ low-current USB charge ports in accordance with USB-PD r3.0 Sec. 7.3
config PLATFORM_EC_USBC_OCP
bool
diff --git a/zephyr/app/ec/Kconfig b/zephyr/app/ec/Kconfig
index 72c80f5d3a..fbf6185740 100644
--- a/zephyr/app/ec/Kconfig
+++ b/zephyr/app/ec/Kconfig
@@ -27,14 +27,6 @@ config NUM_PREEMPT_PRIORITIES
default 26
#
-# Override the LOG_PRINTK to be no as it currently makes multiple
-# tests timeout and a few others fail in console assertions
-# TODO(b/http://b/260772137) Fix LOG_PRINTK issue and remove override
-#
-config LOG_PRINTK
- default n
-
-#
# In Zephyr, the default system workqueue thread priority level is the lowest
# cooperative priority. Override its priority to the second lowest preempt
# priority. (i.e. NUM_PREEMPT_PRIORITIES - 1)
@@ -162,22 +154,4 @@ config SHIMMED_TASKS
build. The CROS_EC_TASK_LIST defines a list of CROS_EC_TASK that
should be shimmed in.
-#
-# These shell options are turned off by MINIMAL_SHELL, but are important to us;
-# override Zephyr's default to keep them on.
-#
-config SHELL_HISTORY
- default y
-
-config SHELL_TAB
- default y
-
-config SHELL_TAB_AUTOCOMPLETION
- default y if SHELL_TAB
-
-config SHELL_HELP
- default y
-
-config KERNEL_SHELL
- default y
endif # CROS_EC
diff --git a/zephyr/app/ec/chip/riscv/riscv-ite/it8xxx2-espi.c b/zephyr/app/ec/chip/riscv/riscv-ite/it8xxx2-espi.c
index 3c623b5aac..6109964cb9 100644
--- a/zephyr/app/ec/chip/riscv/riscv-ite/it8xxx2-espi.c
+++ b/zephyr/app/ec/chip/riscv/riscv-ite/it8xxx2-espi.c
@@ -2,12 +2,11 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
+#include <soc_espi.h>
#include <ap_power/ap_power.h>
#include <chipset.h>
-#include <soc_espi.h>
+#include <zephyr/devicetree.h>
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ec_chip_it8xxx2_espi, CONFIG_ESPI_LOG_LEVEL);
diff --git a/zephyr/app/ec/ec_app_main.c b/zephyr/app/ec/ec_app_main.c
index 4ab5fd3a44..9b13c8ab86 100644
--- a/zephyr/app/ec/ec_app_main.c
+++ b/zephyr/app/ec/ec_app_main.c
@@ -3,11 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/sys/printk.h>
+#include <zephyr/shell/shell_uart.h>
+
#include "ap_power/ap_pwrseq.h"
#include "button.h"
#include "chipset.h"
#include "cros_board_info.h"
-#include "ec_app_main.h"
#include "ec_tasks.h"
#include "hooks.h"
#include "keyboard_scan.h"
@@ -16,10 +19,7 @@
#include "vboot.h"
#include "watchdog.h"
#include "zephyr_espi_shim.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/sys/printk.h>
+#include "ec_app_main.h"
/* For testing purposes this is not named main. See main_shim.c for the real
* main() function.
diff --git a/zephyr/app/ec/main_shim.c b/zephyr/app/ec/main_shim.c
index 0ec92b70bf..a14cff2dcb 100644
--- a/zephyr/app/ec/main_shim.c
+++ b/zephyr/app/ec/main_shim.c
@@ -3,11 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
#include "ec_app_main.h"
#include "host_command.h"
-#include <zephyr/kernel.h>
-
/** A stub main to call the real ec app main function. LCOV_EXCL_START */
void main(void)
{
diff --git a/zephyr/boards/arm/mec1727/mec1727_defconfig b/zephyr/boards/arm/mec1727/mec1727_defconfig
index b99bd0a487..e8c189750e 100644
--- a/zephyr/boards/arm/mec1727/mec1727_defconfig
+++ b/zephyr/boards/arm/mec1727/mec1727_defconfig
@@ -12,6 +12,10 @@ CONFIG_RTOS_TIMER=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32768
CONFIG_SYS_CLOCK_TICKS_PER_SEC=32768
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
diff --git a/zephyr/boards/arm/npcx7/npcx7.dts b/zephyr/boards/arm/npcx7/npcx7.dts
index a4f0646001..c1e548c62b 100644
--- a/zephyr/boards/arm/npcx7/npcx7.dts
+++ b/zephyr/boards/arm/npcx7/npcx7.dts
@@ -7,12 +7,9 @@
#include <cros/nuvoton/npcx7.dtsi>
#include <dt-bindings/gpio_defines.h>
-#include <dt-bindings/gpio/nuvoton-npcx-gpio.h>
#include <nuvoton/npcx7m7fc.dtsi>
#include <nuvoton/npcx/npcx7/npcx7-pinctrl.dtsi>
-#define GPIO_VOLTAGE_1P8 NPCX_GPIO_VOLTAGE_1P8
-
/ {
model = "NPCX7";
diff --git a/zephyr/boards/arm/npcx7/npcx7_defconfig b/zephyr/boards/arm/npcx7/npcx7_defconfig
index f84f44f9e3..c6c8f6c3f4 100644
--- a/zephyr/boards/arm/npcx7/npcx7_defconfig
+++ b/zephyr/boards/arm/npcx7/npcx7_defconfig
@@ -12,6 +12,10 @@ CONFIG_BOARD_NPCX7=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
# Enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
diff --git a/zephyr/boards/arm/npcx9/npcx9.dtsi b/zephyr/boards/arm/npcx9/npcx9.dtsi
index 113cecc173..15547d5802 100644
--- a/zephyr/boards/arm/npcx9/npcx9.dtsi
+++ b/zephyr/boards/arm/npcx9/npcx9.dtsi
@@ -4,11 +4,8 @@
*/
#include <dt-bindings/gpio_defines.h>
-#include <dt-bindings/gpio/nuvoton-npcx-gpio.h>
#include <nuvoton/npcx/npcx9/npcx9-pinctrl.dtsi>
-#define GPIO_VOLTAGE_1P8 NPCX_GPIO_VOLTAGE_1P8
-
/ {
model = "NPCX9";
@@ -59,112 +56,6 @@
pinmux = <&altc_shi_sl>;
pinmux-gpio;
};
-
- /* Keyboard peripheral interfaces */
- /omit-if-no-ref/ ksi0_gpio_gp31: periph-kbscan-ksi0-gpio {
- pinmux = <&alt7_no_ksi0_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi1_gpio_gp30: periph-kbscan-ksi1-gpio {
- pinmux = <&alt7_no_ksi1_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi2_gpio_gp27: periph-kbscan-ksi2-gpio {
- pinmux = <&alt7_no_ksi2_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi3_gpio_gp26: periph-kbscan-ksi3-gpio {
- pinmux = <&alt7_no_ksi3_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi4_gpio_gp25: periph-kbscan-ksi4-gpio {
- pinmux = <&alt7_no_ksi4_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi5_gpio_gp24: periph-kbscan-ksi5-gpio {
- pinmux = <&alt7_no_ksi5_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi6_gpio_gp23: periph-kbscan-ksi6-gpio {
- pinmux = <&alt7_no_ksi6_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ ksi7_gpio_gp22: periph-kbscan-ksi7-gpio {
- pinmux = <&alt7_no_ksi7_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso00_gpio_gp21: periph-kbscan-kso00-gpio {
- pinmux = <&alt8_no_kso00_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso01_gpio_gp20: periph-kbscan-kso01-gpio {
- pinmux = <&alt8_no_kso01_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso02_gpio_gp17: periph-kbscan-kso02-gpio {
- pinmux = <&alt8_no_kso02_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso03_gpio_gp16: periph-kbscan-kso03-gpio {
- pinmux = <&alt8_no_kso03_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso04_gpio_gp15: periph-kbscan-kso04-gpio {
- pinmux = <&alt8_no_kso04_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso05_gpio_gp14: periph-kbscan-kso05-gpio {
- pinmux = <&alt8_no_kso05_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso06_gpio_gp13: periph-kbscan-kso06-gpio {
- pinmux = <&alt8_no_kso06_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso07_gpio_gp12: periph-kbscan-kso07-gpio {
- pinmux = <&alt8_no_kso07_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso08_gpio_gp11: periph-kbscan-kso08-gpio {
- pinmux = <&alt9_no_kso08_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso09_gpio_gp10: periph-kbscan-kso09-gpio {
- pinmux = <&alt9_no_kso09_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso10_gpio_gp07: periph-kbscan-kso10-gpio {
- pinmux = <&alt9_no_kso10_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso11_gpio_gp06: periph-kbscan-kso11-gpio {
- pinmux = <&alt9_no_kso11_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso12_gpio_gp05: periph-kbscan-kso12-gpio {
- pinmux = <&alt9_no_kso12_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso13_gpio_gp04: periph-kbscan-kso13-gpio {
- pinmux = <&alt9_no_kso13_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso14_gpio_gp82: periph-kbscan-kso14-gpio {
- pinmux = <&alt9_no_kso14_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso15_gpio_gp83: periph-kbscan-kso15-gpio {
- pinmux = <&alt9_no_kso15_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso16_gpio_gp03: periph-kbscan-kso16-gpio {
- pinmux = <&alta_no_kso16_sl>;
- pinmux-gpio;
- };
- /omit-if-no-ref/ kso17_gpio_gpb1: periph-kbscan-kso17-gpio {
- pinmux = <&alta_no_kso17_sl>;
- pinmux-gpio;
- };
};
/* PSL_OUT is fixed to GPIO85 in npcx9 series. */
diff --git a/zephyr/boards/arm/npcx9/npcx9m3f_defconfig b/zephyr/boards/arm/npcx9/npcx9m3f_defconfig
index 8238d10e03..d3b4bcc3a2 100644
--- a/zephyr/boards/arm/npcx9/npcx9m3f_defconfig
+++ b/zephyr/boards/arm/npcx9/npcx9m3f_defconfig
@@ -9,6 +9,10 @@ CONFIG_SOC_NPCX9M3F=y
# Platform Configuration
CONFIG_BOARD_NPCX9=y
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
diff --git a/zephyr/boards/arm/npcx9/npcx9m7f_defconfig b/zephyr/boards/arm/npcx9/npcx9m7f_defconfig
index 1cb02182da..e742904aed 100644
--- a/zephyr/boards/arm/npcx9/npcx9m7f_defconfig
+++ b/zephyr/boards/arm/npcx9/npcx9m7f_defconfig
@@ -9,6 +9,10 @@ CONFIG_SOC_NPCX9M7F=y
# Platform Configuration
CONFIG_BOARD_NPCX9=y
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
diff --git a/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig b/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig
index 755d982eef..faee09f492 100644
--- a/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig
+++ b/zephyr/boards/arm/npcx_evb/npcx7_evb_defconfig
@@ -40,6 +40,14 @@ CONFIG_WATCHDOG=y
# I2C
CONFIG_I2C=y
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
# Power Management
CONFIG_PM=y
CONFIG_PM_DEVICE=y
diff --git a/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig b/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig
index bdedd931c1..da75b3d113 100644
--- a/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig
+++ b/zephyr/boards/arm/npcx_evb/npcx9_evb_defconfig
@@ -37,6 +37,17 @@ CONFIG_CLOCK_CONTROL=y
# WATCHDOG configuration
CONFIG_WATCHDOG=y
+# I2C
+CONFIG_I2C=y
+
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
# Power Management
CONFIG_PM=y
CONFIG_PM_DEVICE=y
diff --git a/zephyr/boards/riscv/it8xxx2/it81202bx_defconfig b/zephyr/boards/riscv/it8xxx2/it81202bx_defconfig
index 82a8a0f63f..a024ab5824 100644
--- a/zephyr/boards/riscv/it8xxx2/it81202bx_defconfig
+++ b/zephyr/boards/riscv/it8xxx2/it81202bx_defconfig
@@ -10,6 +10,10 @@ CONFIG_SOC_IT81202_BX=y
# Platform Configuration
CONFIG_BOARD_IT8XXX2=y
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
# Power Management
CONFIG_PM=y
CONFIG_PM_DEVICE=y
diff --git a/zephyr/boards/riscv/it8xxx2/it81302bx_defconfig b/zephyr/boards/riscv/it8xxx2/it81302bx_defconfig
index 6cfac9eeb5..2841b9663c 100644
--- a/zephyr/boards/riscv/it8xxx2/it81302bx_defconfig
+++ b/zephyr/boards/riscv/it8xxx2/it81302bx_defconfig
@@ -10,6 +10,10 @@ CONFIG_SOC_IT81302_BX=y
# Platform Configuration
CONFIG_BOARD_IT8XXX2=y
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
+
# Power Management
CONFIG_PM=y
CONFIG_PM_DEVICE=y
diff --git a/zephyr/boards/riscv/it8xxx2/it8xxx2.dts b/zephyr/boards/riscv/it8xxx2/it8xxx2.dts
index a7cc336cb4..640efd1433 100644
--- a/zephyr/boards/riscv/it8xxx2/it8xxx2.dts
+++ b/zephyr/boards/riscv/it8xxx2/it8xxx2.dts
@@ -6,12 +6,9 @@
/dts-v1/;
#include <dt-bindings/gpio_defines.h>
-#include <dt-bindings/gpio/ite-it8xxx2-gpio.h>
#include <cros/ite/it8xxx2.dtsi>
#include <ite/it8xxx2.dtsi>
-#define GPIO_VOLTAGE_1P8 IT8XXX2_GPIO_VOLTAGE_1P8
-
/ {
model = "Google IT8XXX2 Baseboard";
diff --git a/zephyr/cmake/compiler/clang/compiler_flags.cmake b/zephyr/cmake/compiler/clang/compiler_flags.cmake
index f24e1f1f4c..3423f1c36c 100644
--- a/zephyr/cmake/compiler/clang/compiler_flags.cmake
+++ b/zephyr/cmake/compiler/clang/compiler_flags.cmake
@@ -8,19 +8,9 @@ include("${ZEPHYR_BASE}/cmake/compiler/clang/compiler_flags.cmake")
set_compiler_property(PROPERTY hosted)
# Disable position independent code.
-if ("${ARCH}" STREQUAL "posix" OR "${ARCH}" STREQUAL "unit_testing")
- add_compile_options(-fPIC)
-else()
- add_compile_options(-fno-PIC)
-endif()
-
-# When testing, look for stack smashing
-add_compile_option_ifdef(CONFIG_ZTEST -fstack-protector-all)
+add_compile_options(-fno-PIC)
check_set_compiler_property(APPEND PROPERTY warning_extended -Wunused-variable
-Werror=unused-variable -Werror=missing-braces
-Werror=sometimes-uninitialized -Werror=unused-function
-Werror=array-bounds)
-
-# clang flags for coverage generation
-set_property(TARGET compiler PROPERTY coverage --coverage -fno-inline)
diff --git a/zephyr/cmake/compiler/clang/generic.cmake b/zephyr/cmake/compiler/clang/generic.cmake
index a59b7e4a72..b848c8bd03 100644
--- a/zephyr/cmake/compiler/clang/generic.cmake
+++ b/zephyr/cmake/compiler/clang/generic.cmake
@@ -3,5 +3,4 @@
# found in the LICENSE file.
set(CMAKE_C_COMPILER "/usr/bin/x86_64-pc-linux-gnu-clang")
-set(CMAKE_CXX_COMPILER "/usr/bin/x86_64-pc-linux-gnu-clang++")
set(CMAKE_GCOV "/usr/bin/llvm-cov gcov")
diff --git a/zephyr/cmake/compiler/gcc/compiler_flags.cmake b/zephyr/cmake/compiler/gcc/compiler_flags.cmake
index fbc7ca1d61..adc111835e 100644
--- a/zephyr/cmake/compiler/gcc/compiler_flags.cmake
+++ b/zephyr/cmake/compiler/gcc/compiler_flags.cmake
@@ -8,6 +8,3 @@ include("${ZEPHYR_BASE}/cmake/compiler/gcc/compiler_flags.cmake")
# Disable position independent code.
add_compile_options(-fno-PIC)
-
-# gcc flags for coverage generation
-set_compiler_property(PROPERTY coverage -fprofile-arcs -ftest-coverage -fno-inline)
diff --git a/zephyr/cmake/compiler/gcc/generic.cmake b/zephyr/cmake/compiler/gcc/generic.cmake
deleted file mode 100644
index 8f41f59bee..0000000000
--- a/zephyr/cmake/compiler/gcc/generic.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include("${ZEPHYR_BASE}/cmake/compiler/gcc/generic.cmake")
diff --git a/zephyr/cmake/linker/ld/clang/linker_flags.cmake b/zephyr/cmake/linker/ld/clang/linker_flags.cmake
deleted file mode 100644
index 38f5428d13..0000000000
--- a/zephyr/cmake/linker/ld/clang/linker_flags.cmake
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-if (NOT CONFIG_COVERAGE_GCOV)
- set_property(TARGET linker PROPERTY coverage --coverage)
-endif()
diff --git a/zephyr/cmake/linker/ld/gcc/linker_flags.cmake b/zephyr/cmake/linker/ld/gcc/linker_flags.cmake
index b5ec8b05ca..f71793c431 100644
--- a/zephyr/cmake/linker/ld/gcc/linker_flags.cmake
+++ b/zephyr/cmake/linker/ld/gcc/linker_flags.cmake
@@ -2,10 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-if (NOT CONFIG_COVERAGE_GCOV)
- set_property(TARGET linker PROPERTY coverage -lgcov)
-endif()
-
# GCC 11 by default emits DWARF version 5 which cannot be parsed by
# pyelftools. Can be removed once pyelftools supports v5.
add_link_options(-gdwarf-4)
diff --git a/zephyr/cmake/toolchain/host/generic.cmake b/zephyr/cmake/toolchain/host/generic.cmake
deleted file mode 100644
index 4cc0fbd352..0000000000
--- a/zephyr/cmake/toolchain/host/generic.cmake
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-set(CROSS_COMPILE_TARGET_posix x86_64-pc-linux-gnu)
-set(CROSS_COMPILE_TARGET_unit_testing x86_64-pc-linux-gnu)
-set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
-
-set(CC gcc)
-set(CROSS_COMPILE "/usr/bin/${CROSS_COMPILE_TARGET}-")
-
-set(COMPILER gcc)
-set(LINKER ld)
-set(BINTOOLS gnu)
-
-set(TOOLCHAIN_HAS_NEWLIB OFF CACHE BOOL "True if toolchain supports newlib")
-
-message(STATUS "Found toolchain: host ${ARCH} (gcc/ld)")
diff --git a/zephyr/cmake/toolchain/host/target.cmake b/zephyr/cmake/toolchain/host/target.cmake
deleted file mode 100644
index 9d540f97ff..0000000000
--- a/zephyr/cmake/toolchain/host/target.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include("${ZEPHYR_BASE}/cmake/toolchain/host/target.cmake")
diff --git a/zephyr/cmake/toolchain/llvm/target.cmake b/zephyr/cmake/toolchain/llvm/target.cmake
index e8e5df7be1..e6960dade5 100644
--- a/zephyr/cmake/toolchain/llvm/target.cmake
+++ b/zephyr/cmake/toolchain/llvm/target.cmake
@@ -7,8 +7,8 @@ set(LINKER lld)
set(BINTOOLS llvm)
# Mapping of Zephyr architecture -> toolchain triple
-set(CROSS_COMPILE_TARGET_posix x86_64-pc-linux-gnu)
-set(CROSS_COMPILE_TARGET_unit_testing x86_64-pc-linux-gnu)
+# Note only "posix" is supported at the moment.
+set(CROSS_COMPILE_TARGET_posix x86_64-pc-linux-gnu)
set(CROSS_COMPILE_TARGET ${CROSS_COMPILE_TARGET_${ARCH}})
diff --git a/zephyr/drivers/cros_displight/cros_displight.c b/zephyr/drivers/cros_displight/cros_displight.c
index 850b0d7c90..98d1dd0823 100644
--- a/zephyr/drivers/cros_displight/cros_displight.c
+++ b/zephyr/drivers/cros_displight/cros_displight.c
@@ -5,27 +5,29 @@
#define DT_DRV_COMPAT cros_ec_displight
-#include "common.h"
-#include "util.h"
-
#include <zephyr/devicetree.h>
+#include <drivers/cros_displight.h>
#include <zephyr/drivers/pwm.h>
#include <zephyr/logging/log.h>
-#include <drivers/cros_displight.h>
+#include "common.h"
+#include "util.h"
LOG_MODULE_REGISTER(displight, LOG_LEVEL_ERR);
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
"Exactly one instance of cros-ec,displight should be defined.");
-static const struct pwm_dt_spec displight_pwm = PWM_DT_SPEC_INST_GET(0);
+#define DISPLIGHT_PWM_NODE DT_INST_PWMS_CTLR(0)
+#define DISPLIGHT_PWM_CHANNEL DT_INST_PWMS_CHANNEL(0)
+#define DISPLIGHT_PWM_FLAGS DT_INST_PWMS_FLAGS(0)
+#define DISPLIGHT_PWM_PERIOD_NS DT_INST_PWMS_PERIOD(0)
static int displight_percent;
static void displight_set_duty(int percent)
{
- const struct device *pwm_dev = displight_pwm.dev;
+ const struct device *pwm_dev = DEVICE_DT_GET(DISPLIGHT_PWM_NODE);
uint32_t pulse_ns;
int rv;
@@ -34,14 +36,15 @@ static void displight_set_duty(int percent)
return;
}
- pulse_ns = DIV_ROUND_NEAREST(displight_pwm.period * percent, 100);
+ pulse_ns = DIV_ROUND_NEAREST(DISPLIGHT_PWM_PERIOD_NS * percent, 100);
LOG_DBG("displight PWM %s set percent (%d), pulse %d", pwm_dev->name,
percent, pulse_ns);
- rv = pwm_set_pulse_dt(&displight_pwm, pulse_ns);
+ rv = pwm_set(pwm_dev, DISPLIGHT_PWM_CHANNEL, DISPLIGHT_PWM_PERIOD_NS,
+ pulse_ns, DISPLIGHT_PWM_FLAGS);
if (rv) {
- LOG_ERR("pwm_set_pulse_dt failed %s (%d)", pwm_dev->name, rv);
+ LOG_ERR("pwm_set() failed %s (%d)", pwm_dev->name, rv);
}
}
diff --git a/zephyr/drivers/cros_flash/Kconfig b/zephyr/drivers/cros_flash/Kconfig
index 06f2b9f8c0..8931f413e4 100644
--- a/zephyr/drivers/cros_flash/Kconfig
+++ b/zephyr/drivers/cros_flash/Kconfig
@@ -4,8 +4,8 @@
menuconfig CROS_FLASH_NPCX
bool "Nuvoton NPCX flash driver for the Zephyr shim"
+ depends on SOC_FAMILY_NPCX
default y
- depends on DT_HAS_NUVOTON_NPCX_CROS_FLASH_ENABLED
select PLATFORM_EC_FLASH_CROS
select PLATFORM_EC_SPI_FLASH_REGS
help
@@ -39,8 +39,8 @@ config CROS_FLASH_IT8XXX2
config CROS_FLASH_XEC
bool "Microchip XEC flash driver for the Zephyr shim"
+ depends on SOC_FAMILY_MEC
default y
- depends on DT_HAS_MICROCHIP_XEC_CROS_FLASH_ENABLED
select PLATFORM_EC_FLASH_CROS
select PLATFORM_EC_SPI_FLASH_REGS
help
diff --git a/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c b/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
index 79ef0c36b2..4838c5d583 100644
--- a/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
+++ b/zephyr/drivers/cros_flash/cros_flash_it8xxx2.c
@@ -5,18 +5,17 @@
#define DT_DRV_COMPAT ite_it8xxx2_cros_flash
-#include "flash.h"
-#include "host_command.h"
-#include "system.h"
-#include "watchdog.h"
-
+#include <drivers/cros_flash.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
-#include <drivers/cros_flash.h>
#include <soc.h>
+#include "flash.h"
+#include "host_command.h"
+#include "system.h"
+#include "watchdog.h"
+
LOG_MODULE_REGISTER(cros_flash, LOG_LEVEL_ERR);
/* Device data */
diff --git a/zephyr/drivers/cros_flash/cros_flash_npcx.c b/zephyr/drivers/cros_flash/cros_flash_npcx.c
index e49067ad1a..032bb5906c 100644
--- a/zephyr/drivers/cros_flash/cros_flash_npcx.c
+++ b/zephyr/drivers/cros_flash/cros_flash_npcx.c
@@ -5,20 +5,19 @@
#define DT_DRV_COMPAT nuvoton_npcx_cros_flash
-#include "../drivers/flash/spi_nor.h"
-#include "flash.h"
-#include "spi_flash_reg.h"
-#include "write_protect.h"
-
+#include <drivers/cros_flash.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
-#include <drivers/cros_flash.h>
#include <soc.h>
+#include "flash.h"
+#include "spi_flash_reg.h"
+#include "write_protect.h"
+#include "../drivers/flash/spi_nor.h"
+
LOG_MODULE_REGISTER(cros_flash, LOG_LEVEL_ERR);
static int all_protected; /* Has all-flash protection been requested? */
diff --git a/zephyr/drivers/cros_flash/cros_flash_xec.c b/zephyr/drivers/cros_flash/cros_flash_xec.c
index 610a79c971..2b92eae25b 100644
--- a/zephyr/drivers/cros_flash/cros_flash_xec.c
+++ b/zephyr/drivers/cros_flash/cros_flash_xec.c
@@ -5,20 +5,19 @@
#define DT_DRV_COMPAT microchip_xec_cros_flash
-#include "../drivers/flash/spi_nor.h"
-#include "flash.h"
-#include "spi_flash_reg.h"
-#include "write_protect.h"
-
+#include <drivers/cros_flash.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
-#include <drivers/cros_flash.h>
#include <soc.h>
+#include "flash.h"
+#include "spi_flash_reg.h"
+#include "write_protect.h"
+#include "../drivers/flash/spi_nor.h"
+
LOG_MODULE_REGISTER(cros_flash, LOG_LEVEL_ERR);
static int all_protected;
diff --git a/zephyr/drivers/cros_kb_raw/Kconfig b/zephyr/drivers/cros_kb_raw/Kconfig
index 1e10f38bbe..1055c8a4b2 100644
--- a/zephyr/drivers/cros_kb_raw/Kconfig
+++ b/zephyr/drivers/cros_kb_raw/Kconfig
@@ -6,8 +6,8 @@ if PLATFORM_EC_KEYBOARD
menuconfig CROS_KB_RAW_NPCX
bool "Nuvoton NPCX raw-keyboard-scan driver for the Zephyr shim"
+ depends on SOC_FAMILY_NPCX
default y
- depends on DT_HAS_NUVOTON_NPCX_CROS_KB_RAW_ENABLED
help
This option enables a driver for providing raw access to the
keyboard-scan peripheral in the chip. This is used instead of the
@@ -27,8 +27,8 @@ endif # CROS_KB_RAW_NPCX
config CROS_KB_RAW_ITE
bool "ITE raw-keyboard-scan driver for the Zephyr shim"
+ depends on SOC_FAMILY_RISCV_ITE
default y
- depends on DT_HAS_ITE_IT8XXX2_CROS_KB_RAW_ENABLED
help
This option enables a driver for providing raw access to the
keyboard-scan peripheral in the chip. This is used instead of the
@@ -37,8 +37,8 @@ config CROS_KB_RAW_ITE
menuconfig CROS_KB_RAW_XEC
bool "Microchip raw-keyboard-scan driver for the Zephyr shim"
+ depends on SOC_FAMILY_MEC
default y
- depends on DT_HAS_MICROCHIP_XEC_CROS_KB_RAW_ENABLED
help
This option enables a driver for providing raw access to the
keyboard-scan peripheral in the chip. This is used instead of the
diff --git a/zephyr/drivers/cros_kb_raw/cros_kb_raw_ite.c b/zephyr/drivers/cros_kb_raw/cros_kb_raw_ite.c
index f824d1d90c..fdbc8ee30d 100644
--- a/zephyr/drivers/cros_kb_raw/cros_kb_raw_ite.c
+++ b/zephyr/drivers/cros_kb_raw/cros_kb_raw_ite.c
@@ -5,23 +5,22 @@
#define DT_DRV_COMPAT ite_it8xxx2_cros_kb_raw
-#include "ec_tasks.h"
-#include "keyboard_raw.h"
-#include "task.h"
-
#include <assert.h>
-
+#include <drivers/cros_kb_raw.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/interrupt_controller/wuc_ite_it8xxx2.h>
#include <zephyr/dt-bindings/interrupt-controller/it8xxx2-wuc.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_kb_raw.h>
#include <soc.h>
-#include <soc/ite_it8xxx2/reg_def_cros.h>
#include <soc_dt.h>
+#include <soc/ite_it8xxx2/reg_def_cros.h>
+
+#include "ec_tasks.h"
+#include "keyboard_raw.h"
+#include "task.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_kb_raw, LOG_LEVEL_ERR);
#define KEYBOARD_KSI_PIN_COUNT IT8XXX2_DT_INST_WUCCTRL_LEN(0)
diff --git a/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c b/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c
index 6c61568016..c720f4b431 100644
--- a/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c
+++ b/zephyr/drivers/cros_kb_raw/cros_kb_raw_npcx.c
@@ -5,22 +5,21 @@
#define DT_DRV_COMPAT nuvoton_npcx_cros_kb_raw
-#include "ec_tasks.h"
-#include "keyboard_raw.h"
-#include "soc_miwu.h"
-#include "task.h"
-
#include <assert.h>
-
+#include <zephyr/dt-bindings/clock/npcx_clock.h>
+#include <drivers/cros_kb_raw.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/pinctrl.h>
-#include <zephyr/dt-bindings/clock/npcx_clock.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_kb_raw.h>
#include <soc.h>
#include <soc/nuvoton_npcx/reg_def_cros.h>
+
+#include "ec_tasks.h"
+#include "keyboard_raw.h"
+#include "soc_miwu.h"
+#include "task.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_kb_raw, LOG_LEVEL_ERR);
#ifdef CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED
@@ -219,24 +218,11 @@ static int cros_kb_raw_npcx_init(const struct device *dev)
return 0;
}
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_FACTORY_TEST
-static int cros_kb_raw_npcx_config_alt(const struct device *dev, bool enable)
-{
- const struct cros_kb_raw_npcx_config *const config = DRV_CONFIG(dev);
- uint8_t id = enable ? PINCTRL_STATE_DEFAULT : PINCTRL_STATE_SLEEP;
-
- return pinctrl_apply_state(config->pcfg, id);
-}
-#endif
-
static const struct cros_kb_raw_driver_api cros_kb_raw_npcx_driver_api = {
.init = cros_kb_raw_npcx_init,
.drive_colum = cros_kb_raw_npcx_drive_column,
.read_rows = cros_kb_raw_npcx_read_row,
.enable_interrupt = cros_kb_raw_npcx_enable_interrupt,
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_FACTORY_TEST
- .config_alt = cros_kb_raw_npcx_config_alt,
-#endif
};
PINCTRL_DT_INST_DEFINE(0);
diff --git a/zephyr/drivers/cros_kb_raw/cros_kb_raw_xec.c b/zephyr/drivers/cros_kb_raw/cros_kb_raw_xec.c
index 30ffd7ca85..797377f84f 100644
--- a/zephyr/drivers/cros_kb_raw/cros_kb_raw_xec.c
+++ b/zephyr/drivers/cros_kb_raw/cros_kb_raw_xec.c
@@ -5,20 +5,19 @@
#define DT_DRV_COMPAT microchip_xec_cros_kb_raw
-#include "ec_tasks.h"
-#include "keyboard_raw.h"
-#include "task.h"
-
#include <assert.h>
-
+#include <drivers/cros_kb_raw.h>
#include <zephyr/drivers/clock_control.h>
-#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
#include <zephyr/drivers/pinctrl.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_kb_raw.h>
+#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
#include <soc.h>
#include <soc/microchip_xec/reg_def_cros.h>
+
+#include "ec_tasks.h"
+#include "keyboard_raw.h"
+#include "task.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_kb_raw, LOG_LEVEL_ERR);
#ifdef CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED
diff --git a/zephyr/drivers/cros_kblight/pwm_kblight.c b/zephyr/drivers/cros_kblight/pwm_kblight.c
index ca395f8dba..59b4ef20ef 100644
--- a/zephyr/drivers/cros_kblight/pwm_kblight.c
+++ b/zephyr/drivers/cros_kblight/pwm_kblight.c
@@ -5,27 +5,30 @@
#define DT_DRV_COMPAT cros_ec_kblight_pwm
-#include "common.h"
-#include "keyboard_backlight.h"
-#include "util.h"
-
#include <zephyr/devicetree.h>
#include <zephyr/drivers/pwm.h>
#include <zephyr/logging/log.h>
+#include "common.h"
+#include "keyboard_backlight.h"
+#include "util.h"
+
LOG_MODULE_REGISTER(kblight, LOG_LEVEL_ERR);
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
"Exactly one instance of cros-ec,kblight-pwm should be defined.");
-static const struct pwm_dt_spec kblight_pwm_dt = PWM_DT_SPEC_INST_GET(0);
+#define KBLIGHT_PWM_NODE DT_INST_PWMS_CTLR(0)
+#define KBLIGHT_PWM_CHANNEL DT_INST_PWMS_CHANNEL(0)
+#define KBLIGHT_PWM_FLAGS DT_INST_PWMS_FLAGS(0)
+#define KBLIGHT_PWM_PERIOD_NS DT_INST_PWMS_PERIOD(0)
static bool kblight_enabled;
static int kblight_percent;
static void kblight_pwm_set_duty(int percent)
{
- const struct device *pwm_dev = kblight_pwm_dt.dev;
+ const struct device *pwm_dev = DEVICE_DT_GET(KBLIGHT_PWM_NODE);
uint32_t pulse_ns;
int rv;
@@ -34,14 +37,15 @@ static void kblight_pwm_set_duty(int percent)
return;
}
- pulse_ns = DIV_ROUND_NEAREST(kblight_pwm_dt.period * percent, 100);
+ pulse_ns = DIV_ROUND_NEAREST(KBLIGHT_PWM_PERIOD_NS * percent, 100);
LOG_DBG("kblight PWM %s set percent (%d), pulse %d", pwm_dev->name,
percent, pulse_ns);
- rv = pwm_set_pulse_dt(&kblight_pwm_dt, pulse_ns);
+ rv = pwm_set(pwm_dev, KBLIGHT_PWM_CHANNEL, KBLIGHT_PWM_PERIOD_NS,
+ pulse_ns, KBLIGHT_PWM_FLAGS);
if (rv) {
- LOG_ERR("pwm_set_pulse_dt failed %s (%d)", pwm_dev->name, rv);
+ LOG_ERR("pwm_set() failed %s (%d)", pwm_dev->name, rv);
}
}
@@ -52,6 +56,11 @@ static int kblight_pwm_set(int percent)
return EC_SUCCESS;
}
+static int kblight_pwm_get(void)
+{
+ return kblight_percent;
+}
+
static int kblight_pwm_enable(int enable)
{
kblight_enabled = enable;
@@ -79,6 +88,7 @@ static int kblight_pwm_init(void)
const struct kblight_drv kblight_pwm = {
.init = kblight_pwm_init,
.set = kblight_pwm_set,
+ .get = kblight_pwm_get,
.enable = kblight_pwm_enable,
.get_enabled = kblight_pwm_get_enabled,
};
diff --git a/zephyr/drivers/cros_rtc/Kconfig b/zephyr/drivers/cros_rtc/Kconfig
index 2f064b4db8..2839b03c62 100644
--- a/zephyr/drivers/cros_rtc/Kconfig
+++ b/zephyr/drivers/cros_rtc/Kconfig
@@ -6,12 +6,7 @@ if PLATFORM_EC_RTC && !ARCH_POSIX
choice CROS_RTC_TYPE
prompt "Select the RTC to use"
- # List standalone controllers before embedded once so that they get
- # higher priority.
- default CROS_RTC_NXP_PCF85063A if DT_HAS_NXP_RTC_PCF85063A_ENABLED
- default CROS_RTC_RENESAS_IDT1337AG if DT_HAS_RENESAS_RTC_IDT1337AG_ENABLED
- default CROS_RTC_NPCX if DT_HAS_NUVOTON_NPCX_CROS_MTC_ENABLED
- default CROS_RTC_XEC if DT_HAS_MICROCHIP_XEC_CROS_RTC_ENABLED
+ default CROS_RTC_NPCX if SOC_FAMILY_NPCX
help
Select the RTC used on the board.
@@ -45,11 +40,4 @@ config CROS_RTC_RENESAS_IDT1337AG
endchoice # CROS_RTC_TYPE
-config PLATFORM_EC_PCF85063A_CAP_SEL
- bool "Set CAP_SEL of PCF85063A"
- depends on CROS_RTC_NXP_PCF85063A
- help
- This option select the internal oscillator capacitor to 12.5 pF,
- default is 7 pF.
-
endif # PLATFORM_EC_RTC
diff --git a/zephyr/drivers/cros_rtc/cros_rtc_npcx.c b/zephyr/drivers/cros_rtc/cros_rtc_npcx.c
index a248357cfe..3312ad899f 100644
--- a/zephyr/drivers/cros_rtc/cros_rtc_npcx.c
+++ b/zephyr/drivers/cros_rtc/cros_rtc_npcx.c
@@ -1,23 +1,23 @@
-/* Copyright 2021 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
+/*
+ * Copyright 2021 Google LLC
+ *
+ * SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nuvoton_npcx_cros_mtc
-#include "ec_tasks.h"
-#include "soc_miwu.h"
-#include "task.h"
-
#include <assert.h>
-
+#include <drivers/cros_rtc.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_rtc.h>
#include <soc.h>
#include <soc/nuvoton_npcx/reg_def_cros.h>
+
+#include "ec_tasks.h"
+#include "soc_miwu.h"
+#include "task.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_rtc, LOG_LEVEL_ERR);
#define NPCX_MTC_TTC_LOAD_DELAY_US 250 /* Delay after writing TTC */
diff --git a/zephyr/drivers/cros_rtc/cros_rtc_xec.c b/zephyr/drivers/cros_rtc/cros_rtc_xec.c
index f42560e107..c543aab6af 100644
--- a/zephyr/drivers/cros_rtc/cros_rtc_xec.c
+++ b/zephyr/drivers/cros_rtc/cros_rtc_xec.c
@@ -5,18 +5,17 @@
#define DT_DRV_COMPAT microchip_xec_cros_rtc
-#include "ec_tasks.h"
-#include "task.h"
-
#include <assert.h>
-
+#include <drivers/cros_rtc.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_rtc.h>
#include <soc.h>
#include <soc/microchip_xec/reg_def_cros.h>
+
+#include "ec_tasks.h"
+#include "task.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_rtc, LOG_LEVEL_ERR);
/* Driver config */
diff --git a/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.c b/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.c
index 298c8cd64f..c5580eaeef 100644
--- a/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.c
+++ b/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.c
@@ -5,19 +5,18 @@
#define DT_DRV_COMPAT nxp_rtc_pcf85063a
-#include "nxp_rtc_pcf85063a.h"
-
#include <assert.h>
-
#include <zephyr/device.h>
+#include <drivers/cros_rtc.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_rtc.h>
#include <rtc.h>
#include <soc.h>
+
+#include "nxp_rtc_pcf85063a.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_rtc, LOG_LEVEL_ERR);
/* Driver config */
@@ -363,16 +362,6 @@ static int nxp_rtc_pcf85063a_init(const struct device *dev)
}
}
-#ifdef CONFIG_PLATFORM_EC_PCF85063A_CAP_SEL
- ret = pcf85063a_write_reg(dev, REG_CONTROL_1,
- (CONTROL_1_DEFAULT_VALUE | CAP_SEL));
-
- if (ret < 0) {
- LOG_ERR("PCF85063A set CAP_SEL Fail!");
- return ret;
- }
-#endif
-
/*
* Read Seconds register and check if oscillator is stopped.
* If so, clear the bit.
diff --git a/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.h b/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.h
index c0139db631..54b1fbd2ea 100644
--- a/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.h
+++ b/zephyr/drivers/cros_rtc/nxp_rtc_pcf85063a.h
@@ -10,7 +10,6 @@
#define SOFT_RESET 0x58
#define CONTROL_1_DEFAULT_VALUE 0
#define OS_BIT 0x80
-#define CAP_SEL 0x01
#define DISABLE_ALARM 0x80
#define ENABLE_ALARM_INTERRUPT 0x80
#define RTC_STOP_CLOCKS 0x20
diff --git a/zephyr/drivers/cros_rtc/renesas_rtc_idt1337ag.c b/zephyr/drivers/cros_rtc/renesas_rtc_idt1337ag.c
index f6d3a7c292..7a9a11fd41 100644
--- a/zephyr/drivers/cros_rtc/renesas_rtc_idt1337ag.c
+++ b/zephyr/drivers/cros_rtc/renesas_rtc_idt1337ag.c
@@ -5,19 +5,18 @@
#define DT_DRV_COMPAT renesas_rtc_idt1337ag
-#include "renesas_rtc_idt1337ag.h"
-
#include <assert.h>
-
#include <zephyr/device.h>
+#include <drivers/cros_rtc.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_rtc.h>
#include <rtc.h>
#include <soc.h>
+
+#include "renesas_rtc_idt1337ag.h"
+
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(cros_rtc, LOG_LEVEL_ERR);
/* Driver config */
diff --git a/zephyr/drivers/cros_shi/Kconfig b/zephyr/drivers/cros_shi/Kconfig
index 3b93ad48ee..ebcd937c7d 100644
--- a/zephyr/drivers/cros_shi/Kconfig
+++ b/zephyr/drivers/cros_shi/Kconfig
@@ -2,19 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-if PLATFORM_EC_HOST_INTERFACE_SHI
-
config CROS_SHI_NPCX
bool
+ depends on SOC_FAMILY_NPCX
+ depends on PLATFORM_EC_HOST_INTERFACE_SHI
default y
- depends on DT_HAS_NUVOTON_NPCX_CROS_SHI_ENABLED
help
This option enables Serial Host Interface driver for the NPCX family
of processors. This is used for host-command communication on the
platform which AP is ARM-based SoC.
if CROS_SHI_NPCX
-
config CROS_SHI_MAX_REQUEST
hex "Max data size for the version 3 request packet"
default 0x220
@@ -40,8 +38,9 @@ endif # CROS_SHI_NPCX
config CROS_SHI_IT8XXX2
bool
+ depends on SOC_FAMILY_RISCV_ITE
+ depends on PLATFORM_EC_HOST_INTERFACE_SHI
default y
- depends on DT_HAS_ITE_IT8XXX2_CROS_SHI_ENABLED
help
This option enables spi host interface driver which is required to
communicate with the EC when the CPU is the ARM processor.
@@ -59,5 +58,3 @@ config CROS_SHI_IT8XXX2_INIT_PRIORITY
configuration these pins to alt function of SHI.
endif # CROS_SHI_IT8XXX2
-
-endif # PLATFORM_EC_HOST_INTERFACE_SHI
diff --git a/zephyr/drivers/cros_shi/cros_shi_it8xxx2.c b/zephyr/drivers/cros_shi/cros_shi_it8xxx2.c
index 15b5daf85b..ee6ce3f7a4 100644
--- a/zephyr/drivers/cros_shi/cros_shi_it8xxx2.c
+++ b/zephyr/drivers/cros_shi/cros_shi_it8xxx2.c
@@ -5,22 +5,20 @@
#define DT_DRV_COMPAT ite_it8xxx2_cros_shi
-#include "chipset.h"
-#include "console.h"
-#include "gpio/gpio_int.h"
-#include "host_command.h"
-
-#include <errno.h>
-
#include <zephyr/device.h>
-#include <zephyr/drivers/pinctrl.h>
-#include <zephyr/dt-bindings/pinctrl/it8xxx2-pinctrl.h>
+#include <errno.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
#include <soc_dt.h>
+#include <zephyr/drivers/pinctrl.h>
+#include <zephyr/dt-bindings/pinctrl/it8xxx2-pinctrl.h>
+
+#include "chipset.h"
+#include "console.h"
+#include "gpio/gpio_int.h"
+#include "host_command.h"
/* Console output macros */
#define CPRINTS(format, args...) cprints(CC_SPI, format, ##args)
diff --git a/zephyr/drivers/cros_shi/cros_shi_npcx.c b/zephyr/drivers/cros_shi/cros_shi_npcx.c
index 79bc79db2e..ce3279288b 100644
--- a/zephyr/drivers/cros_shi/cros_shi_npcx.c
+++ b/zephyr/drivers/cros_shi/cros_shi_npcx.c
@@ -5,24 +5,22 @@
#define DT_DRV_COMPAT nuvoton_npcx_cros_shi
-#include "host_command.h"
-#include "soc_miwu.h"
-#include "system.h"
-
-#include <assert.h>
-
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
+#include <assert.h>
+#include <zephyr/dt-bindings/clock/npcx_clock.h>
#include <zephyr/drivers/clock_control.h>
-#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/pinctrl.h>
-#include <zephyr/dt-bindings/clock/npcx_clock.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
#include <drivers/cros_shi.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
#include <soc.h>
#include <soc/nuvoton_npcx/reg_def_cros.h>
+#include "host_command.h"
+#include "soc_miwu.h"
+#include "system.h"
+
#ifdef CONFIG_CROS_SHI_NPCX_DEBUG
#define DEBUG_CPRINTS(format, args...) cprints(CC_SPI, format, ##args)
#define DEBUG_CPRINTF(format, args...) cprintf(CC_SPI, format, ##args)
diff --git a/zephyr/drivers/cros_system/cros_system_it8xxx2.c b/zephyr/drivers/cros_system/cros_system_it8xxx2.c
index a78b5c929c..8c63886808 100644
--- a/zephyr/drivers/cros_system/cros_system_it8xxx2.c
+++ b/zephyr/drivers/cros_system/cros_system_it8xxx2.c
@@ -5,18 +5,17 @@
#define DT_DRV_COMPAT ite_it8xxx2_gctrl
-#include "drivers/cros_system.h"
-#include "gpio/gpio_int.h"
-#include "system.h"
-#include "util.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
#include <soc/ite_it8xxx2/reg_def_cros.h>
+#include "drivers/cros_system.h"
+#include "gpio/gpio_int.h"
+#include "system.h"
+#include "util.h"
+
LOG_MODULE_REGISTER(cros_system, LOG_LEVEL_ERR);
#define GCTRL_IT8XXX2_REG_BASE \
diff --git a/zephyr/drivers/cros_system/cros_system_native_posix.c b/zephyr/drivers/cros_system/cros_system_native_posix.c
index 59fdb39972..fab9c4d033 100644
--- a/zephyr/drivers/cros_system/cros_system_native_posix.c
+++ b/zephyr/drivers/cros_system/cros_system_native_posix.c
@@ -6,12 +6,12 @@
/* LCOV_EXCL_START */
/* This is test code, so it should be excluded from coverage */
-#include "common.h"
-#include "drivers/cros_system.h"
-
#include <zephyr/logging/log.h>
#include <zephyr/sys/util.h>
+#include "common.h"
+#include "drivers/cros_system.h"
+
LOG_MODULE_REGISTER(cros_system, LOG_LEVEL_ERR);
/* Driver config stub */
diff --git a/zephyr/drivers/cros_system/cros_system_npcx.c b/zephyr/drivers/cros_system/cros_system_npcx.c
index 4fc1f1f977..4ab21ca549 100644
--- a/zephyr/drivers/cros_system/cros_system_npcx.c
+++ b/zephyr/drivers/cros_system/cros_system_npcx.c
@@ -3,22 +3,21 @@
* found in the LICENSE file.
*/
-#include "drivers/cros_system.h"
-#include "gpio/gpio_int.h"
-#include "rom_chip.h"
-#include "soc_gpio.h"
-#include "soc_miwu.h"
-#include "system.h"
-
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/watchdog.h>
#include <zephyr/logging/log.h>
-#include <zephyr/sys/util.h>
-
#include <soc.h>
#include <soc/nuvoton_npcx/reg_def_cros.h>
+#include <zephyr/sys/util.h>
+
+#include "drivers/cros_system.h"
+#include "gpio/gpio_int.h"
+#include "rom_chip.h"
+#include "soc_gpio.h"
+#include "soc_miwu.h"
+#include "system.h"
LOG_MODULE_REGISTER(cros_system, LOG_LEVEL_ERR);
diff --git a/zephyr/drivers/cros_system/cros_system_xec.c b/zephyr/drivers/cros_system/cros_system_xec.c
index f91b4630fc..a3cf9aea22 100644
--- a/zephyr/drivers/cros_system/cros_system_xec.c
+++ b/zephyr/drivers/cros_system/cros_system_xec.c
@@ -3,19 +3,18 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio_int.h"
-#include "system.h"
-#include "system_chip.h"
-
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
-#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
+#include <drivers/cros_system.h>
#include <zephyr/drivers/watchdog.h>
#include <zephyr/logging/log.h>
-#include <zephyr/sys/util.h>
-
-#include <drivers/cros_system.h>
#include <soc.h>
#include <soc/microchip_xec/reg_def_cros.h>
+#include <zephyr/sys/util.h>
+
+#include "system.h"
+#include "system_chip.h"
+#include <zephyr/drivers/interrupt_controller/intc_mchp_xec_ecia.h>
+#include "gpio/gpio_int.h"
LOG_MODULE_REGISTER(cros_system, LOG_LEVEL_ERR);
diff --git a/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml b/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
index 83bd825236..d2fed4bfa6 100644
--- a/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
+++ b/zephyr/dts/bindings/battery/battery-fuel-gauge.yaml
@@ -5,6 +5,8 @@
description: |
Battery fuel gauge parameters
+compatible: "battery-fuel-gauge"
+
properties:
manuf_name:
description: |
diff --git a/zephyr/dts/bindings/battery/battery-info.yaml b/zephyr/dts/bindings/battery/battery-info.yaml
index c188616260..54e81cedeb 100644
--- a/zephyr/dts/bindings/battery/battery-info.yaml
+++ b/zephyr/dts/bindings/battery/battery-info.yaml
@@ -8,6 +8,8 @@ description:
Current is in milliamperes
Temperature is in Celsius degrees
+compatible: "battery-info"
+
properties:
voltage_max:
description: |
diff --git a/zephyr/dts/bindings/battery/battery-smart.yaml b/zephyr/dts/bindings/battery/battery-smart.yaml
index 5992226291..1d0c9786eb 100644
--- a/zephyr/dts/bindings/battery/battery-smart.yaml
+++ b/zephyr/dts/bindings/battery/battery-smart.yaml
@@ -28,7 +28,6 @@ properties:
- "dynapack,cosmx_gh02047xl"
- "dynapack,c140254"
- "ganfeng,7c01"
- - "ganfeng,sg20"
- "getac,bq40z50-R3-S3"
- "getac,bq40z50-R3-S2"
- "lgc,ac17a8m"
diff --git a/zephyr/dts/bindings/battery/cosmx,ap20cbl-2.yaml b/zephyr/dts/bindings/battery/cosmx,ap20cbl-2.yaml
index 7faceedb11..5e64834f15 100644
--- a/zephyr/dts/bindings/battery/cosmx,ap20cbl-2.yaml
+++ b/zephyr/dts/bindings/battery/cosmx,ap20cbl-2.yaml
@@ -17,22 +17,22 @@ properties:
default: 0x3A
ship_mode_reg_data:
default: [ 0xC574, 0xC574 ]
- # Documentation: b/257860663#comment7
+ # Documentation: b/243772306
# Manufacturer Access 0x00
- # b14: Charging Disabled (0: Off, 1: On)
- # b13: Discharging Disabled (0: Off, 1: On)
+ # b14: C-FET Status (0: Off, 1: On)
+ # b15: D-FET Status (0: Off, 1: On)
fet_mfgacc_support:
default: 1
fet_reg_addr:
default: 0x0
fet_reg_mask:
- default: 0x2000
+ default: 0x8000
fet_disconnect_val:
- default: 0x2000
+ default: 0x0000
fet_cfet_mask:
default: 0x4000
fet_cfet_off_val:
- default: 0x4000
+ default: 0x0000
# Battery info
voltage_max:
diff --git a/zephyr/dts/bindings/battery/ganfeng,sg20.yaml b/zephyr/dts/bindings/battery/ganfeng,sg20.yaml
deleted file mode 100644
index 6e8f558b00..0000000000
--- a/zephyr/dts/bindings/battery/ganfeng,sg20.yaml
+++ /dev/null
@@ -1,53 +0,0 @@
-description: "Ganfeng SG20"
-compatible: "ganfeng,sg20"
-
-include: battery-smart.yaml
-
-properties:
- enum-name:
- type: string
- default: "ganfeng,sg20"
-
- # Fuel gauge
- manuf_name:
- default: "Ganfeng"
- device_name:
- default: "SG20"
- ship_mode_reg_addr:
- default: 0x00
- ship_mode_reg_data:
- default: [ 0x0010, 0x0010 ]
- fet_mfgacc_support:
- default: 0
- fet_reg_addr:
- default: 0x43
- fet_reg_mask:
- default: 0x0001
- fet_disconnect_val:
- default: 0x0000
- fet_cfet_mask:
- default: 0x0002
- fet_cfet_off_val:
- default: 0x0000
-
- # Battery info
- voltage_max:
- default: 8700
- voltage_normal:
- default: 7600
- voltage_min:
- default: 6000
- precharge_current:
- default: 256
- start_charging_min_c:
- default: 0
- start_charging_max_c:
- default: 50
- charging_min_c:
- default: 0
- charging_max_c:
- default: 60
- discharging_min_c:
- default: -20
- discharging_max_c:
- default: 60
diff --git a/zephyr/dts/bindings/cbi/cros-ec,cbi-ssfc-value.yaml b/zephyr/dts/bindings/cbi/named-cbi-ssfc-value.yaml
index 6bbba1bdd7..7e04afed87 100644
--- a/zephyr/dts/bindings/cbi/cros-ec,cbi-ssfc-value.yaml
+++ b/zephyr/dts/bindings/cbi/named-cbi-ssfc-value.yaml
@@ -4,9 +4,9 @@
description:
Possible CBI SSFC field values.
- It has to be defined as grandchild on the "cros-ec,cbi-ssfc"
+ It has to be defied as grandchild on the "named-cbi-ssfc"
-compatible: "cros-ec,cbi-ssfc-value"
+compatible: "named-cbi-ssfc-value"
properties:
value:
diff --git a/zephyr/dts/bindings/cbi/cros-ec,cbi-ssfc.yaml b/zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml
index d1cc4c26e5..2db330079d 100644
--- a/zephyr/dts/bindings/cbi/cros-ec,cbi-ssfc.yaml
+++ b/zephyr/dts/bindings/cbi/named-cbi-ssfc.yaml
@@ -4,7 +4,7 @@
description: CBI Second Source Factory Cache (SSFC)
-compatible: "cros-ec,cbi-ssfc"
+compatible: "named-cbi-ssfc"
child-binding:
description:
@@ -33,24 +33,24 @@ child-binding:
# Example:
#
# cbi-ssfc {
-# compatible = "cros-ec,cbi-ssfc";
+# compatible = "named-cbi-ssfc";
#
# base_sensor {
# enum-name = "BASE_SENSOR";
# size = <3>;
# bmi160 {
-# compatible = "cros-ec,cbi-ssfc-value";
+# compatible = "named-cbi-ssfc-value";
# status = "okay";
#
# value = <1>;
# devices = <&alt_base_accel &alt_base_gyro>;
# };
# kx022 {
-# compatible = "cros-ec,cbi-ssfc-value";
+# compatible = "named-cbi-ssfc-value";
# status = "okay";
#
# value = <3>;
# devices = <&base_accel_kx022>;
# };
# };
-# };
+# }; \ No newline at end of file
diff --git a/zephyr/dts/bindings/charger/richtek,rt9490.yaml b/zephyr/dts/bindings/charger/richtek,rt9490.yaml
index 0f9acf999a..ecd25696f3 100644
--- a/zephyr/dts/bindings/charger/richtek,rt9490.yaml
+++ b/zephyr/dts/bindings/charger/richtek,rt9490.yaml
@@ -9,11 +9,6 @@ compatible: "richtek,rt9490"
include: chg-chip.yaml
properties:
- irq:
- type: phandles
- description: |
- GPIO interrupt from BC1.2
-
- thermistor:
- type: phandle
- description: Underlying thermistor device to measure temperature
+ thermistor:
+ type: phandle
+ description: Underlying thermistor device to measure temperature
diff --git a/zephyr/dts/bindings/cros_pwr_signal/mediatek,mt8186-power-signal-list.yaml b/zephyr/dts/bindings/cros_pwr_signal/mt8186,power-signal-list.yaml
index 5f0e75f717..6e9af9ccef 100644
--- a/zephyr/dts/bindings/cros_pwr_signal/mediatek,mt8186-power-signal-list.yaml
+++ b/zephyr/dts/bindings/cros_pwr_signal/mt8186,power-signal-list.yaml
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
description: MediaTek MT8186, Power Signal List
-compatible: "mediatek,mt8186-power-signal-list"
+compatible: "mt8186,power-signal-list"
include: power-signal-list.yaml
diff --git a/zephyr/dts/bindings/cros_pwr_signal/mediatek,mt8192-power-signal-list.yaml b/zephyr/dts/bindings/cros_pwr_signal/mt8192,power-signal-list.yaml
index 8bbd1207eb..b1dedb76c8 100644
--- a/zephyr/dts/bindings/cros_pwr_signal/mediatek,mt8192-power-signal-list.yaml
+++ b/zephyr/dts/bindings/cros_pwr_signal/mt8192,power-signal-list.yaml
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
description: MediaTek, Power Signal List
-compatible: "mediatek,mt8192-power-signal-list"
+compatible: "mt8192,power-signal-list"
include: power-signal-list.yaml
diff --git a/zephyr/dts/bindings/emul/cros,anx7447-tcpc-emul.yaml b/zephyr/dts/bindings/emul/cros,anx7447-tcpc.yaml
index a4b41a0cec..562485d03d 100644
--- a/zephyr/dts/bindings/emul/cros,anx7447-tcpc-emul.yaml
+++ b/zephyr/dts/bindings/emul/cros,anx7447-tcpc.yaml
@@ -4,7 +4,7 @@
#
description: Zephyr ANX7447 emulator
-compatible: "cros,anx7447-tcpc-emul"
+compatible: "cros,anx7447-emul"
include: i2c-device.yaml
diff --git a/zephyr/dts/bindings/emul/cros,bb-retimer-emul.yaml b/zephyr/dts/bindings/emul/cros,bb-retimer-emul.yaml
new file mode 100644
index 0000000000..11dd5f5218
--- /dev/null
+++ b/zephyr/dts/bindings/emul/cros,bb-retimer-emul.yaml
@@ -0,0 +1,30 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: Zephyr BB retimer Emulator
+
+compatible: "cros,bb-retimer-emul"
+
+include: base.yaml
+
+properties:
+ vendor:
+ type: string
+ required: true
+ enum:
+ - BB_RETIMER_VENDOR_ID_1
+ - BB_RETIMER_VENDOR_ID_2
+ description: Vendor ID used by device that is emulated.
+
+ error-on-ro-write:
+ type: boolean
+ description:
+ Flag indicating if error should be generated when read only register
+ is being written.
+
+ error-on-reserved-bit-write:
+ type: boolean
+ description:
+ Flag indicating if error should be generated when reserved bit
+ is being written.
diff --git a/zephyr/dts/bindings/emul/zephyr,bma255-emul.yaml b/zephyr/dts/bindings/emul/zephyr,bma255.yaml
index 7017d62667..3f504e05a5 100644
--- a/zephyr/dts/bindings/emul/zephyr,bma255-emul.yaml
+++ b/zephyr/dts/bindings/emul/zephyr,bma255.yaml
@@ -4,7 +4,7 @@
description: Zephyr BMA255 Emulator
-compatible: "zephyr,bma255-emul"
+compatible: "zephyr,bma255"
include: base.yaml
diff --git a/zephyr/dts/bindings/emul/zephyr,bmi-emul.yaml b/zephyr/dts/bindings/emul/zephyr,bmi.yaml
index b8b1d2551d..6280d5cc39 100644
--- a/zephyr/dts/bindings/emul/zephyr,bmi-emul.yaml
+++ b/zephyr/dts/bindings/emul/zephyr,bmi.yaml
@@ -4,7 +4,7 @@
description: Zephyr BMI Emulator
-compatible: "zephyr,bmi-emul"
+compatible: "zephyr,bmi"
include: base.yaml
diff --git a/zephyr/dts/bindings/emul/zephyr,pi3usb9201-emul.yaml b/zephyr/dts/bindings/emul/zephyr,pi3usb9201-emul.yaml
new file mode 100644
index 0000000000..1f26a62f73
--- /dev/null
+++ b/zephyr/dts/bindings/emul/zephyr,pi3usb9201-emul.yaml
@@ -0,0 +1,9 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: Zephyr pi3usb9201 Emulator
+
+compatible: "zephyr,pi3usb9201-emul"
+
+include: base.yaml
diff --git a/zephyr/dts/bindings/emul/zephyr,smart-battery-emul.yaml b/zephyr/dts/bindings/emul/zephyr,smart-battery.yaml
index 88060b01d7..4c46fd4f64 100644
--- a/zephyr/dts/bindings/emul/zephyr,smart-battery-emul.yaml
+++ b/zephyr/dts/bindings/emul/zephyr,smart-battery.yaml
@@ -4,7 +4,7 @@
description: Zephyr Smart Battery Emulator
-compatible: "zephyr,smart-battery-emul"
+compatible: "zephyr,smart-battery"
include: base.yaml
diff --git a/zephyr/dts/bindings/emul/zephyr,tcs3400-emul.yaml b/zephyr/dts/bindings/emul/zephyr,tcs3400.yaml
index 8c33331b7a..f214a21064 100644
--- a/zephyr/dts/bindings/emul/zephyr,tcs3400-emul.yaml
+++ b/zephyr/dts/bindings/emul/zephyr,tcs3400.yaml
@@ -4,7 +4,7 @@
description: Zephyr ALS TCS3400 light sensor i2c emulator
-compatible: "zephyr,tcs3400-emul"
+compatible: "zephyr,tcs3400"
include: base.yaml
diff --git a/zephyr/dts/bindings/emul/zephyr,tusb1064-emul.yaml b/zephyr/dts/bindings/emul/zephyr,tusb1064.yaml
index 3cab1dd5a6..3cab1dd5a6 100644
--- a/zephyr/dts/bindings/emul/zephyr,tusb1064-emul.yaml
+++ b/zephyr/dts/bindings/emul/zephyr,tusb1064.yaml
diff --git a/zephyr/dts/bindings/fan/cros-ec,fan-steps.yaml b/zephyr/dts/bindings/fan/cros-ec,fan-steps.yaml
deleted file mode 100644
index 3befe43868..0000000000
--- a/zephyr/dts/bindings/fan/cros-ec,fan-steps.yaml
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-description: Fan steps parent node
-compatible: "cros-ec,fan-steps"
-child-binding:
- description: Support multiple thermal sensor temperature to trigger different fans speed,
- each step could have different rpm for each fan
- properties:
- temp_on:
- required: false
- type: array
- description:
- Temperatures for each sensor to trigger next fan level,
- <sensor 0, sensor 1, sensor 2, ...> mapping to variant overlay
- temp_off:
- required: false
- type: array
- description:
- Temperatures for each sensor to trigger previous fan level,
- <sensor 0, sensor 1, sensor 2, ...> mapping to variant overlay
- rpm_target:
- required: false
- type: array
- description:
- Support multiple fan speed target for each level (in RPM),
- <fan0 rpm target, fan1 rpm target, ...>
diff --git a/zephyr/dts/bindings/fan/cros-ec,fans.yaml b/zephyr/dts/bindings/fan/cros-ec,fans.yaml
index a9d198e37c..9aa6317f61 100644
--- a/zephyr/dts/bindings/fan/cros-ec,fans.yaml
+++ b/zephyr/dts/bindings/fan/cros-ec,fans.yaml
@@ -24,12 +24,6 @@ child-binding:
type: int
description:
Maximum fan speed (in RPM)
- rpm_deviation:
- required: false
- default: 7
- type: int
- description:
- Percentage of fan rpm deviation
pwms:
type: phandle-array
required: true
diff --git a/zephyr/dts/bindings/gpio/gpio-enum-name.yaml b/zephyr/dts/bindings/gpio/gpio-enum-name.yaml
index 5041b0646a..8252ca75e1 100644
--- a/zephyr/dts/bindings/gpio/gpio-enum-name.yaml
+++ b/zephyr/dts/bindings/gpio/gpio-enum-name.yaml
@@ -55,7 +55,6 @@ properties:
- GPIO_EN_USB_A_5V
- GPIO_IMVP9_VRRDY_OD
- GPIO_KB_DISCRETE_INT
- - GPIO_KBD_KSO2
- GPIO_LID_ACCEL_INT_L
- GPIO_LID_OPEN
- GPIO_PACKET_MODE_EN
diff --git a/zephyr/dts/bindings/gpio/named-gpios.yaml b/zephyr/dts/bindings/gpio/named-gpios.yaml
index 7b92f1a636..bf0ba7237e 100644
--- a/zephyr/dts/bindings/gpio/named-gpios.yaml
+++ b/zephyr/dts/bindings/gpio/named-gpios.yaml
@@ -15,6 +15,9 @@ child-binding:
gpios:
type: phandle-array
required: false
+ "#led-pin-cells":
+ type: int
+ required: false
no-auto-init:
description:
When set, the GPIO is not initialised, and can be
@@ -33,3 +36,5 @@ child-binding:
to the particular board's GPIO name.
type: string
required: false
+ led-pin-cells:
+ - value
diff --git a/zephyr/dts/bindings/keyboard/cros-ec,keyscan.yaml b/zephyr/dts/bindings/keyboard/cros-keyscan.yaml
index 0e093bf015..a2ec2afc46 100644
--- a/zephyr/dts/bindings/keyboard/cros-ec,keyscan.yaml
+++ b/zephyr/dts/bindings/keyboard/cros-keyscan.yaml
@@ -4,7 +4,7 @@
description: Keyboard scanning properties
-compatible: "cros-ec,keyscan"
+compatible: "cros-keyscan"
properties:
output-settle:
diff --git a/zephyr/dts/bindings/led/maxim,max695x.yaml b/zephyr/dts/bindings/led/maxim,max695x.yaml
deleted file mode 100644
index a219512b0d..0000000000
--- a/zephyr/dts/bindings/led/maxim,max695x.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-description: |
- MAX6958/MAX6959 7-Segment LED Display
-
- Example configuration
-
- max695x@38 {
- compatible = "maxim,max695x";
- reg = <0x38>;
- };
-
-
-compatible: "maxim,max695x"
-
-include: i2c-device.yaml
diff --git a/zephyr/dts/bindings/led/maxim,seven-seg-display.yaml b/zephyr/dts/bindings/led/maxim,seven-seg-display.yaml
new file mode 100644
index 0000000000..d66a0cdca2
--- /dev/null
+++ b/zephyr/dts/bindings/led/maxim,seven-seg-display.yaml
@@ -0,0 +1,19 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: MAX6958/MAX6959 7-Segment LED Display
+
+compatible: "maxim,seven-seg-display"
+
+include: i2c-device.yaml
+
+#
+# examples:
+#
+# seven_seg_display: max695x-seven-seg-display@38 {
+# compatible = "maxim,seven-seg-display";
+# reg = <0x38>;
+# label = "MAX695X_SEVEN_SEG_DISPLAY";
+# };
+#
diff --git a/zephyr/dts/bindings/leds/cros-ec,gpio-led-pins.yaml b/zephyr/dts/bindings/leds/cros-ec,gpio-led-pins.yaml
index fbf4e5217c..2e5fe7cff0 100644
--- a/zephyr/dts/bindings/leds/cros-ec,gpio-led-pins.yaml
+++ b/zephyr/dts/bindings/leds/cros-ec,gpio-led-pins.yaml
@@ -15,8 +15,8 @@ child-binding:
the LED and 0 always turns off the LED. So a node looks like
color-amber {
led-color = "LED_AMBER";
- led-pins = <&gpio_ec_chg_led_y_c1 gpio_ec_chg_led_b_c1>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c1 1>,
+ <&gpio_ec_chg_led_b_c1 0>;
};
properties:
led-color:
@@ -61,15 +61,10 @@ child-binding:
- EC_LED_COLOR_WHITE
- EC_LED_COLOR_AMBER
led-pins:
- type: phandles
+ type: phandle-array
required: true
description: |
- This property is used to specify an array of gpio pins to set a
- particular color.
-
- led-values:
- type: array
- required: true
- description: |
- This property is used to specify an array of values to set on the
- corresponding led-pins to set a particular color.
+ This property is used to specify an array of gpio pins and
+ corresponding values to enable a particular color.
+ e.g. Amber color - led-pins = <&gpio_ec_chg_led_y_c1 1>,
+ <&gpio_ec_chg_led_b_c1 0>;
diff --git a/zephyr/dts/bindings/leds/cros-ec,pwm-led-pins.yaml b/zephyr/dts/bindings/leds/cros-ec,pwm-led-pins.yaml
index 5ee8e112b5..19fee69be4 100644
--- a/zephyr/dts/bindings/leds/cros-ec,pwm-led-pins.yaml
+++ b/zephyr/dts/bindings/leds/cros-ec,pwm-led-pins.yaml
@@ -14,8 +14,8 @@ child-binding:
looks like this where 100 is PWM duty cycle in percentage.
color-amber {
led-color = "LED_AMBER";
- led-pwms = <&pwm_led_y &pwm_led_b>;
- led-values = <100 0>;
+ led-pins = <&pwm_led_y 100>,
+ <&pwm_led_b 0>;
};
properties:
led-color:
@@ -59,16 +59,11 @@ child-binding:
- EC_LED_COLOR_YELLOW
- EC_LED_COLOR_WHITE
- EC_LED_COLOR_AMBER
- led-pwms:
- type: phandles
+ led-pins:
+ type: phandle-array
required: true
description: |
- This property is used to specify an array of pwms to set a
- particular color.
-
- led-values:
- type: array
- required: true
- description: |
- This property is used to specify an array of values to set on the
- corresponding pwm-pins to set a particular color.
+ This property is used to specify an array of PWM pins and
+ corresponding values to enable a particular color.
+ e.g. Amber color - led-pins = <&pwm_led_y 100>,
+ <&pwm_led_b 0>;
diff --git a/zephyr/dts/bindings/leds/cros-ec,pwm-pin-config.yaml b/zephyr/dts/bindings/leds/cros-ec,pwm-pin-config.yaml
new file mode 100644
index 0000000000..bdef6b6144
--- /dev/null
+++ b/zephyr/dts/bindings/leds/cros-ec,pwm-pin-config.yaml
@@ -0,0 +1,19 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: PWM LED pin configuration
+
+compatible: "cros-ec,pwm-pin-config"
+
+child-binding:
+ description: PWMs associated with LEDs
+ properties:
+ pwms:
+ type: phandle-array
+ required: true
+ "#led-pin-cells":
+ type: int
+ required: false
+ led-pin-cells:
+ - value
diff --git a/zephyr/dts/bindings/power/intel,ap-pwr-signal-emul.yaml b/zephyr/dts/bindings/power/intel,ap-pwr-signal-emul.yaml
deleted file mode 100644
index 1863349892..0000000000
--- a/zephyr/dts/bindings/power/intel,ap-pwr-signal-emul.yaml
+++ /dev/null
@@ -1,124 +0,0 @@
- # Copyright 2022 The ChromiumOS Authors
- # Use of this source code is governed by a BSD-style license that can be
- # found in the LICENSE file.
-
-description: |
- Power Signal Emulator Node
-
- Power signal emulator allows executing AP Power Sequence in a virtual
- environment by simulating power signals behavior.
-
- This file defines a node to bind two or more power signals. A node connects
- one input-signal with one or more output-signals. When a node is loaded and
- initialized by power signal emulator, its input-signal state will control
- the value of its children output-signals. Behavior of output-signals are
- configurable to meet AP power sequence test cases.
-
- Power Signals direction is determined from emulator node perspective. An input
- signal in a node, is the one to be monitored by the emulator, while an output
- signal gets its value altered when corresponding input signal's state changes.
-
-compatible: "intel,ap-pwr-signal-emul"
-
-properties:
- input-signal:
- type: phandle
- required: true
- description: |
- Input signal whose value is monitored to control children output-signal`s
- value.
-
- assert-value:
- type: int
- required: false
- default: 1
- description: |
- Value that indicates `input-signal` must be ASSERTED.
-
- A power signal state can be ASSERTED or DEASSERTED.`input-signal` is only
- considered asserted if its new value is equal to `assert-value`, any
- other value makes it deasserted.
-
- edge:
- type: string
- required: false
- description: |
- Controls when to trigger children value change, based on `input-signal`
- new state.
-
- EDGE_ACTIVE_ON_ASSERT: Children value changes only when `input-signal`
- state changes into asserted.
-
- EDGE_ACTIVE_ON_DEASSERT: Children value changes only when `input-signal`
- state changes into deasserted.
-
- EDGE_ACTIVE_ON_DEASSERT: Children value changes everytime `input-signal`
- state changes.
-
- default: EDGE_ACTIVE_ON_BOTH
- enum:
- - EDGE_ACTIVE_ON_ASSERT
- - EDGE_ACTIVE_ON_DEASSERT
- - EDGE_ACTIVE_ON_BOTH
-
- init-value:
- type: int
- required: false
- description: |
- Initial value of `input-signal`.
-
-child-binding:
- description: |
- Child power signals configuration.
-
- properties:
- output-signal:
- type: phandle
- required: true
- description: |
- Output signal whose value will be controlled by parent `input-signal`
- state.
-
- assert-value:
- type: int
- required: false
- default: 1
- description: |
- Value that will be assigned to this signal when parent `input-signal`
- state is asserted.
-
- assert-delay-ms:
- type: int
- required: false
- default: 10
- description: |
- Milliseconds to delay setting this signal to its `assert-value`
- after `input-signal` is asserted.
-
- deassert-value:
- type: int
- required: false
- default: 0
- description: |
- Value that will be assigned to this signal when parent `input-signal`
- state is deasserted.
-
- deassert-delay-ms:
- type: int
- required: false
- default: 10
- description: |
- Milliseconds to delay setting this signal to its `deassert-value`
- after `input-signal` is deasserted.
-
- init-value:
- type: int
- required: false
- description: |
- Value set to this power signal when initializing this node.
-
- invert-value:
- type: boolean
- description: |
- Invert this power signal assertion logic, this applies to both values
- and delays.
diff --git a/zephyr/dts/bindings/power/intel,ap-pwr-test-platform.yaml b/zephyr/dts/bindings/power/intel,ap-pwr-test-platform.yaml
deleted file mode 100644
index c2f7e10cd1..0000000000
--- a/zephyr/dts/bindings/power/intel,ap-pwr-test-platform.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
- # Copyright 2022 The Chromium OS Authors. All rights reserved.
- # Use of this source code is governed by a BSD-style license that can be
- # found in the LICENSE file.
-
-description: |
- Power Signal Test Platform
-
- This is a virtual representation of platform comprised of one or more power
- signal emulator nodes. Test platform is loaded into power signal emulator.
-
-compatible: "intel,ap-pwr-test-platform"
-
-properties:
- nodes:
- type: phandles
- required: true
- description: |
- phandle array of power signals nodes to be run by emulator.
diff --git a/zephyr/dts/bindings/switchcap/cros-ec,switchcap-gpio.yaml b/zephyr/dts/bindings/switchcap/switchcap-gpio.yaml
index 344738c8c0..0016401835 100644
--- a/zephyr/dts/bindings/switchcap/cros-ec,switchcap-gpio.yaml
+++ b/zephyr/dts/bindings/switchcap/switchcap-gpio.yaml
@@ -1,6 +1,6 @@
description: SwitchCap controlled by gpios
-compatible: "cros-ec,switchcap-gpio"
+compatible: "switchcap-gpio"
properties:
enable-pin:
diff --git a/zephyr/dts/bindings/switchcap/lion,ln9310.yaml b/zephyr/dts/bindings/switchcap/switchcap-ln9310.yaml
index c1c4a99bee..2a73325cd3 100644
--- a/zephyr/dts/bindings/switchcap/lion,ln9310.yaml
+++ b/zephyr/dts/bindings/switchcap/switchcap-ln9310.yaml
@@ -1,6 +1,6 @@
-description: SwitchCap controlled by Lion Semiconductor LN9310
+description: SwitchCap controlled by LN9310
-compatible: "lion,ln9310"
+compatible: "switchcap-ln9310"
properties:
enable-pin:
diff --git a/zephyr/dts/bindings/usbc/bc12/richtek,rt9490-bc12.yaml b/zephyr/dts/bindings/usbc/bc12/richtek,rt9490-bc12.yaml
new file mode 100644
index 0000000000..38791d65bf
--- /dev/null
+++ b/zephyr/dts/bindings/usbc/bc12/richtek,rt9490-bc12.yaml
@@ -0,0 +1,15 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+description: USBC BC1.2
+
+compatible: "richtek,rt9490-bc12"
+
+include: base.yaml
+
+properties:
+ irq:
+ type: phandles
+ description: |
+ GPIO interrupt from BC1.2
diff --git a/zephyr/dts/bindings/usbc/tcpc/renesas,raa489000.yaml b/zephyr/dts/bindings/usbc/tcpc/renesas,raa489000.yaml
deleted file mode 100644
index f8dd9807ed..0000000000
--- a/zephyr/dts/bindings/usbc/tcpc/renesas,raa489000.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-description: Renesas RAA489000 USB TCPC binding
-
-compatible: "renesas,raa489000"
-
-include: i2c-device.yaml
-
-properties:
- tcpc-flags:
- type: int
- default: 0
- description: |
- TCPC configuration flags
diff --git a/zephyr/dts/board-overlays/native_posix.dts b/zephyr/dts/board-overlays/native_posix.dts
index c8bfe02539..44a034d73b 100644
--- a/zephyr/dts/board-overlays/native_posix.dts
+++ b/zephyr/dts/board-overlays/native_posix.dts
@@ -4,9 +4,6 @@
*/
#include <dt-bindings/gpio_defines.h>
-#include <dt-bindings/native-posix-gpio.h>
-
-#define GPIO_VOLTAGE_1P8 NATIVE_POSIX_GPIO_VOLTAGE_1P8
/ {
named-gpios {
diff --git a/zephyr/dts/it8xxx2_emul.dts b/zephyr/dts/it8xxx2_emul.dts
index 5f517b0c1b..b22251b67b 100644
--- a/zephyr/dts/it8xxx2_emul.dts
+++ b/zephyr/dts/it8xxx2_emul.dts
@@ -8,9 +8,6 @@
*/
#include <dt-bindings/gpio_defines.h>
-#include <dt-bindings/native-posix-gpio.h>
-
-#define GPIO_VOLTAGE_1P8 NATIVE_POSIX_GPIO_VOLTAGE_1P8
/ {
gpioa: gpio@f01601 {
@@ -185,11 +182,4 @@
#size-cells = <0>;
reg = <0x00f03500 0x0080>;
};
-
- adc0: adc {
- compatible = "zephyr,adc-emul";
- nchannels = <6>;
- ref-internal-mv = <3300>;
- #io-channel-cells = <1>;
- };
};
diff --git a/zephyr/emul/CMakeLists.txt b/zephyr/emul/CMakeLists.txt
index 3d268dde80..377be11792 100644
--- a/zephyr/emul/CMakeLists.txt
+++ b/zephyr/emul/CMakeLists.txt
@@ -26,6 +26,5 @@ zephyr_library_sources_ifdef(CONFIG_EMUL_CROS_FLASH emul_flash.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_RTC emul_rtc.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_RT9490 emul_rt9490.c)
zephyr_library_sources_ifdef(CONFIG_PWM_MOCK pwm_mock.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_PCT2075 emul_pct2075.c)
cros_ec_library_include_directories_ifdef(CONFIG_EMUL_CROS_FLASH include)
diff --git a/zephyr/emul/Kconfig b/zephyr/emul/Kconfig
index 44d53179c3..e445e30154 100644
--- a/zephyr/emul/Kconfig
+++ b/zephyr/emul/Kconfig
@@ -13,16 +13,12 @@ config EMUL_COMMON_I2C
config EMUL_SMART_BATTERY
bool "Smart Battery emulator"
- default y
- depends on DT_HAS_ZEPHYR_SMART_BATTERY_EMUL_ENABLED
select EMUL_COMMON_I2C
help
Enable the Smart Battery emulator. This driver use emulated I2C bus.
config EMUL_BMA255
bool "BMA255 emulator"
- default y
- depends on DT_HAS_ZEPHYR_BMA255_EMUL_ENABLED
select EMUL_COMMON_I2C
help
Enable the BMA255 emulator. This driver use emulated I2C bus.
@@ -31,8 +27,6 @@ config EMUL_BMA255
config EMUL_BC12_DETECT_PI3USB9201
bool "PI3USB9201 emulator"
- default y
- depends on ZTEST && DT_HAS_PERICOM_PI3USB9201_ENABLED
help
Enable the PI3USB9201 emulator. PI3USB9201 is a BC1.2 charger
detector/advertiser. The emulator supports reading and writing the
@@ -40,8 +34,6 @@ config EMUL_BC12_DETECT_PI3USB9201
config EMUL_PPC_SYV682X
bool "Silergy SYV682x PPC emulator"
- default y
- depends on DT_HAS_ZEPHYR_SYV682X_EMUL_ENABLED
select PLATFORM_EC_USBC_PPC_SYV682X
help
Enable the SYV682x emulator. SYV682 is a USB Type-C PPC. This driver
@@ -49,8 +41,6 @@ config EMUL_PPC_SYV682X
config EMUL_BMI
bool "BMI emulator"
- default y
- depends on DT_HAS_ZEPHYR_BMI_EMUL_ENABLED
select EMUL_COMMON_I2C
help
Enable the BMI emulator. This driver use emulated I2C bus.
@@ -59,8 +49,6 @@ config EMUL_BMI
config EMUL_TCS3400
bool "TCS3400 emulator"
- default y
- depends on DT_HAS_ZEPHYR_TCS3400_EMUL_ENABLED
select EMUL_COMMON_I2C
help
Enable the TCS3400 light sensor. This driver use emulated I2C bus.
@@ -74,8 +62,6 @@ config EMUL_TCS3400
config EMUL_TUSB1064
bool "TCS3400 emulator"
- default y
- depends on DT_HAS_ZEPHYR_TUSB1064_EMUL_ENABLED
select EMUL_COMMON_I2C
help
Enable the TUSB1064 usb mux. This driver use emulated I2C bus.
@@ -83,8 +69,6 @@ config EMUL_TUSB1064
config EMUL_BB_RETIMER
bool "BB retimer emulator"
- default y
- depends on ZTEST && DT_HAS_INTEL_JHL8040R_ENABLED
select EMUL_COMMON_I2C
help
Enable the BB (Burnside Bridge) retimer emulator. This driver use
@@ -94,15 +78,11 @@ config EMUL_BB_RETIMER
config EMUL_KB_RAW
bool "Raw keyboard emulator"
- default y
- depends on DT_HAS_CROS_EC_KB_RAW_EMUL_ENABLED
help
Enable the raw keyboard emulator.
config EMUL_CROS_FLASH
bool "Emulated flash driver for the Zephyr shim"
- default y
- depends on DT_HAS_CROS_EC_FLASH_EMUL_ENABLED
select PLATFORM_EC_FLASH_CROS
imply SYSTEM_FAKE
help
@@ -110,15 +90,11 @@ config EMUL_CROS_FLASH
config EMUL_RTC
bool "Emulated RTC driver for Zephyr shim"
- default y
- depends on DT_HAS_CROS_EC_RTC_EMUL_ENABLED
help
This options enables the RTC emulator for testing.
config EMUL_RT9490
bool "Rt9490 charger emulator"
- default y
- depends on DT_HAS_ZEPHYR_RT9490_EMUL_ENABLED
select EMUL_COMMON_I2C
help
Enable the RT9490 light sensor emulator. This driver use emulated I2C
@@ -126,21 +102,10 @@ config EMUL_RT9490
config PWM_MOCK
bool "Mock implementation of an PWM device"
- default y
- depends on DT_HAS_CROS_PWM_MOCK_ENABLED
help
Enable the PWM mock. This driver is a pure mock and does nothing by
default.
-config EMUL_PCT2075
- bool "PCT2075 emulator"
- default y
- depends on ZTEST && DT_HAS_NXP_PCT2075_ENABLED
- select EMUL_COMMON_I2C
- help
- Enable the PCT2075 temperature sensor emulator. It uses emulated I2C bus.
- Emulator API is available in zephyr/include/emul/emul_pct2075.h.
-
rsource "Kconfig.ln9310"
rsource "Kconfig.lis2dw12"
rsource "Kconfig.i2c_mock"
diff --git a/zephyr/emul/emul_bb_retimer.c b/zephyr/emul/emul_bb_retimer.c
index 8028c53c0f..266fd1a340 100644
--- a/zephyr/emul/emul_bb_retimer.c
+++ b/zephyr/emul/emul_bb_retimer.c
@@ -3,21 +3,22 @@
* found in the LICENSE file.
*/
-#include "driver/retimer/bb_retimer.h"
-#include "emul/emul_bb_retimer.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
+#define DT_DRV_COMPAT cros_bb_retimer_emul
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_bb_retimer);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT intel_jhl8040r
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_bb_retimer.h"
+#include "emul/emul_stub_device.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_bb_retimer);
+#include "driver/retimer/bb_retimer.h"
/** Run-time data used by the emulator */
struct bb_emul_data {
@@ -308,9 +309,10 @@ static int bb_emul_init(const struct emul *emul, const struct device *parent)
#define BB_RETIMER_EMUL(n) \
static struct bb_emul_data bb_emul_data_##n = { \
- .vendor_id = BB_RETIMER_VENDOR_ID_1, \
- .error_on_ro_write = true, \
- .error_on_rsvd_write = true, \
+ .vendor_id = DT_STRING_TOKEN(DT_DRV_INST(n), vendor), \
+ .error_on_ro_write = DT_INST_PROP(n, error_on_ro_write),\
+ .error_on_rsvd_write = DT_INST_PROP(n, \
+ error_on_reserved_bit_write), \
.common = { \
.start_write = NULL, \
.write_byte = bb_emul_write_byte, \
diff --git a/zephyr/emul/emul_bma255.c b/zephyr/emul/emul_bma255.c
index 2afe1f722e..a57c8fbdbb 100644
--- a/zephyr/emul/emul_bma255.c
+++ b/zephyr/emul/emul_bma255.c
@@ -3,21 +3,22 @@
* found in the LICENSE file.
*/
-#include "driver/accel_bma2x2.h"
-#include "emul/emul_bma255.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
+#define DT_DRV_COMPAT zephyr_bma255
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_bma255);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT zephyr_bma255_emul
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_bma255.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_bma255);
+#include "driver/accel_bma2x2.h"
+#include "emul/emul_stub_device.h"
/** Run-time data used by the emulator */
struct bma_emul_data {
diff --git a/zephyr/emul/emul_bmi.c b/zephyr/emul/emul_bmi.c
index d0f5691402..fe46428f01 100644
--- a/zephyr/emul/emul_bmi.c
+++ b/zephyr/emul/emul_bmi.c
@@ -3,24 +3,25 @@
* found in the LICENSE file.
*/
-#include "driver/accelgyro_bmi160.h"
-#include "driver/accelgyro_bmi260.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "emul/emul_bmi.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
+#define DT_DRV_COMPAT zephyr_bmi
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_bmi);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/sys/__assert.h>
-#define DT_DRV_COMPAT zephyr_bmi_emul
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_bmi.h"
+#include "emul/emul_stub_device.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_bmi);
+#include "driver/accelgyro_bmi160.h"
+#include "driver/accelgyro_bmi260.h"
+#include "driver/accelgyro_bmi_common.h"
/** Run-time data used by the emulator */
struct bmi_emul_data {
diff --git a/zephyr/emul/emul_bmi160.c b/zephyr/emul/emul_bmi160.c
index 8b3042e2ff..c1d6b58a8f 100644
--- a/zephyr/emul/emul_bmi160.c
+++ b/zephyr/emul/emul_bmi160.c
@@ -3,20 +3,21 @@
* found in the LICENSE file.
*/
-#include "driver/accelgyro_bmi160.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "emul/emul_bmi.h"
+#define DT_DRV_COMPAT zephyr_bmi
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_bmi160);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT zephyr_bmi_emul
+#include "emul/emul_bmi.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_bmi160);
+#include "driver/accelgyro_bmi160.h"
+#include "driver/accelgyro_bmi_common.h"
/** Mask reserved bits in each register of BMI160 */
static const uint8_t bmi_emul_160_rsvd_mask[] = {
diff --git a/zephyr/emul/emul_bmi260.c b/zephyr/emul/emul_bmi260.c
index d62b51ebfa..5892a9ae96 100644
--- a/zephyr/emul/emul_bmi260.c
+++ b/zephyr/emul/emul_bmi260.c
@@ -3,20 +3,21 @@
* found in the LICENSE file.
*/
-#include "driver/accelgyro_bmi260.h"
-#include "driver/accelgyro_bmi_common.h"
-#include "emul/emul_bmi.h"
+#define DT_DRV_COMPAT zephyr_bmi
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_bmi260);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT zephyr_bmi_emul
+#include "emul/emul_bmi.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_bmi260);
+#include "driver/accelgyro_bmi260.h"
+#include "driver/accelgyro_bmi_common.h"
/** Mask reserved bits in each register of BMI260 */
static const uint8_t bmi_emul_260_rsvd_mask[] = {
diff --git a/zephyr/emul/emul_clock_control.c b/zephyr/emul/emul_clock_control.c
index e4223a5b43..561298a705 100644
--- a/zephyr/emul/emul_clock_control.c
+++ b/zephyr/emul/emul_clock_control.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
-#include "common.h"
-#include "emul/emul_clock_control.h"
+#define DT_DRV_COMPAT cros_clock_control_emul
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT cros_clock_control_emul
+#include "common.h"
+#include "emul/emul_clock_control.h"
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(clock_control_emul, CONFIG_CLOCK_CONTROL_EMUL_LOG_LEVEL);
/** Data needed to maintain the current emulator state */
diff --git a/zephyr/emul/emul_common_i2c.c b/zephyr/emul/emul_common_i2c.c
index 327188cb48..70bc962c5f 100644
--- a/zephyr/emul/emul_common_i2c.c
+++ b/zephyr/emul/emul_common_i2c.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_common_i2c);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_common_i2c);
+#include "emul/emul_common_i2c.h"
/** Check description in emul_common_i2c.h */
int i2c_common_emul_lock_data(struct i2c_common_emul_data *common_data,
@@ -172,6 +172,16 @@ static int i2c_common_emul_write_byte(const struct emul *target,
{
int reg, ret;
+ /* Custom user handler */
+ if (data->write_func) {
+ ret = data->write_func(target, data->cur_reg, val,
+ data->msg_byte, data->write_func_data);
+ if (ret < 0) {
+ return -EIO;
+ } else if (ret == 0) {
+ return 0;
+ }
+ }
/* Check if user wants to fail on accessed register */
if (data->access_reg) {
reg = data->access_reg(target, data->cur_reg, data->msg_byte,
@@ -185,18 +195,6 @@ static int i2c_common_emul_write_byte(const struct emul *target,
data->write_fail_reg == I2C_COMMON_EMUL_FAIL_ALL_REG) {
return -EIO;
}
-
- /* Custom user handler */
- if (data->write_func) {
- ret = data->write_func(target, data->cur_reg, val,
- data->msg_byte, data->write_func_data);
- if (ret < 0) {
- return -EIO;
- } else if (ret == 0) {
- return 0;
- }
- }
-
/* Emulator handler */
if (data->write_byte) {
k_mutex_lock(&data->data_mtx, K_FOREVER);
@@ -230,6 +228,16 @@ static int i2c_common_emul_read_byte(const struct emul *target,
{
int reg, ret;
+ /* Custom user handler */
+ if (data->read_func) {
+ ret = data->read_func(target, data->cur_reg, val,
+ data->msg_byte, data->read_func_data);
+ if (ret < 0) {
+ return -EIO;
+ } else if (ret == 0) {
+ return 0;
+ }
+ }
/* Check if user wants to fail on accessed register */
if (data->access_reg) {
reg = data->access_reg(target, data->cur_reg, data->msg_byte,
@@ -242,18 +250,6 @@ static int i2c_common_emul_read_byte(const struct emul *target,
data->read_fail_reg == I2C_COMMON_EMUL_FAIL_ALL_REG) {
return -EIO;
}
-
- /* Custom user handler */
- if (data->read_func) {
- ret = data->read_func(target, data->cur_reg, val,
- data->msg_byte, data->read_func_data);
- if (ret < 0) {
- return -EIO;
- } else if (ret == 0) {
- return 0;
- }
- }
-
/* Emulator handler */
if (data->read_byte) {
k_mutex_lock(&data->data_mtx, K_FOREVER);
diff --git a/zephyr/emul/emul_flash.c b/zephyr/emul/emul_flash.c
index 936ee5470c..0efc690fd4 100644
--- a/zephyr/emul/emul_flash.c
+++ b/zephyr/emul/emul_flash.c
@@ -3,19 +3,19 @@
* found in the LICENSE file.
*/
-#include "drivers/cros_flash.h"
-#include "ec_commands.h"
-#include "flash.h"
+#define DT_DRV_COMPAT cros_ec_flash_emul
-#include <zephyr/device.h>
-#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/logging/log.h>
-#include <zephyr/sys/__assert.h>
+LOG_MODULE_REGISTER(emul_flash);
-#define DT_DRV_COMPAT cros_ec_flash_emul
+#include <zephyr/device.h>
+#include <zephyr/drivers/emul.h>
+#include <ec_commands.h>
+#include <drivers/cros_flash.h>
+#include <zephyr/sys/__assert.h>
-LOG_MODULE_REGISTER(emul_flash);
+#include "flash.h"
struct flash_emul_data {
const struct device *flash_dev;
diff --git a/zephyr/emul/emul_isl923x.c b/zephyr/emul/emul_isl923x.c
index d46f1131d4..1ecb9e79f9 100644
--- a/zephyr/emul/emul_isl923x.c
+++ b/zephyr/emul/emul_isl923x.c
@@ -3,26 +3,25 @@
* found in the LICENSE file.
*/
-#include "driver/charger/isl923x.h"
-#include "driver/charger/isl923x_public.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_isl923x.h"
-#include "emul/emul_smart_battery.h"
-#include "emul/emul_stub_device.h"
-#include "i2c.h"
-
-#include <errno.h>
+#define DT_DRV_COMPAT cros_isl923x_emul
#include <zephyr/device.h>
-#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
+#include <zephyr/drivers/emul.h>
+#include <errno.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT cros_isl923x_emul
+#include "driver/charger/isl923x.h"
+#include "driver/charger/isl923x_public.h"
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_isl923x.h"
+#include "emul/emul_smart_battery.h"
+#include "i2c.h"
+#include "emul/emul_stub_device.h"
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(isl923x_emul, CONFIG_ISL923X_EMUL_LOG_LEVEL);
/** Mask used for the charge current register */
diff --git a/zephyr/emul/emul_kb_raw.c b/zephyr/emul/emul_kb_raw.c
index 2e8cdbdd7d..1fdd93d1a0 100644
--- a/zephyr/emul/emul_kb_raw.c
+++ b/zephyr/emul/emul_kb_raw.c
@@ -3,17 +3,16 @@
* found in the LICENSE file.
*/
-#include <zephyr/device.h>
-#include <zephyr/drivers/emul.h>
+#define DT_DRV_COMPAT cros_ec_kb_raw_emul
+
#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_kb_raw);
+#include <zephyr/device.h>
+#include <zephyr/drivers/emul.h>
#include <drivers/cros_kb_raw.h>
#include <keyboard_raw.h>
-#define DT_DRV_COMPAT cros_ec_kb_raw_emul
-
-LOG_MODULE_REGISTER(emul_kb_raw);
-
struct kb_raw_emul_data {
int active_column;
int *matrix;
diff --git a/zephyr/emul/emul_lis2dw12.c b/zephyr/emul/emul_lis2dw12.c
index 547e74912c..bdc4b50358 100644
--- a/zephyr/emul/emul_lis2dw12.c
+++ b/zephyr/emul/emul_lis2dw12.c
@@ -3,23 +3,22 @@
* found in the LICENSE file.
*/
-#include "driver/accel_lis2dw12.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_lis2dw12.h"
-#include "emul/emul_stub_device.h"
-#include "i2c.h"
-
-#include <errno.h>
+#define DT_DRV_COMPAT cros_lis2dw12_emul
#include <zephyr/device.h>
-#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
+#include <zephyr/drivers/emul.h>
+#include <errno.h>
#include <zephyr/sys/__assert.h>
-#define DT_DRV_COMPAT cros_lis2dw12_emul
+#include "driver/accel_lis2dw12.h"
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_lis2dw12.h"
+#include "i2c.h"
+#include "emul/emul_stub_device.h"
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(lis2dw12_emul, CONFIG_LIS2DW12_EMUL_LOG_LEVEL);
struct lis2dw12_emul_data {
diff --git a/zephyr/emul/emul_ln9310.c b/zephyr/emul/emul_ln9310.c
index 9d6a0197a0..bd6d41bce3 100644
--- a/zephyr/emul/emul_ln9310.c
+++ b/zephyr/emul/emul_ln9310.c
@@ -3,15 +3,9 @@
* found in the LICENSE file.
*/
-#include "driver/ln9310.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_ln9310.h"
-#include "emul/emul_stub_device.h"
-#include "hooks.h"
-#include "i2c.h"
+#define DT_DRV_COMPAT cros_ln9310_emul
#include <errno.h>
-
#include <zephyr/device.h>
#include <zephyr/devicetree/gpio.h>
#include <zephyr/drivers/emul.h>
@@ -19,11 +13,16 @@
#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/sys/__assert.h>
-#define DT_DRV_COMPAT cros_ln9310_emul
+#include "driver/ln9310.h"
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_ln9310.h"
+#include "hooks.h"
+#include "i2c.h"
+#include "emul/emul_stub_device.h"
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ln9310_emul, CONFIG_LN9310_EMUL_LOG_LEVEL);
enum functional_mode {
diff --git a/zephyr/emul/emul_pct2075.c b/zephyr/emul/emul_pct2075.c
deleted file mode 100644
index cfd172b6dc..0000000000
--- a/zephyr/emul/emul_pct2075.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "driver/temp_sensor/pct2075.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_pct2075.h"
-#include "emul/emul_stub_device.h"
-#include "util.h"
-
-#include <zephyr/device.h>
-
-/* NOTE: The emulator doesn't support OS pin */
-
-#define DT_DRV_COMPAT nxp_pct2075
-
-#define PCT2075_TEMP_MAX_MC 127000
-#define PCT2075_TEMP_MIN_MC -55000
-#define PCT2075_RESOLUTION_MC 125
-
-static const uint16_t default_values[PCT2075_REG_NUMBER] = {
- [PCT2075_REG_TEMP] = 0x00, [PCT2075_REG_CONF] = 0x00,
- [PCT2075_REG_THYST] = 0x4b00, [PCT2075_REG_TOS] = 0x5000,
- [PCT2075_REG_TIDLE] = 0x00,
-};
-
-void pct2075_emul_reset_regs(const struct emul *emul)
-{
- struct pct2075_data *data = (struct pct2075_data *)emul->data;
-
- memcpy(data->regs, default_values, PCT2075_REG_NUMBER + 1);
-}
-
-int pct2075_emul_set_temp(const struct emul *emul, int mk)
-{
- struct pct2075_data *data = (struct pct2075_data *)emul->data;
- int mc = MILLI_KELVIN_TO_MILLI_CELSIUS(mk);
- int reg;
-
- if (!IN_RANGE(mc, PCT2075_TEMP_MIN_MC, PCT2075_TEMP_MAX_MC)) {
- return -1;
- }
-
- /* Divide by the sensor resolution to get register value */
- reg = mc / PCT2075_RESOLUTION_MC;
-
- /* Use 11 most significant bits. */
- data->regs[PCT2075_REG_TEMP] = reg << 5;
-
- return 0;
-}
-
-int pct2075_emul_read_byte(const struct emul *target, int reg, uint8_t *val,
- int bytes)
-{
- struct pct2075_data *data = (struct pct2075_data *)target->data;
-
- if (!IN_RANGE(reg, 0, PCT2075_REG_NUMBER - 1)) {
- return -1;
- }
-
- if (bytes == 0) {
- *val = data->regs[reg] >> 8;
- } else if (bytes == 1) {
- *val = data->regs[reg] & 0x00FF;
- } else {
- /* Support up to 2 bytes read */
- return -1;
- }
-
- return 0;
-}
-
-static int pct2075_emul_init(const struct emul *emul,
- const struct device *parent)
-{
- struct pct2075_data *data = (struct pct2075_data *)emul->data;
- struct i2c_common_emul_data *common_data = &data->common;
-
- i2c_common_emul_init(common_data);
-
- pct2075_emul_reset_regs(emul);
-
- return 0;
-}
-
-#define INIT_PCT2075_EMUL(n) \
- static struct i2c_common_emul_cfg common_cfg_##n; \
- static struct pct2075_data pct2075_data_##n; \
- static struct i2c_common_emul_cfg common_cfg_##n = { \
- .dev_label = DT_NODE_FULL_NAME(DT_DRV_INST(n)), \
- .data = &pct2075_data_##n.common, \
- .addr = DT_INST_REG_ADDR(n) \
- }; \
- static struct pct2075_data pct2075_data_##n = { \
- .common = { \
- .cfg = &common_cfg_##n, \
- .read_byte = pct2075_emul_read_byte, \
- }, \
- }; \
- EMUL_DT_INST_DEFINE(n, pct2075_emul_init, &pct2075_data_##n, \
- &common_cfg_##n, &i2c_common_emul_api)
-
-DT_INST_FOREACH_STATUS_OKAY(INIT_PCT2075_EMUL)
-
-DT_INST_FOREACH_STATUS_OKAY(EMUL_STUB_DEVICE);
diff --git a/zephyr/emul/emul_pi3usb9201.c b/zephyr/emul/emul_pi3usb9201.c
index a722fc3039..3b1193d9b1 100644
--- a/zephyr/emul/emul_pi3usb9201.c
+++ b/zephyr/emul/emul_pi3usb9201.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_pi3usb9201.h"
-#include "emul/emul_stub_device.h"
+#define DT_DRV_COMPAT zephyr_pi3usb9201_emul
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT pericom_pi3usb9201
+#include "emul/emul_pi3usb9201.h"
+#include "emul/emul_stub_device.h"
+#include "emul/emul_common_i2c.h"
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(emul_pi3usb9201, LOG_LEVEL_DBG);
#define EMUL_REG_COUNT (PI3USB9201_REG_HOST_STS + 1)
diff --git a/zephyr/emul/emul_rt9490.c b/zephyr/emul/emul_rt9490.c
index 1775bc9235..bc156b7085 100644
--- a/zephyr/emul/emul_rt9490.c
+++ b/zephyr/emul/emul_rt9490.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+
#include "driver/charger/rt9490.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_rt9490.h"
#include "emul/emul_stub_device.h"
#include "util.h"
-#include <zephyr/device.h>
-
#define DT_DRV_COMPAT zephyr_rt9490_emul
#define RT9490_REG_MAX 255
diff --git a/zephyr/emul/emul_rtc.c b/zephyr/emul/emul_rtc.c
index 845f0e8d78..0bd2ef0828 100644
--- a/zephyr/emul/emul_rtc.c
+++ b/zephyr/emul/emul_rtc.c
@@ -5,18 +5,18 @@
/* This is not a chip emulator, it's a fake driver. */
-#include "drivers/cros_rtc.h"
-#include "ec_commands.h"
-#include "flash.h"
+#define DT_DRV_COMPAT cros_ec_rtc_emul
+
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_rtc);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
-#include <zephyr/logging/log.h>
+#include <ec_commands.h>
+#include <drivers/cros_rtc.h>
#include <zephyr/sys/__assert.h>
-#define DT_DRV_COMPAT cros_ec_rtc_emul
-
-LOG_MODULE_REGISTER(emul_rtc);
+#include "flash.h"
struct cros_rtc_emul_data {
const struct device *rtc_dev;
diff --git a/zephyr/emul/emul_smart_battery.c b/zephyr/emul/emul_smart_battery.c
index acada754d7..3f79ec2019 100644
--- a/zephyr/emul/emul_smart_battery.c
+++ b/zephyr/emul/emul_smart_battery.c
@@ -3,23 +3,24 @@
* found in the LICENSE file.
*/
-#include "battery_smart.h"
-#include "crc8.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_smart_battery.h"
-#include "emul/emul_stub_device.h"
+#define DT_DRV_COMPAT zephyr_smart_battery
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(smart_battery);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT zephyr_smart_battery_emul
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_smart_battery.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(smart_battery);
+#include "crc8.h"
+#include "battery_smart.h"
+#include "emul/emul_stub_device.h"
/** Run-time data used by the emulator */
struct sbat_emul_data {
@@ -787,10 +788,8 @@ static int sbat_emul_access_reg(const struct emul *emul, int reg, int bytes,
static int sbat_emul_init(const struct emul *emul, const struct device *parent)
{
struct sbat_emul_data *data = emul->data;
- const struct i2c_common_emul_cfg *cfg = emul->cfg;
data->common.i2c = parent;
- data->common.cfg = cfg;
i2c_common_emul_init(&data->common);
@@ -902,14 +901,14 @@ static void emul_smart_battery_reset_capacity(const struct emul *emul)
}
#define SBAT_EMUL_RESET_RULE_AFTER(n) \
- emul_smart_battery_reset_capacity(EMUL_DT_GET(DT_DRV_INST(n)));
+ emul_smart_battery_reset_capacity(EMUL_DT_GET(DT_DRV_INST(n)))
static void emul_sbat_reset(const struct ztest_unit_test *test, void *data)
{
ARG_UNUSED(test);
ARG_UNUSED(data);
- DT_INST_FOREACH_STATUS_OKAY(SBAT_EMUL_RESET_RULE_AFTER)
+ DT_INST_FOREACH_STATUS_OKAY(SBAT_EMUL_RESET_RULE_AFTER);
}
ZTEST_RULE(emul_smart_battery_reset, NULL, emul_sbat_reset);
diff --git a/zephyr/emul/emul_sn5s330.c b/zephyr/emul/emul_sn5s330.c
index 96342abf70..6a520ed195 100644
--- a/zephyr/emul/emul_sn5s330.c
+++ b/zephyr/emul/emul_sn5s330.c
@@ -3,26 +3,25 @@
* found in the LICENSE file.
*/
-#include "driver/ppc/sn5s330.h"
-#include "driver/ppc/sn5s330_public.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_sn5s330.h"
-#include "emul/emul_stub_device.h"
-#include "i2c.h"
-
-#include <errno.h>
+#define DT_DRV_COMPAT cros_sn5s330_emul
#include <zephyr/device.h>
-#include <zephyr/devicetree/gpio.h>
-#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
+#include <zephyr/drivers/emul.h>
+#include <errno.h>
#include <zephyr/sys/__assert.h>
+#include <zephyr/devicetree/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
-#define DT_DRV_COMPAT cros_sn5s330_emul
+#include "driver/ppc/sn5s330.h"
+#include "driver/ppc/sn5s330_public.h"
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_sn5s330.h"
+#include "i2c.h"
+#include "emul/emul_stub_device.h"
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(sn5s330_emul, CONFIG_SN5S330_EMUL_LOG_LEVEL);
struct sn5s330_emul_data {
diff --git a/zephyr/emul/emul_syv682x.c b/zephyr/emul/emul_syv682x.c
index 68c1a84e15..8fb4bfc928 100644
--- a/zephyr/emul/emul_syv682x.c
+++ b/zephyr/emul/emul_syv682x.c
@@ -3,26 +3,25 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
-#include "emul/emul_syv682x.h"
-
-#include <stdint.h>
-#include <string.h>
+#define DT_DRV_COMPAT zephyr_syv682x_emul
#include <zephyr/device.h>
#include <zephyr/devicetree/gpio.h>
-#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(syv682x);
+#include <stdint.h>
+#include <string.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT zephyr_syv682x_emul
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_syv682x.h"
+#include "emul/emul_stub_device.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(syv682x);
#define EMUL_REG_COUNT (SYV682X_CONTROL_4_REG + 1)
#define EMUL_REG_IS_VALID(reg) (reg >= 0 && reg < EMUL_REG_COUNT)
diff --git a/zephyr/emul/emul_tcs3400.c b/zephyr/emul/emul_tcs3400.c
index 0266fe2998..e87deebc35 100644
--- a/zephyr/emul/emul_tcs3400.c
+++ b/zephyr/emul/emul_tcs3400.c
@@ -3,22 +3,23 @@
* found in the LICENSE file.
*/
-#include "driver/als_tcs3400.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
-#include "emul/emul_tcs3400.h"
+#define DT_DRV_COMPAT zephyr_tcs3400
+
+#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(emul_tcs);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT zephyr_tcs3400_emul
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_tcs3400.h"
+#include "emul/emul_stub_device.h"
-#define LOG_LEVEL CONFIG_I2C_LOG_LEVEL
-LOG_MODULE_REGISTER(emul_tcs);
+#include "driver/als_tcs3400.h"
/** Run-time data used by the emulator */
struct tcs_emul_data {
diff --git a/zephyr/emul/emul_tusb1064.c b/zephyr/emul/emul_tusb1064.c
index 866493bc32..4396cc5fc5 100644
--- a/zephyr/emul/emul_tusb1064.c
+++ b/zephyr/emul/emul_tusb1064.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+
#include "driver/usb_mux/tusb1064.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_stub_device.h"
#include "util.h"
-#include <zephyr/device.h>
-
#define DT_DRV_COMPAT zephyr_tusb1064_emul
#define TUSB1064_REG_MAX 255
diff --git a/zephyr/emul/i2c_mock.c b/zephyr/emul/i2c_mock.c
index c906e76c13..8601c87ee7 100644
--- a/zephyr/emul/i2c_mock.c
+++ b/zephyr/emul/i2c_mock.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
+#define DT_DRV_COMPAT cros_i2c_mock
#include <zephyr/device.h>
#include <zephyr/logging/log.h>
-#define DT_DRV_COMPAT cros_i2c_mock
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_stub_device.h"
LOG_MODULE_REGISTER(i2c_mock, CONFIG_I2C_MOCK_LOG_LEVEL);
diff --git a/zephyr/emul/pwm_mock.c b/zephyr/emul/pwm_mock.c
index 26f7891cb8..0d32155d8f 100644
--- a/zephyr/emul/pwm_mock.c
+++ b/zephyr/emul/pwm_mock.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "pwm_mock.h"
+#define DT_DRV_COMPAT cros_pwm_mock
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
-#include <zephyr/drivers/pwm.h>
#include <zephyr/kernel.h>
+#include <zephyr/drivers/pwm.h>
-#define DT_DRV_COMPAT cros_pwm_mock
+#include "pwm_mock.h"
#define CYCLES_PER_SEC 1000000
diff --git a/zephyr/emul/tcpc/CMakeLists.txt b/zephyr/emul/tcpc/CMakeLists.txt
index 25031ad658..8c011229f2 100644
--- a/zephyr/emul/tcpc/CMakeLists.txt
+++ b/zephyr/emul/tcpc/CMakeLists.txt
@@ -10,5 +10,4 @@ zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_DRP emul_tcpci_partner_dr
zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_SNK emul_tcpci_partner_snk.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_SRC emul_tcpci_partner_src.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_FAULTY_EXT emul_tcpci_partner_faulty_ext.c)
-zephyr_library_sources_ifdef(CONFIG_EMUL_TCPCI_PARTNER_VPD emul_tcpci_partner_vpd.c)
zephyr_library_sources_ifdef(CONFIG_EMUL_ANX7447 emul_anx7447.c)
diff --git a/zephyr/emul/tcpc/Kconfig b/zephyr/emul/tcpc/Kconfig
index 147f267113..03b432f0a6 100644
--- a/zephyr/emul/tcpc/Kconfig
+++ b/zephyr/emul/tcpc/Kconfig
@@ -4,8 +4,6 @@
menuconfig EMUL_TCPCI
bool "TCPCI common functionality"
- default y
- depends on DT_HAS_CROS_TCPCI_GENERIC_EMUL_ENABLED
depends on I2C_EMUL
help
Enable the TCPCI emulator. This driver uses the emulated I2C bus.
@@ -23,8 +21,6 @@ source "subsys/logging/Kconfig.template.log_config"
config EMUL_ANX7447
bool "Analogix ANX7447 emulator"
- default y
- depends on DT_HAS_CROS_ANX7447_TCPC_EMUL_ENABLED
help
Enable emulator for ANX7447 of TCPM. This emulator is extension for
TCPCI emulator. ANX7447 specific API is available in
@@ -40,8 +36,6 @@ config EMUL_TCPCI_PARTNER_COMMON
config EMUL_PS8XXX
bool "Parade PS8XXX emulator"
- default y
- depends on DT_HAS_CROS_PS8XXX_EMUL_ENABLED
help
Enable emulator for PS8XXX family of TCPC. This emulator is extenstion
for TCPCI emulator. PS8XXX specific API is available in
@@ -82,14 +76,4 @@ config EMUL_TCPCI_PARTNER_FAULTY_EXT
to TCPCI emulator. API of malfunctioning device emulator is
available in zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h
-config EMUL_TCPCI_PARTNER_VPD
- bool "USB-C VCONN-powered device emulator"
- select EMUL_TCPCI_PARTNER_COMMON
- # select EMUL_TCPCI_PARTNER_SRC
- help
- Enable USB-C VCONN-powered device (VPD) emulator, which may be
- attached to TCPCI emulator. API of VPD is available in
- zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h. This emulation is
- specifically for the host port side of the VPD.
-
endif # EMUL_TCPCI
diff --git a/zephyr/emul/tcpc/emul_anx7447.c b/zephyr/emul/tcpc/emul_anx7447.c
index fb15e2eb4e..6a351a4182 100644
--- a/zephyr/emul/tcpc/emul_anx7447.c
+++ b/zephyr/emul/tcpc/emul_anx7447.c
@@ -3,21 +3,22 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "tcpm/tcpci.h"
+#define DT_DRV_COMPAT cros_anx7447_emul
+
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(anx7447_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT cros_anx7447_tcpc_emul
+#include "tcpm/tcpci.h"
+#include "emul/emul_stub_device.h"
-LOG_MODULE_REGISTER(anx7447_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+#include "emul/emul_common_i2c.h"
+#include "emul/tcpc/emul_tcpci.h"
/**
* @brief Function called for each byte of read message from anx7447 emulator
diff --git a/zephyr/emul/tcpc/emul_ps8xxx.c b/zephyr/emul/tcpc/emul_ps8xxx.c
index 90b9ce7af3..57cc2c85f5 100644
--- a/zephyr/emul/tcpc/emul_ps8xxx.c
+++ b/zephyr/emul/tcpc/emul_ps8xxx.c
@@ -3,24 +3,27 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/ps8xxx.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
-#include "emul/tcpc/emul_ps8xxx.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "tcpm/tcpci.h"
+#define DT_DRV_COMPAT cros_ps8xxx_emul
+
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(ps8xxx_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT cros_ps8xxx_emul
-#define PS8XXX_REG_MUX_IN_HPD_ASSERTION MUX_IN_HPD_ASSERTION_REG
+#include "tcpm/tcpci.h"
-LOG_MODULE_REGISTER(ps8xxx_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+#include "emul/emul_common_i2c.h"
+#include "emul/tcpc/emul_ps8xxx.h"
+#include "emul/tcpc/emul_tcpci.h"
+#include "emul/emul_stub_device.h"
+
+#include "driver/tcpm/ps8xxx.h"
+
+#define PS8XXX_REG_MUX_IN_HPD_ASSERTION MUX_IN_HPD_ASSERTION_REG
/** Run-time data used by the emulator */
struct ps8xxx_emul_data {
diff --git a/zephyr/emul/tcpc/emul_tcpci.c b/zephyr/emul/tcpc/emul_tcpci.c
index e5dcf78bdc..aa4e508489 100644
--- a/zephyr/emul/tcpc/emul_tcpci.c
+++ b/zephyr/emul/tcpc/emul_tcpci.c
@@ -3,20 +3,21 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "tcpm/tcpci.h"
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/ztest.h>
-LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+#include "tcpm/tcpci.h"
+
+#include "emul/emul_common_i2c.h"
+#include "emul/tcpc/emul_tcpci.h"
/**
* @brief Returns number of bytes in specific register
diff --git a/zephyr/emul/tcpc/emul_tcpci_generic.c b/zephyr/emul/tcpc/emul_tcpci_generic.c
index 01fae7c978..204e040ede 100644
--- a/zephyr/emul/tcpc/emul_tcpci_generic.c
+++ b/zephyr/emul/tcpc/emul_tcpci_generic.c
@@ -3,21 +3,22 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_stub_device.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "tcpm/tcpci.h"
+#define DT_DRV_COMPAT cros_tcpci_generic_emul
+
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_generic_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/device.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/logging/log.h>
#include <zephyr/ztest.h>
-#define DT_DRV_COMPAT cros_tcpci_generic_emul
+#include "tcpm/tcpci.h"
+#include "emul/emul_stub_device.h"
-LOG_MODULE_REGISTER(tcpci_generic_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+#include "emul/emul_common_i2c.h"
+#include "emul/tcpc/emul_tcpci.h"
/**
* @brief Function called for each byte of read message from TCPCI emulator
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_common.c b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
index 0473f967dc..22a9ddb91e 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_common.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
@@ -3,21 +3,19 @@
* found in the LICENSE file.
*/
-#include "common.h"
-#include "driver/tcpm/tcpci.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "emul/tcpc/emul_tcpci_partner_common.h"
-#include "usb_pd.h"
-#include "util.h"
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_partner, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <stdlib.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
#include <zephyr/sys/byteorder.h>
+#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
-LOG_MODULE_REGISTER(tcpci_partner, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+#include "common.h"
+#include "emul/tcpc/emul_tcpci_partner_common.h"
+#include "emul/tcpc/emul_tcpci.h"
+#include "usb_pd.h"
+#include "util.h"
/** Length of PDO, RDO and BIST request object in SOP message in bytes */
#define TCPCI_MSG_DO_LEN 4
@@ -406,21 +404,11 @@ int tcpci_partner_send_control_msg(struct tcpci_partner_data *data,
msg->type = type;
- switch (msg->type) {
- case PD_CTRL_DR_SWAP:
- case PD_CTRL_VCONN_SWAP:
- /* For supported message types, remember the control request
- * initiated, so the partner can handle the responses.
- * (Eventually, all messages that can start an AMS should be
- * supported.)
+ if (msg->type == PD_CTRL_DR_SWAP) {
+ /* Remember the control request initiated, so we can
+ * handle the responses
*/
tcpci_partner_common_set_ams_ctrl_msg(data, msg->type);
- break;
- default:
- /* For messages that do not start an AMS, there is nothing to
- * record.
- */
- break;
}
return tcpci_partner_send_msg(data, msg, delay);
@@ -759,27 +747,6 @@ tcpci_partner_common_vdm_handler(struct tcpci_partner_data *data,
}
static enum tcpci_partner_handler_res
-tcpci_partner_enter_usb_handler(struct tcpci_partner_data *data,
- const struct tcpci_emul_msg *message)
-{
- /*
- * Validate received Enter_USB message against EUDO contents in
- * tcpci_partner_data.
- *
- * TODO(b/260095516): This support needs to be expanded to validate the
- * message contents, in a bit field basis. Currently, using this field
- * as simple ACCEPT/REJECT criteria. If this value is 0 (default case),
- * then ACCEPT this message, else reject it.
- */
- if (data->enter_usb_accept)
- tcpci_partner_send_control_msg(data, PD_CTRL_ACCEPT, 0);
- else
- tcpci_partner_send_control_msg(data, PD_CTRL_REJECT, 0);
-
- return TCPCI_PARTNER_COMMON_MSG_HANDLED;
-}
-
-static enum tcpci_partner_handler_res
tcpci_partner_common_cable_handler(struct tcpci_partner_data *data,
const struct tcpci_emul_msg *message,
enum tcpci_msg_type sop_type)
@@ -974,26 +941,6 @@ tcpci_partner_common_accept_dr_swap_handler(struct tcpci_partner_data *data)
}
static enum tcpci_partner_handler_res
-tcpci_partner_common_accept_vconn_swap_handler(struct tcpci_partner_data *data)
-{
- if (data->vconn_role == PD_ROLE_VCONN_SRC) {
- /* TODO: Wait for PS_RDY. */
- } else {
- /* VCONN Swap from off to VCONN Source means the partner sends
- * the first PS_RDY after turning on VCONN.
- */
- tcpci_partner_common_set_vconn(data, PD_ROLE_VCONN_ON);
- tcpci_partner_send_control_msg(data, PD_CTRL_PS_RDY, 15);
- tcpci_partner_common_clear_ams_ctrl_msg(data);
- /* Strictly speaking, the AMS isn't over until the partner
- * receives GoodCRC for the PS_RDY.
- */
- }
-
- return TCPCI_PARTNER_COMMON_MSG_HANDLED;
-}
-
-static enum tcpci_partner_handler_res
tcpi_drp_emul_ps_rdy_handler(struct tcpci_partner_data *data)
{
switch (data->cur_ams_ctrl_req) {
@@ -1011,25 +958,8 @@ static enum tcpci_partner_handler_res
tcpi_partner_common_handle_accept(struct tcpci_partner_data *data)
{
switch (data->cur_ams_ctrl_req) {
- case PD_CTRL_VCONN_SWAP:
- data->cur_ams_ctrl_req = PD_CTRL_INVALID;
- return TCPCI_PARTNER_COMMON_MSG_HANDLED;
-
- default:
- LOG_ERR("Unhandled current_req=%u in ACCEPT",
- data->cur_ams_ctrl_req);
- return TCPCI_PARTNER_COMMON_MSG_NOT_HANDLED;
- }
-}
-
-static enum tcpci_partner_handler_res
-tcpci_partner_common_handle_reject(struct tcpci_partner_data *data)
-{
- switch (data->cur_ams_ctrl_req) {
case PD_CTRL_DR_SWAP:
return tcpci_partner_common_accept_dr_swap_handler(data);
- case PD_CTRL_VCONN_SWAP:
- return tcpci_partner_common_accept_vconn_swap_handler(data);
default:
LOG_ERR("Unhandled current_req=%u in ACCEPT",
@@ -1102,8 +1032,6 @@ tcpci_partner_common_sop_msg_handler(struct tcpci_partner_data *data,
switch (PD_HEADER_TYPE(header)) {
case PD_DATA_VENDOR_DEF:
return tcpci_partner_common_vdm_handler(data, tx_msg);
- case PD_DATA_ENTER_USB:
- return tcpci_partner_enter_usb_handler(data, tx_msg);
default:
/* No other common handlers for data messages */
return TCPCI_PARTNER_COMMON_MSG_NOT_HANDLED;
@@ -1144,10 +1072,6 @@ tcpci_partner_common_sop_msg_handler(struct tcpci_partner_data *data,
tcpci_partner_common_send_hard_reset(data);
return TCPCI_PARTNER_COMMON_MSG_HARD_RESET;
- } else if (data->cur_ams_ctrl_req != PD_CTRL_INVALID) {
- if (tcpci_partner_common_handle_reject(data) ==
- TCPCI_PARTNER_COMMON_MSG_HANDLED)
- return TCPCI_PARTNER_COMMON_MSG_HANDLED;
}
tcpci_partner_common_clear_ams_ctrl_msg(data);
@@ -1183,18 +1107,6 @@ tcpci_partner_common_sop_msg_handler(struct tcpci_partner_data *data,
tcpci_partner_common_send_soft_reset(data);
return TCPCI_PARTNER_COMMON_MSG_HANDLED;
- case PD_CTRL_DATA_RESET:
- /*
- * Send Accept/Reject message
- * TODO(b/260095516): To fully exercise this code path, there
- * needs to be a mechanism (trigger) to either accept or reject
- * this message.
- */
- tcpci_partner_send_control_msg(data, PD_CTRL_ACCEPT, 0);
- return TCPCI_PARTNER_COMMON_MSG_HANDLED;
- case PD_CTRL_DATA_RESET_COMPLETE:
- /* There is no expected reply message from the port parter */
- return TCPCI_PARTNER_COMMON_MSG_HANDLED;
}
return TCPCI_PARTNER_COMMON_MSG_NOT_HANDLED;
@@ -1229,16 +1141,6 @@ void tcpci_partner_set_discovery_info(struct tcpci_partner_data *data,
memcpy(data->modes_vdm, modes_vdm, modes_vdos * sizeof(*modes_vdm));
}
-static void tcpci_partner_common_control_change(struct tcpci_partner_data *data)
-{
- const struct emul *tcpci_emul = data->tcpci_emul;
- uint16_t role_control;
-
- tcpci_emul_get_reg(tcpci_emul, TCPC_REG_ROLE_CTRL, &role_control);
- data->tcpm_cc1 = TCPC_REG_ROLE_CTRL_CC1(role_control);
- data->tcpm_cc1 = TCPC_REG_ROLE_CTRL_CC2(role_control);
-}
-
void tcpci_partner_common_disconnect(struct tcpci_partner_data *data)
{
tcpci_partner_clear_msg_queue(data);
@@ -1414,6 +1316,7 @@ void tcpci_partner_received_msg_status(struct tcpci_partner_data *data,
if (data->received_msg_status == NULL) {
return;
}
+
/*
* Status of each received message should be reported to TCPCI emulator
* only once
@@ -1537,22 +1440,6 @@ tcpci_partner_rx_consumed_op(const struct emul *emul,
tcpci_partner_free_msg(msg);
}
-static void
-tcpci_partner_control_change_op(const struct emul *emul,
- const struct tcpci_emul_partner_ops *ops)
-{
- struct tcpci_partner_data *data =
- CONTAINER_OF(ops, struct tcpci_partner_data, ops);
- struct tcpci_partner_extension *ext;
-
- tcpci_partner_common_control_change(data);
- for (ext = data->extensions; ext != NULL; ext = ext->next) {
- if (ext->ops->control_change) {
- ext->ops->control_change(ext, data);
- }
- }
-}
-
/**
* @brief Function called when emulator is disconnected from TCPCI
*
@@ -1634,7 +1521,6 @@ void tcpci_partner_init(struct tcpci_partner_data *data, enum pd_rev_type rev)
data->identity_vdos = 0;
data->svids_vdos = 0;
data->modes_vdos = 0;
- data->enter_usb_accept = false;
tcpci_partner_common_clear_ams_ctrl_msg(data);
@@ -1645,7 +1531,7 @@ void tcpci_partner_init(struct tcpci_partner_data *data, enum pd_rev_type rev)
data->ops.transmit = tcpci_partner_transmit_op;
data->ops.rx_consumed = tcpci_partner_rx_consumed_op;
- data->ops.control_change = tcpci_partner_control_change_op;
+ data->ops.control_change = NULL;
data->ops.disconnect = tcpci_partner_disconnect_op;
data->displayport_configured = false;
data->entered_svid = 0;
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_drp.c b/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
index 45fa21d972..277957282d 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
@@ -3,6 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_drp_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/kernel.h>
+
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
@@ -12,12 +18,6 @@
#include "tcpm/tcpci.h"
#include "usb_pd.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/byteorder.h>
-
-LOG_MODULE_REGISTER(tcpci_drp_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
/**
* @brief Handle SOP messages as TCPCI dual role device
*
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c b/zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c
index f2920ba20c..fc4cd06b82 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_faulty_ext, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/kernel.h>
+
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "emul/tcpc/emul_tcpci_partner_faulty_ext.h"
#include "usb_pd.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/byteorder.h>
-
-LOG_MODULE_REGISTER(tcpci_faulty_ext, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
/**
* @brief Reduce number of times to repeat action. If count reaches zero, action
* is removed from queue.
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_snk.c b/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
index d14012af41..8d0fe1fa1e 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_snk_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/kernel.h>
+
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "usb_pd.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/byteorder.h>
-
-LOG_MODULE_REGISTER(tcpci_snk_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
/** Length of PDO, RDO and BIST request object in SOP message in bytes */
#define TCPCI_MSG_DO_LEN 4
/** Length of header in SOP message in bytes */
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_src.c b/zephyr/emul/tcpc/emul_tcpci_partner_src.c
index 7f4245fa6f..c81d69c25f 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_src.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_src.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+LOG_MODULE_REGISTER(tcpci_src_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/kernel.h>
+
#include "common.h"
-#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "usb_pd.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/byteorder.h>
-
-LOG_MODULE_REGISTER(tcpci_src_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
/**
* @brief Start source capability timer. Capability message will be send after
* @p time.
diff --git a/zephyr/emul/tcpc/emul_tcpci_partner_vpd.c b/zephyr/emul/tcpc/emul_tcpci_partner_vpd.c
deleted file mode 100644
index f01227e913..0000000000
--- a/zephyr/emul/tcpc/emul_tcpci_partner_vpd.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "driver/tcpm/tcpci.h"
-#include "emul/tcpc/emul_tcpci_partner_common.h"
-#include "emul/tcpc/emul_tcpci_partner_faulty_ext.h"
-#include "emul/tcpc/emul_tcpci_partner_snk.h"
-#include "emul/tcpc/emul_tcpci_partner_src.h"
-#include "emul/tcpc/emul_tcpci_partner_vpd.h"
-
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/byteorder.h>
-
-LOG_MODULE_REGISTER(tcpci_vpd_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
-static enum tcpci_partner_handler_res
-tcpci_vpd_emul_handle_sop_msg(struct tcpci_partner_extension *ext,
- struct tcpci_partner_data *common_data,
- const struct tcpci_emul_msg *msg)
-{
- struct tcpci_vpd_emul_data *data =
- CONTAINER_OF(ext, struct tcpci_vpd_emul_data, ext);
-
- /* Do not respond to SOP messages until charge-through is connected. */
- if (!data->charge_through_connected)
- return TCPCI_PARTNER_COMMON_MSG_NO_GOODCRC;
-
- /* Once charge-through is connected, let the charger (later extension)
- * handle SOP messages.
- */
- return TCPCI_PARTNER_COMMON_MSG_NOT_HANDLED;
-}
-
-static int tcpci_vpd_emul_connect(struct tcpci_partner_extension *ext,
- struct tcpci_partner_data *common_data)
-{
- struct tcpci_vpd_emul_data *data =
- CONTAINER_OF(ext, struct tcpci_vpd_emul_data, ext);
-
- /* Strictly speaking, the VPD shouldn't GoodCRC anything on SOP, Source
- * Capabilities is the first message it will receive, so that's good
- * enough.
- */
- if (common_data->power_role == PD_ROLE_SOURCE) {
- tcpci_faulty_ext_clear_actions_list(&data->fault_ext);
- } else {
- data->fault_actions[0].action_mask =
- TCPCI_FAULTY_EXT_FAIL_SRC_CAP;
- data->fault_actions[0].count = TCPCI_FAULTY_EXT_INFINITE_ACTION;
- tcpci_faulty_ext_append_action(&data->fault_ext,
- &data->fault_actions[0]);
- }
-
- return 0;
-}
-
-static void
-tcpci_vpd_emul_control_change(struct tcpci_partner_extension *ext,
- struct tcpci_partner_data *common_data)
-{
- struct tcpci_vpd_emul_data *data =
- CONTAINER_OF(ext, struct tcpci_vpd_emul_data, ext);
- enum pd_cc_states tcpm_cc_state =
- pd_get_cc_state(common_data->tcpm_cc1, common_data->tcpm_cc2);
-
- LOG_DBG("TCPM changed control register; TCPM CC1 %u, CC2 %u",
- common_data->tcpm_cc1, common_data->tcpm_cc2);
- if (!data->charge_through_connected &&
- tcpm_cc_state == PD_CC_UFP_ATTACHED) {
- LOG_INF("Connecting charge-through port as Source");
- data->charge_through_connected = true;
- tcpci_partner_common_hard_reset_as_role(common_data,
- PD_ROLE_SOURCE);
- tcpci_partner_connect_to_tcpci(common_data,
- common_data->tcpci_emul);
- }
-}
-
-void tcpci_vpd_emul_disconnect(struct tcpci_partner_extension *ext,
- struct tcpci_partner_data *common_data)
-{
- struct tcpci_vpd_emul_data *data =
- CONTAINER_OF(ext, struct tcpci_vpd_emul_data, ext);
-
- data->charge_through_connected = false;
- tcpci_partner_common_hard_reset_as_role(common_data, PD_ROLE_SINK);
-}
-
-static struct tcpci_partner_extension_ops vpd_emul_ops = {
- .sop_msg_handler = tcpci_vpd_emul_handle_sop_msg,
- .connect = tcpci_vpd_emul_connect,
- .control_change = tcpci_vpd_emul_control_change,
- .disconnect = tcpci_vpd_emul_disconnect,
-};
-
-struct tcpci_partner_extension *
-tcpci_vpd_emul_init(struct tcpci_vpd_emul_data *data,
- struct tcpci_partner_data *common_data,
- struct tcpci_partner_extension *ext)
-{
- struct tcpci_partner_extension *vpd_ext = &data->ext;
- struct tcpci_partner_extension *snk_ext;
- struct tcpci_partner_extension *src_ext;
-
- /* A VPD host port initially attaches as a Sink and responds to SOP'
- * Discover Identity while ignoring SOP traffic. Then, when a Source is
- * connected to the charge-through port, the CT-VPD acts as a Source.
- * This extension therefore contains a faulty extension, a sink
- * extension, and a source extension, in that order. Due to the
- * linked-list extension structure, the initialization order is the
- * reverse of that.
- */
- src_ext = tcpci_src_emul_init(&data->src_ext, common_data, ext);
- snk_ext = tcpci_snk_emul_init(&data->snk_ext, common_data, src_ext);
- vpd_ext->next =
- tcpci_faulty_ext_init(&data->fault_ext, common_data, snk_ext);
-
- vpd_ext->ops = &vpd_emul_ops;
-
- data->charge_through_connected = false;
-
- return vpd_ext;
-}
diff --git a/zephyr/fake/include/system_fake.h b/zephyr/fake/include/system_fake.h
index 805e3ae44b..b80624e289 100644
--- a/zephyr/fake/include/system_fake.h
+++ b/zephyr/fake/include/system_fake.h
@@ -6,10 +6,10 @@
#ifndef ZEPHYR_FAKE_SYSTEM_FAKE_H
#define ZEPHYR_FAKE_SYSTEM_FAKE_H
-#include "ec_commands.h"
-
#include <setjmp.h>
+#include "ec_commands.h"
+
/**
* @brief Set the current image copy.
*/
diff --git a/zephyr/fake/system_fake.c b/zephyr/fake/system_fake.c
index 402559a885..75beb62b23 100644
--- a/zephyr/fake/system_fake.c
+++ b/zephyr/fake/system_fake.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <setjmp.h>
+
#include "system.h"
#include "system_fake.h"
-#include <setjmp.h>
-
static enum ec_image shrspi_image_copy = EC_IMAGE_RO;
/* setjmp environment to use for reboot (NULL if none) */
diff --git a/zephyr/firmware_builder.py b/zephyr/firmware_builder.py
index edcbfc58ef..545d31312d 100755
--- a/zephyr/firmware_builder.py
+++ b/zephyr/firmware_builder.py
@@ -24,44 +24,28 @@ DEFAULT_BUNDLE_DIRECTORY = "/tmp/artifact_bundles"
DEFAULT_BUNDLE_METADATA_FILE = "/tmp/artifact_bundle_metadata"
# Boards that we want to track the coverage of our own files specifically.
-SPECIAL_BOARDS = ["herobrine", "krabby", "nivviks", "skyrim", "kingler", "rex"]
+SPECIAL_BOARDS = ["herobrine", "krabby", "nivviks", "skyrim", "kingler"]
-def log_cmd(cmd, env=None):
+def log_cmd(cmd):
"""Log subprocess command."""
- if env is not None:
- print("env", end=" ")
- [ # pylint:disable=expression-not-assigned
- print(key + "=" + shlex.quote(str(value)), end=" ")
- for key, value in env.items()
- ]
print(" ".join(shlex.quote(str(x)) for x in cmd))
sys.stdout.flush()
-def run_twister(
- platform_ec, code_coverage=False, extra_args=None, use_gcc=False
-):
- """Build the tests using twister.
-
- Returns the path to the twister-out dir.
- """
-
- if use_gcc:
- outdir = "twister-out-gcc"
- toolchain = "host"
- else:
- outdir = "twister-out-llvm"
- toolchain = "llvm"
+def run_twister(platform_ec, code_coverage=False, extra_args=None):
+ """Build the tests using twister."""
cmd = [
platform_ec / "twister",
"--outdir",
- platform_ec / outdir,
+ platform_ec / "twister-out",
"-v",
"-i",
+ "-p",
+ "native_posix",
+ "-p",
+ "unit_testing",
"--no-upload-cros-rdb",
- "--toolchain",
- toolchain,
]
if extra_args:
@@ -76,14 +60,7 @@ def run_twister(
]
)
log_cmd(cmd)
-
- subprocess.run(
- cmd,
- check=True,
- cwd=platform_ec,
- stdin=subprocess.DEVNULL,
- )
- return platform_ec / outdir
+ subprocess.run(cmd, check=True, cwd=platform_ec, stdin=subprocess.DEVNULL)
def build(opts):
@@ -99,11 +76,6 @@ def build(opts):
stdin=subprocess.DEVNULL,
)
- # Start with a clean build environment
- cmd = ["make", "clobber"]
- log_cmd(cmd)
- subprocess.run(cmd, cwd=platform_ec, check=True, stdin=subprocess.DEVNULL)
-
cmd = ["zmake", "-D", "build", "-a"]
if opts.code_coverage:
cmd.append("--coverage")
@@ -271,10 +243,7 @@ def test(opts):
# Twister-based tests
platform_ec = zephyr_dir.parent
third_party = platform_ec.parent.parent / "third_party"
- twister_out_dir = run_twister(platform_ec, opts.code_coverage)
- twister_out_dir_gcc = run_twister(
- platform_ec, opts.code_coverage, use_gcc=True
- )
+ run_twister(platform_ec, opts.code_coverage)
if opts.code_coverage:
build_dir = platform_ec / "build" / "zephyr"
@@ -283,7 +252,7 @@ def test(opts):
[
"/usr/bin/lcov",
"--summary",
- twister_out_dir / "coverage.info",
+ platform_ec / "twister-out" / "coverage.info",
],
cwd=zephyr_dir,
check=True,
@@ -293,20 +262,6 @@ def test(opts):
).stdout
_extract_lcov_summary("EC_ZEPHYR_TESTS", metrics, output)
- output = subprocess.run(
- [
- "/usr/bin/lcov",
- "--summary",
- twister_out_dir_gcc / "coverage.info",
- ],
- cwd=zephyr_dir,
- check=True,
- stdout=subprocess.PIPE,
- universal_newlines=True,
- stdin=subprocess.DEVNULL,
- ).stdout
- _extract_lcov_summary("EC_ZEPHYR_TESTS_GCC", metrics, output)
-
cmd = ["make", "test-coverage", f"-j{opts.cpus}"]
log_cmd(cmd)
subprocess.run(
@@ -336,9 +291,7 @@ def test(opts):
"-a",
platform_ec / "build/coverage/lcov.info",
"-a",
- twister_out_dir / "coverage.info",
- "-a",
- twister_out_dir_gcc / "coverage.info",
+ platform_ec / "twister-out" / "coverage.info",
]
log_cmd(cmd)
output = subprocess.run(
@@ -390,7 +343,6 @@ def test(opts):
zephyr_dir / "emul/**",
zephyr_dir / "mock/**",
third_party / "zephyr/main/subsys/emul/**",
- third_party / "zephyr/main/arch/posix/**",
# Exclude all files ending in _test.[ch] or _emul.[ch]
"**/*_test.c",
"**/*_test.h",
@@ -518,7 +470,7 @@ def test(opts):
# These are questionable, but they are essentially untestable
zephyr_dir / "drivers/**",
zephyr_dir / "include/drivers/**",
- zephyr_dir / "program/**",
+ zephyr_dir / "projects/**",
zephyr_dir / "shim/chip/**",
zephyr_dir / "shim/chip/npcx/npcx_monitor/**",
zephyr_dir / "shim/core/**",
diff --git a/zephyr/include/drivers/cros_flash.h b/zephyr/include/drivers/cros_flash.h
index d7078cfb83..267649476b 100644
--- a/zephyr/include/drivers/cros_flash.h
+++ b/zephyr/include/drivers/cros_flash.h
@@ -16,8 +16,8 @@
#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_FLASH_H_
#define ZEPHYR_INCLUDE_DRIVERS_CROS_FLASH_H_
-#include <zephyr/device.h>
#include <zephyr/kernel.h>
+#include <zephyr/device.h>
/**
* @brief CROS Flash Driver APIs
diff --git a/zephyr/include/drivers/cros_kb_raw.h b/zephyr/include/drivers/cros_kb_raw.h
index 7b9255bb9f..d370a3bbde 100644
--- a/zephyr/include/drivers/cros_kb_raw.h
+++ b/zephyr/include/drivers/cros_kb_raw.h
@@ -22,11 +22,11 @@
#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_KB_RAW_H_
#define ZEPHYR_INCLUDE_DRIVERS_CROS_KB_RAW_H_
-#include "gpio_signal.h"
-
+#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
-#include <zephyr/kernel.h>
+
+#include "gpio_signal.h"
/*
* When CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED is enabled, the keyboard
@@ -60,17 +60,11 @@ typedef int (*cros_kb_raw_api_read_rows)(const struct device *dev);
typedef int (*cros_kb_raw_api_enable_interrupt)(const struct device *dev,
int enable);
-typedef int (*cros_kb_raw_api_config_alt)(const struct device *dev,
- bool enable);
-
__subsystem struct cros_kb_raw_driver_api {
cros_kb_raw_api_init init;
cros_kb_raw_api_drive_column drive_colum;
cros_kb_raw_api_read_rows read_rows;
cros_kb_raw_api_enable_interrupt enable_interrupt;
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_FACTORY_TEST
- cros_kb_raw_api_config_alt config_alt;
-#endif
};
/**
@@ -180,36 +174,6 @@ static inline int z_impl_cros_kb_raw_enable_interrupt(const struct device *dev,
}
/**
- * @brief Enable or disable keyboard alternative function.
- *
- * Enabling alternative function.
- *
- * @param dev Pointer to the device structure for the keyboard driver instance.
- * @param enable If 1, enable keyboard function. Otherwise, disable it (as
- * GPIO).
- *
- * @return 0 If successful.
- * @retval -ENOTSUP Not supported api function.
- */
-
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_FACTORY_TEST
-__syscall int cros_kb_raw_config_alt(const struct device *dev, bool enable);
-
-static inline int z_impl_cros_kb_raw_config_alt(const struct device *dev,
- bool enable)
-{
- const struct cros_kb_raw_driver_api *api =
- (const struct cros_kb_raw_driver_api *)dev->api;
-
- if (!api->config_alt) {
- return -ENOTSUP;
- }
-
- return api->config_alt(dev, enable);
-}
-#endif
-
-/**
* @brief Set the logical level of the keyboard column 2 output.
*
* When CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED is enabled, the column 2
diff --git a/zephyr/include/drivers/cros_rtc.h b/zephyr/include/drivers/cros_rtc.h
index 540391aac6..3a0f332b98 100644
--- a/zephyr/include/drivers/cros_rtc.h
+++ b/zephyr/include/drivers/cros_rtc.h
@@ -16,8 +16,8 @@
#ifndef ZEPHYR_INCLUDE_DRIVERS_CROS_RTC_H_
#define ZEPHYR_INCLUDE_DRIVERS_CROS_RTC_H_
-#include <zephyr/device.h>
#include <zephyr/kernel.h>
+#include <zephyr/device.h>
/**
* @brief CROS Real-Time Clock (RTC) Driver APIs
diff --git a/zephyr/include/drivers/cros_shi.h b/zephyr/include/drivers/cros_shi.h
index 2ec2d2233a..3eb3038a45 100644
--- a/zephyr/include/drivers/cros_shi.h
+++ b/zephyr/include/drivers/cros_shi.h
@@ -18,8 +18,8 @@
* @{
*/
-#include <zephyr/device.h>
#include <zephyr/kernel.h>
+#include <zephyr/device.h>
/**
* @cond INTERNAL_HIDDEN
diff --git a/zephyr/include/drivers/cros_system.h b/zephyr/include/drivers/cros_system.h
index c098c2cfcd..5105d97cc9 100644
--- a/zephyr/include/drivers/cros_system.h
+++ b/zephyr/include/drivers/cros_system.h
@@ -18,8 +18,8 @@
* @{
*/
-#include <zephyr/device.h>
#include <zephyr/kernel.h>
+#include <zephyr/device.h>
/**
* @brief system_reset_cause enum
diff --git a/zephyr/include/dt-bindings/native-posix-gpio.h b/zephyr/include/dt-bindings/native-posix-gpio.h
deleted file mode 100644
index c0b8077e3d..0000000000
--- a/zephyr/include/dt-bindings/native-posix-gpio.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#ifndef DT_BINDINGS_NATIVE_POSIX_GPIO_H_
-#define DT_BINDINGS_NATIVE_POSIX_GPIO_H_
-
-/** Used for testing, bits 8-15 for specific SoC flags. */
-#define NATIVE_POSIX_GPIO_VOLTAGE_1P8 (1 << 8)
-
-#endif /* DT_BINDINGS_NATIVE_POSIX_GPIO_H_ */
diff --git a/zephyr/include/emul/emul_isl923x.h b/zephyr/include/emul/emul_isl923x.h
index 7d085658cf..e41cf26f87 100644
--- a/zephyr/include/emul/emul_isl923x.h
+++ b/zephyr/include/emul/emul_isl923x.h
@@ -7,8 +7,8 @@
#define ZEPHYR_INCLUDE_EMUL_EMUL_ISL923X_H_
#include <zephyr/device.h>
-#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c_emul.h>
+#include <zephyr/drivers/emul.h>
/**
* @brief Get the emulator's parent bus device
diff --git a/zephyr/include/emul/emul_kb_raw.h b/zephyr/include/emul/emul_kb_raw.h
index 0598eda7ab..1660ccefd4 100644
--- a/zephyr/include/emul/emul_kb_raw.h
+++ b/zephyr/include/emul/emul_kb_raw.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/include/emul/emul_ln9310.h b/zephyr/include/emul/emul_ln9310.h
index 5d0cab9c20..0c0e61003e 100644
--- a/zephyr/include/emul/emul_ln9310.h
+++ b/zephyr/include/emul/emul_ln9310.h
@@ -12,12 +12,10 @@
#ifndef ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_
#define ZEPHYR_INCLUDE_EMUL_EMUL_LN9310_H_
+#include <zephyr/drivers/emul.h>
#include "driver/ln9310.h"
-
#include <stdbool.h>
-#include <zephyr/drivers/emul.h>
-
/**
* @brief Select the current emulator to use.
*
diff --git a/zephyr/include/emul/emul_pct2075.h b/zephyr/include/emul/emul_pct2075.h
deleted file mode 100644
index f9e1ef60b2..0000000000
--- a/zephyr/include/emul/emul_pct2075.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef EMUL_PCT2075_H
-#define EMUL_PCT2075_H
-
-#include "emul/emul_common_i2c.h"
-
-#include <zephyr/drivers/emul.h>
-
-#define PCT2075_REG_NUMBER 5
-
-struct pct2075_data {
- struct i2c_common_emul_data common;
- uint16_t regs[PCT2075_REG_NUMBER];
-};
-
-/**
- * @brief Set the temperature measurement for the sensor.
- *
- * @param emul Pointer to emulator
- * @param mk Temperature to set in mili-kalvin. The temperature
- * should me in range of 328150 to 400150, with 150 resolution.
- *
- * @return 0 on success
- * @return negative on error
- */
-int pct2075_emul_set_temp(const struct emul *emul, int mk);
-
-#endif
diff --git a/zephyr/include/emul/emul_power_signals.h b/zephyr/include/emul/emul_power_signals.h
deleted file mode 100644
index 7dea6079f0..0000000000
--- a/zephyr/include/emul/emul_power_signals.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef EMUL_POWER_SIGNALS_H_
-#define EMUL_POWER_SIGNALS_H_
-
-/**
- * @brief Test platform definition,
- * This structure contains all power signal nodes associated to one
- * test.
- */
-struct power_signal_emul_test_platform {
- char *name_id;
- int nodes_count;
- struct power_signal_emul_node **nodes;
-};
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL(inst) \
- extern const struct power_signal_emul_test_platform inst;
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM(inst) (&DT_CAT(DT_N_S_, inst))
-
-DT_FOREACH_STATUS_OKAY(intel_ap_pwr_test_platform,
- EMUL_POWER_SIGNAL_TEST_PLATFORM_DECL)
-/**
- * @brief Load test platform.
- *
- * This initializes each of the test platform nodes.
- *
- * @param test_platform Pointer to test platform structure.
- *
- * @return 0 indicating success.
- * @return -EINVAL `test_id` parameter is invalid.
- * @return -EBUSY `test_id` One test platform is currently loaded.
- */
-int power_signal_emul_load(
- const struct power_signal_emul_test_platform *test_platform);
-
-/**
- * @brief Unload test platform.
- *
- * @return 0 indicating success.
- * @return -EINVAL no test platform has been loaded.
- */
-int power_signal_emul_unload(void);
-
-#endif /* EMUL_POWER_SIGNALS_H_ */
diff --git a/zephyr/include/emul/emul_smart_battery.h b/zephyr/include/emul/emul_smart_battery.h
index 35018f37f7..826e817992 100644
--- a/zephyr/include/emul/emul_smart_battery.h
+++ b/zephyr/include/emul/emul_smart_battery.h
@@ -12,13 +12,12 @@
#ifndef __EMUL_SMART_BATTERY_H
#define __EMUL_SMART_BATTERY_H
-#include "emul/emul_common_i2c.h"
-
-#include <stdint.h>
-
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
+#include <stdint.h>
+
+#include "emul/emul_common_i2c.h"
/**
* @brief Smart Battery emulator backend API
diff --git a/zephyr/include/emul/emul_syv682x.h b/zephyr/include/emul/emul_syv682x.h
index 3e4328323e..78ee2406eb 100644
--- a/zephyr/include/emul/emul_syv682x.h
+++ b/zephyr/include/emul/emul_syv682x.h
@@ -11,9 +11,8 @@
#ifndef __EMUL_SYV682X_H
#define __EMUL_SYV682X_H
-#include <stdint.h>
-
#include <zephyr/drivers/i2c_emul.h>
+#include <stdint.h>
/* Register info copied from syv682.h */
diff --git a/zephyr/include/emul/tcpc/emul_tcpci.h b/zephyr/include/emul/tcpc/emul_tcpci.h
index 8badf7dbc4..8175b9ce96 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci.h
@@ -12,14 +12,13 @@
#ifndef __EMUL_TCPCI_H
#define __EMUL_TCPCI_H
-#include "emul/emul_common_i2c.h"
-
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/i2c_emul.h>
-
#include <usb_pd_tcpm.h>
+#include "emul/emul_common_i2c.h"
+
/**
* Number of emulated register. This include vendor registers defined in TCPCI
* specification
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h
index dd8909c2ca..f232724ece 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_common.h
@@ -12,16 +12,15 @@
#ifndef __EMUL_TCPCI_PARTNER_COMMON_H
#define __EMUL_TCPCI_PARTNER_COMMON_H
-#include "ec_commands.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "usb_pd.h"
-
-#include <stdbool.h>
-#include <stdint.h>
-
#include <zephyr/drivers/emul.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/atomic.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "ec_commands.h"
+#include "emul/tcpc/emul_tcpci.h"
+#include "usb_pd.h"
/**
* @brief Common code used by TCPCI partner device emulators
@@ -148,9 +147,6 @@ struct tcpci_partner_data {
/* SVID of entered mode (0 if no mode is entered) */
uint16_t entered_svid;
- enum tcpc_cc_voltage_status tcpm_cc1;
- enum tcpc_cc_voltage_status tcpm_cc2;
-
/* VDMs with which the partner responds to discovery REQs. The VDM
* buffers include the VDM header, and the VDO counts include 1 for the
* VDM header. This structure has space for the mode response for a
@@ -187,8 +183,6 @@ struct tcpci_partner_data {
*/
bool have_response[PD_BATT_MAX];
} battery_capabilities;
- /* Used to control accept/reject for partner port of Enter_USB msg */
- bool enter_usb_accept;
/*
* Cable which is "plugged in" to this port partner
@@ -317,9 +311,6 @@ struct tcpci_partner_extension_ops {
void (*soft_reset)(struct tcpci_partner_extension *ext,
struct tcpci_partner_data *common_data);
- void (*control_change)(struct tcpci_partner_extension *ext,
- struct tcpci_partner_data *common_data);
-
/**
* @brief Function called when partner emulator is disconnected from
* TCPM
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h
index cacb4e6270..e4f58fcd37 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_drp.h
@@ -12,14 +12,13 @@
#ifndef __EMUL_TCPCI_PARTNER_DRP_H
#define __EMUL_TCPCI_PARTNER_DRP_H
+#include <zephyr/drivers/emul.h>
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
#include "usb_pd.h"
-#include <zephyr/drivers/emul.h>
-
/**
* @brief USB-C dual role device extension backend API
* @defgroup tcpci_snk_emul USB-C dual role device extension
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h
index 317e9817d4..f0627c95bd 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_faulty_ext.h
@@ -12,12 +12,11 @@
#ifndef __EMUL_TCPCI_PARTNER_FAULTY_EXT_H
#define __EMUL_TCPCI_PARTNER_FAULTY_EXT_H
+#include <zephyr/drivers/emul.h>
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "usb_pd.h"
-#include <zephyr/drivers/emul.h>
-
/**
* @brief USB-C malfunctioning device extension backend API
* @defgroup tcpci_faulty_ext USB-C malfunctioning device extension
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h
index edf09d25eb..584458942b 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_snk.h
@@ -12,12 +12,11 @@
#ifndef __EMUL_TCPCI_PARTNER_SNK_H
#define __EMUL_TCPCI_PARTNER_SNK_H
-#include "emul/tcpc/emul_tcpci.h"
+#include <zephyr/drivers/emul.h>
#include "emul/tcpc/emul_tcpci_partner_common.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "usb_pd.h"
-#include <zephyr/drivers/emul.h>
-
/**
* @brief USB-C sink device extension backend API
* @defgroup tcpci_snk_emul USB-C sink device extension
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h
index 7ce14da82a..e72d0e4135 100644
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h
+++ b/zephyr/include/emul/tcpc/emul_tcpci_partner_src.h
@@ -12,12 +12,11 @@
#ifndef __EMUL_TCPCI_PARTNER_SRC_H
#define __EMUL_TCPCI_PARTNER_SRC_H
-#include "emul/tcpc/emul_tcpci.h"
+#include <zephyr/drivers/emul.h>
#include "emul/tcpc/emul_tcpci_partner_common.h"
+#include "emul/tcpc/emul_tcpci.h"
#include "usb_pd.h"
-#include <zephyr/drivers/emul.h>
-
/**
* @brief USB-C source device extension backend API
* @defgroup tcpci_src_emul USB-C source device extension
diff --git a/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h b/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h
deleted file mode 100644
index 6de0452b05..0000000000
--- a/zephyr/include/emul/tcpc/emul_tcpci_partner_vpd.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**
- * @file
- *
- * @brief Backend API for USB-C VCONN-powered device emulator
- */
-
-#ifndef __EMUL_TCPCI_PARTNER_VPD_H
-#define __EMUL_TCPCI_PARTNER_VPD_H
-
-#include "emul/tcpc/emul_tcpci_partner_common.h"
-#include "emul/tcpc/emul_tcpci_partner_faulty_ext.h"
-#include "emul/tcpc/emul_tcpci_partner_snk.h"
-#include "emul/tcpc/emul_tcpci_partner_src.h"
-
-#include <zephyr/drivers/emul.h>
-
-/**
- * @brief USB-C VCONN-powered device extension backend API
- * @defgroup tcpci_src_emul USB-C source device extension
- * @{
- */
-
-struct tcpci_vpd_emul_data {
- /** Common extension structure */
- struct tcpci_partner_extension ext;
- /** Pointer to common TCPCI partner data */
- struct tcpci_partner_data *common_data;
- struct tcpci_faulty_ext_data fault_ext;
- struct tcpci_faulty_ext_action fault_actions[1];
- struct tcpci_snk_emul_data snk_ext;
- struct tcpci_src_emul_data src_ext;
- bool charge_through_connected;
-};
-
-struct tcpci_partner_extension *
-tcpci_vpd_emul_init(struct tcpci_vpd_emul_data *data,
- struct tcpci_partner_data *common_data,
- struct tcpci_partner_extension *ext);
-
-/**
- * @}
- */
-
-#endif /* __EMUL_TCPCI_PARTNER_VPD_H */
diff --git a/zephyr/linker/CMakeLists.txt b/zephyr/linker/CMakeLists.txt
index adffc2246f..94544d454b 100644
--- a/zephyr/linker/CMakeLists.txt
+++ b/zephyr/linker/CMakeLists.txt
@@ -21,7 +21,3 @@ zephyr_linker_sources_ifdef(CONFIG_SOC_FAMILY_MEC ROM_START SORT_KEY 1
zephyr_linker_sources(DATA_SECTIONS iterables-ram.ld)
zephyr_linker_sources(SECTIONS iterables-rom.ld)
-
-# Ensure there's space for panic and jump data at the end of ram
-# Must be added to "SECTIONS" because this is applied last
-zephyr_linker_sources(SECTIONS end-of-ram.ld)
diff --git a/zephyr/linker/end-of-ram.ld b/zephyr/linker/end-of-ram.ld
deleted file mode 100644
index e03de7481d..0000000000
--- a/zephyr/linker/end-of-ram.ld
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* This section simply ensures there's enough unused space at the end of ram to
- * hold panic and jump data. This space isn't directly allocated because it
- * would result in the SRAM utilization always being reported as 100%.
- */
-#if !defined(CONFIG_BOARD_NATIVE_POSIX)
-SECTION_PROLOGUE(.end_of_ram_info, 0, )
-{
- ASSERT(DEFINED(_image_ram_end) && _image_ram_end > 0, "Error: _image_ram_end is not defined");
-
-#if defined(RAM_ADDR) && defined(RAM_SIZE)
- PROVIDE(__unused_ram_start = _image_ram_end);
- PROVIDE(__unused_ram_end = RAM_ADDR + RAM_SIZE);
- PROVIDE(__unused_ram_size = __unused_ram_end - __unused_ram_start);
- ASSERT(__unused_ram_size >= CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE,
- "ERROR: Not enough space for preserved end of ram data (see PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE)");
-#endif
-
-#if defined(CONFIG_SHAREDMEM_MINIMUM_SIZE)
- ASSERT(CONFIG_SHAREDMEM_MINIMUM_SIZE >= CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE,
- "ERROR: Sharedmem must be at least large enough for preserved end of ram data");
-#endif
-
-}
-#endif
diff --git a/zephyr/mock/power.c b/zephyr/mock/power.c
index b0de50a30e..73f93ce3b5 100644
--- a/zephyr/mock/power.c
+++ b/zephyr/mock/power.c
@@ -3,15 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+#include <zephyr/ztest.h>
+
#include "hooks.h"
#include "lid_switch.h"
-#include "mock/power.h"
#include "power.h"
#include "task.h"
#include "util.h"
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
+#include "mock/power.h"
LOG_MODULE_REGISTER(mock_power);
diff --git a/zephyr/program/corsola/BUILD.py b/zephyr/program/corsola/BUILD.py
deleted file mode 100644
index f145953e0d..0000000000
--- a/zephyr/program/corsola/BUILD.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2021 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Define zmake projects for corsola."""
-
-# Default chip is it81202bx, some variants will use NPCX9X.
-
-
-def register_corsola_project(
- project_name,
- chip="it81202bx",
-):
- """Register a variant of corsola."""
- register_func = register_binman_project
- if chip.startswith("npcx"):
- register_func = register_npcx_project
-
- chip_kconfig = {"it81202bx": "ite", "npcx9m3f": "npcx"}[chip]
-
- register_func(
- project_name=project_name,
- zephyr_board=chip,
- dts_overlays=[here / project_name / "project.overlay"],
- kconfig_files=[
- here / "program.conf",
- here / f"{chip_kconfig}_program.conf",
- here / project_name / "project.conf",
- ],
- )
-
-
-register_corsola_project("krabby")
-
-register_corsola_project(
- project_name="kingler",
- chip="npcx9m3f",
-)
-
-register_corsola_project(
- project_name="steelix",
- chip="npcx9m3f",
-)
-
-register_corsola_project("tentacruel")
-
-register_corsola_project("magikarp")
-
-register_corsola_project(
- project_name="voltorb",
- chip="npcx9m3f",
-)
diff --git a/zephyr/program/corsola/krabby/project.overlay b/zephyr/program/corsola/krabby/project.overlay
deleted file mode 100644
index 6aafaf4379..0000000000
--- a/zephyr/program/corsola/krabby/project.overlay
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Corsola program common DTS includes */
-
-#include "../common.dtsi"
-#include "../power_signal.dtsi"
-#include "../usba.dtsi"
-#include "../ite_adc.dtsi"
-#include "../battery_krabby.dtsi"
-#include "../ite_gpio.dtsi"
-#include "../ite_keyboard.dtsi"
-#include "../i2c_krabby.dtsi"
-#include "../ite_interrupts.dtsi"
-#include "../led_krabby.dtsi"
-#include "../ite_motionsense.dtsi"
-#include "../ite_usbc.dtsi"
diff --git a/zephyr/program/corsola/magikarp/project.overlay b/zephyr/program/corsola/magikarp/project.overlay
deleted file mode 100644
index f4ca85e375..0000000000
--- a/zephyr/program/corsola/magikarp/project.overlay
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Corsola program common DTS includes */
-
-#include "../common.dtsi"
-#include "../power_signal.dtsi"
-#include "../usba.dtsi"
-#include "../adc_magikarp.dtsi"
-#include "../battery_magikarp.dtsi"
-#include "../cbi_magikarp.dtsi"
-#include "../gpio_magikarp.dtsi"
-#include "../ite_keyboard.dtsi"
-#include "../i2c_magikarp.dtsi"
-#include "../interrupts_magikarp.dtsi"
-#include "../led_magikarp.dtsi"
-#include "../motionsense_magikarp.dtsi"
-#include "../usbc_magikarp.dtsi"
diff --git a/zephyr/program/corsola/steelix/project.overlay b/zephyr/program/corsola/steelix/project.overlay
deleted file mode 100644
index f850a51563..0000000000
--- a/zephyr/program/corsola/steelix/project.overlay
+++ /dev/null
@@ -1,298 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Corsola program common DTS includes */
-
-#include "../common.dtsi"
-#include "../power_signal.dtsi"
-#include "../usba.dtsi"
-#include "../npcx_adc.dtsi"
-#include "../npcx_gpio.dtsi"
-#include "../npcx_host_interface.dtsi"
-#include "../npcx_i2c.dtsi"
-#include "../npcx_interrupts.dtsi"
-#include "../npcx_keyboard.dtsi"
-#include "../npcx_motionsense.dtsi"
-#include "../npcx_usbc.dtsi"
-#include "../npcx_default_gpio_pinctrl.dtsi"
-
-/* Projrect level DTS shared with tests */
-#include "./cbi.dtsi"
-#include "./interrupts.dtsi"
-
-/* board override */
-/ {
- aliases {
- /*
- * motion sense's <>_INT_EVENT is handled
- * by alias. Using the alias, each driver creates
- * its own <>_INT_EVENT.
- */
- lsm6dsm-int = &base_accel;
- };
-
- named-gpios {
- en_pp5000_usb_a1_vbus: en_pp5000_usb_a1_vbus_x {
- gpios = <&gpiof 5 GPIO_OUTPUT_LOW>;
- };
- usb_a1_fault_odl {
- gpios = <&gpiof 4 GPIO_INPUT>;
- };
- };
-
- batteries {
- default_battery: byd_l22b3pg0 {
- compatible = "byd,l22b3pg0", "battery-smart";
- };
- celxpert_l22c3pg0 {
- compatible = "celxpert,l22c3pg0", "battery-smart";
- };
- cosmx_l22x3pg0 {
- compatible = "cosmx,l22x3pg0", "battery-smart";
- };
- smp_l22m3pg0 {
- compatible = "smp,l22m3pg0", "battery-smart";
- };
- sunwoda_l22d3pg0 {
- compatible = "sunwoda,l22d3pg0", "battery-smart";
- };
- };
-
-
- /* Steelix-specific ssfc fields. */
- steelix-ssfc {
- compatible = "cros-ec,cbi-ssfc";
-
- /* SSFC field to identify BASE motion sensor. */
- base-sensor {
- enum-name = "BASE_SENSOR";
- size = <3>;
-
- base_sensor_0: bmi323 {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <1>;
- default;
- };
- base_sensor_1: lsm6dsm {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <2>;
- };
- };
-
- /* SSFC field to identify LID motion sensor. */
- lid-sensor {
- enum-name = "LID_SENSOR";
- size = <3>;
-
- lid_sensor_0: bma422 {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <1>;
- default;
- };
- lid_sensor_1: lis2dw12 {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <2>;
- };
- };
- };
-
- /* Rotation matrix used by drivers. */
- motionsense-rotation-ref {
- compatible = "cros-ec,motionsense-rotation-ref";
- base_rot_ref_lsm6dsm: base-rotation-ref-lsm6dsm {
- mat33 = <0 1 0
- 1 0 0
- 0 0 (-1)>;
- };
- };
-
- /*
- * Driver specific data. A driver-specific data can be shared with
- * different motion sensors while they are using the same driver.
- *
- * If a node's compatible starts with "cros-ec,accelgyro-", it is for
- * a common structure defined in accelgyro.h.
- * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
- * "struct als_drv_data_t" in accelgyro.h
- */
- motionsense-sensor-data {
- lis2dw12_data: lis2dw12-drv-data {
- compatible = "cros-ec,drvdata-lis2dw12";
- status = "okay";
- };
- lsm6dsm_data_accel: lsm6dsm-accel-drv-data {
- compatible = "cros-ec,drvdata-lsm6dsm";
- status = "okay";
- };
- lsm6dsm_data_gyro: lsm6dsm-gyro-drv-data {
- compatible = "cros-ec,drvdata-lsm6dsm";
- status = "okay";
- };
- };
-
- motionsense-sensor-alt {
- alt_lid_accel: alt-lid-accel {
- compatible = "cros-ec,lis2dw12";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&lid_rot_ref>;
- default-range = <2>;
- drv-data = <&lis2dw12_data>;
- i2c-spi-addr-flags = "LIS2DWL_ADDR0_FLAGS";
- alternate-for = <&lid_accel>;
- alternate-ssfc-indicator = <&lid_sensor_1>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- alt_base_accel: alt-base-accel {
- compatible = "cros-ec,lsm6dsm-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&base_mutex>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref_lsm6dsm>;
- drv-data = <&lsm6dsm_data_accel>;
- alternate-for = <&base_accel>;
- alternate-ssfc-indicator = <&base_sensor_1>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <(100 * USEC_PER_MSEC)>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <0>;
- };
- };
- };
-
- alt_base_gyro: alt-base-gyro {
- compatible = "cros-ec,lsm6dsm-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&base_mutex>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref_lsm6dsm>;
- default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */
- drv-data = <&lsm6dsm_data_gyro>;
- alternate-for = <&base_gyro>;
- alternate-ssfc-indicator = <&base_sensor_1>;
- };
- };
-
- cros-keyscan {
- compatible = "cros-ec,keyscan";
-
- debounce-down = <15000>;
- debounce-up = <15000>;
-
- actual-key-mask = <
- 0x1c /* C0 */
- 0xff /* C1 */
- 0xff /* C2 */
- 0xff /* C3 */
- 0xff /* C4 */
- 0xf5 /* C5 */
- 0xff /* C6 */
- 0xa4 /* C7 */
- 0xff /* C8 */
- 0xfe /* C9 */
- 0x55 /* C10 */
- 0xfa /* C11 */
- 0xca /* C12 */
- >;
- };
-
- pwmleds {
- compatible = "pwm-leds";
- led_battery_red: ec_led1_odl {
- pwms = <&pwm0 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
- led_battery_green: ec_led2_odl {
- pwms = <&pwm1 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
- led_power_white: ec_led3_odl {
- pwms = <&pwm4 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
- };
-};
-
-/* Red LED */
-&pwm0_gpc3 {
- drive-open-drain;
-};
-
-&pwm0 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm0_gpc3>;
- pinctrl-names = "default";
-};
-
-/* Green LED */
-&pwm1_gpc2 {
- drive-open-drain;
-};
-
-&pwm1 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm1_gpc2>;
- pinctrl-names = "default";
-};
-
-/* White LED */
-&pwm4_gpb6 {
- drive-open-drain;
-};
-
-&pwm4 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm4_gpb6>;
- pinctrl-names = "default";
-};
-
-/* inherit the rot_ref from Kingler and overwrite it */
-&lid_rot_ref {
- mat33 = <0 1 0
- 1 0 0
- 0 0 (-1)>;
-};
-
-&base_rot_ref {
- mat33 = <1 0 0
- 0 (-1) 0
- 0 0 (-1)>;
-};
-
-/* steelix usba port enable config */
-&usba_port_enable_list {
- enable-pins = <&en_pp5000_usb_a0_vbus
- &en_pp5000_usb_a1_vbus>;
-};
diff --git a/zephyr/program/corsola/tentacruel/project.overlay b/zephyr/program/corsola/tentacruel/project.overlay
deleted file mode 100644
index 79bf2baa3d..0000000000
--- a/zephyr/program/corsola/tentacruel/project.overlay
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Corsola program common DTS includes */
-
-#include "../common.dtsi"
-#include "../power_signal.dtsi"
-#include "../usba.dtsi"
-#include "../adc_tentacruel.dtsi"
-#include "../battery_tentacruel.dtsi"
-#include "../cbi_tentacruel.dtsi"
-#include "../gpio_tentacruel.dtsi"
-#include "../ite_keyboard.dtsi"
-#include "../i2c_tentacruel.dtsi"
-#include "../interrupts_tentacruel.dtsi"
-#include "../led_tentacruel.dtsi"
-#include "../motionsense_tentacruel.dtsi"
-#include "../usbc_tentacruel.dtsi"
-#include "../thermistor_tentacruel.dtsi"
diff --git a/zephyr/program/corsola/voltorb/project.conf b/zephyr/program/corsola/voltorb/project.conf
deleted file mode 100644
index c1be25bfc1..0000000000
--- a/zephyr/program/corsola/voltorb/project.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Variant config
-CONFIG_BOARD_VOLTORB=y
-
-# Voltorb only use D2, drop the workaround config for H1
-CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=n
-
-# No A+Gsensor
-CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=n
-CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=n
-CONFIG_PLATFORM_EC_ACCEL_BMA4XX=n
-CONFIG_PLATFORM_EC_ACCEL_FIFO=n
-CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCELS=n
-CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCEL_INFO=n
-CONFIG_PLATFORM_EC_GMR_TABLET_MODE=n
-CONFIG_PLATFORM_EC_LID_ANGLE=n
-CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=n
-CONFIG_PLATFORM_EC_MOTIONSENSE=n
-CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=n
-CONFIG_PLATFORM_EC_TABLET_MODE=n
-CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=n
-
-# LED
-CONFIG_PLATFORM_EC_LED_COMMON=n
-CONFIG_PLATFORM_EC_LED_ONOFF_STATES=n
-CONFIG_PLATFORM_EC_LED_DT=y
-
-# Keyboard
-CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3=y
-CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
-CONFIG_PLATFORM_EC_KEYBOARD_STRICT_DEBOUNCE=y
-
-# USBC
-CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=3250
-CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=65000
-
-# AC_OK debounce time
-CONFIG_PLATFORM_EC_EXTPOWER_DEBOUNCE_MS=800
diff --git a/zephyr/program/corsola/voltorb/project.overlay b/zephyr/program/corsola/voltorb/project.overlay
deleted file mode 100644
index 8cd5a2bad8..0000000000
--- a/zephyr/program/corsola/voltorb/project.overlay
+++ /dev/null
@@ -1,309 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Corsola program common DTS includes */
-
-#include "../common.dtsi"
-#include "../power_signal.dtsi"
-#include "../usba.dtsi"
-#include "../npcx_adc.dtsi"
-#include "../npcx_gpio.dtsi"
-#include "../npcx_host_interface.dtsi"
-#include "../npcx_i2c.dtsi"
-#include "../npcx_interrupts.dtsi"
-#include "../npcx_keyboard.dtsi"
-#include "../npcx_usbc.dtsi"
-#include "../npcx_default_gpio_pinctrl.dtsi"
-#include <dt-bindings/battery.h>
-
-/ {
- unused-pins {
- compatible = "unused-gpios";
-
- unused-gpios =
- /* base_imu_int_l */
- <&gpio5 6 0>,
- /* ec_pen_chg_dis_odl */
- <&gpioe 4 0>,
- /* lid_accel_int_l */
- <&gpiob 3 0>,
- /* gpio_tablet_mode_l */
- <&gpiob 2 0>,
- /* LED3 */
- <&gpioc 4 0>;
- };
-
- batteries {
- default_battery: lgc_ap18c8k {
- compatible = "lgc,ap18c8k", "battery-smart";
- };
- cosmx_ap20cbl-2 {
- compatible = "cosmx,ap20cbl-2", "battery-smart";
- };
- };
-
- cros-keyscan {
- compatible = "cros-ec,keyscan";
-
- debounce-down = <20000>;
- debounce-up = <20000>;
-
- actual-key-mask = <
- 0x1c /* C0 */
- 0xff /* C1 */
- 0xff /* C2 */
- 0xff /* C3 */
- 0xff /* C4 */
- 0xf5 /* C5 */
- 0xff /* C6 */
- 0xa4 /* C7 */
- 0xff /* C8 */
- 0xfe /* C9 */
- 0x55 /* C10 */
- 0xfa /* C11 */
- 0xca /* C12 */
- >;
- };
-
- led_colors: led-colors {
- compatible = "cros-ec,led-policy";
-
- /* Voltorb LED bat charge */
- bat-power-state-charge-lvl-1 {
- charge-state = "PWR_STATE_CHARGE";
- /* Battery percent range (>= Empty, <= 94%) */
- batt-lvl = <BATTERY_LEVEL_EMPTY
- (BATTERY_LEVEL_NEAR_FULL - 3)>;
-
- color-0 {
- led-color = <&color_amber>;
- };
- };
- bat-power-state-charge-lvl-2 {
- charge-state = "PWR_STATE_CHARGE";
- /* Battery percent range (>= 95%, <= 96%) */
- batt-lvl = <(BATTERY_LEVEL_NEAR_FULL - 2)
- (BATTERY_LEVEL_NEAR_FULL - 1)>;
-
- color-0 {
- led-color = <&color_blue>;
- };
- };
-
- /* Voltorb LED bat charge near full */
- bat-power-state-charge-near-full {
- charge-state = "PWR_STATE_CHARGE_NEAR_FULL";
-
- color-0 {
- led-color = <&color_blue>;
- };
- };
-
- /* Voltorb LED bat discharge */
- bat-power-state-discharge-s0 {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S0";
- /* Battery percent range (>= 14%, <= Full) */
- batt-lvl = <(BATTERY_LEVEL_LOW + 4) BATTERY_LEVEL_FULL>;
-
- color-0 {
- led-color = <&color_blue>;
- };
- };
- bat-power-state-discharge-s0-bat-low {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S0";
- /* Battery percent range (>= 7%, <= 13%) */
- batt-lvl = <(BATTERY_LEVEL_CRITICAL + 2)
- (BATTERY_LEVEL_LOW + 3)>;
-
- color-0 {
- led-color = <&color_amber>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <3000>;
- };
- };
- bat-power-state-discharge-s0-bat-critical {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S0";
- /* Battery percent range (>= Empty, <= 6%) */
- batt-lvl = <BATTERY_LEVEL_EMPTY
- (BATTERY_LEVEL_CRITICAL + 1)>;
-
- color-0 {
- led-color = <&color_amber>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <1000>;
- };
- };
- bat-power-state-discharge-s3 {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S3";
-
- color-0 {
- led-color = <&color_amber>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <3000>;
- };
- };
- bat-power-state-discharge-s5 {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S5";
-
- color-0 {
- led-color = <&color_off>;
- };
- };
-
- /* Voltorb LED bat error */
- bat-power-state-error {
- charge-state = "PWR_STATE_ERROR";
- chipset-state = "POWER_S0";
-
- color-0 {
- led-color = <&color_amber>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <1000>;
- };
- };
- bat-power-state-error-s3 {
- charge-state = "PWR_STATE_ERROR";
- chipset-state = "POWER_S3";
-
- color-0 {
- led-color = <&color_amber>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <3000>;
- };
- };
- bat-power-state-error-s5 {
- charge-state = "PWR_STATE_ERROR";
- chipset-state = "POWER_S5";
-
- color-0 {
- led-color = <&color_off>;
- };
- };
-
- /* Voltorb LED power idle */
- power-state-idle {
- charge-state = "PWR_STATE_IDLE";
-
- color-0 {
- led-color = <&color_blue>;
- };
- };
-
- /* Voltorb LED power forced idle */
- power-state-forced-idle-right {
- charge-state = "PWR_STATE_FORCED_IDLE";
-
- color-0 {
- led-color = <&color_amber>;
- period-ms = <2000>;
- };
- color-1 {
- led-color = <&color_blue>;
- period-ms = <2000>;
- };
- };
- };
-
- pwmleds {
- compatible = "pwm-leds";
-
- led_amber: ec_led1_odl {
- pwms = <&pwm0 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
-
- led_blue: ec_led2_odl {
- pwms = <&pwm1 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
- };
-
- pwm-led-pins {
- compatible = "cros-ec,pwm-led-pins";
-
- color_off: color-off {
- led-color = "LED_OFF";
- led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&led_amber &led_blue>;
- led-values = <0 0>;
- };
-
- color_amber: color-amber {
- led-color = "LED_AMBER";
- led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&led_amber &led_blue>;
- led-values = <100 0>;
- };
-
- color_blue: color_blue {
- led-color = "LED_BLUE";
- led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_BLUE";
- led-pwms = <&led_amber &led_blue>;
- led-values = <0 100>;
- };
- };
-};
-
-/* Amber LED */
-&pwm0_gpc3 {
- drive-open-drain;
-};
-
-&pwm0 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm0_gpc3>;
- pinctrl-names = "default";
-};
-
-/* Blue LED */
-&pwm1_gpc2 {
- drive-open-drain;
-};
-
-&pwm1 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm1_gpc2>;
- pinctrl-names = "default";
-};
-
-/* gpio overrides */
-/ {
- named-gpios {
- /delete-node/ base_imu_int_l;
- /delete-node/ ec_pen_chg_dis_odl;
- /delete-node/ lid_accel_int_l;
- /delete-node/ gpio_tablet_mode_l;
- };
-};
-
-/* interrupts overrides */
-/ {
- gpio-interrupts {
- /delete-node/ base_imu;
- /delete-node/ tablet_mode;
- };
-};
diff --git a/zephyr/program/herobrine/BUILD.py b/zephyr/program/herobrine/BUILD.py
deleted file mode 100644
index 0bee6ffe2a..0000000000
--- a/zephyr/program/herobrine/BUILD.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2021 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Define zmake projects for herobrine."""
-
-
-def register_variant(
- project_name,
-):
- """Register a variant of herobrine."""
- register_npcx_project(
- project_name=project_name,
- zephyr_board="npcx9m3f",
- dts_overlays=[
- here / project_name / "project.overlay",
- ],
- kconfig_files=[
- # Common to all projects.
- here / "program.conf",
- # Project-specific KConfig customization.
- here / project_name / "project.conf",
- ],
- )
-
-
-register_variant(
- project_name="evoker",
-)
-
-register_variant(
- project_name="herobrine",
-)
-
-register_variant(
- project_name="hoglin",
-)
-
-register_variant(
- project_name="villager",
-)
-
-register_variant(
- project_name="zoglin",
-)
-
-register_variant(
- project_name="zombie",
-)
diff --git a/zephyr/program/herobrine/evoker/gpio.dtsi b/zephyr/program/herobrine/evoker/gpio.dtsi
deleted file mode 100644
index fd4a773369..0000000000
--- a/zephyr/program/herobrine/evoker/gpio.dtsi
+++ /dev/null
@@ -1,309 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- aliases {
- gpio-wp = &gpio_ec_wp_odl;
- gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
- };
-
- named-gpios {
- compatible = "named-gpios";
-
- gpio_usb_c0_pd_int_odl: usb_c0_pd_int_odl {
- gpios = <&gpioe 0 GPIO_INPUT>;
- enum-name = "GPIO_USB_C0_PD_INT_ODL";
- };
- gpio_usb_c1_pd_int_odl: usb_c1_pd_int_odl {
- gpios = <&gpiof 5 GPIO_INPUT>;
- enum-name = "GPIO_USB_C1_PD_INT_ODL";
- };
- gpio_usb_c0_swctl_int_odl: usb_c0_swctl_int_odl {
- gpios = <&gpio0 3 GPIO_INPUT>;
- enum-name = "GPIO_USB_C0_SWCTL_INT_ODL";
- };
- gpio_usb_c1_swctl_int_odl: usb_c1_swctl_int_odl {
- gpios = <&gpio4 0 GPIO_INPUT>;
- enum-name = "GPIO_USB_C1_SWCTL_INT_ODL";
- };
- gpio_usb_c0_bc12_int_l: usb_c0_bc12_int_l {
- gpios = <&gpio6 1 GPIO_INPUT_PULL_UP>;
- };
- gpio_usb_c1_bc12_int_l: usb_c1_bc12_int_l {
- gpios = <&gpio8 2 GPIO_INPUT_PULL_UP>;
- };
- gpio_chg_acok_od: chg_acok_od {
- gpios = <&gpiod 2 GPIO_INPUT>;
- enum-name = "GPIO_AC_PRESENT";
- };
- gpio_ec_pwr_btn_odl: ec_pwr_btn_odl {
- gpios = <&gpio0 0 GPIO_INPUT>;
- enum-name = "GPIO_POWER_BUTTON_L";
- };
- gpio_ec_voldn_btn_odl: ec_voldn_btn_odl {
- gpios = <&gpio6 2 GPIO_INPUT_PULL_UP>;
- enum-name = "GPIO_VOLUME_DOWN_L";
- };
- gpio_ec_volup_btn_odl: ec_volup_btn_odl {
- gpios = <&gpioc 2 GPIO_INPUT_PULL_UP>;
- enum-name = "GPIO_VOLUME_UP_L";
- };
- gpio_ec_wp_odl: ec_wp_odl {
- gpios = <&gpiod 3 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
- };
- gpio_lid_open_ec: lid_open_ec {
- gpios = <&gpio0 1 GPIO_INPUT>;
- enum-name = "GPIO_LID_OPEN";
- };
- gpio_ap_rst_l: ap_rst_l {
- gpios = <&gpio5 1 GPIO_INPUT>;
- enum-name = "GPIO_AP_RST_L";
- };
- gpio_ps_hold: ps_hold {
- gpios = <&gpioa 6 GPIO_INPUT_PULL_DOWN>;
- enum-name = "GPIO_PS_HOLD";
- };
- gpio_ap_suspend: ap_suspend {
- gpios = <&gpio5 7 GPIO_INPUT>;
- enum-name = "GPIO_AP_SUSPEND";
- };
- gpio_mb_power_good: mb_power_good {
- gpios = <&gpio3 7 GPIO_INPUT_PULL_DOWN>;
- enum-name = "GPIO_POWER_GOOD";
- };
- gpio_warm_reset_l: warm_reset_l {
- gpios = <&gpiob 0 GPIO_INPUT>;
- enum-name = "GPIO_WARM_RESET_L";
- };
- ap_ec_spi_cs_l {
- gpios = <&gpio5 3 GPIO_INPUT_PULL_DOWN>;
- };
- gpio_tablet_mode_l: tablet_mode_l {
- gpios = <&gpioc 6 GPIO_INPUT>;
- enum-name = "GPIO_TABLET_MODE_L";
- };
- gpio_accel_gyro_int_l: accel_gyro_int_l {
- gpios = <&gpioa 3 GPIO_INPUT>;
- };
- gpio_rtc_ec_wake_odl: rtc_ec_wake_odl {
- gpios = <&gpio0 2 GPIO_INPUT>;
- };
- ec_entering_rw {
- gpios = <&gpio7 2 GPIO_OUTPUT_LOW>;
- enum-name = "GPIO_ENTERING_RW";
- };
- ccd_mode_odl {
- gpios = <&gpio6 3 GPIO_INPUT>;
- enum-name = "GPIO_CCD_MODE_ODL";
- };
- ec_batt_pres_odl {
- gpios = <&gpioe 5 GPIO_INPUT>;
- enum-name = "GPIO_BATT_PRES_ODL";
- };
- ec_gsc_packet_mode {
- gpios = <&gpio8 3 GPIO_OUTPUT_LOW>;
- enum-name = "GPIO_PACKET_MODE_EN";
- };
- pmic_resin_l {
- gpios = <&gpioa 0 GPIO_ODR_HIGH>;
- enum-name = "GPIO_PMIC_RESIN_L";
- };
- pmic_kpd_pwr_odl {
- gpios = <&gpioa 2 GPIO_ODR_HIGH>;
- enum-name = "GPIO_PMIC_KPD_PWR_ODL";
- };
- ap_ec_int_l {
- gpios = <&gpio5 6 GPIO_ODR_HIGH>;
- enum-name = "GPIO_EC_INT_L";
- };
- gpio_switchcap_on: switchcap_on {
- gpios = <&gpiod 5 GPIO_OUTPUT_LOW>;
- enum-name = "GPIO_SWITCHCAP_ON";
- };
- gpio_en_pp5000_s5: en_pp5000_s5 {
- gpios = <&gpio7 3 GPIO_OUTPUT_HIGH>;
- enum-name = "GPIO_EN_PP5000";
- };
- ec_bl_disable_l {
- /* The PMIC controls backlight enable and this pin must
- * be HiZ for normal operation. But the backlight can
- * be enabled by setting this pin low and configuring it
- * as an output.
- */
- gpios = <&gpiob 6 GPIO_INPUT>;
- enum-name = "GPIO_ENABLE_BACKLIGHT";
- };
- lid_accel_int_l {
- gpios = <&gpioa 1 GPIO_INPUT>;
- };
- tp_int_gate {
- gpios = <&gpio7 4 GPIO_OUTPUT_LOW>;
- };
- gpio_usb_c0_pd_rst_l: usb_c0_pd_rst_l {
- gpios = <&gpiof 1 GPIO_OUTPUT_HIGH>;
- };
- gpio_usb_c1_pd_rst_l: usb_c1_pd_rst_l {
- gpios = <&gpioe 4 GPIO_OUTPUT_HIGH>;
- };
- gpio_dp_mux_oe_l: dp_mux_oe_l {
- gpios = <&gpiob 1 GPIO_ODR_HIGH>;
- };
- gpio_dp_mux_sel: dp_mux_sel {
- gpios = <&gpio4 5 GPIO_OUTPUT_LOW>;
- };
- gpio_dp_hot_plug_det_r: dp_hot_plug_det_r {
- gpios = <&gpio9 5 GPIO_OUTPUT_LOW>;
- };
- gpio_usb_c0_frs_en: usb_c0_frs_en {
- gpios = <&gpioc 5 GPIO_OUTPUT_LOW>;
- enum-name = "GPIO_USB_C0_FRS_EN";
- };
- gpio_usb_c1_frs_en: usb_c1_frs_en {
- gpios = <&gpioc 1 GPIO_OUTPUT_LOW>;
- enum-name = "GPIO_USB_C1_FRS_EN";
- };
- gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
- gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
- };
- gpio_ec_chg_led_w_c0: ec_chg_led_w_c0 {
- gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
- };
- gpio_ec_chg_led_w_c1: ec_chg_led_w_c1 {
- gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
- };
- gpio_ec_chg_led_r_c0: ec_chg_led_r_c0 {
- gpios = <&gpioc 4 GPIO_OUTPUT_LOW>;
- };
- ap_ec_spi_mosi {
- gpios = <&gpio4 6 GPIO_INPUT_PULL_DOWN>;
- };
- ap_ec_spi_miso {
- gpios = <&gpio4 7 GPIO_INPUT_PULL_DOWN>;
- };
- ap_ec_spi_clk {
- gpios = <&gpio5 5 GPIO_INPUT_PULL_DOWN>;
- };
- gpio_brd_id0: brd_id0 {
- gpios = <&gpio9 4 GPIO_INPUT>;
- enum-name = "GPIO_BOARD_VERSION1";
- };
- gpio_brd_id1: brd_id1 {
- gpios = <&gpio9 7 GPIO_INPUT>;
- enum-name = "GPIO_BOARD_VERSION2";
- };
- gpio_brd_id2: brd_id2 {
- gpios = <&gpioa 5 GPIO_INPUT>;
- enum-name = "GPIO_BOARD_VERSION3";
- };
- gpio_sku_id0: sku_id0 {
- gpios = <&gpio6 7 GPIO_INPUT>;
- };
- gpio_sku_id1: sku_id1 {
- gpios = <&gpio7 0 GPIO_INPUT>;
- };
- gpio_sku_id2: sku_id2 {
- gpios = <&gpioe 1 GPIO_INPUT>;
- };
- gpio_switchcap_pg: src_vph_pwr_pg {
- gpios = <&gpioe 2 GPIO_INPUT_PULL_DOWN>;
- enum-name = "GPIO_SWITCHCAP_PG";
- };
- arm_x86 {
- gpios = <&gpio6 6 GPIO_OUTPUT_LOW>;
- };
- ec-i2c-sensor-scl {
- gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- ec-i2c-sensor-sda {
- gpios = <&gpiob 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- gpio_ec_kso_02_inv: ec_kso_02_inv {
- gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>;
- };
- };
-
- gpio_id_sku: sku {
- compatible = "cros-ec,gpio-id";
- bits = <
- &gpio_sku_id0
- &gpio_sku_id1
- &gpio_sku_id2
- >;
- system = "ternary";
- };
-
- gpio_id_board: board {
- compatible = "cros-ec,gpio-id";
- bits = <
- &gpio_brd_id0
- &gpio_brd_id1
- &gpio_brd_id2
- >;
- system = "ternary";
- };
-
- unused-pins {
- compatible = "unused-gpios";
- unused-gpios =
- <&gpio5 2 0>,
- <&gpio5 4 0>,
- <&gpio7 6 0>,
- <&gpiod 1 0>,
- <&gpiod 0 0>,
- <&gpioe 3 0>,
- <&gpio0 4 0>,
- <&gpiod 6 0>,
- <&gpio3 2 0>,
- <&gpio3 5 0>,
- <&gpiod 7 0>,
- <&gpio8 6 0>,
- <&gpiod 4 0>,
- <&gpio4 1 0>,
- <&gpio3 4 0>,
- <&gpioc 7 0>,
- <&gpioa 4 0>,
- <&gpio9 6 0>,
- <&gpio9 3 0>,
- <&gpioa 7 0>,
- <&gpio5 0 0>,
- <&gpio8 1 0>,
- <&gpiof 0 0>,
- <&gpio7 5 0>,
- <&gpiof 4 0>,
- <&gpiob 7 0>;
- };
-};
-
-/* Power switch logic input pads */
-&psl_in1_gpd2 {
- /* ACOK_OD */
- psl-in-mode = "edge";
- psl-in-pol = "high-rising";
-};
-
-&psl_in2_gp00 {
- /* EC_PWR_BTN_ODL */
- psl-in-mode = "edge";
- psl-in-pol = "low-falling";
-};
-
-&psl_in3_gp01 {
- /* LID_OPEN_EC */
- psl-in-mode = "edge";
- psl-in-pol = "high-rising";
-};
-
-&psl_in4_gp02 {
- /* RTC_EC_WAKE_ODL */
- psl-in-mode = "edge";
- psl-in-pol = "low-falling";
-};
-
-/* Power domain device controlled by PSL (Power Switch Logic) IO pads */
-&power_ctrl_psl {
- status = "okay";
- pinctrl-names = "sleep";
- pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>;
-};
diff --git a/zephyr/program/herobrine/evoker/project.overlay b/zephyr/program/herobrine/evoker/project.overlay
deleted file mode 100644
index 61d3129f70..0000000000
--- a/zephyr/program/herobrine/evoker/project.overlay
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Herobrine program common DTS includes */
-#include "../adc.dtsi"
-#include "../common.dtsi"
-#include "../i2c.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../default_gpio_pinctrl.dtsi"
-#include "../display.dtsi"
-#include "../switchcap.dtsi"
-#include "../usbc.dtsi"
-
-/* Evoker project DTS includes*/
-#include "gpio.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
-
-/* evoker overrides follow... */
-/* battery overrides */
-/ {
- batteries {
- default_battery: pc_vp_bp153 {
- compatible = "smp,pc-vp-bp153", "battery-smart";
- };
- ap16l5j {
- compatible = "panasonic,ap16l5j", "battery-smart";
- };
- };
-
-};
-
-/* i2c overrides */
-&i2c1_0 {
- ppc_port0_alt: sn5s330@40 {
- compatible = "ti,sn5s330";
- status = "okay";
- reg = <0x40>;
- };
-};
-
-&i2c2_0 {
- ppc_port1_alt: sn5s330@40 {
- compatible = "ti,sn5s330";
- status = "okay";
- reg = <0x40>;
- };
-};
-
-/* interrupts overrides */
-/ {
- gpio-interrupts {
- /delete-node/ usb_a0_oc;
- };
-};
diff --git a/zephyr/program/herobrine/herobrine/CMakeLists.txt b/zephyr/program/herobrine/herobrine/CMakeLists.txt
deleted file mode 100644
index 5524db7215..0000000000
--- a/zephyr/program/herobrine/herobrine/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
- "src/alt_dev_replacement.c")
diff --git a/zephyr/program/herobrine/herobrine/project.overlay b/zephyr/program/herobrine/herobrine/project.overlay
deleted file mode 100644
index 6ee53f67f0..0000000000
--- a/zephyr/program/herobrine/herobrine/project.overlay
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Herobrine program common DTS includes */
-#include "../adc.dtsi"
-#include "../common.dtsi"
-#include "../i2c.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../default_gpio_pinctrl.dtsi"
-#include "../display.dtsi"
-#include "../gpio.dtsi"
-#include "../motionsense.dtsi"
-#include "../switchcap.dtsi"
-#include "../usbc.dtsi"
-
-/* Herobrine project DTS includes*/
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-
-/* herobrine overrides follow... */
-/* battery overrides */
-/ {
- batteries {
- default_battery: ap16l5j {
- compatible = "panasonic,ap16l5j", "battery-smart";
- };
- };
-};
-
-/* i2c overrides */
-&i2c1_0 {
-
- /delete-node/ syv682x@41;
- ppc_port0: sn5s330@40 {
- compatible = "ti,sn5s330";
- status = "okay";
- reg = <0x40>;
- };
-
- ppc_port0_alt: syv682x@41 {
- compatible = "silergy,syv682x";
- status = "okay";
- reg = <0x41>;
- frs_en_gpio = <&gpio_usb_c0_frs_en>;
- };
-};
-
-&i2c2_0 {
-
- /delete-node/ syv682x@41;
- ppc_port1: sn5s330@40 {
- compatible = "ti,sn5s330";
- status = "okay";
- reg = <0x40>;
- };
-};
-
-/* usbc overrides */
-&port0 {
- ppc_alt = <&ppc_port0_alt>;
-};
diff --git a/zephyr/program/herobrine/hoglin/project.overlay b/zephyr/program/herobrine/hoglin/project.overlay
deleted file mode 100644
index e37a325654..0000000000
--- a/zephyr/program/herobrine/hoglin/project.overlay
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Herobrine program common DTS includes */
-#include "../adc.dtsi"
-#include "../common.dtsi"
-#include "../i2c.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../default_gpio_pinctrl.dtsi"
-#include "../usbc.dtsi"
-#include "../switchcap.dtsi"
-
-/* Hoglin project DTS includes*/
-#include "gpio.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
-
-/* hoglin overrides follow... */
-/* battery overrides */
-/ {
- batteries {
- default_battery: 7c01 {
- compatible = "ganfeng,7c01", "battery-smart";
- };
- };
-
-};
-
-/* switchcap overrides */
-&{/switchcap} {
- /delete-property/ power-good-pin;
- poff-delay-ms = <550>;
-};
-
-/* i2c overrides */
-&i2c1_0 {
- /delete-node/ ps8xxx@b;
- tcpc_port0: ps8xxx@1b {
- compatible = "parade,ps8xxx";
- reg = <0x1b>;
- };
-};
-
-&i2c2_0 {
- /delete-node/ ps8xxx@b;
- tcpc_port1: ps8xxx@1b {
- compatible = "parade,ps8xxx";
- reg = <0x1b>;
- };
-};
diff --git a/zephyr/program/herobrine/villager/project.overlay b/zephyr/program/herobrine/villager/project.overlay
deleted file mode 100644
index 5f968e4e9b..0000000000
--- a/zephyr/program/herobrine/villager/project.overlay
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Herobrine program common DTS includes */
-#include "../adc.dtsi"
-#include "../common.dtsi"
-#include "../i2c.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../default_gpio_pinctrl.dtsi"
-#include "../switchcap.dtsi"
-#include "../usbc.dtsi"
-
-/* Villager project DTS includes*/
-#include "gpio.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
-
-/* villager overrides follow... */
-/* battery overrides */
-/ {
- batteries {
- default_battery: ap19a5k {
- compatible = "panasonic,ap19a5k", "battery-smart";
- };
- ap19a8k {
- compatible = "lgc,ap19a8k", "battery-smart";
- };
- };
-};
diff --git a/zephyr/program/herobrine/zoglin/project.overlay b/zephyr/program/herobrine/zoglin/project.overlay
deleted file mode 100644
index b631d4b490..0000000000
--- a/zephyr/program/herobrine/zoglin/project.overlay
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "../hoglin/project.overlay"
diff --git a/zephyr/program/herobrine/zombie/project.overlay b/zephyr/program/herobrine/zombie/project.overlay
deleted file mode 100644
index e5b530dc5f..0000000000
--- a/zephyr/program/herobrine/zombie/project.overlay
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Herobrine program common DTS includes */
-#include "../adc.dtsi"
-#include "../common.dtsi"
-#include "../i2c.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../default_gpio_pinctrl.dtsi"
-#include "../switchcap.dtsi"
-#include "../usbc.dtsi"
-
-/* Zombie project DTS includes*/
-#include "gpio.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
-
-/* zombie overrides follow... */
-/* battery overrides */
-/ {
- batteries {
- default_battery: sg20 {
- compatible = "ganfeng,sg20", "battery-smart";
- };
- };
-};
diff --git a/zephyr/program/nissa/craask/fan.dtsi b/zephyr/program/nissa/craask/fan.dtsi
deleted file mode 100644
index b94b0a018c..0000000000
--- a/zephyr/program/nissa/craask/fan.dtsi
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-/ {
- fans {
- compatible = "cros-ec,fans";
- fan_0 {
- pwms = <&pwm5 5 PWM_KHZ(25) PWM_POLARITY_NORMAL>;
- tach = <&tach2>;
- rpm_min = <2500>;
- rpm_start = <2500>;
- rpm_max = <4100>;
- enable_gpio = <&gpio_fan_enable>;
- };
- };
-};
-
-&pwm5_gpb7 {
- drive-open-drain;
-};
-
-/* pwm for fan */
-&pwm5 {
- status = "okay";
- pinctrl-0 = <&pwm5_gpb7>;
- pinctrl-names = "default";
-};
-
-/* Tachometer for fan speed measurement */
-&tach2 {
- status = "okay";
- pinctrl-0 = <&ta2_1_in_gp73>;
- pinctrl-names = "default";
- port = <NPCX_TACH_PORT_A>; /* port-A is selected */
- sample-clk = <NPCX_TACH_FREQ_LFCLK>; /* Use LFCLK as sampling clock */
- pulses-per-round = <2>; /* number of pulses per round of encoder */
-};
diff --git a/zephyr/program/nissa/craask/keyboard.dtsi b/zephyr/program/nissa/craask/keyboard.dtsi
deleted file mode 100644
index 06eb6bacfb..0000000000
--- a/zephyr/program/nissa/craask/keyboard.dtsi
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-&cros_kb_raw {
- status = "okay";
- /* No KSO2 (it's inverted and implemented by GPIO) */
- pinctrl-0 = <
- &ksi0_gp31
- &ksi1_gp30
- &ksi2_gp27
- &ksi3_gp26
- &ksi4_gp25
- &ksi5_gp24
- &ksi6_gp23
- &ksi7_gp22
- &kso00_gp21
- &kso01_gp20
- &kso03_gp16
- &kso04_gp15
- &kso05_gp14
- &kso06_gp13
- &kso07_gp12
- &kso08_gp11
- &kso09_gp10
- &kso10_gp07
- &kso11_gp06
- &kso12_gp05
- >;
- pinctrl-1 = <
- &ksi0_gpio_gp31
- &ksi1_gpio_gp30
- &ksi2_gpio_gp27
- &ksi3_gpio_gp26
- &ksi4_gpio_gp25
- &ksi5_gpio_gp24
- &ksi6_gpio_gp23
- &ksi7_gpio_gp22
- &kso00_gpio_gp21
- &kso01_gpio_gp20
- &kso03_gpio_gp16
- &kso04_gpio_gp15
- &kso05_gpio_gp14
- &kso06_gpio_gp13
- &kso07_gpio_gp12
- &kso08_gpio_gp11
- &kso09_gpio_gp10
- &kso10_gpio_gp07
- &kso11_gpio_gp06
- &kso12_gpio_gp05
- >;
- pinctrl-names = "default", "sleep";
-};
diff --git a/zephyr/program/nissa/craask/project.overlay b/zephyr/program/nissa/craask/project.overlay
deleted file mode 100644
index 6107b6ef15..0000000000
--- a/zephyr/program/nissa/craask/project.overlay
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "../cbi.dtsi"
-
-#include "cbi.dtsi"
-#include "fan.dtsi"
-#include "generated.dtsi"
-#include "keyboard.dtsi"
-#include "motionsense.dtsi"
-#include "overlay.dtsi"
-#include "power_signals.dtsi"
-#include "pwm_leds.dtsi"
diff --git a/zephyr/program/nissa/craask/src/kb_backlight.c b/zephyr/program/nissa/craask/src/kb_backlight.c
deleted file mode 100644
index 108cbb3abd..0000000000
--- a/zephyr/program/nissa/craask/src/kb_backlight.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "board_config.h"
-#include "common.h"
-#include "cros_board_info.h"
-#include "cros_cbi.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-__override uint32_t board_override_feature_flags0(uint32_t flags0)
-{
- int ret;
- uint32_t val;
-
- /*
- * Remove keyboard backlight feature for devices that don't support it.
- */
- ret = cros_cbi_get_fw_config(FW_KB_BL, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_KB_BL);
- return flags0;
- }
-
- if (val == FW_KB_BL_NOT_PRESENT)
- return (flags0 & ~EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB));
- else
- return flags0;
-}
diff --git a/zephyr/program/nissa/craask/src/keyboard.c b/zephyr/program/nissa/craask/src/keyboard.c
deleted file mode 100644
index 1d2102b655..0000000000
--- a/zephyr/program/nissa/craask/src/keyboard.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-
-static const struct ec_response_keybd_config craask_kb = {
- .num_top_row_keys = 10,
- .action_keys = {
- TK_BACK, /* T1 */
- TK_REFRESH, /* T2 */
- TK_FULLSCREEN, /* T3 */
- TK_OVERVIEW, /* T4 */
- TK_SNAPSHOT, /* T5 */
- TK_BRIGHTNESS_DOWN, /* T6 */
- TK_BRIGHTNESS_UP, /* T7 */
- TK_VOL_MUTE, /* T8 */
- TK_VOL_DOWN, /* T9 */
- TK_VOL_UP, /* T10 */
- },
- .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
-};
-
-__override const struct ec_response_keybd_config *
-board_vivaldi_keybd_config(void)
-{
- return &craask_kb;
-}
-
-/*
- * We have total 30 pins for keyboard connecter {-1, -1} mean
- * the N/A pin that don't consider it and reserve index 0 area
- * that we don't have pin 0.
- */
-const int keyboard_factory_scan_pins[][2] = {
- { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
- { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
- { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
- { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
- { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
- { -1, -1 },
-};
-const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
diff --git a/zephyr/program/nissa/nivviks/overlay.dtsi b/zephyr/program/nissa/nivviks/overlay.dtsi
deleted file mode 100644
index c3a8d7a61d..0000000000
--- a/zephyr/program/nissa/nivviks/overlay.dtsi
+++ /dev/null
@@ -1,439 +0,0 @@
-/* Copyright 2021 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usbc_mux.h>
-#include <dt-bindings/usb_pd_tcpm.h>
-
-/ {
- aliases {
- gpio-cbi-wp = &gpio_ec_cbi_wp;
- gpio-wp = &gpio_ec_wp_odl;
- int-wp = &int_wp_l;
- gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
- };
-
- ec-console {
- compatible = "ec-console";
- disabled = "events", "lpc", "hostcmd";
- };
-
- batteries {
- default_battery: lgc {
- compatible = "lgc,ap18c8k", "battery-smart";
- };
- lgc_ap19b8m {
- compatible = "lgc,ap19b8m", "battery-smart";
- };
- };
-
- hibernate-wake-pins {
- compatible = "cros-ec,hibernate-wake-pins";
- wakeup-irqs = <
- &int_power_button
- &int_lid_open
- >;
- };
-
- gpio-interrupts {
- compatible = "cros-ec,gpio-interrupts";
-
- int_power_button: power_button {
- irq-pin = <&gpio_gsc_ec_pwr_btn_odl>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "power_button_interrupt";
- };
- int_wp_l: wp_l {
- irq-pin = <&gpio_ec_wp_odl>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "switch_interrupt";
- };
- int_lid_open: lid_open {
- irq-pin = <&gpio_lid_open>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "lid_interrupt";
- };
- int_tablet_mode: tablet_mode {
- irq-pin = <&gpio_tablet_mode_l>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "gmr_tablet_switch_isr";
- };
- int_imu: ec_imu {
- irq-pin = <&gpio_imu_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "lsm6dso_interrupt";
- };
- int_vol_down: vol_down {
- irq-pin = <&gpio_voldn_btn_odl>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "button_interrupt";
- };
- int_vol_up: vol_up {
- irq-pin = <&gpio_volup_btn_odl>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "button_interrupt";
- };
- int_usb_c0: usb_c0 {
- irq-pin = <&gpio_usb_c0_int_odl>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "usb_interrupt";
- };
- int_usb_c1: usb_c1 {
- irq-pin = <&gpio_sb_1>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "usb_interrupt";
- };
- };
-
- named-gpios {
- gpio_sb_1: sb-1 {
- gpios = <&gpio0 2 GPIO_PULL_UP>;
- no-auto-init;
- };
-
- gpio_sb_2: sb-2 {
- gpios = <&gpiod 4 GPIO_OUTPUT>;
- no-auto-init;
- };
-
- /*
- * Set I2C pins for type C sub-board to be low voltage (I2C5_1).
- * We do this for all boards, since the pins are 3.3V tolerant,
- * and the only 2 types of sub-boards used on nivviks both have
- * type-C ports on them.
- */
- gpio_sb_3: sb-3 {
- gpios = <&gpiof 4 (GPIO_OPEN_DRAIN | GPIO_VOLTAGE_1P8)>;
- no-auto-init;
- };
- gpio_sb_4: sb-4 {
- gpios = <&gpiof 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- no-auto-init;
- };
- gpio_fan_enable: fan-enable {
- gpios = <&gpio6 3 GPIO_OUTPUT>;
- no-auto-init;
- };
- ec-i2c-sensor-scl {
- gpios = <&gpio9 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- ec-i2c-sensor-sda {
- gpios = <&gpio8 7 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- };
-
- /*
- * Aliases used for sub-board GPIOs.
- */
- aliases {
- /*
- * Input GPIO when used with type-C port 1
- * Output when used with HDMI sub-board
- */
- gpio-usb-c1-int-odl = &gpio_sb_1;
- gpio-en-rails-odl = &gpio_sb_1;
- /*
- * Sub-board with type A USB, enable.
- */
- gpio-en-usb-a1-vbus = &gpio_sb_2;
- /*
- * HPD pins for HDMI sub-board.
- */
- gpio-hdmi-en-odl = &gpio_sb_3;
- gpio-hpd-odl = &gpio_sb_4;
- /*
- * Enable S5 rails for LTE sub-board
- */
- gpio-en-sub-s5-rails = &gpio_sb_2;
- };
-
- temp_memory: memory {
- compatible = "cros-ec,temp-sensor-thermistor";
- thermistor = <&thermistor_3V3_51K1_47K_4050B>;
- adc = <&adc_temp_sensor_1>;
- };
- temp_charger: charger {
- compatible = "cros-ec,temp-sensor-thermistor";
- thermistor = <&thermistor_3V3_51K1_47K_4050B>;
- adc = <&adc_temp_sensor_2>;
- };
- temp_ambient: ambient {
- compatible = "cros-ec,temp-sensor-thermistor";
- thermistor = <&thermistor_3V3_51K1_47K_4050B>;
- adc = <&adc_temp_sensor_3>;
- };
-
- named-temp-sensors {
- compatible = "cros-ec,temp-sensors";
- memory {
- temp_fan_off = <35>;
- temp_fan_max = <60>;
- temp_host_high = <85>;
- temp_host_halt = <90>;
- temp_host_release_high = <80>;
- power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
- sensor = <&temp_memory>;
- };
- charger {
- temp_fan_off = <35>;
- temp_fan_max = <60>;
- temp_host_high = <85>;
- temp_host_halt = <90>;
- temp_host_release_high = <80>;
- power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
- sensor = <&temp_charger>;
- };
- ambient {
- temp_fan_off = <35>;
- temp_fan_max = <60>;
- temp_host_high = <85>;
- temp_host_halt = <90>;
- temp_host_release_high = <80>;
- power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
- sensor = <&temp_ambient>;
- };
- };
-
- usba {
- compatible = "cros-ec,usba-port-enable-pins";
- /*
- * sb_2 is only configured as GPIO when USB-A1 is present,
- * but it's still safe to control when disabled.
- *
- * ILIM_SEL pins are referred to by legacy enum name,
- * GPIO_USB*_ILIM_SEL. The one for port A1 is unused on
- * sub-boards that don't have USB-A so is safe to control
- * regardless of system configuration.
- */
- enable-pins = <&gpio_en_usb_a0_vbus &gpio_sb_2>;
- status = "okay";
- };
-
- usbc {
- #address-cells = <1>;
- #size-cells = <0>;
-
- port0@0 {
- compatible = "named-usbc-port";
- reg = <0>;
- bc12 = <&bc12_port0>;
- chg = <&chg_port0>;
- tcpc = <&tcpc_port0>;
- usb-mux-chain-0 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&virtual_mux_0>;
- };
- };
- port0-muxes {
- virtual_mux_0: virtual-mux-0 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
- };
- /*
- * TODO(b:211693800): port1 may not be present on some
- * sub-boards.
- */
- port1@1 {
- compatible = "named-usbc-port";
- reg = <1>;
- bc12 = <&bc12_port1>;
- chg = <&chg_port1>;
- tcpc = <&tcpc_port1>;
- usb-mux-chain-1 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&virtual_mux_1 &anx7483_mux_1>;
- };
- usb_mux_chain_1_no_mux: usb-mux-chain-1-no-mux {
- compatible = "cros-ec,usb-mux-chain";
- alternative-chain;
- usb-muxes = <&virtual_mux_1>;
- };
- };
- port1-muxes {
- virtual_mux_1: virtual-mux-1 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
- };
- };
-
- fans {
- compatible = "cros-ec,fans";
-
- fan_0 {
- pwms = <&pwm5 5 PWM_KHZ(1) PWM_POLARITY_NORMAL>;
- rpm_min = <2200>;
- rpm_start = <2200>;
- rpm_max = <4200>;
- tach = <&tach2>;
- enable_gpio = <&gpio_fan_enable>;
- };
- };
-
- /*
- * Declare unused GPIOs so that they are shut down
- * and use minimal power
- */
- unused-pins {
- compatible = "unused-gpios";
- unused-gpios =
- <&gpio3 2 0>,
- <&gpio3 3 0>,
- <&gpio3 5 0>,
- <&gpio3 6 0>,
- <&gpio5 7 0>,
- <&gpio6 0 0>,
- <&gpio6 3 0>,
- <&gpio6 6 0>,
- <&gpio7 3 0>,
- <&gpio8 3 0>,
- <&gpio8 6 0>,
- <&gpiob 1 0>,
- <&gpiob 7 0>,
- <&gpioc 7 0>,
- <&gpiof 2 0>,
- <&gpiof 3 0>;
- };
-};
-
-&thermistor_3V3_51K1_47K_4050B {
- status = "okay";
-};
-
-&adc_ec_vsense_pp3300_s5 {
- /*
- * Voltage divider on input has 47k upper and 220k lower legs with
- * 2714 mV full-scale reading on the ADC. Apply the largest possible
- * multiplier (without overflowing int32) to get the best possible
- * approximation of the actual ratio, but derate by a factor of two to
- * ensure unexpectedly high values won't overflow.
- */
- mul = <(791261 / 2)>;
- div = <(651975 / 2)>;
-};
-
-/* Set bus speeds for I2C */
-&i2c0_0 {
- label = "I2C_EEPROM";
- clock-frequency = <I2C_BITRATE_FAST>;
-
- cbi_eeprom: eeprom@50 {
- compatible = "atmel,at24";
- reg = <0x50>;
- size = <2048>;
- pagesize = <16>;
- address-width = <8>;
- timeout = <5>;
- };
-};
-
-&i2c1_0 {
- label = "I2C_SENSOR";
- clock-frequency = <I2C_BITRATE_FAST>;
-};
-
-&i2c3_0 {
- label = "I2C_USB_C0_TCPC";
- clock-frequency = <I2C_BITRATE_FAST_PLUS>;
-
- bc12_port0: pi3usb9201@5f {
- compatible = "pericom,pi3usb9201";
- status = "okay";
- reg = <0x5f>;
- /*
- * BC1.2 interrupt is shared with TCPC, so
- * IRQ is not specified here and handled by
- * usb_c0_interrupt.
- */
- };
-
- chg_port0: isl923x@9 {
- compatible = "intersil,isl923x";
- status = "okay";
- reg = <0x9>;
- };
-
- tcpc_port0: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
-};
-
-&i2c5_1 {
- label = "I2C_SUB_C1_TCPC";
- clock-frequency = <I2C_BITRATE_FAST_PLUS>;
-
- bc12_port1: pi3usb9201@5f {
- compatible = "pericom,pi3usb9201";
- status = "okay";
- reg = <0x5f>;
- };
-
- chg_port1: isl923x@9 {
- compatible = "intersil,isl923x";
- status = "okay";
- reg = <0x9>;
- };
-
- tcpc_port1: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
-
- anx7483_mux_1: anx7483-mux-1@3e {
- compatible = "analogix,anx7483";
- reg = <0x3e>;
- board-set = "anx7483_set_default_tuning";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
- };
-};
-
-&i2c7_0 {
- label = "I2C_BATTERY";
- clock-frequency = <I2C_BITRATE_STANDARD>;
-};
-
-&pwm5_gpb7 {
- drive-open-drain;
-};
-
-&pwm5 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm5_gpb7>;
- pinctrl-names = "default";
-};
-
-/* Tachometer for fan speed measurement */
-&tach2 {
- status = "okay";
- pinctrl-0 = <&ta2_1_in_gp73>;
- pinctrl-names = "default";
- port = <NPCX_TACH_PORT_A>; /* port-A is selected */
- sample-clk = <NPCX_TACH_FREQ_LFCLK>; /* Use LFCLK as sampling clock */
- pulses-per-round = <2>; /* number of pulses per round of encoder */
-};
-
-/* host interface */
-&espi0 {
- status = "okay";
- pinctrl-0 = <&espi_lpc_gp46_47_51_52_53_54_55_57>;
- pinctrl-names = "default";
-};
-
-/*
- * Declare GPIOs that have leakage current caused by board issues here. NPCX ec
- * will disable their input buffers before entering deep sleep and restore them
- * after waking up automatically for better power consumption.
- */
-&power_leakage_io {
- leak-gpios = <&gpioa 4 0
- &gpiof 1 0>;
-};
diff --git a/zephyr/program/nissa/nivviks/src/fan.c b/zephyr/program/nissa/nivviks/src/fan.c
deleted file mode 100644
index 3111a70e03..0000000000
--- a/zephyr/program/nissa/nivviks/src/fan.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "cros_cbi.h"
-#include "fan.h"
-#include "gpio/gpio.h"
-#include "hooks.h"
-#include "nissa_common.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-/*
- * Nirwen fan support
- */
-static void fan_init(void)
-{
- int ret;
- uint32_t val;
- /*
- * Retrieve the fan config.
- */
- ret = cros_cbi_get_fw_config(FW_FAN, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_FAN);
- return;
- }
- if (val != FW_FAN_PRESENT) {
- /* Disable the fan */
- fan_set_count(0);
- } else {
- /* Configure the fan enable GPIO */
- gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_fan_enable),
- GPIO_OUTPUT);
- }
-}
-DECLARE_HOOK(HOOK_INIT, fan_init, HOOK_PRIO_POST_FIRST);
diff --git a/zephyr/program/nissa/nivviks/src/form_factor.c b/zephyr/program/nissa/nivviks/src/form_factor.c
deleted file mode 100644
index 08dfa5c04b..0000000000
--- a/zephyr/program/nissa/nivviks/src/form_factor.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "accelgyro.h"
-#include "cros_cbi.h"
-#include "hooks.h"
-#include "motionsense_sensors.h"
-#include "nissa_common.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-/*
- * Mainboard orientation support.
- */
-
-#define ALT_MAT SENSOR_ROT_STD_REF_NAME(DT_NODELABEL(base_rot_inverted))
-#define BASE_SENSOR SENSOR_ID(DT_NODELABEL(base_accel))
-#define BASE_GYRO SENSOR_ID(DT_NODELABEL(base_gyro))
-
-static void form_factor_init(void)
-{
- int ret;
- uint32_t val;
- /*
- * If the firmware config indicates
- * an inverted form factor, use the alternative
- * rotation matrix.
- */
- ret = cros_cbi_get_fw_config(FW_BASE_INVERSION, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d",
- FW_BASE_INVERSION);
- return;
- }
- if (val == FW_BASE_INVERTED) {
- LOG_INF("Switching to inverted base");
- motion_sensors[BASE_SENSOR].rot_standard_ref = &ALT_MAT;
- motion_sensors[BASE_GYRO].rot_standard_ref = &ALT_MAT;
- }
-}
-DECLARE_HOOK(HOOK_INIT, form_factor_init, HOOK_PRIO_POST_I2C);
diff --git a/zephyr/program/nissa/xivu/motionsense.dtsi b/zephyr/program/nissa/xivu/motionsense.dtsi
deleted file mode 100644
index fd82aa6ae2..0000000000
--- a/zephyr/program/nissa/xivu/motionsense.dtsi
+++ /dev/null
@@ -1,252 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/motionsense/utils.h>
-
-
-/ {
- aliases {
- /*
- * Interrupt bindings for sensor devices.
- */
- lsm6dso-int = &base_accel;
- lis2dw12-int = &lid_accel;
- bmi3xx-int = &base_accel;
- bma4xx-int = &lid_accel;
- };
-
- /*
- * Declare mutexes used by sensor drivers.
- * A mutex node is used to create an instance of mutex_t.
- * A mutex node is referenced by a sensor node if the
- * corresponding sensor driver needs to use the
- * instance of the mutex.
- */
- motionsense-mutex {
- compatible = "cros-ec,motionsense-mutex";
- lid_mutex: lid-mutex {
- };
-
- lid_mutex_bma422: bma422-mutex {
- };
-
- base_mutex: base-mutex {
- };
-
- base_mutex_bmi323: bmi323-mutex {
- };
- };
-
- /* Rotation matrix used by drivers. */
- motionsense-rotation-ref {
- compatible = "cros-ec,motionsense-rotation-ref";
- lid_rot_ref: lid-rotation-ref {
- mat33 = <0 1 0
- 1 0 0
- 0 0 (-1)>;
- };
-
- base_rot_ref: base-rotation-ref {
- mat33 = <0 1 0
- (-1) 0 0
- 0 0 1>;
- };
-
- lid_rot_bma422: lid-rotation-bma {
- mat33 = <(-1) 0 0
- 0 1 0
- 0 0 (-1)>;
- };
-
- base_rot_ref_bmi: base-rotation-ref-bmi {
- mat33 = <(-1) 0 0
- 0 (-1) 0
- 0 0 1>;
- };
- };
-
- /*
- * Driver specific data. A driver-specific data can be shared with
- * different motion sensors while they are using the same driver.
- *
- * If a node's compatible starts with "cros-ec,accelgyro-", it is for
- * a common structure defined in accelgyro.h.
- * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
- * "struct als_drv_data_t" in accelgyro.h
- */
- motionsense-sensor-data {
- lsm6dso_accel_data: lsm6dso-accel-drv-data {
- compatible = "cros-ec,drvdata-lsm6dso";
- status = "okay";
- };
-
- lsm6dso_gyro_data: lsm6dso-gyro-drv-data {
- compatible = "cros-ec,drvdata-lsm6dso";
- status = "okay";
- };
-
- lis2dw12_data: lis2dw12-drv-data {
- compatible = "cros-ec,drvdata-lis2dw12";
- status = "okay";
- };
-
- bma422_data: bma4xx-drv-data {
- compatible = "cros-ec,drvdata-bma4xx";
- status = "okay";
- };
-
- bmi323_data: bmi323-drv-data {
- compatible = "cros-ec,drvdata-bmi3xx";
- status = "okay";
- };
- };
-
- /*
- * List of motion sensors that creates motion_sensors array.
- * The nodelabel "lid_accel" and "base_accel" are used to indicate
- * motion sensor IDs for lid angle calculation.
- * TODO(b/238139272): The first entries of the array must be
- * accelerometers,then gyroscope. Fix this dependency in the DTS
- * processing which makes the devicetree entries independent.
- */
- motionsense-sensor {
- lid_accel: lid-accel {
- compatible = "cros-ec,lis2dw12";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex>;
- port = <&i2c_ec_i2c_sensor>;
- rot-standard-ref = <&lid_rot_ref>;
- default-range = <2>;
- drv-data = <&lis2dw12_data>;
- i2c-spi-addr-flags = "LIS2DWL_ADDR0_FLAGS";
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- ec-s3 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base_accel: base-accel {
- compatible = "cros-ec,lsm6dso-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&base_mutex>;
- port = <&i2c_ec_i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&lsm6dso_accel_data>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- ec-s3 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base_gyro: base-gyro {
- compatible = "cros-ec,lsm6dso-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&base_mutex>;
- port = <&i2c_ec_i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */
- drv-data = <&lsm6dso_gyro_data>;
- };
- };
-
- motionsense-sensor-alt {
- alt_lid_accel: alt-lid-accel {
- compatible = "cros-ec,bma4xx";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex_bma422>;
- port = <&i2c_ec_i2c_sensor>;
- rot-standard-ref = <&lid_rot_bma422>;
- default-range = <2>;
- drv-data = <&bma422_data>;
- i2c-spi-addr-flags = "BMA4_I2C_ADDR_PRIMARY";
- alternate-for = <&lid_accel>;
- alternate-ssfc-indicator = <&lid_sensor_bma422>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- ec-s3 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- alt_base_accel: alt-base-accel {
- compatible = "cros-ec,bmi3xx-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&base_mutex_bmi323>;
- port = <&i2c_ec_i2c_sensor>;
- rot-standard-ref = <&base_rot_ref_bmi>;
- drv-data = <&bmi323_data>;
- alternate-for = <&base_accel>;
- alternate-ssfc-indicator = <&base_sensor_bmi323>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- ec-s3 {
- odr = <(10000 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- alt_base_gyro: alt-base-gyro {
- compatible = "cros-ec,bmi3xx-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&base_mutex_bmi323>;
- port = <&i2c_ec_i2c_sensor>;
- rot-standard-ref = <&base_rot_ref_bmi>;
- drv-data = <&bmi323_data>;
- alternate-for = <&base_gyro>;
- alternate-ssfc-indicator = <&base_sensor_bmi323>;
- };
- };
-
- motionsense-sensor-info {
- compatible = "cros-ec,motionsense-sensor-info";
-
- /*
- * list of GPIO interrupts that have to
- * be enabled at initial stage
- */
- sensor-irqs = <&int_imu>;
- /* list of sensors in force mode */
- accel-force-mode-sensors = <&lid_accel>;
- };
-};
diff --git a/zephyr/program/nissa/xivu/project.conf b/zephyr/program/nissa/xivu/project.conf
deleted file mode 100644
index d20c490c20..0000000000
--- a/zephyr/program/nissa/xivu/project.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-CONFIG_BOARD_XIVU=y
-CONFIG_PLATFORM_EC_OCPC=y
-
-CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=10
-
-# LED
-CONFIG_PLATFORM_EC_LED_COMMON=n
-CONFIG_PLATFORM_EC_LED_DT=y
-
-# USBC
-CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=45000
-
-# Battery
-CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y
-
-# Montionsense
-CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y
-CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
-CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSO=y
-CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
-CONFIG_PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT=y
diff --git a/zephyr/program/nissa/xivu/src/form_factor.c b/zephyr/program/nissa/xivu/src/form_factor.c
deleted file mode 100644
index 2ce6f5418d..0000000000
--- a/zephyr/program/nissa/xivu/src/form_factor.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "accelgyro.h"
-#include "button.h"
-#include "cros_board_info.h"
-#include "cros_cbi.h"
-#include "driver/accel_bma4xx.h"
-#include "driver/accel_lis2dw12_public.h"
-#include "driver/accelgyro_bmi323.h"
-#include "driver/accelgyro_lsm6dso.h"
-#include "gpio/gpio_int.h"
-#include "hooks.h"
-#include "motion_sense.h"
-#include "motionsense_sensors.h"
-#include "nissa_common.h"
-#include "tablet_mode.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-static bool use_alt_sensor;
-static bool use_alt_lid_accel;
-
-void motion_interrupt(enum gpio_signal signal)
-{
- if (use_alt_sensor)
- bmi3xx_interrupt(signal);
- else
- lsm6dso_interrupt(signal);
-}
-
-void lid_accel_interrupt(enum gpio_signal signal)
-{
- if (use_alt_lid_accel)
- bma4xx_interrupt(signal);
- else
- lis2dw12_interrupt(signal);
-}
-
-static void form_factor_init(void)
-{
- if (cros_cbi_ssfc_check_match(
- CBI_SSFC_VALUE_ID(DT_NODELABEL(base_sensor_bmi323)))) {
- use_alt_sensor = true;
- MOTIONSENSE_ENABLE_ALTERNATE(alt_base_accel);
- MOTIONSENSE_ENABLE_ALTERNATE(alt_base_gyro);
- ccprints("BASE ACCEL IS BMI323");
- } else if (cros_cbi_ssfc_check_match(CBI_SSFC_VALUE_ID(
- DT_NODELABEL(base_sensor_lsm6dso)))) {
- use_alt_sensor = false;
- ccprints("BASE ACCEL IS LSM6DSO");
- } else {
- use_alt_sensor = false;
- ccprints("no motionsense");
- }
-
- if (cros_cbi_ssfc_check_match(
- CBI_SSFC_VALUE_ID(DT_NODELABEL(lid_sensor_bma422)))) {
- use_alt_lid_accel = true;
- MOTIONSENSE_ENABLE_ALTERNATE(alt_lid_accel);
- ccprints("LID SENSOR IS BMA422");
- } else if (cros_cbi_ssfc_check_match(CBI_SSFC_VALUE_ID(
- DT_NODELABEL(lid_sensor_lis2dw12)))) {
- use_alt_lid_accel = false;
- ccprints("LID SENSOR IS LIS2DW12");
- } else {
- use_alt_lid_accel = false;
- ccprints("no lid sensor");
- }
-
- motion_sensors_check_ssfc();
-}
-DECLARE_HOOK(HOOK_INIT, form_factor_init, HOOK_PRIO_POST_I2C);
diff --git a/zephyr/program/nissa/xivu/src/usbc.c b/zephyr/program/nissa/xivu/src/usbc.c
deleted file mode 100644
index 174eb07c60..0000000000
--- a/zephyr/program/nissa/xivu/src/usbc.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "charge_state_v2.h"
-#include "chipset.h"
-#include "driver/charger/isl923x_public.h"
-#include "driver/retimer/anx7483_public.h"
-#include "driver/tcpm/raa489000.h"
-#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "temp_sensor/temp_sensor.h"
-#include "usb_mux.h"
-
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-int board_is_sourcing_vbus(int port)
-{
- int regval;
-
- tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
- return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-}
-
-int board_set_active_charge_port(int port)
-{
- int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
- int i;
- int old_port;
-
- if (!is_real_port && port != CHARGE_PORT_NONE)
- return EC_ERROR_INVAL;
-
- old_port = charge_manager_get_active_charge_port();
-
- LOG_INF("New chg p%d", port);
-
- /* Disable all ports. */
- if (port == CHARGE_PORT_NONE) {
- for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
- tcpc_write(i, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW);
- raa489000_enable_asgate(i, false);
- }
-
- return EC_SUCCESS;
- }
-
- /* Check if port is sourcing VBUS. */
- if (board_is_sourcing_vbus(port)) {
- LOG_WRN("Skip enable p%d", port);
- return EC_ERROR_INVAL;
- }
-
- /*
- * Turn off the other ports' sink path FETs, before enabling the
- * requested charge port.
- */
- for (i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
- if (i == port)
- continue;
-
- if (tcpc_write(i, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW))
- LOG_WRN("p%d: sink path disable failed.", i);
- raa489000_enable_asgate(i, false);
- }
-
- /*
- * Stop the charger IC from switching while changing ports. Otherwise,
- * we can overcurrent the adapter we're switching to. (crbug.com/926056)
- */
- if (old_port != CHARGE_PORT_NONE)
- charger_discharge_on_ac(1);
-
- /* Enable requested charge port. */
- if (raa489000_enable_asgate(port, true) ||
- tcpc_write(port, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
- LOG_WRN("p%d: sink path enable failed.", port);
- charger_discharge_on_ac(0);
- return EC_ERROR_UNKNOWN;
- }
-
- /* Allow the charger IC to begin/continue switching. */
- charger_discharge_on_ac(0);
-
- return EC_SUCCESS;
-}
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
- int regval;
-
- /*
- * The interrupt line is shared between the TCPC and BC1.2 detector IC.
- * Therefore, go out and actually read the alert registers to report the
- * alert status.
- */
- if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c0_int_odl))) {
- if (!tcpc_read16(0, TCPC_REG_ALERT, &regval)) {
- /* The TCPCI Rev 1.0 spec says to ignore bits 14:12. */
- if (!(tcpc_config[0].flags & TCPC_FLAGS_TCPCI_REV2_0))
- regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
-
- if (regval)
- status |= PD_STATUS_TCPC_ALERT_0;
- }
- }
-
- if (board_get_usb_pd_port_count() == 2 &&
- !gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_usb_c1_int_odl))) {
- if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
- /* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
- if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
- regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
-
- if (regval)
- status |= PD_STATUS_TCPC_ALERT_1;
- }
- }
-
- return status;
-}
-
-void pd_power_supply_reset(int port)
-{
- /* Disable VBUS */
- tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-}
-
-/* VBUS_CURRENT_TARGET */
-#define RAA489000_VBUS_CURRENT_TARGET_3_3A 0x68 /* 3.3A */
-
-__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
-{
- int rv;
-
- if (port < 0 || port >= CONFIG_USB_PD_PORT_MAX_COUNT)
- return;
-
- int selected_cur = rp == TYPEC_RP_3A0 ?
- RAA489000_VBUS_CURRENT_TARGET_3_3A :
- RAA489000_VBUS_CURRENT_TARGET_1_5A;
-
- rv = tcpc_write16(port, RAA489000_VBUS_CURRENT_TARGET, selected_cur);
-
- if (rv != EC_SUCCESS) {
- LOG_WRN("Failed to set source ilimit on port %d to %d: %d",
- port, selected_cur, rv);
- }
-}
-
-int pd_set_power_supply_ready(int port)
-{
- int rv;
-
- if (port >= CONFIG_USB_PD_PORT_MAX_COUNT)
- return EC_ERROR_INVAL;
-
- /* Disable charging. */
- rv = tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
- if (rv)
- return rv;
-
- /* Our policy is not to source VBUS when the AP is off. */
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
- return EC_ERROR_NOT_POWERED;
-
- /* Provide Vbus. */
- rv = tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_HIGH);
- if (rv)
- return rv;
-
- rv = raa489000_enable_asgate(port, true);
- if (rv)
- return rv;
-
- /* Notify host of power info change. */
- pd_send_host_event(PD_EVENT_POWER_CHANGE);
-
- return EC_SUCCESS;
-}
-
-void board_reset_pd_mcu(void)
-{
- /*
- * TODO(b:147316511): could send a reset command to the TCPC here
- * if needed.
- */
-}
-
-/*
- * Because the TCPCs and BC1.2 chips share interrupt lines, it's possible
- * for an interrupt to be lost if one asserts the IRQ, the other does the same
- * then the first releases it: there will only be one falling edge to trigger
- * the interrupt, and the line will be held low. We handle this by running a
- * deferred check after a falling edge to see whether the IRQ is still being
- * asserted. If it is, we assume an interrupt may have been lost and we need
- * to poll each chip for events again.
- */
-#define USBC_INT_POLL_DELAY_US 5000
-
-static void poll_c0_int(void);
-DECLARE_DEFERRED(poll_c0_int);
-static void poll_c1_int(void);
-DECLARE_DEFERRED(poll_c1_int);
-
-static void usbc_interrupt_trigger(int port)
-{
- schedule_deferred_pd_interrupt(port);
- usb_charger_task_set_event(port, USB_CHG_EVENT_BC12);
-}
-
-static inline void poll_usb_gpio(int port, const struct gpio_dt_spec *gpio,
- const struct deferred_data *ud)
-{
- if (!gpio_pin_get_dt(gpio)) {
- usbc_interrupt_trigger(port);
- hook_call_deferred(ud, USBC_INT_POLL_DELAY_US);
- }
-}
-
-static void poll_c0_int(void)
-{
- poll_usb_gpio(0, GPIO_DT_FROM_NODELABEL(gpio_usb_c0_int_odl),
- &poll_c0_int_data);
-}
-
-static void poll_c1_int(void)
-{
- poll_usb_gpio(1, GPIO_DT_FROM_ALIAS(gpio_usb_c1_int_odl),
- &poll_c1_int_data);
-}
-
-void usb_interrupt(enum gpio_signal signal)
-{
- int port;
- const struct deferred_data *ud;
-
- if (signal == GPIO_SIGNAL(DT_NODELABEL(gpio_usb_c0_int_odl))) {
- port = 0;
- ud = &poll_c0_int_data;
- } else {
- port = 1;
- ud = &poll_c1_int_data;
- }
- /*
- * We've just been called from a falling edge, so there's definitely
- * no lost IRQ right now. Cancel any pending check.
- */
- hook_call_deferred(ud, -1);
- /* Trigger polling of TCPC and BC1.2 in respective tasks */
- usbc_interrupt_trigger(port);
- /* Check for lost interrupts in a bit */
- hook_call_deferred(ud, USBC_INT_POLL_DELAY_US);
-}
-
-struct chg_curr_step {
- int on;
- int off;
- int curr_ma;
-};
-
-static const struct chg_curr_step chg_curr_table[] = {
- { .on = 0, .off = 36, .curr_ma = 2800 },
- { .on = 46, .off = 36, .curr_ma = 1500 },
- { .on = 48, .off = 38, .curr_ma = 1000 },
-};
-
-/* All charge current tables must have the same number of levels */
-#define NUM_CHG_CURRENT_LEVELS ARRAY_SIZE(chg_curr_table)
-
-int charger_profile_override(struct charge_state_data *curr)
-{
- int rv;
- int chg_temp_c;
- int current;
- int thermal_sensor0;
- static int current_level;
- static int prev_tmp;
-
- /*
- * Precharge must be executed when communication is failed on
- * dead battery.
- */
- if (!(curr->batt.flags & BATT_FLAG_RESPONSIVE))
- return 0;
-
- current = curr->requested_current;
-
- rv = temp_sensor_read(
- TEMP_SENSOR_ID_BY_DEV(DT_NODELABEL(temp_charger1)),
- &thermal_sensor0);
- chg_temp_c = K_TO_C(thermal_sensor0);
-
- if (rv != EC_SUCCESS)
- return 0;
-
- if (chipset_in_state(CHIPSET_STATE_ON)) {
- if (chg_temp_c < prev_tmp) {
- if (chg_temp_c <= chg_curr_table[current_level].off)
- current_level = current_level - 1;
- } else if (chg_temp_c > prev_tmp) {
- if (chg_temp_c >= chg_curr_table[current_level + 1].on)
- current_level = current_level + 1;
- }
- /*
- * Prevent level always minus 0 or over table steps.
- */
- if (current_level < 0)
- current_level = 0;
- else if (current_level >= NUM_CHG_CURRENT_LEVELS)
- current_level = NUM_CHG_CURRENT_LEVELS - 1;
-
- prev_tmp = chg_temp_c;
- current = chg_curr_table[current_level].curr_ma;
-
- curr->requested_current = MIN(curr->requested_current, current);
- }
- return 0;
-}
-
-enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
-{
- return EC_RES_INVALID_PARAM;
-}
-
-enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
-{
- return EC_RES_INVALID_PARAM;
-}
diff --git a/zephyr/program/nissa/xivur/cbi.dtsi b/zephyr/program/nissa/xivur/cbi.dtsi
deleted file mode 100644
index 112a2a885c..0000000000
--- a/zephyr/program/nissa/xivur/cbi.dtsi
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- /* Nivviks-specific fw_config fields. */
- nissa-fw-config {
- /*
- * FW_CONFIG field to describe mainboard orientation in chassis.
- */
- base-inversion {
- enum-name = "FW_BASE_INVERSION";
- start = <3>;
- size = <1>;
-
- inverted {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_BASE_INVERTED";
- value = <0>;
- };
- regular {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_BASE_REGULAR";
- value = <1>;
- default;
- };
- };
- };
-};
diff --git a/zephyr/program/nissa/xivur/generated.dtsi b/zephyr/program/nissa/xivur/generated.dtsi
deleted file mode 100644
index 91718302b4..0000000000
--- a/zephyr/program/nissa/xivur/generated.dtsi
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * This file is auto-generated - do not edit!
- */
-
-/ {
-
- named-adc-channels {
- compatible = "named-adc-channels";
-
- adc_ec_vsense_pp1050_proc: ec_vsense_pp1050_proc {
- enum-name = "ADC_PP1050_PROC";
- io-channels = <&adc0 4>;
- };
- adc_ec_vsense_pp3300_s5: ec_vsense_pp3300_s5 {
- enum-name = "ADC_PP3300_S5";
- io-channels = <&adc0 6>;
- };
- adc_temp_sensor_1: temp_sensor_1 {
- enum-name = "ADC_TEMP_SENSOR_1";
- io-channels = <&adc0 0>;
- };
- adc_temp_sensor_2: temp_sensor_2 {
- enum-name = "ADC_TEMP_SENSOR_2";
- io-channels = <&adc0 1>;
- };
- adc_temp_sensor_3: temp_sensor_3 {
- enum-name = "ADC_TEMP_SENSOR_3";
- io-channels = <&adc0 10>;
- };
- };
-
- named-gpios {
- compatible = "named-gpios";
-
- gpio_acc_int_l: acc_int_l {
- gpios = <&gpio5 0 GPIO_INPUT>;
- };
- gpio_all_sys_pwrgd: all_sys_pwrgd {
- gpios = <&gpioa 7 GPIO_INPUT>;
- };
- gpio_ccd_mode_odl: ccd_mode_odl {
- gpios = <&gpioe 5 GPIO_INPUT>;
- enum-name = "GPIO_CCD_MODE_ODL";
- };
- gpio_cpu_c10_gate_l: cpu_c10_gate_l {
- gpios = <&gpio6 7 GPIO_INPUT>;
- };
- gpio_ec_battery_pres_odl: ec_battery_pres_odl {
- gpios = <&gpioa 3 GPIO_INPUT>;
- enum-name = "GPIO_BATT_PRES_ODL";
- };
- gpio_ec_cbi_wp: ec_cbi_wp {
- gpios = <&gpio7 4 GPIO_OUTPUT>;
- };
- gpio_ec_edp_bl_en_od: ec_edp_bl_en_od {
- gpios = <&gpiod 3 GPIO_ODR_HIGH>;
- enum-name = "GPIO_ENABLE_BACKLIGHT";
- };
- gpio_ec_entering_rw: ec_entering_rw {
- gpios = <&gpio0 3 GPIO_OUTPUT>;
- enum-name = "GPIO_ENTERING_RW";
- };
- gpio_ec_gsc_packet_mode: ec_gsc_packet_mode {
- gpios = <&gpio7 5 GPIO_OUTPUT>;
- enum-name = "GPIO_PACKET_MODE_EN";
- };
- gpio_ec_kso_02_inv: ec_kso_02_inv {
- gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>;
- };
- gpio_ec_pch_wake_odl: ec_pch_wake_odl {
- gpios = <&gpiob 0 GPIO_ODR_LOW>;
- };
- gpio_ec_prochot_odl: ec_prochot_odl {
- gpios = <&gpiof 1 GPIO_ODR_HIGH>;
- };
- gpio_ec_soc_dsw_pwrok: ec_soc_dsw_pwrok {
- gpios = <&gpio6 1 GPIO_OUTPUT>;
- };
- gpio_ec_soc_hdmi_hpd: ec_soc_hdmi_hpd {
- gpios = <&gpioe 4 GPIO_OUTPUT>;
- };
- gpio_ec_soc_int_odl: ec_soc_int_odl {
- gpios = <&gpio8 0 GPIO_ODR_HIGH>;
- enum-name = "GPIO_EC_INT_L";
- };
- gpio_ec_soc_pch_pwrok_od: ec_soc_pch_pwrok_od {
- gpios = <&gpio7 2 GPIO_ODR_HIGH>;
- };
- gpio_ec_soc_pwr_btn_odl: ec_soc_pwr_btn_odl {
- gpios = <&gpioc 1 GPIO_ODR_HIGH>;
- enum-name = "GPIO_PCH_PWRBTN_L";
- };
- gpio_ec_soc_rsmrst_l: ec_soc_rsmrst_l {
- gpios = <&gpioa 6 GPIO_OUTPUT>;
- };
- gpio_ec_soc_rtcrst: ec_soc_rtcrst {
- gpios = <&gpio7 6 GPIO_OUTPUT>;
- };
- gpio_ec_soc_sys_pwrok: ec_soc_sys_pwrok {
- gpios = <&gpio3 7 GPIO_OUTPUT>;
- };
- gpio_ec_soc_vccst_pwrgd_od: ec_soc_vccst_pwrgd_od {
- gpios = <&gpioa 4 GPIO_ODR_HIGH>;
- };
- gpio_ec_wp_odl: ec_wp_odl {
- gpios = <&gpioa 1 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
- };
- gpio_en_kb_bl: en_kb_bl {
- gpios = <&gpioa 0 GPIO_OUTPUT>;
- enum-name = "GPIO_EN_KEYBOARD_BACKLIGHT";
- };
- gpio_en_pp3300_s5: en_pp3300_s5 {
- gpios = <&gpiob 6 GPIO_OUTPUT>;
- enum-name = "GPIO_TEMP_SENSOR_POWER";
- };
- gpio_en_pp5000_pen_x: en_pp5000_pen_x {
- gpios = <&gpioe 2 GPIO_OUTPUT>;
- };
- gpio_en_pp5000_s5: en_pp5000_s5 {
- gpios = <&gpio4 0 GPIO_OUTPUT>;
- };
- gpio_en_slp_z: en_slp_z {
- gpios = <&gpioe 1 GPIO_OUTPUT>;
- };
- gpio_en_usb_a0_vbus: en_usb_a0_vbus {
- gpios = <&gpio9 1 GPIO_OUTPUT>;
- };
- gpio_gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl {
- gpios = <&gpio0 0 GPIO_INPUT_PULL_UP>;
- enum-name = "GPIO_POWER_BUTTON_L";
- };
- gpio_hdmi_sel: hdmi_sel {
- gpios = <&gpioc 6 GPIO_OUTPUT>;
- };
- gpio_imu_int_l: imu_int_l {
- gpios = <&gpio5 6 GPIO_INPUT>;
- };
- gpio_imvp91_vrrdy_od: imvp91_vrrdy_od {
- gpios = <&gpio4 3 GPIO_INPUT>;
- };
- gpio_lid_open: lid_open {
- gpios = <&gpiod 2 GPIO_INPUT>;
- enum-name = "GPIO_LID_OPEN";
- };
- gpio_pen_detect_odl: pen_detect_odl {
- gpios = <&gpio9 6 GPIO_INPUT_PULL_UP>;
- };
- gpio_pg_pp1050_mem_s3_od: pg_pp1050_mem_s3_od {
- gpios = <&gpiof 0 GPIO_INPUT>;
- };
- gpio_pg_pp5000_s5_od: pg_pp5000_s5_od {
- gpios = <&gpio4 2 GPIO_INPUT>;
- };
- gpio_rsmrst_pwrgd_l: rsmrst_pwrgd_l {
- gpios = <&gpio9 4 GPIO_INPUT_PULL_UP>;
- };
- gpio_slp_s0_l: slp_s0_l {
- gpios = <&gpio9 7 GPIO_INPUT>;
- };
- gpio_slp_s3_l: slp_s3_l {
- gpios = <&gpioa 5 GPIO_INPUT>;
- };
- gpio_slp_s4_l: slp_s4_l {
- gpios = <&gpio7 0 GPIO_INPUT>;
- };
- gpio_slp_sus_l: slp_sus_l {
- gpios = <&gpio6 2 GPIO_INPUT>;
- };
- gpio_sub_usb_a1_ilimit_sdp: sub_usb_a1_ilimit_sdp {
- gpios = <&gpiod 5 GPIO_OUTPUT>;
- enum-name = "GPIO_USB2_ILIM_SEL";
- };
- gpio_sys_rst_odl: sys_rst_odl {
- gpios = <&gpioc 5 GPIO_ODR_HIGH>;
- };
- gpio_tablet_mode_l: tablet_mode_l {
- gpios = <&gpio9 5 GPIO_INPUT>;
- enum-name = "GPIO_TABLET_MODE_L";
- };
- gpio_usb_a0_ilimit_sdp: usb_a0_ilimit_sdp {
- gpios = <&gpio8 5 GPIO_OUTPUT>;
- enum-name = "GPIO_USB1_ILIM_SEL";
- };
- gpio_usb_c0_int_odl: usb_c0_int_odl {
- gpios = <&gpio0 1 GPIO_INPUT_PULL_UP>;
- };
- gpio_vccin_aux_vid0: vccin_aux_vid0 {
- gpios = <&gpio9 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- gpio_vccin_aux_vid1: vccin_aux_vid1 {
- gpios = <&gpioe 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- gpio_voldn_btn_odl: voldn_btn_odl {
- gpios = <&gpioa 2 GPIO_INPUT_PULL_UP>;
- enum-name = "GPIO_VOLUME_DOWN_L";
- };
- gpio_volup_btn_odl: volup_btn_odl {
- gpios = <&gpio9 3 GPIO_INPUT_PULL_UP>;
- enum-name = "GPIO_VOLUME_UP_L";
- };
- };
-
- named-i2c-ports {
- compatible = "named-i2c-ports";
-
- i2c_ec_i2c_eeprom: ec_i2c_eeprom {
- i2c-port = <&i2c0_0>;
- enum-names = "I2C_PORT_EEPROM";
- };
- i2c_ec_i2c_sensor: ec_i2c_sensor {
- i2c-port = <&i2c1_0>;
- enum-names = "I2C_PORT_SENSOR";
- };
- i2c_ec_i2c_usb_c0: ec_i2c_usb_c0 {
- i2c-port = <&i2c3_0>;
- enum-names = "I2C_PORT_USB_C0_TCPC";
- };
- i2c_ec_i2c_sub_usb_c1: ec_i2c_sub_usb_c1 {
- i2c-port = <&i2c5_1>;
- enum-names = "I2C_PORT_USB_C1_TCPC";
- };
- i2c_ec_i2c_batt: ec_i2c_batt {
- i2c-port = <&i2c7_0>;
- enum-names = "I2C_PORT_BATTERY";
- };
- };
-};
-
-&adc0 {
- status = "okay";
- pinctrl-0 = <&adc0_chan0_gp45
- &adc0_chan1_gp44
- &adc0_chan4_gp41
- &adc0_chan6_gp34
- &adc0_chan10_gpe0>;
- pinctrl-names = "default";
-};
-
-
-&i2c0_0 {
- status = "okay";
- pinctrl-0 = <&i2c0_0_sda_scl_gpb4_b5>;
- pinctrl-names = "default";
-};
-
-&i2c1_0 {
- status = "okay";
- pinctrl-0 = <&i2c1_0_sda_scl_gp87_90>;
- pinctrl-names = "default";
-};
-
-&i2c3_0 {
- status = "okay";
- pinctrl-0 = <&i2c3_0_sda_scl_gpd0_d1>;
- pinctrl-names = "default";
-};
-
-&i2c5_1 {
- status = "okay";
- pinctrl-0 = <&i2c5_1_sda_scl_gpf4_f5>;
- pinctrl-names = "default";
-};
-
-&i2c7_0 {
- status = "okay";
- pinctrl-0 = <&i2c7_0_sda_scl_gpb2_b3>;
- pinctrl-names = "default";
-};
-
-&i2c_ctrl0 {
- status = "okay";
-};
-
-&i2c_ctrl1 {
- status = "okay";
-};
-
-&i2c_ctrl3 {
- status = "okay";
-};
-
-&i2c_ctrl5 {
- status = "okay";
-};
-
-&i2c_ctrl7 {
- status = "okay";
-};
diff --git a/zephyr/program/nissa/xivur/keyboard.dtsi b/zephyr/program/nissa/xivur/keyboard.dtsi
deleted file mode 100644
index 00610e4e18..0000000000
--- a/zephyr/program/nissa/xivur/keyboard.dtsi
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- kblight {
- compatible = "cros-ec,kblight-pwm";
- pwms = <&pwm6 6 PWM_HZ(2400) PWM_POLARITY_NORMAL>;
- };
-};
-
-&pwm6 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm6_gpc0>;
- pinctrl-names = "default";
-};
-
-&cros_kb_raw {
- status = "okay";
- /* No KSO2 (it's inverted and implemented by GPIO) */
- pinctrl-0 = <
- &ksi0_gp31
- &ksi1_gp30
- &ksi2_gp27
- &ksi3_gp26
- &ksi4_gp25
- &ksi5_gp24
- &ksi6_gp23
- &ksi7_gp22
- &kso00_gp21
- &kso01_gp20
- &kso03_gp16
- &kso04_gp15
- &kso05_gp14
- &kso06_gp13
- &kso07_gp12
- &kso08_gp11
- &kso09_gp10
- &kso10_gp07
- &kso11_gp06
- &kso12_gp05
- &kso13_gp04
- &kso14_gp82
- >;
- pinctrl-names = "default";
-};
diff --git a/zephyr/program/nissa/xivur/power_signals.dtsi b/zephyr/program/nissa/xivur/power_signals.dtsi
deleted file mode 100644
index 1d2b23069d..0000000000
--- a/zephyr/program/nissa/xivur/power_signals.dtsi
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- chosen {
- intel-ap-pwrseq,espi = &espi0;
- };
-
- common-pwrseq {
- compatible = "intel,ap-pwrseq";
-
- sys-pwrok-delay = <10>;
- all-sys-pwrgd-timeout = <20>;
- };
-
- pwr-en-pp5000-s5 {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "PP5000_S5 enable output to regulator";
- enum-name = "PWR_EN_PP5000_A";
- gpios = <&gpio4 0 0>;
- output;
- };
- pwr-en-pp3300-s5 {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "PP3300_S5 enable output to LS";
- enum-name = "PWR_EN_PP3300_A";
- gpios = <&gpiob 6 0>;
- output;
- };
- pwr-pg-ec-rsmrst-od {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "RSMRST power good from regulator";
- enum-name = "PWR_RSMRST";
- gpios = <&gpio9 4 0>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- pwr-ec-pch-rsmrst-odl {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "RSMRST output to PCH";
- enum-name = "PWR_EC_PCH_RSMRST";
- gpios = <&gpioa 6 0>;
- output;
- };
- pwr-slp-s0-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SLP_S0_L input from PCH";
- enum-name = "PWR_SLP_S0";
- gpios = <&gpio9 7 GPIO_ACTIVE_LOW>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- pwr-slp-s3-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SLP_S3_L input from PCH";
- enum-name = "PWR_SLP_S3";
- gpios = <&gpioa 5 GPIO_ACTIVE_LOW>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- pwr-slp-sus-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SLP_SUS_L input from PCH";
- enum-name = "PWR_SLP_SUS";
- gpios = <&gpio6 2 GPIO_ACTIVE_LOW>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- pwr-ec-soc-dsw-pwrok {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "DSW_PWROK output to PCH";
- enum-name = "PWR_EC_SOC_DSW_PWROK";
- gpios = <&gpio6 1 0>;
- output;
- };
- pwr-vccst-pwrgd-od {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "VCCST_PWRGD output to PCH";
- enum-name = "PWR_VCCST_PWRGD";
- gpios = <&gpioa 4 GPIO_OPEN_DRAIN>;
- output;
- };
- pwr-imvp9-vrrdy-od {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "VRRDY input from IMVP9";
- enum-name = "PWR_IMVP9_VRRDY";
- gpios = <&gpio4 3 0>;
- };
- pwr-pch-pwrok {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "PCH_PWROK output to PCH";
- enum-name = "PWR_PCH_PWROK";
- gpios = <&gpio7 2 GPIO_OPEN_DRAIN>;
- output;
- };
- pwr-ec-pch-sys-pwrok {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SYS_PWROK output to PCH";
- enum-name = "PWR_EC_PCH_SYS_PWROK";
- gpios = <&gpio3 7 0>;
- output;
- };
- pwr-sys-rst-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SYS_RESET# output to PCH";
- enum-name = "PWR_SYS_RST";
- gpios = <&gpioc 5 (GPIO_ACTIVE_LOW|GPIO_OPEN_DRAIN)>;
- output;
- };
- pwr-slp-s4 {
- compatible = "intel,ap-pwrseq-vw";
- dbg-label = "SLP_S4 virtual wire input from PCH";
- enum-name = "PWR_SLP_S4";
- virtual-wire = "ESPI_VWIRE_SIGNAL_SLP_S4";
- vw-invert;
- };
- pwr-slp-s5 {
- compatible = "intel,ap-pwrseq-vw";
- dbg-label = "SLP_S5 virtual wire input from PCH";
- enum-name = "PWR_SLP_S5";
- virtual-wire = "ESPI_VWIRE_SIGNAL_SLP_S5";
- vw-invert;
- };
- pwr-all-sys-pwrgd {
- compatible = "intel,ap-pwrseq-external";
- dbg-label = "Combined all power good";
- enum-name = "PWR_ALL_SYS_PWRGD";
- };
- pwr-adc-pp3300 {
- compatible = "intel,ap-pwrseq-adc";
- dbg-label = "PP3300 PWROK (from ADC)";
- enum-name = "PWR_DSW_PWROK";
- trigger-high = <&cmp_pp3300_s5_high>;
- trigger-low = <&cmp_pp3300_s5_low>;
- };
- pwr-adc-pp1p05 {
- compatible = "intel,ap-pwrseq-adc";
- dbg-label = "PP1P05 PWROK (from ADC)";
- enum-name = "PWR_PG_PP1P05";
- trigger-high = <&cmp_pp1p05_high>;
- trigger-low = <&cmp_pp1p05_low>;
- };
-
- adc-cmp {
- cmp_pp3300_s5_high: pp3300_high {
- compatible = "nuvoton,adc-cmp";
- io-channels = <&adc0 6>;
- comparison = "ADC_CMP_NPCX_GREATER";
- /*
- * This is 90% of nominal voltage considering voltage
- * divider on ADC input.
- */
- threshold-mv = <2448>;
- };
- cmp_pp3300_s5_low: pp3300_low {
- compatible = "nuvoton,adc-cmp";
- io-channels = <&adc0 6>;
- comparison = "ADC_CMP_NPCX_LESS_OR_EQUAL";
- threshold-mv = <2448>;
- };
- cmp_pp1p05_high: pp1p05_high {
- compatible = "nuvoton,adc-cmp";
- io-channels = <&adc0 4>;
- comparison = "ADC_CMP_NPCX_GREATER";
- /* Setting at 90% of nominal voltage */
- threshold-mv = <945>;
- };
- cmp_pp1p05_low: pp1p05_low {
- compatible = "nuvoton,adc-cmp";
- io-channels = <&adc0 4>;
- comparison = "ADC_CMP_NPCX_LESS_OR_EQUAL";
- threshold-mv = <945>;
- };
- };
-};
-
-/*
- * Because the power signals directly reference the GPIOs,
- * the correspinding named-gpios need to have no-auto-init set.
- */
-&gpio_ec_soc_dsw_pwrok {
- no-auto-init;
-};
-&gpio_ec_soc_pch_pwrok_od {
- no-auto-init;
-};
-&gpio_ec_soc_rsmrst_l {
- no-auto-init;
-};
-&gpio_ec_soc_sys_pwrok {
- no-auto-init;
-};
-&gpio_ec_soc_vccst_pwrgd_od {
- no-auto-init;
-};
-&gpio_en_pp3300_s5 {
- no-auto-init;
-};
-&gpio_en_pp5000_s5 {
- no-auto-init;
-};
-&gpio_imvp91_vrrdy_od {
- no-auto-init;
-};
-&gpio_rsmrst_pwrgd_l {
- no-auto-init;
-};
-&gpio_slp_s0_l {
- no-auto-init;
-};
-&gpio_slp_s3_l {
- no-auto-init;
-};
-&gpio_slp_s4_l {
- no-auto-init;
-};
-&gpio_slp_sus_l {
- no-auto-init;
-};
-&gpio_sys_rst_odl {
- no-auto-init;
-};
diff --git a/zephyr/program/nissa/xivur/pwm_leds.dtsi b/zephyr/program/nissa/xivur/pwm_leds.dtsi
deleted file mode 100644
index a265a5929e..0000000000
--- a/zephyr/program/nissa/xivur/pwm_leds.dtsi
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- pwmleds {
- compatible = "pwm-leds";
- pwm_led0: pwm_led_0 {
- pwms = <&pwm2 2 PWM_HZ(324) PWM_POLARITY_INVERTED>,
- <&pwm0 0 PWM_HZ(324) PWM_POLARITY_INVERTED>,
- <&pwm1 1 PWM_HZ(324) PWM_POLARITY_INVERTED>;
- };
- };
-
- cros-pwmleds {
- compatible = "cros-ec,pwm-leds";
-
- leds = <&pwm_led0>;
-
- /*<red green blue>*/
- color-map-red = <100 0 0>;
- color-map-green = < 0 100 0>;
- color-map-blue = < 0 0 100>;
- color-map-yellow = < 0 50 50>;
- color-map-white = <100 100 100>;
- color-map-amber = <100 0 0>;
-
- brightness-range = <0 0 100 0 0 100>;
-
- #address-cells = <1>;
- #size-cells = <0>;
-
- pwm_led_0@0 {
- reg = <0>;
- ec-led-name = "EC_LED_ID_BATTERY_LED";
- };
- };
-};
-
-/* Enable LEDs to work while CPU suspended */
-
-&pwm0 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm0_gpc3>;
- pinctrl-names = "default";
-};
-
-&pwm1 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm1_gpc2>;
- pinctrl-names = "default";
-};
-
-&pwm2 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm2_gpc4>;
- pinctrl-names = "default";
-};
diff --git a/zephyr/program/nissa/xivur/src/charger.c b/zephyr/program/nissa/xivur/src/charger.c
deleted file mode 100644
index 9dadb0f42f..0000000000
--- a/zephyr/program/nissa/xivur/src/charger.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <zephyr/logging/log.h>
-
-#include "battery.h"
-#include "charger.h"
-#include "charger/isl923x_public.h"
-#include "console.h"
-#include "extpower.h"
-#include "usb_pd.h"
-#include "nissa_common.h"
-
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-int extpower_is_present(void)
-{
- int port;
- int rv;
- bool acok;
-
- for (port = 0; port < board_get_usb_pd_port_count(); port++) {
- rv = raa489000_is_acok(port, &acok);
- if ((rv == EC_SUCCESS) && acok)
- return 1;
- }
-
- return 0;
-}
-
-/*
- * Nivviks does not have a GPIO indicating whether extpower is present,
- * so detect using the charger(s).
- */
-__override void board_check_extpower(void)
-{
- static int last_extpower_present;
- int extpower_present = extpower_is_present();
-
- if (last_extpower_present ^ extpower_present)
- extpower_handle_update(extpower_present);
-
- last_extpower_present = extpower_present;
-}
-
-__override void board_hibernate(void)
-{
- /* Shut down the chargers */
- if (board_get_usb_pd_port_count() == 2)
- raa489000_hibernate(CHARGER_SECONDARY, true);
- raa489000_hibernate(CHARGER_PRIMARY, true);
- LOG_INF("Charger(s) hibernated");
- cflush();
-}
diff --git a/zephyr/program/nissa/xivur/src/led.c b/zephyr/program/nissa/xivur/src/led.c
deleted file mode 100644
index 9087982604..0000000000
--- a/zephyr/program/nissa/xivur/src/led.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Battery LED control for nissa
- */
-#include "common.h"
-#include "ec_commands.h"
-#include "led_common.h"
-#include "led_onoff_states.h"
-#include "led_pwm.h"
-
-__override const int led_charge_lvl_1 = 5;
-__override const int led_charge_lvl_2 = 97;
-__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
- LED_INDEFINITE } },
- [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
- LED_INDEFINITE } },
- [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
- LED_INDEFINITE } },
- [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
- LED_INDEFINITE } },
- [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
- LED_INDEFINITE } },
- [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
- [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
- [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
- 1 * LED_ONE_SEC },
- { LED_OFF, 1 * LED_ONE_SEC } },
- [STATE_FACTORY_TEST] = { { EC_LED_COLOR_AMBER,
- 2 * LED_ONE_SEC },
- { EC_LED_COLOR_BLUE,
- 2 * LED_ONE_SEC } },
- };
-
-__override void led_set_color_battery(enum ec_led_colors color)
-{
- switch (color) {
- case EC_LED_COLOR_BLUE:
- set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_BLUE);
- break;
- case EC_LED_COLOR_AMBER:
- set_pwm_led_color(EC_LED_ID_BATTERY_LED, EC_LED_COLOR_AMBER);
- break;
- default: /* LED_OFF and other unsupported colors */
- set_pwm_led_color(EC_LED_ID_BATTERY_LED, -1);
- break;
- }
-}
diff --git a/zephyr/program/nissa/yaviks/fan.dtsi b/zephyr/program/nissa/yaviks/fan.dtsi
deleted file mode 100644
index 229530b57a..0000000000
--- a/zephyr/program/nissa/yaviks/fan.dtsi
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-/ {
- fans {
- compatible = "cros-ec,fans";
- fan_0 {
- pwms = <&pwm2 PWM_CHANNEL_2 PWM_KHZ(25) PWM_POLARITY_NORMAL>;
- tach = <&tach1>;
- rpm_min = <2500>;
- rpm_start = <2500>;
- rpm_max = <4100>;
- rpm_deviation = <1>;
- enable_gpio = <&gpio_fan_enable>;
- };
- };
- fan_steps {
- compatible = "cros-ec,fan-steps";
- level_0 {
- temp_on = <44 47 0>;
- temp_off = <99 99 99>;
- rpm_target = <0>;
- };
- level_1 {
- temp_on = <48 48 0>;
- temp_off = <43 45 99>;
- rpm_target = <2600>;
- };
- level_2 {
- temp_on = <50 49 0>;
- temp_off = <47 46 99>;
- rpm_target = <2800>;
- };
- level_3 {
- temp_on = <52 50 54>;
- temp_off = <49 47 51>;
- rpm_target = <3000>;
- };
- level_4 {
- temp_on = <54 56 60>;
- temp_off = <51 48 52>;
- rpm_target = <3300>;
- };
- level_5 {
- temp_on = <60 60 64>;
- temp_off = <53 52 56>;
- rpm_target = <3600>;
- };
- level_6 {
- temp_on = <100 100 100>;
- temp_off = <59 54 58>;
- rpm_target = <4100>;
- };
- };
-};
-/* pwm for fan */
-&pwm2 {
- status = "okay";
- prescaler-cx = <PWM_PRESCALER_C6>;
- pinctrl-0 = <&pwm2_gpa2_default>;
- pinctrl-names = "default";
-};
-/* fan tachometer sensor */
-&tach1 {
- status = "okay";
- channel = <IT8XXX2_TACH_CHANNEL_A>;
- pulses-per-round = <2>;
- pinctrl-0 = <&tach1a_gpd7_default>;
- pinctrl-names = "default";
-};
diff --git a/zephyr/program/nissa/yaviks/src/fan.c b/zephyr/program/nissa/yaviks/src/fan.c
deleted file mode 100644
index c01ee3d752..0000000000
--- a/zephyr/program/nissa/yaviks/src/fan.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "cros_cbi.h"
-#include "fan.h"
-#include "gpio/gpio.h"
-#include "hooks.h"
-#include "nissa_common.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
-
-static void fan_init(void)
-{
- int ret;
- uint32_t val;
- /*
- * Retrieve the fan config.
- */
- ret = cros_cbi_get_fw_config(FW_FAN, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_FAN);
- return;
- }
- if (val != FW_FAN_PRESENT) {
- /* Disable the fan */
- fan_set_count(0);
- } else {
- /* Configure the fan enable GPIO */
- gpio_pin_configure_dt(GPIO_DT_FROM_NODELABEL(gpio_fan_enable),
- GPIO_OUTPUT);
- }
-}
-DECLARE_HOOK(HOOK_INIT, fan_init, HOOK_PRIO_POST_FIRST);
diff --git a/zephyr/program/nissa/yaviks/src/thermal.c b/zephyr/program/nissa/yaviks/src/thermal.c
deleted file mode 100644
index a22a9a74c0..0000000000
--- a/zephyr/program/nissa/yaviks/src/thermal.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-#include "fan.h"
-#include "temp_sensor/temp_sensor.h"
-#include "thermal.h"
-#include "util.h"
-
-#include <ap_power/ap_power_interface.h>
-
-#define TEMP_CPU TEMP_SENSOR_ID(DT_NODELABEL(temp_cpu))
-#define TEMP_5V TEMP_SENSOR_ID(DT_NODELABEL(temp_5v_regulator))
-#define TEMP_CHARGER TEMP_SENSOR_ID(DT_NODELABEL(temp_charger))
-
-struct fan_step {
- /*
- * Sensor 1~3 trigger point, set -1 if we're not using this
- * sensor to determine fan speed.
- */
- int8_t on[TEMP_SENSOR_COUNT];
- /*
- * Sensor 1~3 trigger point, set -1 if we're not using this
- * sensor to determine fan speed.
- */
- int8_t off[TEMP_SENSOR_COUNT];
- /* Fan rpm */
- uint16_t rpm[FAN_CH_COUNT];
-};
-
-#define FAN_TABLE_ENTRY(nd) \
- { \
- .on = DT_PROP(nd, temp_on), \
- .off = DT_PROP(nd, temp_off), \
- .rpm = DT_PROP(nd, rpm_target), \
- },
-
-static const struct fan_step fan_step_table[] = { DT_FOREACH_CHILD(
- DT_INST(0, cros_ec_fan_steps), FAN_TABLE_ENTRY) };
-
-int fan_table_to_rpm(int fan, int *temp)
-{
- /* current fan level */
- static int current_level;
- /* previous sensor temperature */
- static int prev_tmp[TEMP_SENSOR_COUNT];
- int i;
- /*
- * Compare the current and previous temperature, we have
- * the three paths :
- * 1. decreasing path. (check the release point)
- * 2. increasing path. (check the trigger point)
- * 3. invariant path. (return the current RPM)
- *
- * Yaviks thermal table V1-1
- * Increase path judgment: CPU || (5V && Charger)
- * Decrease path judgment: CPU && 5V && Charger
- */
- if (temp[TEMP_CPU] < prev_tmp[TEMP_CPU] ||
- temp[TEMP_5V] < prev_tmp[TEMP_5V] ||
- temp[TEMP_CHARGER] < prev_tmp[TEMP_CHARGER]) {
- for (i = current_level; i > 0; i--) {
- if (temp[TEMP_CPU] < fan_step_table[i].off[TEMP_CPU] &&
- temp[TEMP_5V] < fan_step_table[i].off[TEMP_5V] &&
- temp[TEMP_CHARGER] <
- fan_step_table[i].off[TEMP_CHARGER]) {
- current_level = i - 1;
- } else
- break;
- }
- } else if (temp[TEMP_CPU] > prev_tmp[TEMP_CPU] ||
- temp[TEMP_5V] > prev_tmp[TEMP_5V] ||
- temp[TEMP_CHARGER] > prev_tmp[TEMP_CHARGER]) {
- for (i = current_level; i < ARRAY_SIZE(fan_step_table); i++) {
- if (temp[TEMP_CPU] > fan_step_table[i].on[TEMP_CPU] ||
- (temp[TEMP_5V] > fan_step_table[i].on[TEMP_5V] &&
- temp[TEMP_CHARGER] >
- fan_step_table[i].on[TEMP_CHARGER])) {
- current_level = i + 1;
- } else
- break;
- }
- }
- if (current_level < 0)
- current_level = 0;
-
- if (current_level >= ARRAY_SIZE(fan_step_table))
- current_level = ARRAY_SIZE(fan_step_table) - 1;
-
- for (i = 0; i < TEMP_SENSOR_COUNT; ++i)
- prev_tmp[i] = temp[i];
-
- return fan_step_table[current_level].rpm[fan];
-}
-
-void board_override_fan_control(int fan, int *temp)
-{
- /*
- * In common/fan.c pwm_fan_stop() will turn off fan
- * when chipset suspend or shutdown.
- */
- if (ap_power_in_state(AP_POWER_STATE_ON)) {
- fan_set_rpm_mode(fan, 1);
- fan_set_rpm_target(fan, fan_table_to_rpm(fan, temp));
- }
-}
diff --git a/zephyr/program/skyrim/BUILD.py b/zephyr/program/skyrim/BUILD.py
deleted file mode 100644
index 08c76c1f13..0000000000
--- a/zephyr/program/skyrim/BUILD.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright 2021 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Define zmake projects for skyrim."""
-
-
-def register_skyrim_project(
- project_name,
-):
- """Register a variant of skyrim."""
- register_npcx_project(
- project_name=project_name,
- zephyr_board="npcx9m3f",
- dts_overlays=[
- here / project_name / "project.overlay",
- ],
- kconfig_files=[
- # Common to all projects.
- here / "program.conf",
- # Project-specific KConfig customization.
- here / project_name / "project.conf",
- ],
- )
-
-
-register_skyrim_project(
- project_name="morthal",
-)
-
-
-register_skyrim_project(
- project_name="skyrim",
-)
-
-
-register_skyrim_project(
- project_name="winterhold",
-)
-
-
-register_skyrim_project(
- project_name="frostflow",
-)
-
-register_skyrim_project(
- project_name="crystaldrift",
-)
diff --git a/zephyr/program/skyrim/CMakeLists.txt b/zephyr/program/skyrim/CMakeLists.txt
deleted file mode 100644
index bb1bde51a8..0000000000
--- a/zephyr/program/skyrim/CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2021 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-cmake_minimum_required(VERSION 3.13.1)
-
-find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
-
-zephyr_library_sources("src/common.c")
-zephyr_library_sources("src/power_signals.c")
-
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
- "src/usb_pd_policy.c"
- "src/usbc_config.c")
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
- "src/led.c")
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT
- "src/stt.c")
-
-if(DEFINED CONFIG_BOARD_MORTHAL)
- project(morthal)
- add_subdirectory(morthal)
-endif()
-
-if(DEFINED CONFIG_BOARD_SKYRIM)
- project(skyrim)
- add_subdirectory(skyrim)
-endif()
-
-if(DEFINED CONFIG_BOARD_WINTERHOLD)
- project(winterhold)
- add_subdirectory(winterhold)
-endif()
-
-if(DEFINED CONFIG_BOARD_FROSTFLOW)
- project(frostflow)
- add_subdirectory(frostflow)
-endif()
-
-if(DEFINED CONFIG_BOARD_CRYSTALDRIFT)
- project(crystaldrift)
- add_subdirectory(crystaldrift)
-endif()
diff --git a/zephyr/program/skyrim/crystaldrift/CMakeLists.txt b/zephyr/program/skyrim/crystaldrift/CMakeLists.txt
deleted file mode 100644
index 6e50c3d40e..0000000000
--- a/zephyr/program/skyrim/crystaldrift/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-cros_ec_library_include_directories_ifdef(CONFIG_BOARD_CRYSTALDRIFT include)
-zephyr_library_sources(
- "src/usb_mux_config.c"
- "src/ppc_config.c"
- "src/form_factor.c"
- "src/alt_charger.c"
-)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "src/fan.c")
diff --git a/zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi b/zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi
deleted file mode 100644
index 812f97a7c7..0000000000
--- a/zephyr/program/skyrim/crystaldrift/crystaldrift.dtsi
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/usbc_mux.h>
-
-#include "../i2c.dtsi"
-
-/ {
- named-gpios {
- /* Crystaldrift-specific GPIO customizations */
- };
-
- named-temp-sensors {
- compatible = "cros-ec,temp-sensors";
- soc-pct2075 {
- temp_host_high = <100>;
- temp_host_halt = <105>;
- temp_host_release_high = <80>;
- temp_host_release_halt = <80>;
- temp_fan_off = <35>;
- temp_fan_max = <70>;
- power-good-pin = <&gpio_pg_pwr_s5>;
- sensor = <&soc_pct2075>;
- };
- amb-pct2075 {
- power-good-pin = <&gpio_pg_pwr_s5>;
- sensor = <&amb_pct2075>;
- };
- };
-
- /*
- * Note this is expected to vary per-board, so we keep it in the board
- * dts files.
- */
- crystaldrift-fw-config {
- compatible = "cros-ec,cbi-fw-config";
-
- form-factor {
- enum-name = "FW_FORM_FACTOR";
- start = <0>;
- size = <1>;
-
- ff-clamshell {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_FF_CLAMSHELL";
- value = <0>;
- };
- ff-convertible {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_FF_CONVERTIBLE";
- value = <1>;
- default;
- };
- };
- io-db {
- enum-name = "FW_IO_DB";
- start = <6>;
- size = <2>;
-
- io-db-ps8811-ps8818 {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_IO_DB_PS8811_PS8818";
- value = <0>;
- };
- io-db-none-anx7483 {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_IO_DB_NONE_ANX7483";
- value = <1>;
- default;
- };
- };
-
- /*
- * FW_CONFIG field to enable fan or not.
- */
- fan {
- enum-name = "FW_FAN";
- start = <10>;
- size = <1>;
-
- no-fan {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_FAN_NOT_PRESENT";
- value = <0>;
- };
- fan-present {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_FAN_PRESENT";
- value = <1>;
- /*
- * Set as default so that unprovisioned
- * configs will run the fan regardless.
- */
- default;
- };
- };
-
- charger-option {
- enum-name = "FW_CHARGER";
- start = <11>;
- size = <2>;
-
- charger-option-isl9241 {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_CHARGER_ISL9241";
- value = <0>;
- default;
- };
- charger-option-isl9538 {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_CHARGER_ISL9538";
- value = <1>;
- };
- };
- };
-
- /* Rotation matrices for motion sensors. */
- motionsense-rotation-ref {
- compatible = "cros-ec,motionsense-rotation-ref";
- lid_rot_ref: lid-rotation-ref {
- mat33 = <0 (-1) 0
- 1 0 0
- 0 0 1>;
- };
-
- lid_rot_ref1: lid-rotation-ref1 {
- mat33 = <0 1 0
- (-1) 0 0
- 0 0 1>;
- };
-
- base_rot_ref: base-rotation-ref {
- mat33 = <0 1 0
- (-1) 0 0
- 0 0 1>;
- };
- };
-
- ppc_port0: aoz1380 {
- compatible = "aoz,aoz1380";
- status = "okay";
- };
-};
-
-&i2c0_0 {
- anx7483_port0: anx7483@3e {
- compatible = "analogix,anx7483";
- reg = <0x3e>;
- board-set = "board_anx7483_c0_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
- };
-};
-
-&i2c1_0 {
- anx7483_port1: anx7483@3e {
- compatible = "analogix,anx7483";
- reg = <0x3e>;
- board-set = "board_anx7483_c1_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
- };
- ppc_port1: nx20p348x@71 {
- compatible = "nxp,nx20p348x";
- status = "okay";
- reg = <0x71>;
- };
- ps8818_port1: ps8818@28 {
- compatible = "parade,ps8818";
- reg = <0x28>;
- flags = <(USB_MUX_FLAG_RESETS_IN_G3)>;
- board-set = "board_c1_ps8818_mux_set";
- };
-};
-
-&i2c4_1 {
- charger: isl9241@9 {
- compatible = "intersil,isl9241";
- status = "okay";
- reg = <0x9>;
- };
- alt_charger: isl9538@9 {
- compatible = "intersil,isl923x";
- status = "okay";
- reg = <0x9>;
- };
-};
-
-&usbc_port0 {
- chg_alt = <&alt_charger>;
- ppc = <&ppc_port0>;
- usb-mux-chain-0 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&amd_fp6_port0 &anx7483_port0>;
- };
-};
-
-&usbc_port1 {
- ppc = <&ppc_port1>;
- usb-mux-chain-1-anx {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&amd_fp6_port1 &anx7483_port1>;
- };
- usb_mux_chain_ps8818_port1: usb-mux-chain-1-ps {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&amd_fp6_port1 &ps8818_port1>;
- alternative-chain;
- };
-};
diff --git a/zephyr/program/skyrim/crystaldrift/project.conf b/zephyr/program/skyrim/crystaldrift/project.conf
deleted file mode 100644
index e9339c1c3c..0000000000
--- a/zephyr/program/skyrim/crystaldrift/project.conf
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Crystaldrift reference-board-specific Kconfig settings.
-CONFIG_BOARD_CRYSTALDRIFT=y
-
-# CBI WP pin present
-CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
-
-# LED
-CONFIG_PLATFORM_EC_LED_DT=y
-
-# Crystaldrfit is capable of sinking 100W
-CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=100000
-CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=5000
-CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=20000
-
-CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
-
-# Enable alternative charger chip
-CONFIG_PLATFORM_EC_CHARGER_RUNTIME_CONFIG=y
-CONFIG_PLATFORM_EC_CHARGER_ISL9238C=y
-
-# Battery
-CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
diff --git a/zephyr/program/skyrim/crystaldrift/project.overlay b/zephyr/program/skyrim/crystaldrift/project.overlay
deleted file mode 100644
index 1192bb0d16..0000000000
--- a/zephyr/program/skyrim/crystaldrift/project.overlay
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Skyrim program common DTS includes */
-#include "../adc.dtsi"
-#include "../fan.dtsi"
-#include "../gpio.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../usbc.dtsi"
-
-/* Crystaldrift project DTS includes*/
-#include "crystaldrift.dtsi"
-#include "battery.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
diff --git a/zephyr/program/skyrim/crystaldrift/src/alt_charger.c b/zephyr/program/skyrim/crystaldrift/src/alt_charger.c
deleted file mode 100644
index a429457136..0000000000
--- a/zephyr/program/skyrim/crystaldrift/src/alt_charger.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "charger_chips.h"
-#include "common.h"
-#include "cros_board_info.h"
-#include "cros_cbi.h"
-#include "hooks.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(crystaldrift, CONFIG_SKYRIM_LOG_LEVEL);
-
-static void alt_charger_init(void)
-{
- int ret;
- uint32_t val;
-
- ret = cros_cbi_get_fw_config(FW_CHARGER, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_CHARGER);
- return;
- }
-
- if (val == FW_CHARGER_ISL9538)
- CHG_ENABLE_ALTERNATE(0);
-}
-DECLARE_HOOK(HOOK_INIT, alt_charger_init, HOOK_PRIO_POST_FIRST);
diff --git a/zephyr/program/skyrim/crystaldrift/src/fan.c b/zephyr/program/skyrim/crystaldrift/src/fan.c
deleted file mode 100644
index 6645e2a495..0000000000
--- a/zephyr/program/skyrim/crystaldrift/src/fan.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "cros_board_info.h"
-#include "cros_cbi.h"
-#include "fan.h"
-#include "gpio/gpio.h"
-#include "hooks.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(crystaldrift, CONFIG_SKYRIM_LOG_LEVEL);
-
-/*
- * Skyrim fan support
- */
-static void fan_init(void)
-{
- int ret;
- uint32_t val;
- uint32_t board_version;
- /*
- * Retrieve the fan config.
- */
- ret = cros_cbi_get_fw_config(FW_FAN, &val);
- if (ret != 0) {
- LOG_ERR("Error retrieving CBI FW_CONFIG field %d", FW_FAN);
- return;
- }
-
- ret = cbi_get_board_version(&board_version);
- if (ret != EC_SUCCESS) {
- LOG_ERR("Error retrieving CBI board version");
- return;
- }
-
- if ((board_version >= 3) && (val != FW_FAN_PRESENT)) {
- /* Disable the fan */
- fan_set_count(0);
- }
-}
-DECLARE_HOOK(HOOK_INIT, fan_init, HOOK_PRIO_POST_FIRST);
-
-/*
- * Pcore OCP support
- * Note: early boards should note enable this interrupt as they are not
- * correctly configured for it.
- */
-__override bool board_supports_pcore_ocp(void)
-{
- uint32_t board_version;
-
- if (cbi_get_board_version(&board_version) == EC_SUCCESS &&
- board_version > 3)
- return true;
-
- return false;
-}
diff --git a/zephyr/program/skyrim/crystaldrift/src/form_factor.c b/zephyr/program/skyrim/crystaldrift/src/form_factor.c
deleted file mode 100644
index 688765617b..0000000000
--- a/zephyr/program/skyrim/crystaldrift/src/form_factor.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "accelgyro.h"
-#include "common.h"
-#include "cros_board_info.h"
-#include "hooks.h"
-#include "motionsense_sensors.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
-LOG_MODULE_DECLARE(crystaldrift, CONFIG_SKYRIM_LOG_LEVEL);
-
-/*
- * Mainboard orientation support.
- */
-
-#define ALT_MAT SENSOR_ROT_STD_REF_NAME(DT_NODELABEL(lid_rot_ref1))
-#define LID_ACCEL SENSOR_ID(DT_NODELABEL(lid_accel))
-
-static void form_factor_init(void)
-{
- int ret;
- uint32_t val;
- /*
- * If the board version >=4
- * use ver1 rotation matrix.
- */
- ret = cbi_get_board_version(&val);
- if (ret == EC_SUCCESS && val >= 4) {
- LOG_INF("Switching to ver1 lid");
- motion_sensors[LID_ACCEL].rot_standard_ref = &ALT_MAT;
- }
-}
-DECLARE_HOOK(HOOK_INIT, form_factor_init, HOOK_PRIO_POST_I2C);
diff --git a/zephyr/program/skyrim/crystaldrift/src/ppc_config.c b/zephyr/program/skyrim/crystaldrift/src/ppc_config.c
deleted file mode 100644
index 3913fda4dc..0000000000
--- a/zephyr/program/skyrim/crystaldrift/src/ppc_config.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Crystaldrift board-specific PPC code */
-
-#include "driver/ppc/aoz1380_public.h"
-#include "driver/ppc/nx20p348x.h"
-#include "usbc_ppc.h"
-
-#include <zephyr/drivers/gpio.h>
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-
-/*
- * In the AOZ1380 PPC, there are no programmable features. We use
- * the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0
- * current limits.
- */
-int board_aoz1380_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp)
-{
- int rv = EC_SUCCESS;
-
- rv = gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(ioex_usb_c0_ilim_3a_en),
- (rp == TYPEC_RP_3A0) ? 1 : 0);
-
- return rv;
-}
-
-void ppc_interrupt(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_PPC_INT_ODL:
- aoz1380_interrupt(0);
- break;
-
- case GPIO_USB_C1_PPC_INT_ODL:
- nx20p348x_interrupt(1);
- break;
-
- default:
- break;
- }
-}
diff --git a/zephyr/program/skyrim/frostflow/CMakeLists.txt b/zephyr/program/skyrim/frostflow/CMakeLists.txt
deleted file mode 100644
index dd7eae2384..0000000000
--- a/zephyr/program/skyrim/frostflow/CMakeLists.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-cros_ec_library_include_directories_ifdef(CONFIG_BOARD_FROSTFLOW include)
-zephyr_include_directories("include")
-zephyr_library_sources(
- "src/usb_mux_config.c"
- "src/ppc_config.c"
- "src/thermal.c"
-)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD_CUSTOMIZATION
- "src/keyboard.c"
- "src/keyboard_customization.c"
-)
diff --git a/zephyr/program/skyrim/frostflow/frostflow.dtsi b/zephyr/program/skyrim/frostflow/frostflow.dtsi
deleted file mode 100644
index 1cadf7ee2d..0000000000
--- a/zephyr/program/skyrim/frostflow/frostflow.dtsi
+++ /dev/null
@@ -1,223 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/usbc_mux.h>
-
-#include "../i2c.dtsi"
-
-/ {
- named-gpios {
- /* Frostflow-specific GPIO customizations */
- };
-
- named-temp-sensors {
- compatible = "cros-ec,temp-sensors";
- temp_soc: soc-pct2075 {
- temp_host_high = <75>;
- temp_host_halt = <80>;
- temp_host_release_high = <65>;
- temp_host_release_halt = <70>;
- power-good-pin = <&gpio_pg_pwr_s5>;
- sensor = <&soc_pct2075>;
- };
- temp_amb: amb-pct2075 {
- temp_host_high = <65>;
- temp_host_halt = <70>;
- temp_host_release_high = <55>;
- temp_host_release_halt = <60>;
- temp_fan_off = <32>;
- temp_fan_max = <45>;
- power-good-pin = <&gpio_pg_pwr_s5>;
- sensor = <&amb_pct2075>;
- };
- };
-
- /* Rotation matrices for motion sensors. */
- motionsense-rotation-ref {
- compatible = "cros-ec,motionsense-rotation-ref";
- lid_rot_ref: lid-rotation-ref {
- mat33 = <1 0 0
- 0 1 0
- 0 0 1>;
- };
-
- base_rot_ref: base-rotation-ref {
- mat33 = <0 1 0
- 1 0 0
- 0 0 (-1)>;
- };
- };
-
- ppc_port0: aoz1380 {
- compatible = "aoz,aoz1380";
- status = "okay";
- };
-
- fan_steps_clamshell: fan-steps-clamshell {
- compatible = "cros-ec,fan-steps";
- level_0 {
- temp_on = <(-1) (-1) (-1) (-1) 31>;
- temp_off = <(-1) (-1) (-1) (-1) 99>;
- rpm_target = <0>;
- };
- level_1 {
- temp_on = <(-1) (-1) (-1) (-1) 32>;
- temp_off = <(-1) (-1) (-1) (-1) 30>;
- rpm_target = <2600>;
- };
- level_2 {
- temp_on = <(-1) (-1) (-1) (-1) 34>;
- temp_off = <(-1) (-1) (-1) (-1) 31>;
- rpm_target = <2900>;
- };
- level_3 {
- temp_on = <(-1) (-1) (-1) (-1) 36>;
- temp_off = <(-1) (-1) (-1) (-1) 33>;
- rpm_target = <3600>;
- };
- level_4 {
- temp_on = <(-1) (-1) (-1) (-1) 38>;
- temp_off = <(-1) (-1) (-1) (-1) 35>;
- rpm_target = <4200>;
- };
- level_5 {
- temp_on = <(-1) (-1) (-1) (-1) 45>;
- temp_off = <(-1) (-1) (-1) (-1) 37>;
- rpm_target = <4600>;
- };
- };
-
- fan_steps_tablet: fan-steps-tablet {
- compatible = "cros-ec,fan-steps";
- level_0 {
- temp_on = <(-1) (-1) (-1) (-1) 31>;
- temp_off = <(-1) (-1) (-1) (-1) 99>;
- rpm_target = <0>;
- };
- level_1 {
- temp_on = <(-1) (-1) (-1) (-1) 32>;
- temp_off = <(-1) (-1) (-1) (-1) 30>;
- rpm_target = <2600>;
- };
- level_2 {
- temp_on = <(-1) (-1) (-1) (-1) 34>;
- temp_off = <(-1) (-1) (-1) (-1) 31>;
- rpm_target = <2900>;
- };
- level_3 {
- temp_on = <(-1) (-1) (-1) (-1) 36>;
- temp_off = <(-1) (-1) (-1) (-1) 33>;
- rpm_target = <3600>;
- };
- level_4 {
- temp_on = <(-1) (-1) (-1) (-1) 38>;
- temp_off = <(-1) (-1) (-1) (-1) 35>;
- rpm_target = <4200>;
- };
- level_5 {
- temp_on = <(-1) (-1) (-1) (-1) 45>;
- temp_off = <(-1) (-1) (-1) (-1) 37>;
- rpm_target = <4600>;
- };
- };
-};
-
-&i2c1_0 {
- ppc_port1: nx20p348x@71 {
- compatible = "nxp,nx20p348x";
- status = "okay";
- reg = <0x71>;
- };
- ps8818_port1: ps8818@28 {
- compatible = "parade,ps8818";
- reg = <0x28>;
- flags = <(USB_MUX_FLAG_RESETS_IN_G3)>;
- board-set = "board_c1_ps8818_mux_set";
- };
-};
-
-&i2c4_1 {
- charger: isl9241@9 {
- compatible = "intersil,isl9241";
- status = "okay";
- reg = <0x9>;
- };
-};
-
-&amd_fp6_port0 {
- board-set = "board_c0_amd_fp6_mux_set";
-};
-
-&usbc_port0 {
- ppc = <&ppc_port0>;
- usb-mux-chain-0 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&amd_fp6_port0>;
- };
-};
-
-&usbc_port1 {
- ppc = <&ppc_port1>;
- usb-mux-chain-1-ps8818 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&amd_fp6_port1 &ps8818_port1>;
- };
-};
-
-&cros_kb_raw {
- pinctrl-0 = <
- &ksi0_gp31
- &ksi1_gp30
- &ksi2_gp27
- &ksi3_gp26
- &ksi4_gp25
- &ksi5_gp24
- &ksi6_gp23
- &ksi7_gp22
- &kso00_gp21
- &kso01_gp20
- &kso03_gp16
- &kso04_gp15
- &kso05_gp14
- &kso06_gp13
- &kso07_gp12
- &kso08_gp11
- &kso09_gp10
- &kso10_gp07
- &kso11_gp06
- &kso12_gp05
- &kso13_gp04
- &kso14_gp82
- >;
-};
-
-&temp_sensor_charger {
- temp_host_high = <75>;
- temp_host_halt = <80>;
- temp_host_release_high = <65>;
- temp_host_release_halt = <70>;
-};
-
-&temp_sensor_memory {
- temp_host_high = <75>;
- temp_host_halt = <80>;
- temp_host_release_high = <65>;
- temp_host_release_halt = <70>;
-};
-
-&temp_sensor_cpu {
- /delete-property/ temp_host_high;
- /delete-property/ temp_host_halt;
- /delete-property/ temp_host_release_high;
- /delete-property/ temp_fan_off;
- /delete-property/ temp_fan_max;
-};
-
-&fan0 {
- pwms = <&pwm0 0 PWM_KHZ(25) PWM_POLARITY_NORMAL>;
- rpm_min = <2400>;
- rpm_start = <2600>;
- rpm_max = <4600>;
-};
diff --git a/zephyr/program/skyrim/frostflow/motionsense.dtsi b/zephyr/program/skyrim/frostflow/motionsense.dtsi
deleted file mode 100644
index f943bea4c8..0000000000
--- a/zephyr/program/skyrim/frostflow/motionsense.dtsi
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/motionsense/utils.h>
-
-
-/ {
- aliases {
- /*
- * motion sense's <>_INT_EVENT is handled
- * by alias. Using the alias, each driver creates
- * its own <>_INT_EVENT.
- */
- bmi3xx-int = &base_accel;
- };
-
- /*
- * Declare mutexes used by sensor drivers.
- * A mutex node is used to create an instance of mutex_t.
- * A mutex node is referenced by a sensor node if the
- * corresponding sensor driver needs to use the
- * instance of the mutex.
- */
- motionsense-mutex {
- compatible = "cros-ec,motionsense-mutex";
- lid_mutex: lid-mutex {
- };
-
- mutex_bmi3xx: bmi3xx-mutex {
- };
- };
-
- /*
- * Driver specific data. A driver-specific data can be shared with
- * different motion sensors while they are using the same driver.
- *
- * If a node's compatible starts with "cros-ec,accelgyro-", it is for
- * a common structure defined in accelgyro.h.
- * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
- * "struct als_drv_data_t" in accelgyro.h
- */
- motionsense-sensor-data {
- bma4xx_data: bma4xx-drv-data {
- compatible = "cros-ec,drvdata-bma4xx";
- status = "okay";
- };
-
- bmi3xx_data: bmi3xx-drv-data {
- compatible = "cros-ec,drvdata-bmi3xx";
- status = "okay";
- };
- };
-
- /*
- * List of motion sensors that creates motion_sensors array.
- * The nodelabel "lid_accel" and "base_accel" are used to indicate
- * motion sensor IDs for lid angle calculation.
- */
- motionsense-sensor {
- lid_accel: lid-accel {
- compatible = "cros-ec,bma4xx";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex>;
- port = <&i2c_sensor>;
- drv-data = <&bma4xx_data>;
- rot-standard-ref = <&lid_rot_ref>;
- default-range = <2>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base_accel: base-accel {
- compatible = "cros-ec,bmi3xx-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
-
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base-gyro {
- compatible = "cros-ec,bmi3xx-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
- };
- };
-
- motionsense-sensor-info {
- compatible = "cros-ec,motionsense-sensor-info";
-
- /*
- * list of GPIO interrupts that have to
- * be enabled at initial stage
- */
- sensor-irqs = <&int_accel_gyro>;
-
- /* list of sensors in force mode */
- accel-force-mode-sensors = <&lid_accel>;
- };
-};
diff --git a/zephyr/program/skyrim/frostflow/project.overlay b/zephyr/program/skyrim/frostflow/project.overlay
deleted file mode 100644
index a1bc7dbb5e..0000000000
--- a/zephyr/program/skyrim/frostflow/project.overlay
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Skyrim program common DTS includes */
-#include "../adc.dtsi"
-#include "../fan.dtsi"
-#include "../gpio.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../usbc.dtsi"
-
-/* Frostflow project DTS includes*/
-#include "frostflow.dtsi"
-#include "battery.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
diff --git a/zephyr/program/skyrim/frostflow/src/thermal.c b/zephyr/program/skyrim/frostflow/src/thermal.c
deleted file mode 100644
index eae8aac25d..0000000000
--- a/zephyr/program/skyrim/frostflow/src/thermal.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-#include "chipset.h"
-#include "fan.h"
-#include "tablet_mode.h"
-#include "temp_sensor/temp_sensor.h"
-#include "thermal.h"
-#include "util.h"
-#include "console.h"
-
-#define TEMP_AMB TEMP_SENSOR_ID(DT_NODELABEL(temp_amb))
-
-struct fan_step {
- /*
- * Sensor 0~4 trigger point, set -1 if we're not using this
- * sensor to determine fan speed.
- */
- int on[TEMP_SENSOR_COUNT];
- /*
- * Sensor 0~4 release point, set -1 if we're not using this
- * sensor to determine fan speed.
- */
- int off[TEMP_SENSOR_COUNT];
- /* Fan rpm */
- uint16_t rpm[FAN_CH_COUNT];
-};
-
-#define FAN_TABLE_ENTRY(nd) \
- { \
- .on = DT_PROP(nd, temp_on), \
- .off = DT_PROP(nd, temp_off), \
- .rpm = DT_PROP(nd, rpm_target), \
- },
-
-static const struct fan_step fan_table_clamshell[] = { DT_FOREACH_CHILD(
- DT_NODELABEL(fan_steps_clamshell), FAN_TABLE_ENTRY) };
-
-static const struct fan_step fan_table_tablet[] = { DT_FOREACH_CHILD(
- DT_NODELABEL(fan_steps_tablet), FAN_TABLE_ENTRY) };
-
-static const struct fan_step *fan_step_table;
-#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table_clamshell)
-
-BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == ARRAY_SIZE(fan_table_tablet));
-
-int fan_table_to_rpm(int fan, int *temp)
-{
- /* current fan level */
- static int current_level;
- /* previous sensor temperature */
- static int prev_tmp[TEMP_SENSOR_COUNT];
- int i;
-
- if (tablet_get_mode())
- fan_step_table = fan_table_tablet;
- else
- fan_step_table = fan_table_clamshell;
-
- /*
- * Compare the current and previous temperature, we have
- * the three paths :
- * 1. decreasing path. (check the release point)
- * 2. increasing path. (check the trigger point)
- * 3. invariant path. (return the current RPM)
- */
-
- if (temp[TEMP_AMB] < prev_tmp[TEMP_AMB]) {
- for (i = current_level; i > 0; i--) {
- if (temp[TEMP_AMB] < fan_step_table[i].off[TEMP_AMB])
- current_level = i - 1;
- else
- break;
- }
- } else if (temp[TEMP_AMB] > prev_tmp[TEMP_AMB]) {
- for (i = current_level; i < NUM_FAN_LEVELS; i++) {
- if (temp[TEMP_AMB] > fan_step_table[i].on[TEMP_AMB])
- current_level = i + 1;
- else
- break;
- }
- }
-
- if (current_level < 0)
- current_level = 0;
-
- if (current_level >= NUM_FAN_LEVELS)
- current_level = NUM_FAN_LEVELS - 1;
-
- for (i = 0; i < TEMP_SENSOR_COUNT; ++i)
- prev_tmp[i] = temp[i];
-
- return fan_step_table[current_level].rpm[fan];
-}
-
-void board_override_fan_control(int fan, int *temp)
-{
- /*
- * In common/fan.c pwm_fan_stop() will turn off fan
- * when chipset suspend or shutdown.
- */
- if (chipset_in_state(CHIPSET_STATE_ON)) {
- fan_set_rpm_mode(fan, 1);
- fan_set_rpm_target(fan, fan_table_to_rpm(fan, temp));
- }
-}
diff --git a/zephyr/program/skyrim/frostflow/src/usb_mux_config.c b/zephyr/program/skyrim/frostflow/src/usb_mux_config.c
deleted file mode 100644
index 2ec1dda0be..0000000000
--- a/zephyr/program/skyrim/frostflow/src/usb_mux_config.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Frostflow board-specific USB-C mux configuration */
-
-#include "ioexpander.h"
-#include "usbc/usb_muxes.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-
-/*
- * USB C0 (general) and C1 (just ps8815 DB) use IOEX pins to
- * indicate flipped polarity to a protection switch.
- */
-static int ioex_set_flip(int port, mux_state_t mux_state)
-{
- if (port == 0) {
- if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- gpio_pin_set_dt(
- GPIO_DT_FROM_NODELABEL(ioex_usb_c0_sbu_flip),
- 1);
- else
- gpio_pin_set_dt(
- GPIO_DT_FROM_NODELABEL(ioex_usb_c0_sbu_flip),
- 0);
- } else {
- if (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- gpio_pin_set_dt(
- GPIO_DT_FROM_NODELABEL(ioex_usb_c1_sbu_flip),
- 1);
- else
- gpio_pin_set_dt(
- GPIO_DT_FROM_NODELABEL(ioex_usb_c1_sbu_flip),
- 0);
- }
-
- return EC_SUCCESS;
-}
-
-int board_c0_amd_fp6_mux_set(const struct usb_mux *me, mux_state_t mux_state)
-{
- /* Set the SBU polarity mux */
- RETURN_ERROR(ioex_set_flip(me->usb_port, mux_state));
-
- return EC_SUCCESS;
-}
-
-int board_c1_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state)
-{
- CPRINTSUSB("C1: PS8818 mux using default tuning");
-
- /* Once a DP connection is established, we need to set IN_HPD */
- if (mux_state & USB_PD_MUX_DP_ENABLED)
- ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 1);
- else
- ioex_set_level(IOEX_USB_C1_HPD_IN_DB, 0);
-
- return 0;
-}
diff --git a/zephyr/program/skyrim/include/keyboard_customization.h b/zephyr/program/skyrim/include/keyboard_customization.h
deleted file mode 100644
index 2d2a997f91..0000000000
--- a/zephyr/program/skyrim/include/keyboard_customization.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Keyboard configuration */
-
-#ifndef __KEYBOARD_CUSTOMIZATION_H
-#define __KEYBOARD_CUSTOMIZATION_H
-
-/*
- * KEYBOARD_COLS_MAX has the build time column size. It's used to allocate
- * exact spaces for arrays. Actual keyboard scanning is done using
- * keyboard_cols, which holds a runtime column size.
- */
-#ifdef CONFIG_KEYBOARD_CUSTOMIZATION
-#undef KEYBOARD_COLS_MAX
-#undef KEYBOARD_ROWS
-
-#define KEYBOARD_COLS_MAX 15
-#define KEYBOARD_ROWS 8
-#endif
-
-/*
- * WARNING: Do not directly modify it. You should call keyboard_raw_set_cols,
- * instead. It checks whether you're eligible or not.
- */
-extern uint8_t keyboard_cols;
-
-#define KEYBOARD_ROW_TO_MASK(r) (1 << (r))
-
-/* Columns and masks for keys we particularly care about */
-#define KEYBOARD_COL_DOWN 11
-#define KEYBOARD_ROW_DOWN 5
-#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
-#define KEYBOARD_COL_ESC 1
-#define KEYBOARD_ROW_ESC 1
-#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
-#define KEYBOARD_COL_KEY_H 6
-#define KEYBOARD_ROW_KEY_H 1
-#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
-#define KEYBOARD_COL_KEY_R 3
-#define KEYBOARD_ROW_KEY_R 7
-#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
-#define KEYBOARD_COL_LEFT_ALT 10
-#define KEYBOARD_ROW_LEFT_ALT 6
-#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
-#define KEYBOARD_COL_REFRESH 2
-#define KEYBOARD_ROW_REFRESH 3
-#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
-#define KEYBOARD_COL_RIGHT_ALT 10
-#define KEYBOARD_ROW_RIGHT_ALT 0
-#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
-#define KEYBOARD_DEFAULT_COL_VOL_UP 4
-#define KEYBOARD_DEFAULT_ROW_VOL_UP 1
-#define KEYBOARD_COL_LEFT_CTRL 0
-#define KEYBOARD_ROW_LEFT_CTRL 2
-#define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL)
-#define KEYBOARD_COL_RIGHT_CTRL 0
-#define KEYBOARD_ROW_RIGHT_CTRL 4
-#define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL)
-#define KEYBOARD_COL_SEARCH 0
-#define KEYBOARD_ROW_SEARCH 3
-#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
-#define KEYBOARD_COL_KEY_0 9
-#define KEYBOARD_ROW_KEY_0 0
-#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
-#define KEYBOARD_COL_KEY_1 1
-#define KEYBOARD_ROW_KEY_1 7
-#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
-#define KEYBOARD_COL_KEY_2 4
-#define KEYBOARD_ROW_KEY_2 6
-#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
-#define KEYBOARD_COL_LEFT_SHIFT 7
-#define KEYBOARD_ROW_LEFT_SHIFT 1
-#define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT)
-
-#endif /* __KEYBOARD_CUSTOMIZATION_H */
diff --git a/zephyr/program/skyrim/morthal/CMakeLists.txt b/zephyr/program/skyrim/morthal/CMakeLists.txt
deleted file mode 100644
index b4819f1e73..0000000000
--- a/zephyr/program/skyrim/morthal/CMakeLists.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-zephyr_library_sources(
- "src/ppc_config.c"
- "src/usb_mux_config.c"
-)
diff --git a/zephyr/program/skyrim/morthal/motionsense.dtsi b/zephyr/program/skyrim/morthal/motionsense.dtsi
deleted file mode 100644
index f943bea4c8..0000000000
--- a/zephyr/program/skyrim/morthal/motionsense.dtsi
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/motionsense/utils.h>
-
-
-/ {
- aliases {
- /*
- * motion sense's <>_INT_EVENT is handled
- * by alias. Using the alias, each driver creates
- * its own <>_INT_EVENT.
- */
- bmi3xx-int = &base_accel;
- };
-
- /*
- * Declare mutexes used by sensor drivers.
- * A mutex node is used to create an instance of mutex_t.
- * A mutex node is referenced by a sensor node if the
- * corresponding sensor driver needs to use the
- * instance of the mutex.
- */
- motionsense-mutex {
- compatible = "cros-ec,motionsense-mutex";
- lid_mutex: lid-mutex {
- };
-
- mutex_bmi3xx: bmi3xx-mutex {
- };
- };
-
- /*
- * Driver specific data. A driver-specific data can be shared with
- * different motion sensors while they are using the same driver.
- *
- * If a node's compatible starts with "cros-ec,accelgyro-", it is for
- * a common structure defined in accelgyro.h.
- * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
- * "struct als_drv_data_t" in accelgyro.h
- */
- motionsense-sensor-data {
- bma4xx_data: bma4xx-drv-data {
- compatible = "cros-ec,drvdata-bma4xx";
- status = "okay";
- };
-
- bmi3xx_data: bmi3xx-drv-data {
- compatible = "cros-ec,drvdata-bmi3xx";
- status = "okay";
- };
- };
-
- /*
- * List of motion sensors that creates motion_sensors array.
- * The nodelabel "lid_accel" and "base_accel" are used to indicate
- * motion sensor IDs for lid angle calculation.
- */
- motionsense-sensor {
- lid_accel: lid-accel {
- compatible = "cros-ec,bma4xx";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex>;
- port = <&i2c_sensor>;
- drv-data = <&bma4xx_data>;
- rot-standard-ref = <&lid_rot_ref>;
- default-range = <2>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base_accel: base-accel {
- compatible = "cros-ec,bmi3xx-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
-
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base-gyro {
- compatible = "cros-ec,bmi3xx-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
- };
- };
-
- motionsense-sensor-info {
- compatible = "cros-ec,motionsense-sensor-info";
-
- /*
- * list of GPIO interrupts that have to
- * be enabled at initial stage
- */
- sensor-irqs = <&int_accel_gyro>;
-
- /* list of sensors in force mode */
- accel-force-mode-sensors = <&lid_accel>;
- };
-};
diff --git a/zephyr/program/skyrim/morthal/project.overlay b/zephyr/program/skyrim/morthal/project.overlay
deleted file mode 100644
index a41d358cce..0000000000
--- a/zephyr/program/skyrim/morthal/project.overlay
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Skyrim program common DTS includes */
-#include "../adc.dtsi"
-#include "../fan.dtsi"
-#include "../gpio.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../usbc.dtsi"
-
-/* Morthal project DTS includes*/
-#include "morthal.dtsi"
-#include "battery.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
diff --git a/zephyr/program/skyrim/motionsense.dtsi b/zephyr/program/skyrim/motionsense.dtsi
deleted file mode 100644
index f943bea4c8..0000000000
--- a/zephyr/program/skyrim/motionsense.dtsi
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/motionsense/utils.h>
-
-
-/ {
- aliases {
- /*
- * motion sense's <>_INT_EVENT is handled
- * by alias. Using the alias, each driver creates
- * its own <>_INT_EVENT.
- */
- bmi3xx-int = &base_accel;
- };
-
- /*
- * Declare mutexes used by sensor drivers.
- * A mutex node is used to create an instance of mutex_t.
- * A mutex node is referenced by a sensor node if the
- * corresponding sensor driver needs to use the
- * instance of the mutex.
- */
- motionsense-mutex {
- compatible = "cros-ec,motionsense-mutex";
- lid_mutex: lid-mutex {
- };
-
- mutex_bmi3xx: bmi3xx-mutex {
- };
- };
-
- /*
- * Driver specific data. A driver-specific data can be shared with
- * different motion sensors while they are using the same driver.
- *
- * If a node's compatible starts with "cros-ec,accelgyro-", it is for
- * a common structure defined in accelgyro.h.
- * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
- * "struct als_drv_data_t" in accelgyro.h
- */
- motionsense-sensor-data {
- bma4xx_data: bma4xx-drv-data {
- compatible = "cros-ec,drvdata-bma4xx";
- status = "okay";
- };
-
- bmi3xx_data: bmi3xx-drv-data {
- compatible = "cros-ec,drvdata-bmi3xx";
- status = "okay";
- };
- };
-
- /*
- * List of motion sensors that creates motion_sensors array.
- * The nodelabel "lid_accel" and "base_accel" are used to indicate
- * motion sensor IDs for lid angle calculation.
- */
- motionsense-sensor {
- lid_accel: lid-accel {
- compatible = "cros-ec,bma4xx";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex>;
- port = <&i2c_sensor>;
- drv-data = <&bma4xx_data>;
- rot-standard-ref = <&lid_rot_ref>;
- default-range = <2>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base_accel: base-accel {
- compatible = "cros-ec,bmi3xx-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
-
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base-gyro {
- compatible = "cros-ec,bmi3xx-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
- };
- };
-
- motionsense-sensor-info {
- compatible = "cros-ec,motionsense-sensor-info";
-
- /*
- * list of GPIO interrupts that have to
- * be enabled at initial stage
- */
- sensor-irqs = <&int_accel_gyro>;
-
- /* list of sensors in force mode */
- accel-force-mode-sensors = <&lid_accel>;
- };
-};
diff --git a/zephyr/program/skyrim/skyrim/CMakeLists.txt b/zephyr/program/skyrim/skyrim/CMakeLists.txt
deleted file mode 100644
index fef1c72a31..0000000000
--- a/zephyr/program/skyrim/skyrim/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-cros_ec_library_include_directories_ifdef(CONFIG_BOARD_SKYRIM include)
-zephyr_library_sources(
- "src/usb_mux_config.c"
- "src/ppc_config.c"
- "src/form_factor.c"
- "src/alt_charger.c"
- "src/keyboard.c"
-)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "src/fan.c")
diff --git a/zephyr/program/skyrim/skyrim/led_policy.dtsi b/zephyr/program/skyrim/skyrim/led_policy.dtsi
deleted file mode 100644
index a075c6b0d2..0000000000
--- a/zephyr/program/skyrim/skyrim/led_policy.dtsi
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <dt-bindings/battery.h>
-
-/ {
- led-colors {
- compatible = "cros-ec,led-policy";
-
- power-state-charge {
- charge-state = "PWR_STATE_CHARGE";
-
- color-0 {
- led-color = <&color_amber>;
- };
- };
-
- power-state-discharge-s0 {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S0";
- /* Battery percent range (> Low, <= Full) */
- batt-lvl = <(BATTERY_LEVEL_LOW + 1) BATTERY_LEVEL_FULL>;
-
- color-0 {
- led-color = <&color_white>;
- };
- };
-
- power-state-discharge-s0-batt-low {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S0";
- /* Battery percent range (>= Empty, <= Low) */
- batt-lvl = <BATTERY_LEVEL_EMPTY BATTERY_LEVEL_LOW>;
-
- /* White 2 sec, off 1 sec */
- color-0 {
- led-color = <&color_white>;
- period-ms = <2000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <1000>;
- };
- };
-
- power-state-discharge-s3 {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S3";
-
- /* White 1 sec, off 1 sec */
- color-0 {
- led-color = <&color_white>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <1000>;
- };
- };
-
- power-state-discharge-s5 {
- charge-state = "PWR_STATE_DISCHARGE";
- chipset-state = "POWER_S5";
-
- color-0 {
- led-color = <&color_off>;
- };
- };
-
- power-state-error {
- charge-state = "PWR_STATE_ERROR";
-
- /* Amber 1 sec, off 1 sec */
- color-0 {
- led-color = <&color_amber>;
- period-ms = <1000>;
- };
- color-1 {
- led-color = <&color_off>;
- period-ms = <1000>;
- };
- };
-
- power-state-near-full {
- charge-state = "PWR_STATE_CHARGE_NEAR_FULL";
-
- color-0 {
- led-color = <&color_white>;
- };
- };
-
- power-state-forced-idle {
- charge-state = "PWR_STATE_FORCED_IDLE";
-
- /* Amber 2 sec, White 2 sec */
- color-0 {
- led-color = <&color_amber>;
- period-ms = <2000>;
- };
- color-1 {
- led-color = <&color_white>;
- period-ms = <2000>;
- };
- };
- };
-};
diff --git a/zephyr/program/skyrim/skyrim/motionsense.dtsi b/zephyr/program/skyrim/skyrim/motionsense.dtsi
deleted file mode 100644
index f943bea4c8..0000000000
--- a/zephyr/program/skyrim/skyrim/motionsense.dtsi
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/motionsense/utils.h>
-
-
-/ {
- aliases {
- /*
- * motion sense's <>_INT_EVENT is handled
- * by alias. Using the alias, each driver creates
- * its own <>_INT_EVENT.
- */
- bmi3xx-int = &base_accel;
- };
-
- /*
- * Declare mutexes used by sensor drivers.
- * A mutex node is used to create an instance of mutex_t.
- * A mutex node is referenced by a sensor node if the
- * corresponding sensor driver needs to use the
- * instance of the mutex.
- */
- motionsense-mutex {
- compatible = "cros-ec,motionsense-mutex";
- lid_mutex: lid-mutex {
- };
-
- mutex_bmi3xx: bmi3xx-mutex {
- };
- };
-
- /*
- * Driver specific data. A driver-specific data can be shared with
- * different motion sensors while they are using the same driver.
- *
- * If a node's compatible starts with "cros-ec,accelgyro-", it is for
- * a common structure defined in accelgyro.h.
- * e.g) compatible = "cros-ec,accelgyro-als-drv-data" is for
- * "struct als_drv_data_t" in accelgyro.h
- */
- motionsense-sensor-data {
- bma4xx_data: bma4xx-drv-data {
- compatible = "cros-ec,drvdata-bma4xx";
- status = "okay";
- };
-
- bmi3xx_data: bmi3xx-drv-data {
- compatible = "cros-ec,drvdata-bmi3xx";
- status = "okay";
- };
- };
-
- /*
- * List of motion sensors that creates motion_sensors array.
- * The nodelabel "lid_accel" and "base_accel" are used to indicate
- * motion sensor IDs for lid angle calculation.
- */
- motionsense-sensor {
- lid_accel: lid-accel {
- compatible = "cros-ec,bma4xx";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_LID";
- mutex = <&lid_mutex>;
- port = <&i2c_sensor>;
- drv-data = <&bma4xx_data>;
- rot-standard-ref = <&lid_rot_ref>;
- default-range = <2>;
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base_accel: base-accel {
- compatible = "cros-ec,bmi3xx-accel";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
-
- configs {
- compatible =
- "cros-ec,motionsense-sensor-config";
- ec-s0 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
- };
- ec-s3 {
- odr = <(12500 | ROUND_UP_FLAG)>;
- };
- };
- };
-
- base-gyro {
- compatible = "cros-ec,bmi3xx-gyro";
- status = "okay";
-
- active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
- port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
- };
- };
-
- motionsense-sensor-info {
- compatible = "cros-ec,motionsense-sensor-info";
-
- /*
- * list of GPIO interrupts that have to
- * be enabled at initial stage
- */
- sensor-irqs = <&int_accel_gyro>;
-
- /* list of sensors in force mode */
- accel-force-mode-sensors = <&lid_accel>;
- };
-};
diff --git a/zephyr/program/skyrim/skyrim/project.overlay b/zephyr/program/skyrim/skyrim/project.overlay
deleted file mode 100644
index 9b61b2ac9b..0000000000
--- a/zephyr/program/skyrim/skyrim/project.overlay
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Skyrim program common DTS includes */
-#include "../adc.dtsi"
-#include "../fan.dtsi"
-#include "../gpio.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../usbc.dtsi"
-
-/* Skyrim project DTS includes*/
-#include "skyrim.dtsi"
-#include "battery.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
diff --git a/zephyr/program/skyrim/skyrim/skyrim_vif.xml b/zephyr/program/skyrim/skyrim/skyrim_vif.xml
deleted file mode 100644
index 28d6f19049..0000000000
--- a/zephyr/program/skyrim/skyrim/skyrim_vif.xml
+++ /dev/null
@@ -1,346 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<vif:VIF xmlns:opt="http://usb.org/VendorInfoFileOptionalContent.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:vif="http://usb.org/VendorInfoFile.xsd">
- <vif:VIF_Specification>3.22</vif:VIF_Specification>
- <vif:VIF_App>
- <vif:Vendor>USB-IF</vif:Vendor>
- <vif:Name>VIF Editor</vif:Name>
- <vif:Version>3.4.2.0</vif:Version>
- </vif:VIF_App>
- <vif:Vendor_Name>Google</vif:Vendor_Name>
- <vif:Model_Part_Number>skyrim</vif:Model_Part_Number>
- <vif:Product_Revision>FIX-ME</vif:Product_Revision>
- <vif:TID>65535</vif:TID>
- <vif:VIF_Product_Type value="0">Port Product</vif:VIF_Product_Type>
- <vif:Certification_Type value="0">End Product</vif:Certification_Type>
- <vif:Product>
- <!--Product Level Content:-->
- </vif:Product>
- <vif:Component>
- <!--Component 0: Port 0-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Component-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Port_Label>0</vif:Port_Label>
- <vif:Connector_Type value="2">Type-C®</vif:Connector_Type>
- <vif:USB4_Supported value="false" />
- <vif:USB_PD_Support value="true" />
- <vif:PD_Port_Type value="4">DRP</vif:PD_Port_Type>
- <vif:Type_C_State_Machine value="2">DRP</vif:Type_C_State_Machine>
- <vif:Port_Battery_Powered value="true" />
- <vif:BC_1_2_Support value="3">Both</vif:BC_1_2_Support>
- <vif:Captive_Cable value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;General PD-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:PD_Spec_Revision_Major value="3" />
- <vif:PD_Spec_Revision_Minor value="0" />
- <vif:PD_Spec_Version_Major value="2" />
- <vif:PD_Spec_Version_Minor value="0" />
- <vif:PD_Specification_Revision value="2">Revision 3</vif:PD_Specification_Revision>
- <vif:SOP_Capable value="true" />
- <vif:SOP_P_Capable value="true" />
- <vif:SOP_PP_Capable value="true" />
- <vif:SOP_P_Debug_Capable value="false" />
- <vif:SOP_PP_Debug_Capable value="false" />
- <vif:Manufacturer_Info_Supported_Port value="false" />
- <vif:Chunking_Implemented_SOP value="true" />
- <vif:Unchunked_Extended_Messages_Supported value="false" />
- <vif:Security_Msgs_Supported_SOP value="false" />
- <vif:Unconstrained_Power value="false" />
- <vif:Num_Fixed_Batteries value="1" />
- <vif:Num_Swappable_Battery_Slots value="0" />
- <vif:ID_Header_Connector_Type_SOP value="2">USB Type-C® Receptacle</vif:ID_Header_Connector_Type_SOP>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;PD Capabilities-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:USB_Comms_Capable value="true" />
- <vif:DR_Swap_To_DFP_Supported value="true" />
- <vif:DR_Swap_To_UFP_Supported value="false" />
- <vif:VCONN_Swap_To_On_Supported value="true" />
- <vif:VCONN_Swap_To_Off_Supported value="true" />
- <vif:Responds_To_Discov_SOP_UFP value="true" />
- <vif:Responds_To_Discov_SOP_DFP value="true" />
- <vif:Attempts_Discov_SOP value="true" />
- <vif:Power_Interruption_Available value="0">No Interruption Possible</vif:Power_Interruption_Available>
- <vif:Data_Reset_Supported value="false" />
- <vif:Enter_USB_Supported value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;USB Type-C®-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Type_C_Can_Act_As_Host value="true" />
- <vif:Type_C_Can_Act_As_Device value="false" />
- <vif:Type_C_Implements_Try_SRC value="true" />
- <vif:Type_C_Implements_Try_SNK value="false" />
- <vif:Type_C_Supports_Audio_Accessory value="false" />
- <vif:Type_C_Is_VCONN_Powered_Accessory value="false" />
- <vif:Type_C_Is_Debug_Target_SRC value="true" />
- <vif:Type_C_Is_Debug_Target_SNK value="true" />
- <vif:RP_Value value="1">1.5A</vif:RP_Value>
- <vif:Type_C_Port_On_Hub value="false" />
- <vif:Type_C_Power_Source value="2">Both</vif:Type_C_Power_Source>
- <vif:Type_C_Sources_VCONN value="true" />
- <vif:Type_C_Is_Alt_Mode_Controller value="true" />
- <vif:Type_C_Is_Alt_Mode_Adapter value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Product Power-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Product_Total_Source_Power_mW value="22500">22500 mW</vif:Product_Total_Source_Power_mW>
- <vif:Port_Source_Power_Type value="1">Shared</vif:Port_Source_Power_Type>
- <vif:Port_Source_Power_Gang>CPower</vif:Port_Source_Power_Gang>
- <vif:Port_Source_Power_Gang_Max_Power value="22500">22500 mW</vif:Port_Source_Power_Gang_Max_Power>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;USB Host-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Host_Supports_USB_Data value="true" />
- <vif:Host_Speed value="1">USB 3.2 Gen 1x1</vif:Host_Speed>
- <vif:Host_Contains_Captive_Retimer value="true" />
- <vif:Host_Truncates_DP_For_tDHPResponse value="false" />
- <vif:Host_Is_Embedded value="false" />
- <vif:Host_Suspend_Supported value="true" />
- <vif:Is_DFP_On_Hub value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Battery Charging 1.2-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:BC_1_2_Charging_Port_Type value="1">CDP</vif:BC_1_2_Charging_Port_Type>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;PD Source-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:PD_Power_As_Source value="1500">1500 mW</vif:PD_Power_As_Source>
- <vif:EPR_Supported_As_Src value="false" />
- <vif:USB_Suspend_May_Be_Cleared value="true" />
- <vif:Sends_Pings value="false" />
- <vif:FR_Swap_Type_C_Current_Capability_As_Initial_Sink value="3">3A @ 5V</vif:FR_Swap_Type_C_Current_Capability_As_Initial_Sink>
- <vif:Master_Port value="true" />
- <vif:Has_Invariant_PDOs value="false" />
- <vif:Num_Src_PDOs value="1" />
- <vif:PD_OC_Protection value="false" />
- <!--Bundle: SrcPdoList-->
- <vif:SrcPdoList>
- <vif:SrcPDO>
- <!--Source PDO 1-->
- <vif:Src_PDO_Supply_Type value="0">Fixed</vif:Src_PDO_Supply_Type>
- <vif:Src_PDO_Peak_Current value="0">100% IOC</vif:Src_PDO_Peak_Current>
- <vif:Src_PDO_Voltage value="100">5000 mV</vif:Src_PDO_Voltage>
- <vif:Src_PDO_Max_Current value="300">3000 mA</vif:Src_PDO_Max_Current>
- </vif:SrcPDO>
- </vif:SrcPdoList>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;PD Sink-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:PD_Power_As_Sink value="100000">100000 mW</vif:PD_Power_As_Sink>
- <vif:EPR_Supported_As_Snk value="false" />
- <vif:No_USB_Suspend_May_Be_Set value="true" />
- <vif:GiveBack_May_Be_Set value="false" />
- <vif:Higher_Capability_Set value="false" />
- <vif:FR_Swap_Reqd_Type_C_Current_As_Initial_Source value="0">FR_Swap not supported</vif:FR_Swap_Reqd_Type_C_Current_As_Initial_Source>
- <vif:Num_Snk_PDOs value="3" />
- <!--Bundle: SnkPdoList-->
- <vif:SnkPdoList>
- <vif:SnkPDO>
- <!--Sink PDO 1-->
- <vif:Snk_PDO_Supply_Type value="0">Fixed</vif:Snk_PDO_Supply_Type>
- <vif:Snk_PDO_Voltage value="100">5000 mV</vif:Snk_PDO_Voltage>
- <vif:Snk_PDO_Op_Current value="300">3000 mA</vif:Snk_PDO_Op_Current>
- </vif:SnkPDO>
- <vif:SnkPDO>
- <!--Sink PDO 2-->
- <vif:Snk_PDO_Supply_Type value="1">Battery</vif:Snk_PDO_Supply_Type>
- <vif:Snk_PDO_Op_Power value="60">15000 mW</vif:Snk_PDO_Op_Power>
- <vif:Snk_PDO_Min_Voltage value="95">4750 mV</vif:Snk_PDO_Min_Voltage>
- <vif:Snk_PDO_Max_Voltage value="400">20000 mV</vif:Snk_PDO_Max_Voltage>
- </vif:SnkPDO>
- <vif:SnkPDO>
- <!--Sink PDO 3-->
- <vif:Snk_PDO_Supply_Type value="2">Variable</vif:Snk_PDO_Supply_Type>
- <vif:Snk_PDO_Min_Voltage value="95">4750 mV</vif:Snk_PDO_Min_Voltage>
- <vif:Snk_PDO_Max_Voltage value="400">20000 mV</vif:Snk_PDO_Max_Voltage>
- <vif:Snk_PDO_Op_Current value="500">5000 mA</vif:Snk_PDO_Op_Current>
- </vif:SnkPDO>
- </vif:SnkPdoList>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Dual Role-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Accepts_PR_Swap_As_Src value="true" />
- <vif:Accepts_PR_Swap_As_Snk value="true" />
- <vif:Requests_PR_Swap_As_Src value="true" />
- <vif:Requests_PR_Swap_As_Snk value="true" />
- <vif:FR_Swap_Supported_As_Initial_Sink value="true" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;SOP Discover ID-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:XID_SOP value="0" />
- <vif:Data_Capable_As_USB_Host_SOP value="true" />
- <vif:Data_Capable_As_USB_Device_SOP value="false" />
- <vif:Product_Type_UFP_SOP value="0">Undefined</vif:Product_Type_UFP_SOP>
- <vif:Product_Type_DFP_SOP value="2">PDUSB Host</vif:Product_Type_DFP_SOP>
- <vif:DFP_VDO_Port_Number value="0" />
- <vif:Modal_Operation_Supported_SOP value="false" />
- <vif:USB_VID_SOP value="6353">18D1</vif:USB_VID_SOP>
- <vif:PID_SOP value="20575">505F</vif:PID_SOP>
- <vif:bcdDevice_SOP value="0">0000</vif:bcdDevice_SOP>
- </vif:Component>
- <vif:Component>
- <!--Component 1: Port 1-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Component-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Port_Label>1</vif:Port_Label>
- <vif:Connector_Type value="2">Type-C®</vif:Connector_Type>
- <vif:USB4_Supported value="false" />
- <vif:USB_PD_Support value="true" />
- <vif:PD_Port_Type value="4">DRP</vif:PD_Port_Type>
- <vif:Type_C_State_Machine value="2">DRP</vif:Type_C_State_Machine>
- <vif:Port_Battery_Powered value="true" />
- <vif:BC_1_2_Support value="3">Both</vif:BC_1_2_Support>
- <vif:Captive_Cable value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;General PD-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:PD_Spec_Revision_Major value="3" />
- <vif:PD_Spec_Revision_Minor value="0" />
- <vif:PD_Spec_Version_Major value="2" />
- <vif:PD_Spec_Version_Minor value="0" />
- <vif:PD_Specification_Revision value="2">Revision 3</vif:PD_Specification_Revision>
- <vif:SOP_Capable value="true" />
- <vif:SOP_P_Capable value="true" />
- <vif:SOP_PP_Capable value="true" />
- <vif:SOP_P_Debug_Capable value="false" />
- <vif:SOP_PP_Debug_Capable value="false" />
- <vif:Manufacturer_Info_Supported_Port value="false" />
- <vif:Chunking_Implemented_SOP value="true" />
- <vif:Unchunked_Extended_Messages_Supported value="false" />
- <vif:Security_Msgs_Supported_SOP value="false" />
- <vif:Unconstrained_Power value="false" />
- <vif:Num_Fixed_Batteries value="1" />
- <vif:Num_Swappable_Battery_Slots value="0" />
- <vif:ID_Header_Connector_Type_SOP value="2">USB Type-C® Receptacle</vif:ID_Header_Connector_Type_SOP>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;PD Capabilities-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:USB_Comms_Capable value="true" />
- <vif:DR_Swap_To_DFP_Supported value="true" />
- <vif:DR_Swap_To_UFP_Supported value="false" />
- <vif:VCONN_Swap_To_On_Supported value="true" />
- <vif:VCONN_Swap_To_Off_Supported value="true" />
- <vif:Responds_To_Discov_SOP_UFP value="true" />
- <vif:Responds_To_Discov_SOP_DFP value="true" />
- <vif:Attempts_Discov_SOP value="true" />
- <vif:Power_Interruption_Available value="0">No Interruption Possible</vif:Power_Interruption_Available>
- <vif:Data_Reset_Supported value="false" />
- <vif:Enter_USB_Supported value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;USB Type-C®-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Type_C_Can_Act_As_Host value="true" />
- <vif:Type_C_Can_Act_As_Device value="false" />
- <vif:Type_C_Implements_Try_SRC value="true" />
- <vif:Type_C_Implements_Try_SNK value="false" />
- <vif:Type_C_Supports_Audio_Accessory value="false" />
- <vif:Type_C_Is_VCONN_Powered_Accessory value="false" />
- <vif:Type_C_Is_Debug_Target_SRC value="true" />
- <vif:Type_C_Is_Debug_Target_SNK value="true" />
- <vif:RP_Value value="1">1.5A</vif:RP_Value>
- <vif:Type_C_Port_On_Hub value="false" />
- <vif:Type_C_Power_Source value="2">Both</vif:Type_C_Power_Source>
- <vif:Type_C_Sources_VCONN value="true" />
- <vif:Type_C_Is_Alt_Mode_Controller value="true" />
- <vif:Type_C_Is_Alt_Mode_Adapter value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Product Power-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Product_Total_Source_Power_mW value="22500">22500 mW</vif:Product_Total_Source_Power_mW>
- <vif:Port_Source_Power_Type value="1">Shared</vif:Port_Source_Power_Type>
- <vif:Port_Source_Power_Gang>CPower</vif:Port_Source_Power_Gang>
- <vif:Port_Source_Power_Gang_Max_Power value="22500">22500 mW</vif:Port_Source_Power_Gang_Max_Power>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;USB Host-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Host_Supports_USB_Data value="true" />
- <vif:Host_Speed value="1">USB 3.2 Gen 1x1</vif:Host_Speed>
- <vif:Host_Contains_Captive_Retimer value="true" />
- <vif:Host_Truncates_DP_For_tDHPResponse value="false" />
- <vif:Host_Is_Embedded value="false" />
- <vif:Host_Suspend_Supported value="true" />
- <vif:Is_DFP_On_Hub value="false" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Battery Charging 1.2-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:BC_1_2_Charging_Port_Type value="1">CDP</vif:BC_1_2_Charging_Port_Type>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;PD Source-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:PD_Power_As_Source value="15000">15000 mW</vif:PD_Power_As_Source>
- <vif:EPR_Supported_As_Src value="false" />
- <vif:USB_Suspend_May_Be_Cleared value="true" />
- <vif:Sends_Pings value="false" />
- <vif:FR_Swap_Type_C_Current_Capability_As_Initial_Sink value="3">3A @ 5V</vif:FR_Swap_Type_C_Current_Capability_As_Initial_Sink>
- <vif:Master_Port value="true" />
- <vif:Has_Invariant_PDOs value="false" />
- <vif:Num_Src_PDOs value="1" />
- <vif:PD_OC_Protection value="false" />
- <!--Bundle: SrcPdoList-->
- <vif:SrcPdoList>
- <vif:SrcPDO>
- <!--Source PDO 1-->
- <vif:Src_PDO_Supply_Type value="0">Fixed</vif:Src_PDO_Supply_Type>
- <vif:Src_PDO_Peak_Current value="0">100% IOC</vif:Src_PDO_Peak_Current>
- <vif:Src_PDO_Voltage value="100">5000 mV</vif:Src_PDO_Voltage>
- <vif:Src_PDO_Max_Current value="300">3000 mA</vif:Src_PDO_Max_Current>
- </vif:SrcPDO>
- </vif:SrcPdoList>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;PD Sink-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:PD_Power_As_Sink value="100000">100000 mW</vif:PD_Power_As_Sink>
- <vif:EPR_Supported_As_Snk value="false" />
- <vif:No_USB_Suspend_May_Be_Set value="true" />
- <vif:GiveBack_May_Be_Set value="false" />
- <vif:Higher_Capability_Set value="false" />
- <vif:FR_Swap_Reqd_Type_C_Current_As_Initial_Source value="0">FR_Swap not supported</vif:FR_Swap_Reqd_Type_C_Current_As_Initial_Source>
- <vif:Num_Snk_PDOs value="3" />
- <!--Bundle: SnkPdoList-->
- <vif:SnkPdoList>
- <vif:SnkPDO>
- <!--Sink PDO 1-->
- <vif:Snk_PDO_Supply_Type value="0">Fixed</vif:Snk_PDO_Supply_Type>
- <vif:Snk_PDO_Voltage value="100">5000 mV</vif:Snk_PDO_Voltage>
- <vif:Snk_PDO_Op_Current value="300">3000 mA</vif:Snk_PDO_Op_Current>
- </vif:SnkPDO>
- <vif:SnkPDO>
- <!--Sink PDO 2-->
- <vif:Snk_PDO_Supply_Type value="1">Battery</vif:Snk_PDO_Supply_Type>
- <vif:Snk_PDO_Op_Power value="60">15000 mW</vif:Snk_PDO_Op_Power>
- <vif:Snk_PDO_Min_Voltage value="95">4750 mV</vif:Snk_PDO_Min_Voltage>
- <vif:Snk_PDO_Max_Voltage value="400">20000 mV</vif:Snk_PDO_Max_Voltage>
- </vif:SnkPDO>
- <vif:SnkPDO>
- <!--Sink PDO 3-->
- <vif:Snk_PDO_Supply_Type value="2">Variable</vif:Snk_PDO_Supply_Type>
- <vif:Snk_PDO_Min_Voltage value="95">4750 mV</vif:Snk_PDO_Min_Voltage>
- <vif:Snk_PDO_Max_Voltage value="400">20000 mV</vif:Snk_PDO_Max_Voltage>
- <vif:Snk_PDO_Op_Current value="500">5000 mA</vif:Snk_PDO_Op_Current>
- </vif:SnkPDO>
- </vif:SnkPdoList>
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;Dual Role-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:Accepts_PR_Swap_As_Src value="true" />
- <vif:Accepts_PR_Swap_As_Snk value="true" />
- <vif:Requests_PR_Swap_As_Src value="true" />
- <vif:Requests_PR_Swap_As_Snk value="true" />
- <vif:FR_Swap_Supported_As_Initial_Sink value="true" />
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <!--;SOP Discover ID-->
- <!--;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-->
- <vif:XID_SOP value="0" />
- <vif:Data_Capable_As_USB_Host_SOP value="true" />
- <vif:Data_Capable_As_USB_Device_SOP value="false" />
- <vif:Product_Type_UFP_SOP value="0">Undefined</vif:Product_Type_UFP_SOP>
- <vif:Product_Type_DFP_SOP value="2">PDUSB Host</vif:Product_Type_DFP_SOP>
- <vif:DFP_VDO_Port_Number value="1" />
- <vif:Modal_Operation_Supported_SOP value="false" />
- <vif:USB_VID_SOP value="6353">18D1</vif:USB_VID_SOP>
- <vif:PID_SOP value="20575">505F</vif:PID_SOP>
- <vif:bcdDevice_SOP value="0">0000</vif:bcdDevice_SOP>
- </vif:Component>
-</vif:VIF>
diff --git a/zephyr/program/skyrim/winterhold/CMakeLists.txt b/zephyr/program/skyrim/winterhold/CMakeLists.txt
deleted file mode 100644
index ebd01a87e6..0000000000
--- a/zephyr/program/skyrim/winterhold/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-zephyr_library_sources(
- "src/usb_mux_config.c"
- "src/ppc_config.c"
- "src/kb_backlight.c"
- "src/keyboard.c"
- "src/sensor.c"
- "src/battery_present.c"
-)
diff --git a/zephyr/program/skyrim/winterhold/led_pins.dtsi b/zephyr/program/skyrim/winterhold/led_pins.dtsi
deleted file mode 100644
index 78b9a59c40..0000000000
--- a/zephyr/program/skyrim/winterhold/led_pins.dtsi
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/ {
- pwmleds {
- compatible = "pwm-leds";
- pwm_y: pwm_y {
- pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
- pwm_w: pwm_w {
- pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
- };
- };
-
- pwm-led-pins {
- compatible = "cros-ec,pwm-led-pins";
-
- color_off: color-off {
- led-color = "LED_OFF";
- led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 0>;
- };
-
- color_amber: color-amber {
- led-color = "LED_AMBER";
- led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <100 0>;
- };
-
- color_white: color-white {
- led-color = "LED_WHITE";
- led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 100>;
- };
- };
-};
-
-/* Amber "battery charging" LED */
-&pwm2 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm2_gpc4>;
- pinctrl-names = "default";
-};
-
-/* White "battery full" LED */
-&pwm3 {
- status = "okay";
- clock-bus = "NPCX_CLOCK_BUS_LFCLK";
- pinctrl-0 = <&pwm3_gp80>;
- pinctrl-names = "default";
-};
diff --git a/zephyr/program/skyrim/winterhold/project.conf b/zephyr/program/skyrim/winterhold/project.conf
deleted file mode 100644
index 84be72ec0e..0000000000
--- a/zephyr/program/skyrim/winterhold/project.conf
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Winterhold reference-board-specific Kconfig settings.
-CONFIG_BOARD_WINTERHOLD=y
-
-# TODO(b/215404321): Remove later in board development
-CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
-CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
-
-# LED
-CONFIG_PLATFORM_EC_LED_DT=y
-
-CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
-
-# Enable charger chip
-CONFIG_PLATFORM_EC_CHARGER_ISL9238=y
-CONFIG_PLATFORM_EC_CHARGER_ISL9241=n
-
-# Get the vbus voltage from TCPC
-CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=n
-CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_TCPC=y
-
-# Remove unused sensor
-CONFIG_PLATFORM_EC_ACCEL_BMA4XX=n
-
-# Support LIS2DW12 sensor
-CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y
-
-# Disable lid configuration
-CONFIG_PLATFORM_EC_LID_ANGLE=n
-CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=n
-
-# Disable tablet mode configuration
-CONFIG_PLATFORM_EC_TABLET_MODE=n
-CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=n
-CONFIG_PLATFORM_EC_GMR_TABLET_MODE=n
-
-# Battery
-CONFIG_PLATFORM_EC_BATTERY_HW_PRESENT_CUSTOM=y
-
-# Body detection configuration
-CONFIG_PLATFORM_EC_BODY_DETECTION=y
-CONFIG_PLATFORM_EC_BODY_DETECTION_ALWAYS_ENABLE_IN_S0=y
-CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE=y
-CONFIG_PLATFORM_EC_GESTURE_HOST_DETECTION=y
diff --git a/zephyr/program/skyrim/winterhold/project.overlay b/zephyr/program/skyrim/winterhold/project.overlay
deleted file mode 100644
index 9a13a1a3cd..0000000000
--- a/zephyr/program/skyrim/winterhold/project.overlay
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Skyrim program common DTS includes */
-#include "../adc.dtsi"
-#include "../fan.dtsi"
-#include "../gpio.dtsi"
-#include "../interrupts.dtsi"
-#include "../keyboard.dtsi"
-#include "../usbc.dtsi"
-
-/* winterhold project DTS includes*/
-#include "winterhold.dtsi"
-#include "battery.dtsi"
-#include "led_pins.dtsi"
-#include "led_policy.dtsi"
-#include "motionsense.dtsi"
diff --git a/zephyr/program/skyrim/winterhold/src/battery_present.c b/zephyr/program/skyrim/winterhold/src/battery_present.c
deleted file mode 100644
index 290955a242..0000000000
--- a/zephyr/program/skyrim/winterhold/src/battery_present.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "battery.h"
-#include "battery_smart.h"
-#include "common.h"
-
-#include <zephyr/drivers/gpio.h>
-
-static enum battery_present batt_pres_prev = BP_NOT_SURE;
-
-__overridable bool board_battery_is_initialized(void)
-{
- int batt_status;
-
- return battery_status(&batt_status) != EC_SUCCESS ?
- false :
- !!(batt_status & STATUS_INITIALIZED);
-}
-
-/*
- * Physical detection of battery.
- */
-static enum battery_present battery_check_present_status(void)
-{
- enum battery_present batt_pres;
-
- if (battery_is_cut_off())
- return BP_NO;
-
- /* Get the physical hardware status */
- batt_pres = battery_hw_present();
-
- /*
- * If the battery is not physically connected, then no need to perform
- * any more checks.
- */
- if (batt_pres == BP_NO)
- return BP_NO;
-
- /*
- * If the battery is present now and was present last time we checked,
- * return early.
- */
- if ((batt_pres == BP_YES) && (batt_pres == batt_pres_prev))
- return BP_YES;
-
- /*
- * Check battery initialization. If the battery is not initialized,
- * then return BP_NOT_SURE. Battery could be in ship
- * mode and might require pre-charge current to wake it up. BP_NO is not
- * returned here because charger state machine will not provide
- * pre-charge current assuming that battery is not present.
- */
- if (!board_battery_is_initialized())
- return BP_NOT_SURE;
-
- return BP_YES;
-}
-
-enum battery_present battery_is_present(void)
-{
- batt_pres_prev = battery_check_present_status();
- return batt_pres_prev;
-}
-
-enum battery_present battery_hw_present(void)
-{
- const struct gpio_dt_spec *batt_pres;
-
- batt_pres = GPIO_DT_FROM_NODELABEL(gpio_ec_batt_pres_odl);
-
- /*
- * The GPIO is low when the battery is physically present.
- * But if battery cell voltage < 2.5V, it will not able to
- * pull down EC_BATT_PRES_ODL. So we need to set pre-charge
- * current even EC_BATT_PRES_ODL is high.
- */
- return gpio_pin_get_dt(batt_pres) ? BP_NOT_SURE : BP_YES;
-}
diff --git a/zephyr/program/skyrim/winterhold/src/sensor.c b/zephyr/program/skyrim/winterhold/src/sensor.c
deleted file mode 100644
index 52cd201705..0000000000
--- a/zephyr/program/skyrim/winterhold/src/sensor.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-#include "cros_board_info.h"
-#include "driver/accel_lis2dw12.h"
-#include "driver/accelgyro_bmi3xx.h"
-#include "hooks.h"
-#include "motionsense_sensors.h"
-
-void base_accel_interrupt(enum gpio_signal signal)
-{
- int ret;
- uint32_t val;
-
- ret = cbi_get_board_version(&val);
-
- if (ret == EC_SUCCESS && val < 1)
- bmi3xx_interrupt(signal);
- else
- lis2dw12_interrupt(signal);
-}
-
-static void motionsense_init(void)
-{
- int ret;
- uint32_t val;
-
- ret = cbi_get_board_version(&val);
-
- if (ret == EC_SUCCESS && val < 1) {
- MOTIONSENSE_ENABLE_ALTERNATE(alt_base_accel);
- }
-}
-DECLARE_HOOK(HOOK_INIT, motionsense_init, HOOK_PRIO_DEFAULT);
diff --git a/zephyr/program/.pylintrc b/zephyr/projects/.pylintrc
index 8bdb6378e4..8bdb6378e4 100644
--- a/zephyr/program/.pylintrc
+++ b/zephyr/projects/.pylintrc
diff --git a/zephyr/program/brya/BUILD.py b/zephyr/projects/brya/BUILD.py
index 9991335ca7..9991335ca7 100644
--- a/zephyr/program/brya/BUILD.py
+++ b/zephyr/projects/brya/BUILD.py
diff --git a/zephyr/program/brya/CMakeLists.txt b/zephyr/projects/brya/CMakeLists.txt
index 11c1a8386f..11c1a8386f 100644
--- a/zephyr/program/brya/CMakeLists.txt
+++ b/zephyr/projects/brya/CMakeLists.txt
diff --git a/zephyr/program/brya/Kconfig b/zephyr/projects/brya/Kconfig
index 4dd8e23443..4dd8e23443 100644
--- a/zephyr/program/brya/Kconfig
+++ b/zephyr/projects/brya/Kconfig
diff --git a/zephyr/program/brya/adc.dts b/zephyr/projects/brya/adc.dts
index f3f0d1e064..f3f0d1e064 100644
--- a/zephyr/program/brya/adc.dts
+++ b/zephyr/projects/brya/adc.dts
diff --git a/zephyr/program/brya/battery.dts b/zephyr/projects/brya/battery.dts
index 4844d88d92..4844d88d92 100644
--- a/zephyr/program/brya/battery.dts
+++ b/zephyr/projects/brya/battery.dts
diff --git a/zephyr/program/brya/battery_present.c b/zephyr/projects/brya/battery_present.c
index b2af448271..c487a01f36 100644
--- a/zephyr/program/brya/battery_present.c
+++ b/zephyr/projects/brya/battery_present.c
@@ -2,11 +2,11 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "battery.h"
#include "cbi.h"
-#include <zephyr/drivers/gpio.h>
-
enum battery_present battery_hw_present(void)
{
const struct gpio_dt_spec *batt_pres;
diff --git a/zephyr/program/brya/brya.dts b/zephyr/projects/brya/brya.dts
index 4b0490afa9..4b0490afa9 100644
--- a/zephyr/program/brya/brya.dts
+++ b/zephyr/projects/brya/brya.dts
diff --git a/zephyr/program/brya/fan.dts b/zephyr/projects/brya/fan.dts
index aa6dcfde7d..aa6dcfde7d 100644
--- a/zephyr/program/brya/fan.dts
+++ b/zephyr/projects/brya/fan.dts
diff --git a/zephyr/program/brya/gpio.dts b/zephyr/projects/brya/gpio.dts
index 6c6a2ac054..6c6a2ac054 100644
--- a/zephyr/program/brya/gpio.dts
+++ b/zephyr/projects/brya/gpio.dts
diff --git a/zephyr/program/brya/i2c.dts b/zephyr/projects/brya/i2c.dts
index 8de12cdb5e..7284d80870 100644
--- a/zephyr/program/brya/i2c.dts
+++ b/zephyr/projects/brya/i2c.dts
@@ -258,9 +258,10 @@
pinctrl-0 = <&i2c7_0_sda_scl_gpb2_b3>;
pinctrl-names = "default";
- pmic_mp2964@20 {
+ pmic_mp2964: pmic_mp2964@20 {
compatible = "mps,mp2964";
reg = <0x20>;
+ label = "I2C_ADDR_MP2964_FLAGS";
};
charger: bq25710@9 {
diff --git a/zephyr/program/brya/interrupts.dts b/zephyr/projects/brya/interrupts.dts
index 1adca3e035..1adca3e035 100644
--- a/zephyr/program/brya/interrupts.dts
+++ b/zephyr/projects/brya/interrupts.dts
diff --git a/zephyr/program/brya/kblight_hooks.c b/zephyr/projects/brya/kblight_hooks.c
index 8716537f5d..d6d795f28e 100644
--- a/zephyr/program/brya/kblight_hooks.c
+++ b/zephyr/projects/brya/kblight_hooks.c
@@ -3,14 +3,12 @@
* found in the LICENSE file.
*/
-#include "cbi.h"
-#include "hooks.h"
-
-#include <stdbool.h>
-
#include <zephyr/drivers/gpio.h>
+#include <stdbool.h>
#include <ap_power/ap_power.h>
+#include "cbi.h"
+#include "hooks.h"
/* Enable/Disable keyboard backlight gpio */
static inline void kbd_backlight_enable(bool enable)
diff --git a/zephyr/program/brya/keyboard.dts b/zephyr/projects/brya/keyboard.dts
index 91fad2db92..91fad2db92 100644
--- a/zephyr/program/brya/keyboard.dts
+++ b/zephyr/projects/brya/keyboard.dts
diff --git a/zephyr/program/brya/motionsense.dts b/zephyr/projects/brya/motionsense.dts
index 08994e30cc..08994e30cc 100644
--- a/zephyr/program/brya/motionsense.dts
+++ b/zephyr/projects/brya/motionsense.dts
diff --git a/zephyr/program/brya/prj.conf b/zephyr/projects/brya/prj.conf
index 402db74994..422f862809 100644
--- a/zephyr/program/brya/prj.conf
+++ b/zephyr/projects/brya/prj.conf
@@ -9,6 +9,7 @@ CONFIG_PLATFORM_EC_POWER_BUTTON=y
CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_SWITCH=y
CONFIG_LTO=y
+CONFIG_CROS_FLASH_NPCX=y
CONFIG_CROS_SYSTEM_NPCX=y
CONFIG_PLATFORM_EC_VBOOT_EFS2=y
CONFIG_PLATFORM_EC_VBOOT_HASH=y
@@ -27,6 +28,9 @@ CONFIG_ARM_MPU=y
# CBI
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
# eSPI
@@ -35,6 +39,9 @@ CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S4=y
CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S5=y
CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_DEFAULT_VW_WIDTH_US=150
+# I2C
+CONFIG_I2C=y
+
# Power Sequencing
CONFIG_PLATFORM_EC_POWERSEQ=y
CONFIG_PLATFORM_EC_POWERSEQ_RTC_RESET=y
@@ -71,7 +78,12 @@ CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSO=y
CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y
CONFIG_PLATFORM_EC_ALS_TCS3400=y
+# Fan
+CONFIG_TACH_NPCX=y
+
# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_TEMP_SENSOR_POWER=y
# MKBP event
@@ -81,18 +93,22 @@ CONFIG_PLATFORM_EC_MKBP_USE_GPIO_AND_HOST_EVENT=y
# PMIC
CONFIG_PLATFORM_EC_PMIC=y
+CONFIG_PLATFORM_EC_MP2964=y
# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
CONFIG_PLATFORM_EC_KEYBOARD_KEYPAD=y
CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
CONFIG_PLATFORM_EC_CMD_BUTTON=n
+CONFIG_CROS_KB_RAW_NPCX=y
CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
@@ -105,7 +121,6 @@ CONFIG_PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_CUSTOM=y
CONFIG_PLATFORM_EC_CHARGER_BQ25720_VSYS_TH2_DV=70
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON=3
CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC=1
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT=15000
@@ -113,6 +128,7 @@ CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=15001
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10
CONFIG_PLATFORM_EC_CHARGE_RAMP_SW=y
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USB_PID=0x504F
CONFIG_PLATFORM_EC_USBC_PPC_SYV682X=y
CONFIG_PLATFORM_EC_USBC_PPC_NX20P3483=y
@@ -139,6 +155,7 @@ CONFIG_PLATFORM_EC_USB_PD_TCPM_NCT38XX=y
CONFIG_PLATFORM_EC_USB_PD_TCPM_MUX=y
CONFIG_PLATFORM_EC_USB_PD_TCPM_TCPCI=y
CONFIG_PLATFORM_EC_USBC_PPC_DEDICATED_INT=y
+CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_PPC_DUMP=n
CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP=n
CONFIG_PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG=n
@@ -151,12 +168,20 @@ CONFIG_SYSCON=y
# LED
CONFIG_PLATFORM_EC_LED_COMMON=y
+CONFIG_PLATFORM_EC_LED_PWM=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_LEDTEST=n
CONFIG_PLATFORM_EC_LED_PWM_NEAR_FULL_COLOR=4
CONFIG_PLATFORM_EC_LED_PWM_SOC_ON_COLOR=4
CONFIG_PLATFORM_EC_LED_PWM_SOC_SUSPEND_COLOR=4
CONFIG_PLATFORM_EC_LED_PWM_LOW_BATT_COLOR=5
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
+#IOEX
+CONFIG_GPIO_NCT38XX=y
+
# TODO(b/188605676): bring these features up
CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=n
diff --git a/zephyr/program/brya/prj_brya.conf b/zephyr/projects/brya/prj_brya.conf
index 5aaf86a8c9..5aaf86a8c9 100644
--- a/zephyr/program/brya/prj_brya.conf
+++ b/zephyr/projects/brya/prj_brya.conf
diff --git a/zephyr/program/brya/pwm_leds.dts b/zephyr/projects/brya/pwm_leds.dts
index 4321b4bd34..4321b4bd34 100644
--- a/zephyr/program/brya/pwm_leds.dts
+++ b/zephyr/projects/brya/pwm_leds.dts
diff --git a/zephyr/program/brya/temp_sensors.dts b/zephyr/projects/brya/temp_sensors.dts
index ae436a2c6b..ae436a2c6b 100644
--- a/zephyr/program/brya/temp_sensors.dts
+++ b/zephyr/projects/brya/temp_sensors.dts
diff --git a/zephyr/program/brya/usbc.dts b/zephyr/projects/brya/usbc.dts
index 1be9ac94ac..1be9ac94ac 100644
--- a/zephyr/program/brya/usbc.dts
+++ b/zephyr/projects/brya/usbc.dts
diff --git a/zephyr/projects/corsola/BUILD.py b/zephyr/projects/corsola/BUILD.py
new file mode 100644
index 0000000000..4e82ab7926
--- /dev/null
+++ b/zephyr/projects/corsola/BUILD.py
@@ -0,0 +1,139 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Define zmake projects for corsola."""
+
+# Default chip is it81202bx, some variants will use NPCX9X.
+
+
+def register_corsola_project(
+ project_name,
+ chip="it81202bx",
+ extra_dts_overlays=(),
+ extra_kconfig_files=(),
+):
+ """Register a variant of corsola."""
+ register_func = register_binman_project
+ if chip.startswith("npcx"):
+ register_func = register_npcx_project
+
+ register_func(
+ project_name=project_name,
+ zephyr_board=chip,
+ dts_overlays=[
+ here / "common.dts",
+ here / "power_signal.dts",
+ here / "usba.dts",
+ *extra_dts_overlays,
+ ],
+ kconfig_files=[here / "prj.conf", *extra_kconfig_files],
+ )
+
+
+register_corsola_project(
+ "krabby",
+ extra_dts_overlays=[
+ here / "adc_krabby.dts",
+ here / "battery_krabby.dts",
+ here / "gpio_krabby.dts",
+ here / "i2c_krabby.dts",
+ here / "interrupts_krabby.dts",
+ here / "led_krabby.dts",
+ here / "motionsense_krabby.dts",
+ here / "usbc_krabby.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_it81202_base.conf",
+ here / "prj_krabby.conf",
+ ],
+)
+
+register_corsola_project(
+ project_name="kingler",
+ chip="npcx9m3f",
+ extra_dts_overlays=[
+ here / "adc_kingler.dts",
+ here / "battery_kingler.dts",
+ here / "host_interface_npcx.dts",
+ here / "i2c_kingler.dts",
+ here / "interrupts_kingler.dts",
+ here / "gpio_kingler.dts",
+ here / "npcx_keyboard.dts",
+ here / "led_kingler.dts",
+ here / "motionsense_kingler.dts",
+ here / "usbc_kingler.dts",
+ here / "default_gpio_pinctrl_kingler.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_npcx993_base.conf",
+ here / "prj_kingler.conf",
+ ],
+)
+
+register_corsola_project(
+ project_name="steelix",
+ chip="npcx9m3f",
+ extra_dts_overlays=[
+ here / "adc_kingler.dts",
+ here / "battery_steelix.dts",
+ here / "host_interface_npcx.dts",
+ here / "i2c_kingler.dts",
+ here / "interrupts_kingler.dts",
+ here / "interrupts_steelix.dts",
+ here / "cbi_steelix.dts",
+ here / "gpio_steelix.dts",
+ here / "npcx_keyboard.dts",
+ here / "keyboard_steelix.dts",
+ here / "led_steelix.dts",
+ here / "motionsense_kingler.dts",
+ here / "motionsense_steelix.dts",
+ here / "usba_steelix.dts",
+ here / "usbc_kingler.dts",
+ here / "default_gpio_pinctrl_kingler.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_npcx993_base.conf",
+ here / "prj_steelix.conf",
+ ],
+)
+
+
+register_corsola_project(
+ "tentacruel",
+ extra_dts_overlays=[
+ here / "adc_tentacruel.dts",
+ here / "battery_tentacruel.dts",
+ here / "cbi_tentacruel.dts",
+ here / "gpio_tentacruel.dts",
+ here / "i2c_tentacruel.dts",
+ here / "interrupts_tentacruel.dts",
+ here / "led_tentacruel.dts",
+ here / "motionsense_tentacruel.dts",
+ here / "usbc_tentacruel.dts",
+ here / "thermistor_tentacruel.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_it81202_base.conf",
+ here / "prj_tentacruel.conf",
+ ],
+)
+
+register_corsola_project(
+ "magikarp",
+ extra_dts_overlays=[
+ here / "adc_magikarp.dts",
+ here / "battery_magikarp.dts",
+ here / "cbi_magikarp.dts",
+ here / "gpio_magikarp.dts",
+ here / "i2c_magikarp.dts",
+ here / "interrupts_magikarp.dts",
+ here / "led_magikarp.dts",
+ here / "motionsense_magikarp.dts",
+ here / "usbc_magikarp.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_it81202_base.conf",
+ here / "prj_magikarp.conf",
+ ],
+)
diff --git a/zephyr/program/corsola/CMakeLists.txt b/zephyr/projects/corsola/CMakeLists.txt
index 33aa0804d2..fa899a0e77 100644
--- a/zephyr/program/corsola/CMakeLists.txt
+++ b/zephyr/projects/corsola/CMakeLists.txt
@@ -77,12 +77,5 @@ elseif(DEFINED CONFIG_BOARD_MAGIKARP)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
"src/krabby/usbc_config.c")
-elseif(DEFINED CONFIG_BOARD_VOLTORB)
- project(voltorb)
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_I2C "src/kingler/i2c.c")
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
- "src/kingler/usb_pd_policy.c")
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
- "src/kingler/usbc_config.c")
-
endif()
+
diff --git a/zephyr/program/corsola/Kconfig b/zephyr/projects/corsola/Kconfig
index 731de33d8b..4f66601c20 100644
--- a/zephyr/program/corsola/Kconfig
+++ b/zephyr/projects/corsola/Kconfig
@@ -32,12 +32,6 @@ config BOARD_MAGIKARP
Build Google Magikarp variant board. Magikarp is a variant of Krabby
and has MediaTek MT8186 SoC with ITE it81202-bx EC.
-config BOARD_VOLTORB
- bool "Google Voltorb Board"
- help
- Build Google Voltorb variant board. Voltorb is a variant of Kingler
- and has MediaTek MT8186/MT8186T SoC with NPCX993FA0BX EC.
-
config VARIANT_CORSOLA_DB_DETECTION
bool "Corsola Platform Runtime Daughter Board Detection"
depends on PLATFORM_EC_USB_PD_TCPC_RUNTIME_CONFIG
diff --git a/zephyr/program/corsola/npcx_adc.dtsi b/zephyr/projects/corsola/adc_kingler.dts
index 7b69abe48a..7b69abe48a 100644
--- a/zephyr/program/corsola/npcx_adc.dtsi
+++ b/zephyr/projects/corsola/adc_kingler.dts
diff --git a/zephyr/program/corsola/ite_adc.dtsi b/zephyr/projects/corsola/adc_krabby.dts
index be65e9eea7..be65e9eea7 100644
--- a/zephyr/program/corsola/ite_adc.dtsi
+++ b/zephyr/projects/corsola/adc_krabby.dts
diff --git a/zephyr/program/corsola/adc_magikarp.dtsi b/zephyr/projects/corsola/adc_magikarp.dts
index 358af6f0f4..358af6f0f4 100644
--- a/zephyr/program/corsola/adc_magikarp.dtsi
+++ b/zephyr/projects/corsola/adc_magikarp.dts
diff --git a/zephyr/program/corsola/adc_tentacruel.dtsi b/zephyr/projects/corsola/adc_tentacruel.dts
index 63ecb23a8e..1b5e849589 100644
--- a/zephyr/program/corsola/adc_tentacruel.dtsi
+++ b/zephyr/projects/corsola/adc_tentacruel.dts
@@ -53,16 +53,10 @@
named-temp-sensors {
compatible = "cros-ec,temp-sensors";
ambient {
- temp_host_high = <56>;
- temp_host_halt = <80>;
- temp_host_release_high = <42>;
sensor = <&temp_ambient>;
};
temp_charger: charger {
- temp_host_high = <68>;
- temp_host_halt = <90>;
- temp_host_release_high = <59>;
- sensor = <&charger_bc12_port1>;
+ sensor = <&charger>;
};
};
};
diff --git a/zephyr/projects/corsola/battery_kingler.dts b/zephyr/projects/corsola/battery_kingler.dts
new file mode 100644
index 0000000000..b01fb8a46d
--- /dev/null
+++ b/zephyr/projects/corsola/battery_kingler.dts
@@ -0,0 +1,15 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: smp_l20m3pg2 {
+ compatible = "smp,l20m3pg2", "battery-smart";
+ };
+ lgc_l20l3pg2 {
+ compatible = "lgc,l20l3pg2", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/program/corsola/battery_krabby.dtsi b/zephyr/projects/corsola/battery_krabby.dts
index ce41859182..ce41859182 100644
--- a/zephyr/program/corsola/battery_krabby.dtsi
+++ b/zephyr/projects/corsola/battery_krabby.dts
diff --git a/zephyr/program/corsola/battery_magikarp.dtsi b/zephyr/projects/corsola/battery_magikarp.dts
index bbdd6ac0c5..bbdd6ac0c5 100644
--- a/zephyr/program/corsola/battery_magikarp.dtsi
+++ b/zephyr/projects/corsola/battery_magikarp.dts
diff --git a/zephyr/projects/corsola/battery_steelix.dts b/zephyr/projects/corsola/battery_steelix.dts
new file mode 100644
index 0000000000..594c83478c
--- /dev/null
+++ b/zephyr/projects/corsola/battery_steelix.dts
@@ -0,0 +1,24 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: byd_l22b3pg0 {
+ compatible = "byd,l22b3pg0", "battery-smart";
+ };
+ celxpert_l22c3pg0 {
+ compatible = "celxpert,l22c3pg0", "battery-smart";
+ };
+ cosmx_l22x3pg0 {
+ compatible = "cosmx,l22x3pg0", "battery-smart";
+ };
+ smp_l22m3pg0 {
+ compatible = "smp,l22m3pg0", "battery-smart";
+ };
+ sunwoda_l22d3pg0 {
+ compatible = "sunwoda,l22d3pg0", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/program/corsola/battery_tentacruel.dtsi b/zephyr/projects/corsola/battery_tentacruel.dts
index f116c20a51..f116c20a51 100644
--- a/zephyr/program/corsola/battery_tentacruel.dtsi
+++ b/zephyr/projects/corsola/battery_tentacruel.dts
diff --git a/zephyr/program/corsola/cbi_magikarp.dtsi b/zephyr/projects/corsola/cbi_magikarp.dts
index 5eac6b82c6..5eac6b82c6 100644
--- a/zephyr/program/corsola/cbi_magikarp.dtsi
+++ b/zephyr/projects/corsola/cbi_magikarp.dts
diff --git a/zephyr/program/corsola/steelix/cbi.dtsi b/zephyr/projects/corsola/cbi_steelix.dts
index 6636b53a96..f4918b1577 100644
--- a/zephyr/program/corsola/steelix/cbi.dtsi
+++ b/zephyr/projects/corsola/cbi_steelix.dts
@@ -54,7 +54,7 @@
/* Steelix-specific ssfc fields. */
steelix-ssfc {
- compatible = "cros-ec,cbi-ssfc";
+ compatible = "named-cbi-ssfc";
/* SSFC field to identify BASE motion sensor. */
base-sensor {
@@ -62,13 +62,13 @@
size = <3>;
base_sensor_0: bmi323 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
default;
};
base_sensor_1: lsm6dsm {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <2>;
};
@@ -80,13 +80,13 @@
size = <3>;
lid_sensor_0: bma422 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
default;
};
lid_sensor_1: lis2dw12 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <2>;
};
diff --git a/zephyr/program/corsola/cbi_tentacruel.dtsi b/zephyr/projects/corsola/cbi_tentacruel.dts
index 2cd4594417..2cd4594417 100644
--- a/zephyr/program/corsola/cbi_tentacruel.dtsi
+++ b/zephyr/projects/corsola/cbi_tentacruel.dts
diff --git a/zephyr/program/corsola/common.dtsi b/zephyr/projects/corsola/common.dts
index 001dcc7ce3..001dcc7ce3 100644
--- a/zephyr/program/corsola/common.dtsi
+++ b/zephyr/projects/corsola/common.dts
diff --git a/zephyr/program/corsola/npcx_default_gpio_pinctrl.dtsi b/zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts
index 604658a145..604658a145 100644
--- a/zephyr/program/corsola/npcx_default_gpio_pinctrl.dtsi
+++ b/zephyr/projects/corsola/default_gpio_pinctrl_kingler.dts
diff --git a/zephyr/program/corsola/npcx_gpio.dtsi b/zephyr/projects/corsola/gpio_kingler.dts
index 9a827a06dd..9a827a06dd 100644
--- a/zephyr/program/corsola/npcx_gpio.dtsi
+++ b/zephyr/projects/corsola/gpio_kingler.dts
diff --git a/zephyr/program/corsola/ite_gpio.dtsi b/zephyr/projects/corsola/gpio_krabby.dts
index 5f06609f43..5f06609f43 100644
--- a/zephyr/program/corsola/ite_gpio.dtsi
+++ b/zephyr/projects/corsola/gpio_krabby.dts
diff --git a/zephyr/program/corsola/gpio_magikarp.dtsi b/zephyr/projects/corsola/gpio_magikarp.dts
index cb9f6f1a0a..cb9f6f1a0a 100644
--- a/zephyr/program/corsola/gpio_magikarp.dtsi
+++ b/zephyr/projects/corsola/gpio_magikarp.dts
diff --git a/zephyr/projects/corsola/gpio_steelix.dts b/zephyr/projects/corsola/gpio_steelix.dts
new file mode 100644
index 0000000000..14120e6d7d
--- /dev/null
+++ b/zephyr/projects/corsola/gpio_steelix.dts
@@ -0,0 +1,255 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ gpio-cbi-wp = &gpio_ec_cbi_wp;
+ gpio-wp = &gpio_ec_wp_l;
+ gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ /*
+ * In npcx9 series, gpio46, gpio47, and the whole gpio5 port
+ * belong to VHIF power well. On steelix, it is connencted to
+ * 1.8V.
+ */
+ base_imu_int_l: base_imu_int_l {
+ gpios = <&gpio5 6 GPIO_INPUT>;
+ };
+ spi_ap_clk_ec {
+ gpios = <&gpio5 5 GPIO_INPUT>;
+ };
+ spi_ap_cs_ec_l {
+ gpios = <&gpio5 3 GPIO_INPUT>;
+ };
+ spi_ap_do_ec_di {
+ gpios = <&gpio4 6 GPIO_INPUT>;
+ };
+ spi_ap_di_ec_do {
+ gpios = <&gpio4 7 GPIO_INPUT>;
+ };
+ ap_ec_warm_rst_req: ap_ec_warm_rst_req {
+ gpios = <&gpio5 1 (GPIO_INPUT | GPIO_ACTIVE_HIGH)>;
+ enum-name = "GPIO_AP_EC_WARM_RST_REQ";
+ };
+ ap_ec_wdtrst_l: ap_ec_wdtrst_l {
+ gpios = <&gpio5 2 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_WDTRST_L";
+ };
+ ap_in_sleep_l: ap_in_sleep_l {
+ gpios = <&gpio5 4 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_IN_SLEEP_L";
+ };
+ gpio_en_ulp: en_ulp {
+ gpios = <&gpioc 6 GPIO_OUTPUT_LOW>;
+ };
+ en_ec_id_odl {
+ gpios = <&gpio7 6 GPIO_ODR_HIGH>;
+ };
+ sys_rst_odl {
+ gpios = <&gpioc 5 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_SYS_RST_ODL";
+ };
+ ec_i2c_sensor_scl {
+ gpios = <&gpiob 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_sensor_sda {
+ gpios = <&gpiob 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_usb_c0_scl {
+ gpios = <&gpio9 0 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c0_sda {
+ gpios = <&gpio8 7 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c1_scl {
+ gpios = <&gpio9 2 GPIO_INPUT>;
+ };
+ ec_i2c_usb_c1_sda {
+ gpios = <&gpio9 1 GPIO_INPUT>;
+ };
+ ec_i2c_pwr_cbi_scl {
+ gpios = <&gpiod 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_pwr_cbi_sda {
+ gpios = <&gpiod 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec_i2c_batt_scl {
+ gpios = <&gpio3 3 GPIO_INPUT>;
+ };
+ ec_i2c_batt_sda {
+ gpios = <&gpio3 6 GPIO_INPUT>;
+ };
+ en_pp5000_usb_a1_vbus: en_pp5000_usb_a1_vbus_x {
+ gpios = <&gpiof 5 GPIO_OUTPUT_LOW>;
+ };
+ usb_a1_fault_odl {
+ gpios = <&gpiof 4 GPIO_INPUT>;
+ };
+ ec_pen_chg_dis_odl {
+ gpios = <&gpioe 4 GPIO_INPUT>;
+ };
+ gpio_ec_cbi_wp: ec_cbi_wp {
+ gpios = <&gpio8 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_wp_l: ec_wp_odl {
+ gpios = <&gpioe 3 (GPIO_INPUT | GPIO_ACTIVE_LOW |
+ GPIO_VOLTAGE_1P8)>;
+ };
+ lid_accel_int_l {
+ gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_tablet_mode_l: tablet_mode_l {
+ gpios = <&gpiob 2 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ ec_ap_int_odl {
+ gpios = <&gpioc 1 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ gpio_ec_kso_02_inv: ec_kso_02_inv {
+ gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>;
+ };
+ gpio_usb_c0_bc12_int_odl: usb_c0_bc12_int_odl {
+ gpios = <&gpio8 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_BC12_INT_ODL";
+ };
+ ec_entering_rw {
+ gpios = <&gpio0 3 GPIO_OUTPUT_LOW>;
+ };
+ charger_prochot_odl {
+ gpios = <&gpiob 1 GPIO_INPUT>;
+ };
+ ec_rst_odl {
+ gpios = <&gpio7 7 GPIO_INPUT>;
+ };
+ gpio_lid_open: lid_open {
+ gpios = <&gpiod 2 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ gpio_acok_od: acok_od {
+ gpios = <&gpio0 0 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_gsc_ec_pwr_btn_odl: gsc_ec_pwr_btn_odl {
+ gpios = <&gpio0 1 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ gpio_en_5v_usm: en_5v_usm {
+ gpios = <&gpio0 2 GPIO_OUTPUT_LOW>;
+ };
+ packet_mode_en {
+ gpios = <&gpio7 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ gpio_x_ec_gpio2: x_ec_gpio2 {
+ gpios = <&gpiod 4 GPIO_INPUT>;
+ };
+ /*
+ * In npcx9 series, gpio93-97, the whole gpioa port, and gpiob0
+ * belong to VSPI power well. On steelix, it is connencted to
+ * 1.8V.
+ */
+ ap_sysrst_odl_r: ap_sysrst_odl_r {
+ gpios = <&gpioa 1 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ enum-name = "GPIO_AP_EC_SYSRST_ODL";
+ };
+ gpio_ap_xhci_init_done: ap_xhci_init_done {
+ gpios = <&gpioa 3 GPIO_INPUT>;
+ };
+ gpio_usb_c0_ppc_int_odl: usb_c0_ppc_int_odl {
+ gpios = <&gpio6 7 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_PPC_INT_ODL";
+ };
+ pg_pp5000_z2_od {
+ gpios = <&gpio7 0 GPIO_INPUT>;
+ };
+ gpio_ec_x_gpio1: ec_x_gpio1 {
+ gpios = <&gpio6 2 GPIO_OUTPUT_LOW>;
+ };
+ dp_aux_path_sel: dp_aux_path_sel {
+ gpios = <&gpio6 3 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_ec_bl_en_od: ec_bl_en_od {
+ gpios = <&gpio4 0 (GPIO_ODR_LOW | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_ec_x_gpio3: ec_x_gpio3 {
+ gpios = <&gpiod 3 GPIO_OUTPUT_LOW>;
+ };
+ gpio_usb_c0_tcpc_int_odl: usb_c0_tcpc_int_odl {
+ gpios = <&gpio7 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_TCPC_INT_ODL";
+ };
+ gpio_usb_c0_tcpc_rst: usb_c0_tcpc_rst {
+ gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
+ };
+ en_pp5000_usb_a0_vbus: en_pp5000_usb_a0_vbus {
+ gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_hdmi_prsnt_odl: hdmi_prsnt_odl {
+ gpios = <&gpio3 7 GPIO_INPUT>;
+ };
+ en_pp5000_z2 {
+ gpios = <&gpio3 4 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_usb_c1_tcpc_int_odl: usb_c1_tcpc_int_odl {
+ gpios = <&gpioe 1 GPIO_INPUT>;
+ };
+ ec_batt_pres_odl {
+ gpios = <&gpioe 0 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ usb_a0_fault_odl {
+ gpios = <&gpioc 7 GPIO_INPUT>;
+ };
+ ec_ap_dp_hpd_odl: ec_ap_dp_hpd_odl {
+ gpios = <&gpio6 1 GPIO_ODR_HIGH>;
+ };
+ ec_pmic_en_odl {
+ gpios = <&gpio7 4 (GPIO_ODR_HIGH | GPIO_VOLTAGE_1P8)>;
+ enum-name = "GPIO_EC_PMIC_EN_ODL";
+ };
+ gpio_ec_volup_btn_odl: ec_volup_btn_odl {
+ gpios = <&gpiod 5 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ec_voldn_btn_odl: ec_voldn_btn_odl {
+ gpios = <&gpioe 2 GPIO_INPUT>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ gpio_ccd_mode_odl: ccd_mode_odl {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ /* unimplemented GPIOs */
+ entering-rw {
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ };
+
+ /*
+ * aliases for sub-board GPIOs
+ */
+ aliases {
+ gpio-en-hdmi-pwr = &gpio_ec_x_gpio1;
+ gpio-usb-c1-frs-en = &gpio_ec_x_gpio1;
+ gpio-usb-c1-ppc-int-odl = &gpio_x_ec_gpio2;
+ gpio-ps185-ec-dp-hpd = &gpio_x_ec_gpio2;
+ gpio-usb-c1-dp-in-hpd = &gpio_ec_x_gpio3;
+ gpio-ps185-pwrdn-odl = &gpio_ec_x_gpio3;
+ };
+
+ hibernate-wake-pins {
+ compatible = "cros-ec,hibernate-wake-pins";
+ wakeup-irqs = <
+ &int_ac_present
+ &int_power_button
+ &int_lid_open
+ >;
+ };
+};
diff --git a/zephyr/program/corsola/gpio_tentacruel.dtsi b/zephyr/projects/corsola/gpio_tentacruel.dts
index a9ac9e8eac..a9ac9e8eac 100644
--- a/zephyr/program/corsola/gpio_tentacruel.dtsi
+++ b/zephyr/projects/corsola/gpio_tentacruel.dts
diff --git a/zephyr/program/trogdor/lazor/host_interface_npcx.dts b/zephyr/projects/corsola/host_interface_npcx.dts
index 14efa3c6b2..14efa3c6b2 100644
--- a/zephyr/program/trogdor/lazor/host_interface_npcx.dts
+++ b/zephyr/projects/corsola/host_interface_npcx.dts
diff --git a/zephyr/program/corsola/npcx_i2c.dtsi b/zephyr/projects/corsola/i2c_kingler.dts
index 90390ab8a0..90390ab8a0 100644
--- a/zephyr/program/corsola/npcx_i2c.dtsi
+++ b/zephyr/projects/corsola/i2c_kingler.dts
diff --git a/zephyr/program/corsola/i2c_krabby.dtsi b/zephyr/projects/corsola/i2c_krabby.dts
index 102ec4947c..a5dc03b655 100644
--- a/zephyr/program/corsola/i2c_krabby.dtsi
+++ b/zephyr/projects/corsola/i2c_krabby.dts
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "ite_i2c.dtsi"
+#include "i2c_krabby_tentacruel.dtsi"
&i2c0 {
- charger_bc12_port1: rt9490@53 {
+ charger: rt9490@53 {
compatible = "richtek,rt9490";
status = "okay";
reg = <0x53>;
- irq = <&int_usb_c1_bc12_charger>;
};
};
diff --git a/zephyr/program/corsola/ite_i2c.dtsi b/zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi
index ba8e31423a..6fd153e1fa 100644
--- a/zephyr/program/corsola/ite_i2c.dtsi
+++ b/zephyr/projects/corsola/i2c_krabby_tentacruel.dtsi
@@ -62,6 +62,13 @@
address-width = <8>;
timeout = <5>;
};
+
+ bc12_port1: rt9490-bc12@53 {
+ compatible = "richtek,rt9490-bc12";
+ status = "okay";
+ reg = <0x53>;
+ irq = <&int_usb_c1_bc12_charger>;
+ };
};
&i2c1 {
diff --git a/zephyr/program/corsola/i2c_magikarp.dtsi b/zephyr/projects/corsola/i2c_magikarp.dts
index 0dfd317b88..fbf5ed6337 100644
--- a/zephyr/program/corsola/i2c_magikarp.dtsi
+++ b/zephyr/projects/corsola/i2c_magikarp.dts
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "ite_i2c.dtsi"
+#include "i2c_krabby_tentacruel.dtsi"
&i2c0 {
- charger_bc12_port1: rt9490@53 {
+ charger: rt9490@53 {
compatible = "richtek,rt9490";
status = "okay";
reg = <0x53>;
- irq = <&int_usb_c1_bc12_charger>;
};
};
diff --git a/zephyr/program/corsola/i2c_tentacruel.dtsi b/zephyr/projects/corsola/i2c_tentacruel.dts
index 05203103d5..a635adcf5c 100644
--- a/zephyr/program/corsola/i2c_tentacruel.dtsi
+++ b/zephyr/projects/corsola/i2c_tentacruel.dts
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "ite_i2c.dtsi"
+#include "i2c_krabby_tentacruel.dtsi"
&i2c0 {
- charger_bc12_port1: rt9490@53 {
+ charger: rt9490@53 {
compatible = "richtek,rt9490";
status = "okay";
reg = <0x53>;
- irq = <&int_usb_c1_bc12_charger>;
thermistor = <&thermistor_rt9490>;
};
};
diff --git a/zephyr/program/corsola/include/baseboard_usbc_config.h b/zephyr/projects/corsola/include/baseboard_usbc_config.h
index a80aa10446..66610fec5e 100644
--- a/zephyr/program/corsola/include/baseboard_usbc_config.h
+++ b/zephyr/projects/corsola/include/baseboard_usbc_config.h
@@ -18,9 +18,6 @@
void ppc_interrupt(enum gpio_signal signal);
void ccd_interrupt(enum gpio_signal signal);
-void hdmi_hpd_interrupt(enum gpio_signal signal);
-void ps185_hdmi_hpd_mux_set(void);
-int corsola_is_dp_muxable(int port);
/* USB-A ports */
enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_COUNT };
diff --git a/zephyr/program/corsola/include/variant_db_detection.h b/zephyr/projects/corsola/include/variant_db_detection.h
index e98ba3067d..285ff327f2 100644
--- a/zephyr/program/corsola/include/variant_db_detection.h
+++ b/zephyr/projects/corsola/include/variant_db_detection.h
@@ -30,8 +30,4 @@ inline enum corsola_db_type corsola_get_db_type(void)
};
#endif /* CONFIG_VARIANT_CORSOLA_DB_DETECTION */
-/* return the adjusted port count for board overridden usbc/charger functions.
- */
-uint8_t board_get_adjusted_usb_pd_port_count(void);
-
#endif /* __CROS_EC_CORSOLA_DB_DETECTION_H */
diff --git a/zephyr/program/corsola/npcx_interrupts.dtsi b/zephyr/projects/corsola/interrupts_kingler.dts
index f3da785a60..f3da785a60 100644
--- a/zephyr/program/corsola/npcx_interrupts.dtsi
+++ b/zephyr/projects/corsola/interrupts_kingler.dts
diff --git a/zephyr/program/corsola/ite_interrupts.dtsi b/zephyr/projects/corsola/interrupts_krabby.dts
index 3caf4660ae..3caf4660ae 100644
--- a/zephyr/program/corsola/ite_interrupts.dtsi
+++ b/zephyr/projects/corsola/interrupts_krabby.dts
diff --git a/zephyr/program/corsola/interrupts_magikarp.dtsi b/zephyr/projects/corsola/interrupts_magikarp.dts
index 4f4e0ba100..4f4e0ba100 100644
--- a/zephyr/program/corsola/interrupts_magikarp.dtsi
+++ b/zephyr/projects/corsola/interrupts_magikarp.dts
diff --git a/zephyr/program/corsola/steelix/interrupts.dtsi b/zephyr/projects/corsola/interrupts_steelix.dts
index b212cd9496..816beb95f4 100644
--- a/zephyr/program/corsola/steelix/interrupts.dtsi
+++ b/zephyr/projects/corsola/interrupts_steelix.dts
@@ -3,10 +3,8 @@
* found in the LICENSE file.
*/
- /* This file should only be included in the project.overlay. */
&int_base_imu {
irq-pin = <&base_imu_int_l>;
flags = <GPIO_INT_EDGE_FALLING>;
handler = "motion_interrupt";
};
-
diff --git a/zephyr/program/corsola/interrupts_tentacruel.dtsi b/zephyr/projects/corsola/interrupts_tentacruel.dts
index 11229daf36..11229daf36 100644
--- a/zephyr/program/corsola/interrupts_tentacruel.dtsi
+++ b/zephyr/projects/corsola/interrupts_tentacruel.dts
diff --git a/zephyr/program/corsola/ite_keyboard.dtsi b/zephyr/projects/corsola/keyboard_steelix.dts
index 8d2a345ff0..9a0dca3e05 100644
--- a/zephyr/program/corsola/ite_keyboard.dtsi
+++ b/zephyr/projects/corsola/keyboard_steelix.dts
@@ -5,9 +5,10 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
- scan-period = <10000>;
+ debounce-down = <15000>;
+ debounce-up = <15000>;
actual-key-mask = <
0x1c /* C0 */
diff --git a/zephyr/program/corsola/led_it81202_base.dtsi b/zephyr/projects/corsola/led_it81202_base.dtsi
index 582af0b092..dce7bb4f95 100644
--- a/zephyr/program/corsola/led_it81202_base.dtsi
+++ b/zephyr/projects/corsola/led_it81202_base.dtsi
@@ -5,7 +5,7 @@
#include <dt-bindings/battery.h>
/ {
- led-colors {
+ led_colors: led-colors {
compatible = "cros-ec,led-policy";
bat-power-state-charge {
@@ -92,17 +92,29 @@
};
pwmleds {
- compatible = "pwm-leds";
+ compatible = "cros-ec,pwm-pin-config";
/* NOTE: &pwm number needs same with channel number */
led_power_white: ec_led1_odl {
- pwms = <&pwm0 PWM_CHANNEL_0 PWM_HZ(324) PWM_POLARITY_INVERTED>;
+ #led-pin-cells = <1>;
+ pwms = <&pwm0
+ PWM_CHANNEL_0
+ PWM_HZ(324)
+ PWM_POLARITY_INVERTED>;
};
led_battery_amber: ec_led2_odl {
- pwms = <&pwm1 PWM_CHANNEL_1 PWM_HZ(324) PWM_POLARITY_INVERTED>;
+ #led-pin-cells = <1>;
+ pwms = <&pwm1
+ PWM_CHANNEL_1
+ PWM_HZ(324)
+ PWM_POLARITY_INVERTED>;
};
led_battery_white: ec_led3_odl {
- pwms = <&pwm2 PWM_CHANNEL_2 PWM_HZ(324) PWM_POLARITY_INVERTED>;
+ #led-pin-cells = <1>;
+ pwms = <&pwm2
+ PWM_CHANNEL_2
+ PWM_HZ(324)
+ PWM_POLARITY_INVERTED>;
};
};
@@ -112,39 +124,37 @@
color_power_off: color-power-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_POWER_LED";
- led-pwms = <&led_power_white>;
- led-values = <0>;
+ led-pins = <&led_power_white 0>;
};
color_power_white: color-power-white {
led-color = "LED_WHITE";
br-color = "EC_LED_COLOR_WHITE";
led-id = "EC_LED_ID_POWER_LED";
- led-pwms = <&led_power_white>;
- led-values = <100>;
+ led-pins = <&led_power_white 100>;
};
color_battery_off: color-battery-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&led_battery_amber &led_battery_white>;
- led-values = <0 0>;
+ led-pins = <&led_battery_amber 0>,
+ <&led_battery_white 0>;
};
color_battery_amber: color-battery-amber {
led-color = "LED_AMBER";
br-color = "EC_LED_COLOR_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&led_battery_amber &led_battery_white>;
- led-values = <100 0>;
+ led-pins = <&led_battery_amber 100>,
+ <&led_battery_white 0>;
};
color_battery_white: color-battery-white {
led-color = "LED_WHITE";
br-color = "EC_LED_COLOR_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&led_battery_amber &led_battery_white>;
- led-values = <0 100>;
+ led-pins = <&led_battery_amber 0>,
+ <&led_battery_white 100>;
};
};
};
diff --git a/zephyr/program/corsola/kingler/project.overlay b/zephyr/projects/corsola/led_kingler.dts
index 93f06d94e2..92f6c4d4fe 100644
--- a/zephyr/program/corsola/kingler/project.overlay
+++ b/zephyr/projects/corsola/led_kingler.dts
@@ -3,32 +3,7 @@
* found in the LICENSE file.
*/
-/* Corsola program common DTS includes */
-
-#include "../common.dtsi"
-#include "../power_signal.dtsi"
-#include "../usba.dtsi"
-#include "../npcx_adc.dtsi"
-#include "../npcx_host_interface.dtsi"
-#include "../npcx_i2c.dtsi"
-#include "../npcx_interrupts.dtsi"
-#include "../npcx_gpio.dtsi"
-#include "../npcx_keyboard.dtsi"
-#include "../npcx_motionsense.dtsi"
-#include "../npcx_usbc.dtsi"
-#include "../npcx_default_gpio_pinctrl.dtsi"
-
-/* board override */
/ {
- batteries {
- default_battery: smp_l20m3pg2 {
- compatible = "smp,l20m3pg2", "battery-smart";
- };
- lgc_l20l3pg2 {
- compatible = "lgc,l20l3pg2", "battery-smart";
- };
- };
-
pwmleds {
compatible = "pwm-leds";
pwm_led0: pwm_led_0 {
diff --git a/zephyr/program/corsola/led_krabby.dtsi b/zephyr/projects/corsola/led_krabby.dts
index b16bff3cac..b16bff3cac 100644
--- a/zephyr/program/corsola/led_krabby.dtsi
+++ b/zephyr/projects/corsola/led_krabby.dts
diff --git a/zephyr/program/corsola/led_magikarp.dtsi b/zephyr/projects/corsola/led_magikarp.dts
index f8b53a42ec..0e2b0aca52 100644
--- a/zephyr/program/corsola/led_magikarp.dtsi
+++ b/zephyr/projects/corsola/led_magikarp.dts
@@ -5,7 +5,7 @@
#include "led_it81202_base.dtsi"
/ {
- led-colors {
+ led_colors: led-colors {
compatible = "cros-ec,led-policy";
/* Magikarp LED bat charge */
@@ -130,8 +130,7 @@
color_power_white: color-power-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_POWER_LED";
- led-pwms = <&led_power_white>;
- led-values = <0>;
+ led-pins = <&led_power_white 0>;
};
};
};
diff --git a/zephyr/projects/corsola/led_steelix.dts b/zephyr/projects/corsola/led_steelix.dts
new file mode 100644
index 0000000000..6a25929327
--- /dev/null
+++ b/zephyr/projects/corsola/led_steelix.dts
@@ -0,0 +1,55 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ pwmleds {
+ compatible = "pwm-leds";
+ led_battery_red: ec_led1_odl {
+ pwms = <&pwm0 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ led_battery_green: ec_led2_odl {
+ pwms = <&pwm1 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ led_power_white: ec_led3_odl {
+ pwms = <&pwm4 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
+ };
+ };
+};
+
+/* Red LED */
+&pwm0_gpc3 {
+ drive-open-drain;
+};
+
+&pwm0 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm0_gpc3>;
+ pinctrl-names = "default";
+};
+
+/* Green LED */
+&pwm1_gpc2 {
+ drive-open-drain;
+};
+
+&pwm1 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm1_gpc2>;
+ pinctrl-names = "default";
+};
+
+/* White LED */
+&pwm4_gpb6 {
+ drive-open-drain;
+};
+
+&pwm4 {
+ status = "okay";
+ clock-bus = "NPCX_CLOCK_BUS_LFCLK";
+ pinctrl-0 = <&pwm4_gpb6>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/program/corsola/led_tentacruel.dtsi b/zephyr/projects/corsola/led_tentacruel.dts
index 05d49371af..5569a956f6 100644
--- a/zephyr/program/corsola/led_tentacruel.dtsi
+++ b/zephyr/projects/corsola/led_tentacruel.dts
@@ -5,7 +5,7 @@
#include "led_it81202_base.dtsi"
/ {
- led-colors {
+ led_colors: led-colors {
compatible = "cros-ec,led-policy";
/* Tentacruel LED bat charge */
@@ -112,8 +112,7 @@
color_power_white: color-power-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_POWER_LED";
- led-pwms = <&led_power_white>;
- led-values = <0>;
+ led-pins = <&led_power_white 0>;
};
};
};
diff --git a/zephyr/program/corsola/npcx_motionsense.dtsi b/zephyr/projects/corsola/motionsense_kingler.dts
index a7f674e01f..a7f674e01f 100644
--- a/zephyr/program/corsola/npcx_motionsense.dtsi
+++ b/zephyr/projects/corsola/motionsense_kingler.dts
diff --git a/zephyr/program/corsola/ite_motionsense.dtsi b/zephyr/projects/corsola/motionsense_krabby.dts
index 1c7d5b2df4..1c7d5b2df4 100644
--- a/zephyr/program/corsola/ite_motionsense.dtsi
+++ b/zephyr/projects/corsola/motionsense_krabby.dts
diff --git a/zephyr/program/corsola/motionsense_magikarp.dtsi b/zephyr/projects/corsola/motionsense_magikarp.dts
index 92e73bd2c6..92e73bd2c6 100644
--- a/zephyr/program/corsola/motionsense_magikarp.dtsi
+++ b/zephyr/projects/corsola/motionsense_magikarp.dts
diff --git a/zephyr/program/skyrim/winterhold/motionsense.dtsi b/zephyr/projects/corsola/motionsense_steelix.dts
index 60d345c0a2..df96fc2e42 100644
--- a/zephyr/program/skyrim/winterhold/motionsense.dtsi
+++ b/zephyr/projects/corsola/motionsense_steelix.dts
@@ -5,6 +5,18 @@
#include <dt-bindings/motionsense/utils.h>
+/* inherit the rot_ref from Kingler and overwrite it */
+&lid_rot_ref {
+ mat33 = <0 1 0
+ 1 0 0
+ 0 0 (-1)>;
+};
+
+&base_rot_ref {
+ mat33 = <1 0 0
+ 0 (-1) 0
+ 0 0 (-1)>;
+};
/ {
aliases {
@@ -13,24 +25,16 @@
* by alias. Using the alias, each driver creates
* its own <>_INT_EVENT.
*/
- bmi3xx-int = &base_accel;
- lis2dw12-int = &base_accel;
-
- /* Use base accelerometer for on-body sensor */
- on-body-sensor = &base_accel;
+ lsm6dsm-int = &base_accel;
};
- /*
- * Declare mutexes used by sensor drivers.
- * A mutex node is used to create an instance of mutex_t.
- * A mutex node is referenced by a sensor node if the
- * corresponding sensor driver needs to use the
- * instance of the mutex.
- */
- motionsense-mutex {
- mutex_bmi3xx: bmi3xx-mutex {
- };
- mutex_lis2dw12: lis2dw12-mutex {
+ /* Rotation matrix used by drivers. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ base_rot_ref_lsm6dsm: base-rotation-ref-lsm6dsm {
+ mat33 = <0 1 0
+ 1 0 0
+ 0 0 (-1)>;
};
};
@@ -44,35 +48,35 @@
* "struct als_drv_data_t" in accelgyro.h
*/
motionsense-sensor-data {
- bmi3xx_data: bmi3xx-drv-data {
- compatible = "cros-ec,drvdata-bmi3xx";
- status = "okay";
- };
lis2dw12_data: lis2dw12-drv-data {
compatible = "cros-ec,drvdata-lis2dw12";
status = "okay";
};
+ lsm6dsm_data_accel: lsm6dsm-accel-drv-data {
+ compatible = "cros-ec,drvdata-lsm6dsm";
+ status = "okay";
+ };
+ lsm6dsm_data_gyro: lsm6dsm-gyro-drv-data {
+ compatible = "cros-ec,drvdata-lsm6dsm";
+ status = "okay";
+ };
};
- /*
- * List of motion sensors that creates motion_sensors array.
- * The nodelabel "lid_accel" and "base_accel" are used to indicate
- * motion sensor IDs for lid angle calculation.
- */
- motionsense-sensor {
- base_accel: base-accel {
+ motionsense-sensor-alt {
+ alt_lid_accel: alt-lid-accel {
compatible = "cros-ec,lis2dw12";
status = "okay";
active-mask = "SENSOR_ACTIVE_S0_S3";
- location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_lis2dw12>;
+ location = "MOTIONSENSE_LOC_LID";
+ mutex = <&lid_mutex>;
port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
+ rot-standard-ref = <&lid_rot_ref>;
default-range = <2>;
drv-data = <&lis2dw12_data>;
- i2c-spi-addr-flags = "LIS2DWL_ADDR1_FLAGS";
-
+ i2c-spi-addr-flags = "LIS2DWL_ADDR0_FLAGS";
+ alternate-for = <&lid_accel>;
+ alternate-ssfc-indicator = <&lid_sensor_1>;
configs {
compatible =
"cros-ec,motionsense-sensor-config";
@@ -84,41 +88,46 @@
};
};
};
- };
- motionsense-sensor-alt {
alt_base_accel: alt-base-accel {
- compatible = "cros-ec,bmi3xx-accel";
+ compatible = "cros-ec,lsm6dsm-accel";
status = "okay";
active-mask = "SENSOR_ACTIVE_S0_S3";
location = "MOTIONSENSE_LOC_BASE";
- mutex = <&mutex_bmi3xx>;
+ mutex = <&base_mutex>;
port = <&i2c_sensor>;
- rot-standard-ref = <&base_rot_ref>;
- drv-data = <&bmi3xx_data>;
+ rot-standard-ref = <&base_rot_ref_lsm6dsm>;
+ drv-data = <&lsm6dsm_data_accel>;
alternate-for = <&base_accel>;
+ alternate-ssfc-indicator = <&base_sensor_1>;
configs {
compatible =
"cros-ec,motionsense-sensor-config";
ec-s0 {
odr = <(12500 | ROUND_UP_FLAG)>;
- ec-rate = <100>;
+ ec-rate = <(100 * USEC_PER_MSEC)>;
};
ec-s3 {
odr = <(12500 | ROUND_UP_FLAG)>;
+ ec-rate = <0>;
};
};
};
- };
- motionsense-sensor-info {
- compatible = "cros-ec,motionsense-sensor-info";
+ alt_base_gyro: alt-base-gyro {
+ compatible = "cros-ec,lsm6dsm-gyro";
+ status = "okay";
- /*
- * list of GPIO interrupts that have to
- * be enabled at initial stage
- */
- sensor-irqs = <&int_accel_gyro>;
+ active-mask = "SENSOR_ACTIVE_S0_S3";
+ location = "MOTIONSENSE_LOC_BASE";
+ mutex = <&base_mutex>;
+ port = <&i2c_sensor>;
+ rot-standard-ref = <&base_rot_ref_lsm6dsm>;
+ default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */
+ drv-data = <&lsm6dsm_data_gyro>;
+ alternate-for = <&base_gyro>;
+ alternate-ssfc-indicator = <&base_sensor_1>;
+ };
};
};
diff --git a/zephyr/program/corsola/motionsense_tentacruel.dtsi b/zephyr/projects/corsola/motionsense_tentacruel.dts
index 68b2c023df..68b2c023df 100644
--- a/zephyr/program/corsola/motionsense_tentacruel.dtsi
+++ b/zephyr/projects/corsola/motionsense_tentacruel.dts
diff --git a/zephyr/program/corsola/npcx_keyboard.dtsi b/zephyr/projects/corsola/npcx_keyboard.dts
index f9e46de1f2..f9e46de1f2 100644
--- a/zephyr/program/corsola/npcx_keyboard.dtsi
+++ b/zephyr/projects/corsola/npcx_keyboard.dts
diff --git a/zephyr/program/corsola/power_signal.dtsi b/zephyr/projects/corsola/power_signal.dts
index 5037bac228..181d7cf96e 100644
--- a/zephyr/program/corsola/power_signal.dtsi
+++ b/zephyr/projects/corsola/power_signal.dts
@@ -5,7 +5,7 @@
/ {
power_signal_list: power-signal-list {
- compatible = "mediatek,mt8186-power-signal-list";
+ compatible = "mt8186,power-signal-list";
ap_in_rst {
power-enum-name = "AP_IN_RST";
power-gpio-pin = <&ap_sysrst_odl_r>;
diff --git a/zephyr/program/corsola/program.conf b/zephyr/projects/corsola/prj.conf
index 86bd30aaed..110b91bbbb 100644
--- a/zephyr/program/corsola/program.conf
+++ b/zephyr/projects/corsola/prj.conf
@@ -28,9 +28,16 @@ CONFIG_SHELL_TAB_AUTOCOMPLETION=y
# CBI
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
+
+# I2C
+CONFIG_I2C=y
# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_MKBP=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
@@ -55,7 +62,6 @@ CONFIG_PLATFORM_EC_USB_PD_DPS=y
CONFIG_PLATFORM_EC_USB_PD_DP_HPD_GPIO=y
CONFIG_PLATFORM_EC_USB_PD_DP_HPD_GPIO_CUSTOM=y
CONFIG_PLATFORM_EC_USB_PD_FRS=y
-CONFIG_PLATFORM_EC_USB_PD_CLEAR_HARD_RESET_STATUS=y
# Power Seq
CONFIG_PLATFORM_EC_CHIPSET_RESUME_INIT_HOOK=y
@@ -75,6 +81,7 @@ CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
CONFIG_PLATFORM_EC_HOSTCMD=y
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
@@ -85,10 +92,8 @@ CONFIG_PLATFORM_EC_I2C_VIRTUAL_BATTERY=y
# Charger
CONFIG_PLATFORM_EC_BC12_CLIENT_MODE_ONLY_PI3USB9201=y
+CONFIG_PLATFORM_EC_CHARGER=y
CONFIG_PLATFORM_EC_CHARGE_MANAGER=y
-# b:257167723: Adapter output current exceeds the spec on heavy-load.
-# Preserve a margin in case of charger overdraw.
-CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=3
# Button
CONFIG_PLATFORM_EC_CMD_BUTTON=y
diff --git a/zephyr/program/corsola/ite_program.conf b/zephyr/projects/corsola/prj_it81202_base.conf
index 55aecebb90..04283bcf5c 100644
--- a/zephyr/program/corsola/ite_program.conf
+++ b/zephyr/projects/corsola/prj_it81202_base.conf
@@ -17,6 +17,7 @@ CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_CHARGE_RAMP_HW=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
+CONFIG_PLATFORM_EC_CHARGER_RT9490=y
CONFIG_PLATFORM_EC_CHARGER_MAINTAIN_VBAT=y
CONFIG_PLATFORM_EC_CHARGER_PSYS=y
CONFIG_PLATFORM_EC_CHARGER_PSYS_READ=y
@@ -36,6 +37,10 @@ CONFIG_PLATFORM_EC_HOST_COMMAND_STATUS=y
# LED
CONFIG_PLATFORM_EC_LED_DT=y
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
# Sensors
CONFIG_PLATFORM_EC_MOTIONSENSE=y
CONFIG_PLATFORM_EC_ACCEL_FIFO=y
@@ -58,6 +63,9 @@ CONFIG_TASK_CHIPSET_STACK_SIZE=1440
CONFIG_TASK_MOTIONSENSE_STACK_SIZE=1024
CONFIG_TASK_PD_STACK_SIZE=1280
+# USB-A
+CONFIG_PLATFORM_EC_USBA=y
+
# USB-C
CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n
CONFIG_PLATFORM_EC_USBC_PPC_RT1739=y
diff --git a/zephyr/program/corsola/kingler/project.conf b/zephyr/projects/corsola/prj_kingler.conf
index cd4a735d71..d7de991e93 100644
--- a/zephyr/program/corsola/kingler/project.conf
+++ b/zephyr/projects/corsola/prj_kingler.conf
@@ -5,5 +5,8 @@
# Variant config
CONFIG_BOARD_KINGLER=y
+# LED
+CONFIG_PLATFORM_EC_LED_PWM=y
+
# Keyboard
CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI2=y
diff --git a/zephyr/program/corsola/krabby/project.conf b/zephyr/projects/corsola/prj_krabby.conf
index c4cde05c16..c4cde05c16 100644
--- a/zephyr/program/corsola/krabby/project.conf
+++ b/zephyr/projects/corsola/prj_krabby.conf
diff --git a/zephyr/program/corsola/magikarp/project.conf b/zephyr/projects/corsola/prj_magikarp.conf
index 2fd94d6fbe..a5ec9ede3b 100644
--- a/zephyr/program/corsola/magikarp/project.conf
+++ b/zephyr/projects/corsola/prj_magikarp.conf
@@ -6,6 +6,7 @@
CONFIG_BOARD_MAGIKARP=y
# USB-C
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USB_MUX_TUSB546=n
CONFIG_PLATFORM_EC_USB_MUX_PS8743=y
CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=45000
@@ -18,5 +19,9 @@ CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
+# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
+
# Battery
CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y
diff --git a/zephyr/program/corsola/npcx_program.conf b/zephyr/projects/corsola/prj_npcx993_base.conf
index 300cbe085d..0642bcd331 100644
--- a/zephyr/program/corsola/npcx_program.conf
+++ b/zephyr/projects/corsola/prj_npcx993_base.conf
@@ -9,6 +9,11 @@ CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
# Debug options and features; can be disabled to save memory or once bringup
# is complete.
CONFIG_SHELL_MINIMAL=n
+CONFIG_LOG=y
+CONFIG_LOG_MODE_MINIMAL=y
+
+# ADC
+CONFIG_ADC=y
# Charger
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
@@ -21,6 +26,7 @@ CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
# PWM
CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
# LED
CONFIG_PLATFORM_EC_LED_COMMON=y
@@ -52,7 +58,11 @@ CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS=y
CONFIG_PLATFORM_EC_TABLET_MODE=y
CONFIG_PLATFORM_EC_TABLET_MODE_SWITCH=y
+# USBA
+CONFIG_PLATFORM_EC_USBA=y
+
# USBC
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n
CONFIG_PLATFORM_EC_PD_POWER_SUPPLY_TURN_OFF_DELAY=15000
CONFIG_PLATFORM_EC_PD_POWER_SUPPLY_TURN_ON_DELAY=15000
@@ -77,6 +87,7 @@ CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_BY_BOARD=y
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
# Keyboard
+CONFIG_CROS_KB_RAW_NPCX=y
CONFIG_CROS_KB_RAW_NPCX_KSO_HIGH_DRIVE=y
CONFIG_SYSCON=y
diff --git a/zephyr/program/corsola/steelix/project.conf b/zephyr/projects/corsola/prj_steelix.conf
index bf2de72512..7a854b1313 100644
--- a/zephyr/program/corsola/steelix/project.conf
+++ b/zephyr/projects/corsola/prj_steelix.conf
@@ -29,6 +29,4 @@ CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=n
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_SHELL_MINIMAL=y
-
-# AC_OK debounce time
-CONFIG_PLATFORM_EC_EXTPOWER_DEBOUNCE_MS=800
+CONFIG_PLATFORM_EC_USB_PD_DEBUG_LEVEL=0
diff --git a/zephyr/program/corsola/tentacruel/project.conf b/zephyr/projects/corsola/prj_tentacruel.conf
index cf5f727cbc..71cc9d9694 100644
--- a/zephyr/program/corsola/tentacruel/project.conf
+++ b/zephyr/projects/corsola/prj_tentacruel.conf
@@ -6,6 +6,7 @@
CONFIG_BOARD_TENTACRUEL=y
# USB-C
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USB_MUX_TUSB546=n
CONFIG_PLATFORM_EC_USB_MUX_PS8743=y
@@ -17,5 +18,9 @@ CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
CONFIG_PLATFORM_EC_ACCELGYRO_BMI_COMM_I2C=y
+# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
+
# Battery
CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y
diff --git a/zephyr/program/corsola/src/board.c b/zephyr/projects/corsola/src/board.c
index bd0ee739b5..93a2443191 100644
--- a/zephyr/program/corsola/src/board.c
+++ b/zephyr/projects/corsola/src/board.c
@@ -3,7 +3,6 @@
* found in the LICENSE file.
*/
-#include "baseboard_usbc_config.h"
#include "console.h"
#include "hooks.h"
#include "typec_control.h"
@@ -12,6 +11,8 @@
#include "usb_pd.h"
#include "usbc_ppc.h"
+#include "baseboard_usbc_config.h"
+
#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
static void ccd_interrupt_deferred(void)
diff --git a/zephyr/program/corsola/src/board_chipset.c b/zephyr/projects/corsola/src/board_chipset.c
index e534bfafcb..54e96bc631 100644
--- a/zephyr/program/corsola/src/board_chipset.c
+++ b/zephyr/projects/corsola/src/board_chipset.c
@@ -5,12 +5,10 @@
/* Corsola baseboard-chipset specific configuration */
-#include "gpio.h"
-
-#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
-
#include <ap_power/ap_power.h>
+#include <zephyr/drivers/gpio.h>
+#include "gpio.h"
static void board_backlight_handler(struct ap_power_ev_callback *cb,
struct ap_power_ev_data data)
diff --git a/zephyr/program/corsola/src/hibernate.c b/zephyr/projects/corsola/src/hibernate.c
index 2b7ed9795d..56c085e077 100644
--- a/zephyr/program/corsola/src/hibernate.c
+++ b/zephyr/projects/corsola/src/hibernate.c
@@ -2,12 +2,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "charger.h"
#include "driver/charger/isl923x_public.h"
#include "system.h"
-#include <zephyr/drivers/gpio.h>
-
/* Corsola board specific hibernate implementation */
__override void board_hibernate(void)
{
diff --git a/zephyr/program/corsola/src/kingler/board_steelix.c b/zephyr/projects/corsola/src/kingler/board_steelix.c
index b4faf5af0c..8b88a6d7c7 100644
--- a/zephyr/program/corsola/src/kingler/board_steelix.c
+++ b/zephyr/projects/corsola/src/kingler/board_steelix.c
@@ -8,6 +8,9 @@
* Steelix is convertible but Rusty is clamshell
* so some functions should be disabled for clamshell.
*/
+#include <zephyr/logging/log.h>
+#include <zephyr/drivers/gpio.h>
+
#include "accelgyro.h"
#include "common.h"
#include "cros_cbi.h"
@@ -19,9 +22,6 @@
#include "motionsense_sensors.h"
#include "tablet_mode.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(board_init, LOG_LEVEL_ERR);
static bool board_is_clamshell;
diff --git a/zephyr/program/corsola/src/kingler/button.c b/zephyr/projects/corsola/src/kingler/button.c
index 920069bef6..920069bef6 100644
--- a/zephyr/program/corsola/src/kingler/button.c
+++ b/zephyr/projects/corsola/src/kingler/button.c
diff --git a/zephyr/program/corsola/src/kingler/i2c.c b/zephyr/projects/corsola/src/kingler/i2c.c
index 5bd8aef7d5..f2bbff3749 100644
--- a/zephyr/program/corsola/src/kingler/i2c.c
+++ b/zephyr/projects/corsola/src/kingler/i2c.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "i2c.h"
#include "i2c/i2c.h"
+#include "i2c.h"
/* Kingler and Steelix board specific i2c implementation */
diff --git a/zephyr/program/corsola/src/kingler/led.c b/zephyr/projects/corsola/src/kingler/led.c
index 4e2c5b12fb..4e2c5b12fb 100644
--- a/zephyr/program/corsola/src/kingler/led.c
+++ b/zephyr/projects/corsola/src/kingler/led.c
diff --git a/zephyr/program/corsola/src/kingler/led_steelix.c b/zephyr/projects/corsola/src/kingler/led_steelix.c
index 1188c4f95e..87b76128e8 100644
--- a/zephyr/program/corsola/src/kingler/led_steelix.c
+++ b/zephyr/projects/corsola/src/kingler/led_steelix.c
@@ -5,6 +5,9 @@
* Battery LED control for Steelix
*/
+#include <zephyr/drivers/pwm.h>
+#include <zephyr/logging/log.h>
+
#include "board_led.h"
#include "common.h"
#include "cros_cbi.h"
@@ -12,9 +15,6 @@
#include "led_onoff_states.h"
#include "util.h"
-#include <zephyr/drivers/pwm.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(board_led, LOG_LEVEL_ERR);
#define BOARD_LED_PWM_PERIOD_NS BOARD_LED_HZ_TO_PERIOD_NS(100)
diff --git a/zephyr/program/corsola/src/kingler/usb_pd_policy.c b/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
index c9e26f6681..3de2857ad1 100644
--- a/zephyr/program/corsola/src/kingler/usb_pd_policy.c
+++ b/zephyr/projects/corsola/src/kingler/usb_pd_policy.c
@@ -3,7 +3,6 @@
* found in the LICENSE file.
*/
-#include "baseboard_usbc_config.h"
#include "charge_manager.h"
#include "console.h"
#include "driver/ppc/rt1718s.h"
@@ -13,6 +12,8 @@
#include "usbc_ppc.h"
#include "util.h"
+#include "baseboard_usbc_config.h"
+
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/corsola/src/kingler/usbc_config.c b/zephyr/projects/corsola/src/kingler/usbc_config.c
index 2e05d3720e..8c0ca86454 100644
--- a/zephyr/program/corsola/src/kingler/usbc_config.c
+++ b/zephyr/projects/corsola/src/kingler/usbc_config.c
@@ -5,12 +5,6 @@
/* Kingler board-specific USB-C configuration */
-/* TODO(b/220196310): Create GPIO driver for RT17181S TCPC */
-#ifdef __REQUIRE_ZEPHYR_GPIOS__
-#undef __REQUIRE_ZEPHYR_GPIOS__
-#endif
-
-#include "baseboard_usbc_config.h"
#include "charger.h"
#include "console.h"
#include "driver/bc12/pi3usb9201_public.h"
@@ -20,7 +14,6 @@
#include "driver/tcpm/anx7447.h"
#include "driver/tcpm/rt1718s.h"
#include "driver/usb_mux/ps8743.h"
-#include "gpio.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
#include "timer.h"
@@ -28,8 +21,16 @@
#include "usb_mux.h"
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
+
+#include "baseboard_usbc_config.h"
#include "variant_db_detection.h"
+/* TODO(b/220196310): Create GPIO driver for RT17181S TCPC */
+#ifdef __REQUIRE_ZEPHYR_GPIOS__
+#undef __REQUIRE_ZEPHYR_GPIOS__
+#endif
+#include "gpio.h"
+
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
@@ -173,8 +174,7 @@ int board_set_active_charge_port(int port)
{
int i;
bool is_valid_port =
- (port >= 0 && port < board_get_adjusted_usb_pd_port_count());
- /* adjust the actual port count when not the type-c db connected. */
+ (port >= 0 && port < board_get_usb_pd_port_count());
if (!is_valid_port && port != CHARGE_PORT_NONE) {
return EC_ERROR_INVAL;
@@ -184,7 +184,7 @@ int board_set_active_charge_port(int port)
CPRINTS("Disabling all charger ports");
/* Disable all ports. */
- for (i = 0; i < board_get_adjusted_usb_pd_port_count(); i++) {
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
/*
* Do not return early if one fails otherwise we can
* get into a boot loop assertion failure.
@@ -209,7 +209,7 @@ int board_set_active_charge_port(int port)
* Turn off the other ports' sink path FETs, before enabling the
* requested charge port.
*/
- for (i = 0; i < board_get_adjusted_usb_pd_port_count(); i++) {
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
if (i == port) {
continue;
}
diff --git a/zephyr/program/corsola/src/krabby/charger_workaround.c b/zephyr/projects/corsola/src/krabby/charger_workaround.c
index be046a947b..d7fd05cc00 100644
--- a/zephyr/program/corsola/src/krabby/charger_workaround.c
+++ b/zephyr/projects/corsola/src/krabby/charger_workaround.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/sys/util.h>
+
#include "charger.h"
#include "driver/charger/rt9490.h"
#include "hooks.h"
#include "i2c.h"
#include "system.h"
-#include <zephyr/sys/util.h>
-
/*
* This workaround and the board id checks only apply to krabby and early
* tentacruel devices.
diff --git a/zephyr/program/corsola/src/krabby/hooks.c b/zephyr/projects/corsola/src/krabby/hooks.c
index 2582998b9c..1eb4f600f2 100644
--- a/zephyr/program/corsola/src/krabby/hooks.c
+++ b/zephyr/projects/corsola/src/krabby/hooks.c
@@ -3,18 +3,17 @@
* found in the LICENSE file.
*/
+#include <zephyr/init.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/pinctrl.h>
+
+#include <ap_power/ap_power.h>
#include "charger.h"
#include "driver/charger/rt9490.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/pinctrl.h>
-#include <zephyr/init.h>
-
-#include <ap_power/ap_power.h>
-
#define I2C3_NODE DT_NODELABEL(i2c3)
PINCTRL_DT_DEFINE(I2C3_NODE);
diff --git a/zephyr/program/corsola/src/krabby/i2c.c b/zephyr/projects/corsola/src/krabby/i2c.c
index 66b88b09b0..a83af77dbd 100644
--- a/zephyr/program/corsola/src/krabby/i2c.c
+++ b/zephyr/projects/corsola/src/krabby/i2c.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "i2c.h"
#include "i2c/i2c.h"
+#include "i2c.h"
/* Krabby board specific i2c implementation */
diff --git a/zephyr/program/corsola/src/krabby/keyboard_magikarp.c b/zephyr/projects/corsola/src/krabby/keyboard_magikarp.c
index bcb706bba3..bcb706bba3 100644
--- a/zephyr/program/corsola/src/krabby/keyboard_magikarp.c
+++ b/zephyr/projects/corsola/src/krabby/keyboard_magikarp.c
diff --git a/zephyr/program/corsola/src/krabby/ppc_krabby.c b/zephyr/projects/corsola/src/krabby/ppc_krabby.c
index dbbfee57b5..d4f574a725 100644
--- a/zephyr/program/corsola/src/krabby/ppc_krabby.c
+++ b/zephyr/projects/corsola/src/krabby/ppc_krabby.c
@@ -6,9 +6,9 @@
/* Krabby PPC/BC12 (RT1739) configuration */
#include "baseboard_usbc_config.h"
+#include "gpio/gpio_int.h"
#include "driver/ppc/rt1739.h"
#include "driver/ppc/syv682x.h"
-#include "gpio/gpio_int.h"
#include "hooks.h"
#include "variant_db_detection.h"
diff --git a/zephyr/program/corsola/src/krabby/ppc_magikarp.c b/zephyr/projects/corsola/src/krabby/ppc_magikarp.c
index 41cce3f73d..41cce3f73d 100644
--- a/zephyr/program/corsola/src/krabby/ppc_magikarp.c
+++ b/zephyr/projects/corsola/src/krabby/ppc_magikarp.c
diff --git a/zephyr/program/corsola/src/krabby/ppc_tentacruel.c b/zephyr/projects/corsola/src/krabby/ppc_tentacruel.c
index 877b9940b4..877b9940b4 100644
--- a/zephyr/program/corsola/src/krabby/ppc_tentacruel.c
+++ b/zephyr/projects/corsola/src/krabby/ppc_tentacruel.c
diff --git a/zephyr/program/corsola/src/krabby/sensor_magikarp.c b/zephyr/projects/corsola/src/krabby/sensor_magikarp.c
index 48e6f6c23c..269bc26fae 100644
--- a/zephyr/program/corsola/src/krabby/sensor_magikarp.c
+++ b/zephyr/projects/corsola/src/krabby/sensor_magikarp.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "accelgyro.h"
#include "common.h"
+#include "accelgyro.h"
#include "cros_cbi.h"
#include "driver/accelgyro_bmi323.h"
#include "driver/accelgyro_icm42607.h"
diff --git a/zephyr/program/corsola/src/krabby/sensor_tentacruel.c b/zephyr/projects/corsola/src/krabby/sensor_tentacruel.c
index 48e6f6c23c..269bc26fae 100644
--- a/zephyr/program/corsola/src/krabby/sensor_tentacruel.c
+++ b/zephyr/projects/corsola/src/krabby/sensor_tentacruel.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "accelgyro.h"
#include "common.h"
+#include "accelgyro.h"
#include "cros_cbi.h"
#include "driver/accelgyro_bmi323.h"
#include "driver/accelgyro_icm42607.h"
diff --git a/zephyr/program/corsola/src/krabby/temp_tentacruel.c b/zephyr/projects/corsola/src/krabby/temp_tentacruel.c
index 08d5204e28..59c5a989aa 100644
--- a/zephyr/program/corsola/src/krabby/temp_tentacruel.c
+++ b/zephyr/projects/corsola/src/krabby/temp_tentacruel.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "charge_state.h"
#include "charger.h"
+#include "charge_state.h"
#include "common.h"
#include "config.h"
#include "console.h"
@@ -15,7 +15,7 @@
#include "util.h"
#define NUM_CURRENT_LEVELS ARRAY_SIZE(current_table)
-#define TEMP_THRESHOLD 50
+#define TEMP_THRESHOLD 55
#define TEMP_BUFF_SIZE 60
#define KEEP_TIME 5
@@ -55,7 +55,7 @@ static uint16_t current_table[] = {
3600,
3000,
2400,
- 1600,
+ 1800,
};
/* Called by hook task every hook second (1 sec) */
diff --git a/zephyr/program/corsola/src/krabby/usb_pd_policy.c b/zephyr/projects/corsola/src/krabby/usb_pd_policy.c
index 8f2a2c3515..8f2a2c3515 100644
--- a/zephyr/program/corsola/src/krabby/usb_pd_policy.c
+++ b/zephyr/projects/corsola/src/krabby/usb_pd_policy.c
diff --git a/zephyr/program/corsola/src/krabby/usbc_config.c b/zephyr/projects/corsola/src/krabby/usbc_config.c
index ab5888616e..7a7f710804 100644
--- a/zephyr/program/corsola/src/krabby/usbc_config.c
+++ b/zephyr/projects/corsola/src/krabby/usbc_config.c
@@ -14,7 +14,6 @@
#include "i2c.h"
#include "usb_pd.h"
#include "usbc_ppc.h"
-#include "variant_db_detection.h"
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
@@ -68,12 +67,11 @@ void board_reset_pd_mcu(void)
*/
}
+#ifndef CONFIG_TEST
int board_set_active_charge_port(int port)
{
int i;
- int is_valid_port =
- (port >= 0 && port < board_get_adjusted_usb_pd_port_count());
- /* adjust the actual port count when not the type-c db connected. */
+ int is_valid_port = (port >= 0 && port < board_get_usb_pd_port_count());
if (!is_valid_port && port != CHARGE_PORT_NONE) {
return EC_ERROR_INVAL;
@@ -83,7 +81,7 @@ int board_set_active_charge_port(int port)
CPRINTS("Disabling all charger ports");
/* Disable all ports. */
- for (i = 0; i < board_get_adjusted_usb_pd_port_count(); i++) {
+ for (i = 0; i < ppc_cnt; i++) {
/*
* Do not return early if one fails otherwise we can
* get into a boot loop assertion failure.
@@ -108,7 +106,7 @@ int board_set_active_charge_port(int port)
* Turn off the other ports' sink path FETs, before enabling the
* requested charge port.
*/
- for (i = 0; i < board_get_adjusted_usb_pd_port_count(); i++) {
+ for (i = 0; i < ppc_cnt; i++) {
if (i == port) {
continue;
}
@@ -126,6 +124,7 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
+#endif
#ifdef CONFIG_USB_PD_VBUS_MEASURE_ADC_EACH_PORT
enum adc_channel board_get_vbus_adc(int port)
diff --git a/zephyr/program/corsola/src/usb_pd_policy.c b/zephyr/projects/corsola/src/usb_pd_policy.c
index a5f3f11134..a885362c61 100644
--- a/zephyr/program/corsola/src/usb_pd_policy.c
+++ b/zephyr/projects/corsola/src/usb_pd_policy.c
@@ -4,9 +4,8 @@
*/
#include "atomic.h"
-#include "baseboard_usbc_config.h"
-#include "chipset.h"
#include "console.h"
+#include "chipset.h"
#include "hooks.h"
#include "timer.h"
#include "typec_control.h"
@@ -15,6 +14,8 @@
#include "usb_pd.h"
#include "usbc_ppc.h"
+#include "baseboard_usbc_config.h"
+
#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
diff --git a/zephyr/program/corsola/src/usbc_config.c b/zephyr/projects/corsola/src/usbc_config.c
index 93eb72a48f..e3a2796de5 100644
--- a/zephyr/program/corsola/src/usbc_config.c
+++ b/zephyr/projects/corsola/src/usbc_config.c
@@ -5,11 +5,14 @@
/* Corsola baseboard-specific USB-C configuration */
+#include <zephyr/drivers/gpio.h>
+#include <ap_power/ap_power.h>
+
#include "adc.h"
#include "baseboard_usbc_config.h"
#include "button.h"
-#include "charge_state_v2.h"
#include "charger.h"
+#include "charge_state_v2.h"
#include "console.h"
#include "ec_commands.h"
#include "extpower.h"
@@ -17,13 +20,13 @@
#include "hooks.h"
#include "i2c.h"
#include "lid_switch.h"
+#include "task.h"
+#include "ppc/syv682x_public.h"
#include "power.h"
#include "power_button.h"
-#include "ppc/syv682x_public.h"
#include "spi.h"
#include "switch.h"
#include "tablet_mode.h"
-#include "task.h"
#include "uart.h"
#include "usb_charge.h"
#include "usb_mux.h"
@@ -31,11 +34,8 @@
#include "usb_tc_sm.h"
#include "usbc/usb_muxes.h"
#include "usbc_ppc.h"
-#include "variant_db_detection.h"
-#include <zephyr/drivers/gpio.h>
-
-#include <ap_power/ap_power.h>
+#include "variant_db_detection.h"
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
@@ -59,11 +59,6 @@ DECLARE_HOOK(HOOK_INIT, baseboard_init, HOOK_PRIO_PRE_DEFAULT);
__override uint8_t board_get_usb_pd_port_count(void)
{
- /* This function returns the PORT_COUNT+1 when HDMI db is connected.
- * This is a trick to ensure the usb_mux_set being set properley.
- * HDMI display functions using the USB virtual mux to * communicate
- * with the DP bridge.
- */
if (corsola_get_db_type() == CORSOLA_DB_HDMI) {
if (tasks_inited) {
return CONFIG_USB_PD_PORT_MAX_COUNT;
@@ -77,15 +72,6 @@ __override uint8_t board_get_usb_pd_port_count(void)
return CONFIG_USB_PD_PORT_MAX_COUNT;
}
-uint8_t board_get_adjusted_usb_pd_port_count(void)
-{
- if (corsola_get_db_type() == CORSOLA_DB_TYPEC) {
- return CONFIG_USB_PD_PORT_MAX_COUNT;
- } else {
- return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- }
-}
-
/* USB-A */
void usb_a0_interrupt(enum gpio_signal signal)
{
@@ -126,6 +112,13 @@ __override enum pd_dual_role_states pd_get_drp_state_in_s0(void)
}
}
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
{
/*
@@ -135,6 +128,92 @@ void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
*/
}
+/**
+ * Handle PS185 HPD changing state.
+ */
+int debounced_hpd;
+
+static void ps185_hdmi_hpd_deferred(void)
+{
+ const int new_hpd =
+ gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
+
+ /* HPD status not changed, probably a glitch, just return. */
+ if (debounced_hpd == new_hpd) {
+ return;
+ }
+
+ debounced_hpd = new_hpd;
+
+ if (!corsola_is_dp_muxable(USBC_PORT_C1)) {
+ if (debounced_hpd) {
+ CPRINTS("C0 port is already muxed.");
+ }
+ return;
+ }
+
+ if (debounced_hpd) {
+ dp_status[USBC_PORT_C1] =
+ VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
+ 0, /* HPD level ... not applicable */
+ 0, /* exit DP? ... no */
+ 0, /* usb mode? ... no */
+ 0, /* multi-function ... no */
+ 1, /* DP enabled ... yes */
+ 0, /* power low? ... no */
+ (!!DP_FLAGS_DP_ON));
+ /* update C1 virtual mux */
+ usb_mux_set(USBC_PORT_C1, USB_PD_MUX_DP_ENABLED,
+ USB_SWITCH_DISCONNECT,
+ 0 /* polarity, don't care */);
+
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(dp_aux_path_sel),
+ debounced_hpd);
+ CPRINTS("Set DP_AUX_PATH_SEL: %d", 1);
+ }
+ svdm_set_hpd_gpio(USBC_PORT_C1, debounced_hpd);
+ CPRINTS(debounced_hpd ? "HDMI plug" : "HDMI unplug");
+}
+DECLARE_DEFERRED(ps185_hdmi_hpd_deferred);
+
+static void ps185_hdmi_hpd_disconnect_deferred(void)
+{
+ const int new_hpd =
+ gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
+
+ if (debounced_hpd == new_hpd && !new_hpd) {
+ dp_status[USBC_PORT_C1] =
+ VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
+ 0, /* HPD level ... not applicable */
+ 0, /* exit DP? ... no */
+ 0, /* usb mode? ... no */
+ 0, /* multi-function ... no */
+ 0, /* DP enabled ... no */
+ 0, /* power low? ... no */
+ (!DP_FLAGS_DP_ON));
+ usb_mux_set(USBC_PORT_C1, USB_PD_MUX_NONE,
+ USB_SWITCH_DISCONNECT,
+ 0 /* polarity, don't care */);
+ }
+}
+DECLARE_DEFERRED(ps185_hdmi_hpd_disconnect_deferred);
+
+#define PS185_HPD_DEBOUCE 250
+#define HPD_SINK_ABSENCE_DEBOUNCE (2 * MSEC)
+
+static void hdmi_hpd_interrupt(enum gpio_signal signal)
+{
+ hook_call_deferred(&ps185_hdmi_hpd_deferred_data, PS185_HPD_DEBOUCE);
+
+ if (!gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd))) {
+ hook_call_deferred(&ps185_hdmi_hpd_disconnect_deferred_data,
+ HPD_SINK_ABSENCE_DEBOUNCE);
+ } else {
+ hook_call_deferred(&ps185_hdmi_hpd_disconnect_deferred_data,
+ -1);
+ }
+}
+
/* HDMI/TYPE-C function shared subboard interrupt */
void x_ec_interrupt(enum gpio_signal signal)
{
@@ -174,13 +253,6 @@ static void board_hdmi_handler(struct ap_power_ev_callback *cb,
static void tasks_init_deferred(void)
{
tasks_inited = true;
- if (corsola_get_db_type() == CORSOLA_DB_HDMI) {
- /* If the HDMI port is plugged on-boot, and the usb_mux won't
- * be configured before the task inited. Re-invoke the
- * HPD configuration after task inited.
- */
- ps185_hdmi_hpd_mux_set();
- }
}
DECLARE_DEFERRED(tasks_init_deferred);
diff --git a/zephyr/program/corsola/src/variant_db_detection.c b/zephyr/projects/corsola/src/variant_db_detection.c
index 9ade144513..6099d86bdd 100644
--- a/zephyr/program/corsola/src/variant_db_detection.c
+++ b/zephyr/projects/corsola/src/variant_db_detection.c
@@ -4,23 +4,18 @@
*/
/* Corsola daughter board detection */
-#include "baseboard_usbc_config.h"
+#include <zephyr/drivers/gpio.h>
+
#include "console.h"
#include "cros_cbi.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
-#include "usb_mux.h"
-#include "variant_db_detection.h"
-#include <zephyr/drivers/gpio.h>
+#include "variant_db_detection.h"
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
-#ifdef TEST_BUILD
-uint32_t dp_status[CONFIG_USB_PD_PORT_MAX_COUNT];
-#endif
-
static void corsola_db_config(enum corsola_db_type type)
{
switch (type) {
@@ -118,93 +113,3 @@ static void corsola_db_init(void)
corsola_get_db_type();
}
DECLARE_HOOK(HOOK_INIT, corsola_db_init, HOOK_PRIO_PRE_I2C);
-
-/**
- * Handle PS185 HPD changing state.
- */
-void ps185_hdmi_hpd_mux_set(void)
-{
- const int hpd =
- gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
-
- if (!corsola_is_dp_muxable(USBC_PORT_C1)) {
- return;
- }
-
- if (hpd && !(usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED)) {
- dp_status[USBC_PORT_C1] =
- VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
- 0, /* HPD level ... not applicable */
- 0, /* exit DP? ... no */
- 0, /* usb mode? ... no */
- 0, /* multi-function ... no */
- 1, /* DP enabled ... yes */
- 0, /* power low? ... no */
- (!!DP_FLAGS_DP_ON));
- /* update C1 virtual mux */
- usb_mux_set(USBC_PORT_C1, USB_PD_MUX_DP_ENABLED,
- USB_SWITCH_DISCONNECT,
- 0 /* polarity, don't care */);
- CPRINTS("HDMI plug");
- }
-}
-
-static void ps185_hdmi_hpd_deferred(void)
-{
- const int hpd =
- gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
-
- if (!hpd && (usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED)) {
- dp_status[USBC_PORT_C1] =
- VDO_DP_STATUS(0, /* HPD IRQ ... not applicable */
- 0, /* HPD level ... not applicable */
- 0, /* exit DP? ... no */
- 0, /* usb mode? ... no */
- 0, /* multi-function ... no */
- 0, /* DP enabled ... no */
- 0, /* power low? ... no */
- (!DP_FLAGS_DP_ON));
- usb_mux_set(USBC_PORT_C1, USB_PD_MUX_NONE,
- USB_SWITCH_DISCONNECT,
- 0 /* polarity, don't care */);
- CPRINTS("HDMI unplug");
-
- return;
- }
-
- ps185_hdmi_hpd_mux_set();
-}
-DECLARE_DEFERRED(ps185_hdmi_hpd_deferred);
-
-#define HPD_SINK_ABSENCE_DEBOUNCE (2 * MSEC)
-
-void hdmi_hpd_interrupt(enum gpio_signal signal)
-{
- const int hpd =
- gpio_pin_get_dt(GPIO_DT_FROM_ALIAS(gpio_ps185_ec_dp_hpd));
-
- if (!hpd) {
- hook_call_deferred(&ps185_hdmi_hpd_deferred_data,
- HPD_SINK_ABSENCE_DEBOUNCE);
- } else {
- hook_call_deferred(&ps185_hdmi_hpd_deferred_data, -1);
- }
-
- /* C0 DP is muxed, we should not send HPD to the AP */
- if (!corsola_is_dp_muxable(USBC_PORT_C1)) {
- if (hpd) {
- CPRINTS("C0 port is already muxed.");
- }
- return;
- }
-
- if (hpd && !(usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED)) {
- /* set dp_aux_path_sel first, and configure the usb_mux in the
- * deferred hook to prevent from dead locking.
- */
- gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(dp_aux_path_sel), hpd);
- hook_call_deferred(&ps185_hdmi_hpd_deferred_data, 0);
- }
-
- svdm_set_hpd_gpio(USBC_PORT_C1, hpd);
-}
diff --git a/zephyr/program/corsola/thermistor_tentacruel.dtsi b/zephyr/projects/corsola/thermistor_tentacruel.dts
index f9e5306f24..f9e5306f24 100644
--- a/zephyr/program/corsola/thermistor_tentacruel.dtsi
+++ b/zephyr/projects/corsola/thermistor_tentacruel.dts
diff --git a/zephyr/program/corsola/usba.dtsi b/zephyr/projects/corsola/usba.dts
index 2ecb3b7d5a..2ecb3b7d5a 100644
--- a/zephyr/program/corsola/usba.dtsi
+++ b/zephyr/projects/corsola/usba.dts
diff --git a/zephyr/projects/corsola/usba_steelix.dts b/zephyr/projects/corsola/usba_steelix.dts
new file mode 100644
index 0000000000..0ddd67f664
--- /dev/null
+++ b/zephyr/projects/corsola/usba_steelix.dts
@@ -0,0 +1,10 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* steelix usba port enable config */
+&usba_port_enable_list {
+ enable-pins = <&en_pp5000_usb_a0_vbus
+ &en_pp5000_usb_a1_vbus>;
+};
diff --git a/zephyr/program/corsola/npcx_usbc.dtsi b/zephyr/projects/corsola/usbc_kingler.dts
index 18bc6ce303..18bc6ce303 100644
--- a/zephyr/program/corsola/npcx_usbc.dtsi
+++ b/zephyr/projects/corsola/usbc_kingler.dts
diff --git a/zephyr/program/corsola/ite_usbc.dtsi b/zephyr/projects/corsola/usbc_krabby.dts
index f8881e437c..a72864da35 100644
--- a/zephyr/program/corsola/ite_usbc.dtsi
+++ b/zephyr/projects/corsola/usbc_krabby.dts
@@ -14,7 +14,7 @@
bc12 = <&bc12_ppc_port0>;
ppc = <&bc12_ppc_port0>;
tcpc = <&usbpd0>;
- chg = <&charger_bc12_port1>;
+ chg = <&charger>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&it5205_mux_0 &virtual_mux_0>;
@@ -29,7 +29,7 @@
port1@1 {
compatible = "named-usbc-port";
reg = <1>;
- bc12 = <&charger_bc12_port1>;
+ bc12 = <&bc12_port1>;
ppc = <&ppc_port1>;
tcpc = <&usbpd1>;
usb-mux-chain-1 {
diff --git a/zephyr/program/corsola/usbc_magikarp.dtsi b/zephyr/projects/corsola/usbc_magikarp.dts
index 1d96f2a194..c94db15b3a 100644
--- a/zephyr/program/corsola/usbc_magikarp.dtsi
+++ b/zephyr/projects/corsola/usbc_magikarp.dts
@@ -14,7 +14,7 @@
bc12 = <&bc12_port0>;
ppc = <&ppc_port0>;
tcpc = <&usbpd0>;
- chg = <&charger_bc12_port1>;
+ chg = <&charger>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&it5205_mux_0 &virtual_mux_0>;
@@ -29,7 +29,7 @@
port1@1 {
compatible = "named-usbc-port";
reg = <1>;
- bc12 = <&charger_bc12_port1>;
+ bc12 = <&bc12_port1>;
ppc = <&ppc_port1>;
tcpc = <&usbpd1>;
usb-mux-chain-1 {
diff --git a/zephyr/program/corsola/usbc_tentacruel.dtsi b/zephyr/projects/corsola/usbc_tentacruel.dts
index 3a0ead7b3e..bb105a8e08 100644
--- a/zephyr/program/corsola/usbc_tentacruel.dtsi
+++ b/zephyr/projects/corsola/usbc_tentacruel.dts
@@ -15,7 +15,7 @@
ppc = <&bc12_ppc_port0>;
ppc_alt = <&ppc_port0>;
tcpc = <&usbpd0>;
- chg = <&charger_bc12_port1>;
+ chg = <&charger>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&it5205_mux_0 &virtual_mux_0>;
@@ -30,7 +30,7 @@
port1@1 {
compatible = "named-usbc-port";
reg = <1>;
- bc12 = <&charger_bc12_port1>;
+ bc12 = <&bc12_port1>;
ppc = <&ppc_port1>;
tcpc = <&usbpd1>;
usb-mux-chain-1 {
diff --git a/zephyr/projects/herobrine/BUILD.py b/zephyr/projects/herobrine/BUILD.py
new file mode 100644
index 0000000000..d38803deb7
--- /dev/null
+++ b/zephyr/projects/herobrine/BUILD.py
@@ -0,0 +1,124 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Define zmake projects for herobrine."""
+
+
+def register_variant(
+ project_name, extra_dts_overlays=(), extra_kconfig_files=()
+):
+ """Register a variant of herobrine."""
+ register_npcx_project(
+ project_name=project_name,
+ zephyr_board="npcx9m3f",
+ dts_overlays=[
+ # Common to all projects.
+ here / "adc.dts",
+ here / "common.dts",
+ here / "interrupts.dts",
+ here / "keyboard.dts",
+ here / "default_gpio_pinctrl.dts",
+ # Project-specific DTS customization.
+ *extra_dts_overlays,
+ ],
+ kconfig_files=[
+ # Common to all projects.
+ here / "prj.conf",
+ # Project-specific KConfig customization.
+ *extra_kconfig_files,
+ ],
+ )
+
+
+register_variant(
+ project_name="evoker",
+ extra_dts_overlays=[
+ here / "display.dts",
+ here / "battery_evoker.dts",
+ here / "gpio_evoker.dts",
+ here / "i2c_evoker.dts",
+ here / "led_pins_evoker.dts",
+ here / "led_policy_evoker.dts",
+ here / "motionsense_evoker.dts",
+ here / "switchcap.dts",
+ here / "usbc_evoker.dts",
+ ],
+ extra_kconfig_files=[here / "prj_evoker.conf"],
+)
+
+register_variant(
+ project_name="herobrine",
+ extra_dts_overlays=[
+ here / "display.dts",
+ here / "battery_herobrine.dts",
+ here / "gpio.dts",
+ here / "i2c_herobrine.dts",
+ here / "led_pins_herobrine.dts",
+ here / "led_policy_herobrine.dts",
+ here / "motionsense.dts",
+ here / "switchcap.dts",
+ here / "usbc_herobrine.dts",
+ ],
+ extra_kconfig_files=[here / "prj_herobrine.conf"],
+)
+
+register_variant(
+ project_name="hoglin",
+ extra_dts_overlays=[
+ here / "battery_hoglin.dts",
+ here / "gpio_hoglin.dts",
+ here / "i2c_hoglin.dts",
+ here / "led_pins_hoglin.dts",
+ here / "led_policy_hoglin.dts",
+ here / "motionsense_hoglin.dts",
+ here / "switchcap_hoglin.dts",
+ here / "usbc_hoglin.dts",
+ ],
+ extra_kconfig_files=[here / "prj_hoglin.conf"],
+)
+
+register_variant(
+ project_name="villager",
+ extra_dts_overlays=[
+ here / "battery_villager.dts",
+ here / "gpio_villager.dts",
+ here / "i2c_villager.dts",
+ here / "led_pins_villager.dts",
+ here / "led_policy_villager.dts",
+ here / "motionsense_villager.dts",
+ here / "switchcap.dts",
+ here / "usbc_villager.dts",
+ ],
+ extra_kconfig_files=[here / "prj_villager.conf"],
+)
+
+register_variant(
+ project_name="zoglin",
+ extra_dts_overlays=[
+ here / "battery_hoglin.dts",
+ here / "gpio_hoglin.dts",
+ here / "i2c_hoglin.dts",
+ here / "led_pins_hoglin.dts",
+ here / "led_policy_hoglin.dts",
+ here / "motionsense_hoglin.dts",
+ here / "switchcap_hoglin.dts",
+ here / "usbc_hoglin.dts",
+ ],
+ extra_kconfig_files=[here / "prj_zoglin.conf"],
+)
+
+register_variant(
+ project_name="zombie",
+ extra_dts_overlays=[
+ here / "battery_zombie.dts",
+ here / "gpio_zombie.dts",
+ here / "i2c_zombie.dts",
+ here / "led_pins_zombie.dts",
+ here / "led_policy_zombie.dts",
+ here / "motionsense_zombie.dts",
+ here / "switchcap.dts",
+ here / "usbc_zombie.dts",
+ ],
+ extra_kconfig_files=[here / "prj_zombie.conf"],
+)
diff --git a/zephyr/program/herobrine/CMakeLists.txt b/zephyr/projects/herobrine/CMakeLists.txt
index 90a49a053e..a7e2fc6cf6 100644
--- a/zephyr/program/herobrine/CMakeLists.txt
+++ b/zephyr/projects/herobrine/CMakeLists.txt
@@ -24,7 +24,8 @@ if(DEFINED CONFIG_BOARD_EVOKER)
project(evoker)
elseif(DEFINED CONFIG_BOARD_HEROBRINE)
project(herobrine)
- add_subdirectory(herobrine)
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/herobrine/alt_dev_replacement.c")
elseif(DEFINED CONFIG_BOARD_HOGLIN)
project(hoglin)
elseif(DEFINED CONFIG_BOARD_VILLAGER)
diff --git a/zephyr/program/herobrine/Kconfig b/zephyr/projects/herobrine/Kconfig
index d0056288d5..d0056288d5 100644
--- a/zephyr/program/herobrine/Kconfig
+++ b/zephyr/projects/herobrine/Kconfig
diff --git a/zephyr/program/herobrine/adc.dtsi b/zephyr/projects/herobrine/adc.dts
index 16a5434e9d..16a5434e9d 100644
--- a/zephyr/program/herobrine/adc.dtsi
+++ b/zephyr/projects/herobrine/adc.dts
diff --git a/zephyr/projects/herobrine/battery_evoker.dts b/zephyr/projects/herobrine/battery_evoker.dts
new file mode 100644
index 0000000000..0e09616c1d
--- /dev/null
+++ b/zephyr/projects/herobrine/battery_evoker.dts
@@ -0,0 +1,15 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: pc_vp_bp153 {
+ compatible = "smp,pc-vp-bp153", "battery-smart";
+ };
+ ap16l5j {
+ compatible = "panasonic,ap16l5j", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/herobrine/battery_herobrine.dts b/zephyr/projects/herobrine/battery_herobrine.dts
new file mode 100644
index 0000000000..b347ec4c3c
--- /dev/null
+++ b/zephyr/projects/herobrine/battery_herobrine.dts
@@ -0,0 +1,12 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: ap16l5j {
+ compatible = "panasonic,ap16l5j", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/projects/herobrine/battery_hoglin.dts b/zephyr/projects/herobrine/battery_hoglin.dts
new file mode 100644
index 0000000000..11180c3988
--- /dev/null
+++ b/zephyr/projects/herobrine/battery_hoglin.dts
@@ -0,0 +1,12 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: 7c01 {
+ compatible = "ganfeng,7c01", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/program/skyrim/crystaldrift/battery.dtsi b/zephyr/projects/herobrine/battery_villager.dts
index 6b1799c233..dafd473a6e 100644
--- a/zephyr/program/skyrim/crystaldrift/battery.dtsi
+++ b/zephyr/projects/herobrine/battery_villager.dts
@@ -5,11 +5,11 @@
/ {
batteries {
- default_battery: aec_5477109 {
- compatible = "aec,5477109", "battery-smart";
+ default_battery: ap19a5k {
+ compatible = "panasonic,ap19a5k", "battery-smart";
};
- smp_l20m3pg1 {
- compatible = "smp,l20m3pg1", "battery-smart";
+ ap19a8k {
+ compatible = "lgc,ap19a8k", "battery-smart";
};
};
};
diff --git a/zephyr/projects/herobrine/battery_zombie.dts b/zephyr/projects/herobrine/battery_zombie.dts
new file mode 100644
index 0000000000..dafd473a6e
--- /dev/null
+++ b/zephyr/projects/herobrine/battery_zombie.dts
@@ -0,0 +1,15 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ batteries {
+ default_battery: ap19a5k {
+ compatible = "panasonic,ap19a5k", "battery-smart";
+ };
+ ap19a8k {
+ compatible = "lgc,ap19a8k", "battery-smart";
+ };
+ };
+};
diff --git a/zephyr/program/herobrine/common.dtsi b/zephyr/projects/herobrine/common.dts
index a722f1dfa2..a722f1dfa2 100644
--- a/zephyr/program/herobrine/common.dtsi
+++ b/zephyr/projects/herobrine/common.dts
diff --git a/zephyr/program/herobrine/default_gpio_pinctrl.dtsi b/zephyr/projects/herobrine/default_gpio_pinctrl.dts
index 604658a145..604658a145 100644
--- a/zephyr/program/herobrine/default_gpio_pinctrl.dtsi
+++ b/zephyr/projects/herobrine/default_gpio_pinctrl.dts
diff --git a/zephyr/program/trogdor/lazor/display.dts b/zephyr/projects/herobrine/display.dts
index 65d3a2d91b..65d3a2d91b 100644
--- a/zephyr/program/trogdor/lazor/display.dts
+++ b/zephyr/projects/herobrine/display.dts
diff --git a/zephyr/program/herobrine/gpio.dtsi b/zephyr/projects/herobrine/gpio.dts
index 60a60ec658..a355aaf099 100644
--- a/zephyr/program/herobrine/gpio.dtsi
+++ b/zephyr/projects/herobrine/gpio.dts
@@ -175,15 +175,19 @@
enum-name = "GPIO_USB_C1_FRS_EN";
};
gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_w_c0: ec_chg_led_w_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_y_c1: ec_chg_led_y_c1 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_w_c1: ec_chg_led_w_c1 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 4 GPIO_OUTPUT_LOW>;
};
ap_ec_spi_mosi {
@@ -239,23 +243,27 @@
enable-pins = <&gpio_en_usb_a_5v>;
};
- gpio_id_sku: sku {
+ sku {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_sku_id0
&gpio_sku_id1
&gpio_sku_id2
>;
+
system = "ternary";
};
- gpio_id_board: board {
+ board {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_brd_id0
&gpio_brd_id1
&gpio_brd_id2
>;
+
system = "ternary";
};
@@ -318,4 +326,4 @@
status = "okay";
pinctrl-names = "sleep";
pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>;
-};
+}; \ No newline at end of file
diff --git a/zephyr/projects/herobrine/gpio_evoker.dts b/zephyr/projects/herobrine/gpio_evoker.dts
new file mode 100644
index 0000000000..d60fdf93c7
--- /dev/null
+++ b/zephyr/projects/herobrine/gpio_evoker.dts
@@ -0,0 +1,329 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ aliases {
+ gpio-wp = &gpio_ec_wp_odl;
+ gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
+ };
+
+ named-gpios {
+ compatible = "named-gpios";
+
+ gpio_usb_c0_pd_int_odl: usb_c0_pd_int_odl {
+ gpios = <&gpioe 0 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_PD_INT_ODL";
+ };
+ gpio_usb_c1_pd_int_odl: usb_c1_pd_int_odl {
+ gpios = <&gpiof 5 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C1_PD_INT_ODL";
+ };
+ gpio_usb_c0_swctl_int_odl: usb_c0_swctl_int_odl {
+ gpios = <&gpio0 3 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C0_SWCTL_INT_ODL";
+ };
+ gpio_usb_c1_swctl_int_odl: usb_c1_swctl_int_odl {
+ gpios = <&gpio4 0 GPIO_INPUT>;
+ enum-name = "GPIO_USB_C1_SWCTL_INT_ODL";
+ };
+ gpio_usb_c0_bc12_int_l: usb_c0_bc12_int_l {
+ gpios = <&gpio6 1 GPIO_INPUT_PULL_UP>;
+ };
+ gpio_usb_c1_bc12_int_l: usb_c1_bc12_int_l {
+ gpios = <&gpio8 2 GPIO_INPUT_PULL_UP>;
+ };
+ gpio_usb_a0_oc_odl: usb_a0_oc_odl {
+ gpios = <&gpiof 4 GPIO_INPUT_PULL_UP>;
+ };
+ gpio_chg_acok_od: chg_acok_od {
+ gpios = <&gpiod 2 GPIO_INPUT>;
+ enum-name = "GPIO_AC_PRESENT";
+ };
+ gpio_ec_pwr_btn_odl: ec_pwr_btn_odl {
+ gpios = <&gpio0 0 GPIO_INPUT>;
+ enum-name = "GPIO_POWER_BUTTON_L";
+ };
+ gpio_ec_voldn_btn_odl: ec_voldn_btn_odl {
+ gpios = <&gpio6 2 GPIO_INPUT_PULL_UP>;
+ enum-name = "GPIO_VOLUME_DOWN_L";
+ };
+ gpio_ec_volup_btn_odl: ec_volup_btn_odl {
+ gpios = <&gpioc 2 GPIO_INPUT_PULL_UP>;
+ enum-name = "GPIO_VOLUME_UP_L";
+ };
+ gpio_ec_wp_odl: ec_wp_odl {
+ gpios = <&gpiod 3 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
+ };
+ gpio_lid_open_ec: lid_open_ec {
+ gpios = <&gpio0 1 GPIO_INPUT>;
+ enum-name = "GPIO_LID_OPEN";
+ };
+ gpio_ap_rst_l: ap_rst_l {
+ gpios = <&gpio5 1 GPIO_INPUT>;
+ enum-name = "GPIO_AP_RST_L";
+ };
+ gpio_ps_hold: ps_hold {
+ gpios = <&gpioa 6 GPIO_INPUT_PULL_DOWN>;
+ enum-name = "GPIO_PS_HOLD";
+ };
+ gpio_ap_suspend: ap_suspend {
+ gpios = <&gpio5 7 GPIO_INPUT>;
+ enum-name = "GPIO_AP_SUSPEND";
+ };
+ gpio_mb_power_good: mb_power_good {
+ gpios = <&gpio3 7 GPIO_INPUT_PULL_DOWN>;
+ enum-name = "GPIO_POWER_GOOD";
+ };
+ gpio_warm_reset_l: warm_reset_l {
+ gpios = <&gpiob 0 GPIO_INPUT>;
+ enum-name = "GPIO_WARM_RESET_L";
+ };
+ ap_ec_spi_cs_l {
+ gpios = <&gpio5 3 GPIO_INPUT_PULL_DOWN>;
+ };
+ gpio_tablet_mode_l: tablet_mode_l {
+ gpios = <&gpioc 6 GPIO_INPUT>;
+ enum-name = "GPIO_TABLET_MODE_L";
+ };
+ gpio_accel_gyro_int_l: accel_gyro_int_l {
+ gpios = <&gpioa 3 GPIO_INPUT>;
+ };
+ gpio_rtc_ec_wake_odl: rtc_ec_wake_odl {
+ gpios = <&gpio0 2 GPIO_INPUT>;
+ };
+ ec_entering_rw {
+ gpios = <&gpio7 2 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_ENTERING_RW";
+ };
+ ccd_mode_odl {
+ gpios = <&gpio6 3 GPIO_INPUT>;
+ enum-name = "GPIO_CCD_MODE_ODL";
+ };
+ ec_batt_pres_odl {
+ gpios = <&gpioe 5 GPIO_INPUT>;
+ enum-name = "GPIO_BATT_PRES_ODL";
+ };
+ ec_gsc_packet_mode {
+ gpios = <&gpio8 3 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_PACKET_MODE_EN";
+ };
+ pmic_resin_l {
+ gpios = <&gpioa 0 GPIO_ODR_HIGH>;
+ enum-name = "GPIO_PMIC_RESIN_L";
+ };
+ pmic_kpd_pwr_odl {
+ gpios = <&gpioa 2 GPIO_ODR_HIGH>;
+ enum-name = "GPIO_PMIC_KPD_PWR_ODL";
+ };
+ ap_ec_int_l {
+ gpios = <&gpio5 6 GPIO_ODR_HIGH>;
+ enum-name = "GPIO_EC_INT_L";
+ };
+ gpio_switchcap_on: switchcap_on {
+ gpios = <&gpiod 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_SWITCHCAP_ON";
+ };
+ gpio_en_pp5000_s5: en_pp5000_s5 {
+ gpios = <&gpio7 3 GPIO_OUTPUT_HIGH>;
+ enum-name = "GPIO_EN_PP5000";
+ };
+ ec_bl_disable_l {
+ /* The PMIC controls backlight enable and this pin must
+ * be HiZ for normal operation. But the backlight can
+ * be enabled by setting this pin low and configuring it
+ * as an output.
+ */
+ gpios = <&gpiob 6 GPIO_INPUT>;
+ enum-name = "GPIO_ENABLE_BACKLIGHT";
+ };
+ lid_accel_int_l {
+ gpios = <&gpioa 1 GPIO_INPUT>;
+ };
+ tp_int_gate {
+ gpios = <&gpio7 4 GPIO_OUTPUT_LOW>;
+ };
+ gpio_usb_c0_pd_rst_l: usb_c0_pd_rst_l {
+ gpios = <&gpiof 1 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_usb_c1_pd_rst_l: usb_c1_pd_rst_l {
+ gpios = <&gpioe 4 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_dp_mux_oe_l: dp_mux_oe_l {
+ gpios = <&gpiob 1 GPIO_ODR_HIGH>;
+ };
+ gpio_dp_mux_sel: dp_mux_sel {
+ gpios = <&gpio4 5 GPIO_OUTPUT_LOW>;
+ };
+ gpio_dp_hot_plug_det_r: dp_hot_plug_det_r {
+ gpios = <&gpio9 5 GPIO_OUTPUT_LOW>;
+ };
+ gpio_en_usb_a_5v: en_usb_a_5v {
+ gpios = <&gpiof 0 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_EN_USB_A_5V";
+ };
+ usb_a_cdp_ilim_en_l {
+ gpios = <&gpio7 5 GPIO_OUTPUT_HIGH>;
+ };
+ gpio_usb_c0_frs_en: usb_c0_frs_en {
+ gpios = <&gpioc 5 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_USB_C0_FRS_EN";
+ };
+ gpio_usb_c1_frs_en: usb_c1_frs_en {
+ gpios = <&gpioc 1 GPIO_OUTPUT_LOW>;
+ enum-name = "GPIO_USB_C1_FRS_EN";
+ };
+ gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
+ #led-pin-cells = <1>;
+ gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_chg_led_w_c0: ec_chg_led_w_c0 {
+ #led-pin-cells = <1>;
+ gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_chg_led_w_c1: ec_chg_led_w_c1 {
+ #led-pin-cells = <1>;
+ gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
+ };
+ gpio_ec_chg_led_r_c0: ec_chg_led_r_c0 {
+ #led-pin-cells = <1>;
+ gpios = <&gpioc 4 GPIO_OUTPUT_LOW>;
+ };
+ ap_ec_spi_mosi {
+ gpios = <&gpio4 6 GPIO_INPUT_PULL_DOWN>;
+ };
+ ap_ec_spi_miso {
+ gpios = <&gpio4 7 GPIO_INPUT_PULL_DOWN>;
+ };
+ ap_ec_spi_clk {
+ gpios = <&gpio5 5 GPIO_INPUT_PULL_DOWN>;
+ };
+ gpio_brd_id0: brd_id0 {
+ gpios = <&gpio9 4 GPIO_INPUT>;
+ enum-name = "GPIO_BOARD_VERSION1";
+ };
+ gpio_brd_id1: brd_id1 {
+ gpios = <&gpio9 7 GPIO_INPUT>;
+ enum-name = "GPIO_BOARD_VERSION2";
+ };
+ gpio_brd_id2: brd_id2 {
+ gpios = <&gpioa 5 GPIO_INPUT>;
+ enum-name = "GPIO_BOARD_VERSION3";
+ };
+ gpio_sku_id0: sku_id0 {
+ gpios = <&gpio6 7 GPIO_INPUT>;
+ };
+ gpio_sku_id1: sku_id1 {
+ gpios = <&gpio7 0 GPIO_INPUT>;
+ };
+ gpio_sku_id2: sku_id2 {
+ gpios = <&gpioe 1 GPIO_INPUT>;
+ };
+ gpio_switchcap_pg: src_vph_pwr_pg {
+ gpios = <&gpioe 2 GPIO_INPUT_PULL_DOWN>;
+ enum-name = "GPIO_SWITCHCAP_PG";
+ };
+ arm_x86 {
+ gpios = <&gpio6 6 GPIO_OUTPUT_LOW>;
+ };
+ ec-i2c-sensor-scl {
+ gpios = <&gpiob 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ ec-i2c-sensor-sda {
+ gpios = <&gpiob 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ };
+ gpio_ec_kso_02_inv: ec_kso_02_inv {
+ gpios = <&gpio1 7 (GPIO_OUTPUT_LOW | GPIO_ACTIVE_LOW)>;
+ };
+ };
+
+ usba-port-enable-list {
+ compatible = "cros-ec,usba-port-enable-pins";
+ enable-pins = <&gpio_en_usb_a_5v>;
+ };
+
+ sku {
+ compatible = "cros-ec,gpio-id";
+
+ bits = <
+ &gpio_sku_id0
+ &gpio_sku_id1
+ &gpio_sku_id2
+ >;
+
+ system = "ternary";
+ };
+
+ board {
+ compatible = "cros-ec,gpio-id";
+
+ bits = <
+ &gpio_brd_id0
+ &gpio_brd_id1
+ &gpio_brd_id2
+ >;
+
+ system = "ternary";
+ };
+
+ unused-pins {
+ compatible = "unused-gpios";
+ unused-gpios =
+ <&gpio5 2 0>,
+ <&gpio5 4 0>,
+ <&gpio7 6 0>,
+ <&gpiod 1 0>,
+ <&gpiod 0 0>,
+ <&gpioe 3 0>,
+ <&gpio0 4 0>,
+ <&gpiod 6 0>,
+ <&gpio3 2 0>,
+ <&gpio3 5 0>,
+ <&gpiod 7 0>,
+ <&gpio8 6 0>,
+ <&gpiod 4 0>,
+ <&gpio4 1 0>,
+ <&gpio3 4 0>,
+ <&gpioc 7 0>,
+ <&gpioa 4 0>,
+ <&gpio9 6 0>,
+ <&gpio9 3 0>,
+ <&gpioa 7 0>,
+ <&gpio5 0 0>,
+ <&gpio8 1 0>,
+ <&gpiob 7 0>;
+ };
+};
+
+/* Power switch logic input pads */
+&psl_in1_gpd2 {
+ /* ACOK_OD */
+ psl-in-mode = "edge";
+ psl-in-pol = "high-rising";
+};
+
+&psl_in2_gp00 {
+ /* EC_PWR_BTN_ODL */
+ psl-in-mode = "edge";
+ psl-in-pol = "low-falling";
+};
+
+&psl_in3_gp01 {
+ /* LID_OPEN_EC */
+ psl-in-mode = "edge";
+ psl-in-pol = "high-rising";
+};
+
+&psl_in4_gp02 {
+ /* RTC_EC_WAKE_ODL */
+ psl-in-mode = "edge";
+ psl-in-pol = "low-falling";
+};
+
+/* Power domain device controlled by PSL (Power Switch Logic) IO pads */
+&power_ctrl_psl {
+ status = "okay";
+ pinctrl-names = "sleep";
+ pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>;
+};
diff --git a/zephyr/program/herobrine/hoglin/gpio.dtsi b/zephyr/projects/herobrine/gpio_hoglin.dts
index c742393ff8..cb7babc9cf 100644
--- a/zephyr/program/herobrine/hoglin/gpio.dtsi
+++ b/zephyr/projects/herobrine/gpio_hoglin.dts
@@ -175,9 +175,11 @@
enum-name = "GPIO_USB_C1_FRS_EN";
};
gpio_ec_chg_led_b_c0: ec_chg_led_b_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_r_c0: ec_chg_led_r_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_y_c1: ec_chg_led_b_c1 {
@@ -239,23 +241,27 @@
enable-pins = <&gpio_en_usb_a_5v>;
};
- gpio_id_sku: sku {
+ sku {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_sku_id0
&gpio_sku_id1
&gpio_sku_id2
>;
+
system = "ternary";
};
- gpio_id_board: board {
+ board {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_brd_id0
&gpio_brd_id1
&gpio_brd_id2
>;
+
system = "ternary";
};
diff --git a/zephyr/program/herobrine/villager/gpio.dtsi b/zephyr/projects/herobrine/gpio_villager.dts
index 9884fc7fb2..1e7625ff6a 100644
--- a/zephyr/program/herobrine/villager/gpio.dtsi
+++ b/zephyr/projects/herobrine/gpio_villager.dts
@@ -175,9 +175,11 @@
enum-name = "GPIO_USB_C1_FRS_EN";
};
gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_b_c0: ec_chg_led_b_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
};
ap_ec_spi_mosi {
@@ -233,23 +235,27 @@
enable-pins = <&gpio_en_usb_a_5v>;
};
- gpio_id_sku: sku {
+ sku {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_sku_id0
&gpio_sku_id1
&gpio_sku_id2
>;
+
system = "ternary";
};
- gpio_id_board: board {
+ board {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_brd_id0
&gpio_brd_id1
&gpio_brd_id2
>;
+
system = "ternary";
};
diff --git a/zephyr/program/herobrine/zombie/gpio.dtsi b/zephyr/projects/herobrine/gpio_zombie.dts
index 711854fb79..14ed1f54d6 100644
--- a/zephyr/program/herobrine/zombie/gpio.dtsi
+++ b/zephyr/projects/herobrine/gpio_zombie.dts
@@ -175,9 +175,11 @@
enum-name = "GPIO_USB_C1_FRS_EN";
};
gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpio6 0 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_b_c0: ec_chg_led_b_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 0 GPIO_OUTPUT_LOW>;
};
ap_ec_spi_mosi {
@@ -233,23 +235,27 @@
enable-pins = <&gpio_en_usb_a_5v>;
};
- gpio_id_sku: sku {
+ sku {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_sku_id0
&gpio_sku_id1
&gpio_sku_id2
>;
+
system = "ternary";
};
- gpio_id_board: board {
+ board {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_brd_id0
&gpio_brd_id1
&gpio_brd_id2
>;
+
system = "ternary";
};
diff --git a/zephyr/program/herobrine/i2c.dtsi b/zephyr/projects/herobrine/i2c_common.dtsi
index 58c3f8d014..b1ed0242c0 100644
--- a/zephyr/program/herobrine/i2c.dtsi
+++ b/zephyr/projects/herobrine/i2c_common.dtsi
@@ -84,18 +84,6 @@
clock-frequency = <I2C_BITRATE_FAST_PLUS>;
pinctrl-0 = <&i2c1_0_sda_scl_gp87_90>;
pinctrl-names = "default";
-
- ppc_port0: syv682x@41 {
- compatible = "silergy,syv682x";
- status = "okay";
- reg = <0x41>;
- frs_en_gpio = <&gpio_usb_c0_frs_en>;
- };
-
- tcpc_port0: ps8xxx@b {
- compatible = "parade,ps8xxx";
- reg = <0xb>;
- };
};
&i2c_ctrl1 {
@@ -108,18 +96,6 @@
clock-frequency = <I2C_BITRATE_FAST_PLUS>;
pinctrl-0 = <&i2c2_0_sda_scl_gp91_92>;
pinctrl-names = "default";
-
- ppc_port1: syv682x@41 {
- compatible = "silergy,syv682x";
- status = "okay";
- reg = <0x41>;
- frs_en_gpio = <&gpio_usb_c1_frs_en>;
- };
-
- tcpc_port1: ps8xxx@b {
- compatible = "parade,ps8xxx";
- reg = <0xb>;
- };
};
&i2c_ctrl2 {
diff --git a/zephyr/projects/herobrine/i2c_evoker.dts b/zephyr/projects/herobrine/i2c_evoker.dts
new file mode 100644
index 0000000000..7023d08c8d
--- /dev/null
+++ b/zephyr/projects/herobrine/i2c_evoker.dts
@@ -0,0 +1,46 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_common.dtsi"
+
+&i2c1_0 {
+ ppc_port0: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c0_frs_en>;
+ };
+
+ ppc_port0_alt: sn5s330@40 {
+ compatible = "ti,sn5s330";
+ status = "okay";
+ reg = <0x40>;
+ };
+
+ tcpc_port0: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
+
+&i2c2_0 {
+ ppc_port1: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c1_frs_en>;
+ };
+
+ ppc_port1_alt: sn5s330@40 {
+ compatible = "ti,sn5s330";
+ status = "okay";
+ reg = <0x40>;
+ };
+
+ tcpc_port1: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
diff --git a/zephyr/projects/herobrine/i2c_herobrine.dts b/zephyr/projects/herobrine/i2c_herobrine.dts
new file mode 100644
index 0000000000..92c68f4215
--- /dev/null
+++ b/zephyr/projects/herobrine/i2c_herobrine.dts
@@ -0,0 +1,39 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_common.dtsi"
+
+&i2c1_0 {
+ ppc_port0: sn5s330@40 {
+ compatible = "ti,sn5s330";
+ status = "okay";
+ reg = <0x40>;
+ };
+
+ ppc_port0_alt: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c0_frs_en>;
+ };
+
+ tcpc_port0: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
+
+&i2c2_0 {
+ ppc_port1: sn5s330@40 {
+ compatible = "ti,sn5s330";
+ status = "okay";
+ reg = <0x40>;
+ };
+
+ tcpc_port1: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
diff --git a/zephyr/projects/herobrine/i2c_hoglin.dts b/zephyr/projects/herobrine/i2c_hoglin.dts
new file mode 100644
index 0000000000..504dbb9248
--- /dev/null
+++ b/zephyr/projects/herobrine/i2c_hoglin.dts
@@ -0,0 +1,34 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_common.dtsi"
+
+&i2c1_0 {
+ ppc_port0: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c0_frs_en>;
+ };
+
+ tcpc_port0: ps8xxx@1b {
+ compatible = "parade,ps8xxx";
+ reg = <0x1b>;
+ };
+};
+
+&i2c2_0 {
+ ppc_port1: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c1_frs_en>;
+ };
+
+ tcpc_port1: ps8xxx@1b {
+ compatible = "parade,ps8xxx";
+ reg = <0x1b>;
+ };
+};
diff --git a/zephyr/projects/herobrine/i2c_villager.dts b/zephyr/projects/herobrine/i2c_villager.dts
new file mode 100644
index 0000000000..efdf88ac38
--- /dev/null
+++ b/zephyr/projects/herobrine/i2c_villager.dts
@@ -0,0 +1,34 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_common.dtsi"
+
+&i2c1_0 {
+ ppc_port0: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c0_frs_en>;
+ };
+
+ tcpc_port0: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
+
+&i2c2_0 {
+ ppc_port1: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c1_frs_en>;
+ };
+
+ tcpc_port1: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
diff --git a/zephyr/projects/herobrine/i2c_zombie.dts b/zephyr/projects/herobrine/i2c_zombie.dts
new file mode 100644
index 0000000000..efdf88ac38
--- /dev/null
+++ b/zephyr/projects/herobrine/i2c_zombie.dts
@@ -0,0 +1,34 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "i2c_common.dtsi"
+
+&i2c1_0 {
+ ppc_port0: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c0_frs_en>;
+ };
+
+ tcpc_port0: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
+
+&i2c2_0 {
+ ppc_port1: syv682x@41 {
+ compatible = "silergy,syv682x";
+ status = "okay";
+ reg = <0x41>;
+ frs_en_gpio = <&gpio_usb_c1_frs_en>;
+ };
+
+ tcpc_port1: ps8xxx@b {
+ compatible = "parade,ps8xxx";
+ reg = <0xb>;
+ };
+};
diff --git a/zephyr/program/herobrine/include/board_chipset.h b/zephyr/projects/herobrine/include/board_chipset.h
index 000bc06654..81c0dd1a40 100644
--- a/zephyr/program/herobrine/include/board_chipset.h
+++ b/zephyr/projects/herobrine/include/board_chipset.h
@@ -6,8 +6,6 @@
#ifndef __CROS_EC_HEROBRINE_BOARD_CHIPSET_H
#define __CROS_EC_HEROBRINE_BOARD_CHIPSET_H
-#include "common.h"
-
__test_only void reset_pp5000_inited(void);
#endif /* __CROS_EC_HEROBRINE_BOARD_CHIPSET_H */
diff --git a/zephyr/program/herobrine/interrupts.dtsi b/zephyr/projects/herobrine/interrupts.dts
index 82650bfc51..82650bfc51 100644
--- a/zephyr/program/herobrine/interrupts.dtsi
+++ b/zephyr/projects/herobrine/interrupts.dts
diff --git a/zephyr/program/herobrine/keyboard.dtsi b/zephyr/projects/herobrine/keyboard.dts
index 3b7e830f2f..3b7e830f2f 100644
--- a/zephyr/program/herobrine/keyboard.dtsi
+++ b/zephyr/projects/herobrine/keyboard.dts
diff --git a/zephyr/program/herobrine/evoker/led_pins.dtsi b/zephyr/projects/herobrine/led_pins_evoker.dts
index 8365691f4d..ff2dc0e36c 100644
--- a/zephyr/program/herobrine/evoker/led_pins.dtsi
+++ b/zephyr/projects/herobrine/led_pins_evoker.dts
@@ -10,55 +10,45 @@
color_power_off: color-power-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_POWER_LED";
- led-pins = <&gpio_ec_chg_led_w_c1>;
- led-values = <0>;
+ led-pins = <&gpio_ec_chg_led_w_c1 0>;
};
color_power_white: color-power-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_POWER_LED";
- br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_ec_chg_led_w_c1>;
- led-values = <1>;
+ led-pins = <&gpio_ec_chg_led_w_c1 1>;
};
color_battery_off: color-battery-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <0 0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 0>,
+ <&gpio_ec_chg_led_r_c0 0>;
};
color_battery_amber: color-battery-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_AMBER";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <1 0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 1>,
+ <&gpio_ec_chg_led_w_c0 0>,
+ <&gpio_ec_chg_led_r_c0 0>;
};
color_battery_white: color-battery-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <0 1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 1>,
+ <&gpio_ec_chg_led_r_c0 0>;
};
color_battery_red: color-battery-red {
led-color = "LED_RED";
led-id = "EC_LED_ID_BATTERY_LED";
- br-color = "EC_LED_COLOR_RED";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <0 0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 0>,
+ <&gpio_ec_chg_led_r_c0 1>;
};
};
};
diff --git a/zephyr/program/herobrine/herobrine/led_pins.dtsi b/zephyr/projects/herobrine/led_pins_herobrine.dts
index 23a0271e69..c509ab1a64 100644
--- a/zephyr/program/herobrine/herobrine/led_pins.dtsi
+++ b/zephyr/projects/herobrine/led_pins_herobrine.dts
@@ -10,53 +10,47 @@
color_off_left: color-off-left {
led-color = "LED_OFF";
led-id = "EC_LED_ID_LEFT_LED";
- led-pins = <&gpio_ec_chg_led_y_c1
- &gpio_ec_chg_led_w_c1>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c1 0>,
+ <&gpio_ec_chg_led_w_c1 0>;
};
color_off_right: color-off-right {
led-color = "LED_OFF";
led-id = "EC_LED_ID_RIGHT_LED";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 0>;
};
color_amber_left: color-amber-left {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_LEFT_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pins = <&gpio_ec_chg_led_y_c1
- &gpio_ec_chg_led_w_c1>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c1 1>,
+ <&gpio_ec_chg_led_w_c1 0>;
};
color_amber_right: color-amber-right {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_RIGHT_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 1>,
+ <&gpio_ec_chg_led_w_c0 0>;
};
color_white_left: color-white-left {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_LEFT_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_ec_chg_led_y_c1
- &gpio_ec_chg_led_w_c1>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c1 0>,
+ <&gpio_ec_chg_led_w_c1 1>;
};
color_white_right: color-white-right {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_RIGHT_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 1>;
};
};
};
diff --git a/zephyr/program/herobrine/hoglin/led_pins.dtsi b/zephyr/projects/herobrine/led_pins_hoglin.dts
index b70c385b98..7b125c5cac 100644
--- a/zephyr/program/herobrine/hoglin/led_pins.dtsi
+++ b/zephyr/projects/herobrine/led_pins_hoglin.dts
@@ -10,27 +10,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pins = <&gpio_ec_chg_led_b_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_b_c0 0>,
+ <&gpio_ec_chg_led_r_c0 0>;
};
color_blue: color-blue {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pins = <&gpio_ec_chg_led_b_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_b_c0 1>,
+ <&gpio_ec_chg_led_r_c0 0>;
};
color_red: color-red {
led-color = "LED_RED";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_RED";
- led-pins = <&gpio_ec_chg_led_b_c0
- &gpio_ec_chg_led_r_c0>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_b_c0 0>,
+ <&gpio_ec_chg_led_r_c0 1>;
};
};
};
diff --git a/zephyr/program/herobrine/villager/led_pins.dtsi b/zephyr/projects/herobrine/led_pins_villager.dts
index 2a74fce58c..b0913cdbce 100644
--- a/zephyr/program/herobrine/villager/led_pins.dtsi
+++ b/zephyr/projects/herobrine/led_pins_villager.dts
@@ -10,27 +10,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_b_c0>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_b_c0 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_b_c0>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 1>,
+ <&gpio_ec_chg_led_b_c0 0>;
};
color_blue: color-blue {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_b_c0>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_b_c0 1>;
};
};
};
diff --git a/zephyr/program/herobrine/zombie/led_pins.dtsi b/zephyr/projects/herobrine/led_pins_zombie.dts
index 2a74fce58c..b0913cdbce 100644
--- a/zephyr/program/herobrine/zombie/led_pins.dtsi
+++ b/zephyr/projects/herobrine/led_pins_zombie.dts
@@ -10,27 +10,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_b_c0>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_b_c0 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_b_c0>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 1>,
+ <&gpio_ec_chg_led_b_c0 0>;
};
color_blue: color-blue {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_b_c0>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_b_c0 1>;
};
};
};
diff --git a/zephyr/program/herobrine/evoker/led_policy.dtsi b/zephyr/projects/herobrine/led_policy_evoker.dts
index fc17755ede..fc17755ede 100644
--- a/zephyr/program/herobrine/evoker/led_policy.dtsi
+++ b/zephyr/projects/herobrine/led_policy_evoker.dts
diff --git a/zephyr/program/herobrine/herobrine/led_policy.dtsi b/zephyr/projects/herobrine/led_policy_herobrine.dts
index 13e5306deb..13e5306deb 100644
--- a/zephyr/program/herobrine/herobrine/led_policy.dtsi
+++ b/zephyr/projects/herobrine/led_policy_herobrine.dts
diff --git a/zephyr/program/herobrine/hoglin/led_policy.dtsi b/zephyr/projects/herobrine/led_policy_hoglin.dts
index 043dfbcaa5..043dfbcaa5 100644
--- a/zephyr/program/herobrine/hoglin/led_policy.dtsi
+++ b/zephyr/projects/herobrine/led_policy_hoglin.dts
diff --git a/zephyr/program/herobrine/villager/led_policy.dtsi b/zephyr/projects/herobrine/led_policy_villager.dts
index f8996a3f4b..f8996a3f4b 100644
--- a/zephyr/program/herobrine/villager/led_policy.dtsi
+++ b/zephyr/projects/herobrine/led_policy_villager.dts
diff --git a/zephyr/program/herobrine/zombie/led_policy.dtsi b/zephyr/projects/herobrine/led_policy_zombie.dts
index f8996a3f4b..f8996a3f4b 100644
--- a/zephyr/program/herobrine/zombie/led_policy.dtsi
+++ b/zephyr/projects/herobrine/led_policy_zombie.dts
diff --git a/zephyr/program/herobrine/motionsense.dtsi b/zephyr/projects/herobrine/motionsense.dts
index 1955f43284..1955f43284 100644
--- a/zephyr/program/herobrine/motionsense.dtsi
+++ b/zephyr/projects/herobrine/motionsense.dts
diff --git a/zephyr/program/herobrine/evoker/motionsense.dtsi b/zephyr/projects/herobrine/motionsense_evoker.dts
index aa7646e0b3..aa7646e0b3 100644
--- a/zephyr/program/herobrine/evoker/motionsense.dtsi
+++ b/zephyr/projects/herobrine/motionsense_evoker.dts
diff --git a/zephyr/program/herobrine/hoglin/motionsense.dtsi b/zephyr/projects/herobrine/motionsense_hoglin.dts
index c3935178ff..c3935178ff 100644
--- a/zephyr/program/herobrine/hoglin/motionsense.dtsi
+++ b/zephyr/projects/herobrine/motionsense_hoglin.dts
diff --git a/zephyr/program/herobrine/villager/motionsense.dtsi b/zephyr/projects/herobrine/motionsense_villager.dts
index 31d00e04a5..31d00e04a5 100644
--- a/zephyr/program/herobrine/villager/motionsense.dtsi
+++ b/zephyr/projects/herobrine/motionsense_villager.dts
diff --git a/zephyr/program/herobrine/zombie/motionsense.dtsi b/zephyr/projects/herobrine/motionsense_zombie.dts
index e069564b35..e069564b35 100644
--- a/zephyr/program/herobrine/zombie/motionsense.dtsi
+++ b/zephyr/projects/herobrine/motionsense_zombie.dts
diff --git a/zephyr/program/herobrine/program.conf b/zephyr/projects/herobrine/prj.conf
index babc8483c9..3391e60dce 100644
--- a/zephyr/program/herobrine/program.conf
+++ b/zephyr/projects/herobrine/prj.conf
@@ -11,10 +11,12 @@ CONFIG_PLATFORM_EC_SWITCH=y
CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_BACKLIGHT_LID=y
CONFIG_PLATFORM_EC_POWER_BUTTON=y
+CONFIG_PLATFORM_EC_CBI_GPIO=y
CONFIG_KERNEL_SHELL=y
CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=y
# I2C options
+CONFIG_I2C=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_I2C_SPEED=y
CONFIG_PLATFORM_EC_HOSTCMD_I2C_CONTROL=y
@@ -28,9 +30,16 @@ CONFIG_SHELL_TAB_AUTOCOMPLETION=y
CONFIG_PLATFORM_EC_LED_COMMON=n
CONFIG_PLATFORM_EC_LED_DT=y
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
# Application Processor is Qualcomm SC7280
CONFIG_AP_ARM_QUALCOMM_SC7280=y
+# GPIO Switchcap
+CONFIG_PLATFORM_EC_SWITCHCAP_GPIO=y
+
# Board version is selected over GPIO board ID pins.
CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y
@@ -47,14 +56,21 @@ CONFIG_PLATFORM_EC_MKBP_EVENT=y
CONFIG_PLATFORM_EC_MKBP_USE_GPIO=y
# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_MKBP=y
CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
CONFIG_PLATFORM_EC_CMD_BUTTON=y
+CONFIG_CROS_KB_RAW_NPCX=y
+
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_I2C_VIRTUAL_BATTERY=y
CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED=y
@@ -70,7 +86,6 @@ CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON=2
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=12500
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y
CONFIG_PLATFORM_EC_CHARGER_PSYS=y
CONFIG_PLATFORM_EC_CHARGER_PSYS_READ=y
@@ -78,8 +93,12 @@ CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20
CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
+# USB-A
+CONFIG_PLATFORM_EC_USBA=y
+
# USB-C
CONFIG_PLATFORM_EC_USB_PD_FRS=y
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USB_PD_USB32_DRD=n
CONFIG_PLATFORM_EC_USBC_PPC_SN5S330=y
CONFIG_PLATFORM_EC_USBC_PPC_SYV682C=y
@@ -110,6 +129,7 @@ CONFIG_PLATFORM_EC_USB_PID=0x5055
# RTC
CONFIG_PLATFORM_EC_RTC=y
+CONFIG_CROS_RTC_NXP_PCF85063A=y
CONFIG_PLATFORM_EC_HOSTCMD_RTC=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC_ALARM=y
diff --git a/zephyr/program/herobrine/evoker/project.conf b/zephyr/projects/herobrine/prj_evoker.conf
index a57c119b90..b4a5fce160 100644
--- a/zephyr/program/herobrine/evoker/project.conf
+++ b/zephyr/projects/herobrine/prj_evoker.conf
@@ -13,10 +13,4 @@ CONFIG_PLATFORM_EC_ACCEL_BMA4XX=y
# ISL9238C disable the CMOUT latch function.
CONFIG_PLATFORM_EC_ISL9238C_DISABLE_CMOUT_LATCH=y
-CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_DUMP=y
-
-# Disable USB-A
-CONFIG_PLATFORM_EC_USBA=n
-
-# Set PCF85063A CAP_SEL
-CONFIG_PLATFORM_EC_PCF85063A_CAP_SEL=y
+CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_DUMP=y \ No newline at end of file
diff --git a/zephyr/program/herobrine/herobrine/project.conf b/zephyr/projects/herobrine/prj_herobrine.conf
index bf39f65692..bf39f65692 100644
--- a/zephyr/program/herobrine/herobrine/project.conf
+++ b/zephyr/projects/herobrine/prj_herobrine.conf
diff --git a/zephyr/program/herobrine/hoglin/project.conf b/zephyr/projects/herobrine/prj_hoglin.conf
index c6e20937c0..c6e20937c0 100644
--- a/zephyr/program/herobrine/hoglin/project.conf
+++ b/zephyr/projects/herobrine/prj_hoglin.conf
diff --git a/zephyr/program/herobrine/villager/project.conf b/zephyr/projects/herobrine/prj_villager.conf
index 35eebe6d99..35eebe6d99 100644
--- a/zephyr/program/herobrine/villager/project.conf
+++ b/zephyr/projects/herobrine/prj_villager.conf
diff --git a/zephyr/program/herobrine/zoglin/project.conf b/zephyr/projects/herobrine/prj_zoglin.conf
index 7f96cf6c79..7f96cf6c79 100644
--- a/zephyr/program/herobrine/zoglin/project.conf
+++ b/zephyr/projects/herobrine/prj_zoglin.conf
diff --git a/zephyr/program/herobrine/zombie/project.conf b/zephyr/projects/herobrine/prj_zombie.conf
index 037ab5cc05..037ab5cc05 100644
--- a/zephyr/program/herobrine/zombie/project.conf
+++ b/zephyr/projects/herobrine/prj_zombie.conf
diff --git a/zephyr/program/herobrine/src/board_chipset.c b/zephyr/projects/herobrine/src/board_chipset.c
index dece9708ff..2312bdb1c4 100644
--- a/zephyr/program/herobrine/src/board_chipset.c
+++ b/zephyr/projects/herobrine/src/board_chipset.c
@@ -5,16 +5,17 @@
/* Herobrine chipset-specific configuration */
-#include "battery.h"
-#include "board_chipset.h"
#include "charger.h"
#include "common.h"
#include "console.h"
+#include "battery.h"
#include "gpio.h"
#include "hooks.h"
#include "timer.h"
#include "usb_pd.h"
+#include "board_chipset.h"
+
#define CPRINTS(format, args...) cprints(CC_HOOK, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_HOOK, format, ##args)
diff --git a/zephyr/program/herobrine/herobrine/src/alt_dev_replacement.c b/zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c
index e1e9250ec4..00acd509f4 100644
--- a/zephyr/program/herobrine/herobrine/src/alt_dev_replacement.c
+++ b/zephyr/projects/herobrine/src/herobrine/alt_dev_replacement.c
@@ -2,11 +2,10 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "cros_board_info.h"
-#include "hooks.h"
-#include "usbc/ppc.h"
-
#include <zephyr/logging/log.h>
+#include "usbc/ppc.h"
+#include "hooks.h"
+#include "cros_board_info.h"
LOG_MODULE_REGISTER(alt_dev_replacement);
diff --git a/zephyr/program/herobrine/src/i2c.c b/zephyr/projects/herobrine/src/i2c.c
index 8cf2cfc232..88b722c42d 100644
--- a/zephyr/program/herobrine/src/i2c.c
+++ b/zephyr/projects/herobrine/src/i2c.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "i2c.h"
#include "i2c/i2c.h"
+#include "i2c.h"
/* Herobrine-NPCX9 board specific i2c implementation */
diff --git a/zephyr/program/herobrine/src/usb_pd_policy.c b/zephyr/projects/herobrine/src/usb_pd_policy.c
index ad34f3b6e4..adc517d3cb 100644
--- a/zephyr/program/herobrine/src/usb_pd_policy.c
+++ b/zephyr/projects/herobrine/src/usb_pd_policy.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "charge_manager.h"
#include "chipset.h"
#include "console.h"
@@ -11,8 +13,6 @@
#include "usbc_ppc.h"
#include "util.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/herobrine/src/usbc_config.c b/zephyr/projects/herobrine/src/usbc_config.c
index 3333a110da..f040ab12cb 100644
--- a/zephyr/program/herobrine/src/usbc_config.c
+++ b/zephyr/projects/herobrine/src/usbc_config.c
@@ -5,10 +5,12 @@
/* Herobrine board-specific USB-C configuration */
-#include "charge_manager.h"
-#include "charge_state.h"
+#include <zephyr/drivers/gpio.h>
+
#include "charger.h"
#include "charger/isl923x_public.h"
+#include "charge_manager.h"
+#include "charge_state.h"
#include "common.h"
#include "config.h"
#include "cros_board_info.h"
@@ -20,13 +22,11 @@
#include "tcpm/ps8xxx_public.h"
#include "tcpm/tcpci.h"
#include "timer.h"
-#include "usb_mux.h"
#include "usb_pd.h"
-#include "usbc/ppc.h"
+#include "usb_mux.h"
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-
-#include <zephyr/drivers/gpio.h>
+#include "usbc/ppc.h"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
@@ -50,7 +50,6 @@ void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(port);
}
-#ifdef CONFIG_PLATFORM_EC_USBA
static void usba_oc_deferred(void)
{
/* Use next number after all USB-C ports to indicate the USB-A port */
@@ -64,7 +63,6 @@ void usba_oc_interrupt(enum gpio_signal signal)
{
hook_call_deferred(&usba_oc_deferred_data, 0);
}
-#endif
void ppc_interrupt(enum gpio_signal signal)
{
@@ -120,7 +118,6 @@ enum ec_status charger_profile_override_set_param(uint32_t param,
return EC_RES_INVALID_PARAM;
}
-#ifdef CONFIG_PLATFORM_EC_USBA
/* Initialize board USC-C things */
static void board_init_usbc(void)
{
@@ -128,7 +125,6 @@ static void board_init_usbc(void)
gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_a0_oc));
}
DECLARE_HOOK(HOOK_INIT, board_init_usbc, HOOK_PRIO_DEFAULT);
-#endif
void board_tcpc_init(void)
{
@@ -140,7 +136,6 @@ void board_tcpc_init(void)
/* Enable PPC interrupts */
gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_swctl));
- gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c1_swctl));
/* Enable TCPC interrupts */
gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_pd));
@@ -249,8 +244,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
@@ -262,7 +257,8 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
charge_ma = max_ma;
}
- charge_set_input_current_limit(charge_ma, charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/zephyr/program/herobrine/switchcap.dtsi b/zephyr/projects/herobrine/switchcap.dts
index fb2db35d1a..ed200a0c6f 100644
--- a/zephyr/program/herobrine/switchcap.dtsi
+++ b/zephyr/projects/herobrine/switchcap.dts
@@ -5,7 +5,7 @@
/ {
switchcap {
- compatible = "cros-ec,switchcap-gpio";
+ compatible = "switchcap-gpio";
enable-pin = <&gpio_switchcap_on>;
power-good-pin = <&gpio_switchcap_pg>;
};
diff --git a/zephyr/test/system_shim/default.overlay b/zephyr/projects/herobrine/switchcap_hoglin.dts
index 13ceee9c19..7c083667a1 100644
--- a/zephyr/test/system_shim/default.overlay
+++ b/zephyr/projects/herobrine/switchcap_hoglin.dts
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "boards/native_posix.overlay"
-
/ {
- chosen {
- cros-ec,bbram = &bbram;
+ switchcap {
+ compatible = "switchcap-gpio";
+ enable-pin = <&gpio_switchcap_on>;
+ poff-delay-ms = <550>;
};
};
diff --git a/zephyr/program/herobrine/usbc.dtsi b/zephyr/projects/herobrine/usbc_evoker.dts
index bed94800dd..20bd48382f 100644
--- a/zephyr/program/herobrine/usbc.dtsi
+++ b/zephyr/projects/herobrine/usbc_evoker.dts
@@ -8,7 +8,7 @@
#address-cells = <1>;
#size-cells = <0>;
- port0: port0@0 {
+ port0@0 {
compatible = "named-usbc-port";
reg = <0>;
bc12 = <&bc12_port0>;
@@ -24,7 +24,7 @@
compatible = "parade,usbc-mux-ps8xxx";
};
- port1: port1@1 {
+ port1@1 {
compatible = "named-usbc-port";
reg = <1>;
bc12 = <&bc12_port1>;
diff --git a/zephyr/projects/herobrine/usbc_herobrine.dts b/zephyr/projects/herobrine/usbc_herobrine.dts
new file mode 100644
index 0000000000..675286ecd7
--- /dev/null
+++ b/zephyr/projects/herobrine/usbc_herobrine.dts
@@ -0,0 +1,43 @@
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ ppc = <&ppc_port0>;
+ ppc_alt = <&ppc_port0_alt>;
+ tcpc = <&tcpc_port0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_0>;
+ };
+ };
+ usb_mux_0: usb-mux-0 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&tcpc_port1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_1>;
+ };
+ };
+ usb_mux_1: usb-mux-1 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+ };
+};
diff --git a/zephyr/projects/herobrine/usbc_hoglin.dts b/zephyr/projects/herobrine/usbc_hoglin.dts
new file mode 100644
index 0000000000..20bd48382f
--- /dev/null
+++ b/zephyr/projects/herobrine/usbc_hoglin.dts
@@ -0,0 +1,42 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ ppc = <&ppc_port0>;
+ tcpc = <&tcpc_port0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_0>;
+ };
+ };
+ usb_mux_0: usb-mux-0 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&tcpc_port1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_1>;
+ };
+ };
+ usb_mux_1: usb-mux-1 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+ };
+};
diff --git a/zephyr/projects/herobrine/usbc_villager.dts b/zephyr/projects/herobrine/usbc_villager.dts
new file mode 100644
index 0000000000..20bd48382f
--- /dev/null
+++ b/zephyr/projects/herobrine/usbc_villager.dts
@@ -0,0 +1,42 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ ppc = <&ppc_port0>;
+ tcpc = <&tcpc_port0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_0>;
+ };
+ };
+ usb_mux_0: usb-mux-0 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&tcpc_port1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_1>;
+ };
+ };
+ usb_mux_1: usb-mux-1 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+ };
+};
diff --git a/zephyr/projects/herobrine/usbc_zombie.dts b/zephyr/projects/herobrine/usbc_zombie.dts
new file mode 100644
index 0000000000..20bd48382f
--- /dev/null
+++ b/zephyr/projects/herobrine/usbc_zombie.dts
@@ -0,0 +1,42 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ usbc {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port0@0 {
+ compatible = "named-usbc-port";
+ reg = <0>;
+ bc12 = <&bc12_port0>;
+ ppc = <&ppc_port0>;
+ tcpc = <&tcpc_port0>;
+ chg = <&charger>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_0>;
+ };
+ };
+ usb_mux_0: usb-mux-0 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+
+ port1@1 {
+ compatible = "named-usbc-port";
+ reg = <1>;
+ bc12 = <&bc12_port1>;
+ ppc = <&ppc_port1>;
+ tcpc = <&tcpc_port1>;
+ usb-mux-chain-1 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&usb_mux_1>;
+ };
+ };
+ usb_mux_1: usb-mux-1 {
+ compatible = "parade,usbc-mux-ps8xxx";
+ };
+ };
+};
diff --git a/zephyr/program/intelrvp/BUILD.py b/zephyr/projects/intelrvp/BUILD.py
index f129b3d2d2..f129b3d2d2 100644
--- a/zephyr/program/intelrvp/BUILD.py
+++ b/zephyr/projects/intelrvp/BUILD.py
diff --git a/zephyr/program/intelrvp/CMakeLists.txt b/zephyr/projects/intelrvp/CMakeLists.txt
index 039627dec6..039627dec6 100644
--- a/zephyr/program/intelrvp/CMakeLists.txt
+++ b/zephyr/projects/intelrvp/CMakeLists.txt
diff --git a/zephyr/program/intelrvp/Kconfig b/zephyr/projects/intelrvp/Kconfig
index 605f57c054..605f57c054 100644
--- a/zephyr/program/intelrvp/Kconfig
+++ b/zephyr/projects/intelrvp/Kconfig
diff --git a/zephyr/program/intelrvp/adlrvp/CMakeLists.txt b/zephyr/projects/intelrvp/adlrvp/CMakeLists.txt
index 71dee29552..71dee29552 100644
--- a/zephyr/program/intelrvp/adlrvp/CMakeLists.txt
+++ b/zephyr/projects/intelrvp/adlrvp/CMakeLists.txt
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/adlrvp_mchp.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/adlrvp_mchp.dts
index 39fd720290..527a62e776 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/adlrvp_mchp.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/adlrvp_mchp.dts
@@ -80,9 +80,10 @@
<&pca95xx 10 0>, <&pca95xx 9 0>, <&pca95xx 8 0>;
};
- max695x@38 {
- compatible = "maxim,max695x";
+ seven_seg_display: max695x-seven-seg-display@38 {
+ compatible = "maxim,seven-seg-display";
reg = <0x38>;
+ label = "MAX695X_SEVEN_SEG_DISPLAY";
};
charger: isl9241@9 {
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/bb_retimer.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/bb_retimer.dts
index 1c760120f1..1c760120f1 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/bb_retimer.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/bb_retimer.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/gpio.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/gpio.dts
index d526fdcb3b..d526fdcb3b 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/gpio.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/gpio.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/interrupts.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/interrupts.dts
index 17986fe2c7..17986fe2c7 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/interrupts.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/interrupts.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/keyboard.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/keyboard.dts
index 2601da793d..b3577e6afd 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/keyboard.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/keyboard.dts
@@ -5,7 +5,7 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
output-settle = <80>;
debounce-down = <9000>;
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/prj.conf b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/prj.conf
index d7220368a2..083530c858 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/prj.conf
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/prj.conf
@@ -3,7 +3,9 @@
# found in the LICENSE file.
CONFIG_BOARD_ADLRVP_MCHP=y
+CONFIG_CROS_FLASH_XEC=y
CONFIG_CROS_SYSTEM_XEC=y
+CONFIG_CROS_KB_RAW_XEC=y
# For MCHP ESPI Drivers
CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD=y
@@ -41,6 +43,7 @@ CONFIG_PLATFORM_EC_RTC=n
# PWM
CONFIG_PWM=n
+CONFIG_PWM_SHELL=n
## INTEL RVP
# Host command
@@ -52,6 +55,9 @@ CONFIG_PLATFORM_EC_THROTTLE_AP=n
## ADL RVP
# CBI
CONFIG_EEPROM=n
+CONFIG_EEPROM_AT24=n
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=n
# LED
CONFIG_PLATFORM_EC_LED_COMMON=n
@@ -69,6 +75,9 @@ CONFIG_PLATFORM_EC_DEDICATED_CHARGE_PORT=y
# H1 issues second reset
CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=n
+# 7-Segment Display
+CONFIG_PLATFORM_EC_MAX695X_SEVEN_SEGMENT_DISPLAY=n
+
# Debug options
# Enable flash console commands
CONFIG_PLATFORM_EC_CONSOLE_CMD_FLASH=y
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/usbc.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/usbc.dts
index 471a1f52e9..471a1f52e9 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_mchp/usbc.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_mchp/usbc.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/adlrvp_npcx.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/adlrvp_npcx.dts
index b8fbd6656d..79723beabd 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/adlrvp_npcx.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/adlrvp_npcx.dts
@@ -112,9 +112,10 @@
<&pca95xx 10 0>, <&pca95xx 9 0>, <&pca95xx 8 0>;
};
- max695x@38 {
- compatible = "maxim,max695x";
+ seven_seg_display: max695x-seven-seg-display@38 {
+ compatible = "maxim,seven-seg-display";
reg = <0x38>;
+ label = "MAX695X_SEVEN_SEG_DISPLAY";
};
charger: isl9241@9 {
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/fan.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts
index 8babe53903..8babe53903 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/fan.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/fan.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/gpio.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/gpio.dts
index 1d38fc877c..1d38fc877c 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/gpio.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/gpio.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/interrupts.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/interrupts.dts
index d7bb40fad2..d7bb40fad2 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/interrupts.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/interrupts.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/keyboard.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/keyboard.dts
index be0a570e95..81d6e82f48 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/keyboard.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/keyboard.dts
@@ -5,7 +5,7 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
output-settle = <35>;
debounce-down = <5000>;
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/prj.conf b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/prj.conf
index d04abada31..2c98fd9330 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/prj.conf
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/prj.conf
@@ -3,11 +3,22 @@
# found in the LICENSE file.
CONFIG_BOARD_ADLRVP_NPCX=y
+CONFIG_CROS_FLASH_NPCX=y
CONFIG_CROS_SYSTEM_NPCX=y
CONFIG_SYSCON=y
# Charger
CONFIG_PLATFORM_EC_DEDICATED_CHARGE_PORT=y
+# FAN
+CONFIG_TACH_NPCX=y
+
+# Keyboard
+CONFIG_CROS_KB_RAW_NPCX=y
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
# RTC
CONFIG_PLATFORM_EC_RTC=y
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/pwm_leds.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm_leds.dts
index eb1576dbff..eb1576dbff 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/pwm_leds.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/pwm_leds.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/temp_sensor.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/temp_sensor.dts
index 93ecaa02f6..93ecaa02f6 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/temp_sensor.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/temp_sensor.dts
diff --git a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/usbc.dts b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/usbc.dts
index 471a1f52e9..471a1f52e9 100644
--- a/zephyr/program/intelrvp/adlrvp/adlrvp_npcx/usbc.dts
+++ b/zephyr/projects/intelrvp/adlrvp/adlrvp_npcx/usbc.dts
diff --git a/zephyr/program/intelrvp/adlrvp/battery.dts b/zephyr/projects/intelrvp/adlrvp/battery.dts
index 1de4111791..1de4111791 100644
--- a/zephyr/program/intelrvp/adlrvp/battery.dts
+++ b/zephyr/projects/intelrvp/adlrvp/battery.dts
diff --git a/zephyr/program/intelrvp/adlrvp/include/adlrvp_zephyr.h b/zephyr/projects/intelrvp/adlrvp/include/adlrvp_zephyr.h
index 135fd4ef4f..135fd4ef4f 100644
--- a/zephyr/program/intelrvp/adlrvp/include/adlrvp_zephyr.h
+++ b/zephyr/projects/intelrvp/adlrvp/include/adlrvp_zephyr.h
diff --git a/zephyr/program/intelrvp/adlrvp/ioex.dts b/zephyr/projects/intelrvp/adlrvp/ioex.dts
index 3e2227dacb..3e2227dacb 100644
--- a/zephyr/program/intelrvp/adlrvp/ioex.dts
+++ b/zephyr/projects/intelrvp/adlrvp/ioex.dts
diff --git a/zephyr/program/intelrvp/adlrvp/prj.conf b/zephyr/projects/intelrvp/adlrvp/prj.conf
index df0811ecdd..4bcee4a953 100644
--- a/zephyr/program/intelrvp/adlrvp/prj.conf
+++ b/zephyr/projects/intelrvp/adlrvp/prj.conf
@@ -17,8 +17,12 @@ CONFIG_PLATFORM_EC_USB_CHARGER=n
# CBI
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
# Charger
+CONFIG_PLATFORM_EC_CHARGER=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=5
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10
@@ -31,9 +35,12 @@ CONFIG_PLATFORM_EC_CHARGER_RUNTIME_CONFIG=y
# LED
CONFIG_PLATFORM_EC_LED_COMMON=y
+CONFIG_PLATFORM_EC_LED_PWM=y
CONFIG_PLATFORM_EC_LED_PWM_TASK_DISABLED=y
# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_TEMP_SENSOR_POWER=y
# USB-C and PD
@@ -58,7 +65,12 @@ CONFIG_PLATFORM_EC_USBC_PPC_SN5S330=y
CONFIG_PLATFORM_EC_USBC_RETIMER_INTEL_BB=y
# IOEX
+CONFIG_PLATFORM_EC_IOEX_CROS_DRV=y
CONFIG_PLATFORM_EC_IOEX_PCA9675=y
+CONFIG_GPIO_PCA95XX=y
+
+# 7-Segment Display
+CONFIG_PLATFORM_EC_MAX695X_SEVEN_SEGMENT_DISPLAY=y
# eSPI
CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_DEFAULT_VW_WIDTH_US=150
diff --git a/zephyr/program/intelrvp/adlrvp/src/adlrvp.c b/zephyr/projects/intelrvp/adlrvp/src/adlrvp.c
index d7d192b1af..ce5196c60d 100644
--- a/zephyr/program/intelrvp/adlrvp/src/adlrvp.c
+++ b/zephyr/projects/intelrvp/adlrvp/src/adlrvp.c
@@ -4,19 +4,19 @@
*/
/* TODO: b/218904113: Convert to using Zephyr GPIOs */
+#include "gpio_signal.h"
#include "adlrvp_zephyr.h"
-#include "battery.h"
-#include "battery_fuel_gauge.h"
-#include "bq25710.h"
-#include "charger.h"
#include "common.h"
#include "console.h"
+#include "intelrvp.h"
+#include "intel_rvp_board_id.h"
+#include "battery_fuel_gauge.h"
+#include "charger.h"
+#include "battery.h"
+#include "bq25710.h"
#include "driver/retimer/bb_retimer_public.h"
#include "extpower.h"
-#include "gpio_signal.h"
#include "hooks.h"
-#include "intel_rvp_board_id.h"
-#include "intelrvp.h"
#include "ioexpander.h"
#include "isl9241.h"
#include "power/icelake.h"
diff --git a/zephyr/program/intelrvp/include/intel_rvp_board_id.h b/zephyr/projects/intelrvp/include/intel_rvp_board_id.h
index 7825b272e3..7825b272e3 100644
--- a/zephyr/program/intelrvp/include/intel_rvp_board_id.h
+++ b/zephyr/projects/intelrvp/include/intel_rvp_board_id.h
diff --git a/zephyr/program/intelrvp/include/intelrvp.h b/zephyr/projects/intelrvp/include/intelrvp.h
index 9b6dc98485..9b6dc98485 100644
--- a/zephyr/program/intelrvp/include/intelrvp.h
+++ b/zephyr/projects/intelrvp/include/intelrvp.h
diff --git a/zephyr/program/intelrvp/led.md b/zephyr/projects/intelrvp/led.md
index c36bc6b36c..c36bc6b36c 100644
--- a/zephyr/program/intelrvp/led.md
+++ b/zephyr/projects/intelrvp/led.md
diff --git a/zephyr/program/intelrvp/legacy_ec_pwrseq.conf b/zephyr/projects/intelrvp/legacy_ec_pwrseq.conf
index 331afb637d..331afb637d 100644
--- a/zephyr/program/intelrvp/legacy_ec_pwrseq.conf
+++ b/zephyr/projects/intelrvp/legacy_ec_pwrseq.conf
diff --git a/zephyr/program/intelrvp/mtlrvp/CMakeLists.txt b/zephyr/projects/intelrvp/mtlrvp/CMakeLists.txt
index c6729af776..c6729af776 100644
--- a/zephyr/program/intelrvp/mtlrvp/CMakeLists.txt
+++ b/zephyr/projects/intelrvp/mtlrvp/CMakeLists.txt
diff --git a/zephyr/program/intelrvp/mtlrvp/ioex.dts b/zephyr/projects/intelrvp/mtlrvp/ioex.dts
index 7d2f4b5820..7d2f4b5820 100644
--- a/zephyr/program/intelrvp/mtlrvp/ioex.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/ioex.dts
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/fan.dts b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/fan.dts
index cf85dd3413..cf85dd3413 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/fan.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/fan.dts
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/gpio.dts b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/gpio.dts
index 77b4cf0573..77b4cf0573 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/gpio.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/gpio.dts
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/interrupts.dts b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/interrupts.dts
index ad928fd593..b120f6c05e 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/interrupts.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/interrupts.dts
@@ -56,10 +56,5 @@
flags = <GPIO_INT_EDGE_BOTH>;
handler = "board_connect_c0_sbu";
};
- int_dc_jack_present: dc_jack_present {
- irq-pin = <&std_adp_prsnt>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "board_dc_jack_interrupt";
- };
};
};
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/keyboard.dts b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/keyboard.dts
index be0a570e95..81d6e82f48 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/keyboard.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/keyboard.dts
@@ -5,7 +5,7 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
output-settle = <35>;
debounce-down = <5000>;
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx.dts b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx.dts
index 25ad865dd7..86a46e3e7a 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx.dts
@@ -105,9 +105,10 @@
reg = <0x39>;
};
- max695x@38 {
- compatible = "maxim,max695x";
+ seven_seg_display: max695x-seven-seg-display@38 {
+ compatible = "maxim,seven-seg-display";
reg = <0x38>;
+ label = "MAX695X_SEVEN_SEG_DISPLAY";
};
charger: isl9241@9 {
@@ -161,7 +162,7 @@
reg = <0x73>;
label = "NCT38XX_C0";
- ioex_c0: gpio@0 {
+ ioex_c0:gpio@0 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x0>;
label = "NCT38XX_C0_GPIO0";
@@ -187,7 +188,7 @@
reg = <0x77>;
label = "NCT38XX_C1";
- ioex_c1: gpio@0 {
+ ioex_c1:gpio@0 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x0>;
label = "NCT38XX_C1_GPIO0";
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx_power_signals.dts b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx_power_signals.dts
index 3c270d296f..3c270d296f 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx_power_signals.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/mtlrvp_npcx_power_signals.dts
diff --git a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/prj.conf b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/prj.conf
index e4b25b48e7..45b101a7ac 100644
--- a/zephyr/program/intelrvp/mtlrvp/mtlrvpp_npcx/prj.conf
+++ b/zephyr/projects/intelrvp/mtlrvp/mtlrvpp_npcx/prj.conf
@@ -3,8 +3,16 @@
# found in the LICENSE file.
CONFIG_BOARD_MTLRVP_NPCX=y
+CONFIG_CROS_FLASH_NPCX=y
CONFIG_CROS_SYSTEM_NPCX=y
CONFIG_SYSCON=y
-# RTC
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
+# Fan
+CONFIG_TACH_NPCX=y
+
+#RTC
CONFIG_PLATFORM_EC_RTC=y
diff --git a/zephyr/program/intelrvp/mtlrvp/prj.conf b/zephyr/projects/intelrvp/mtlrvp/prj.conf
index 1270712f99..1a521d4c89 100644
--- a/zephyr/program/intelrvp/mtlrvp/prj.conf
+++ b/zephyr/projects/intelrvp/mtlrvp/prj.conf
@@ -14,6 +14,9 @@ CONFIG_PLATFORM_EC_BATTERY_V2=y
# CBI
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
CONFIG_PLATFORM_EC_BYPASS_CBI_EEPROM_WP_CHECK=y
CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
@@ -21,6 +24,7 @@ CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
CONFIG_PLATFORM_EC_USB_CHARGER=n
# Charger
+CONFIG_PLATFORM_EC_CHARGER=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=5
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10
@@ -29,13 +33,19 @@ CONFIG_PLATFORM_EC_CHARGER_ISL9241=y
CONFIG_PLATFORM_EC_DEDICATED_CHARGE_PORT=y
# IOEX
+CONFIG_PLATFORM_EC_IOEX_CROS_DRV=y
CONFIG_PLATFORM_EC_IOEX_CCGXXF=y
+CONFIG_GPIO_PCA95XX=y
+CONFIG_GPIO_NCT38XX=y
CONFIG_PLATFORM_EC_IOEX_IT8801=y
#Keyboard from I/O expander
+CONFIG_PLATFORM_EC_KEYBOARD_DISCRETE=y
CONFIG_CROS_KB_RAW_NPCX=n
# Temperature sensors
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_TEMP_SENSOR_POWER=y
# USB CONFIG
@@ -65,3 +75,6 @@ CONFIG_PLATFORM_EC_USB_PD_USB4=y
CONFIG_PLATFORM_EC_USB_PD_INT_SHARED=y
CONFIG_PLATFORM_EC_USB_PD_PORT_0_SHARED=y
CONFIG_PLATFORM_EC_USB_PD_PORT_1_SHARED=y
+
+# 7-Segment Display
+CONFIG_PLATFORM_EC_MAX695X_SEVEN_SEGMENT_DISPLAY=y
diff --git a/zephyr/program/intelrvp/mtlrvp/src/board_power.c b/zephyr/projects/intelrvp/mtlrvp/src/board_power.c
index e35450b8b5..301402bf0f 100644
--- a/zephyr/program/intelrvp/mtlrvp/src/board_power.c
+++ b/zephyr/projects/intelrvp/mtlrvp/src/board_power.c
@@ -3,12 +3,9 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio.h"
-#include "gpio_signal.h"
-
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
#include <zephyr/sys/atomic.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/drivers/gpio.h>
#include <ap_power/ap_power.h>
#include <ap_power/ap_power_events.h>
@@ -17,6 +14,9 @@
#include <power_signals.h>
#include <x86_power_signals.h>
+#include "gpio_signal.h"
+#include "gpio/gpio.h"
+
LOG_MODULE_DECLARE(ap_pwrseq, LOG_LEVEL_INF);
#if CONFIG_X86_NON_DSX_PWRSEQ_MTL
diff --git a/zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c b/zephyr/projects/intelrvp/mtlrvp/src/mtlrvp.c
index e73995337a..9d96a08712 100644
--- a/zephyr/program/intelrvp/mtlrvp/src/mtlrvp.c
+++ b/zephyr/projects/intelrvp/mtlrvp/src/mtlrvp.c
@@ -17,8 +17,8 @@
#include "gpio/gpio_int.h"
#include "hooks.h"
#include "i2c.h"
-#include "intel_rvp_board_id.h"
#include "intelrvp.h"
+#include "intel_rvp_board_id.h"
#include "ioexpander.h"
#include "isl9241.h"
#include "keyboard_raw.h"
@@ -275,9 +275,6 @@ static void board_int_init(void)
/* Enable CCD Mode interrupt */
gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_ccd_mode));
-
- /* Enable DC jack interrupt */
- gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_dc_jack_present));
}
static int board_pre_task_peripheral_init(const struct device *unused)
diff --git a/zephyr/program/intelrvp/mtlrvp/usbc.dts b/zephyr/projects/intelrvp/mtlrvp/usbc.dts
index e4f3bdc465..e4f3bdc465 100644
--- a/zephyr/program/intelrvp/mtlrvp/usbc.dts
+++ b/zephyr/projects/intelrvp/mtlrvp/usbc.dts
diff --git a/zephyr/program/intelrvp/prj.conf b/zephyr/projects/intelrvp/prj.conf
index 9ca19c5071..df04eca101 100644
--- a/zephyr/program/intelrvp/prj.conf
+++ b/zephyr/projects/intelrvp/prj.conf
@@ -12,6 +12,7 @@ CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
CONFIG_SHIMMED_TASKS=y
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
@@ -20,7 +21,6 @@ CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_BATTERY_TYPE_NO_AUTO_DETECT=y
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT=15000
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=15001
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
#Power Sequencing
CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=y
@@ -34,6 +34,9 @@ CONFIG_PLATFORM_EC_USB_VID=0x18d1
CONFIG_PLATFORM_EC_USB_PID=0x8086
CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY=y
+# I2C
+CONFIG_I2C=y
+
# eSPI
CONFIG_ESPI=y
CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S3=y
@@ -41,6 +44,7 @@ CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S4=y
CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S5=y
# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI2=y
@@ -58,6 +62,10 @@ CONFIG_SHELL_TAB=y
CONFIG_SHELL_TAB_AUTOCOMPLETION=y
CONFIG_KERNEL_SHELL=y
+# Logging
+CONFIG_LOG=y
+CONFIG_LOG_MODE_MINIMAL=y
+
# TODO
# Below conf are disabled to compile successfully
# These will be enabled in upcoming CLs
diff --git a/zephyr/program/intelrvp/src/chg_usb_pd.c b/zephyr/projects/intelrvp/src/chg_usb_pd.c
index 084617cb98..63a1853b4d 100644
--- a/zephyr/program/intelrvp/src/chg_usb_pd.c
+++ b/zephyr/projects/intelrvp/src/chg_usb_pd.c
@@ -120,3 +120,10 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
+
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/zephyr/program/intelrvp/src/chg_usb_pd_mecc_1_1.c b/zephyr/projects/intelrvp/src/chg_usb_pd_mecc_1_1.c
index 45fbbc6f65..45fbbc6f65 100644
--- a/zephyr/program/intelrvp/src/chg_usb_pd_mecc_1_1.c
+++ b/zephyr/projects/intelrvp/src/chg_usb_pd_mecc_1_1.c
diff --git a/zephyr/program/intelrvp/src/intel_rvp_board_id.c b/zephyr/projects/intelrvp/src/intel_rvp_board_id.c
index 7062cb74b9..77d4e93afd 100644
--- a/zephyr/program/intelrvp/src/intel_rvp_board_id.c
+++ b/zephyr/projects/intelrvp/src/intel_rvp_board_id.c
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "intel_rvp_board_id.h"
-
#include <zephyr/devicetree.h>
+#include "intel_rvp_board_id.h"
#define DT_DRV_COMPAT intel_rvp_board_id
diff --git a/zephyr/program/intelrvp/src/intel_rvp_led.c b/zephyr/projects/intelrvp/src/intel_rvp_led.c
index 0e4d872963..0e4d872963 100644
--- a/zephyr/program/intelrvp/src/intel_rvp_led.c
+++ b/zephyr/projects/intelrvp/src/intel_rvp_led.c
diff --git a/zephyr/program/intelrvp/src/intelrvp.c b/zephyr/projects/intelrvp/src/intelrvp.c
index 7098f26cbf..7098f26cbf 100644
--- a/zephyr/program/intelrvp/src/intelrvp.c
+++ b/zephyr/projects/intelrvp/src/intelrvp.c
diff --git a/zephyr/program/intelrvp/src/usb_pd_policy_mecc_1_1.c b/zephyr/projects/intelrvp/src/usb_pd_policy_mecc_1_1.c
index a194b358f1..a194b358f1 100644
--- a/zephyr/program/intelrvp/src/usb_pd_policy_mecc_1_1.c
+++ b/zephyr/projects/intelrvp/src/usb_pd_policy_mecc_1_1.c
diff --git a/zephyr/program/intelrvp/zephyr_ap_pwrseq.conf b/zephyr/projects/intelrvp/zephyr_ap_pwrseq.conf
index d33b9bc963..1ef365a8fa 100644
--- a/zephyr/program/intelrvp/zephyr_ap_pwrseq.conf
+++ b/zephyr/projects/intelrvp/zephyr_ap_pwrseq.conf
@@ -7,4 +7,3 @@ CONFIG_AP_PWRSEQ=y
CONFIG_X86_NON_DSX_PWRSEQ_CONSOLE=y
CONFIG_X86_NON_DSX_PWRSEQ_HOST_CMD=y
CONFIG_AP_PWRSEQ_S0IX=y
-CONFIG_AP_PWRSEQ_S0IX_ERROR_RECOVERY=y
diff --git a/zephyr/program/it8xxx2_evb/BUILD.py b/zephyr/projects/it8xxx2_evb/BUILD.py
index ee89c75390..ee89c75390 100644
--- a/zephyr/program/it8xxx2_evb/BUILD.py
+++ b/zephyr/projects/it8xxx2_evb/BUILD.py
diff --git a/zephyr/program/it8xxx2_evb/CMakeLists.txt b/zephyr/projects/it8xxx2_evb/CMakeLists.txt
index 170606a52d..170606a52d 100644
--- a/zephyr/program/it8xxx2_evb/CMakeLists.txt
+++ b/zephyr/projects/it8xxx2_evb/CMakeLists.txt
diff --git a/zephyr/program/it8xxx2_evb/adc.dts b/zephyr/projects/it8xxx2_evb/adc.dts
index 509c9b9daf..509c9b9daf 100644
--- a/zephyr/program/it8xxx2_evb/adc.dts
+++ b/zephyr/projects/it8xxx2_evb/adc.dts
diff --git a/zephyr/program/it8xxx2_evb/fan.dts b/zephyr/projects/it8xxx2_evb/fan.dts
index 2551507ec3..2551507ec3 100644
--- a/zephyr/program/it8xxx2_evb/fan.dts
+++ b/zephyr/projects/it8xxx2_evb/fan.dts
diff --git a/zephyr/program/it8xxx2_evb/gpio.dts b/zephyr/projects/it8xxx2_evb/gpio.dts
index 85bb45d7a0..85bb45d7a0 100644
--- a/zephyr/program/it8xxx2_evb/gpio.dts
+++ b/zephyr/projects/it8xxx2_evb/gpio.dts
diff --git a/zephyr/program/it8xxx2_evb/i2c.dts b/zephyr/projects/it8xxx2_evb/i2c.dts
index c08c543e44..c08c543e44 100644
--- a/zephyr/program/it8xxx2_evb/i2c.dts
+++ b/zephyr/projects/it8xxx2_evb/i2c.dts
diff --git a/zephyr/program/it8xxx2_evb/include/i2c_map.h b/zephyr/projects/it8xxx2_evb/include/i2c_map.h
index a6878e8bae..e83a238d3a 100644
--- a/zephyr/program/it8xxx2_evb/include/i2c_map.h
+++ b/zephyr/projects/it8xxx2_evb/include/i2c_map.h
@@ -6,10 +6,10 @@
#ifndef __ZEPHYR_CHROME_I2C_MAP_H
#define __ZEPHYR_CHROME_I2C_MAP_H
-#include "config.h"
-
#include <zephyr/devicetree.h>
+#include "config.h"
+
/* We need registers.h to get the chip specific defines for now */
#include "i2c/i2c.h"
diff --git a/zephyr/program/it8xxx2_evb/interrupts.dts b/zephyr/projects/it8xxx2_evb/interrupts.dts
index 07fc0ed339..07fc0ed339 100644
--- a/zephyr/program/it8xxx2_evb/interrupts.dts
+++ b/zephyr/projects/it8xxx2_evb/interrupts.dts
diff --git a/zephyr/program/it8xxx2_evb/prj.conf b/zephyr/projects/it8xxx2_evb/prj.conf
index 7a608cb831..d6d422e490 100644
--- a/zephyr/program/it8xxx2_evb/prj.conf
+++ b/zephyr/projects/it8xxx2_evb/prj.conf
@@ -13,9 +13,19 @@ CONFIG_AP_ARM_MTK_MT8192=y
# Lid switch
CONFIG_PLATFORM_EC_LID_SWITCH=y
+# Logging
+CONFIG_LOG=y
+
# Fan
CONFIG_SENSOR=y
+# I2C
+CONFIG_I2C=y
+
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
# Power Button
CONFIG_PLATFORM_EC_POWER_BUTTON=y
@@ -24,6 +34,7 @@ CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=n
CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=n
CONFIG_PLATFORM_EC_KEYBOARD=n
+CONFIG_CROS_KB_RAW_ITE=n
CONFIG_PLATFORM_EC_SWITCH=n
CONFIG_PLATFORM_EC_VBOOT_EFS2=n
CONFIG_PLATFORM_EC_VBOOT_HASH=n
diff --git a/zephyr/program/it8xxx2_evb/pwm.dts b/zephyr/projects/it8xxx2_evb/pwm.dts
index c566e5c029..c566e5c029 100644
--- a/zephyr/program/it8xxx2_evb/pwm.dts
+++ b/zephyr/projects/it8xxx2_evb/pwm.dts
diff --git a/zephyr/program/minimal/BUILD.py b/zephyr/projects/minimal/BUILD.py
index 5e892aa2d7..5e892aa2d7 100644
--- a/zephyr/program/minimal/BUILD.py
+++ b/zephyr/projects/minimal/BUILD.py
diff --git a/zephyr/program/minimal/CMakeLists.txt b/zephyr/projects/minimal/CMakeLists.txt
index de3bec9428..de3bec9428 100644
--- a/zephyr/program/minimal/CMakeLists.txt
+++ b/zephyr/projects/minimal/CMakeLists.txt
diff --git a/zephyr/program/minimal/README.md b/zephyr/projects/minimal/README.md
index 72c092dfce..72c092dfce 100644
--- a/zephyr/program/minimal/README.md
+++ b/zephyr/projects/minimal/README.md
diff --git a/zephyr/program/minimal/it8xxx2.dts b/zephyr/projects/minimal/it8xxx2.dts
index 3d2028afb2..3d2028afb2 100644
--- a/zephyr/program/minimal/it8xxx2.dts
+++ b/zephyr/projects/minimal/it8xxx2.dts
diff --git a/zephyr/program/minimal/npcx9.dts b/zephyr/projects/minimal/npcx9.dts
index 3a9f3b26e4..3a9f3b26e4 100644
--- a/zephyr/program/minimal/npcx9.dts
+++ b/zephyr/projects/minimal/npcx9.dts
diff --git a/zephyr/program/minimal/prj.conf b/zephyr/projects/minimal/prj.conf
index bacb4fe288..db7cac0cef 100644
--- a/zephyr/program/minimal/prj.conf
+++ b/zephyr/projects/minimal/prj.conf
@@ -9,10 +9,10 @@ CONFIG_SYSCON=y
# Disable default features we don't want in a minimal example.
CONFIG_ADC=n
+CONFIG_I2C=n
CONFIG_PWM=n
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
CONFIG_PLATFORM_EC_KEYBOARD=n
CONFIG_PLATFORM_EC_POWER_BUTTON=n
CONFIG_PLATFORM_EC_SWITCH=n
CONFIG_PLATFORM_EC_VBOOT_EFS2=n
-CONFIG_PLATFORM_EC_I2C=n
diff --git a/zephyr/program/nissa/BUILD.py b/zephyr/projects/nissa/BUILD.py
index fa5c77baf9..b1affe7b4c 100644
--- a/zephyr/program/nissa/BUILD.py
+++ b/zephyr/projects/nissa/BUILD.py
@@ -4,7 +4,7 @@
"""Define zmake projects for nissa."""
-# Nivviks and Craask, Pujjo, Xivu, Xivur has NPCX993F, Nereid and Joxer, Yaviks has ITE81302
+# Nivviks and Craask, Pujjo, Xivu has NPCX993F, Nereid and Joxer, Yaviks has ITE81302
def register_nissa_project(
@@ -55,11 +55,6 @@ xivu = register_nissa_project(
chip="npcx9m3f",
)
-xivur = register_nissa_project(
- project_name="xivur",
- chip="npcx9m3f",
-)
-
joxer = register_nissa_project(
project_name="joxer",
chip="it81302bx",
diff --git a/zephyr/program/nissa/CMakeLists.txt b/zephyr/projects/nissa/CMakeLists.txt
index 967fff2229..8769af58ba 100644
--- a/zephyr/program/nissa/CMakeLists.txt
+++ b/zephyr/projects/nissa/CMakeLists.txt
@@ -8,7 +8,7 @@ find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
zephyr_include_directories(include)
zephyr_library_sources("src/common.c")
-zephyr_library_sources_ifdef(CONFIG_NISSA_SUB_BOARD "src/sub_board.c")
+zephyr_library_sources("src/sub_board.c")
zephyr_library_sources_ifdef(CONFIG_AP_PWRSEQ "src/board_power.c")
if(DEFINED CONFIG_BOARD_NIVVIKS)
@@ -34,10 +34,8 @@ if(DEFINED CONFIG_BOARD_NEREID)
endif()
if(DEFINED CONFIG_BOARD_CRAASK)
zephyr_library_sources(
- "craask/src/fan.c"
"craask/src/form_factor.c"
"craask/src/keyboard.c"
- "craask/src/kb_backlight.c"
"craask/src/led.c"
)
project(craask)
@@ -59,7 +57,6 @@ endif()
if(DEFINED CONFIG_BOARD_XIVU)
project(xivu)
zephyr_library_sources(
- "xivu/src/form_factor.c"
"xivu/src/keyboard.c"
)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "xivu/src/usbc.c")
@@ -80,20 +77,8 @@ if(DEFINED CONFIG_BOARD_YAVIKS)
zephyr_library_sources(
"yaviks/src/led.c"
"yaviks/src/keyboard.c"
- "yaviks/src/thermal.c"
)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "yaviks/src/usbc.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGER "yaviks/src/charger.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "yaviks/src/fan.c")
-endif()
-if(DEFINED CONFIG_BOARD_XIVUR)
- project(xivur)
- zephyr_library_sources(
- "xivur/src/led.c"
- "xivur/src/form_factor.c"
- "xivur/src/keyboard.c"
- )
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "xivur/src/fan.c")
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "xivur/src/usbc.c")
- zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGER "xivur/src/charger.c")
-endif()
+endif() \ No newline at end of file
diff --git a/zephyr/program/nissa/Kconfig b/zephyr/projects/nissa/Kconfig
index a7fb4c666a..9e9ffc2528 100644
--- a/zephyr/program/nissa/Kconfig
+++ b/zephyr/projects/nissa/Kconfig
@@ -2,15 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-config NISSA_SUB_BOARD
- bool "Nissa sub-board support"
- default y
- help
- Enable the sub-board support for Nissa boards.
- This uses a common fw_config bitfield to select
- one of a number of option sub-boards with different
- hardware configurations.
-
config BOARD_NIVVIKS
bool "Google Nivviks Board"
help
@@ -41,12 +32,6 @@ config BOARD_XIVU
Build Google Xivu board. Xivu has Intel ADL-N SoC
with NPCX993FA0BX EC.
-config BOARD_XIVUR
- bool "Google Xivur Board"
- help
- Build Google Xivur board. Xivur has Intel ADL-N SoC
- with NPCX993FA0BX EC.
-
config BOARD_JOXER
bool "Google Joxer Board"
help
diff --git a/zephyr/program/nissa/cbi.dtsi b/zephyr/projects/nissa/cbi.dtsi
index d841be1624..d841be1624 100644
--- a/zephyr/program/nissa/cbi.dtsi
+++ b/zephyr/projects/nissa/cbi.dtsi
diff --git a/zephyr/program/nissa/craask/cbi.dtsi b/zephyr/projects/nissa/craask/cbi.dtsi
index e329929227..4c2e052f4d 100644
--- a/zephyr/program/nissa/craask/cbi.dtsi
+++ b/zephyr/projects/nissa/craask/cbi.dtsi
@@ -52,55 +52,10 @@
value = <1>;
};
};
-
- /*
- * FW_CONFIG field to enable fan or not.
- */
- fan {
- enum-name = "FW_FAN";
- start = <17>;
- size = <1>;
-
- no-fan {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_FAN_NOT_PRESENT";
- value = <0>;
- };
- fan-present {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_FAN_PRESENT";
- value = <1>;
- /*
- * Set as default so that unprovisioned
- * configs will run the fan regardless.
- */
- default;
- };
- };
-
- /*
- * FW_CONFIG field to enable KB back light or not.
- */
- kb-bl {
- enum-name = "FW_KB_BL";
- start = <18>;
- size = <1>;
-
- no-kb-bl {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_KB_BL_NOT_PRESENT";
- value = <0>;
- };
- kb-bl-present {
- compatible = "cros-ec,cbi-fw-config-value";
- enum-name = "FW_KB_BL_PRESENT";
- value = <1>;
- };
- };
};
/* Craask-specific ssfc fields. */
cbi-ssfc {
- compatible = "cros-ec,cbi-ssfc";
+ compatible = "named-cbi-ssfc";
/*
* SSFC bit0-1 was defined for AUDIO CODEC.
* 0: ALC5682I_VS
@@ -118,13 +73,13 @@
size = <2>;
lid_sensor_0: lis2dw12 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <0>;
default;
};
lid_sensor_1: bma422 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
};
@@ -137,13 +92,13 @@
size = <2>;
base_sensor_0: lsm6dso {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <0>;
default;
};
base_sensor_1: bmi323 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
};
diff --git a/zephyr/program/nissa/craask/generated.dtsi b/zephyr/projects/nissa/craask/generated.dtsi
index b10ec5f08b..4303bbd4c5 100644
--- a/zephyr/program/nissa/craask/generated.dtsi
+++ b/zephyr/projects/nissa/craask/generated.dtsi
@@ -67,7 +67,6 @@
};
gpio_ec_kso_02_inv: ec_kso_02_inv {
gpios = <&gpio1 7 (GPIO_OUTPUT | GPIO_ACTIVE_LOW)>;
- enum-name = "GPIO_KBD_KSO2";
};
gpio_ec_pch_wake_odl: ec_pch_wake_odl {
gpios = <&gpiob 0 GPIO_ODR_LOW>;
diff --git a/zephyr/projects/nissa/craask/keyboard.dtsi b/zephyr/projects/nissa/craask/keyboard.dtsi
new file mode 100644
index 0000000000..f9e46de1f2
--- /dev/null
+++ b/zephyr/projects/nissa/craask/keyboard.dtsi
@@ -0,0 +1,32 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+&cros_kb_raw {
+ status = "okay";
+ /* No KSO2 (it's inverted and implemented by GPIO) */
+ pinctrl-0 = <
+ &ksi0_gp31
+ &ksi1_gp30
+ &ksi2_gp27
+ &ksi3_gp26
+ &ksi4_gp25
+ &ksi5_gp24
+ &ksi6_gp23
+ &ksi7_gp22
+ &kso00_gp21
+ &kso01_gp20
+ &kso03_gp16
+ &kso04_gp15
+ &kso05_gp14
+ &kso06_gp13
+ &kso07_gp12
+ &kso08_gp11
+ &kso09_gp10
+ &kso10_gp07
+ &kso11_gp06
+ &kso12_gp05
+ >;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/program/nissa/craask/motionsense.dtsi b/zephyr/projects/nissa/craask/motionsense.dtsi
index 941dfa2240..448aed6991 100644
--- a/zephyr/program/nissa/craask/motionsense.dtsi
+++ b/zephyr/projects/nissa/craask/motionsense.dtsi
@@ -14,7 +14,6 @@
lsm6dso-int = &base_accel;
lis2dw12-int = &lid_accel;
bmi3xx-int = &base_accel;
- bma4xx-int = &lid_accel;
};
/*
@@ -67,8 +66,8 @@
};
base_rot_bmi323: base-rotation-bmi323 {
- mat33 = <0 (-1) 0
- (-1) 0 0
+ mat33 = <1 0 0
+ 0 (-1) 0
0 0 (-1)>;
};
};
@@ -251,6 +250,8 @@
* list of GPIO interrupts that have to
* be enabled at initial stage
*/
- sensor-irqs = <&int_imu &int_lid_accel>;
+ sensor-irqs = <&int_imu>;
+ /* list of sensors in force mode */
+ accel-force-mode-sensors = <&lid_accel>;
};
};
diff --git a/zephyr/program/nissa/craask/overlay.dtsi b/zephyr/projects/nissa/craask/overlay.dtsi
index 749317cbf5..b3a510c111 100644
--- a/zephyr/program/nissa/craask/overlay.dtsi
+++ b/zephyr/projects/nissa/craask/overlay.dtsi
@@ -4,8 +4,6 @@
*/
#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usbc_mux.h>
-#include <dt-bindings/usb_pd_tcpm.h>
/ {
aliases {
@@ -68,11 +66,6 @@
flags = <GPIO_INT_EDGE_FALLING>;
handler = "motion_interrupt";
};
- int_lid_accel: ec_lid_accel {
- irq-pin = <&gpio_acc_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "lid_accel_interrupt";
- };
int_vol_down: vol_down {
irq-pin = <&gpio_voldn_btn_odl>;
flags = <GPIO_INT_EDGE_BOTH>;
@@ -120,10 +113,6 @@
gpios = <&gpiof 5 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
no-auto-init;
};
- gpio_fan_enable: fan-enable {
- gpios = <&gpio6 3 GPIO_OUTPUT>;
- no-auto-init;
- };
ec-i2c-sensor-scl {
gpios = <&gpio9 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
};
@@ -176,18 +165,29 @@
named-temp-sensors {
compatible = "cros-ec,temp-sensors";
memory {
- temp_host_high = <75>;
- temp_host_halt = <85>;
- temp_host_release_high = <70>;
- temp_host_release_halt = <80>;
+ temp_fan_off = <35>;
+ temp_fan_max = <60>;
+ temp_host_high = <85>;
+ temp_host_halt = <90>;
+ temp_host_release_high = <80>;
power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
sensor = <&temp_memory>;
};
charger {
+ temp_fan_off = <35>;
+ temp_fan_max = <60>;
+ temp_host_high = <85>;
+ temp_host_halt = <90>;
+ temp_host_release_high = <80>;
power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
sensor = <&temp_charger>;
};
ambient {
+ temp_fan_off = <35>;
+ temp_fan_max = <60>;
+ temp_host_high = <85>;
+ temp_host_halt = <90>;
+ temp_host_release_high = <80>;
power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
sensor = <&temp_ambient>;
};
@@ -217,7 +217,6 @@
reg = <0>;
bc12 = <&bc12_port0>;
chg = <&chg_port0>;
- tcpc = <&tcpc_port0>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_0>;
@@ -237,7 +236,6 @@
reg = <1>;
bc12 = <&bc12_port1>;
chg = <&chg_port1>;
- tcpc = <&tcpc_port1>;
usb-mux-chain-1 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_1 &anx7483_mux_1>;
@@ -259,31 +257,6 @@
compatible = "cros-ec,kblight-pwm";
pwms = <&pwm6 6 PWM_HZ(2400) PWM_POLARITY_NORMAL>;
};
-
- /*
- * Declare unused GPIOs so that they are shut down
- * and use minimal power
- */
- unused-pins {
- compatible = "unused-gpios";
- unused-gpios =
- <&gpio3 2 0>,
- <&gpio3 3 0>,
- <&gpio3 5 0>,
- <&gpio3 6 0>,
- <&gpio5 7 0>,
- <&gpio6 0 0>,
- <&gpio6 3 0>,
- <&gpio6 6 0>,
- <&gpio7 3 0>,
- <&gpio8 3 0>,
- <&gpio8 6 0>,
- <&gpiob 1 0>,
- <&gpiob 7 0>,
- <&gpioc 7 0>,
- <&gpiof 2 0>,
- <&gpiof 3 0>;
- };
};
&thermistor_3V3_51K1_47K_4050B {
@@ -342,14 +315,6 @@
status = "okay";
reg = <0x9>;
};
-
- tcpc_port0: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
};
&i2c5_1 {
@@ -368,19 +333,10 @@
reg = <0x9>;
};
- tcpc_port1: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
-
anx7483_mux_1: anx7483-mux-1@3e {
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "anx7483_set_default_tuning";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
};
@@ -402,13 +358,3 @@
pinctrl-0 = <&espi_lpc_gp46_47_51_52_53_54_55_57>;
pinctrl-names = "default";
};
-
-/*
- * Declare GPIOs that have leakage current caused by board issues here. NPCX ec
- * will disable their input buffers before entering deep sleep and restore them
- * after waking up automatically for better power consumption.
- */
-&power_leakage_io {
- leak-gpios = <&gpioa 4 0
- &gpiof 1 0>;
-};
diff --git a/zephyr/program/nissa/craask/power_signals.dtsi b/zephyr/projects/nissa/craask/power_signals.dtsi
index 1d2b23069d..1d2b23069d 100644
--- a/zephyr/program/nissa/craask/power_signals.dtsi
+++ b/zephyr/projects/nissa/craask/power_signals.dtsi
diff --git a/zephyr/program/nissa/craask/project.conf b/zephyr/projects/nissa/craask/project.conf
index 85cef7caba..b7f31cee63 100644
--- a/zephyr/program/nissa/craask/project.conf
+++ b/zephyr/projects/nissa/craask/project.conf
@@ -13,5 +13,3 @@ CONFIG_PLATFORM_EC_ACCELGYRO_BMI3XX=y
CONFIG_PLATFORM_EC_DYNAMIC_MOTION_SENSOR_COUNT=y
CONFIG_PLATFORM_EC_BUTTONS_RUNTIME_CONFIG=y
-
-CONFIG_PLATFORM_EC_KEYBOARD_FACTORY_TEST=y
diff --git a/zephyr/program/nissa/joxer/project.overlay b/zephyr/projects/nissa/craask/project.overlay
index 9ca681d979..9ca681d979 100644
--- a/zephyr/program/nissa/joxer/project.overlay
+++ b/zephyr/projects/nissa/craask/project.overlay
diff --git a/zephyr/program/nissa/craask/pwm_leds.dtsi b/zephyr/projects/nissa/craask/pwm_leds.dtsi
index e55aa1c9ef..e55aa1c9ef 100644
--- a/zephyr/program/nissa/craask/pwm_leds.dtsi
+++ b/zephyr/projects/nissa/craask/pwm_leds.dtsi
diff --git a/zephyr/program/nissa/craask/src/charger.c b/zephyr/projects/nissa/craask/src/charger.c
index 3984045a19..d4723e4a0a 100644
--- a/zephyr/program/nissa/craask/src/charger.c
+++ b/zephyr/projects/nissa/craask/src/charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
#include "charger.h"
#include "charger/isl923x_public.h"
#include "console.h"
#include "extpower.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/craask/src/form_factor.c b/zephyr/projects/nissa/craask/src/form_factor.c
index 56d0c50f73..59869eaa2f 100644
--- a/zephyr/program/nissa/craask/src/form_factor.c
+++ b/zephyr/projects/nissa/craask/src/form_factor.c
@@ -3,23 +3,22 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/logging/log.h>
+
#include "accelgyro.h"
#include "button.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
-#include "driver/accel_bma4xx.h"
-#include "driver/accel_lis2dw12_public.h"
#include "driver/accelgyro_bmi323.h"
#include "driver/accelgyro_lsm6dso.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
-#include "motion_sense.h"
#include "motionsense_sensors.h"
-#include "nissa_common.h"
+#include "motion_sense.h"
#include "tablet_mode.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
@@ -36,7 +35,6 @@ LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
#define ALT_LID_S SENSOR_ID(DT_NODELABEL(alt_lid_accel))
static bool use_alt_sensor;
-static bool use_alt_lid_accel;
void motion_interrupt(enum gpio_signal signal)
{
@@ -46,14 +44,6 @@ void motion_interrupt(enum gpio_signal signal)
lsm6dso_interrupt(signal);
}
-void lid_accel_interrupt(enum gpio_signal signal)
-{
- if (use_alt_lid_accel)
- bma4xx_interrupt(signal);
- else
- lis2dw12_interrupt(signal);
-}
-
static void form_factor_init(void)
{
int ret;
@@ -107,11 +97,9 @@ static void form_factor_init(void)
motion_sensors_alt[ALT_LID_S].rot_standard_ref = &BMA_ALT_MAT;
}
- /* check which motion sensors are used */
+ /* check which base sensor is used for motion_interrupt */
use_alt_sensor = cros_cbi_ssfc_check_match(
CBI_SSFC_VALUE_ID(DT_NODELABEL(base_sensor_1)));
- use_alt_lid_accel = cros_cbi_ssfc_check_match(
- CBI_SSFC_VALUE_ID(DT_NODELABEL(lid_sensor_1)));
motion_sensors_check_ssfc();
diff --git a/zephyr/program/nissa/xivur/src/keyboard.c b/zephyr/projects/nissa/craask/src/keyboard.c
index 2bc1d203a7..65229eb43f 100644
--- a/zephyr/program/nissa/xivur/src/keyboard.c
+++ b/zephyr/projects/nissa/craask/src/keyboard.c
@@ -5,7 +5,7 @@
#include "ec_commands.h"
-static const struct ec_response_keybd_config xivur_kb = {
+static const struct ec_response_keybd_config craask_kb = {
.num_top_row_keys = 10,
.action_keys = {
TK_BACK, /* T1 */
@@ -25,5 +25,5 @@ static const struct ec_response_keybd_config xivur_kb = {
__override const struct ec_response_keybd_config *
board_vivaldi_keybd_config(void)
{
- return &xivur_kb;
+ return &craask_kb;
}
diff --git a/zephyr/program/nissa/craask/src/led.c b/zephyr/projects/nissa/craask/src/led.c
index 0af0202cf4..0af0202cf4 100644
--- a/zephyr/program/nissa/craask/src/led.c
+++ b/zephyr/projects/nissa/craask/src/led.c
diff --git a/zephyr/program/nissa/xivur/src/usbc.c b/zephyr/projects/nissa/craask/src/usbc.c
index a15460a212..a15460a212 100644
--- a/zephyr/program/nissa/xivur/src/usbc.c
+++ b/zephyr/projects/nissa/craask/src/usbc.c
diff --git a/zephyr/program/nissa/include/nissa_common.h b/zephyr/projects/nissa/include/nissa_common.h
index 7cdaba2e50..7cdaba2e50 100644
--- a/zephyr/program/nissa/include/nissa_common.h
+++ b/zephyr/projects/nissa/include/nissa_common.h
diff --git a/zephyr/program/nissa/include/nissa_hdmi.h b/zephyr/projects/nissa/include/nissa_hdmi.h
index 9f2f533ba7..9f2f533ba7 100644
--- a/zephyr/program/nissa/include/nissa_hdmi.h
+++ b/zephyr/projects/nissa/include/nissa_hdmi.h
diff --git a/zephyr/program/nissa/it8xxx2_program.conf b/zephyr/projects/nissa/it8xxx2_program.conf
index 475f34cf9d..3272c04209 100644
--- a/zephyr/program/nissa/it8xxx2_program.conf
+++ b/zephyr/projects/nissa/it8xxx2_program.conf
@@ -55,9 +55,6 @@ CONFIG_PLATFORM_EC_OCPC=y
CONFIG_PLATFORM_EC_CHARGER_SM5803=y
CONFIG_PLATFORM_EC_OCPC_DEF_RBATT_MOHMS=21
CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=15000
-# SM5803 is very inefficient in buck-boost operation, so DPS doesn't help and
-# might actually contribute to charger failures.
-CONFIG_PLATFORM_EC_USB_PD_DPS=n
# VSENSE: PP3300_S5 & PP1050_PROC
CONFIG_VCMP_IT8XXX2=y
diff --git a/zephyr/program/nissa/joxer/cbi.dtsi b/zephyr/projects/nissa/joxer/cbi.dtsi
index afbd125b32..afbd125b32 100644
--- a/zephyr/program/nissa/joxer/cbi.dtsi
+++ b/zephyr/projects/nissa/joxer/cbi.dtsi
diff --git a/zephyr/program/nissa/joxer/generated.dtsi b/zephyr/projects/nissa/joxer/generated.dtsi
index 22214b9726..22214b9726 100644
--- a/zephyr/program/nissa/joxer/generated.dtsi
+++ b/zephyr/projects/nissa/joxer/generated.dtsi
diff --git a/zephyr/program/nissa/joxer/joxer_vif.xml b/zephyr/projects/nissa/joxer/joxer_vif.xml
index cfbce5623a..cfbce5623a 100644
--- a/zephyr/program/nissa/joxer/joxer_vif.xml
+++ b/zephyr/projects/nissa/joxer/joxer_vif.xml
diff --git a/zephyr/program/nissa/joxer/keyboard.dtsi b/zephyr/projects/nissa/joxer/keyboard.dtsi
index 04a620767a..04a620767a 100644
--- a/zephyr/program/nissa/joxer/keyboard.dtsi
+++ b/zephyr/projects/nissa/joxer/keyboard.dtsi
diff --git a/zephyr/program/nissa/joxer/motionsense.dtsi b/zephyr/projects/nissa/joxer/motionsense.dtsi
index e9c46a849a..537cc34451 100644
--- a/zephyr/program/nissa/joxer/motionsense.dtsi
+++ b/zephyr/projects/nissa/joxer/motionsense.dtsi
@@ -12,7 +12,6 @@
* Interrupt bindings for sensor devices.
*/
bmi3xx-int = &base_accel;
- bma4xx-int = &lid_accel;
};
/*
@@ -143,6 +142,8 @@
* list of GPIO interrupts that have to
* be enabled at initial stage
*/
- sensor-irqs = <&int_imu &int_lid_accel>;
+ sensor-irqs = <&int_imu>;
+ /* list of sensors in force mode */
+ accel-force-mode-sensors = <&lid_accel>;
};
};
diff --git a/zephyr/program/nissa/joxer/overlay.dtsi b/zephyr/projects/nissa/joxer/overlay.dtsi
index 56f1d928cf..b587da8fb1 100644
--- a/zephyr/program/nissa/joxer/overlay.dtsi
+++ b/zephyr/projects/nissa/joxer/overlay.dtsi
@@ -4,7 +4,6 @@
*/
#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usb_pd_tcpm.h>
/ {
aliases {
@@ -99,14 +98,9 @@
handler = "gmr_tablet_switch_isr";
};
int_imu: ec_imu {
- irq-pin = <&gpio_imu_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "bmi3xx_interrupt";
- };
- int_lid_accel: ec_lid_accel {
- irq-pin = <&gpio_acc_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "bma4xx_interrupt";
+ irq-pin = <&gpio_imu_int_l>;
+ flags = <GPIO_INT_EDGE_FALLING>;
+ handler = "bmi3xx_interrupt";
};
int_usb_c0: usb_c0 {
irq-pin = <&gpio_usb_c0_int_odl>;
@@ -246,7 +240,6 @@
reg = <0>;
bc12 = <&bc12_port0>;
chg = <&chg_port0>;
- tcpc = <&usbpd0>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_0>;
@@ -262,7 +255,6 @@
reg = <1>;
bc12 = <&bc12_port1>;
chg = <&chg_port1>;
- tcpc = <&tcpc_port1>;
usb-mux-chain-1 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_1 &tcpci_mux_1>;
@@ -399,12 +391,6 @@
status = "okay";
reg = <0x32>;
};
-
- tcpc_port1: ps8745@b {
- compatible = "parade,ps8xxx";
- reg = <0xb>;
- tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
- };
};
&i2c_ec_i2c_sub_usb_c1 {
diff --git a/zephyr/program/nissa/joxer/power_signals.dtsi b/zephyr/projects/nissa/joxer/power_signals.dtsi
index 8affae03b1..8affae03b1 100644
--- a/zephyr/program/nissa/joxer/power_signals.dtsi
+++ b/zephyr/projects/nissa/joxer/power_signals.dtsi
diff --git a/zephyr/program/nissa/joxer/project.conf b/zephyr/projects/nissa/joxer/project.conf
index a0de72294c..a0de72294c 100644
--- a/zephyr/program/nissa/joxer/project.conf
+++ b/zephyr/projects/nissa/joxer/project.conf
diff --git a/zephyr/program/nissa/nivviks/project.overlay b/zephyr/projects/nissa/joxer/project.overlay
index 9ca681d979..9ca681d979 100644
--- a/zephyr/program/nissa/nivviks/project.overlay
+++ b/zephyr/projects/nissa/joxer/project.overlay
diff --git a/zephyr/program/nissa/joxer/pwm_leds.dtsi b/zephyr/projects/nissa/joxer/pwm_leds.dtsi
index aa4a76b271..aa4a76b271 100644
--- a/zephyr/program/nissa/joxer/pwm_leds.dtsi
+++ b/zephyr/projects/nissa/joxer/pwm_leds.dtsi
diff --git a/zephyr/program/nissa/joxer/src/charger.c b/zephyr/projects/nissa/joxer/src/charger.c
index 4bb7de7ecb..b9454d8b80 100644
--- a/zephyr/program/nissa/joxer/src/charger.c
+++ b/zephyr/projects/nissa/joxer/src/charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
#include "charger.h"
#include "console.h"
#include "driver/charger/sm5803.h"
#include "extpower.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/joxer/src/fan.c b/zephyr/projects/nissa/joxer/src/fan.c
index 82be341da5..6d234b2fc3 100644
--- a/zephyr/program/nissa/joxer/src/fan.c
+++ b/zephyr/projects/nissa/joxer/src/fan.c
@@ -3,15 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
+
#include "cros_cbi.h"
#include "fan.h"
#include "gpio/gpio.h"
#include "hooks.h"
-#include "nissa_common.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/joxer/src/keyboard.c b/zephyr/projects/nissa/joxer/src/keyboard.c
index e9e20194f0..48db40f53f 100644
--- a/zephyr/program/nissa/joxer/src/keyboard.c
+++ b/zephyr/projects/nissa/joxer/src/keyboard.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
+
#include "cros_cbi.h"
#include "ec_commands.h"
#include "gpio/gpio.h"
@@ -10,10 +14,6 @@
#include "keyboard_8042_sharedlib.h"
#include "nissa_common.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
static const struct ec_response_keybd_config joxer_kb_legacy = {
diff --git a/zephyr/program/nissa/joxer/src/led.c b/zephyr/projects/nissa/joxer/src/led.c
index c617ee9507..d66e5b27a6 100644
--- a/zephyr/program/nissa/joxer/src/led.c
+++ b/zephyr/projects/nissa/joxer/src/led.c
@@ -4,6 +4,8 @@
*
* Battery LED control for nissa
*/
+#include <stdint.h>
+
#include "charge_manager.h"
#include "common.h"
#include "compile_time_macros.h"
@@ -14,8 +16,6 @@
#include "pwm.h"
#include "util.h"
-#include <stdint.h>
-
#define BAT_LED_ON_LVL 0
#define BAT_LED_OFF_LVL 1
diff --git a/zephyr/program/nissa/joxer/src/usbc.c b/zephyr/projects/nissa/joxer/src/usbc.c
index 8e576c5673..5fec9ab544 100644
--- a/zephyr/program/nissa/joxer/src/usbc.c
+++ b/zephyr/projects/nissa/joxer/src/usbc.c
@@ -3,23 +3,47 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+#include <ap_power/ap_power.h>
+
#include "charge_state_v2.h"
#include "chipset.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "system.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
#include "driver/tcpm/ps8xxx_public.h"
#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "usb_mux.h"
-
-#include <zephyr/logging/log.h>
-#include <ap_power/ap_power.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_EMBEDDED,
+ /* TCPC is embedded within EC so no i2c config needed */
+ .drv = &it8xxx2_tcpm_drv,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
+ },
+ {
+ /*
+ * Sub-board: optional PS8745 TCPC+redriver. Behaves the same
+ * as PS8815.
+ */
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ },
+ .drv = &ps8xxx_tcpm_drv,
+ /* PS8745 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+};
+
/* Vconn control for integrated ITE TCPC */
void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
{
diff --git a/zephyr/program/nissa/nereid/generated.dtsi b/zephyr/projects/nissa/nereid/generated.dtsi
index bca58c478e..bca58c478e 100644
--- a/zephyr/program/nissa/nereid/generated.dtsi
+++ b/zephyr/projects/nissa/nereid/generated.dtsi
diff --git a/zephyr/program/nissa/nereid/keyboard.dtsi b/zephyr/projects/nissa/nereid/keyboard.dtsi
index 04a620767a..04a620767a 100644
--- a/zephyr/program/nissa/nereid/keyboard.dtsi
+++ b/zephyr/projects/nissa/nereid/keyboard.dtsi
diff --git a/zephyr/program/nissa/nereid/motionsense.dtsi b/zephyr/projects/nissa/nereid/motionsense.dtsi
index a65bb48fbd..a65bb48fbd 100644
--- a/zephyr/program/nissa/nereid/motionsense.dtsi
+++ b/zephyr/projects/nissa/nereid/motionsense.dtsi
diff --git a/zephyr/program/nissa/nereid/nereid_vif.xml b/zephyr/projects/nissa/nereid/nereid_vif.xml
index 91c8dbe68b..91c8dbe68b 100644
--- a/zephyr/program/nissa/nereid/nereid_vif.xml
+++ b/zephyr/projects/nissa/nereid/nereid_vif.xml
diff --git a/zephyr/program/nissa/nereid/overlay.dtsi b/zephyr/projects/nissa/nereid/overlay.dtsi
index 36d30a0fce..a44a3e01bd 100644
--- a/zephyr/program/nissa/nereid/overlay.dtsi
+++ b/zephyr/projects/nissa/nereid/overlay.dtsi
@@ -4,7 +4,6 @@
*/
#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usb_pd_tcpm.h>
/ {
aliases {
@@ -218,7 +217,6 @@
reg = <0>;
bc12 = <&bc12_port0>;
chg = <&chg_port0>;
- tcpc = <&usbpd0>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_0>;
@@ -234,7 +232,6 @@
reg = <1>;
bc12 = <&bc12_port1>;
chg = <&chg_port1>;
- tcpc = <&tcpc_port1>;
usb-mux-chain-1 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_1 &tcpci_mux_1>;
@@ -366,12 +363,6 @@
status = "okay";
reg = <0x32>;
};
-
- tcpc_port1: ps8745@b {
- compatible = "parade,ps8xxx";
- reg = <0xb>;
- tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
- };
};
&i2c_ec_i2c_sub_usb_c1 {
diff --git a/zephyr/program/nissa/nereid/power_signals.dtsi b/zephyr/projects/nissa/nereid/power_signals.dtsi
index 8affae03b1..8affae03b1 100644
--- a/zephyr/program/nissa/nereid/power_signals.dtsi
+++ b/zephyr/projects/nissa/nereid/power_signals.dtsi
diff --git a/zephyr/program/nissa/nereid/project.conf b/zephyr/projects/nissa/nereid/project.conf
index 75a5faba5d..75a5faba5d 100644
--- a/zephyr/program/nissa/nereid/project.conf
+++ b/zephyr/projects/nissa/nereid/project.conf
diff --git a/zephyr/program/nissa/nereid/project.overlay b/zephyr/projects/nissa/nereid/project.overlay
index 0aceac1c47..0aceac1c47 100644
--- a/zephyr/program/nissa/nereid/project.overlay
+++ b/zephyr/projects/nissa/nereid/project.overlay
diff --git a/zephyr/program/nissa/nereid/pwm_leds.dtsi b/zephyr/projects/nissa/nereid/pwm_leds.dtsi
index aa4a76b271..aa4a76b271 100644
--- a/zephyr/program/nissa/nereid/pwm_leds.dtsi
+++ b/zephyr/projects/nissa/nereid/pwm_leds.dtsi
diff --git a/zephyr/program/nissa/nereid/src/charger.c b/zephyr/projects/nissa/nereid/src/charger.c
index dc4eda9291..181e9a61fd 100644
--- a/zephyr/program/nissa/nereid/src/charger.c
+++ b/zephyr/projects/nissa/nereid/src/charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
#include "charger.h"
#include "console.h"
#include "driver/charger/sm5803.h"
#include "extpower.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/nereid/src/hdmi.c b/zephyr/projects/nissa/nereid/src/hdmi.c
index 5025472c6d..7e5708c6eb 100644
--- a/zephyr/program/nissa/nereid/src/hdmi.c
+++ b/zephyr/projects/nissa/nereid/src/hdmi.c
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "nissa_hdmi.h"
-
#include <cros_board_info.h>
+#include "nissa_hdmi.h"
__override void nissa_configure_hdmi_power_gpios(void)
{
diff --git a/zephyr/program/nissa/nereid/src/keyboard.c b/zephyr/projects/nissa/nereid/src/keyboard.c
index b69bb4da33..b69bb4da33 100644
--- a/zephyr/program/nissa/nereid/src/keyboard.c
+++ b/zephyr/projects/nissa/nereid/src/keyboard.c
diff --git a/zephyr/program/nissa/yaviks/src/usbc.c b/zephyr/projects/nissa/nereid/src/usbc.c
index 1e87abfa0d..48f7cfd9cb 100644
--- a/zephyr/program/nissa/yaviks/src/usbc.c
+++ b/zephyr/projects/nissa/nereid/src/usbc.c
@@ -3,23 +3,47 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+#include <ap_power/ap_power.h>
+
#include "charge_state_v2.h"
#include "chipset.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "system.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
#include "driver/tcpm/ps8xxx_public.h"
#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "usb_mux.h"
-
-#include <zephyr/logging/log.h>
-#include <ap_power/ap_power.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_EMBEDDED,
+ /* TCPC is embedded within EC so no i2c config needed */
+ .drv = &it8xxx2_tcpm_drv,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
+ },
+ {
+ /*
+ * Sub-board: optional PS8745 TCPC+redriver. Behaves the same
+ * as PS8815.
+ */
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ },
+ .drv = &ps8xxx_tcpm_drv,
+ /* PS8745 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+};
+
/* Vconn control for integrated ITE TCPC */
void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
{
diff --git a/zephyr/program/nissa/nissa.csv b/zephyr/projects/nissa/nissa.csv
index 45b73ea229..45b73ea229 100644
--- a/zephyr/program/nissa/nissa.csv
+++ b/zephyr/projects/nissa/nissa.csv
diff --git a/zephyr/program/nissa/nivviks/cbi.dtsi b/zephyr/projects/nissa/nivviks/cbi.dtsi
index 112a2a885c..112a2a885c 100644
--- a/zephyr/program/nissa/nivviks/cbi.dtsi
+++ b/zephyr/projects/nissa/nivviks/cbi.dtsi
diff --git a/zephyr/program/nissa/nivviks/generated.dtsi b/zephyr/projects/nissa/nivviks/generated.dtsi
index 91718302b4..91718302b4 100644
--- a/zephyr/program/nissa/nivviks/generated.dtsi
+++ b/zephyr/projects/nissa/nivviks/generated.dtsi
diff --git a/zephyr/program/nissa/nivviks/keyboard.dtsi b/zephyr/projects/nissa/nivviks/keyboard.dtsi
index 00610e4e18..00610e4e18 100644
--- a/zephyr/program/nissa/nivviks/keyboard.dtsi
+++ b/zephyr/projects/nissa/nivviks/keyboard.dtsi
diff --git a/zephyr/program/nissa/nivviks/motionsense.dtsi b/zephyr/projects/nissa/nivviks/motionsense.dtsi
index 6297a07bf5..6297a07bf5 100644
--- a/zephyr/program/nissa/nivviks/motionsense.dtsi
+++ b/zephyr/projects/nissa/nivviks/motionsense.dtsi
diff --git a/zephyr/program/nissa/xivur/overlay.dtsi b/zephyr/projects/nissa/nivviks/overlay.dtsi
index c2d5e3f24b..c2d5e3f24b 100644
--- a/zephyr/program/nissa/xivur/overlay.dtsi
+++ b/zephyr/projects/nissa/nivviks/overlay.dtsi
diff --git a/zephyr/program/nissa/nivviks/power_signals.dtsi b/zephyr/projects/nissa/nivviks/power_signals.dtsi
index 1d2b23069d..1d2b23069d 100644
--- a/zephyr/program/nissa/nivviks/power_signals.dtsi
+++ b/zephyr/projects/nissa/nivviks/power_signals.dtsi
diff --git a/zephyr/program/nissa/nivviks/project.conf b/zephyr/projects/nissa/nivviks/project.conf
index af9e4e2586..af9e4e2586 100644
--- a/zephyr/program/nissa/nivviks/project.conf
+++ b/zephyr/projects/nissa/nivviks/project.conf
diff --git a/zephyr/program/nissa/xivur/project.overlay b/zephyr/projects/nissa/nivviks/project.overlay
index 9ca681d979..9ca681d979 100644
--- a/zephyr/program/nissa/xivur/project.overlay
+++ b/zephyr/projects/nissa/nivviks/project.overlay
diff --git a/zephyr/program/nissa/nivviks/pwm_leds.dtsi b/zephyr/projects/nissa/nivviks/pwm_leds.dtsi
index a265a5929e..a265a5929e 100644
--- a/zephyr/program/nissa/nivviks/pwm_leds.dtsi
+++ b/zephyr/projects/nissa/nivviks/pwm_leds.dtsi
diff --git a/zephyr/program/nissa/nivviks/src/charger.c b/zephyr/projects/nissa/nivviks/src/charger.c
index 234bcbbd55..e2f9f966e7 100644
--- a/zephyr/program/nissa/nivviks/src/charger.c
+++ b/zephyr/projects/nissa/nivviks/src/charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
#include "charger.h"
#include "charger/isl923x_public.h"
#include "console.h"
#include "extpower.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/xivur/src/fan.c b/zephyr/projects/nissa/nivviks/src/fan.c
index 840049722c..840049722c 100644
--- a/zephyr/program/nissa/xivur/src/fan.c
+++ b/zephyr/projects/nissa/nivviks/src/fan.c
diff --git a/zephyr/program/nissa/xivur/src/form_factor.c b/zephyr/projects/nissa/nivviks/src/form_factor.c
index 602b22baff..602b22baff 100644
--- a/zephyr/program/nissa/xivur/src/form_factor.c
+++ b/zephyr/projects/nissa/nivviks/src/form_factor.c
diff --git a/zephyr/program/nissa/nivviks/src/keyboard.c b/zephyr/projects/nissa/nivviks/src/keyboard.c
index f13d5bf78c..f13d5bf78c 100644
--- a/zephyr/program/nissa/nivviks/src/keyboard.c
+++ b/zephyr/projects/nissa/nivviks/src/keyboard.c
diff --git a/zephyr/program/nissa/nivviks/src/led.c b/zephyr/projects/nissa/nivviks/src/led.c
index 9087982604..9087982604 100644
--- a/zephyr/program/nissa/nivviks/src/led.c
+++ b/zephyr/projects/nissa/nivviks/src/led.c
diff --git a/zephyr/program/nissa/nivviks/src/usbc.c b/zephyr/projects/nissa/nivviks/src/usbc.c
index 1e0c1627bb..14fc5a071d 100644
--- a/zephyr/program/nissa/nivviks/src/usbc.c
+++ b/zephyr/projects/nissa/nivviks/src/usbc.c
@@ -1,23 +1,49 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "charge_state_v2.h"
#include "chipset.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "system.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
-#include "driver/tcpm/raa489000.h"
#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "usb_mux.h"
+#include "driver/tcpm/raa489000.h"
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0_TCPC,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .drv = &raa489000_tcpm_drv,
+ /* RAA489000 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_VBUS_MONITOR,
+ },
+ { /* sub-board */
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .drv = &raa489000_tcpm_drv,
+ /* RAA489000 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_VBUS_MONITOR,
+ },
+};
+
int board_is_sourcing_vbus(int port)
{
int regval;
diff --git a/zephyr/program/nissa/npcx_program.conf b/zephyr/projects/nissa/npcx_program.conf
index 83ee245a8d..5e0dd99501 100644
--- a/zephyr/program/nissa/npcx_program.conf
+++ b/zephyr/projects/nissa/npcx_program.conf
@@ -3,16 +3,19 @@
# found in the LICENSE file.
# EC chip configuration: NPCX993
+CONFIG_CROS_FLASH_NPCX=y
CONFIG_CROS_SYSTEM_NPCX=y
CONFIG_SOC_SERIES_NPCX9=y
CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y
CONFIG_SYSCON=y
+CONFIG_TACH_NPCX=y
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=256
# Common sensor drivers
CONFIG_PLATFORM_EC_ACCEL_LIS2DW12=y
# Keyboard
+CONFIG_CROS_KB_RAW_NPCX=y
CONFIG_PLATFORM_EC_KBLIGHT_ENABLE_PIN=y
# Ensure recovery key combination (esc+refresh+power) is reliable
CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
@@ -27,9 +30,7 @@ CONFIG_PLATFORM_EC_USB_PD_TCPC_LPM_EXIT_DEBOUNCE_US=100000
CONFIG_PLATFORM_EC_USB_PD_5V_EN_CUSTOM=y
# type C port 1 redriver
CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
-
-# Save some flash space by turning off features we don't care much about
-# (EC Kconfig.console turns the ones we do care about on by default)
+# Save some space
CONFIG_SHELL_MINIMAL=y
# FRS enable
@@ -42,7 +43,5 @@ CONFIG_PLATFORM_EC_OCPC_DEF_RBATT_MOHMS=22
# VSENSE: PP3300_S5 & PP1050_PROC
CONFIG_ADC_CMP_NPCX=y
-CONFIG_ADC_CMP_NPCX_WORKQUEUE=y
-CONFIG_ADC_CMP_NPCX_WORKQUEUE_PRIORITY=12
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=n
diff --git a/zephyr/program/nissa/program.conf b/zephyr/projects/nissa/program.conf
index ade406671a..c23a7f1381 100644
--- a/zephyr/program/nissa/program.conf
+++ b/zephyr/projects/nissa/program.conf
@@ -9,6 +9,11 @@ CONFIG_PLATFORM_EC=y
CONFIG_SHIMMED_TASKS=y
CONFIG_LTO=y
+# Debug options and features; can be disabled to save memory or once bringup
+# is complete.
+CONFIG_LOG=y
+CONFIG_LOG_MODE_MINIMAL=y
+
# RAM-saving options
# flash shell command is unused, allocated a 4kB buffer for flash test
CONFIG_FLASH_SHELL=n
@@ -48,8 +53,12 @@ CONFIG_X86_NON_DSX_PWRSEQ_HOST_CMD=y
CONFIG_AP_PWRSEQ_S0IX=y
CONFIG_AP_PWRSEQ_S0IX_ERROR_RECOVERY=y
+# I2C
+CONFIG_I2C=y
+
# Keyboard support
CONFIG_PLATFORM_EC_KBLIGHT_ENABLE_PIN=y
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
CONFIG_PLATFORM_EC_CMD_BUTTON=n
@@ -58,6 +67,7 @@ CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
# LED
CONFIG_PLATFORM_EC_LED_COMMON=y
+CONFIG_PLATFORM_EC_LED_PWM=y
CONFIG_PLATFORM_EC_LED_ONOFF_STATES=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_LEDTEST=n
@@ -67,15 +77,25 @@ CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y
CONFIG_PLATFORM_EC_MKBP_USE_GPIO_AND_HOST_EVENT=y
# Temperature sensor support
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_TEMP_SENSOR_FIRST_READ_DELAY=y
# CBI EEPROM support
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
+
# PWM support
+CONFIG_PWM=y
CONFIG_PWM_SHELL=y
+# TODO(b/188605676): bring these features up
+CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+
# Sensors support
CONFIG_PLATFORM_EC_LID_ANGLE=y
CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
@@ -96,15 +116,16 @@ CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n
CONFIG_PLATFORM_EC_USB_MUX_RUNTIME_CONFIG=y
CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y
-CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY=y
# ADL integrated muxes are slow: unblock PD
CONFIG_PLATFORM_EC_USB_MUX_TASK=y
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
# USB-C TCPC and PPC standard options
CONFIG_PLATFORM_EC_USB_PD_TCPC_LOW_POWER=y
CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=y
# USB-A host ports
+CONFIG_PLATFORM_EC_USBA=y
CONFIG_PLATFORM_EC_USB_PORT_ENABLE_DYNAMIC=y
# Both ports use a smart switch with CTL1..3 fixed high, for SDP2 or CDP only:
# either SLGC55545 or PI5USB2546.
@@ -114,6 +135,7 @@ CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_DEFAULT_CDP=y
CONFIG_PLATFORM_EC_USB_PORT_POWER_SMART_INVERTED=y
# Battery support
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
@@ -121,25 +143,14 @@ CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y
# Charger support
+CONFIG_PLATFORM_EC_CHARGER=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
-CONFIG_PLATFORM_EC_OCPC_DEF_DRIVELIMIT_MILLIVOLTS=200
-# Assume 4% overdraw, which could be changed with actual characterization
-CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=4
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
+# Dynamically select PD voltage to maximize charger efficiency
+CONFIG_PLATFORM_EC_USB_PD_DPS=y
# Reduce logging so that state transitions do not cause protocol issues
# pd dump [1-3] can be used to increase the debugging level
CONFIG_PLATFORM_EC_USB_PD_INITIAL_DEBUG_LEVEL=0
-
-# System-side power distribution is designed to be robust up to about 45W, and
-# higher input power may have negative reliability implications (especially for
-# systems with 2S batteries). Most devices can't exceed 45W sinking anyway, so
-# limit charger power to keep system input current within the design range.
-CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=45000
-# 15V input is slightly more efficient than 20V for all supported chargers, and
-# because power is limited to 45W for other reasons (see above) limiting input
-# voltage like this does not compromise the total power capacity of the system.
-CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=15000 \ No newline at end of file
diff --git a/zephyr/program/nissa/pujjo/cbi.dtsi b/zephyr/projects/nissa/pujjo/cbi.dtsi
index 02057140a5..b5ba92bd9e 100644
--- a/zephyr/program/nissa/pujjo/cbi.dtsi
+++ b/zephyr/projects/nissa/pujjo/cbi.dtsi
@@ -146,7 +146,7 @@
/* Pujjo-specific ssfc fields. */
cbi-ssfc {
- compatible = "cros-ec,cbi-ssfc";
+ compatible = "named-cbi-ssfc";
/*
* SSFC field to identify BASE motion sensor.
*/
@@ -155,13 +155,13 @@
size = <2>;
base_sensor_0: bmi323 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <0>;
default;
};
base_sensor_1: lsm6dsm {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
};
@@ -175,13 +175,13 @@
size = <2>;
lid_sensor_0: bma422 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <0>;
default;
};
lid_sensor_1: lis2dw12 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
};
diff --git a/zephyr/program/nissa/pujjo/generated.dtsi b/zephyr/projects/nissa/pujjo/generated.dtsi
index 46da0e4a02..727d2d3d53 100644
--- a/zephyr/program/nissa/pujjo/generated.dtsi
+++ b/zephyr/projects/nissa/pujjo/generated.dtsi
@@ -188,10 +188,10 @@
gpios = <&gpio0 1 GPIO_INPUT_PULL_UP>;
};
gpio_vccin_aux_vid0: vccin_aux_vid0 {
- gpios = <&gpio9 2 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ gpios = <&gpio9 2 GPIO_INPUT>;
};
gpio_vccin_aux_vid1: vccin_aux_vid1 {
- gpios = <&gpioe 3 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ gpios = <&gpioe 3 GPIO_INPUT>;
};
gpio_voldn_btn_odl: voldn_btn_odl {
gpios = <&gpio9 3 GPIO_INPUT_PULL_UP>;
diff --git a/zephyr/program/nissa/pujjo/keyboard.dtsi b/zephyr/projects/nissa/pujjo/keyboard.dtsi
index 00610e4e18..00610e4e18 100644
--- a/zephyr/program/nissa/pujjo/keyboard.dtsi
+++ b/zephyr/projects/nissa/pujjo/keyboard.dtsi
diff --git a/zephyr/program/nissa/pujjo/motionsense.dtsi b/zephyr/projects/nissa/pujjo/motionsense.dtsi
index af21e0509e..2dfca337c4 100644
--- a/zephyr/program/nissa/pujjo/motionsense.dtsi
+++ b/zephyr/projects/nissa/pujjo/motionsense.dtsi
@@ -14,7 +14,6 @@
bmi3xx-int = &base_accel;
lsm6dsm-int = &base_accel;
lis2dw12-int = &lid_accel;
- bma4xx-int = &lid_accel;
};
/*
@@ -227,7 +226,6 @@
port = <&i2c_ec_i2c_sensor>;
rot-standard-ref = <&base_rot_lsm6dsm>;
drv-data = <&lsm6dsm_data_gyro>;
- default-range = <(1000 | ROUND_UP_FLAG)>; /* dps */
alternate-for = <&base_gyro>;
alternate-ssfc-indicator = <&base_sensor_1>;
};
@@ -240,6 +238,8 @@
* list of GPIO interrupts that have to
* be enabled at initial stage
*/
- sensor-irqs = <&int_imu &int_lid_accel>;
+ sensor-irqs = <&int_imu>;
+ /* list of sensors in force mode */
+ accel-force-mode-sensors = <&lid_accel>;
};
};
diff --git a/zephyr/program/nissa/pujjo/overlay.dtsi b/zephyr/projects/nissa/pujjo/overlay.dtsi
index cb20ec6554..60b3b60003 100644
--- a/zephyr/program/nissa/pujjo/overlay.dtsi
+++ b/zephyr/projects/nissa/pujjo/overlay.dtsi
@@ -4,7 +4,6 @@
*/
#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usb_pd_tcpm.h>
/ {
aliases {
@@ -73,11 +72,6 @@
flags = <GPIO_INT_EDGE_FALLING>;
handler = "motion_interrupt";
};
- int_lid_accel: lid_accel {
- irq-pin = <&gpio_acc_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "lid_accel_interrupt";
- };
int_vol_down: vol_down {
irq-pin = <&gpio_voldn_btn_odl>;
flags = <GPIO_INT_EDGE_BOTH>;
@@ -102,23 +96,17 @@
};
gpio_sb_3: sb_3 {
- gpios = <&gpiof 5 (GPIO_OPEN_DRAIN | GPIO_VOLTAGE_1P8)>;
+ gpios = <&gpiof 5 GPIO_OPEN_DRAIN>;
no-auto-init;
};
gpio_sb_4: sb_4 {
- gpios = <&gpiof 4 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
+ gpios = <&gpiof 4 GPIO_INPUT>;
no-auto-init;
};
gpio_fan_enable: fan-enable {
gpios = <&gpio6 3 GPIO_OUTPUT>;
no-auto-init;
};
- ec-i2c-sensor-scl {
- gpios = <&gpio9 0 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
- ec-i2c-sensor-sda {
- gpios = <&gpio8 7 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>;
- };
gpio_power_led: power_led {
gpios = <&gpioc 2 GPIO_OUTPUT_LOW>;
};
@@ -220,7 +208,6 @@
reg = <0>;
bc12 = <&bc12_port0>;
chg = <&chg_port0>;
- tcpc = <&tcpc_port0>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_0>;
@@ -317,14 +304,6 @@
status = "okay";
reg = <0x9>;
};
-
- tcpc_port0: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
};
&i2c7_0 {
diff --git a/zephyr/program/nissa/pujjo/power_signals.dtsi b/zephyr/projects/nissa/pujjo/power_signals.dtsi
index 1d2b23069d..1d2b23069d 100644
--- a/zephyr/program/nissa/pujjo/power_signals.dtsi
+++ b/zephyr/projects/nissa/pujjo/power_signals.dtsi
diff --git a/zephyr/program/nissa/pujjo/project.conf b/zephyr/projects/nissa/pujjo/project.conf
index b9dc28b9cd..b9dc28b9cd 100644
--- a/zephyr/program/nissa/pujjo/project.conf
+++ b/zephyr/projects/nissa/pujjo/project.conf
diff --git a/zephyr/program/nissa/pujjo/project.overlay b/zephyr/projects/nissa/pujjo/project.overlay
index e498775714..e498775714 100644
--- a/zephyr/program/nissa/pujjo/project.overlay
+++ b/zephyr/projects/nissa/pujjo/project.overlay
diff --git a/zephyr/program/nissa/pujjo/pujjo_vif.xml b/zephyr/projects/nissa/pujjo/pujjo_vif.xml
index b7d462584a..b7d462584a 100644
--- a/zephyr/program/nissa/pujjo/pujjo_vif.xml
+++ b/zephyr/projects/nissa/pujjo/pujjo_vif.xml
diff --git a/zephyr/program/nissa/pujjo/src/charger.c b/zephyr/projects/nissa/pujjo/src/charger.c
index 8763f24793..f1f1d57790 100644
--- a/zephyr/program/nissa/pujjo/src/charger.c
+++ b/zephyr/projects/nissa/pujjo/src/charger.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
#include "charger.h"
#include "charger/isl923x_public.h"
-#include "console.h"
-#include "driver/charger/isl923x.h"
#include "driver/tcpm/raa489000.h"
+#include "driver/charger/isl923x.h"
+#include "console.h"
#include "extpower.h"
-#include "hooks.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
+#include "hooks.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/pujjo/src/fan.c b/zephyr/projects/nissa/pujjo/src/fan.c
index 8b8634a653..97323a7edf 100644
--- a/zephyr/program/nissa/pujjo/src/fan.c
+++ b/zephyr/projects/nissa/pujjo/src/fan.c
@@ -3,15 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
+
#include "cros_cbi.h"
#include "fan.h"
#include "gpio/gpio.h"
#include "hooks.h"
-#include "nissa_common.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/pujjo/src/form_factor.c b/zephyr/projects/nissa/pujjo/src/form_factor.c
index f160c88d78..6b02a258bc 100644
--- a/zephyr/program/nissa/pujjo/src/form_factor.c
+++ b/zephyr/projects/nissa/pujjo/src/form_factor.c
@@ -3,28 +3,26 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/logging/log.h>
+
#include "accelgyro.h"
#include "button.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
-#include "driver/accel_bma4xx.h"
-#include "driver/accel_lis2dw12_public.h"
#include "driver/accelgyro_bmi323.h"
#include "driver/accelgyro_lsm6dsm.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
-#include "motion_sense.h"
#include "motionsense_sensors.h"
-#include "nissa_common.h"
+#include "motion_sense.h"
#include "tablet_mode.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
static bool use_alt_sensor;
-static bool use_alt_lid_accel;
void motion_interrupt(enum gpio_signal signal)
{
@@ -34,23 +32,13 @@ void motion_interrupt(enum gpio_signal signal)
bmi3xx_interrupt(signal);
}
-void lid_accel_interrupt(enum gpio_signal signal)
-{
- if (use_alt_lid_accel)
- lis2dw12_interrupt(signal);
- else
- bma4xx_interrupt(signal);
-}
-
static void sensor_init(void)
{
int ret;
uint32_t val;
- /* check which sensors are installed */
+ /* check which base sensor is used for motion_interrupt */
use_alt_sensor = cros_cbi_ssfc_check_match(
CBI_SSFC_VALUE_ID(DT_NODELABEL(base_sensor_1)));
- use_alt_lid_accel = cros_cbi_ssfc_check_match(
- CBI_SSFC_VALUE_ID(DT_NODELABEL(lid_sensor_1)));
motion_sensors_check_ssfc();
diff --git a/zephyr/program/nissa/pujjo/src/hdmi.c b/zephyr/projects/nissa/pujjo/src/hdmi.c
index 9461e7c53e..9461e7c53e 100644
--- a/zephyr/program/nissa/pujjo/src/hdmi.c
+++ b/zephyr/projects/nissa/pujjo/src/hdmi.c
diff --git a/zephyr/program/nissa/pujjo/src/keyboard.c b/zephyr/projects/nissa/pujjo/src/keyboard.c
index 1587030080..1587030080 100644
--- a/zephyr/program/nissa/pujjo/src/keyboard.c
+++ b/zephyr/projects/nissa/pujjo/src/keyboard.c
diff --git a/zephyr/program/nissa/pujjo/src/led.c b/zephyr/projects/nissa/pujjo/src/led.c
index 4d859f2764..bd04af5a25 100644
--- a/zephyr/program/nissa/pujjo/src/led.c
+++ b/zephyr/projects/nissa/pujjo/src/led.c
@@ -10,9 +10,9 @@
*/
#include "common.h"
-#include "gpio.h"
-#include "led_common.h"
#include "led_onoff_states.h"
+#include "led_common.h"
+#include "gpio.h"
#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
diff --git a/zephyr/program/nissa/pujjo/src/usbc.c b/zephyr/projects/nissa/pujjo/src/usbc.c
index ac93edfd7a..5d3d94c243 100644
--- a/zephyr/program/nissa/pujjo/src/usbc.c
+++ b/zephyr/projects/nissa/pujjo/src/usbc.c
@@ -3,21 +3,36 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "charge_state_v2.h"
#include "chipset.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "system.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
-#include "driver/tcpm/raa489000.h"
#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "usb_mux.h"
+#include "driver/tcpm/raa489000.h"
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0_TCPC,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .drv = &raa489000_tcpm_drv,
+ /* RAA489000 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_VBUS_MONITOR,
+ },
+};
+
int board_is_sourcing_vbus(int port)
{
int regval;
diff --git a/zephyr/program/nissa/src/board_power.c b/zephyr/projects/nissa/src/board_power.c
index 858076686b..d7fb4aeffe 100644
--- a/zephyr/program/nissa/src/board_power.c
+++ b/zephyr/projects/nissa/src/board_power.c
@@ -3,12 +3,9 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio.h"
-#include "gpio_signal.h"
-
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
#include <zephyr/sys/atomic.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/drivers/gpio.h>
#include <ap_power/ap_power.h>
#include <ap_power/ap_power_events.h>
@@ -17,6 +14,9 @@
#include <power_signals.h>
#include <x86_power_signals.h>
+#include "gpio_signal.h"
+#include "gpio/gpio.h"
+
LOG_MODULE_DECLARE(ap_pwrseq, LOG_LEVEL_INF);
#define X86_NON_DSX_ADLP_NONPWRSEQ_FORCE_SHUTDOWN_TO_MS 5
diff --git a/zephyr/program/nissa/src/common.c b/zephyr/projects/nissa/src/common.c
index d437bfca47..78f703ae49 100644
--- a/zephyr/program/nissa/src/common.c
+++ b/zephyr/projects/nissa/src/common.c
@@ -3,20 +3,21 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <ap_power/ap_power.h>
+
#include "battery.h"
-#include "charge_state_v2.h"
#include "charger.h"
+#include "charge_state_v2.h"
#include "chipset.h"
#include "cros_cbi.h"
#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
#include "usb_mux.h"
+#include "system.h"
-#include <zephyr/device.h>
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
-#include <ap_power/ap_power.h>
+#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(nissa, CONFIG_NISSA_LOG_LEVEL);
static uint8_t cached_usb_pd_port_count;
@@ -80,6 +81,20 @@ static void board_setup_init(void)
*/
DECLARE_HOOK(HOOK_INIT, board_setup_init, HOOK_PRIO_INIT_I2C);
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
+
+ /*
+ * Assume charger overdraws by about 4%, keeping the actual draw
+ * within spec. This adjustment can be changed with characterization
+ * of actual hardware.
+ */
+ icl = icl * 96 / 100;
+ charge_set_input_current_limit(icl, charge_mv);
+}
+
int pd_check_vconn_swap(int port)
{
/* Allow VCONN swaps if the AP is on. */
@@ -137,63 +152,3 @@ enum nissa_sub_board_type nissa_get_sb_type(void)
}
return sb;
}
-
-__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
- int *ki_div, int *kd, int *kd_div)
-{
- *kp = 1;
- *kp_div = 32;
- *ki = 0;
- *ki_div = 1;
- *kd = 0;
- *kd_div = 1;
-}
-
-#ifdef CONFIG_PLATFORM_EC_CHARGER_SM5803
-/*
- * Called by USB-PD code to determine whether a given input voltage is
- * acceptable.
- */
-__override int pd_is_valid_input_voltage(int mv)
-{
- int battery_voltage, rv;
-
- rv = battery_design_voltage(&battery_voltage);
- if (rv) {
- LOG_ERR("Unable to get battery design voltage: %d", rv);
- return true;
- }
-
- /*
- * SM5803 is extremely inefficient in buck-boost mode, when
- * VBUS ~= VSYS: very high temperatures on the chip and associated
- * inductor have been observed when sinking normal charge current in
- * buck-boost mode (but not in buck or boost mode) so we choose to
- * completely exclude some voltages that are likely to be problematic.
- *
- * Nissa devices use either 2S or 3S batteries, for which VBUS will
- * usually only be near VSYS with a 3S battery and 12V input (picked
- * from among common supported PD voltages)- 2S can get close to
- * 9V, but we expect charge current to be low when a 2S battery is
- * charged to that voltage (because it will be nearly full).
- *
- * We assume that any battery with a design voltage above 9V is 3S, and
- * that other problematic PD voltages (near to, but not exactly 12V)
- * will rarely occur.
- */
- if (battery_voltage > 9000 && mv == 12000) {
- return false;
- }
- return true;
-}
-#endif
-
-/* Trigger shutdown by enabling the Z-sleep circuit */
-__override void board_hibernate_late(void)
-{
- gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_slp_z), 1);
- /*
- * The system should hibernate, but there may be
- * a small delay, so return.
- */
-}
diff --git a/zephyr/program/nissa/src/led.c b/zephyr/projects/nissa/src/led.c
index 2617d0092d..2617d0092d 100644
--- a/zephyr/program/nissa/src/led.c
+++ b/zephyr/projects/nissa/src/led.c
diff --git a/zephyr/program/nissa/src/sub_board.c b/zephyr/projects/nissa/src/sub_board.c
index e8e9648ba6..3ccbcd9325 100644
--- a/zephyr/program/nissa/src/sub_board.c
+++ b/zephyr/projects/nissa/src/sub_board.c
@@ -5,24 +5,24 @@
/* Nissa sub-board hardware configuration */
+#include <ap_power/ap_power.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/pinctrl.h>
+#include <zephyr/init.h>
+#include <zephyr/kernel.h>
+#include <zephyr/sys/printk.h>
+
#include "cros_board_info.h"
#include "driver/tcpm/tcpci.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
-#include "nissa_common.h"
-#include "nissa_hdmi.h"
-#include "task.h"
#include "usb_charge.h"
#include "usb_pd.h"
#include "usbc/usb_muxes.h"
+#include "task.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/pinctrl.h>
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/sys/printk.h>
-
-#include <ap_power/ap_power.h>
+#include "nissa_common.h"
+#include "nissa_hdmi.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
@@ -157,14 +157,14 @@ static void nereid_subboard_config(void)
if (sb == NISSA_SB_C_A || sb == NISSA_SB_HDMI_A ||
sb == NISSA_SB_NONE) {
/*
- * Configure VBUS enable, retaining current value.
+ * Configure VBUS enable, default off.
* SB_NONE indicates missing fw_config; it's safe to enable VBUS
* control in this case since all that will happen is we turn
* off power to LTE, and it's useful to allow USB-A to work in
* such a configuration.
*/
gpio_pin_configure_dt(GPIO_DT_FROM_ALIAS(gpio_en_usb_a1_vbus),
- GPIO_OUTPUT);
+ GPIO_OUTPUT_LOW);
} else {
/* Turn off unused pins */
gpio_pin_configure_dt(
@@ -286,3 +286,13 @@ static void board_init(void)
#endif
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/* Trigger shutdown by enabling the Z-sleep circuit */
+__override void board_hibernate_late(void)
+{
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_slp_z), 1);
+ /*
+ * The system should hibernate, but there may be
+ * a small delay, so return.
+ */
+}
diff --git a/zephyr/program/nissa/xivu/cbi.dtsi b/zephyr/projects/nissa/xivu/cbi.dtsi
index 72f83c28a4..4149ea291c 100644
--- a/zephyr/program/nissa/xivu/cbi.dtsi
+++ b/zephyr/projects/nissa/xivu/cbi.dtsi
@@ -74,60 +74,4 @@
/delete-node/ fan;
};
- /* Xivu-specific ssfc fields. */
- cbi-ssfc {
- compatible = "cros-ec,cbi-ssfc";
- /*
- * SSFC field to identify LID motion sensor.
- */
- lid-sensor {
- enum-name = "LID_SENSOR";
- size = <2>;
-
- lid_sensor_none: none {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <0>;
- default;
- };
-
- lid_sensor_lis2dw12: lis2dw12 {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <1>;
- default;
- };
- lid_sensor_bma422: bma422 {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <2>;
- };
- };
- /*
- * SSFC field to identify BASE motion sensor.
- */
- base-sensor {
- enum-name = "BASE_SENSOR";
- size = <2>;
-
- base_sensor_none: none {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <0>;
- default;
- };
- base_sensor_lsm6dso: lsm6dso {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <1>;
- default;
- };
- base_sensor_bmi323: bmi323 {
- compatible = "cros-ec,cbi-ssfc-value";
- status = "okay";
- value = <2>;
- };
- };
- };
-
};
diff --git a/zephyr/program/nissa/xivu/generated.dtsi b/zephyr/projects/nissa/xivu/generated.dtsi
index 383054adf8..383054adf8 100644
--- a/zephyr/program/nissa/xivu/generated.dtsi
+++ b/zephyr/projects/nissa/xivu/generated.dtsi
diff --git a/zephyr/program/nissa/xivu/keyboard.dtsi b/zephyr/projects/nissa/xivu/keyboard.dtsi
index 5248c4aaff..5248c4aaff 100644
--- a/zephyr/program/nissa/xivu/keyboard.dtsi
+++ b/zephyr/projects/nissa/xivu/keyboard.dtsi
diff --git a/zephyr/program/nissa/xivu/led_pins.dtsi b/zephyr/projects/nissa/xivu/led_pins.dtsi
index e7efa3e96c..d85004a0c9 100644
--- a/zephyr/program/nissa/xivu/led_pins.dtsi
+++ b/zephyr/projects/nissa/xivu/led_pins.dtsi
@@ -4,18 +4,25 @@
*/
/ {
- pwmleds {
- compatible = "pwm-leds";
+ pwm_pins {
+ compatible = "cros-ec,pwm-pin-config";
pwm_led_y_c0: pwm_led_y_c0 {
+ #led-pin-cells = <1>;
pwms = <&pwm2 0 PWM_HZ(324) PWM_POLARITY_INVERTED>;
};
+
pwm_led_w_c0: pwm_led_w_c0 {
+ #led-pin-cells = <1>;
pwms = <&pwm0 0 PWM_HZ(324) PWM_POLARITY_INVERTED>;
};
+
pwm_led_y_c1: pwm_led_y_c1 {
+ #led-pin-cells = <1>;
pwms = <&pwm6 0 PWM_HZ(324) PWM_POLARITY_INVERTED>;
};
+
pwm_led_w_c1: pwm_led_w_c1 {
+ #led-pin-cells = <1>;
pwms = <&pwm1 0 PWM_HZ(324) PWM_POLARITY_INVERTED>;
};
};
@@ -26,27 +33,30 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_led_y_c0 &pwm_led_y_c1
- &pwm_led_w_c0 &pwm_led_w_c1>;
- led-values = <0 0 0 0>;
+ led-pins = <&pwm_led_y_c0 0>,
+ <&pwm_led_y_c1 0>,
+ <&pwm_led_w_c0 0>,
+ <&pwm_led_w_c1 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_led_y_c0 &pwm_led_y_c1
- &pwm_led_w_c0 &pwm_led_w_c1>;
- led-values = <50 50 0 0>;
+ led-pins = <&pwm_led_y_c0 1>,
+ <&pwm_led_y_c1 1>,
+ <&pwm_led_w_c0 0>,
+ <&pwm_led_w_c1 0>;
};
color_white: color-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwm_led_y_c0 &pwm_led_y_c1
- &pwm_led_w_c0 &pwm_led_w_c1>;
- led-values = <0 0 50 50>;
+ led-pins = <&pwm_led_y_c0 0>,
+ <&pwm_led_y_c1 0>,
+ <&pwm_led_w_c0 1>,
+ <&pwm_led_w_c1 1>;
};
};
};
diff --git a/zephyr/program/nissa/xivu/led_policy.dtsi b/zephyr/projects/nissa/xivu/led_policy.dtsi
index 562e361ec5..562e361ec5 100644
--- a/zephyr/program/nissa/xivu/led_policy.dtsi
+++ b/zephyr/projects/nissa/xivu/led_policy.dtsi
diff --git a/zephyr/program/nissa/xivur/motionsense.dtsi b/zephyr/projects/nissa/xivu/motionsense.dtsi
index 6297a07bf5..332252c4ef 100644
--- a/zephyr/program/nissa/xivur/motionsense.dtsi
+++ b/zephyr/projects/nissa/xivu/motionsense.dtsi
@@ -1,4 +1,4 @@
-/* Copyright 2021 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,22 +35,16 @@
motionsense-rotation-ref {
compatible = "cros-ec,motionsense-rotation-ref";
lid_rot_ref: lid-rotation-ref {
- mat33 = <(-1) 0 0
- 0 1 0
+ mat33 = <0 1 0
+ 1 0 0
0 0 (-1)>;
};
- base_rot_ref: base-rot-ref {
- mat33 = <(-1) 0 0
- 0 (-1) 0
+ base_rot_ref: base-rotation-ref {
+ mat33 = <0 (-1) 0
+ 1 0 0
0 0 1>;
};
-
- base_rot_inverted: base-rotation-inverted {
- mat33 = <1 0 0
- 0 (-1) 0
- 0 0 (-1)>;
- };
};
/*
@@ -120,10 +114,6 @@
location = "MOTIONSENSE_LOC_BASE";
mutex = <&base_mutex>;
port = <&i2c_ec_i2c_sensor>;
- /*
- * May be replaced by alternate depending
- * on board config.
- */
rot-standard-ref = <&base_rot_ref>;
drv-data = <&lsm6dso_accel_data>;
configs {
diff --git a/zephyr/program/nissa/xivu/overlay.dtsi b/zephyr/projects/nissa/xivu/overlay.dtsi
index 402f0e2f2f..de45db75e7 100644
--- a/zephyr/program/nissa/xivu/overlay.dtsi
+++ b/zephyr/projects/nissa/xivu/overlay.dtsi
@@ -4,8 +4,6 @@
*/
#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usbc_mux.h>
-#include <dt-bindings/usb_pd_tcpm.h>
/ {
aliases {
@@ -60,12 +58,7 @@
int_imu: ec_imu {
irq-pin = <&gpio_imu_int_l>;
flags = <GPIO_INT_EDGE_FALLING>;
- handler = "motion_interrupt";
- };
- int_lid_accel: ec_lid_accel {
- irq-pin = <&gpio_acc_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "lid_accel_interrupt";
+ handler = "lsm6dso_interrupt";
};
int_vol_down: vol_down {
irq-pin = <&gpio_voldn_btn_odl>;
@@ -216,7 +209,6 @@
reg = <0>;
bc12 = <&bc12_port0>;
chg = <&chg_port0>;
- tcpc = <&tcpc_port0>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_0>;
@@ -236,7 +228,6 @@
reg = <1>;
bc12 = <&bc12_port1>;
chg = <&chg_port1>;
- tcpc = <&tcpc_port1>;
usb-mux-chain-1 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_1 &anx7483_mux_1>;
@@ -322,14 +313,6 @@
status = "okay";
reg = <0x9>;
};
-
- tcpc_port0: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
};
&i2c5_1 {
@@ -348,19 +331,10 @@
reg = <0x9>;
};
- tcpc_port1: raa489000@22 {
- compatible = "renesas,raa489000";
- reg = <0x22>;
- tcpc-flags = <(
- TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_VBUS_MONITOR)>;
- };
-
anx7483_mux_1: anx7483-mux-1@3e {
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "anx7483_set_default_tuning";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
};
diff --git a/zephyr/program/nissa/xivu/power_signals.dtsi b/zephyr/projects/nissa/xivu/power_signals.dtsi
index 1d2b23069d..1d2b23069d 100644
--- a/zephyr/program/nissa/xivu/power_signals.dtsi
+++ b/zephyr/projects/nissa/xivu/power_signals.dtsi
diff --git a/zephyr/program/nissa/xivur/project.conf b/zephyr/projects/nissa/xivu/project.conf
index c63cf8b41f..4ce9c635c3 100644
--- a/zephyr/program/nissa/xivur/project.conf
+++ b/zephyr/projects/nissa/xivu/project.conf
@@ -2,7 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-CONFIG_BOARD_XIVUR=y
+CONFIG_BOARD_XIVU=y
CONFIG_PLATFORM_EC_OCPC=y
-
CONFIG_PLATFORM_EC_ACCELGYRO_LSM6DSO=y
+
+# LED
+CONFIG_PLATFORM_EC_LED_COMMON=n
+CONFIG_PLATFORM_EC_LED_DT=y
+
+# USBC
+CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=45000
diff --git a/zephyr/program/nissa/xivu/project.overlay b/zephyr/projects/nissa/xivu/project.overlay
index a7c5b7e9e7..a7c5b7e9e7 100644
--- a/zephyr/program/nissa/xivu/project.overlay
+++ b/zephyr/projects/nissa/xivu/project.overlay
diff --git a/zephyr/program/nissa/xivu/src/charger.c b/zephyr/projects/nissa/xivu/src/charger.c
index a3d9d16443..5021a55758 100644
--- a/zephyr/program/nissa/xivu/src/charger.c
+++ b/zephyr/projects/nissa/xivu/src/charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
#include "charger.h"
#include "charger/isl923x_public.h"
#include "console.h"
#include "extpower.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/xivu/src/keyboard.c b/zephyr/projects/nissa/xivu/src/keyboard.c
index ef799fb1d2..ef799fb1d2 100644
--- a/zephyr/program/nissa/xivu/src/keyboard.c
+++ b/zephyr/projects/nissa/xivu/src/keyboard.c
diff --git a/zephyr/program/nissa/craask/src/usbc.c b/zephyr/projects/nissa/xivu/src/usbc.c
index 1e0c1627bb..1520efaa55 100644
--- a/zephyr/program/nissa/craask/src/usbc.c
+++ b/zephyr/projects/nissa/xivu/src/usbc.c
@@ -3,21 +3,47 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "charge_state_v2.h"
#include "chipset.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "system.h"
#include "driver/charger/isl923x_public.h"
#include "driver/retimer/anx7483_public.h"
-#include "driver/tcpm/raa489000.h"
#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "usb_mux.h"
+#include "driver/tcpm/raa489000.h"
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0_TCPC,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .drv = &raa489000_tcpm_drv,
+ /* RAA489000 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_VBUS_MONITOR,
+ },
+ { /* sub-board */
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .drv = &raa489000_tcpm_drv,
+ /* RAA489000 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_VBUS_MONITOR,
+ },
+};
+
int board_is_sourcing_vbus(int port)
{
int regval;
@@ -249,3 +275,11 @@ void usb_interrupt(enum gpio_signal signal)
/* Check for lost interrupts in a bit */
hook_call_deferred(ud, USBC_INT_POLL_DELAY_US);
}
+
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_ma = (charge_ma * 90) / 100;
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/zephyr/program/nissa/yaviks/cbi.dtsi b/zephyr/projects/nissa/yaviks/cbi.dtsi
index c5716cbd37..c5716cbd37 100644
--- a/zephyr/program/nissa/yaviks/cbi.dtsi
+++ b/zephyr/projects/nissa/yaviks/cbi.dtsi
diff --git a/zephyr/program/nissa/yaviks/gpio.dtsi b/zephyr/projects/nissa/yaviks/gpio.dtsi
index dae1d641cd..dae1d641cd 100644
--- a/zephyr/program/nissa/yaviks/gpio.dtsi
+++ b/zephyr/projects/nissa/yaviks/gpio.dtsi
diff --git a/zephyr/program/nissa/yaviks/keyboard.dtsi b/zephyr/projects/nissa/yaviks/keyboard.dtsi
index 04a620767a..04a620767a 100644
--- a/zephyr/program/nissa/yaviks/keyboard.dtsi
+++ b/zephyr/projects/nissa/yaviks/keyboard.dtsi
diff --git a/zephyr/program/nissa/yaviks/overlay.dtsi b/zephyr/projects/nissa/yaviks/overlay.dtsi
index 2b5f1e453d..d768116444 100644
--- a/zephyr/program/nissa/yaviks/overlay.dtsi
+++ b/zephyr/projects/nissa/yaviks/overlay.dtsi
@@ -4,7 +4,6 @@
*/
#include <cros/thermistor/thermistor.dtsi>
-#include <dt-bindings/usb_pd_tcpm.h>
/ {
aliases {
@@ -131,17 +130,17 @@
};
};
- temp_cpu_thermistor: cpu {
+ temp_cpu: cpu {
compatible = "cros-ec,temp-sensor-thermistor";
thermistor = <&thermistor_3V3_51K1_47K_4050B>;
adc = <&adc_temp_sensor_1>;
};
- temp_5v_regulator_thermistor: 5v-regulator {
+ temp_5v_regulator: 5v_regulator {
compatible = "cros-ec,temp-sensor-thermistor";
thermistor = <&thermistor_3V3_51K1_47K_4050B>;
adc = <&adc_temp_sensor_2>;
};
- temp_charger_thermistor: charger {
+ temp_charger: charger {
compatible = "cros-ec,temp-sensor-thermistor";
thermistor = <&thermistor_3V3_51K1_47K_4050B>;
adc = <&adc_temp_sensor_3>;
@@ -149,32 +148,32 @@
named-temp-sensors {
compatible = "cros-ec,temp-sensors";
- temp_cpu: cpu {
+ cpu {
temp_fan_off = <45>;
temp_fan_max = <60>;
temp_host_high = <75>;
temp_host_halt = <85>;
temp_host_release_high = <65>;
power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
- sensor = <&temp_cpu_thermistor>;
+ sensor = <&temp_cpu>;
};
- temp_5v_regulator: 5v-regulator {
+ 5v_regulator {
temp_fan_off = <50>;
temp_fan_max = <65>;
temp_host_high = <75>;
temp_host_halt = <85>;
temp_host_release_high = <65>;
power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
- sensor = <&temp_5v_regulator_thermistor>;
+ sensor = <&temp_5v_regulator>;
};
- temp_charger: charger {
+ charger {
temp_fan_off = <50>;
temp_fan_max = <65>;
temp_host_high = <80>;
temp_host_halt = <85>;
temp_host_release_high = <75>;
power-good-pin = <&gpio_ec_soc_dsw_pwrok>;
- sensor = <&temp_charger_thermistor>;
+ sensor = <&temp_charger>;
};
};
@@ -202,7 +201,6 @@
reg = <0>;
bc12 = <&bc12_port0>;
chg = <&chg_port0>;
- tcpc = <&usbpd0>;
usb-mux-chain-0 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_0>;
@@ -218,7 +216,6 @@
reg = <1>;
bc12 = <&bc12_port1>;
chg = <&chg_port1>;
- tcpc = <&tcpc_port1>;
usb-mux-chain-1 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&virtual_mux_1 &tcpci_mux_1>;
@@ -238,6 +235,18 @@
};
};
};
+
+ fans {
+ compatible = "cros-ec,fans";
+ fan_0 {
+ pwms = <&pwm2 PWM_CHANNEL_2 PWM_KHZ(25) PWM_POLARITY_NORMAL>;
+ tach = <&tach1>;
+ rpm_min = <2600>;
+ rpm_start = <2600>;
+ rpm_max = <4100>;
+ enable_gpio = <&gpio_fan_enable>;
+ };
+ };
};
&thermistor_3V3_51K1_47K_4050B {
@@ -339,12 +348,6 @@
status = "okay";
reg = <0x32>;
};
-
- tcpc_port1: ps8745@b {
- compatible = "parade,ps8xxx";
- reg = <0xb>;
- tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
- };
};
&i2c_ec_i2c_sub_usb_c1 {
@@ -381,3 +384,19 @@
&usbpd0 {
status = "okay";
};
+
+/* pwm for fan */
+&pwm2 {
+ status = "okay";
+ prescaler-cx = <PWM_PRESCALER_C6>;
+ pinctrl-0 = <&pwm2_gpa2_default>;
+ pinctrl-names = "default";
+};
+/* fan tachometer sensor */
+&tach1 {
+ status = "okay";
+ channel = <IT8XXX2_TACH_CHANNEL_A>;
+ pulses-per-round = <2>;
+ pinctrl-0 = <&tach1a_gpd7_default>;
+ pinctrl-names = "default";
+};
diff --git a/zephyr/program/nissa/yaviks/power_signals.dtsi b/zephyr/projects/nissa/yaviks/power_signals.dtsi
index d64ac83150..d64ac83150 100644
--- a/zephyr/program/nissa/yaviks/power_signals.dtsi
+++ b/zephyr/projects/nissa/yaviks/power_signals.dtsi
diff --git a/zephyr/program/nissa/yaviks/project.conf b/zephyr/projects/nissa/yaviks/project.conf
index 80a9e9ea97..0e385b843e 100644
--- a/zephyr/program/nissa/yaviks/project.conf
+++ b/zephyr/projects/nissa/yaviks/project.conf
@@ -28,7 +28,6 @@ CONFIG_PLATFORM_EC_KBLIGHT_ENABLE_PIN=n
# Fan
CONFIG_PLATFORM_EC_FAN=y
-CONFIG_PLATFORM_EC_CUSTOM_FAN_CONTROL=y
# LED
CONFIG_PLATFORM_EC_LED_PWM=n
diff --git a/zephyr/program/nissa/yaviks/project.overlay b/zephyr/projects/nissa/yaviks/project.overlay
index fecd1c98c8..a7ce97a8b3 100644
--- a/zephyr/program/nissa/yaviks/project.overlay
+++ b/zephyr/projects/nissa/yaviks/project.overlay
@@ -6,7 +6,6 @@
#include "../cbi.dtsi"
#include "cbi.dtsi"
-#include "fan.dtsi"
#include "gpio.dtsi"
#include "keyboard.dtsi"
#include "overlay.dtsi"
diff --git a/zephyr/program/nissa/yaviks/src/charger.c b/zephyr/projects/nissa/yaviks/src/charger.c
index ec2247f4b4..9be2e685b0 100644
--- a/zephyr/program/nissa/yaviks/src/charger.c
+++ b/zephyr/projects/nissa/yaviks/src/charger.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "battery.h"
-#include "battery_fuel_gauge.h"
#include "charger.h"
#include "console.h"
#include "driver/charger/sm5803.h"
#include "extpower.h"
-#include "nissa_common.h"
#include "usb_pd.h"
-
-#include <zephyr/logging/log.h>
+#include "nissa_common.h"
+#include "battery_fuel_gauge.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
diff --git a/zephyr/program/nissa/craask/src/fan.c b/zephyr/projects/nissa/yaviks/src/fan.c
index c01ee3d752..23c3ec1143 100644
--- a/zephyr/program/nissa/craask/src/fan.c
+++ b/zephyr/projects/nissa/yaviks/src/fan.c
@@ -2,15 +2,14 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
#include "cros_cbi.h"
#include "fan.h"
#include "gpio/gpio.h"
#include "hooks.h"
#include "nissa_common.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
static void fan_init(void)
diff --git a/zephyr/program/nissa/yaviks/src/keyboard.c b/zephyr/projects/nissa/yaviks/src/keyboard.c
index 54f8750e98..46d6083dbf 100644
--- a/zephyr/program/nissa/yaviks/src/keyboard.c
+++ b/zephyr/projects/nissa/yaviks/src/keyboard.c
@@ -2,6 +2,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "cros_cbi.h"
#include "ec_commands.h"
#include "hooks.h"
@@ -9,8 +11,6 @@
#include "keyboard_scan.h"
#include "timer.h"
-#include <zephyr/logging/log.h>
-
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
/* Keyboard scan setting */
diff --git a/zephyr/program/nissa/yaviks/src/led.c b/zephyr/projects/nissa/yaviks/src/led.c
index 7671bd3a92..88a476f1b0 100644
--- a/zephyr/program/nissa/yaviks/src/led.c
+++ b/zephyr/projects/nissa/yaviks/src/led.c
@@ -3,17 +3,17 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+
#include "battery.h"
#include "charge_manager.h"
#include "charge_state.h"
#include "chipset.h"
#include "ec_commands.h"
#include "gpio.h"
-#include "hooks.h"
#include "host_command.h"
#include "led_common.h"
-
-#include <stdint.h>
+#include "hooks.h"
#define BAT_LED_ON 0
#define BAT_LED_OFF 1
diff --git a/zephyr/program/nissa/nereid/src/usbc.c b/zephyr/projects/nissa/yaviks/src/usbc.c
index 1e87abfa0d..48f7cfd9cb 100644
--- a/zephyr/program/nissa/nereid/src/usbc.c
+++ b/zephyr/projects/nissa/yaviks/src/usbc.c
@@ -3,23 +3,47 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+#include <ap_power/ap_power.h>
+
#include "charge_state_v2.h"
#include "chipset.h"
+#include "hooks.h"
+#include "usb_mux.h"
+#include "system.h"
#include "driver/charger/sm5803.h"
#include "driver/tcpm/it83xx_pd.h"
#include "driver/tcpm/ps8xxx_public.h"
#include "driver/tcpm/tcpci.h"
-#include "hooks.h"
-#include "nissa_common.h"
-#include "system.h"
-#include "usb_mux.h"
-
-#include <zephyr/logging/log.h>
-#include <ap_power/ap_power.h>
+#include "nissa_common.h"
LOG_MODULE_DECLARE(nissa, CONFIG_NISSA_LOG_LEVEL);
+struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_EMBEDDED,
+ /* TCPC is embedded within EC so no i2c config needed */
+ .drv = &it8xxx2_tcpm_drv,
+ /* Alert is active-low, push-pull */
+ .flags = 0,
+ },
+ {
+ /*
+ * Sub-board: optional PS8745 TCPC+redriver. Behaves the same
+ * as PS8815.
+ */
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ },
+ .drv = &ps8xxx_tcpm_drv,
+ /* PS8745 implements TCPCI 2.0 */
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+};
+
/* Vconn control for integrated ITE TCPC */
void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
{
diff --git a/zephyr/program/nissa/yaviks/yaviks_vif.xml b/zephyr/projects/nissa/yaviks/yaviks_vif.xml
index edc6299c58..edc6299c58 100644
--- a/zephyr/program/nissa/yaviks/yaviks_vif.xml
+++ b/zephyr/projects/nissa/yaviks/yaviks_vif.xml
diff --git a/zephyr/program/npcx_evb/npcx7/BUILD.py b/zephyr/projects/npcx_evb/npcx7/BUILD.py
index baa6774595..baa6774595 100644
--- a/zephyr/program/npcx_evb/npcx7/BUILD.py
+++ b/zephyr/projects/npcx_evb/npcx7/BUILD.py
diff --git a/zephyr/program/npcx_evb/npcx7/CMakeLists.txt b/zephyr/projects/npcx_evb/npcx7/CMakeLists.txt
index 64429d586e..64429d586e 100644
--- a/zephyr/program/npcx_evb/npcx7/CMakeLists.txt
+++ b/zephyr/projects/npcx_evb/npcx7/CMakeLists.txt
diff --git a/zephyr/program/npcx_evb/npcx7/fan.dts b/zephyr/projects/npcx_evb/npcx7/fan.dts
index dc4debdcb9..dc4debdcb9 100644
--- a/zephyr/program/npcx_evb/npcx7/fan.dts
+++ b/zephyr/projects/npcx_evb/npcx7/fan.dts
diff --git a/zephyr/program/npcx_evb/npcx7/gpio.dts b/zephyr/projects/npcx_evb/npcx7/gpio.dts
index d44927609d..d44927609d 100644
--- a/zephyr/program/npcx_evb/npcx7/gpio.dts
+++ b/zephyr/projects/npcx_evb/npcx7/gpio.dts
diff --git a/zephyr/program/npcx_evb/npcx7/interrupts.dts b/zephyr/projects/npcx_evb/npcx7/interrupts.dts
index 3e92428ef4..3e92428ef4 100644
--- a/zephyr/program/npcx_evb/npcx7/interrupts.dts
+++ b/zephyr/projects/npcx_evb/npcx7/interrupts.dts
diff --git a/zephyr/program/npcx_evb/npcx7/keyboard.dts b/zephyr/projects/npcx_evb/npcx7/keyboard.dts
index e7e35d1493..3fb6986f1a 100644
--- a/zephyr/program/npcx_evb/npcx7/keyboard.dts
+++ b/zephyr/projects/npcx_evb/npcx7/keyboard.dts
@@ -5,7 +5,7 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
output-settle = <40>;
debounce-down = <6000>;
diff --git a/zephyr/program/npcx_evb/npcx7/prj.conf b/zephyr/projects/npcx_evb/npcx7/prj.conf
index f94c5ac2fa..5f1fc03f88 100644
--- a/zephyr/program/npcx_evb/npcx7/prj.conf
+++ b/zephyr/projects/npcx_evb/npcx7/prj.conf
@@ -18,6 +18,9 @@ CONFIG_PLATFORM_EC_VSTORE=n
# Board version is selected over GPIO board ID pins.
CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y
+# PWM
+CONFIG_PWM=y
+
# Sensors
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=n
@@ -49,6 +52,7 @@ CONFIG_PLATFORM_EC_USB_PD_USB4=n
# Zephyr feature
CONFIG_ASSERT=y
CONFIG_SHELL_MINIMAL=n
+CONFIG_LOG=y
# Avoid underflow info from tachometer
CONFIG_SENSOR_LOG_LEVEL_ERR=y
diff --git a/zephyr/program/npcx_evb/npcx9/BUILD.py b/zephyr/projects/npcx_evb/npcx9/BUILD.py
index 335f410d9b..335f410d9b 100644
--- a/zephyr/program/npcx_evb/npcx9/BUILD.py
+++ b/zephyr/projects/npcx_evb/npcx9/BUILD.py
diff --git a/zephyr/program/npcx_evb/npcx9/CMakeLists.txt b/zephyr/projects/npcx_evb/npcx9/CMakeLists.txt
index ef734c06f6..ef734c06f6 100644
--- a/zephyr/program/npcx_evb/npcx9/CMakeLists.txt
+++ b/zephyr/projects/npcx_evb/npcx9/CMakeLists.txt
diff --git a/zephyr/program/npcx_evb/npcx9/fan.dts b/zephyr/projects/npcx_evb/npcx9/fan.dts
index dc4debdcb9..dc4debdcb9 100644
--- a/zephyr/program/npcx_evb/npcx9/fan.dts
+++ b/zephyr/projects/npcx_evb/npcx9/fan.dts
diff --git a/zephyr/program/npcx_evb/npcx9/gpio.dts b/zephyr/projects/npcx_evb/npcx9/gpio.dts
index 9a32112471..9a32112471 100644
--- a/zephyr/program/npcx_evb/npcx9/gpio.dts
+++ b/zephyr/projects/npcx_evb/npcx9/gpio.dts
diff --git a/zephyr/program/npcx_evb/npcx9/interrupts.dts b/zephyr/projects/npcx_evb/npcx9/interrupts.dts
index 3e92428ef4..3e92428ef4 100644
--- a/zephyr/program/npcx_evb/npcx9/interrupts.dts
+++ b/zephyr/projects/npcx_evb/npcx9/interrupts.dts
diff --git a/zephyr/program/npcx_evb/npcx9/keyboard.dts b/zephyr/projects/npcx_evb/npcx9/keyboard.dts
index e7e35d1493..3fb6986f1a 100644
--- a/zephyr/program/npcx_evb/npcx9/keyboard.dts
+++ b/zephyr/projects/npcx_evb/npcx9/keyboard.dts
@@ -5,7 +5,7 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
output-settle = <40>;
debounce-down = <6000>;
diff --git a/zephyr/program/npcx_evb/npcx9/prj.conf b/zephyr/projects/npcx_evb/npcx9/prj.conf
index 73b263c830..827b6366c6 100644
--- a/zephyr/program/npcx_evb/npcx9/prj.conf
+++ b/zephyr/projects/npcx_evb/npcx9/prj.conf
@@ -22,6 +22,9 @@ CONFIG_PLATFORM_EC_WORKAROUND_FLASH_DOWNLOAD_API=y
# Board version is selected over GPIO board ID pins.
CONFIG_PLATFORM_EC_BOARD_VERSION_GPIO=y
+# PWM
+CONFIG_PWM=y
+
# Sensors
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=n
@@ -53,6 +56,7 @@ CONFIG_PLATFORM_EC_USB_PD_USB4=n
# Zephyr feature
CONFIG_ASSERT=y
CONFIG_SHELL_MINIMAL=n
+CONFIG_LOG=y
# Avoid underflow info from tachometer
CONFIG_SENSOR_LOG_LEVEL_ERR=y
diff --git a/zephyr/program/rex/BUILD.py b/zephyr/projects/rex/BUILD.py
index 2537f61226..2537f61226 100644
--- a/zephyr/program/rex/BUILD.py
+++ b/zephyr/projects/rex/BUILD.py
diff --git a/zephyr/program/rex/CMakeLists.txt b/zephyr/projects/rex/CMakeLists.txt
index 27d7dff068..27d7dff068 100644
--- a/zephyr/program/rex/CMakeLists.txt
+++ b/zephyr/projects/rex/CMakeLists.txt
diff --git a/zephyr/program/rex/Kconfig b/zephyr/projects/rex/Kconfig
index 7d17c27815..7d17c27815 100644
--- a/zephyr/program/rex/Kconfig
+++ b/zephyr/projects/rex/Kconfig
diff --git a/zephyr/program/rex/battery.dts b/zephyr/projects/rex/battery.dts
index e11346f48d..e11346f48d 100644
--- a/zephyr/program/rex/battery.dts
+++ b/zephyr/projects/rex/battery.dts
diff --git a/zephyr/program/rex/fan.dts b/zephyr/projects/rex/fan.dts
index aa6dcfde7d..aa6dcfde7d 100644
--- a/zephyr/program/rex/fan.dts
+++ b/zephyr/projects/rex/fan.dts
diff --git a/zephyr/program/rex/generated.dts b/zephyr/projects/rex/generated.dts
index 5b6f9cd708..5b6f9cd708 100644
--- a/zephyr/program/rex/generated.dts
+++ b/zephyr/projects/rex/generated.dts
diff --git a/zephyr/program/rex/include/gpio_map.h b/zephyr/projects/rex/include/gpio_map.h
index 01cbc44396..01cbc44396 100644
--- a/zephyr/program/rex/include/gpio_map.h
+++ b/zephyr/projects/rex/include/gpio_map.h
diff --git a/zephyr/program/rex/interrupts.dts b/zephyr/projects/rex/interrupts.dts
index 7de9141caf..7de9141caf 100644
--- a/zephyr/program/rex/interrupts.dts
+++ b/zephyr/projects/rex/interrupts.dts
diff --git a/zephyr/program/rex/keyboard.dts b/zephyr/projects/rex/keyboard.dts
index 91fad2db92..91fad2db92 100644
--- a/zephyr/program/rex/keyboard.dts
+++ b/zephyr/projects/rex/keyboard.dts
diff --git a/zephyr/program/rex/led.dts b/zephyr/projects/rex/led.dts
index fb31eaac43..94acb6da5c 100644
--- a/zephyr/program/rex/led.dts
+++ b/zephyr/projects/rex/led.dts
@@ -10,24 +10,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pins = <&gpio_led_1_l &gpio_led_2_l>;
- led-values = <1 1>;
+ led-pins = <&gpio_led_1_l 1>,
+ <&gpio_led_2_l 1>;
};
color_white: color-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_led_1_l &gpio_led_2_l>;
- led-values = <1 0>;
+ led-pins = <&gpio_led_1_l 1>,
+ <&gpio_led_2_l 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pins = <&gpio_led_1_l &gpio_led_2_l>;
- led-values = <0 1>;
+ led-pins = <&gpio_led_1_l 0>,
+ <&gpio_led_2_l 1>;
};
};
@@ -120,3 +120,19 @@
};
};
};
+
+&gpio_led_1_l {
+ #led-pin-cells = <1>;
+};
+
+&gpio_led_2_l {
+ #led-pin-cells = <1>;
+};
+
+&gpio_led_3_l {
+ #led-pin-cells = <1>;
+};
+
+&gpio_led_4_l {
+ #led-pin-cells = <1>;
+};
diff --git a/zephyr/program/rex/motionsense.dts b/zephyr/projects/rex/motionsense.dts
index 6af7cd2b12..6af7cd2b12 100644
--- a/zephyr/program/rex/motionsense.dts
+++ b/zephyr/projects/rex/motionsense.dts
diff --git a/zephyr/program/rex/power_signals.dts b/zephyr/projects/rex/power_signals.dts
index 09c84b8558..860c316795 100644
--- a/zephyr/program/rex/power_signals.dts
+++ b/zephyr/projects/rex/power_signals.dts
@@ -111,42 +111,42 @@
};
/* pwr-pg-ec-rsmrst-od */
-&gpio_seq_ec_rsmrst_odl {
+&gpio_seq_ec_rsmrst_odl{
no-auto-init;
};
/* pwr-ec-pch-rsmrst-odl */
-&gpio_ec_soc_rsmrst_l {
+&gpio_ec_soc_rsmrst_l{
no-auto-init;
};
/* pwr-pch-pwrok */
-&gpio_soc_pwrok {
+&gpio_soc_pwrok{
no-auto-init;
};
/* pwr-ec-pch-sys-pwrok */
-&gpio_sys_pwrok {
+&gpio_sys_pwrok{
no-auto-init;
};
/* pwr-sys-rst-l */
-&gpio_sys_rst_odl {
+&gpio_sys_rst_odl{
no-auto-init;
};
/* pwr-slp-s0-l */
-&gpio_sys_slp_s0ix_3v3_l {
+&gpio_sys_slp_s0ix_3v3_l{
no-auto-init;
};
/* pwr-slp-s3-l */
-&gpio_slp_s3_ls_l {
+&gpio_slp_s3_ls_l{
no-auto-init;
};
/* pwr-all-sys-pwrgd */
-&gpio_seq_ec_all_sys_pg {
+&gpio_seq_ec_all_sys_pg{
no-auto-init;
};
diff --git a/zephyr/program/rex/prj.conf b/zephyr/projects/rex/prj.conf
index 221f1e712b..7dcb2894da 100644
--- a/zephyr/program/rex/prj.conf
+++ b/zephyr/projects/rex/prj.conf
@@ -18,6 +18,10 @@ CONFIG_SHELL_TAB=y
CONFIG_SHELL_TAB_AUTOCOMPLETION=y
CONFIG_KERNEL_SHELL=y
+# Logging
+CONFIG_LOG=y
+CONFIG_LOG_MODE_MINIMAL=y
+
# Disable default features we don't want in a minimal example.
CONFIG_PLATFORM_EC_BACKLIGHT_LID=y
CONFIG_PLATFORM_EC_SWITCH=y
@@ -47,15 +51,30 @@ CONFIG_AP_PWRSEQ=y
CONFIG_X86_NON_DSX_PWRSEQ_CONSOLE=y
CONFIG_AP_PWRSEQ_S0IX=y
+# ADC
+CONFIG_ADC=y
+
# I2C
+CONFIG_I2C=y
CONFIG_PLATFORM_EC_HOSTCMD_I2C_CONTROL=y
+# PWM
+CONFIG_PWM=y
+
+# Fan
+CONFIG_TACH_NPCX=y
+
# Temperature sensors
CONFIG_SENSOR=y
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_TEMP_SENSOR_POWER=y
# CBI EEPROM support
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
CONFIG_PLATFORM_EC_BYPASS_CBI_EEPROM_WP_CHECK=y
@@ -63,6 +82,7 @@ CONFIG_PLATFORM_EC_BYPASS_CBI_EEPROM_WP_CHECK=y
CONFIG_PLATFORM_EC_LED_DT=y
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
@@ -71,13 +91,15 @@ CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y
# Charger
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
-CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT=512
+CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT=512
CONFIG_PLATFORM_EC_CHARGER_ISL9241=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=5
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=30000
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT=15000
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
+
+# USB-A
+CONFIG_PLATFORM_EC_USBA=y
# USBC
CONFIG_PLATFORM_EC_USBC_PPC=y
@@ -106,6 +128,12 @@ CONFIG_PLATFORM_EC_USB_PD_USB4=y
CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=y
CONFIG_PLATFORM_EC_USB_PID=0x504D
+# IOEX
+CONFIG_GPIO_NCT38XX=y
+
+# BC 1.2
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
+
#USB Mux
CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y
CONFIG_PLATFORM_EC_USB_MUX_TASK=y
@@ -118,6 +146,7 @@ CONFIG_PLATFORM_EC_POWER_BUTTON=y
CONFIG_PLATFORM_EC_LID_SWITCH=y
# Keyboard support
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_8042=y
# Column 2 is driven through the GSC, which inverts the signal going through it
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
diff --git a/zephyr/program/rex/prj_rex.conf b/zephyr/projects/rex/prj_rex.conf
index b724a881b9..0f204b9669 100644
--- a/zephyr/program/rex/prj_rex.conf
+++ b/zephyr/projects/rex/prj_rex.conf
@@ -4,3 +4,6 @@
# Rex reference-board-specific Kconfig settings.
CONFIG_BOARD_REX=y
+
+# Keyboard
+CONFIG_CROS_KB_RAW_NPCX=y
diff --git a/zephyr/program/rex/rex.dts b/zephyr/projects/rex/rex.dts
index a20bfccdfe..0db4b96aa7 100644
--- a/zephyr/program/rex/rex.dts
+++ b/zephyr/projects/rex/rex.dts
@@ -83,7 +83,7 @@
&power_ctrl_psl {
status = "okay";
pinctrl-names = "sleep";
- pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in4_gp02>;
+ pinctrl-0 = <&psl_in1_gpd2 &psl_in2_gp00 &psl_in3_gp01 &psl_in4_gp02>;
};
/* ADC and GPIO alt-function specifications */
@@ -117,14 +117,14 @@
tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
};
- nct3807_C0: nct3807_C0@70 {
+ nct3807_C0:nct3807_C0@70 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "nuvoton,nct38xx-gpio";
reg = <0x70>;
label = "NCT3807_C0";
- ioex_c0_port0: gpio@0 {
+ ioex_c0_port0:gpio@0 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x0>;
label = "NCT3807_C0_GPIO0";
@@ -134,7 +134,7 @@
pin_mask = <0xff>;
pinmux_mask = <0xf7>;
};
- ioex_c0_port1: gpio@1 {
+ ioex_c0_port1:gpio@1 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x1>;
label = "NCT3807_C0_GPIO1";
@@ -192,7 +192,7 @@
};
&i2c4_1 {
- label = "I2C_USB_C1_TCPC";
+ label = "I2_USB_C1_TCPC";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c4_1_sda_scl_gpf2_f3>;
@@ -210,7 +210,7 @@
};
&i2c5_0 {
- label = "I2C_BATTERY";
+ label = "I2C__BATTERY";
clock-frequency = <I2C_BITRATE_STANDARD>;
pinctrl-0 = <&i2c5_0_sda_scl_gp33_36>;
diff --git a/zephyr/program/rex/rex0_gpio.csv b/zephyr/projects/rex/rex0_gpio.csv
index 5c20f6fb00..5c20f6fb00 100644
--- a/zephyr/program/rex/rex0_gpio.csv
+++ b/zephyr/projects/rex/rex0_gpio.csv
diff --git a/zephyr/program/rex/src/board_power.c b/zephyr/projects/rex/src/board_power.c
index 655edaa452..c7f12d024e 100644
--- a/zephyr/program/rex/src/board_power.c
+++ b/zephyr/projects/rex/src/board_power.c
@@ -3,11 +3,8 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio.h"
-#include "gpio_signal.h"
-
-#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>
+#include <zephyr/drivers/gpio.h>
#include <ap_power/ap_power.h>
#include <ap_power/ap_power_events.h>
@@ -16,6 +13,9 @@
#include <power_signals.h>
#include <x86_power_signals.h>
+#include "gpio_signal.h"
+#include "gpio/gpio.h"
+
LOG_MODULE_DECLARE(ap_pwrseq, LOG_LEVEL_INF);
#if CONFIG_X86_NON_DSX_PWRSEQ_MTL
diff --git a/zephyr/program/rex/src/usb_pd_policy.c b/zephyr/projects/rex/src/usb_pd_policy.c
index 7c78c4ebae..7e9876f9c1 100644
--- a/zephyr/program/rex/src/usb_pd_policy.c
+++ b/zephyr/projects/rex/src/usb_pd_policy.c
@@ -5,6 +5,8 @@
/* Shared USB-C policy for Rex boards */
+#include <zephyr/drivers/gpio.h>
+
#include "charge_manager.h"
#include "chipset.h"
#include "common.h"
@@ -18,8 +20,6 @@
#include "usbc_ppc.h"
#include "util.h"
-#include <zephyr/drivers/gpio.h>
-
int pd_check_vconn_swap(int port)
{
/* Allow VCONN swaps if the AP is on. */
diff --git a/zephyr/program/rex/src/usbc_config.c b/zephyr/projects/rex/src/usbc_config.c
index df260f6730..66f3a1f45d 100644
--- a/zephyr/program/rex/src/usbc_config.c
+++ b/zephyr/projects/rex/src/usbc_config.c
@@ -3,14 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "battery_fuel_gauge.h"
+#include "charger.h"
#include "charge_manager.h"
#include "charge_ramp.h"
-#include "charge_state.h"
#include "charge_state_v2.h"
+#include "charge_state.h"
#include "charger.h"
#include "driver/charger/isl9241.h"
-#include "driver/ppc/nx20p348x.h"
#include "driver/retimer/bb_retimer_public.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/tcpm/ps8xxx_public.h"
@@ -19,14 +21,13 @@
#include "hooks.h"
#include "i2c.h"
#include "ioexpander.h"
+#include "driver/ppc/nx20p348x.h"
#include "ppc/syv682x_public.h"
#include "system.h"
#include "task.h"
#include "usb_mux.h"
#include "usbc_ppc.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
@@ -192,6 +193,13 @@ void bc12_interrupt(enum gpio_signal signal)
}
}
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
static void board_disable_charger_ports(void)
{
int i;
diff --git a/zephyr/program/rex/temp_sensors.dts b/zephyr/projects/rex/temp_sensors.dts
index 680ebc8954..680ebc8954 100644
--- a/zephyr/program/rex/temp_sensors.dts
+++ b/zephyr/projects/rex/temp_sensors.dts
diff --git a/zephyr/program/rex/usbc.dts b/zephyr/projects/rex/usbc.dts
index 84ae79fae6..84ae79fae6 100644
--- a/zephyr/program/rex/usbc.dts
+++ b/zephyr/projects/rex/usbc.dts
diff --git a/zephyr/projects/skyrim/BUILD.py b/zephyr/projects/skyrim/BUILD.py
new file mode 100644
index 0000000000..3807150af9
--- /dev/null
+++ b/zephyr/projects/skyrim/BUILD.py
@@ -0,0 +1,86 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Define zmake projects for skyrim."""
+
+
+def register_skyrim_project(
+ project_name,
+ extra_dts_overlays=(),
+ extra_kconfig_files=(),
+):
+ """Register a variant of skyrim."""
+ register_npcx_project(
+ project_name=project_name,
+ zephyr_board="npcx9m3f",
+ dts_overlays=[
+ # Common to all projects.
+ here / "adc.dts",
+ here / "fan.dts",
+ here / "gpio.dts",
+ here / "interrupts.dts",
+ here / "keyboard.dts",
+ here / "motionsense.dts",
+ here / "usbc.dts",
+ # Project-specific DTS customizations.
+ *extra_dts_overlays,
+ ],
+ kconfig_files=[here / "prj.conf", *extra_kconfig_files],
+ )
+
+
+register_skyrim_project(
+ project_name="morthal",
+ extra_dts_overlays=[
+ here / "morthal.dts",
+ here / "battery_morthal.dts",
+ here / "led_pins_morthal.dts",
+ here / "led_policy_morthal.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_morthal.conf",
+ ],
+)
+
+
+register_skyrim_project(
+ project_name="skyrim",
+ extra_dts_overlays=[
+ here / "skyrim.dts",
+ here / "battery_skyrim.dts",
+ here / "led_pins_skyrim.dts",
+ here / "led_policy_skyrim.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_skyrim.conf",
+ ],
+)
+
+
+register_skyrim_project(
+ project_name="winterhold",
+ extra_dts_overlays=[
+ here / "winterhold.dts",
+ here / "battery_winterhold.dts",
+ here / "led_pins_winterhold.dts",
+ here / "led_policy_winterhold.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_winterhold.conf",
+ ],
+)
+
+
+register_skyrim_project(
+ project_name="frostflow",
+ extra_dts_overlays=[
+ here / "frostflow.dts",
+ here / "battery_frostflow.dts",
+ here / "led_pins_frostflow.dts",
+ here / "led_policy_frostflow.dts",
+ ],
+ extra_kconfig_files=[
+ here / "prj_frostflow.conf",
+ ],
+)
diff --git a/zephyr/projects/skyrim/CMakeLists.txt b/zephyr/projects/skyrim/CMakeLists.txt
new file mode 100644
index 0000000000..71b8427aa1
--- /dev/null
+++ b/zephyr/projects/skyrim/CMakeLists.txt
@@ -0,0 +1,62 @@
+# Copyright 2021 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+cmake_minimum_required(VERSION 3.13.1)
+
+find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
+
+zephyr_library_sources("src/common.c")
+zephyr_library_sources("src/power_signals.c")
+
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC
+ "src/usb_pd_policy.c"
+ "src/usbc_config.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
+ "src/led.c")
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT
+ "src/stt.c")
+
+if(DEFINED CONFIG_BOARD_MORTHAL)
+ project(morthal)
+ zephyr_library_sources(
+ "src/morthal/ppc_config.c"
+ "src/morthal/usb_mux_config.c"
+)
+endif()
+
+if(DEFINED CONFIG_BOARD_SKYRIM)
+ project(skyrim)
+ cros_ec_library_include_directories_ifdef(CONFIG_BOARD_SKYRIM include)
+ zephyr_library_sources(
+ "src/skyrim/usb_mux_config.c"
+ "src/skyrim/ppc_config.c"
+ "src/skyrim/form_factor.c"
+ "src/skyrim/alt_charger.c"
+ "src/skyrim/keyboard.c"
+ )
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "src/skyrim/fan.c")
+endif()
+
+if(DEFINED CONFIG_BOARD_WINTERHOLD)
+ project(winterhold)
+ zephyr_library_sources(
+ "src/winterhold/usb_mux_config.c"
+ "src/winterhold/ppc_config.c"
+ "src/winterhold/kb_backlight.c"
+ "src/winterhold/keyboard.c"
+ )
+endif()
+
+if(DEFINED CONFIG_BOARD_FROSTFLOW)
+ project(frostflow)
+ cros_ec_library_include_directories_ifdef(CONFIG_BOARD_FROSTFLOW include)
+ zephyr_include_directories("include/frostflow")
+ zephyr_library_sources(
+ "src/frostflow/usb_mux_config.c"
+ "src/frostflow/ppc_config.c"
+ )
+ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD_CUSTOMIZATION
+ "src/frostflow/keyboard.c"
+ "src/frostflow/keyboard_customization.c")
+endif()
diff --git a/zephyr/program/skyrim/Kconfig b/zephyr/projects/skyrim/Kconfig
index a80ba2bd24..fbb797f6fc 100644
--- a/zephyr/program/skyrim/Kconfig
+++ b/zephyr/projects/skyrim/Kconfig
@@ -26,11 +26,11 @@ config BOARD_FROSTFLOW
Build Google Frostflow reference board. This board uses an AMD SoC
and NPCX9 EC
-config BOARD_CRYSTALDRIFT
- bool "Google Crystaldrift Board"
+config BOARD_INPUT_CURRENT_SCALE_FACTOR
+ int "Input current scale factor"
+ default 100
help
- Build Google Crystaldrift reference board. This board uses an AMD SoC
- and NPCX9 EC
+ Limit input current to fraction of negotiated limit.
config BOARD_USB_HUB_RESET
bool "Support USB hub reset or not"
diff --git a/zephyr/program/skyrim/adc.dtsi b/zephyr/projects/skyrim/adc.dts
index 952e5db1d0..0f2ffd6436 100644
--- a/zephyr/program/skyrim/adc.dtsi
+++ b/zephyr/projects/skyrim/adc.dts
@@ -41,14 +41,14 @@
named-temp-sensors {
compatible = "cros-ec,temp-sensors";
- temp_sensor_charger: charger-thermistor {
+ charger-thermistor {
temp_host_high = <100>;
temp_host_halt = <105>;
temp_host_release_high = <80>;
sensor = <&temp_charger_thermistor>;
};
- temp_sensor_memory: memory-thermistor {
+ memory-thermistor {
temp_host_high = <100>;
temp_host_halt = <105>;
temp_host_release_high = <80>;
@@ -56,7 +56,7 @@
sensor = <&temp_memory_thermistor>;
};
- temp_sensor_cpu: cpu {
+ cpu {
temp_host_high = <100>;
temp_host_halt = <105>;
temp_host_release_high = <80>;
diff --git a/zephyr/program/skyrim/frostflow/battery.dtsi b/zephyr/projects/skyrim/battery_frostflow.dts
index 2d6b28de70..2d6b28de70 100644
--- a/zephyr/program/skyrim/frostflow/battery.dtsi
+++ b/zephyr/projects/skyrim/battery_frostflow.dts
diff --git a/zephyr/program/skyrim/morthal/battery.dtsi b/zephyr/projects/skyrim/battery_morthal.dts
index 8c87cef7f9..8c87cef7f9 100644
--- a/zephyr/program/skyrim/morthal/battery.dtsi
+++ b/zephyr/projects/skyrim/battery_morthal.dts
diff --git a/zephyr/program/skyrim/skyrim/battery.dtsi b/zephyr/projects/skyrim/battery_skyrim.dts
index 8c87cef7f9..8c87cef7f9 100644
--- a/zephyr/program/skyrim/skyrim/battery.dtsi
+++ b/zephyr/projects/skyrim/battery_skyrim.dts
diff --git a/zephyr/program/skyrim/winterhold/battery.dtsi b/zephyr/projects/skyrim/battery_winterhold.dts
index 8e82e0d1f2..d923243d45 100644
--- a/zephyr/program/skyrim/winterhold/battery.dtsi
+++ b/zephyr/projects/skyrim/battery_winterhold.dts
@@ -11,22 +11,22 @@
smp_atlxdy9k {
compatible = "smp,atlxdy9k", "battery-smart";
};
- smp_cosxdy9k {
+ smp_cosxdy9k{
compatible = "smp,cosxdy9k", "battery-smart";
};
- byd_wv3k8 {
+ byd_wv3k8{
compatible = "byd,wv3k8", "battery-smart";
};
- cosmx_mvk11 {
+ cosmx_mvk11{
compatible = "cosmx,mvk11", "battery-smart";
};
- sunwoda_atlvkyjx {
+ sunwoda_atlvkyjx{
compatible = "sunwoda,atlvkyjx", "battery-smart";
};
- sunwoda_cosvkyjx {
+ sunwoda_cosvkyjx{
compatible = "sunwoda,cosvkyjx", "battery-smart";
};
- atl_cfd72 {
+ atl_cfd72{
compatible = "atl,cfd72", "battery-smart";
};
};
diff --git a/zephyr/program/skyrim/fan.dtsi b/zephyr/projects/skyrim/fan.dts
index dff26bcb29..f0bc28cb7e 100644
--- a/zephyr/program/skyrim/fan.dtsi
+++ b/zephyr/projects/skyrim/fan.dts
@@ -7,7 +7,7 @@
fans {
compatible = "cros-ec,fans";
- fan0: fan_0 {
+ fan_0 {
pwms = <&pwm0 0 PWM_KHZ(25) PWM_POLARITY_NORMAL>;
rpm_min = <3100>;
rpm_start = <3100>;
diff --git a/zephyr/projects/skyrim/frostflow.dts b/zephyr/projects/skyrim/frostflow.dts
new file mode 100644
index 0000000000..1ed0b4cb2b
--- /dev/null
+++ b/zephyr/projects/skyrim/frostflow.dts
@@ -0,0 +1,136 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <dt-bindings/usbc_mux.h>
+
+#include "i2c_common.dtsi"
+
+/ {
+ named-gpios {
+ /* Frostflow-specific GPIO customizations */
+ };
+
+ named-temp-sensors {
+ compatible = "cros-ec,temp-sensors";
+ soc-pct2075 {
+ temp_host_high = <100>;
+ temp_host_halt = <105>;
+ temp_host_release_high = <80>;
+ temp_host_release_halt = <80>;
+ temp_fan_off = <35>;
+ temp_fan_max = <70>;
+ power-good-pin = <&gpio_pg_pwr_s5>;
+ sensor = <&soc_pct2075>;
+ };
+ amb-pct2075 {
+ power-good-pin = <&gpio_pg_pwr_s5>;
+ sensor = <&amb_pct2075>;
+ };
+ };
+
+ /* Rotation matrices for motion sensors. */
+ motionsense-rotation-ref {
+ compatible = "cros-ec,motionsense-rotation-ref";
+ lid_rot_ref: lid-rotation-ref {
+ mat33 = <1 0 0
+ 0 1 0
+ 0 0 1>;
+ };
+
+ base_rot_ref: base-rotation-ref {
+ mat33 = <0 1 0
+ 1 0 0
+ 0 0 (-1)>;
+ };
+ };
+
+ ppc_port0: aoz1380 {
+ compatible = "aoz,aoz1380";
+ status = "okay";
+ };
+};
+
+&i2c0_0 {
+ anx7483_port0: anx7483@3e {
+ compatible = "analogix,anx7483";
+ reg = <0x3e>;
+ board-set = "board_anx7483_c0_mux_set";
+ };
+};
+
+&i2c1_0 {
+ anx7483_port1: anx7483@3e {
+ compatible = "analogix,anx7483";
+ reg = <0x3e>;
+ board-set = "board_anx7483_c1_mux_set";
+ };
+ ppc_port1: nx20p348x@71 {
+ compatible = "nxp,nx20p348x";
+ status = "okay";
+ reg = <0x71>;
+ };
+ ps8818_port1: ps8818@28 {
+ compatible = "parade,ps8818";
+ reg = <0x28>;
+ flags = <(USB_MUX_FLAG_RESETS_IN_G3)>;
+ board-set = "board_c1_ps8818_mux_set";
+ };
+};
+
+&i2c4_1 {
+ charger: isl9241@9 {
+ compatible = "intersil,isl9241";
+ status = "okay";
+ reg = <0x9>;
+ };
+};
+
+&usbc_port0 {
+ ppc = <&ppc_port0>;
+ usb-mux-chain-0 {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&amd_fp6_port0 &anx7483_port0>;
+ };
+};
+
+&usbc_port1 {
+ ppc = <&ppc_port1>;
+ usb-mux-chain-1-anx {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&amd_fp6_port1 &anx7483_port1>;
+ };
+ usb_mux_chain_ps8818_port1: usb-mux-chain-1-ps {
+ compatible = "cros-ec,usb-mux-chain";
+ usb-muxes = <&amd_fp6_port1 &ps8818_port1>;
+ alternative-chain;
+ };
+};
+
+&cros_kb_raw {
+ pinctrl-0 = <
+ &ksi0_gp31
+ &ksi1_gp30
+ &ksi2_gp27
+ &ksi3_gp26
+ &ksi4_gp25
+ &ksi5_gp24
+ &ksi6_gp23
+ &ksi7_gp22
+ &kso00_gp21
+ &kso01_gp20
+ &kso03_gp16
+ &kso04_gp15
+ &kso05_gp14
+ &kso06_gp13
+ &kso07_gp12
+ &kso08_gp11
+ &kso09_gp10
+ &kso10_gp07
+ &kso11_gp06
+ &kso12_gp05
+ &kso13_gp04
+ &kso14_gp82
+ >;
+};
diff --git a/zephyr/program/skyrim/gpio.dtsi b/zephyr/projects/skyrim/gpio.dts
index 2b79bad222..57abcc846d 100644
--- a/zephyr/program/skyrim/gpio.dtsi
+++ b/zephyr/projects/skyrim/gpio.dts
@@ -118,7 +118,7 @@
gpios = <&gpio0 2 GPIO_INPUT>;
enum-name = "GPIO_LID_OPEN";
};
- gpio_ec_batt_pres_odl: ec_batt_pres_odl {
+ ec_batt_pres_odl {
gpios = <&gpio9 4 GPIO_INPUT>;
enum-name = "GPIO_BATT_PRES_ODL";
};
diff --git a/zephyr/program/skyrim/i2c.dtsi b/zephyr/projects/skyrim/i2c_common.dtsi
index 460a6bcfd2..aaf54a161b 100644
--- a/zephyr/program/skyrim/i2c.dtsi
+++ b/zephyr/projects/skyrim/i2c_common.dtsi
@@ -85,14 +85,14 @@
tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
};
- nct3807_C0: nct3807_C0@70 {
+ nct3807_C0:nct3807_C0@70 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "nuvoton,nct38xx-gpio";
reg = <0x70>;
label = "NCT3807_C0";
- ioex_c0_port0: gpio@0 {
+ ioex_c0_port0:gpio@0 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x0>;
label = "NCT3807_C0_GPIO0";
@@ -102,7 +102,7 @@
pin_mask = <0xff>;
pinmux_mask = <0xf7>;
};
- ioex_c0_port1: gpio@1 {
+ ioex_c0_port1:gpio@1 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x1>;
label = "NCT3807_C0_GPIO1";
@@ -146,14 +146,14 @@
tcpc-flags = <(TCPC_FLAGS_TCPCI_REV2_0)>;
};
- nct3807_C1: nct3807_C1@70 {
+ nct3807_C1:nct3807_C1@70 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "nuvoton,nct38xx-gpio";
reg = <0x70>;
label = "NCT3807_C1";
- ioex_c1_port0: gpio@0 {
+ ioex_c1_port0:gpio@0 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x0>;
label = "NCT3807_C1_GPIO0";
@@ -163,7 +163,7 @@
pin_mask = <0xff>;
pinmux_mask = <0xf7>;
};
- ioex_c1_port1: gpio@1 {
+ ioex_c1_port1:gpio@1 {
compatible = "nuvoton,nct38xx-gpio-port";
reg = <0x1>;
label = "NCT3807_C1_GPIO1";
diff --git a/zephyr/program/skyrim/frostflow/include/keyboard_customization.h b/zephyr/projects/skyrim/include/frostflow/keyboard_customization.h
index 2d2a997f91..2d2a997f91 100644
--- a/zephyr/program/skyrim/frostflow/include/keyboard_customization.h
+++ b/zephyr/projects/skyrim/include/frostflow/keyboard_customization.h
diff --git a/zephyr/program/skyrim/interrupts.dtsi b/zephyr/projects/skyrim/interrupts.dts
index de4e87986a..de4e87986a 100644
--- a/zephyr/program/skyrim/interrupts.dtsi
+++ b/zephyr/projects/skyrim/interrupts.dts
diff --git a/zephyr/program/skyrim/keyboard.dtsi b/zephyr/projects/skyrim/keyboard.dts
index aaf305c725..df334ba54c 100644
--- a/zephyr/program/skyrim/keyboard.dtsi
+++ b/zephyr/projects/skyrim/keyboard.dts
@@ -41,8 +41,6 @@
&kso10_gp07
&kso11_gp06
&kso12_gp05
- &kso13_gp04
- &kso14_gp82
>;
pinctrl-names = "default";
};
diff --git a/zephyr/program/skyrim/crystaldrift/led_pins.dtsi b/zephyr/projects/skyrim/led_pins_frostflow.dts
index f778a24a51..d294490208 100644
--- a/zephyr/program/skyrim/crystaldrift/led_pins.dtsi
+++ b/zephyr/projects/skyrim/led_pins_frostflow.dts
@@ -4,14 +4,16 @@
*/
/ {
- pwmleds {
- compatible = "pwm-leds";
+ pwm_pins {
+ compatible = "cros-ec,pwm-pin-config";
pwm_y: pwm_y {
+ #led-pin-cells = <1>;
pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
pwm_w: pwm_w {
+ #led-pin-cells = <1>;
pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
};
@@ -22,24 +24,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 0>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <100 0>;
+ led-pins = <&pwm_y 100>,
+ <&pwm_w 0>;
};
color_white: color-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 100>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 100>;
};
};
};
diff --git a/zephyr/program/skyrim/skyrim/led_pins.dtsi b/zephyr/projects/skyrim/led_pins_morthal.dts
index 78b9a59c40..d294490208 100644
--- a/zephyr/program/skyrim/skyrim/led_pins.dtsi
+++ b/zephyr/projects/skyrim/led_pins_morthal.dts
@@ -4,12 +4,16 @@
*/
/ {
- pwmleds {
- compatible = "pwm-leds";
+ pwm_pins {
+ compatible = "cros-ec,pwm-pin-config";
+
pwm_y: pwm_y {
+ #led-pin-cells = <1>;
pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
+
pwm_w: pwm_w {
+ #led-pin-cells = <1>;
pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
};
@@ -20,24 +24,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 0>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <100 0>;
+ led-pins = <&pwm_y 100>,
+ <&pwm_w 0>;
};
color_white: color-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 100>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 100>;
};
};
};
diff --git a/zephyr/program/skyrim/frostflow/led_pins.dtsi b/zephyr/projects/skyrim/led_pins_skyrim.dts
index 78b9a59c40..d294490208 100644
--- a/zephyr/program/skyrim/frostflow/led_pins.dtsi
+++ b/zephyr/projects/skyrim/led_pins_skyrim.dts
@@ -4,12 +4,16 @@
*/
/ {
- pwmleds {
- compatible = "pwm-leds";
+ pwm_pins {
+ compatible = "cros-ec,pwm-pin-config";
+
pwm_y: pwm_y {
+ #led-pin-cells = <1>;
pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
+
pwm_w: pwm_w {
+ #led-pin-cells = <1>;
pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
};
@@ -20,24 +24,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 0>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <100 0>;
+ led-pins = <&pwm_y 100>,
+ <&pwm_w 0>;
};
color_white: color-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 100>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 100>;
};
};
};
diff --git a/zephyr/program/skyrim/morthal/led_pins.dtsi b/zephyr/projects/skyrim/led_pins_winterhold.dts
index 78b9a59c40..d294490208 100644
--- a/zephyr/program/skyrim/morthal/led_pins.dtsi
+++ b/zephyr/projects/skyrim/led_pins_winterhold.dts
@@ -4,12 +4,16 @@
*/
/ {
- pwmleds {
- compatible = "pwm-leds";
+ pwm_pins {
+ compatible = "cros-ec,pwm-pin-config";
+
pwm_y: pwm_y {
+ #led-pin-cells = <1>;
pwms = <&pwm2 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
+
pwm_w: pwm_w {
+ #led-pin-cells = <1>;
pwms = <&pwm3 0 PWM_HZ(100) PWM_POLARITY_INVERTED>;
};
};
@@ -20,24 +24,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 0>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <100 0>;
+ led-pins = <&pwm_y 100>,
+ <&pwm_w 0>;
};
color_white: color-white {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwm_y &pwm_w>;
- led-values = <0 100>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_w 100>;
};
};
};
diff --git a/zephyr/program/skyrim/frostflow/led_policy.dtsi b/zephyr/projects/skyrim/led_policy_frostflow.dts
index e5875640fb..e5875640fb 100644
--- a/zephyr/program/skyrim/frostflow/led_policy.dtsi
+++ b/zephyr/projects/skyrim/led_policy_frostflow.dts
diff --git a/zephyr/program/skyrim/crystaldrift/led_policy.dtsi b/zephyr/projects/skyrim/led_policy_morthal.dts
index a075c6b0d2..a075c6b0d2 100644
--- a/zephyr/program/skyrim/crystaldrift/led_policy.dtsi
+++ b/zephyr/projects/skyrim/led_policy_morthal.dts
diff --git a/zephyr/program/skyrim/morthal/led_policy.dtsi b/zephyr/projects/skyrim/led_policy_skyrim.dts
index a075c6b0d2..a075c6b0d2 100644
--- a/zephyr/program/skyrim/morthal/led_policy.dtsi
+++ b/zephyr/projects/skyrim/led_policy_skyrim.dts
diff --git a/zephyr/program/skyrim/winterhold/led_policy.dtsi b/zephyr/projects/skyrim/led_policy_winterhold.dts
index f1f8aa31ed..f1f8aa31ed 100644
--- a/zephyr/program/skyrim/winterhold/led_policy.dtsi
+++ b/zephyr/projects/skyrim/led_policy_winterhold.dts
diff --git a/zephyr/program/skyrim/morthal/morthal.dtsi b/zephyr/projects/skyrim/morthal.dts
index 99a062220d..508ce23bce 100644
--- a/zephyr/program/skyrim/morthal/morthal.dtsi
+++ b/zephyr/projects/skyrim/morthal.dts
@@ -5,7 +5,7 @@
#include <dt-bindings/usbc_mux.h>
-#include "../i2c.dtsi"
+#include "i2c_common.dtsi"
/ {
named-gpios {
@@ -131,7 +131,6 @@
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "board_anx7483_c0_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
};
@@ -140,7 +139,6 @@
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "board_anx7483_c1_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
ppc_port1: nx20p348x@71 {
compatible = "nxp,nx20p348x";
diff --git a/zephyr/program/skyrim/crystaldrift/motionsense.dtsi b/zephyr/projects/skyrim/motionsense.dts
index f943bea4c8..f943bea4c8 100644
--- a/zephyr/program/skyrim/crystaldrift/motionsense.dtsi
+++ b/zephyr/projects/skyrim/motionsense.dts
diff --git a/zephyr/program/skyrim/program.conf b/zephyr/projects/skyrim/prj.conf
index e879e1153b..a0085258e4 100644
--- a/zephyr/program/skyrim/program.conf
+++ b/zephyr/projects/skyrim/prj.conf
@@ -27,13 +27,25 @@ CONFIG_PLATFORM_EC_PORT80=y
# Power button
CONFIG_PLATFORM_EC_POWER_BUTTON=y
+# ADC
+CONFIG_ADC=y
+
+# I2C
+CONFIG_I2C=y
+
# CBI
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
+CONFIG_EEPROM_SHELL=n
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
# Temperature Sensors
CONFIG_PLATFORM_EC_AMD_SB_RMI=y
CONFIG_PLATFORM_EC_AMD_STT=y
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+CONFIG_PLATFORM_EC_TEMP_SENSOR_SB_TSI=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_THROTTLE_AP=y
# External power
@@ -46,6 +58,9 @@ CONFIG_PLATFORM_EC_BACKLIGHT_LID_ACTIVE_LOW=y
CONFIG_SENSOR=y
CONFIG_SENSOR_SHELL=n
+# Fan
+CONFIG_TACH_NPCX=y
+
# Lid switch
CONFIG_PLATFORM_EC_LID_ANGLE=y
CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
@@ -53,30 +68,39 @@ CONFIG_PLATFORM_EC_LID_SWITCH=y
# Keyboard
CONFIG_PLATFORM_EC_KBLIGHT_ENABLE_PIN=y
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI3=y
CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3=y
-# Syscon
+# PWM
+CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
+
CONFIG_SYSCON=y
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
+CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
CONFIG_PLATFORM_EC_BATTERY_REVIVE_DISCONNECT=y
# Charger
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
-CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT=512
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
+CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT=512
CONFIG_PLATFORM_EC_CHARGER_ISL9241=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=50000
+# USB-A
+CONFIG_PLATFORM_EC_USBA=y
+
# USB-C
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USBC_PPC_NX20P3483=y
CONFIG_PLATFORM_EC_USBC_PPC_AOZ1380=y
CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7451=y
@@ -104,6 +128,9 @@ CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=y
# Give ourselves enough task space to use i2ctrace
CONFIG_TASK_PD_STACK_SIZE=1280
+# IOEX
+CONFIG_GPIO_NCT38XX=y
+
# Motion sense
CONFIG_PLATFORM_EC_MOTIONSENSE=y
CONFIG_PLATFORM_EC_ACCEL_FIFO=y
diff --git a/zephyr/program/skyrim/frostflow/project.conf b/zephyr/projects/skyrim/prj_frostflow.conf
index 02da02d35d..29931de4d4 100644
--- a/zephyr/program/skyrim/frostflow/project.conf
+++ b/zephyr/projects/skyrim/prj_frostflow.conf
@@ -4,11 +4,11 @@
# Frostflow reference-board-specific Kconfig settings.
CONFIG_BOARD_FROSTFLOW=y
-CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=10
+CONFIG_BOARD_INPUT_CURRENT_SCALE_FACTOR=90
# TODO(b/215404321): Remove later in board development
CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
-CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=n
+CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
# LED
CONFIG_PLATFORM_EC_LED_DT=y
@@ -18,16 +18,13 @@ CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=45000
CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=3000
CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=20000
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=15000
+# Only Frostflow has the PCT2075
+CONFIG_PLATFORM_EC_TEMP_SENSOR_PCT2075=y
+
+CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
# Keyboard
CONFIG_PLATFORM_EC_KEYBOARD_CUSTOMIZATION=y
# Frostflow not have the USB HUB
CONFIG_BOARD_USB_HUB_RESET=n
-
-# Battery
-CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
-
-# Fan
-CONFIG_PLATFORM_EC_FAN=y
-CONFIG_PLATFORM_EC_CUSTOM_FAN_CONTROL=y
diff --git a/zephyr/program/skyrim/morthal/project.conf b/zephyr/projects/skyrim/prj_morthal.conf
index 8a22f58ab8..3d2b3fddb7 100644
--- a/zephyr/program/skyrim/morthal/project.conf
+++ b/zephyr/projects/skyrim/prj_morthal.conf
@@ -17,7 +17,7 @@ CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=100000
CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=5000
CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=20000
-CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
+# Only Morthal has the PCT2075
+CONFIG_PLATFORM_EC_TEMP_SENSOR_PCT2075=y
-# Battery
-CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
+CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
diff --git a/zephyr/program/skyrim/skyrim/project.conf b/zephyr/projects/skyrim/prj_skyrim.conf
index 67b3f0f142..2752854c8b 100644
--- a/zephyr/program/skyrim/skyrim/project.conf
+++ b/zephyr/projects/skyrim/prj_skyrim.conf
@@ -16,11 +16,11 @@ CONFIG_PLATFORM_EC_PD_MAX_POWER_MW=100000
CONFIG_PLATFORM_EC_PD_MAX_CURRENT_MA=5000
CONFIG_PLATFORM_EC_PD_MAX_VOLTAGE_MV=20000
+# Only Skyrim has the PCT2075
+CONFIG_PLATFORM_EC_TEMP_SENSOR_PCT2075=y
+
CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
# Enable alternative charger chip
CONFIG_PLATFORM_EC_CHARGER_RUNTIME_CONFIG=y
CONFIG_PLATFORM_EC_CHARGER_ISL9238C=y
-
-# Battery
-CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
diff --git a/zephyr/projects/skyrim/prj_winterhold.conf b/zephyr/projects/skyrim/prj_winterhold.conf
new file mode 100644
index 0000000000..2ccd195a72
--- /dev/null
+++ b/zephyr/projects/skyrim/prj_winterhold.conf
@@ -0,0 +1,26 @@
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Winterhold reference-board-specific Kconfig settings.
+CONFIG_BOARD_WINTERHOLD=y
+
+# TODO(b/215404321): Remove later in board development
+CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
+CONFIG_PLATFORM_EC_SYSTEM_UNLOCKED=y
+
+# LED
+CONFIG_PLATFORM_EC_LED_DT=y
+
+# Only Winterhold has the PCT2075
+CONFIG_PLATFORM_EC_TEMP_SENSOR_PCT2075=y
+
+CONFIG_PLATFORM_EC_USBC_RETIMER_ANX7483=y
+
+# Enable charger chip
+CONFIG_PLATFORM_EC_CHARGER_ISL9238=y
+CONFIG_PLATFORM_EC_CHARGER_ISL9241=n
+
+# Get the vbus voltage from TCPC
+CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER=n
+CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_TCPC=y \ No newline at end of file
diff --git a/zephyr/program/skyrim/skyrim/skyrim.dtsi b/zephyr/projects/skyrim/skyrim.dts
index 1037df1c8c..6a812a55f3 100644
--- a/zephyr/program/skyrim/skyrim/skyrim.dtsi
+++ b/zephyr/projects/skyrim/skyrim.dts
@@ -5,7 +5,7 @@
#include <dt-bindings/usbc_mux.h>
-#include "../i2c.dtsi"
+#include "i2c_common.dtsi"
/ {
named-gpios {
@@ -149,7 +149,6 @@
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "board_anx7483_c0_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
};
@@ -158,7 +157,6 @@
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "board_anx7483_c1_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
ppc_port1: nx20p348x@71 {
compatible = "nxp,nx20p348x";
diff --git a/zephyr/program/skyrim/src/common.c b/zephyr/projects/skyrim/src/common.c
index af82139c1b..af82139c1b 100644
--- a/zephyr/program/skyrim/src/common.c
+++ b/zephyr/projects/skyrim/src/common.c
diff --git a/zephyr/program/skyrim/frostflow/src/keyboard.c b/zephyr/projects/skyrim/src/frostflow/keyboard.c
index 2905f17941..2905f17941 100644
--- a/zephyr/program/skyrim/frostflow/src/keyboard.c
+++ b/zephyr/projects/skyrim/src/frostflow/keyboard.c
diff --git a/zephyr/program/skyrim/frostflow/src/keyboard_customization.c b/zephyr/projects/skyrim/src/frostflow/keyboard_customization.c
index bd02940e03..d176323d80 100644
--- a/zephyr/program/skyrim/frostflow/src/keyboard_customization.c
+++ b/zephyr/projects/skyrim/src/frostflow/keyboard_customization.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "common.h"
#include "gpio.h"
#include "keyboard_customization.h"
#include "keyboard_protocol.h"
#include "keyboard_raw.h"
-#include <zephyr/drivers/gpio.h>
-
static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
{ 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000 },
{ 0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016 },
diff --git a/zephyr/program/skyrim/frostflow/src/ppc_config.c b/zephyr/projects/skyrim/src/frostflow/ppc_config.c
index 513c025dec..6072a788eb 100644
--- a/zephyr/program/skyrim/frostflow/src/ppc_config.c
+++ b/zephyr/projects/skyrim/src/frostflow/ppc_config.c
@@ -5,12 +5,12 @@
/* Frostflow board-specific PPC code */
-#include "driver/ppc/aoz1380_public.h"
+#include <zephyr/drivers/gpio.h>
+
#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/aoz1380_public.h"
#include "usbc_ppc.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c b/zephyr/projects/skyrim/src/frostflow/usb_mux_config.c
index 0e08431360..e641e0d649 100644
--- a/zephyr/program/skyrim/crystaldrift/src/usb_mux_config.c
+++ b/zephyr/projects/skyrim/src/frostflow/usb_mux_config.c
@@ -3,7 +3,9 @@
* found in the LICENSE file.
*/
-/* Crystaldrift board-specific USB-C mux configuration */
+/* Frostflow board-specific USB-C mux configuration */
+
+#include <zephyr/drivers/gpio.h>
#include "console.h"
#include "cros_board_info.h"
@@ -14,8 +16,6 @@
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
@@ -121,22 +121,3 @@ int board_c1_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state)
return 0;
}
-
-static void setup_mux(void)
-{
- uint32_t val;
-
- if (cros_cbi_get_fw_config(FW_IO_DB, &val) != 0)
- CPRINTSUSB("Error finding FW_DB_IO in CBI FW_CONFIG");
- /* Val will have our dts default on error, so continue setup */
-
- if (val == FW_IO_DB_PS8811_PS8818) {
- CPRINTSUSB("C1: Setting PS8818 mux");
- USB_MUX_ENABLE_ALTERNATIVE(usb_mux_chain_ps8818_port1);
- } else if (val == FW_IO_DB_NONE_ANX7483) {
- CPRINTSUSB("C1: Setting ANX7483 mux");
- } else {
- CPRINTSUSB("Unexpected DB_IO board: %d", val);
- }
-}
-DECLARE_HOOK(HOOK_INIT, setup_mux, HOOK_PRIO_INIT_I2C);
diff --git a/zephyr/program/skyrim/morthal/src/ppc_config.c b/zephyr/projects/skyrim/src/morthal/ppc_config.c
index 8108742fdc..f3ec1d312e 100644
--- a/zephyr/program/skyrim/morthal/src/ppc_config.c
+++ b/zephyr/projects/skyrim/src/morthal/ppc_config.c
@@ -5,12 +5,12 @@
/* Morthal board-specific PPC code */
-#include "driver/ppc/aoz1380_public.h"
+#include <zephyr/drivers/gpio.h>
+
#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/aoz1380_public.h"
#include "usbc_ppc.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/skyrim/morthal/src/usb_mux_config.c b/zephyr/projects/skyrim/src/morthal/usb_mux_config.c
index f4b6502b35..8fe76233e2 100644
--- a/zephyr/program/skyrim/morthal/src/usb_mux_config.c
+++ b/zephyr/projects/skyrim/src/morthal/usb_mux_config.c
@@ -5,6 +5,8 @@
/* Morthal board-specific USB-C mux configuration */
+#include <zephyr/drivers/gpio.h>
+
#include "console.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
@@ -14,8 +16,6 @@
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/skyrim/src/power_signals.c b/zephyr/projects/skyrim/src/power_signals.c
index 04ed3d441d..5d372d35ae 100644
--- a/zephyr/program/skyrim/src/power_signals.c
+++ b/zephyr/projects/skyrim/src/power_signals.c
@@ -7,8 +7,8 @@
#include "charger.h"
#include "chipset.h"
#include "config.h"
-#include "gpio/gpio_int.h"
#include "gpio_signal.h"
+#include "gpio/gpio_int.h"
#include "hooks.h"
#include "i2c.h"
#include "ioexpander.h"
diff --git a/zephyr/program/skyrim/skyrim/src/alt_charger.c b/zephyr/projects/skyrim/src/skyrim/alt_charger.c
index 91e5af8426..4b717901cd 100644
--- a/zephyr/program/skyrim/skyrim/src/alt_charger.c
+++ b/zephyr/projects/skyrim/src/skyrim/alt_charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/logging/log.h>
+
#include "charger_chips.h"
#include "common.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
#include "hooks.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_DECLARE(skyrim, CONFIG_SKYRIM_LOG_LEVEL);
static void alt_charger_init(void)
diff --git a/zephyr/program/skyrim/skyrim/src/fan.c b/zephyr/projects/skyrim/src/skyrim/fan.c
index c584022a92..0a368ee6f0 100644
--- a/zephyr/program/skyrim/skyrim/src/fan.c
+++ b/zephyr/projects/skyrim/src/skyrim/fan.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
#include "fan.h"
#include "gpio/gpio.h"
#include "hooks.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_DECLARE(skyrim, CONFIG_SKYRIM_LOG_LEVEL);
/*
diff --git a/zephyr/program/skyrim/skyrim/src/form_factor.c b/zephyr/projects/skyrim/src/skyrim/form_factor.c
index b13d905364..f137c6db31 100644
--- a/zephyr/program/skyrim/skyrim/src/form_factor.c
+++ b/zephyr/projects/skyrim/src/skyrim/form_factor.c
@@ -3,15 +3,14 @@
* found in the LICENSE file.
*/
-#include "accelgyro.h"
+#include <zephyr/devicetree.h>
+#include <zephyr/logging/log.h>
#include "common.h"
+#include "accelgyro.h"
#include "cros_board_info.h"
#include "hooks.h"
#include "motionsense_sensors.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_DECLARE(skyrim, CONFIG_SKYRIM_LOG_LEVEL);
/*
diff --git a/zephyr/program/skyrim/skyrim/src/keyboard.c b/zephyr/projects/skyrim/src/skyrim/keyboard.c
index e261321e86..e261321e86 100644
--- a/zephyr/program/skyrim/skyrim/src/keyboard.c
+++ b/zephyr/projects/skyrim/src/skyrim/keyboard.c
diff --git a/zephyr/program/skyrim/skyrim/src/ppc_config.c b/zephyr/projects/skyrim/src/skyrim/ppc_config.c
index 047103baee..bebc8adcc7 100644
--- a/zephyr/program/skyrim/skyrim/src/ppc_config.c
+++ b/zephyr/projects/skyrim/src/skyrim/ppc_config.c
@@ -5,12 +5,12 @@
/* Skyrim board-specific PPC code */
-#include "driver/ppc/aoz1380_public.h"
+#include <zephyr/drivers/gpio.h>
+
#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/aoz1380_public.h"
#include "usbc_ppc.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/skyrim/skyrim/src/usb_mux_config.c b/zephyr/projects/skyrim/src/skyrim/usb_mux_config.c
index 8d409dffdd..6c65e56d9e 100644
--- a/zephyr/program/skyrim/skyrim/src/usb_mux_config.c
+++ b/zephyr/projects/skyrim/src/skyrim/usb_mux_config.c
@@ -5,6 +5,8 @@
/* Skyrim board-specific USB-C mux configuration */
+#include <zephyr/drivers/gpio.h>
+
#include "console.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
@@ -14,8 +16,6 @@
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/skyrim/src/stt.c b/zephyr/projects/skyrim/src/stt.c
index 40743fbc68..40743fbc68 100644
--- a/zephyr/program/skyrim/src/stt.c
+++ b/zephyr/projects/skyrim/src/stt.c
diff --git a/zephyr/program/skyrim/src/usb_pd_policy.c b/zephyr/projects/skyrim/src/usb_pd_policy.c
index 745d95bc00..ec9f873863 100644
--- a/zephyr/program/skyrim/src/usb_pd_policy.c
+++ b/zephyr/projects/skyrim/src/usb_pd_policy.c
@@ -5,6 +5,8 @@
/* Shared USB-C policy for Zork boards */
+#include <zephyr/drivers/gpio.h>
+
#include "charge_manager.h"
#include "chipset.h"
#include "common.h"
@@ -18,8 +20,6 @@
#include "usbc_ppc.h"
#include "util.h"
-#include <zephyr/drivers/gpio.h>
-
int pd_check_vconn_swap(int port)
{
/*
diff --git a/zephyr/program/skyrim/src/usbc_config.c b/zephyr/projects/skyrim/src/usbc_config.c
index 47d0ac6a29..dec9f928b5 100644
--- a/zephyr/program/skyrim/src/usbc_config.c
+++ b/zephyr/projects/skyrim/src/usbc_config.c
@@ -5,14 +5,16 @@
/* Skyrim family-specific USB-C configuration */
+#include <zephyr/drivers/gpio.h>
+
+#include "cros_board_info.h"
+#include "cros_cbi.h"
#include "battery_fuel_gauge.h"
#include "charge_manager.h"
#include "charge_ramp.h"
-#include "charge_state.h"
#include "charge_state_v2.h"
+#include "charge_state.h"
#include "charger.h"
-#include "cros_board_info.h"
-#include "cros_cbi.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/charger/isl9241.h"
#include "driver/ppc/nx20p348x.h"
@@ -27,10 +29,8 @@
#include "power.h"
#include "usb_mux.h"
#include "usb_pd_tcpm.h"
-#include "usbc/usb_muxes.h"
#include "usbc_ppc.h"
-
-#include <zephyr/drivers/gpio.h>
+#include "usbc/usb_muxes.h"
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
@@ -190,6 +190,15 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_ma = (charge_ma * CONFIG_BOARD_INPUT_CURRENT_SCALE_FACTOR) / 100;
+
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
void sbu_fault_interrupt(enum gpio_signal signal)
{
int port = signal == IOEX_USB_C1_FAULT_ODL ? 1 : 0;
diff --git a/zephyr/program/skyrim/winterhold/src/kb_backlight.c b/zephyr/projects/skyrim/src/winterhold/kb_backlight.c
index cbbfc0a4e9..049b99e3a1 100644
--- a/zephyr/program/skyrim/winterhold/src/kb_backlight.c
+++ b/zephyr/projects/skyrim/src/winterhold/kb_backlight.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/logging/log.h>
+
#include "board_config.h"
#include "common.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_DECLARE(skyrim, CONFIG_SKYRIM_LOG_LEVEL);
__override uint32_t board_override_feature_flags0(uint32_t flags0)
diff --git a/zephyr/program/skyrim/winterhold/src/keyboard.c b/zephyr/projects/skyrim/src/winterhold/keyboard.c
index d3aebe0f2e..d3aebe0f2e 100644
--- a/zephyr/program/skyrim/winterhold/src/keyboard.c
+++ b/zephyr/projects/skyrim/src/winterhold/keyboard.c
diff --git a/zephyr/program/skyrim/winterhold/src/ppc_config.c b/zephyr/projects/skyrim/src/winterhold/ppc_config.c
index d6adb145ff..72ddb6ce6c 100644
--- a/zephyr/program/skyrim/winterhold/src/ppc_config.c
+++ b/zephyr/projects/skyrim/src/winterhold/ppc_config.c
@@ -5,11 +5,11 @@
/* Winterhold board-specific PPC code */
+#include <zephyr/drivers/gpio.h>
+
#include "driver/ppc/nx20p348x.h"
#include "usbc_ppc.h"
-#include <zephyr/drivers/gpio.h>
-
void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
diff --git a/zephyr/program/skyrim/winterhold/src/usb_mux_config.c b/zephyr/projects/skyrim/src/winterhold/usb_mux_config.c
index 19153eb676..d2ee4a6606 100644
--- a/zephyr/program/skyrim/winterhold/src/usb_mux_config.c
+++ b/zephyr/projects/skyrim/src/winterhold/usb_mux_config.c
@@ -5,6 +5,8 @@
/* Winterhold board-specific USB-C mux configuration */
+#include <zephyr/drivers/gpio.h>
+
#include "console.h"
#include "cros_board_info.h"
#include "cros_cbi.h"
@@ -14,8 +16,6 @@
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
@@ -56,20 +56,6 @@ int board_anx7483_c0_mux_set(const struct usb_mux *me, mux_state_t mux_state)
return anx7483_set_default_tuning(me, mux_state);
}
-int board_anx7483_c1_fg_defalut_tuning(const struct usb_mux *me)
-{
- RETURN_ERROR(
- anx7483_set_fg(me, ANX7483_PIN_URX1, ANX7483_FG_SETTING_1_2DB));
- RETURN_ERROR(
- anx7483_set_fg(me, ANX7483_PIN_URX2, ANX7483_FG_SETTING_1_2DB));
- RETURN_ERROR(
- anx7483_set_fg(me, ANX7483_PIN_UTX1, ANX7483_FG_SETTING_1_2DB));
- RETURN_ERROR(
- anx7483_set_fg(me, ANX7483_PIN_UTX2, ANX7483_FG_SETTING_1_2DB));
-
- return EC_SUCCESS;
-}
-
int board_anx7483_c1_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
bool flipped = mux_state & USB_PD_MUX_POLARITY_INVERTED;
@@ -82,12 +68,6 @@ int board_anx7483_c1_mux_set(const struct usb_mux *me, mux_state_t mux_state)
RETURN_ERROR(anx7483_set_default_tuning(me, mux_state));
- /*
- * Set the Flat Gain to default every time, to prevent DP only mode's
- * Flat Gain change in the last plug.
- */
- RETURN_ERROR(board_anx7483_c1_fg_defalut_tuning(me));
-
if (mux_state == USB_PD_MUX_USB_ENABLED) {
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1,
ANX7483_EQ_SETTING_12_5DB));
@@ -99,47 +79,31 @@ int board_anx7483_c1_mux_set(const struct usb_mux *me, mux_state_t mux_state)
ANX7483_EQ_SETTING_12_5DB));
} else if (mux_state == USB_PD_MUX_DP_ENABLED) {
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1,
- ANX7483_EQ_SETTING_8_4DB));
+ ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2,
- ANX7483_EQ_SETTING_8_4DB));
+ ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX1,
- ANX7483_EQ_SETTING_8_4DB));
+ ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX2,
- ANX7483_EQ_SETTING_8_4DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_URX1,
- ANX7483_FG_SETTING_0_5DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_URX2,
- ANX7483_FG_SETTING_0_5DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_UTX1,
- ANX7483_FG_SETTING_0_5DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_UTX2,
- ANX7483_FG_SETTING_0_5DB));
+ ANX7483_EQ_SETTING_12_5DB));
} else if (mux_state == USB_PD_MUX_DOCK && !flipped) {
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1,
ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2,
- ANX7483_EQ_SETTING_8_4DB));
+ ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_DRX1,
ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX2,
- ANX7483_EQ_SETTING_8_4DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_URX2,
- ANX7483_FG_SETTING_0_5DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_UTX2,
- ANX7483_FG_SETTING_0_5DB));
+ ANX7483_EQ_SETTING_12_5DB));
} else if (mux_state == USB_PD_MUX_DOCK && flipped) {
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX1,
- ANX7483_EQ_SETTING_8_4DB));
+ ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_URX2,
ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_UTX1,
- ANX7483_EQ_SETTING_8_4DB));
+ ANX7483_EQ_SETTING_12_5DB));
RETURN_ERROR(anx7483_set_eq(me, ANX7483_PIN_DRX2,
ANX7483_EQ_SETTING_12_5DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_URX1,
- ANX7483_FG_SETTING_0_5DB));
- RETURN_ERROR(anx7483_set_fg(me, ANX7483_PIN_UTX1,
- ANX7483_FG_SETTING_0_5DB));
}
return EC_SUCCESS;
diff --git a/zephyr/program/skyrim/usbc.dtsi b/zephyr/projects/skyrim/usbc.dts
index 8486927e8d..8486927e8d 100644
--- a/zephyr/program/skyrim/usbc.dtsi
+++ b/zephyr/projects/skyrim/usbc.dts
diff --git a/zephyr/program/skyrim/winterhold/winterhold.dtsi b/zephyr/projects/skyrim/winterhold.dts
index a831cd9500..6113923ed8 100644
--- a/zephyr/program/skyrim/winterhold/winterhold.dtsi
+++ b/zephyr/projects/skyrim/winterhold.dts
@@ -5,7 +5,7 @@
#include <dt-bindings/usbc_mux.h>
-#include "../i2c.dtsi"
+#include "i2c_common.dtsi"
/ {
named-gpios {
@@ -15,22 +15,16 @@
named-temp-sensors {
compatible = "cros-ec,temp-sensors";
soc-pct2075 {
- temp_host_high = <105>;
- temp_host_halt = <110>;
- temp_host_release_high = <95>;
- temp_host_release_halt = <100>;
+ temp_host_high = <100>;
+ temp_host_halt = <105>;
+ temp_host_release_high = <80>;
+ temp_host_release_halt = <80>;
+ temp_fan_off = <0>;
+ temp_fan_max = <70>;
power-good-pin = <&gpio_pg_pwr_s5>;
sensor = <&soc_pct2075>;
};
amb-pct2075 {
- temp_host_warn = <50>;
- temp_host_high = <105>;
- temp_host_halt = <110>;
- temp_host_release_warn = <45>;
- temp_host_release_high = <95>;
- temp_host_release_halt = <100>;
- temp_fan_off = <35>;
- temp_fan_max = <40>;
power-good-pin = <&gpio_pg_pwr_s5>;
sensor = <&amb_pct2075>;
};
@@ -86,7 +80,6 @@
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "board_anx7483_c0_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
ppc_port0: nx20p348x@71 {
compatible = "nxp,nx20p348x";
@@ -100,7 +93,6 @@
compatible = "analogix,anx7483";
reg = <0x3e>;
board-set = "board_anx7483_c1_mux_set";
- flags = <USB_MUX_FLAG_RESETS_IN_G3>;
};
ppc_port1: nx20p348x@71 {
compatible = "nxp,nx20p348x";
@@ -132,37 +124,3 @@
usb-muxes = <&amd_fp6_port1 &anx7483_port1>;
};
};
-
-&fan0 {
- pwms = <&pwm0 0 PWM_KHZ(2) PWM_POLARITY_NORMAL>;
- rpm_min = <2100>;
- rpm_start = <2600>;
- rpm_max = <4800>;
-};
-
-&temp_sensor_charger {
- temp_host_high = <100>;
- temp_host_halt = <110>;
- temp_host_release_high = <90>;
- temp_host_release_halt = <100>;
-};
-
-&temp_sensor_memory {
- temp_host_high = <91>;
- temp_host_halt = <96>;
- temp_host_release_high = <81>;
- temp_host_release_halt = <86>;
-};
-
-&temp_sensor_cpu {
- /delete-property/ temp_host_high;
- /delete-property/ temp_host_halt;
- /delete-property/ temp_host_release_high;
- /delete-property/ temp_fan_off;
- /delete-property/ temp_fan_max;
-};
-
-/* Override handler */
-&int_accel_gyro {
- handler = "base_accel_interrupt";
-};
diff --git a/zephyr/program/trogdor/lazor/BUILD.py b/zephyr/projects/trogdor/lazor/BUILD.py
index ca1a26bdcf..ca1a26bdcf 100644
--- a/zephyr/program/trogdor/lazor/BUILD.py
+++ b/zephyr/projects/trogdor/lazor/BUILD.py
diff --git a/zephyr/program/trogdor/lazor/CMakeLists.txt b/zephyr/projects/trogdor/lazor/CMakeLists.txt
index b6d5024707..b6d5024707 100644
--- a/zephyr/program/trogdor/lazor/CMakeLists.txt
+++ b/zephyr/projects/trogdor/lazor/CMakeLists.txt
diff --git a/zephyr/program/trogdor/lazor/adc.dts b/zephyr/projects/trogdor/lazor/adc.dts
index b834001587..b834001587 100644
--- a/zephyr/program/trogdor/lazor/adc.dts
+++ b/zephyr/projects/trogdor/lazor/adc.dts
diff --git a/zephyr/program/trogdor/lazor/battery.dts b/zephyr/projects/trogdor/lazor/battery.dts
index 2b17dd4761..2b17dd4761 100644
--- a/zephyr/program/trogdor/lazor/battery.dts
+++ b/zephyr/projects/trogdor/lazor/battery.dts
diff --git a/zephyr/program/trogdor/lazor/default_gpio_pinctrl.dts b/zephyr/projects/trogdor/lazor/default_gpio_pinctrl.dts
index 1819bdbc3e..1819bdbc3e 100644
--- a/zephyr/program/trogdor/lazor/default_gpio_pinctrl.dts
+++ b/zephyr/projects/trogdor/lazor/default_gpio_pinctrl.dts
diff --git a/zephyr/program/herobrine/display.dtsi b/zephyr/projects/trogdor/lazor/display.dts
index 65d3a2d91b..65d3a2d91b 100644
--- a/zephyr/program/herobrine/display.dtsi
+++ b/zephyr/projects/trogdor/lazor/display.dts
diff --git a/zephyr/program/trogdor/lazor/gpio.dts b/zephyr/projects/trogdor/lazor/gpio.dts
index d40a593949..a047d7e2f2 100644
--- a/zephyr/program/trogdor/lazor/gpio.dts
+++ b/zephyr/projects/trogdor/lazor/gpio.dts
@@ -188,9 +188,11 @@
gpios = <&gpio7 5 GPIO_OUTPUT_HIGH>;
};
gpio_ec_chg_led_y_c1: ec_chg_led_y_c1 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 3 GPIO_OUTPUT_LOW>;
};
gpio_ec_chg_led_b_c1: ec_chg_led_b_c1 {
+ #led-pin-cells = <1>;
gpios = <&gpioc 4 GPIO_OUTPUT_LOW>;
};
gpio_brd_id0: brd_id0 {
@@ -263,23 +265,27 @@
MKBP_EVENT_SENSOR_FIFO)>;
};
- gpio_id_sku: sku {
+ sku {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_sku_id0
&gpio_sku_id1
&gpio_sku_id2
>;
+
system = "binary";
};
- gpio_id_board: board {
+ board {
compatible = "cros-ec,gpio-id";
+
bits = <
&gpio_brd_id0
&gpio_brd_id1
&gpio_brd_id2
>;
+
system = "binary_first_base3";
};
diff --git a/zephyr/projects/trogdor/lazor/gpio_led.dts b/zephyr/projects/trogdor/lazor/gpio_led.dts
new file mode 100644
index 0000000000..c8c026506b
--- /dev/null
+++ b/zephyr/projects/trogdor/lazor/gpio_led.dts
@@ -0,0 +1,33 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/ {
+ gpio-led-pins {
+ compatible = "cros-ec,gpio-led-pins";
+
+ color_off: color-off {
+ led-color = "LED_OFF";
+ led-id = "EC_LED_ID_BATTERY_LED";
+ led-pins = <&gpio_ec_chg_led_y_c1 0>,
+ <&gpio_ec_chg_led_b_c1 0>;
+ };
+
+ color_amber: color-amber {
+ led-color = "LED_AMBER";
+ led-id = "EC_LED_ID_BATTERY_LED";
+ br-color = "EC_LED_COLOR_AMBER";
+ led-pins = <&gpio_ec_chg_led_y_c1 1>,
+ <&gpio_ec_chg_led_b_c1 0>;
+ };
+
+ color_blue: color-blue {
+ led-color = "LED_BLUE";
+ led-id = "EC_LED_ID_BATTERY_LED";
+ br-color = "EC_LED_COLOR_BLUE";
+ led-pins = <&gpio_ec_chg_led_y_c1 0>,
+ <&gpio_ec_chg_led_b_c1 1>;
+ };
+ };
+};
diff --git a/zephyr/program/corsola/npcx_host_interface.dtsi b/zephyr/projects/trogdor/lazor/host_interface_npcx.dts
index 14efa3c6b2..14efa3c6b2 100644
--- a/zephyr/program/corsola/npcx_host_interface.dtsi
+++ b/zephyr/projects/trogdor/lazor/host_interface_npcx.dts
diff --git a/zephyr/program/trogdor/lazor/i2c.dts b/zephyr/projects/trogdor/lazor/i2c.dts
index e19ad224a9..e19ad224a9 100644
--- a/zephyr/program/trogdor/lazor/i2c.dts
+++ b/zephyr/projects/trogdor/lazor/i2c.dts
diff --git a/zephyr/program/trogdor/lazor/include/sku.h b/zephyr/projects/trogdor/lazor/include/sku.h
index 76825bbba1..76825bbba1 100644
--- a/zephyr/program/trogdor/lazor/include/sku.h
+++ b/zephyr/projects/trogdor/lazor/include/sku.h
diff --git a/zephyr/program/trogdor/lazor/interrupts.dts b/zephyr/projects/trogdor/lazor/interrupts.dts
index 5c2ed35e90..5c2ed35e90 100644
--- a/zephyr/program/trogdor/lazor/interrupts.dts
+++ b/zephyr/projects/trogdor/lazor/interrupts.dts
diff --git a/zephyr/program/trogdor/lazor/keyboard.dts b/zephyr/projects/trogdor/lazor/keyboard.dts
index 6580fa2a35..b8689b883c 100644
--- a/zephyr/program/trogdor/lazor/keyboard.dts
+++ b/zephyr/projects/trogdor/lazor/keyboard.dts
@@ -5,7 +5,7 @@
/ {
cros-keyscan {
- compatible = "cros-ec,keyscan";
+ compatible = "cros-keyscan";
actual-key-mask = <
0x14 /* C0 */
diff --git a/zephyr/program/trogdor/lazor/led.dts b/zephyr/projects/trogdor/lazor/led.dts
index 4527afd34c..4527afd34c 100644
--- a/zephyr/program/trogdor/lazor/led.dts
+++ b/zephyr/projects/trogdor/lazor/led.dts
diff --git a/zephyr/program/trogdor/lazor/motionsense.dts b/zephyr/projects/trogdor/lazor/motionsense.dts
index 75fe31b997..75fe31b997 100644
--- a/zephyr/program/trogdor/lazor/motionsense.dts
+++ b/zephyr/projects/trogdor/lazor/motionsense.dts
diff --git a/zephyr/program/trogdor/lazor/prj.conf b/zephyr/projects/trogdor/lazor/prj.conf
index 7863c75917..358de69d68 100644
--- a/zephyr/program/trogdor/lazor/prj.conf
+++ b/zephyr/projects/trogdor/lazor/prj.conf
@@ -21,11 +21,15 @@ CONFIG_PLATFORM_EC_LID_SWITCH=y
CONFIG_PLATFORM_EC_BACKLIGHT_LID=y
CONFIG_PLATFORM_EC_POWER_BUTTON=y
+# I2C
+CONFIG_I2C=y
+
# LED
CONFIG_PLATFORM_EC_LED_DT=y
# PWM
CONFIG_PWM=y
+CONFIG_PWM_SHELL=n
# Application Processor is Qualcomm SC7180
CONFIG_AP_ARM_QUALCOMM_SC7180=y
@@ -51,13 +55,20 @@ CONFIG_PLATFORM_EC_MKBP_EVENT=y
CONFIG_PLATFORM_EC_MKBP_USE_GPIO=y
# Keyboard
+CONFIG_PLATFORM_EC_KEYBOARD=y
CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_MKBP=y
CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y
CONFIG_PLATFORM_EC_KEYBOARD_COL2_INVERTED=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
CONFIG_PLATFORM_EC_CMD_BUTTON=y
+CONFIG_CROS_KB_RAW_NPCX=y
+
+# ADC
+CONFIG_ADC=y
+CONFIG_ADC_SHELL=n
# Battery
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_I2C_VIRTUAL_BATTERY=y
CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED=y
@@ -73,7 +84,6 @@ CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON=2
CONFIG_PLATFORM_EC_CHARGER_MIN_POWER_MW_FOR_POWER_ON=10000
-CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=512
CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y
CONFIG_PLATFORM_EC_CHARGER_PSYS=y
CONFIG_PLATFORM_EC_CHARGER_PSYS_READ=y
@@ -81,7 +91,11 @@ CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20
CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_ADC_AMON_BMON=y
+# USB-A
+CONFIG_PLATFORM_EC_USBA=y
+
# USB-C
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USB_PD_USB32_DRD=n
CONFIG_PLATFORM_EC_USBC_PPC_SN5S330=y
CONFIG_PLATFORM_EC_USBC_RETIMER_FW_UPDATE=n
@@ -109,6 +123,7 @@ CONFIG_PLATFORM_EC_USB_PID=0x5043
# RTC
CONFIG_PLATFORM_EC_RTC=y
+CONFIG_CROS_RTC_NPCX=y
CONFIG_PLATFORM_EC_HOSTCMD_RTC=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_RTC=y
diff --git a/zephyr/program/trogdor/lazor/pwm_led.dts b/zephyr/projects/trogdor/lazor/pwm_led.dts
index f8375b3596..0582966d6a 100644
--- a/zephyr/program/trogdor/lazor/pwm_led.dts
+++ b/zephyr/projects/trogdor/lazor/pwm_led.dts
@@ -4,12 +4,16 @@
*/
/ {
- pwmleds {
- compatible = "pwm-leds";
+ pwm_pins {
+ compatible = "cros-ec,pwm-pin-config";
+
pwm_y: pwm_y {
+ #led-pin-cells = <1>;
pwms = <&pwm0 0 PWM_HZ(324) PWM_POLARITY_NORMAL>;
};
+
pwm_b: pwm_b {
+ #led-pin-cells = <1>;
pwms = <&pwm2 0 PWM_HZ(324) PWM_POLARITY_NORMAL>;
};
};
@@ -20,24 +24,24 @@
color_off: color-off {
led-color = "LED_OFF";
led-id = "EC_LED_ID_BATTERY_LED";
- led-pwms = <&pwm_y &pwm_b>;
- led-values = <0 0>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_b 0>;
};
color_amber: color-amber {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwm_y &pwm_b>;
- led-values = <100 0>;
+ led-pins = <&pwm_y 100>,
+ <&pwm_b 0>;
};
color_blue: color-blue {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_BATTERY_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pwms = <&pwm_y &pwm_b>;
- led-values = <0 100>;
+ led-pins = <&pwm_y 0>,
+ <&pwm_b 100>;
};
};
};
diff --git a/zephyr/program/trogdor/lazor/src/hibernate.c b/zephyr/projects/trogdor/lazor/src/hibernate.c
index 388ff1b087..388ff1b087 100644
--- a/zephyr/program/trogdor/lazor/src/hibernate.c
+++ b/zephyr/projects/trogdor/lazor/src/hibernate.c
diff --git a/zephyr/program/trogdor/lazor/src/i2c.c b/zephyr/projects/trogdor/lazor/src/i2c.c
index e572bbdf37..6d737b410f 100644
--- a/zephyr/program/trogdor/lazor/src/i2c.c
+++ b/zephyr/projects/trogdor/lazor/src/i2c.c
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#include "i2c.h"
#include "i2c/i2c.h"
+#include "i2c.h"
/* Lazor board specific i2c implementation */
diff --git a/zephyr/program/trogdor/lazor/src/power.c b/zephyr/projects/trogdor/lazor/src/power.c
index ee99c77196..96f9bc43c5 100644
--- a/zephyr/program/trogdor/lazor/src/power.c
+++ b/zephyr/projects/trogdor/lazor/src/power.c
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "gpio.h"
-#include "power.h"
-#include "task.h"
-
-#include <zephyr/drivers/gpio.h>
#include <zephyr/init.h>
+#include <zephyr/drivers/gpio.h>
#include <ap_power/ap_power.h>
+#include "power.h"
+#include "task.h"
+#include "gpio.h"
static void board_power_change(struct ap_power_ev_callback *cb,
struct ap_power_ev_data data)
diff --git a/zephyr/program/trogdor/lazor/src/sku.c b/zephyr/projects/trogdor/lazor/src/sku.c
index a6187d422f..1d88437031 100644
--- a/zephyr/program/trogdor/lazor/src/sku.c
+++ b/zephyr/projects/trogdor/lazor/src/sku.c
@@ -7,10 +7,10 @@
#include "config.h"
#include "console.h"
#include "driver/ln9310.h"
+#include "tcpm/ps8xxx_public.h"
#include "hooks.h"
#include "sku.h"
#include "system.h"
-#include "tcpm/ps8xxx_public.h"
#include "util.h"
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/trogdor/lazor/src/switchcap.c b/zephyr/projects/trogdor/lazor/src/switchcap.c
index 77413fb336..d8205cbcfc 100644
--- a/zephyr/program/trogdor/lazor/src/switchcap.c
+++ b/zephyr/projects/trogdor/lazor/src/switchcap.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "common.h"
#include "config.h"
#include "console.h"
@@ -11,10 +13,8 @@
#include "hooks.h"
#include "i2c.h"
#include "power/qcom.h"
-#include "sku.h"
#include "system.h"
-
-#include <zephyr/drivers/gpio.h>
+#include "sku.h"
#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
diff --git a/zephyr/program/trogdor/lazor/src/usb_pd_policy.c b/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c
index 32e3376ca0..8d046826f9 100644
--- a/zephyr/program/trogdor/lazor/src/usb_pd_policy.c
+++ b/zephyr/projects/trogdor/lazor/src/usb_pd_policy.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio.h>
+
#include "charge_manager.h"
#include "chipset.h"
#include "console.h"
@@ -11,8 +13,6 @@
#include "usbc_ppc.h"
#include "util.h"
-#include <zephyr/drivers/gpio.h>
-
#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
diff --git a/zephyr/program/trogdor/lazor/src/usbc_config.c b/zephyr/projects/trogdor/lazor/src/usbc_config.c
index d7d5ca2cc1..f6bfdfb186 100644
--- a/zephyr/program/trogdor/lazor/src/usbc_config.c
+++ b/zephyr/projects/trogdor/lazor/src/usbc_config.c
@@ -7,23 +7,23 @@
#include "battery_fuel_gauge.h"
#include "bc12/pi3usb9201_public.h"
-#include "charge_manager.h"
-#include "charge_state.h"
#include "charger.h"
#include "charger/isl923x_public.h"
+#include "charge_manager.h"
+#include "charge_state.h"
#include "common.h"
#include "config.h"
#include "driver/ln9310.h"
-#include "gpio/gpio_int.h"
#include "gpio_signal.h"
+#include "gpio/gpio_int.h"
#include "hooks.h"
#include "ppc/sn5s330_public.h"
#include "system.h"
#include "tcpm/ps8xxx_public.h"
#include "tcpm/tcpci.h"
#include "timer.h"
-#include "usb_mux.h"
#include "usb_pd.h"
+#include "usb_mux.h"
#include "usbc_ocp.h"
#include "usbc_ppc.h"
@@ -197,7 +197,7 @@ void board_tcpc_init(void)
/* Enable TCPC interrupts */
gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_tcpc));
- gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c1_tcpc));
+ gpio_enable_dt_interrupt(GPIO_INT_FROM_NODELABEL(int_usb_c0_tcpc));
/*
* Initialize HPD to low; after sysjump SOC needs to see
@@ -301,8 +301,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
@@ -314,7 +314,8 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
charge_ma = max_ma;
}
- charge_set_input_current_limit(charge_ma, charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
@@ -325,7 +326,7 @@ uint16_t tcpc_get_alert_status(void)
if (gpio_pin_get_dt(
GPIO_DT_FROM_NODELABEL(gpio_usb_c0_pd_rst_l)))
status |= PD_STATUS_TCPC_ALERT_0;
- if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c1_pd_int_odl)))
+ if (!gpio_pin_get_dt(GPIO_DT_FROM_NODELABEL(gpio_usb_c0_pd_int_odl)))
if (gpio_pin_get_dt(
GPIO_DT_FROM_NODELABEL(gpio_usb_c1_pd_rst_l)))
status |= PD_STATUS_TCPC_ALERT_1;
diff --git a/zephyr/program/trogdor/lazor/usbc.dts b/zephyr/projects/trogdor/lazor/usbc.dts
index 7864c2716b..7864c2716b 100644
--- a/zephyr/program/trogdor/lazor/usbc.dts
+++ b/zephyr/projects/trogdor/lazor/usbc.dts
diff --git a/zephyr/shim/chip/it8xxx2/clock.c b/zephyr/shim/chip/it8xxx2/clock.c
index a4df87dc1d..14dbc0e7eb 100644
--- a/zephyr/shim/chip/it8xxx2/clock.c
+++ b/zephyr/shim/chip/it8xxx2/clock.c
@@ -3,16 +3,15 @@
* found in the LICENSE file.
*/
-#include "module_id.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-#include <zephyr/sys/util.h>
-
#include <soc.h>
#include <soc/ite_it8xxx2/reg_def_cros.h>
+#include <zephyr/sys/util.h>
+
+#include "module_id.h"
LOG_MODULE_REGISTER(shim_clock, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/chip/it8xxx2/gpio.c b/zephyr/shim/chip/it8xxx2/gpio.c
index 16eb7a3963..7106b2a294 100644
--- a/zephyr/shim/chip/it8xxx2/gpio.c
+++ b/zephyr/shim/chip/it8xxx2/gpio.c
@@ -3,13 +3,14 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
+
#include <zephyr/logging/log.h>
+#include "gpio/gpio.h"
+
LOG_MODULE_REGISTER(shim_cros_gpio, LOG_LEVEL_ERR);
static const struct unused_pin_config unused_pin_configs[] = {
diff --git a/zephyr/shim/chip/it8xxx2/keyboard_raw.c b/zephyr/shim/chip/it8xxx2/keyboard_raw.c
index 5fe99b7efa..0a117cda14 100644
--- a/zephyr/shim/chip/it8xxx2/keyboard_raw.c
+++ b/zephyr/shim/chip/it8xxx2/keyboard_raw.c
@@ -5,14 +5,13 @@
/* Functions needed by keyboard scanner module for Chrome EC */
-#include "drivers/cros_kb_raw.h"
-#include "keyboard_raw.h"
-
#include <zephyr/device.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
+#include <zephyr/kernel.h>
+
+#include "drivers/cros_kb_raw.h"
+#include "keyboard_raw.h"
/**
* Return true if the current value of the given input GPIO port is zero
diff --git a/zephyr/shim/chip/it8xxx2/power_policy.c b/zephyr/shim/chip/it8xxx2/power_policy.c
index c6e73d53a4..c8efb0ca96 100644
--- a/zephyr/shim/chip/it8xxx2/power_policy.c
+++ b/zephyr/shim/chip/it8xxx2/power_policy.c
@@ -3,13 +3,12 @@
* found in the LICENSE file.
*/
-#include "system.h"
-
-#include <zephyr/kernel.h>
#include <zephyr/pm/pm.h>
#include <zephyr/pm/policy.h>
-
#include <soc.h>
+#include <zephyr/kernel.h>
+
+#include "system.h"
static const struct pm_state_info pm_states[] =
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(cpu0));
diff --git a/zephyr/shim/chip/mchp/clock.c b/zephyr/shim/chip/mchp/clock.c
index 5fb39bfd43..6ee4cd931c 100644
--- a/zephyr/shim/chip/mchp/clock.c
+++ b/zephyr/shim/chip/mchp/clock.c
@@ -3,17 +3,16 @@
* found in the LICENSE file.
*/
-#include "clock_chip.h"
-#include "module_id.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/dt-bindings/clock/mchp_xec_pcr.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
+#include "clock_chip.h"
+#include "module_id.h"
+
LOG_MODULE_REGISTER(shim_clock, LOG_LEVEL_ERR);
#define PCR_NODE DT_INST(0, microchip_xec_pcr)
diff --git a/zephyr/shim/chip/mchp/gpio.c b/zephyr/shim/chip/mchp/gpio.c
index d772a566d8..7801c6f7cc 100644
--- a/zephyr/shim/chip/mchp/gpio.c
+++ b/zephyr/shim/chip/mchp/gpio.c
@@ -3,12 +3,11 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
+#include "gpio/gpio.h"
LOG_MODULE_REGISTER(shim_cros_gpio, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/chip/mchp/keyboard_raw.c b/zephyr/shim/chip/mchp/keyboard_raw.c
index 9183e4d7dd..95ad642d12 100644
--- a/zephyr/shim/chip/mchp/keyboard_raw.c
+++ b/zephyr/shim/chip/mchp/keyboard_raw.c
@@ -5,14 +5,13 @@
/* Functions needed by keyboard scanner module for Chrome EC */
-#include "drivers/cros_kb_raw.h"
-#include "keyboard_raw.h"
-
#include <zephyr/device.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
+#include <zephyr/kernel.h>
+
+#include "drivers/cros_kb_raw.h"
+#include "keyboard_raw.h"
/**
* Return true if the current value of the given input GPIO port is zero
diff --git a/zephyr/shim/chip/mchp/system.c b/zephyr/shim/chip/mchp/system.c
index 6e5da9aa80..35ba806533 100644
--- a/zephyr/shim/chip/mchp/system.c
+++ b/zephyr/shim/chip/mchp/system.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "system.h"
-#include "system_chip.h"
-
#include <zephyr/drivers/bbram.h>
#include <zephyr/logging/log.h>
+#include "system.h"
+#include "system_chip.h"
+
LOG_MODULE_REGISTER(shim_xec_system, LOG_LEVEL_ERR);
#define GET_BBRAM_OFS(node) DT_PROP(DT_PATH(named_bbram_regions, node), offset)
diff --git a/zephyr/shim/chip/mchp/system_download_from_flash.c b/zephyr/shim/chip/mchp/system_download_from_flash.c
index 8f6304274f..51cdc5aab6 100644
--- a/zephyr/shim/chip/mchp/system_download_from_flash.c
+++ b/zephyr/shim/chip/mchp/system_download_from_flash.c
@@ -2,14 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/dt-bindings/clock/npcx_clock.h>
+#include <stdnoreturn.h>
+
#include "common.h"
#include "soc.h"
#include "system_chip.h"
-#include <zephyr/dt-bindings/clock/npcx_clock.h>
-
-#include <stdnoreturn.h>
-
/* Modules Map */
#define WDT_NODE DT_INST(0, microchip_xec_watchdog)
#define STRUCT_WDT_REG_BASE_ADDR ((struct wdt_regs *)(DT_REG_ADDR(WDT_NODE)))
diff --git a/zephyr/shim/chip/mchp/system_external_storage.c b/zephyr/shim/chip/mchp/system_external_storage.c
index 5887e045a4..4250b05fe3 100644
--- a/zephyr/shim/chip/mchp/system_external_storage.c
+++ b/zephyr/shim/chip/mchp/system_external_storage.c
@@ -3,16 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/bbram.h>
+#include <soc.h>
+
#include "clock_chip.h"
#include "common.h"
-#include "config_chip.h"
#include "system.h"
#include "system_chip.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/bbram.h>
-
-#include <soc.h>
+#include "config_chip.h"
#define MCHP_ECRO_WORD 0x4F524345u /* ASCII ECRO */
#define MCHP_ECRW_WORD 0x57524345u /* ASCII ECRW */
diff --git a/zephyr/shim/chip/npcx/clock.c b/zephyr/shim/chip/npcx/clock.c
index 2a6fe27ef4..fc483ef775 100644
--- a/zephyr/shim/chip/npcx/clock.c
+++ b/zephyr/shim/chip/npcx/clock.c
@@ -3,17 +3,16 @@
* found in the LICENSE file.
*/
-#include "clock_chip.h"
-#include "module_id.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/dt-bindings/clock/npcx_clock.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
+#include "clock_chip.h"
+#include "module_id.h"
+
LOG_MODULE_REGISTER(shim_clock, LOG_LEVEL_ERR);
#define CDCG_NODE DT_INST(0, nuvoton_npcx_pcc)
diff --git a/zephyr/shim/chip/npcx/gpio.c b/zephyr/shim/chip/npcx/gpio.c
index 1d51c00f61..850123e17b 100644
--- a/zephyr/shim/chip/npcx/gpio.c
+++ b/zephyr/shim/chip/npcx/gpio.c
@@ -3,16 +3,17 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio.h"
-#include "soc_gpio.h"
-#include "util.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
#include <zephyr/shell/shell.h>
+#include <zephyr/logging/log.h>
+
+#include "gpio/gpio.h"
+#include "soc_gpio.h"
+#include "util.h"
+
LOG_MODULE_REGISTER(shim_cros_gpio, LOG_LEVEL_ERR);
static const struct unused_pin_config unused_pin_configs[] = {
diff --git a/zephyr/shim/chip/npcx/keyboard_raw.c b/zephyr/shim/chip/npcx/keyboard_raw.c
index 1f01952ab9..4d43134482 100644
--- a/zephyr/shim/chip/npcx/keyboard_raw.c
+++ b/zephyr/shim/chip/npcx/keyboard_raw.c
@@ -5,16 +5,15 @@
/* Functions needed by keyboard scanner module for Chrome EC */
-#include "drivers/cros_kb_raw.h"
-#include "keyboard_raw.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
#include <soc_gpio.h>
+#include <zephyr/kernel.h>
+
+#include "drivers/cros_kb_raw.h"
+#include "keyboard_raw.h"
/**
* Return true if the current value of the given input GPIO port is zero
diff --git a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c
index 3062ed98a4..e3fecc0cbd 100644
--- a/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c
+++ b/zephyr/shim/chip/npcx/npcx_monitor/npcx_monitor.c
@@ -5,14 +5,12 @@
* NPCX SoC spi flash update tool - monitor firmware
*/
+#include <stdint.h>
+#include <zephyr/sys/util.h>
#include "config_chip.h"
#include "npcx_monitor.h"
#include "registers.h"
-#include <stdint.h>
-
-#include <zephyr/sys/util.h>
-
/*
* TODO(b/197162681): This was copied from chip/npcx/spiflashfw but this
* needs to be moved to Zephyr upstream
diff --git a/zephyr/shim/chip/npcx/power_policy.c b/zephyr/shim/chip/npcx/power_policy.c
index 29ebcbd542..aea6e62d30 100644
--- a/zephyr/shim/chip/npcx/power_policy.c
+++ b/zephyr/shim/chip/npcx/power_policy.c
@@ -3,16 +3,15 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "cros_version.h"
-#include "system.h"
-
#include <zephyr/kernel.h>
#include <zephyr/pm/pm.h>
#include <zephyr/pm/policy.h>
-
#include <soc.h>
+#include "console.h"
+#include "cros_version.h"
+#include "system.h"
+
static const struct pm_state_info residency_info[] =
PM_STATE_INFO_LIST_FROM_DT_CPU(DT_NODELABEL(cpu0));
diff --git a/zephyr/shim/chip/npcx/shi.c b/zephyr/shim/chip/npcx/shi.c
index 0cecc2c56e..8bec57252d 100644
--- a/zephyr/shim/chip/npcx/shi.c
+++ b/zephyr/shim/chip/npcx/shi.c
@@ -5,19 +5,18 @@
/* Functions needed by Serial Host Interface module for Chrome EC */
-#include "chipset.h"
-#include "drivers/cros_shi.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "system.h"
-
#include <zephyr/device.h>
#include <zephyr/dt-bindings/clock/npcx_clock.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
+#include <soc.h>
+#include <zephyr/kernel.h>
#include <ap_power/ap_power.h>
-#include <soc.h>
+#include "chipset.h"
+#include "drivers/cros_shi.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "system.h"
LOG_MODULE_REGISTER(shim_cros_shi, LOG_LEVEL_DBG);
diff --git a/zephyr/shim/chip/npcx/system.c b/zephyr/shim/chip/npcx/system.c
index 1fbdca0803..2240acea54 100644
--- a/zephyr/shim/chip/npcx/system.c
+++ b/zephyr/shim/chip/npcx/system.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "system.h"
-#include "system_chip.h"
-
#include <zephyr/drivers/bbram.h>
#include <zephyr/logging/log.h>
+#include "system.h"
+#include "system_chip.h"
+
LOG_MODULE_REGISTER(shim_npcx_system, LOG_LEVEL_ERR);
static void chip_bbram_status_check(void)
diff --git a/zephyr/shim/chip/npcx/system_download_from_flash.c b/zephyr/shim/chip/npcx/system_download_from_flash.c
index 53e22d4839..1aef9560d1 100644
--- a/zephyr/shim/chip/npcx/system_download_from_flash.c
+++ b/zephyr/shim/chip/npcx/system_download_from_flash.c
@@ -2,14 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "common.h"
-#include "soc.h"
-#include "system_chip.h"
-
#include <zephyr/dt-bindings/clock/npcx_clock.h>
+#include <stdnoreturn.h>
#include <zephyr/sys/__assert.h>
-#include <stdnoreturn.h>
+#include "common.h"
+#include "soc.h"
+#include "system_chip.h"
/* Modules Map */
#define NPCX_PMC_BASE_ADDR 0x4000D000
diff --git a/zephyr/shim/chip/npcx/system_external_storage.c b/zephyr/shim/chip/npcx/system_external_storage.c
index d3b2d26362..81e1968cf4 100644
--- a/zephyr/shim/chip/npcx/system_external_storage.c
+++ b/zephyr/shim/chip/npcx/system_external_storage.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/syscon.h>
+
#include "clock_chip.h"
#include "common.h"
#include "rom_chip.h"
#include "system.h"
#include "system_chip.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/syscon.h>
-
/* TODO (b:179900857) Make this implementation not npcx specific. */
static const struct device *mdc_dev = DEVICE_DT_GET(DT_NODELABEL(mdc));
diff --git a/zephyr/shim/core/cortex-m/irq_command.c b/zephyr/shim/core/cortex-m/irq_command.c
index 651f804800..1cf1a213e4 100644
--- a/zephyr/shim/core/cortex-m/irq_command.c
+++ b/zephyr/shim/core/cortex-m/irq_command.c
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "console.h"
-
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
+#include "console.h"
/* IRQ counters */
int irq_count[CONFIG_NUM_IRQS];
diff --git a/zephyr/shim/core/cortex-m/mpu.c b/zephyr/shim/core/cortex-m/mpu.c
index 601961225c..8025227700 100644
--- a/zephyr/shim/core/cortex-m/mpu.c
+++ b/zephyr/shim/core/cortex-m/mpu.c
@@ -3,12 +3,13 @@
* found in the LICENSE file.
*/
-#include "config.h"
-#include "mpu.h"
-
#include <zephyr/arch/arm/aarch32/cortex_m/cmsis.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/init.h>
+
+#include "config.h"
+#include "mpu.h"
+
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(shim_mpu, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/include/board_led.h b/zephyr/shim/include/board_led.h
index ae4b23d74e..074ffa0256 100644
--- a/zephyr/shim/include/board_led.h
+++ b/zephyr/shim/include/board_led.h
@@ -6,10 +6,6 @@
#ifndef __BOARD_LED_H
#define __BOARD_LED_H
-#include <stdint.h>
-
-#include <zephyr/drivers/pwm.h>
-
struct board_led_pwm_dt_channel {
const struct device *dev;
uint32_t channel;
diff --git a/zephyr/shim/include/charger/chg_isl923x.h b/zephyr/shim/include/charger/chg_isl923x.h
index 9156e574de..b0323cd1b8 100644
--- a/zephyr/shim/include/charger/chg_isl923x.h
+++ b/zephyr/shim/include/charger/chg_isl923x.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/charger/isl923x_public.h"
-
#include <zephyr/devicetree.h>
+#include "driver/charger/isl923x_public.h"
#define ISL923X_CHG_COMPAT intersil_isl923x
#define ISL923X_EMUL_COMPAT cros_isl923x_emul
diff --git a/zephyr/shim/include/charger/chg_isl9241.h b/zephyr/shim/include/charger/chg_isl9241.h
index c6d2239038..711a581c2f 100644
--- a/zephyr/shim/include/charger/chg_isl9241.h
+++ b/zephyr/shim/include/charger/chg_isl9241.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/charger/isl9241_public.h"
-
#include <zephyr/devicetree.h>
+#include "driver/charger/isl9241_public.h"
#define ISL9241_CHG_COMPAT intersil_isl9241
diff --git a/zephyr/shim/include/charger/chg_rt9490.h b/zephyr/shim/include/charger/chg_rt9490.h
index 44d81eac48..3ac596d482 100644
--- a/zephyr/shim/include/charger/chg_rt9490.h
+++ b/zephyr/shim/include/charger/chg_rt9490.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/charger/rt9490.h"
-
#include <zephyr/devicetree.h>
+#include "driver/charger/rt9490.h"
#define RT9490_CHG_COMPAT richtek_rt9490
#define RT9490_EMUL_COMPAT zephyr_rt9490_emul
diff --git a/zephyr/shim/include/charger/chg_sm5803.h b/zephyr/shim/include/charger/chg_sm5803.h
index 853dd06a63..65ef066970 100644
--- a/zephyr/shim/include/charger/chg_sm5803.h
+++ b/zephyr/shim/include/charger/chg_sm5803.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/charger/sm5803.h"
-
#include <zephyr/devicetree.h>
+#include "driver/charger/sm5803.h"
#define SM5803_CHG_COMPAT siliconmitus_sm5803
diff --git a/zephyr/shim/include/charger_chips.h b/zephyr/shim/include/charger_chips.h
index 503a53330d..b24fa246bf 100644
--- a/zephyr/shim/include/charger_chips.h
+++ b/zephyr/shim/include/charger_chips.h
@@ -7,7 +7,6 @@
#define __CROS_EC_CHARGER_CHIPS_H
#include "charger.h"
-
#include <zephyr/devicetree.h>
extern const struct charger_config_t chg_chips_alt[];
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 28a93739c5..7c63ca31f9 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -15,8 +15,6 @@
#line 16
#include <zephyr/devicetree.h>
-#include <zephyr/toolchain.h>
-
#include <autoconf.h>
#define SENSOR_NODE DT_PATH(motionsense_sensor)
@@ -314,11 +312,6 @@
#ifdef CONFIG_PLATFORM_EC_OCPC
#define CONFIG_OCPC
#define CONFIG_OCPC_DEF_RBATT_MOHMS CONFIG_PLATFORM_EC_OCPC_DEF_RBATT_MOHMS
-#ifdef CONFIG_PLATFORM_EC_OCPC_DEF_DRIVELIMIT_MILLIVOLTS
-#undef CONFIG_OCPC_DEF_DRIVELIMIT_MILLIVOLTS
-#define CONFIG_OCPC_DEF_DRIVELIMIT_MILLIVOLTS \
- CONFIG_PLATFORM_EC_OCPC_DEF_DRIVELIMIT_MILLIVOLTS
-#endif
#endif
#undef CONFIG_CHARGER_SINGLE_CHIP
@@ -495,23 +488,17 @@
/* The jump data goes at the end of data ram, so for posix, the end of ram is
* wherever the jump data ended up.
*/
-extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
+#include "sysjump.h"
+extern char mock_jump_data[sizeof(struct jump_data) + 256];
#define CONFIG_RAM_BASE 0x0
-#define CONFIG_DATA_RAM_SIZE \
- (((uintptr_t)&mock_jump_data) + \
- CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE)
+#define CONFIG_DATA_RAM_SIZE \
+ (((uintptr_t)&mock_jump_data) + sizeof(mock_jump_data))
#else
#error "A zephyr,sram device must be chosen in the device tree"
#endif
#define CONFIG_RAM_SIZE CONFIG_DATA_RAM_SIZE
-#undef CONFIG_PRESERVED_END_OF_RAM_SIZE
-#ifdef CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE
-#define CONFIG_PRESERVED_END_OF_RAM_SIZE \
- CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE
-#endif
-
#define CONFIG_RO_MEM_OFF CONFIG_CROS_EC_RO_MEM_OFF
#define CONFIG_RO_MEM_SIZE CONFIG_CROS_EC_RO_MEM_SIZE
#define CONFIG_RW_MEM_OFF CONFIG_CROS_EC_RW_MEM_OFF
@@ -649,11 +636,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#define CONFIG_FAN_BYPASS_SLOW_RESPONSE
#endif
-#undef CONFIG_CUSTOM_FAN_CONTROL
-#ifdef CONFIG_PLATFORM_EC_CUSTOM_FAN_CONTROL
-#define CONFIG_CUSTOM_FAN_CONTROL
-#endif
-
#ifdef CONFIG_PLATFORM_EC_I2C
/* Also see shim/include/i2c/i2c.h which defines the ports enum */
#define CONFIG_I2C_CONTROLLER
@@ -729,11 +711,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#define CONFIG_KEYBOARD_REFRESH_ROW3
#endif /* CONFIG_PLATFORM_EC_KEYBOARD_REFRESH_ROW3 */
-#undef CONFIG_KEYBOARD_FACTORY_TEST
-#ifdef CONFIG_PLATFORM_EC_KEYBOARD_FACTORY_TEST
-#define CONFIG_KEYBOARD_FACTORY_TEST
-#endif
-
#undef CONFIG_KEYBOARD_KEYPAD
#ifdef CONFIG_PLATFORM_EC_KEYBOARD_KEYPAD
#define CONFIG_KEYBOARD_KEYPAD
@@ -1017,9 +994,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
CONFIG_PLATFORM_EC_PD_POWER_SUPPLY_TURN_OFF_DELAY
#endif
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS CONFIG_PLATFORM_EC_EXTPOWER_DEBOUNCE_MS
-
#undef CONFIG_CMD_PPC_DUMP
#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_PPC_DUMP
#define CONFIG_CMD_PPC_DUMP
@@ -1052,16 +1026,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#endif
-#undef CONFIG_CHARGE_STATE_DEBUG
-#ifdef CONFIG_PLATFORM_EC_CHARGE_STATE_DEBUG
-#define CONFIG_CHARGE_STATE_DEBUG
-#endif
-
-#undef CONFIG_CMD_PWR_AVG
-#ifdef CONFIG_PLATFORM_EC_CMD_PWR_AVG
-#define CONFIG_CMD_PWR_AVG
-#endif
-
#undef CONFIG_CHARGESPLASH
#ifdef CONFIG_PLATFORM_EC_CHARGESPLASH
#define CONFIG_CHARGESPLASH
@@ -1078,22 +1042,9 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
CONFIG_PLATFORM_EC_CHARGESPLASH_MAX_REQUESTS_PER_PERIOD
#endif
-#undef CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT
-#ifdef CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT
-#define CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT \
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT
-#endif
-
-#undef CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT
-#ifdef CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT
-#define CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT \
- CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT
-#endif
-
-#undef CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT
-#ifdef CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT
-#define CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT \
- CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT
+#undef CONFIG_CHARGER_INPUT_CURRENT
+#ifdef CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT
+#define CONFIG_CHARGER_INPUT_CURRENT CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT
#endif
#undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
@@ -1376,11 +1327,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#define CONFIG_USB_PE_SM
#endif
-#undef CONFIG_USB_DPM_SM
-#ifdef CONFIG_PLATFORM_EC_USB_DPM_SM
-#define CONFIG_USB_DPM_SM
-#endif
-
#undef CONFIG_USB_PD_DECODE_SOP
#ifdef CONFIG_PLATFORM_EC_USB_PD_DECODE_SOP
#define CONFIG_USB_PD_DECODE_SOP
@@ -1981,42 +1927,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#define CONFIG_ACCEL_FIFO_THRES CONFIG_PLATFORM_EC_ACCEL_FIFO_THRES
#endif /* CONFIG_PLATFORM_EC_ACCEL_FIFO */
-#undef CONFIG_BODY_DETECTION
-#undef CONFIG_BODY_DETECTION_SENSOR
-#undef CONFIG_BODY_DETECTION_MAX_WINDOW_SIZE
-#undef CONFIG_BODY_DETECTION_VAR_THRESHOLD
-#undef CONFIG_BODY_DETECTION_CONFIDENCE_DELTA
-#undef CONFIG_BODY_DETECTION_VAR_NOISE_FACTOR
-#undef CONFIG_BODY_DETECTION_ON_BODY_CON
-#undef CONFIG_BODY_DETECTION_OFF_BODY_CON
-#undef CONFIG_BODY_DETECTION_STATIONARY_DURATION
-#undef CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE
-#undef CONFIG_BODY_DETECTION_ALWAYS_ENABLE_IN_S0
-#ifdef CONFIG_PLATFORM_EC_BODY_DETECTION
-#define CONFIG_BODY_DETECTION
-#define CONFIG_BODY_DETECTION_SENSOR SENSOR_ID(DT_ALIAS(on_body_sensor))
-#define CONFIG_BODY_DETECTION_MAX_WINDOW_SIZE \
- CONFIG_PLATFORM_EC_BODY_DETECTION_MAX_WINDOW_SIZE
-#define CONFIG_BODY_DETECTION_VAR_THRESHOLD \
- CONFIG_PLATFORM_EC_BODY_DETECTION_VAR_THRESHOLD
-#define CONFIG_BODY_DETECTION_CONFIDENCE_DELTA \
- CONFIG_PLATFORM_EC_BODY_DETECTION_CONFIDENCE_DELTA
-#define CONFIG_BODY_DETECTION_VAR_NOISE_FACTOR \
- CONFIG_PLATFORM_EC_BODY_DETECTION_VAR_NOISE_FACTOR
-#define CONFIG_BODY_DETECTION_ON_BODY_CON \
- CONFIG_PLATFORM_EC_BODY_DETECTION_ON_BODY_CON
-#define CONFIG_BODY_DETECTION_OFF_BODY_CON \
- CONFIG_PLATFORM_EC_BODY_DETECTION_OFF_BODY_CON
-#define CONFIG_BODY_DETECTION_STATIONARY_DURATION \
- CONFIG_PLATFORM_EC_BODY_DETECTION_STATIONARY_DURATION
-#ifdef CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE
-#define CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE
-#endif /* CONFIG_PLATFORM_EC_BODY_DETECTION_NOTIFY_MODE_CHANGE */
-#ifdef CONFIG_PLATFORM_EC_BODY_DETECTION_ALWAYS_ENABLE_IN_S0
-#define CONFIG_BODY_DETECTION_ALWAYS_ENABLE_IN_S0
-#endif
-#endif /* CONFIG_PLATFORM_EC_BODY_DETECTION */
-
#undef CONFIG_CMD_ACCELS
#ifdef CONFIG_PLATFORM_EC_CONSOLE_CMD_ACCELS
#define CONFIG_CMD_ACCELS
@@ -2043,11 +1953,6 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#define CONFIG_CMD_ACCEL_SPOOF
#endif
-#undef CONFIG_GESTURE_HOST_DETECTION
-#ifdef CONFIG_PLATFORM_EC_GESTURE_HOST_DETECTION
-#define CONFIG_GESTURE_HOST_DETECTION
-#endif
-
#undef CONFIG_SENSOR_TIGHT_TIMESTAMPS
#ifdef CONFIG_PLATFORM_EC_SENSOR_TIGHT_TIMESTAMPS
#define CONFIG_SENSOR_TIGHT_TIMESTAMPS
@@ -2168,10 +2073,7 @@ extern char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
#undef CONFIG_MAX695X_SEVEN_SEGMENT_DISPLAY
#ifdef CONFIG_PLATFORM_EC_MAX695X_SEVEN_SEGMENT_DISPLAY
#define CONFIG_MAX695X_SEVEN_SEGMENT_DISPLAY
-#define PORT80_I2C_ADDR \
- DT_REG_ADDR(DT_COMPAT_GET_ANY_STATUS_OKAY(maxim_max695x))
-BUILD_ASSERT((DT_NUM_INST_STATUS_OKAY(maxim_max695x)) == 1,
- "Only one instance of maxim,max695x should be defined");
+#define PORT80_I2C_ADDR DT_REG_ADDR(DT_NODELABEL(seven_seg_display))
#endif
#undef CONFIG_CMD_SEVEN_SEG_DISPLAY
@@ -2499,16 +2401,6 @@ BUILD_ASSERT((DT_NUM_INST_STATUS_OKAY(maxim_max695x)) == 1,
#define CONFIG_HIBERNATE_PSL
#endif
-#ifdef CONFIG_PLATFORM_EC_HIBERNATE_DELAY_SEC
-#undef CONFIG_HIBERNATE_DELAY_SEC
-#define CONFIG_HIBERNATE_DELAY_SEC CONFIG_PLATFORM_EC_HIBERNATE_DELAY_SEC
-#endif
-
-#undef CONFIG_HIBERNATE
-#ifdef CONFIG_PLATFORM_EC_HIBERNATE
-#define CONFIG_HIBERNATE
-#endif
-
#undef CONFIG_BATTERY_DEVICE_CHEMISTRY
#ifdef CONFIG_PLATFORM_EC_USE_BATTERY_DEVICE_CHEMISTRY
#define CONFIG_BATTERY_DEVICE_CHEMISTRY \
@@ -2645,10 +2537,7 @@ BUILD_ASSERT((DT_NUM_INST_STATUS_OKAY(maxim_max695x)) == 1,
#undef CONFIG_MP2964
#ifdef CONFIG_PLATFORM_EC_MP2964
#define CONFIG_MP2964
-#define I2C_ADDR_MP2964_FLAGS \
- DT_REG_ADDR(DT_COMPAT_GET_ANY_STATUS_OKAY(mps_mp2964))
-BUILD_ASSERT((DT_NUM_INST_STATUS_OKAY(mps_mp2964)) == 1,
- "Only one instance of mps,mp2964 should be defined");
+#define I2C_ADDR_MP2964_FLAGS DT_REG_ADDR(DT_NODELABEL(pmic_mp2964))
#endif
#undef CONFIG_ACCELGYRO_ICM_COMM_SPI
diff --git a/zephyr/shim/include/cros_cbi.h b/zephyr/shim/include/cros_cbi.h
index 603be590c1..1f8a1b3dfa 100644
--- a/zephyr/shim/include/cros_cbi.h
+++ b/zephyr/shim/include/cros_cbi.h
@@ -6,16 +6,17 @@
#ifndef __CROS_EC_CROS_CBI_H
#define __CROS_EC_CROS_CBI_H
+#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
-#include <zephyr/kernel.h>
/*
* Macros are _INST_ types, so require DT_DRV_COMPAT to be defined.
*/
-#define DT_DRV_COMPAT cros_ec_cbi_ssfc_value
+#define DT_DRV_COMPAT named_cbi_ssfc_value
+#define CROS_CBI_LABEL "cros_cbi"
-#define CBI_SSFC_VALUE_COMPAT DT_DRV_COMPAT
+#define CBI_SSFC_VALUE_COMPAT named_cbi_ssfc_value
#define CBI_SSFC_VALUE_ID(id) DT_CAT(CBI_SSFC_VALUE_, id)
#define CBI_SSFC_VALUE_ID_WITH_COMMA(id) CBI_SSFC_VALUE_ID(id),
#define CBI_SSFC_VALUE_INST_ENUM(inst, _) \
diff --git a/zephyr/shim/include/fpu.h b/zephyr/shim/include/fpu.h
index 20df108b87..d1e4460827 100644
--- a/zephyr/shim/include/fpu.h
+++ b/zephyr/shim/include/fpu.h
@@ -16,7 +16,7 @@
* This code is taken from core/cortex-m/include/fpu.h
*/
-#ifdef CONFIG_FPU
+#ifdef CONFIG_PLATFORM_EC_FPU
/* Implementation for Cortex-M */
#ifdef CONFIG_CPU_CORTEX_M
@@ -55,12 +55,10 @@ static inline float fabsf(float v)
__asm__("fabs.s %0, %1" : "=f"(abs) : "f"(v));
return abs;
}
-#elif CONFIG_BOARD_NATIVE_POSIX
-#include <math.h>
#else
#error "Unsupported core: please add an implementation"
#endif
-#endif /* CONFIG_FPU */
+#endif /* CONFIG_PLATFORM_EC_FPU */
#endif /* __CROS_EC_MATH_H */
diff --git a/zephyr/shim/include/gpio/gpio.h b/zephyr/shim/include/gpio/gpio.h
index fbe57729fe..7d41c0fa02 100644
--- a/zephyr/shim/include/gpio/gpio.h
+++ b/zephyr/shim/include/gpio/gpio.h
@@ -8,7 +8,6 @@
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
/*
* Validate interrupt flags are valid for the Zephyr GPIO driver.
diff --git a/zephyr/shim/include/motionsense_sensors.h b/zephyr/shim/include/motionsense_sensors.h
index f83a8c63ad..e00eae426e 100644
--- a/zephyr/shim/include/motionsense_sensors.h
+++ b/zephyr/shim/include/motionsense_sensors.h
@@ -6,9 +6,8 @@
#ifndef __CROS_EC_MOTIONSENSE_SENSORS_H
#define __CROS_EC_MOTIONSENSE_SENSORS_H
-#include "motion_sense.h"
-
#include <zephyr/devicetree.h>
+#include "motion_sense.h"
extern struct motion_sensor_t motion_sensors_alt[];
diff --git a/zephyr/shim/include/motionsense_sensors_defs.h b/zephyr/shim/include/motionsense_sensors_defs.h
index b4b0274237..ac0fc6bf56 100644
--- a/zephyr/shim/include/motionsense_sensors_defs.h
+++ b/zephyr/shim/include/motionsense_sensors_defs.h
@@ -6,10 +6,10 @@
#ifndef __CROS_EC_MOTIONSENSE_SENSORS_DEFS_H
#define __CROS_EC_MOTIONSENSE_SENSORS_DEFS_H
-#include "common.h"
-
#include <zephyr/devicetree.h>
+#include "common.h"
+
#define SENSOR_ID(id) DT_CAT(SENSOR_, id)
/* Define the SENSOR_ID if:
diff --git a/zephyr/shim/include/power/power.h b/zephyr/shim/include/power/power.h
index a764e0c8b5..1e780646af 100644
--- a/zephyr/shim/include/power/power.h
+++ b/zephyr/shim/include/power/power.h
@@ -9,10 +9,30 @@
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
-#if CONFIG_CROS_EC_POWER_SIGNAL_LIST
-
#define POWER_SIGNAL_LIST_NODE DT_NODELABEL(power_signal_list)
+#define SYSTEM_DT_POWER_SIGNAL_CONFIG DT_NODE_EXISTS(POWER_SIGNAL_LIST_NODE)
+
+#if (SYSTEM_DT_POWER_SIGNAL_CONFIG)
+
+#define GEN_POWER_SIGNAL_STRUCT_ENTRY_GPIO(cid) \
+ DT_STRING_UPPER_TOKEN(DT_PROP(cid, power_gpio_pin), enum_name)
+#define GEN_POWER_SIGNAL_STRUCT_ENTRY_FLAGS(cid) \
+ (DT_GPIO_FLAGS(DT_PROP(cid, power_gpio_pin), gpios) & \
+ GPIO_ACTIVE_LOW ? \
+ POWER_SIGNAL_ACTIVE_LOW : \
+ POWER_SIGNAL_ACTIVE_HIGH)
+#define GEN_POWER_SIGNAL_STRUCT_ENTRY_NAME(cid) DT_PROP(cid, power_enum_name)
+
+#define GEN_POWER_SIGNAL_STRUCT_ENTRY(cid) \
+ { \
+ .gpio = GEN_POWER_SIGNAL_STRUCT_ENTRY_GPIO(cid), \
+ .flags = GEN_POWER_SIGNAL_STRUCT_ENTRY_FLAGS(cid), \
+ .name = GEN_POWER_SIGNAL_STRUCT_ENTRY_NAME(cid) \
+ }
+#define GEN_POWER_SIGNAL_STRUCT(cid) \
+ [GEN_POWER_SIGNAL_ENUM_ENTRY(cid)] = GEN_POWER_SIGNAL_STRUCT_ENTRY(cid),
+
#define GEN_POWER_SIGNAL_ENUM_ENTRY(cid) \
DT_STRING_UPPER_TOKEN(cid, power_enum_name)
@@ -22,5 +42,13 @@ enum power_signal {
POWER_SIGNAL_COUNT
};
-#endif /* CONFIG_CROS_EC_POWER_SIGNAL_LIST */
+/*
+ * Verify the number of required power-signals are specified in
+ * the DeviceTree
+ */
+#define POWER_SIGNALS_REQUIRED \
+ DT_PROP(POWER_SIGNAL_LIST_NODE, power_signals_required)
+BUILD_ASSERT(POWER_SIGNALS_REQUIRED == POWER_SIGNAL_COUNT);
+
+#endif /* SYSTEM_DT_POWER_SIGNAL_CONFIG */
#endif /* ZEPHYR_CHROME_POWER_POWER_H */
diff --git a/zephyr/shim/include/temp_sensor/temp_sensor.h b/zephyr/shim/include/temp_sensor/temp_sensor.h
index c4770ce767..9be18987eb 100644
--- a/zephyr/shim/include/temp_sensor/temp_sensor.h
+++ b/zephyr/shim/include/temp_sensor/temp_sensor.h
@@ -6,10 +6,9 @@
#ifndef ZEPHYR_SHIM_INCLUDE_TEMP_SENSOR_TEMP_SENSOR_H_
#define ZEPHYR_SHIM_INCLUDE_TEMP_SENSOR_TEMP_SENSOR_H_
-#include "charger/chg_rt9490.h"
-#include "include/temp_sensor.h"
-
#include <zephyr/devicetree.h>
+#include "include/temp_sensor.h"
+#include "charger/chg_rt9490.h"
#ifdef CONFIG_PLATFORM_EC_TEMP_SENSOR
@@ -144,7 +143,6 @@ enum tmp112_sensor {
struct zephyr_temp_sensor {
/* Read sensor value in K into temp_ptr; return non-zero if error. */
int (*read)(const struct temp_sensor_t *sensor, int *temp_ptr);
- void (*update_temperature)(int idx);
const struct thermistor_info *thermistor;
#if ANY_INST_HAS_POWER_GOOD_PIN
const struct device *power_good_dev;
diff --git a/zephyr/shim/include/usbc/bc12_rt9490.h b/zephyr/shim/include/usbc/bc12_rt9490.h
index c4323728f9..a9371ddeea 100644
--- a/zephyr/shim/include/usbc/bc12_rt9490.h
+++ b/zephyr/shim/include/usbc/bc12_rt9490.h
@@ -5,7 +5,7 @@
#include "driver/charger/rt9490.h"
-#define RT9490_BC12_COMPAT richtek_rt9490
+#define RT9490_BC12_COMPAT richtek_rt9490_bc12
#define BC12_CHIP_RT9490(id) \
{ \
diff --git a/zephyr/shim/include/usbc/ppc.h b/zephyr/shim/include/usbc/ppc.h
index fa38145f66..28e518a3ef 100644
--- a/zephyr/shim/include/usbc/ppc.h
+++ b/zephyr/shim/include/usbc/ppc.h
@@ -6,16 +6,15 @@
#ifndef ZEPHYR_CHROME_USBC_PPC_H
#define ZEPHYR_CHROME_USBC_PPC_H
-#include "usbc/ppc_nx20p348x.h"
+#include <zephyr/device.h>
+#include <zephyr/devicetree.h>
#include "usbc/ppc_rt1739.h"
+#include "usbc/ppc_nx20p348x.h"
#include "usbc/ppc_sn5s330.h"
#include "usbc/ppc_syv682x.h"
#include "usbc/utils.h"
#include "usbc_ppc.h"
-#include <zephyr/device.h>
-#include <zephyr/devicetree.h>
-
extern struct ppc_config_t ppc_chips_alt[];
#define ALT_PPC_CHIP_CHK(usbc_id, usb_port_num) \
diff --git a/zephyr/shim/include/usbc/tcpc_anx7447.h b/zephyr/shim/include/usbc/tcpc_anx7447.h
index 89076c8c49..b45e03393c 100644
--- a/zephyr/shim/include/usbc/tcpc_anx7447.h
+++ b/zephyr/shim/include/usbc/tcpc_anx7447.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "tcpm/anx7447_public.h"
-
#include <zephyr/devicetree.h>
+#include "tcpm/anx7447_public.h"
#define ANX7447_TCPC_COMPAT analogix_anx7447_tcpc
diff --git a/zephyr/shim/include/usbc/tcpc_anx7447_emul.h b/zephyr/shim/include/usbc/tcpc_anx7447_emul.h
index 3367286dd9..78322a7329 100644
--- a/zephyr/shim/include/usbc/tcpc_anx7447_emul.h
+++ b/zephyr/shim/include/usbc/tcpc_anx7447_emul.h
@@ -3,11 +3,10 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/anx7447_public.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/anx7447_public.h"
-#define ANX7447_EMUL_COMPAT cros_anx7447_tcpc_emul
+#define ANX7447_EMUL_COMPAT cros_anx7447_emul
#define TCPC_CONFIG_ANX7447_EMUL(id) \
{ \
diff --git a/zephyr/shim/include/usbc/tcpc_ccgxxf.h b/zephyr/shim/include/usbc/tcpc_ccgxxf.h
index fb7bdcabcf..0c02cf6846 100644
--- a/zephyr/shim/include/usbc/tcpc_ccgxxf.h
+++ b/zephyr/shim/include/usbc/tcpc_ccgxxf.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/ccgxxf.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/ccgxxf.h"
#define CCGXXF_TCPC_COMPAT cypress_ccgxxf
diff --git a/zephyr/shim/include/usbc/tcpc_fusb302.h b/zephyr/shim/include/usbc/tcpc_fusb302.h
index fa309051cd..a2e512d938 100644
--- a/zephyr/shim/include/usbc/tcpc_fusb302.h
+++ b/zephyr/shim/include/usbc/tcpc_fusb302.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/fusb302.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/fusb302.h"
#define FUSB302_TCPC_COMPAT fairchild_fusb302
diff --git a/zephyr/shim/include/usbc/tcpc_generic_emul.h b/zephyr/shim/include/usbc/tcpc_generic_emul.h
index 9000dfdf20..7dc46c51ba 100644
--- a/zephyr/shim/include/usbc/tcpc_generic_emul.h
+++ b/zephyr/shim/include/usbc/tcpc_generic_emul.h
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/tcpci.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/tcpci.h"
+
#define TCPCI_EMUL_COMPAT cros_tcpci_generic_emul
#define TCPC_CONFIG_TCPCI_EMUL(id) \
diff --git a/zephyr/shim/include/usbc/tcpc_it8xxx2.h b/zephyr/shim/include/usbc/tcpc_it8xxx2.h
index b9084782e0..c619656667 100644
--- a/zephyr/shim/include/usbc/tcpc_it8xxx2.h
+++ b/zephyr/shim/include/usbc/tcpc_it8xxx2.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/it8xxx2_pd_public.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/it8xxx2_pd_public.h"
#define IT8XXX2_TCPC_COMPAT ite_it8xxx2_usbpd
diff --git a/zephyr/shim/include/usbc/tcpc_nct38xx.h b/zephyr/shim/include/usbc/tcpc_nct38xx.h
index 7a0752904e..87ba3379c8 100644
--- a/zephyr/shim/include/usbc/tcpc_nct38xx.h
+++ b/zephyr/shim/include/usbc/tcpc_nct38xx.h
@@ -6,9 +6,8 @@
#ifndef __CROS_EC_TCPC_NCT38XX_H
#define __CROS_EC_TCPC_NCT38XX_H
-#include "driver/tcpm/nct38xx.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/nct38xx.h"
#define NCT38XX_TCPC_COMPAT nuvoton_nct38xx
diff --git a/zephyr/shim/include/usbc/tcpc_ps8xxx.h b/zephyr/shim/include/usbc/tcpc_ps8xxx.h
index 7d3b9c6ccc..1a457af09b 100644
--- a/zephyr/shim/include/usbc/tcpc_ps8xxx.h
+++ b/zephyr/shim/include/usbc/tcpc_ps8xxx.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/ps8xxx_public.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/ps8xxx_public.h"
#define PS8XXX_COMPAT parade_ps8xxx
diff --git a/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h b/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h
index b1ea6f1705..fbd2e4bfd1 100644
--- a/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h
+++ b/zephyr/shim/include/usbc/tcpc_ps8xxx_emul.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/ps8xxx_public.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/ps8xxx_public.h"
#define PS8XXX_EMUL_COMPAT cros_ps8xxx_emul
diff --git a/zephyr/shim/include/usbc/tcpc_raa489000.h b/zephyr/shim/include/usbc/tcpc_raa489000.h
deleted file mode 100644
index 47e7706ae1..0000000000
--- a/zephyr/shim/include/usbc/tcpc_raa489000.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "driver/tcpm/raa489000.h"
-
-#include <zephyr/devicetree.h>
-
-#define RAA489000_TCPC_COMPAT renesas_raa489000
-
-#define TCPC_CONFIG_RAA489000(id) \
- { \
- .bus_type = EC_BUS_TYPE_I2C, \
- .i2c_info = { \
- .port = I2C_PORT_BY_DEV(id), \
- .addr_flags = DT_REG_ADDR(id), \
- }, \
- .drv = &raa489000_tcpm_drv, \
- .flags = DT_PROP(id, tcpc_flags), \
- },
diff --git a/zephyr/shim/include/usbc/tcpc_rt1718s.h b/zephyr/shim/include/usbc/tcpc_rt1718s.h
index 861b474ecf..794fb99480 100644
--- a/zephyr/shim/include/usbc/tcpc_rt1718s.h
+++ b/zephyr/shim/include/usbc/tcpc_rt1718s.h
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "tcpm/rt1718s_public.h"
-
#include <zephyr/devicetree.h>
+#include "tcpm/rt1718s_public.h"
#define RT1718S_TCPC_COMPAT richtek_rt1718s_tcpc
diff --git a/zephyr/shim/include/usbc/tcpci.h b/zephyr/shim/include/usbc/tcpci.h
index 15cea4b332..67138dbe99 100644
--- a/zephyr/shim/include/usbc/tcpci.h
+++ b/zephyr/shim/include/usbc/tcpci.h
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/tcpci.h"
-
#include <zephyr/devicetree.h>
+#include "driver/tcpm/tcpci.h"
+
#define TCPCI_COMPAT cros_ec_tcpci
#define TCPC_CONFIG_TCPCI(id) \
diff --git a/zephyr/shim/include/usbc/usb_muxes.h b/zephyr/shim/include/usbc/usb_muxes.h
index 6ee9c691a8..f94aed488d 100644
--- a/zephyr/shim/include/usbc/usb_muxes.h
+++ b/zephyr/shim/include/usbc/usb_muxes.h
@@ -6,6 +6,8 @@
#ifndef ZEPHYR_CHROME_USBC_USB_MUXES_H
#define ZEPHYR_CHROME_USBC_USB_MUXES_H
+#include <zephyr/devicetree.h>
+#include <zephyr/sys/util_macro.h>
#include "usb_mux.h"
#include "usbc/amd_fp6_usb_mux.h"
#include "usbc/anx7447_usb_mux.h"
@@ -19,9 +21,6 @@
#include "usbc/utils.h"
#include "usbc/virtual_usb_mux.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/sys/util_macro.h>
-
/**
* @brief List of USB mux drivers compatibles and their configurations. Each
* element of list has to have (compatible, config) format.
@@ -178,14 +177,14 @@
* @brief Set struct usb_mux fields common for all USB muxes and alter flags
*
* @param mux_id USB mux node ID
- * @param flags_mask Mask for bits that should be ignored in flags property
+ * @param flags_mask Mask for bits that should be igonred in flags property
* @param flags_val Value that should be used instead for masked bits
*/
#define USB_MUX_COMMON_FIELDS_WITH_FLAGS(mux_id, flags_mask, flags_val) \
.usb_port = USB_MUX_PORT(mux_id), \
.board_init = USB_MUX_CALLBACK_OR_NULL(mux_id, board_init), \
.board_set = USB_MUX_CALLBACK_OR_NULL(mux_id, board_set), \
- .flags = (DT_PROP_OR(mux_id, flags, 0) & ~(flags_mask)) | (flags_val)
+ .flags = (DT_PROP(mux_id, flags) & ~(flags_mask)) | (flags_val)
/**
* @brief Set struct usb_mux fields common for all USB muxes
diff --git a/zephyr/shim/include/zephyr_hooks_shim.h b/zephyr/shim/include/zephyr_hooks_shim.h
index f1c25c6e8f..f3949787bd 100644
--- a/zephyr/shim/include/zephyr_hooks_shim.h
+++ b/zephyr/shim/include/zephyr_hooks_shim.h
@@ -8,12 +8,12 @@
#endif
#define __CROS_EC_ZEPHYR_HOOKS_SHIM_H
-#include "common.h"
-#include "cros_version.h"
-
#include <zephyr/init.h>
#include <zephyr/kernel.h>
+#include "common.h"
+#include "cros_version.h"
+
/**
* The internal data structure stored for a deferred function.
*/
diff --git a/zephyr/shim/include/zephyr_host_command.h b/zephyr/shim/include/zephyr_host_command.h
index 9271c6c368..e2f0a7c296 100644
--- a/zephyr/shim/include/zephyr_host_command.h
+++ b/zephyr/shim/include/zephyr_host_command.h
@@ -10,9 +10,8 @@
#endif
#define __CROS_EC_ZEPHYR_HOST_COMMAND_H
-#include <stdbool.h>
-
#include <zephyr/init.h>
+#include <stdbool.h>
/* Initializes and runs the host command handler loop. */
void host_command_task(void *u);
diff --git a/zephyr/shim/include/zephyr_shim.h b/zephyr/shim/include/zephyr_shim.h
index dce1706c5b..3e12568155 100644
--- a/zephyr/shim/include/zephyr_shim.h
+++ b/zephyr/shim/include/zephyr_shim.h
@@ -6,9 +6,8 @@
#ifndef __BOARD_H
#define __BOARD_H
-#include "common.h"
-
#include <zephyr/devicetree.h>
+#include "common.h"
/* Included shimed version of gpio signal. */
#include "gpio_signal.h"
diff --git a/zephyr/shim/include/zephyr_write_protect.h b/zephyr/shim/include/zephyr_write_protect.h
index 59a305a0f9..227af16bd0 100644
--- a/zephyr/shim/include/zephyr_write_protect.h
+++ b/zephyr/shim/include/zephyr_write_protect.h
@@ -8,7 +8,6 @@
#include "gpio/gpio_int.h"
#include "gpio_signal.h"
-
#include <zephyr/drivers/gpio.h>
/**
diff --git a/zephyr/shim/src/CMakeLists.txt b/zephyr/shim/src/CMakeLists.txt
index 543c2b2303..97968e8a52 100644
--- a/zephyr/shim/src/CMakeLists.txt
+++ b/zephyr/shim/src/CMakeLists.txt
@@ -5,7 +5,9 @@
zephyr_library_sources(console.c)
zephyr_library_sources(crc.c)
zephyr_library_sources(gpio.c)
+zephyr_library_sources(gpio_id.c)
zephyr_library_sources(gpio_int.c)
+zephyr_library_sources(power.c)
add_subdirectory("cbi")
add_subdirectory("led_driver")
@@ -29,8 +31,6 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI
espi.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN fan.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FLASH_CROS flash.c)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_GPIO_ID
- gpio_id.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_HOOKS hooks.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD host_command.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE
@@ -42,22 +42,20 @@ if (NOT DEFINED CONFIG_PLATFORM_EC_KEYBOARD_DISCRETE)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD
keyboard_raw.c)
endif()
-zephyr_library_sources_ifdef(CONFIG_CROS_EC_KEYSCAN keyscan.c)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_KEYBOARD keyscan.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LOG_BACKEND_CONSOLE_BUFFER
log_backend_console_buffer.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MKBP_EVENT mkbp_event.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_MOTIONSENSE
motionsense_sensors.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_PANIC panic.c)
-zephyr_library_sources_ifdef(CONFIG_CROS_EC_POWER_SIGNAL_LIST
- power.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_PWM_HC pwm_hc.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_PWM pwm_led.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_RTC rtc.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_SWITCHCAP_GPIO
- switchcap_gpio.c)
-zephyr_library_sources_ifdef(CONFIG_CROS_EC_SWITCHCAP_LN9310
- switchcap_ln9310.c)
+ switchcap_gpio.c)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_SWITCHCAP_LN9310
+ switchcap_ln9310.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_TEMP_SENSOR temp_sensors.c
thermal.c)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_TIMER hwtimer.c)
diff --git a/zephyr/shim/src/adc.c b/zephyr/shim/src/adc.c
index b448823eee..9d5e64376c 100644
--- a/zephyr/shim/src/adc.c
+++ b/zephyr/shim/src/adc.c
@@ -3,12 +3,11 @@
* found in the LICENSE file.
*/
-#include "adc.h"
-#include "zephyr_adc.h"
-
#include <zephyr/devicetree/io-channels.h>
#include <zephyr/drivers/adc.h>
#include <zephyr/logging/log.h>
+#include "adc.h"
+#include "zephyr_adc.h"
LOG_MODULE_REGISTER(shim_adc, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/src/battery.c b/zephyr/shim/src/battery.c
index 8485f1314e..98c0877770 100644
--- a/zephyr/shim/src/battery.c
+++ b/zephyr/shim/src/battery.c
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "battery_fuel_gauge.h"
-
#include <zephyr/devicetree.h>
+#include "battery_fuel_gauge.h"
+
#define NODE_FUEL_GAUGE(node) \
{ \
.manuf_name = DT_PROP(node, manuf_name), \
@@ -17,7 +17,7 @@
.reg_data = DT_PROP(node, ship_mode_reg_data), \
}, \
.sleep_mode = { \
- .sleep_supported = DT_PROP_OR(node, sleep_mode_support, 0), \
+ .sleep_supported = DT_PROP_OR(node, sleep_mode_supported, 0), \
.reg_addr = DT_PROP_OR(node, sleep_mode_reg_addr, 0), \
.reg_data = DT_PROP_OR(node, sleep_mode_reg_data, 0), \
}, \
diff --git a/zephyr/shim/src/bb_retimer_usb_mux.c b/zephyr/shim/src/bb_retimer_usb_mux.c
index b0e3944528..c40068211e 100644
--- a/zephyr/shim/src/bb_retimer_usb_mux.c
+++ b/zephyr/shim/src/bb_retimer_usb_mux.c
@@ -1,13 +1,18 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/sys/util_macro.h>
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/sys/util_macro.h>
+/**
+ * This prevents creating struct usb_mux bb_controls[] for platforms that didn't
+ * migrate USB mux configuration to DTS yet.
+ */
+#if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_usb_mux_chain)
BB_RETIMER_CHECK_SAME_CONTROLS(BB_RETIMER_INSTANCES_LIST)
@@ -30,3 +35,5 @@ BB_RETIMER_CHECK_SAME_CONTROLS(BB_RETIMER_INSTANCES_LIST)
BB_CONTROLS_CONST struct bb_usb_control bb_controls[] = {
USB_MUX_BB_RETIMERS_CONTROLS_ARRAY
};
+
+#endif /* #if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_usb_mux_chain) */
diff --git a/zephyr/shim/src/bc12.c b/zephyr/shim/src/bc12.c
index 12b45d2197..6542a166eb 100644
--- a/zephyr/shim/src/bc12.c
+++ b/zephyr/shim/src/bc12.c
@@ -3,15 +3,14 @@
* found in the LICENSE file.
*/
-#include "usb_charge.h"
+#include <zephyr/devicetree.h>
#include "usbc/bc12_pi3usb9201.h"
#include "usbc/bc12_rt1718s.h"
#include "usbc/bc12_rt1739.h"
#include "usbc/bc12_rt9490.h"
#include "usbc/tcpc_rt1718s.h"
#include "usbc/utils.h"
-
-#include <zephyr/devicetree.h>
+#include "usb_charge.h"
#if DT_HAS_COMPAT_STATUS_OKAY(RT1718S_BC12_COMPAT) || \
DT_HAS_COMPAT_STATUS_OKAY(RT1739_BC12_COMPAT) || \
diff --git a/zephyr/shim/src/bc12_pi3usb9201.c b/zephyr/shim/src/bc12_pi3usb9201.c
index d41fcc3212..25d1962ff2 100644
--- a/zephyr/shim/src/bc12_pi3usb9201.c
+++ b/zephyr/shim/src/bc12_pi3usb9201.c
@@ -5,16 +5,20 @@
#define DT_DRV_COMPAT pericom_pi3usb9201
+#include <zephyr/devicetree.h>
#include "bc12/pi3usb9201_public.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
-#include "i2c/i2c.h"
#include "task.h"
#include "usb_charge.h"
#include "usb_pd.h"
#include "usbc/utils.h"
+#include "i2c/i2c.h"
-#include <zephyr/devicetree.h>
+#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
+
+BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) > 0,
+ "No compatible BC1.2 instance found");
#define USBC_PORT_BC12(usbc_id, bc12_id) \
[USBC_PORT_NEW(usbc_id)] = { \
@@ -52,3 +56,5 @@ void usb1_evt(enum gpio_signal signal)
usb_charger_task_set_event(1, USB_CHG_EVENT_BC12);
}
#endif
+
+#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
diff --git a/zephyr/shim/src/bc12_rt9490.c b/zephyr/shim/src/bc12_rt9490.c
index a3c97e7faf..df10fb5570 100644
--- a/zephyr/shim/src/bc12_rt9490.c
+++ b/zephyr/shim/src/bc12_rt9490.c
@@ -3,14 +3,15 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT richtek_rt9490
+#define DT_DRV_COMPAT richtek_rt9490_bc12
+#include <zephyr/devicetree.h>
#include "driver/charger/rt9490.h"
#include "gpio/gpio_int.h"
#include "hooks.h"
#include "usbc/utils.h"
-#include <zephyr/devicetree.h>
+#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
static void rt9490_bc12_enable_irqs(void)
{
@@ -41,3 +42,5 @@ void rt9490_bc12_dt_interrupt(enum gpio_signal signal)
break;
}
}
+
+#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
diff --git a/zephyr/shim/src/cbi/CMakeLists.txt b/zephyr/shim/src/cbi/CMakeLists.txt
index a5d3894ad0..4b14f0bb1d 100644
--- a/zephyr/shim/src/cbi/CMakeLists.txt
+++ b/zephyr/shim/src/cbi/CMakeLists.txt
@@ -1,6 +1,9 @@
# SPDX-License-Identifier: Apache-2.0
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI cros_cbi.c
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_EEPROM cbi_eeprom.c
+ cros_cbi.c
+ cros_cbi_fw_config.c
+ cros_cbi_ssfc.c)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_GPIO cros_cbi.c
cros_cbi_fw_config.c
cros_cbi_ssfc.c)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CBI_EEPROM cbi_eeprom.c)
diff --git a/zephyr/shim/src/cbi/cbi_eeprom.c b/zephyr/shim/src/cbi/cbi_eeprom.c
index 9cd0d0a955..aa6c4e0fa1 100644
--- a/zephyr/shim/src/cbi/cbi_eeprom.c
+++ b/zephyr/shim/src/cbi/cbi_eeprom.c
@@ -3,16 +3,15 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "cros_board_info.h"
-#include "write_protect.h"
-
#include <zephyr/drivers/eeprom.h>
#include <zephyr/drivers/gpio.h>
-#define CBI_EEPROM_NODE DT_NODELABEL(cbi_eeprom)
+#include "console.h"
+#include "cros_board_info.h"
+#include "write_protect.h"
-BUILD_ASSERT(DT_NODE_EXISTS(CBI_EEPROM_NODE), "cbi_eeprom node not defined");
+#if DT_NODE_EXISTS(DT_NODELABEL(cbi_eeprom))
+#define CBI_EEPROM_DEV DEVICE_DT_GET(DT_NODELABEL(cbi_eeprom))
#ifdef CONFIG_PLATFORM_EC_EEPROM_CBI_WP
#if !DT_NODE_EXISTS(DT_ALIAS(gpio_cbi_wp))
@@ -26,39 +25,22 @@ void cbi_latch_eeprom_wp(void)
}
#endif /* CONFIG_PLATFORM_EC_EEPROM_CBI_WP */
-test_mockable_static int eeprom_load(uint8_t offset, uint8_t *data, int len)
+static int eeprom_load(uint8_t offset, uint8_t *data, int len)
{
- const struct device *dev;
-
- dev = DEVICE_DT_GET(CBI_EEPROM_NODE);
-
- if (!device_is_ready(dev)) {
- return -ENODEV;
- }
-
- return eeprom_read(dev, offset, data, len);
+ return eeprom_read(CBI_EEPROM_DEV, offset, data, len);
}
static int eeprom_is_write_protected(void)
{
- if (IS_ENABLED(CONFIG_PLATFORM_EC_BYPASS_CBI_EEPROM_WP_CHECK)) {
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_BYPASS_CBI_EEPROM_WP_CHECK))
return 0;
- }
return write_protect_is_asserted();
}
static int eeprom_store(uint8_t *cbi)
{
- const struct device *dev;
-
- dev = DEVICE_DT_GET(CBI_EEPROM_NODE);
-
- if (!device_is_ready(dev)) {
- return -ENODEV;
- }
-
- return eeprom_write(dev, 0, cbi,
+ return eeprom_write(CBI_EEPROM_DEV, 0, cbi,
((struct cbi_header *)cbi)->total_size);
}
@@ -72,3 +54,4 @@ const struct cbi_storage_config_t cbi_config = {
.storage_type = CBI_STORAGE_TYPE_EEPROM,
.drv = &eeprom_drv,
};
+#endif
diff --git a/zephyr/shim/src/cbi/cros_cbi.c b/zephyr/shim/src/cbi/cros_cbi.c
index e6fa3e8cd1..5b90f9442d 100644
--- a/zephyr/shim/src/cbi/cros_cbi.c
+++ b/zephyr/shim/src/cbi/cros_cbi.c
@@ -3,8 +3,9 @@
* found in the LICENSE file.
*/
-#include "cros_board_info.h"
#include "cros_cbi.h"
+
+#include "cros_board_info.h"
#include "hooks.h"
static void cros_cbi_ec_init(void)
diff --git a/zephyr/shim/src/cbi/cros_cbi_fw_config.c b/zephyr/shim/src/cbi/cros_cbi_fw_config.c
index 8f6086eb58..6710a30726 100644
--- a/zephyr/shim/src/cbi/cros_cbi_fw_config.c
+++ b/zephyr/shim/src/cbi/cros_cbi_fw_config.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(cros_cbi_fw_config, LOG_LEVEL_ERR);
/*
@@ -47,13 +47,13 @@ LOG_MODULE_REGISTER(cros_cbi_fw_config, LOG_LEVEL_ERR);
#define FW_SHIFT_MASK(id) (FW_MASK(id) << FW_START(id))
/*
- * For a child "cros-ec,cbi-fw-config-value" node, retrieve the
+ * For a child "named-cbi-fw-config-value" node, retrieve the
* size of the parent field this value is associated with.
*/
#define FW_PARENT_SIZE(id) DT_PROP(DT_PARENT(id), size)
/*
- * For a child "cros-ec,cbi-fw-config-value" node, retrieve the
+ * For a child "named-cbi-fw-config-value" node, retrieve the
* start of the parent field this value is associated with.
*/
#define FW_PARENT_START(id) DT_PROP(DT_PARENT(id), start)
@@ -115,7 +115,7 @@ DT_FOREACH_STATUS_OKAY(CBI_FW_CONFIG_VALUE_COMPAT, FW_VALUE_BUILD_ASSERT)
/*
* Define bit fields based on the device tree entries. Example:
* cbi-fw-config {
- * compatible = "cros-ec,cbi-fw-config";
+ * compatible = "named-cbi-fw-config";
*
* fan {
* enum-name = "FW_CONFIG_FAN";
@@ -123,7 +123,7 @@ DT_FOREACH_STATUS_OKAY(CBI_FW_CONFIG_VALUE_COMPAT, FW_VALUE_BUILD_ASSERT)
* size = <1>;
* fan_present {
* enum-name = "FW_FAN_PRESENT"
- * compatible = "cros-ec,cbi-fw-config-value";
+ * compatible = "named-cbi-fw-config-value";
* value = <1>;
* };
* };
@@ -148,7 +148,7 @@ DT_FOREACH_STATUS_OKAY(CBI_FW_CONFIG_VALUE_COMPAT, FW_VALUE_BUILD_ASSERT)
break;
/*
- * Create a case for every child of this "cros-ec,cbi-fw-config" node.
+ * Create a case for every child of this "named-cbi-fw-config" node.
*/
#define FW_FIELD_NODES(inst, cached, value) \
DT_FOREACH_CHILD_STATUS_OKAY_VARGS(inst, FW_FIELD_CASE, cached, value)
@@ -177,7 +177,7 @@ static int cros_cbi_fw_config_get_field(uint32_t cached_fw_config,
{
switch (field_id) {
/*
- * Iterate through all the the "cros-ec,cbi-fw-config" nodes,
+ * Iterate through all the the "named-cbi-fw-config" nodes,
* and create cases for all of their child nodes.
*/
DT_FOREACH_STATUS_OKAY_VARGS(CBI_FW_CONFIG_COMPAT,
diff --git a/zephyr/shim/src/cbi/cros_cbi_ssfc.c b/zephyr/shim/src/cbi/cros_cbi_ssfc.c
index f20ca457f4..eb0f69b1cb 100644
--- a/zephyr/shim/src/cbi/cros_cbi_ssfc.c
+++ b/zephyr/shim/src/cbi/cros_cbi_ssfc.c
@@ -3,24 +3,25 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(cros_cbi_ssfc, LOG_LEVEL_ERR);
-/* Actually, two "compatible" values are handle here - cros_ec_cbi_ssfc_value
- * and cros_ec_cbi_ssfc. cros_ec_cbi_ssfc_value nodes are grandchildren of the
- * cros_ec_cbi_ssfc node. cros_ec_cbi_ssfc_value is introduced to iterate over
- * grandchildren of the cros_ec_cbi_ssfc (macro DT_FOREACH_CHILD can not be
- * nested) and it can be pointed by a sensor dts to indicate alternative usage.
+/* Actually, two "compatible" values are handle here -
+ * named_cbi_ssfc_value and named_cbi_ssfc. named_cbi_ssfc_value nodes are
+ * grandchildren of the named_cbi_ssfc node. named_cbi_ssfc_value is introduced
+ * to iterate over grandchildren of the named_cbi_ssfc(macro
+ * DT_FOREACH_CHILD can not be nested) and it can be pointed by a sensor dts to
+ * indicate alternative usage.
*/
-#define DT_DRV_COMPAT cros_ec_cbi_ssfc_value
+#define DT_DRV_COMPAT named_cbi_ssfc_value
-BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(cros_ec_cbi_ssfc) < 2,
+BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(named_cbi_ssfc) < 2,
"More than 1 CBI SSFS node");
-#define CBI_SSFC_NODE DT_INST(0, cros_ec_cbi_ssfc)
+#define CBI_SSFC_NODE DT_INST(0, named_cbi_ssfc)
#define CBI_SSFC_INIT_DEFAULT_ID(id, ssfc) \
do { \
@@ -72,13 +73,13 @@ BUILD_ASSERT(CBI_SSFC_FIELDS_SIZE <= 32, "CBI SSFS is bigger than 32 bits");
/*
* Define union bit fields based on the device tree entries. Example:
* cbi-ssfc {
- * compatible = "cros-ec,cbi-ssfc";
+ * compatible = "named-cbi-ssfc";
*
* base_sensor {
* enum-name = "BASE_SENSOR";
* size = <3>;
* bmi160 {
- * compatible = "cros-ec,cbi-ssfc-value";
+ * compatible = "named-cbi-ssfc-value";
* status = "okay";
* value = <1>;
* };
@@ -87,7 +88,7 @@ BUILD_ASSERT(CBI_SSFC_FIELDS_SIZE <= 32, "CBI SSFS is bigger than 32 bits");
* enum-name = "LID_SENSOR";
* size = <3>;
* bma255 {
- * compatible = "cros-ec,cbi-ssfc-value";
+ * compatible = "named-cbi-ssfc-value";
* status = "okay";
* value = <1>;
* };
@@ -96,7 +97,7 @@ BUILD_ASSERT(CBI_SSFC_FIELDS_SIZE <= 32, "CBI SSFS is bigger than 32 bits");
* enum-name = "LIGHTBAR";
* size = <2>;
* 10_led {
- * compatible = "cros-ec,cbi-ssfc-value";
+ * compatible = "named-cbi-ssfc-value";
* status = "okay";
* value = <1>;
* };
diff --git a/zephyr/shim/src/charger.c b/zephyr/shim/src/charger.c
index 9d6021ad7d..35ede5a8f7 100644
--- a/zephyr/shim/src/charger.c
+++ b/zephyr/shim/src/charger.c
@@ -4,6 +4,7 @@
*/
#include "charger.h"
+#include <zephyr/devicetree.h>
#include "charger/chg_bq25710.h"
#include "charger/chg_isl923x.h"
#include "charger/chg_isl9241.h"
@@ -11,8 +12,6 @@
#include "charger/chg_sm5803.h"
#include "usbc/utils.h"
-#include <zephyr/devicetree.h>
-
#define CHG_CHIP_ENTRY(usbc_id, chg_id, config_fn) \
[USBC_PORT_NEW(usbc_id)] = config_fn(chg_id)
diff --git a/zephyr/shim/src/chipset_api.c b/zephyr/shim/src/chipset_api.c
index 925d13f6e1..6c48719a7f 100644
--- a/zephyr/shim/src/chipset_api.c
+++ b/zephyr/shim/src/chipset_api.c
@@ -5,9 +5,10 @@
/* Chipset interface APIs */
+#include "common.h"
+
#include "ap_power/ap_power_interface.h"
#include "chipset_state_check.h"
-#include "common.h"
int chipset_in_state(int state_mask)
{
diff --git a/zephyr/shim/src/chipset_state_check.h b/zephyr/shim/src/chipset_state_check.h
index c33a3f9553..2d10b2ce4a 100644
--- a/zephyr/shim/src/chipset_state_check.h
+++ b/zephyr/shim/src/chipset_state_check.h
@@ -6,8 +6,8 @@
#ifndef __CHIPSET_STATE_CHECK_H__
#define __CHIPSET_STATE_CHECK_H__
-#include "ap_power/ap_power_interface.h"
#include "chipset.h"
+#include "ap_power/ap_power_interface.h"
BUILD_ASSERT((int)AP_POWER_STATE_HARD_OFF == (int)CHIPSET_STATE_HARD_OFF);
BUILD_ASSERT((int)AP_POWER_STATE_SOFT_OFF == (int)CHIPSET_STATE_SOFT_OFF);
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index fa6dc5a613..4ac8e249cb 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -3,6 +3,20 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <zephyr/drivers/uart.h>
+#include <zephyr/shell/shell.h>
+#ifdef CONFIG_SHELL_BACKEND_DUMMY /* nocheck */
+#include <zephyr/shell/shell_dummy.h> /* nocheck */
+#endif
+#include <zephyr/shell/shell_uart.h>
+#include <stdbool.h>
+#include <string.h>
+#include <zephyr/sys/printk.h>
+#include <zephyr/sys/ring_buffer.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+
/*
* TODO(b/238433667): Include EC printf functions
* (crec_vsnprintf/crec_snprintf) until we switch to the standard
@@ -16,21 +30,6 @@
#include "usb_console.h"
#include "zephyr_console_shim.h"
-#include <stdbool.h>
-#include <string.h>
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/uart.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/shell/shell.h>
-#ifdef CONFIG_SHELL_BACKEND_DUMMY /* nocheck */
-#include <zephyr/shell/shell_dummy.h> /* nocheck */
-#endif
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/sys/printk.h>
-#include <zephyr/sys/ring_buffer.h>
-
#if !defined(CONFIG_SHELL_BACKEND_SERIAL) && \
!defined(CONFIG_SHELL_BACKEND_DUMMY) /* nocheck */
#error Must select either CONFIG_SHELL_BACKEND_SERIAL or \
@@ -322,7 +321,7 @@ void uart_write_char(char c)
{
uart_poll_out(uart_shell_dev, c);
- if (IS_ENABLED(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE) && !k_is_in_isr())
+ if (IS_ENABLED(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE))
console_buf_notify_chars(&c, 1);
}
diff --git a/zephyr/shim/src/console_buffer.c b/zephyr/shim/src/console_buffer.c
index f5e80b2d20..dad0031267 100644
--- a/zephyr/shim/src/console_buffer.c
+++ b/zephyr/shim/src/console_buffer.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+
#include "common.h"
#include "console.h"
#include "ec_commands.h"
-#include <zephyr/kernel.h>
-
static char console_buf[CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE_BUF_SIZE];
static uint32_t previous_snapshot_idx;
static uint32_t current_snapshot_idx;
diff --git a/zephyr/shim/src/crc.c b/zephyr/shim/src/crc.c
index 1e98c1cf3f..f8ce335029 100644
--- a/zephyr/shim/src/crc.c
+++ b/zephyr/shim/src/crc.c
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "crc8.h"
-
#include <zephyr/sys/crc.h>
+#include "crc8.h"
+
/* Polynomial representation for x^8 + x^2 + x + 1 is 0x07 */
#define SMBUS_POLYNOMIAL 0x07
diff --git a/zephyr/shim/src/espi.c b/zephyr/shim/src/espi.c
index 9cc5de8f0b..6a8e18e262 100644
--- a/zephyr/shim/src/espi.c
+++ b/zephyr/shim/src/espi.c
@@ -3,6 +3,17 @@
* found in the LICENSE file.
*/
+#include <atomic.h>
+#include <zephyr/device.h>
+#include <zephyr/drivers/espi.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
+#include <stdint.h>
+
+#include <ap_power/ap_power.h>
+#include <ap_power/ap_power_events.h>
+#include <ap_power/ap_power_espi.h>
#include "acpi.h"
#include "chipset.h"
#include "common.h"
@@ -17,19 +28,6 @@
#include "timer.h"
#include "zephyr_espi_shim.h"
-#include <stdint.h>
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/espi.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <ap_power/ap_power.h>
-#include <ap_power/ap_power_espi.h>
-#include <ap_power/ap_power_events.h>
-#include <atomic.h>
-
#define VWIRE_PULSE_TRIGGER_TIME \
CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_DEFAULT_VW_WIDTH_US
diff --git a/zephyr/shim/src/fan.c b/zephyr/shim/src/fan.c
index 9978e6f4ca..c7074b0c4d 100644
--- a/zephyr/shim/src/fan.c
+++ b/zephyr/shim/src/fan.c
@@ -5,6 +5,12 @@
#define DT_DRV_COMPAT cros_ec_fans
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/pwm.h>
+#include <zephyr/drivers/sensor.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/sys/util_macro.h>
+
#include "fan.h"
#include "gpio_signal.h"
#include "hooks.h"
@@ -12,12 +18,6 @@
#include "system.h"
#include "util.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/pwm.h>
-#include <zephyr/drivers/sensor.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/util_macro.h>
-
LOG_MODULE_REGISTER(fan_shim, LOG_LEVEL_ERR);
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
@@ -43,7 +43,6 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
.rpm_min = DT_PROP(node_id, rpm_min), \
.rpm_start = DT_PROP(node_id, rpm_start), \
.rpm_max = DT_PROP(node_id, rpm_max), \
- .rpm_deviation = DT_PROP(node_id, rpm_deviation), \
};
#define FAN_INST(node_id) \
@@ -62,6 +61,14 @@ DT_INST_FOREACH_CHILD(0, FAN_CONFIGS)
const struct fan_t fans[FAN_CH_COUNT] = { DT_INST_FOREACH_CHILD(0, FAN_INST) };
+/* Rpm deviation (Unit:percent) */
+#ifndef RPM_DEVIATION
+#define RPM_DEVIATION 7
+#endif
+
+/* Margin of target rpm */
+#define RPM_MARGIN(rpm_target) (((rpm_target)*RPM_DEVIATION) / 100)
+
/* Fan mode */
enum fan_mode {
/* FAN rpm mode */
@@ -125,9 +132,9 @@ static void fan_pwm_update(int ch)
LOG_DBG("FAN PWM %s set percent (%d), pulse %d", pwm_dev->name,
data->pwm_percent, pulse_ns);
- ret = pwm_set_pulse_dt(&cfg->pwm, pulse_ns);
+ ret = pwm_set_dt(&cfg->pwm, cfg->pwm.period, pulse_ns);
if (ret) {
- LOG_ERR("pwm_set_pulse_dt failed %s (%d)", pwm_dev->name, ret);
+ LOG_ERR("pwm_set() failed %s (%d)", pwm_dev->name, ret);
}
}
@@ -219,10 +226,9 @@ enum fan_status fan_smart_control(int ch)
int duty, rpm_diff;
int rpm_actual = data->rpm_actual;
int rpm_target = data->rpm_target;
- int deviation = fans[ch].rpm->rpm_deviation;
/* wait rpm is stable */
- if (ABS(rpm_actual - data->rpm_pre) > (rpm_target * deviation / 100)) {
+ if (ABS(rpm_actual - data->rpm_pre) > RPM_MARGIN(rpm_actual)) {
data->rpm_pre = rpm_actual;
return FAN_STATUS_CHANGING;
}
@@ -237,7 +243,7 @@ enum fan_status fan_smart_control(int ch)
return FAN_STATUS_STOPPED;
}
- if (rpm_diff > (rpm_target * deviation / 100)) {
+ if (rpm_diff > RPM_MARGIN(rpm_target)) {
/* Increase PWM duty */
if (duty == 100) {
return FAN_STATUS_FRUSTRATED;
@@ -245,7 +251,7 @@ enum fan_status fan_smart_control(int ch)
fan_adjust_duty(ch, rpm_diff, duty);
return FAN_STATUS_CHANGING;
- } else if (rpm_diff < -(rpm_target * deviation / 100)) {
+ } else if (rpm_diff < -RPM_MARGIN(rpm_target)) {
/* Decrease PWM duty */
if (duty == 1 && rpm_target != 0) {
return FAN_STATUS_FRUSTRATED;
diff --git a/zephyr/shim/src/flash.c b/zephyr/shim/src/flash.c
index 5b7079e450..8aa7deecf5 100644
--- a/zephyr/shim/src/flash.c
+++ b/zephyr/shim/src/flash.c
@@ -3,18 +3,17 @@
* found in the LICENSE file.
*/
+#include <flash.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/drivers/flash.h>
+
#include "console.h"
#include "drivers/cros_flash.h"
#include "registers.h"
#include "task.h"
#include "util.h"
-#include <zephyr/drivers/flash.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
-#include <flash.h>
-
LOG_MODULE_REGISTER(shim_flash, LOG_LEVEL_ERR);
#if !DT_HAS_CHOSEN(cros_ec_flash_controller)
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c
index a629c77a11..528569980d 100644
--- a/zephyr/shim/src/gpio.c
+++ b/zephyr/shim/src/gpio.c
@@ -3,19 +3,19 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <zephyr/init.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+
#ifdef __REQUIRE_ZEPHYR_GPIOS__
#undef __REQUIRE_ZEPHYR_GPIOS__
#endif
-#include "cros_version.h"
#include "gpio.h"
#include "gpio/gpio.h"
#include "ioexpander.h"
#include "system.h"
-
-#include <zephyr/device.h>
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
+#include "cros_version.h"
LOG_MODULE_REGISTER(gpio_shim, LOG_LEVEL_ERR);
@@ -166,11 +166,6 @@ int gpio_or_ioex_get_level(int signal, int *value)
return EC_SUCCESS;
}
-/* Don't define any 1.8V bit if not supported. */
-#ifndef GPIO_VOLTAGE_1P8
-#define GPIO_VOLTAGE_1P8 0
-#endif
-
/* GPIO flags which are the same in Zephyr and this codebase */
#define GPIO_CONVERSION_SAME_BITS \
(GPIO_OPEN_DRAIN | GPIO_PULL_UP | GPIO_PULL_DOWN | GPIO_VOLTAGE_1P8 | \
@@ -255,10 +250,7 @@ const struct gpio_dt_spec *gpio_get_dt_spec(enum gpio_signal signal)
return &configs[signal].spec;
}
-/* Allow access to this function in tests so we can run it multiple times
- * without having to create a new binary for each run.
- */
-test_export_static int init_gpios(const struct device *unused)
+static int init_gpios(const struct device *unused)
{
gpio_flags_t flags;
bool is_sys_jumped = system_jumped_to_this_image();
@@ -325,10 +317,9 @@ void gpio_reset(enum gpio_signal signal)
void gpio_reset_port(const struct device *port)
{
for (size_t i = 0; i < ARRAY_SIZE(configs); ++i) {
- if (port == configs[i].spec.port) {
+ if (port == configs[i].spec.port)
gpio_pin_configure_dt(&configs[i].spec,
configs[i].init_flags);
- }
}
}
@@ -343,17 +334,12 @@ void gpio_set_flags(enum gpio_signal signal, int flags)
void gpio_set_flags_by_mask(uint32_t port, uint32_t mask, uint32_t flags)
{
- const gpio_flags_t zephyr_flags = convert_to_zephyr_flags(flags);
+ int pin;
- /* Using __builtin_ctz here will guarantee that this loop is as
- * performant as the underlying architecture allows it to be.
- */
- while (mask != 0) {
- int pin = __builtin_ctz(mask);
-
- gpio_configure_port_pin(port, pin, zephyr_flags);
- mask &= ~BIT(pin);
- }
+ for (pin = 0; pin < 8; pin++)
+ if (mask & BIT(pin))
+ gpio_configure_port_pin(port, pin,
+ convert_to_zephyr_flags(flags));
}
int signal_is_gpio(int signal)
diff --git a/zephyr/shim/src/gpio_id.c b/zephyr/shim/src/gpio_id.c
index e157e2d487..b994154cd1 100644
--- a/zephyr/shim/src/gpio_id.c
+++ b/zephyr/shim/src/gpio_id.c
@@ -3,14 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+
#ifdef __REQUIRE_ZEPHYR_GPIOS__
#undef __REQUIRE_ZEPHYR_GPIOS__
#endif
-
#include "gpio.h"
#include "util.h"
-#include <zephyr/devicetree.h>
+#define IS_BOARD_COMPATIBLE DT_NODE_HAS_COMPAT(DT_PATH(board), cros_ec_gpio_id)
+#define IS_SKU_COMPATIBLE DT_NODE_HAS_COMPAT(DT_PATH(sku), cros_ec_gpio_id)
#define CONVERT_NUMERAL_SYSTEM_EVAL(system, bits, nbits) \
system##_from_bits(bits, nbits)
@@ -21,15 +23,14 @@
#define READ_PIN_FROM_PHANDLE(node_id, prop, idx) \
gpio_get_ternary(GPIO_SIGNAL(DT_PHANDLE_BY_IDX(node_id, prop, idx))),
-#define SKU_GPIO_ID_NODE DT_NODELABEL(gpio_id_sku)
-#if DT_NODE_HAS_STATUS(SKU_GPIO_ID_NODE, okay)
+#if DT_NODE_EXISTS(DT_PATH(sku)) && IS_SKU_COMPATIBLE
__override uint32_t board_get_sku_id(void)
{
static uint32_t sku_id = (uint32_t)-1;
if (sku_id == (uint32_t)-1) {
- int bits[] = { DT_FOREACH_PROP_ELEM(SKU_GPIO_ID_NODE, bits,
+ int bits[] = { DT_FOREACH_PROP_ELEM(DT_PATH(sku), bits,
READ_PIN_FROM_PHANDLE) };
if (sizeof(bits) == 0)
@@ -45,15 +46,14 @@ __override uint32_t board_get_sku_id(void)
#endif
-#define BOARD_GPIO_ID_NODE DT_NODELABEL(gpio_id_board)
-#if DT_NODE_HAS_STATUS(SKU_GPIO_ID_NODE, okay)
+#if DT_NODE_EXISTS(DT_PATH(board)) && IS_BOARD_COMPATIBLE
__override int board_get_version(void)
{
static int board_version = -1;
if (board_version == -1) {
- int bits[] = { DT_FOREACH_PROP_ELEM(BOARD_GPIO_ID_NODE, bits,
+ int bits[] = { DT_FOREACH_PROP_ELEM(DT_PATH(board), bits,
READ_PIN_FROM_PHANDLE) };
if (sizeof(bits) == 0)
@@ -68,7 +68,3 @@ __override int board_get_version(void)
}
#endif
-
-BUILD_ASSERT(DT_NODE_HAS_STATUS(SKU_GPIO_ID_NODE, okay) ||
- DT_NODE_HAS_STATUS(BOARD_GPIO_ID_NODE, okay),
- "neither sku or board id nodelabels found");
diff --git a/zephyr/shim/src/gpio_int.c b/zephyr/shim/src/gpio_int.c
index 761e7e7b3c..8406f3abe8 100644
--- a/zephyr/shim/src/gpio_int.c
+++ b/zephyr/shim/src/gpio_int.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <zephyr/init.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+
#ifdef __REQUIRE_ZEPHYR_GPIOS__
#undef __REQUIRE_ZEPHYR_GPIOS__
#endif
-#include "cros_version.h"
#include "gpio.h"
#include "gpio/gpio.h"
#include "gpio/gpio_int.h"
-
-#include <zephyr/device.h>
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
+#include "cros_version.h"
LOG_MODULE_REGISTER(gpio_int, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/src/hooks.c b/zephyr/shim/src/hooks.c
index b8f9b917e4..3f11a578c5 100644
--- a/zephyr/shim/src/hooks.c
+++ b/zephyr/shim/src/hooks.c
@@ -3,19 +3,18 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+
+#include <ap_power/ap_power.h>
+#include <ap_power/ap_power_events.h>
#include "common.h"
#include "console.h"
#include "ec_tasks.h"
-#include "hook_types.h"
#include "hooks.h"
+#include "hook_types.h"
#include "task.h"
#include "timer.h"
-#include <zephyr/kernel.h>
-
-#include <ap_power/ap_power.h>
-#include <ap_power/ap_power_events.h>
-
/*
* hook_registry maps each hook_type to the list of handlers for that hook type.
*
diff --git a/zephyr/shim/src/host_command.c b/zephyr/shim/src/host_command.c
index 16f5ae66d8..c5a51332a1 100644
--- a/zephyr/shim/src/host_command.c
+++ b/zephyr/shim/src/host_command.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+
#include "host_command.h"
#include "task.h"
-#include <zephyr/kernel.h>
-
struct host_command *zephyr_find_host_command(int command)
{
STRUCT_SECTION_FOREACH(host_command, cmd)
diff --git a/zephyr/shim/src/hwtimer.c b/zephyr/shim/src/hwtimer.c
index cefbe4eb7f..d99f7a826b 100644
--- a/zephyr/shim/src/hwtimer.c
+++ b/zephyr/shim/src/hwtimer.c
@@ -3,11 +3,10 @@
* found in the LICENSE file.
*/
-#include "hwtimer.h"
-
+#include <zephyr/kernel.h>
#include <stdint.h>
-#include <zephyr/kernel.h>
+#include "hwtimer.h"
uint64_t __hw_clock_source_read64(void)
{
diff --git a/zephyr/shim/src/i2c.c b/zephyr/shim/src/i2c.c
index 53766f1683..0074327826 100644
--- a/zephyr/shim/src/i2c.c
+++ b/zephyr/shim/src/i2c.c
@@ -3,12 +3,19 @@
* found in the LICENSE file.
*/
+#include <zephyr/sys/util.h>
+#include <zephyr/drivers/i2c.h>
+
#include "console.h"
#include "i2c.h"
#include "i2c/i2c.h"
-#include <zephyr/drivers/i2c.h>
-#include <zephyr/sys/util.h>
+/*
+ * The named-i2c-ports node is required by the I2C shim
+ */
+#if !DT_NODE_EXISTS(DT_PATH(named_i2c_ports))
+#error I2C shim requires the named-i2c-ports node to be defined.
+#endif
/*
* Initialize device bindings in i2c_devices.
diff --git a/zephyr/shim/src/ioex.c b/zephyr/shim/src/ioex.c
index afda051c8a..a5d685bc48 100644
--- a/zephyr/shim/src/ioex.c
+++ b/zephyr/shim/src/ioex.c
@@ -3,16 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/init.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+#include "common.h"
#ifdef __REQUIRE_ZEPHYR_GPIOS__
#undef __REQUIRE_ZEPHYR_GPIOS__
#endif
-#include "common.h"
#include "ioexpander.h"
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(ioex_shim, LOG_LEVEL_ERR);
int ioex_init(int ioex)
diff --git a/zephyr/shim/src/ioex_drv.c b/zephyr/shim/src/ioex_drv.c
index 98f67a4459..3baa4777fd 100644
--- a/zephyr/shim/src/ioex_drv.c
+++ b/zephyr/shim/src/ioex_drv.c
@@ -3,15 +3,38 @@
* found in the LICENSE file.
*/
+#define DT_DRV_COMPAT cros_ioex_port
+#define DT_DRV_COMPAT_CHIP cros_ioex_chip
+
+#include <zephyr/device.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/i2c.h>
+#include <errno.h>
#ifdef __REQUIRE_ZEPHYR_GPIOS__
#undef __REQUIRE_ZEPHYR_GPIOS__
#endif
+#include "gpio.h"
+#include <zephyr/drivers/gpio/gpio_utils.h>
+#include <zephyr/init.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/sys/util.h>
#include "common.h"
#include "config.h"
+#include "i2c.h"
+#include "ioexpander.h"
+
/* Include drivers if enabled */
+#ifdef CONFIG_PLATFORM_EC_IOEX_CCGXXF
+#include "driver/tcpm/ccgxxf.h"
+#endif
#ifdef CONFIG_PLATFORM_EC_IOEX_IT8801
#include "driver/ioexpander/it8801.h"
#endif
+#ifdef CONFIG_PLATFORM_EC_IOEX_NCT38XX
+#include "driver/tcpm/nct38xx.h"
+#endif
#ifdef CONFIG_PLATFORM_EC_IOEX_PCA9675
#include "driver/ioexpander/pca9675.h"
#endif
@@ -21,30 +44,6 @@
#ifdef CONFIG_PLATFORM_EC_IOEX_TCA64XXA
#include "driver/ioexpander/tca64xxa.h"
#endif
-#ifdef CONFIG_PLATFORM_EC_IOEX_CCGXXF
-#include "driver/tcpm/ccgxxf.h"
-#endif
-#ifdef CONFIG_PLATFORM_EC_IOEX_NCT38XX
-#include "driver/tcpm/nct38xx.h"
-#endif
-#include "gpio.h"
-#include "i2c.h"
-#include "ioexpander.h"
-
-#include <errno.h>
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_utils.h>
-#include <zephyr/drivers/i2c.h>
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/sys/util.h>
-
-#define DT_DRV_COMPAT cros_ioex_port
-#define DT_DRV_COMPAT_CHIP cros_ioex_chip
LOG_MODULE_REGISTER(cros_ioex_port, CONFIG_GPIO_LOG_LEVEL);
diff --git a/zephyr/shim/src/keyboard_raw.c b/zephyr/shim/src/keyboard_raw.c
index 73b3c2acaf..c9f465d06d 100644
--- a/zephyr/shim/src/keyboard_raw.c
+++ b/zephyr/shim/src/keyboard_raw.c
@@ -5,14 +5,13 @@
/* Functions needed by keyboard scanner module for Chrome EC */
-#include "drivers/cros_kb_raw.h"
-#include "keyboard_raw.h"
-
#include <zephyr/device.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-
#include <soc.h>
+#include <zephyr/kernel.h>
+
+#include "drivers/cros_kb_raw.h"
+#include "keyboard_raw.h"
LOG_MODULE_REGISTER(shim_cros_kb_raw, LOG_LEVEL_ERR);
@@ -64,11 +63,3 @@ void keyboard_raw_enable_interrupt(int enable)
{
cros_kb_raw_enable_interrupt(cros_kb_raw_dev, enable);
}
-
-/**
- * Enable or disable keyboard alternative function.
- */
-void keybaord_raw_config_alt(bool enable)
-{
- cros_kb_raw_config_alt(cros_kb_raw_dev, enable);
-}
diff --git a/zephyr/shim/src/keyscan.c b/zephyr/shim/src/keyscan.c
index 46bb5fcc7f..514885379b 100644
--- a/zephyr/shim/src/keyscan.c
+++ b/zephyr/shim/src/keyscan.c
@@ -3,18 +3,15 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT cros_ec_keyscan
-
-#include "keyboard_scan.h"
+#define DT_DRV_COMPAT cros_keyscan
#include <assert.h>
-
#include <zephyr/kernel.h>
-
#include <soc.h>
-BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
- "Exactly one instance of cros-ec,keyscan should be defined.");
+#include "keyboard_scan.h"
+
+#if DT_NODE_EXISTS(DT_INST(0, cros_keyscan))
/* The keyboard matrix should have at least enough columns for the
* standard keyboard with no keypad.
@@ -34,3 +31,4 @@ __override struct keyboard_scan_config keyscan_config = {
.poll_timeout_us = DT_INST_PROP(0, poll_timeout),
.actual_key_mask = DT_INST_PROP(0, actual_key_mask),
};
+#endif
diff --git a/zephyr/shim/src/led_driver/CMakeLists.txt b/zephyr/shim/src/led_driver/CMakeLists.txt
index 7f513ed425..179f540fe1 100644
--- a/zephyr/shim/src/led_driver/CMakeLists.txt
+++ b/zephyr/shim/src/led_driver/CMakeLists.txt
@@ -3,5 +3,5 @@
# found in the LICENSE file.
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_DT led.c)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_DT_GPIO led_gpio.c)
-zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_DT_PWM led_pwm.c)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_DT led_gpio.c)
+zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_DT led_pwm.c)
diff --git a/zephyr/shim/src/led_driver/led.c b/zephyr/shim/src/led_driver/led.c
index 9a1c07b310..011632ac83 100644
--- a/zephyr/shim/src/led_driver/led.c
+++ b/zephyr/shim/src/led_driver/led.c
@@ -5,7 +5,7 @@
* Power and battery LED control.
*/
-#define DT_DRV_COMPAT cros_ec_led_policy
+#include <zephyr/drivers/gpio.h>
#include "battery.h"
#include "charge_manager.h"
@@ -21,12 +21,10 @@
#include "util.h"
#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(led, LOG_LEVEL_ERR);
-BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
- "Exactly one instance of cros-ec,led-policy should be defined.");
+#define LED_COLOR_NODE DT_PATH(led_colors)
struct led_color_node_t {
struct led_pins_node_t *pins_node;
@@ -35,12 +33,10 @@ struct led_color_node_t {
#define DECLARE_PINS_NODE(id) extern struct led_pins_node_t PINS_NODE(id);
-#if CONFIG_PLATFORM_EC_LED_DT_PWM
-DT_FOREACH_CHILD(DT_COMPAT_GET_ANY_STATUS_OKAY(cros_ec_pwm_led_pins),
- DECLARE_PINS_NODE)
-#elif CONFIG_PLATFORM_EC_LED_DT_GPIO
-DT_FOREACH_CHILD(DT_COMPAT_GET_ANY_STATUS_OKAY(cros_ec_gpio_led_pins),
- DECLARE_PINS_NODE)
+#if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_PWM_LED)
+DT_FOREACH_CHILD(PWM_LED_PINS_NODE, DECLARE_PINS_NODE)
+#elif DT_HAS_COMPAT_STATUS_OKAY(COMPAT_GPIO_LED)
+DT_FOREACH_CHILD(GPIO_LED_PINS_NODE, DECLARE_PINS_NODE)
#endif
/*
@@ -117,8 +113,8 @@ struct node_prop_t {
LED_COLOR_INIT(3, 4, state_id), \
} },
-static const struct node_prop_t node_array[] = { DT_INST_FOREACH_CHILD(
- 0, SET_LED_VALUES) };
+static const struct node_prop_t node_array[] = { DT_FOREACH_CHILD(
+ LED_COLOR_NODE, SET_LED_VALUES) };
test_export_static enum power_state get_chipset_state(void)
{
diff --git a/zephyr/shim/src/led_driver/led.h b/zephyr/shim/src/led_driver/led.h
index a186d97da9..b8cedf5af7 100644
--- a/zephyr/shim/src/led_driver/led.h
+++ b/zephyr/shim/src/led_driver/led.h
@@ -10,6 +10,9 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/pwm.h>
+#define COMPAT_GPIO_LED cros_ec_gpio_led_pins
+#define COMPAT_PWM_LED cros_ec_pwm_led_pins
+
#define PINS_NODE(id) DT_CAT(PIN_NODE_, id)
#define PINS_ARRAY(id) DT_CAT(PINS_ARRAY_, id)
@@ -32,6 +35,9 @@
COND_CODE_1(DT_NODE_HAS_PROP(id, enum_name), \
(LED_ENUM(id, enum_name), ), ())
+#define GPIO_LED_PINS_NODE DT_PATH(gpio_led_pins)
+#define PWM_LED_PINS_NODE DT_PATH(pwm_led_pins)
+
enum led_color {
LED_OFF,
LED_RED,
@@ -79,12 +85,12 @@ struct led_pins_node_t {
/* Brightness Range color, only used to support ectool functionality */
enum ec_led_colors br_color;
-#if CONFIG_PLATFORM_EC_LED_DT_GPIO
+#if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_GPIO_LED)
/* Array of GPIO pins to set to enable particular color */
struct gpio_pin_t *gpio_pins;
#endif
-#if CONFIG_PLATFORM_EC_LED_DT_PWM
+#if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_PWM_LED)
/* Array of PWM pins to set to enable particular color */
struct pwm_pin_t *pwm_pins;
#endif
diff --git a/zephyr/shim/src/led_driver/led_gpio.c b/zephyr/shim/src/led_driver/led_gpio.c
index d6af1772c2..122794dc82 100644
--- a/zephyr/shim/src/led_driver/led_gpio.c
+++ b/zephyr/shim/src/led_driver/led_gpio.c
@@ -5,8 +5,6 @@
* GPIO LED control.
*/
-#define DT_DRV_COMPAT cros_ec_gpio_led_pins
-
#include "ec_commands.h"
#include "led.h"
#include "util.h"
@@ -15,21 +13,20 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(gpio_led, LOG_LEVEL_ERR);
+#if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_GPIO_LED)
-BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
- "Exactly one instance of cros-ec,gpio-led-pins should be defined.");
+LOG_MODULE_REGISTER(gpio_led, LOG_LEVEL_ERR);
#define SET_PIN(node_id, prop, i) \
{ .signal = GPIO_SIGNAL(DT_PHANDLE_BY_IDX(node_id, prop, i)), \
- .val = DT_PROP_BY_IDX(node_id, led_values, i) },
+ .val = DT_PHA_BY_IDX(node_id, prop, i, value) },
#define SET_GPIO_PIN(node_id) \
{ DT_FOREACH_PROP_ELEM(node_id, led_pins, SET_PIN) };
#define GEN_PINS_ARRAY(id) struct gpio_pin_t PINS_ARRAY(id)[] = SET_GPIO_PIN(id)
-DT_INST_FOREACH_CHILD(0, GEN_PINS_ARRAY)
+DT_FOREACH_CHILD(GPIO_LED_PINS_NODE, GEN_PINS_ARRAY)
#define SET_PIN_NODE(node_id) \
{ .led_color = GET_PROP(node_id, led_color), \
@@ -44,14 +41,14 @@ DT_INST_FOREACH_CHILD(0, GEN_PINS_ARRAY)
#define GEN_PINS_NODES(id) \
const struct led_pins_node_t PINS_NODE(id) = SET_PIN_NODE(id)
-DT_INST_FOREACH_CHILD(0, GEN_PINS_NODES)
+DT_FOREACH_CHILD(GPIO_LED_PINS_NODE, GEN_PINS_NODES)
/*
* Array of pointers to each pin node
*/
#define PINS_NODE_PTR(id) &PINS_NODE(id),
-const struct led_pins_node_t *pins_node[] = { DT_INST_FOREACH_CHILD(
- 0, PINS_NODE_PTR) };
+const struct led_pins_node_t *pins_node[] = { DT_FOREACH_CHILD(
+ GPIO_LED_PINS_NODE, PINS_NODE_PTR) };
/*
* Set all the GPIO pins defined in the node to the defined value,
@@ -141,3 +138,5 @@ const struct led_pins_node_t *led_get_node(enum led_color color,
return pin_node;
}
#endif /* TEST_BUILD */
+
+#endif /* DT_HAS_COMPAT_STATUS_OKAY(COMPAT_GPIO_LED) */
diff --git a/zephyr/shim/src/led_driver/led_pwm.c b/zephyr/shim/src/led_driver/led_pwm.c
index 9fcafeea53..00002fc32e 100644
--- a/zephyr/shim/src/led_driver/led_pwm.c
+++ b/zephyr/shim/src/led_driver/led_pwm.c
@@ -5,8 +5,6 @@
* PWM LED control.
*/
-#define DT_DRV_COMPAT cros_ec_pwm_led_pins
-
#include "ec_commands.h"
#include "led.h"
#include "util.h"
@@ -15,10 +13,9 @@
#include <zephyr/drivers/pwm.h>
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(pwm_led, LOG_LEVEL_ERR);
+#if DT_HAS_COMPAT_STATUS_OKAY(COMPAT_PWM_LED)
-BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
- "Exactly one instance of cros-ec,pwm-led-pins should be defined.");
+LOG_MODULE_REGISTER(pwm_led, LOG_LEVEL_ERR);
/*
* Period in ns from frequency(Hz) defined in pins node
@@ -36,23 +33,23 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1,
.pwm = PWM_DT_SPEC_GET(DT_PHANDLE_BY_IDX(node_id, prop, i)), \
.pulse_ns = DIV_ROUND_NEAREST( \
DT_PWMS_PERIOD(DT_PHANDLE_BY_IDX(node_id, prop, i)) * \
- DT_PROP_BY_IDX(node_id, led_values, i), \
+ DT_PHA_BY_IDX(node_id, prop, i, value), \
100), \
},
#define SET_PWM_PIN(node_id) \
- { DT_FOREACH_PROP_ELEM(node_id, led_pwms, SET_PIN) };
+ { DT_FOREACH_PROP_ELEM(node_id, led_pins, SET_PIN) };
#define GEN_PINS_ARRAY(id) struct pwm_pin_t PINS_ARRAY(id)[] = SET_PWM_PIN(id)
-DT_INST_FOREACH_CHILD(0, GEN_PINS_ARRAY)
+DT_FOREACH_CHILD(PWM_LED_PINS_NODE, GEN_PINS_ARRAY)
#define SET_PIN_NODE(node_id) \
{ .led_color = GET_PROP(node_id, led_color), \
.led_id = GET_PROP(node_id, led_id), \
.br_color = GET_PROP_NVE(node_id, br_color), \
.pwm_pins = PINS_ARRAY(node_id), \
- .pins_count = DT_PROP_LEN(node_id, led_pwms) };
+ .pins_count = DT_PROP_LEN(node_id, led_pins) };
/*
* Initialize led_pins_node_t struct for each pin node defined
@@ -60,14 +57,14 @@ DT_INST_FOREACH_CHILD(0, GEN_PINS_ARRAY)
#define GEN_PINS_NODES(id) \
const struct led_pins_node_t PINS_NODE(id) = SET_PIN_NODE(id)
-DT_INST_FOREACH_CHILD(0, GEN_PINS_NODES)
+DT_FOREACH_CHILD(PWM_LED_PINS_NODE, GEN_PINS_NODES)
/*
* Array of pointers to each pin node
*/
#define PINS_NODE_PTR(id) &PINS_NODE(id),
-const struct led_pins_node_t *pins_node[] = { DT_INST_FOREACH_CHILD(
- 0, PINS_NODE_PTR) };
+const struct led_pins_node_t *pins_node[] = { DT_FOREACH_CHILD(
+ PWM_LED_PINS_NODE, PINS_NODE_PTR) };
/*
* Set all the PWM channels defined in the node to the defined value,
@@ -150,3 +147,4 @@ __override int led_is_supported(enum ec_led_id led_id)
return ((1 << (int)led_id) & supported_leds);
}
+#endif /* DT_HAS_COMPAT_STATUS_OKAY(COMPAT_PWM_LED) */
diff --git a/zephyr/shim/src/log_backend_console_buffer.c b/zephyr/shim/src/log_backend_console_buffer.c
index 3f455469c4..cafb690b87 100644
--- a/zephyr/shim/src/log_backend_console_buffer.c
+++ b/zephyr/shim/src/log_backend_console_buffer.c
@@ -1,13 +1,13 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "console.h"
-
#include <zephyr/logging/log_backend.h>
-#include <zephyr/logging/log_backend_std.h>
#include <zephyr/logging/log_output.h>
+#include <zephyr/logging/log_backend_std.h>
+
+#include "console.h"
static uint8_t
char_out_buf[CONFIG_PLATFORM_EC_LOG_BACKEND_CONSOLE_BUFFER_TMP_BUF_SIZE];
diff --git a/zephyr/shim/src/motionsense_sensors.c b/zephyr/shim/src/motionsense_sensors.c
index 72bb677af6..8d886192ac 100644
--- a/zephyr/shim/src/motionsense_sensors.c
+++ b/zephyr/shim/src/motionsense_sensors.c
@@ -3,15 +3,14 @@
* found in the LICENSE file.
*/
-#include "accelgyro.h"
+#include <zephyr/logging/log.h>
#include "common.h"
+#include "accelgyro.h"
#include "cros_cbi.h"
-#include "gpio/gpio_int.h"
#include "hooks.h"
+#include "gpio/gpio_int.h"
#include "motionsense_sensors.h"
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(shim_cros_motionsense_sensors);
#define SENSOR_MUTEX_NODE DT_PATH(motionsense_mutex)
diff --git a/zephyr/shim/src/panic.c b/zephyr/shim/src/panic.c
index 2ac8328e9e..9ff8a46f62 100644
--- a/zephyr/shim/src/panic.c
+++ b/zephyr/shim/src/panic.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "common.h"
-#include "panic.h"
-
#include <zephyr/arch/cpu.h>
#include <zephyr/fatal.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/logging/log_ctrl.h>
+#include <zephyr/kernel.h>
+
+#include "common.h"
+#include "panic.h"
/*
* Arch-specific configuration
diff --git a/zephyr/shim/src/power.c b/zephyr/shim/src/power.c
index ab58cf391d..007c40ab71 100644
--- a/zephyr/shim/src/power.c
+++ b/zephyr/shim/src/power.c
@@ -3,38 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/sys/util.h>
+
#include "console.h"
#include "power.h"
#include "power/power.h"
-#include <zephyr/sys/util.h>
-
-#define GEN_POWER_SIGNAL_STRUCT_ENTRY_GPIO(cid) \
- DT_STRING_UPPER_TOKEN(DT_PROP(cid, power_gpio_pin), enum_name)
-#define GEN_POWER_SIGNAL_STRUCT_ENTRY_FLAGS(cid) \
- (DT_GPIO_FLAGS(DT_PROP(cid, power_gpio_pin), gpios) & \
- GPIO_ACTIVE_LOW ? \
- POWER_SIGNAL_ACTIVE_LOW : \
- POWER_SIGNAL_ACTIVE_HIGH)
-#define GEN_POWER_SIGNAL_STRUCT_ENTRY_NAME(cid) DT_PROP(cid, power_enum_name)
-
-#define GEN_POWER_SIGNAL_STRUCT_ENTRY(cid) \
- { \
- .gpio = GEN_POWER_SIGNAL_STRUCT_ENTRY_GPIO(cid), \
- .flags = GEN_POWER_SIGNAL_STRUCT_ENTRY_FLAGS(cid), \
- .name = GEN_POWER_SIGNAL_STRUCT_ENTRY_NAME(cid) \
- }
-#define GEN_POWER_SIGNAL_STRUCT(cid) \
- [GEN_POWER_SIGNAL_ENUM_ENTRY(cid)] = GEN_POWER_SIGNAL_STRUCT_ENTRY(cid),
+#if (SYSTEM_DT_POWER_SIGNAL_CONFIG)
const struct power_signal_info power_signal_list[] = { DT_FOREACH_CHILD(
POWER_SIGNAL_LIST_NODE, GEN_POWER_SIGNAL_STRUCT) };
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
-/*
- * Verify the number of required power-signals are specified in
- * the DeviceTree
- */
-#define POWER_SIGNALS_REQUIRED \
- DT_PROP(POWER_SIGNAL_LIST_NODE, power_signals_required)
-BUILD_ASSERT(POWER_SIGNALS_REQUIRED == POWER_SIGNAL_COUNT);
+#endif /* SYSTEM_DT_POWER_SIGNAL_CONFIG */
diff --git a/zephyr/shim/src/ppc.c b/zephyr/shim/src/ppc.c
index c15c6900b1..c4c54d002f 100644
--- a/zephyr/shim/src/ppc.c
+++ b/zephyr/shim/src/ppc.c
@@ -3,15 +3,14 @@
* found in the LICENSE file.
*/
-#include "usbc/ppc.h"
+#include <zephyr/devicetree.h>
+#include "usbc_ppc.h"
#include "usbc/ppc_aoz1380.h"
#include "usbc/ppc_nx20p348x.h"
#include "usbc/ppc_rt1739.h"
#include "usbc/ppc_sn5s330.h"
#include "usbc/ppc_syv682x.h"
-#include "usbc_ppc.h"
-
-#include <zephyr/devicetree.h>
+#include "usbc/ppc.h"
#if DT_HAS_COMPAT_STATUS_OKAY(AOZ1380_COMPAT) || \
DT_HAS_COMPAT_STATUS_OKAY(NX20P348X_COMPAT) || \
diff --git a/zephyr/shim/src/pwm_hc.c b/zephyr/shim/src/pwm_hc.c
index 3c7b2f1737..c0350c733f 100644
--- a/zephyr/shim/src/pwm_hc.c
+++ b/zephyr/shim/src/pwm_hc.c
@@ -3,20 +3,20 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/pwm.h>
+#include <zephyr/logging/log.h>
+
#include "common.h"
#include "console.h"
#include "drivers/cros_displight.h"
#include "ec_commands.h"
#include "host_command.h"
-#include "keyboard_backlight.h"
#include "pwm.h"
+#include "keyboard_backlight.h"
#include "util.h"
-#include <zephyr/device.h>
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/pwm.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(pwm_shim, LOG_LEVEL_ERR);
#define HAS_PWM_GENERIC_CHANNEL(compat) \
diff --git a/zephyr/shim/src/pwm_led.c b/zephyr/shim/src/pwm_led.c
index 81cc3a9c28..498c543ffb 100644
--- a/zephyr/shim/src/pwm_led.c
+++ b/zephyr/shim/src/pwm_led.c
@@ -6,7 +6,6 @@
#define DT_DRV_COMPAT cros_ec_pwm_leds
#include <string.h>
-
#include <zephyr/devicetree.h>
#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
diff --git a/zephyr/shim/src/rtc.c b/zephyr/shim/src/rtc.c
index 3acf6a3bb6..c8a0511c95 100644
--- a/zephyr/shim/src/rtc.c
+++ b/zephyr/shim/src/rtc.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
+
#include "console.h"
#include "drivers/cros_rtc.h"
#include "hooks.h"
@@ -10,9 +13,6 @@
#include "system.h"
#include "util.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-
LOG_MODULE_REGISTER(shim_cros_rtc, LOG_LEVEL_ERR);
#define CROS_RTC_NODE DT_CHOSEN(cros_rtc)
diff --git a/zephyr/shim/src/switchcap_gpio.c b/zephyr/shim/src/switchcap_gpio.c
index 982e5ff98c..23bed493c8 100644
--- a/zephyr/shim/src/switchcap_gpio.c
+++ b/zephyr/shim/src/switchcap_gpio.c
@@ -3,24 +3,33 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT cros_ec_switchcap_gpio
-
-#include "common.h"
-
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/kernel.h>
+#include "common.h"
/* TODO(b/218600962): Consolidate switchcap code. */
-#define SC_PIN_ENABLE_GPIO DT_INST_PROP(0, enable_pin)
-#define SC_PIN_ENABLE GPIO_DT_FROM_NODE(SC_PIN_ENABLE_GPIO)
+#if DT_NODE_EXISTS(DT_PATH(switchcap))
+
+#if !DT_NODE_HAS_COMPAT(DT_PATH(switchcap), switchcap_gpio)
+#error "Invalid /switchcap node in device tree"
+#endif
-#define SC_PIN_POWER_GOOD_GPIO DT_INST_PROP(0, power_good_pin)
-#define SC_PIN_POWER_GOOD_EXISTS DT_NODE_EXISTS(SC_PIN_POWER_GOOD_GPIO)
-#define SC_PIN_POWER_GOOD GPIO_DT_FROM_NODE(SC_PIN_POWER_GOOD_GPIO)
+#define SC_PIN_ENABLE_PHANDLE \
+ DT_PHANDLE_BY_IDX(DT_PATH(switchcap), enable_pin, 0)
+#define SC_PIN_ENABLE GPIO_DT_FROM_NODE(SC_PIN_ENABLE_PHANDLE)
-static const int32_t poff_delay_ms = DT_INST_PROP_OR(0, poff_delay_ms, 0);
+#define SC_PIN_POWER_GOOD_PHANDLE \
+ DT_PHANDLE_BY_IDX(DT_PATH(switchcap), power_good_pin, 0)
+#define SC_PIN_POWER_GOOD_EXISTS DT_NODE_EXISTS(SC_PIN_POWER_GOOD_PHANDLE)
+#define SC_PIN_POWER_GOOD GPIO_DT_FROM_NODE(SC_PIN_POWER_GOOD_PHANDLE)
+
+#if DT_NODE_HAS_PROP(DT_PATH(switchcap), poff_delay_ms)
+static const int32_t poff_delay_ms = DT_PROP(DT_PATH(switchcap), poff_delay_ms);
+#else
+static const int32_t poff_delay_ms;
+#endif
void board_set_switchcap_power(int enable)
{
@@ -42,3 +51,5 @@ int board_is_switchcap_power_good(void)
return 1;
#endif
}
+
+#endif
diff --git a/zephyr/shim/src/switchcap_ln9310.c b/zephyr/shim/src/switchcap_ln9310.c
index 54087ef6f2..7c5fd4ed8d 100644
--- a/zephyr/shim/src/switchcap_ln9310.c
+++ b/zephyr/shim/src/switchcap_ln9310.c
@@ -3,23 +3,27 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT lion_ln9310
-
-#include "common.h"
-#include "ln9310.h"
-
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
+#include "common.h"
+#include "ln9310.h"
/* TODO(b/218600962): Consolidate switchcap code. */
-#define SC_PIN_ENABLE_GPIO DT_INST_PROP(0, enable_pin)
-#define SC_PIN_ENABLE GPIO_DT_FROM_NODE(SC_PIN_ENABLE_GPIO)
+#if DT_NODE_EXISTS(DT_PATH(switchcap))
+
+#if !DT_NODE_HAS_COMPAT(DT_PATH(switchcap), switchcap_ln9310)
+#error "Invalid /switchcap node in device tree"
+#endif
-#define SC_PORT_NODE DT_INST_PHANDLE(0, port)
-#define SC_PORT DT_STRING_UPPER_TOKEN_BY_IDX(SC_PORT_NODE, enum_names, 0)
+#define SC_PIN_ENABLE_PHANDLE \
+ DT_PHANDLE_BY_IDX(DT_PATH(switchcap), enable_pin, 0)
+#define SC_PIN_ENABLE GPIO_DT_FROM_NODE(SC_PIN_ENABLE_PHANDLE)
-#define SC_ADDR_FLAGS DT_INST_STRING_UPPER_TOKEN(0, addr_flags)
+#define SC_PORT_PHANDLE DT_PHANDLE(DT_PATH(switchcap), port)
+#define SC_PORT DT_STRING_UPPER_TOKEN_BY_IDX(SC_PORT_PHANDLE, enum_names, 0)
+
+#define SC_ADDR_FLAGS DT_STRING_UPPER_TOKEN(DT_PATH(switchcap), addr_flags)
void board_set_switchcap_power(int enable)
{
@@ -41,3 +45,5 @@ const struct ln9310_config_t ln9310_config = {
.i2c_port = SC_PORT,
.i2c_addr_flags = SC_ADDR_FLAGS,
};
+
+#endif
diff --git a/zephyr/shim/src/system.c b/zephyr/shim/src/system.c
index 0b47782b42..53e651ec03 100644
--- a/zephyr/shim/src/system.c
+++ b/zephyr/shim/src/system.c
@@ -3,18 +3,17 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <zephyr/drivers/bbram.h>
+#include <drivers/cros_system.h>
+#include <zephyr/logging/log.h>
+
#include "common.h"
#include "console.h"
#include "cros_version.h"
#include "system.h"
#include "watchdog.h"
-#include <zephyr/device.h>
-#include <zephyr/drivers/bbram.h>
-#include <zephyr/logging/log.h>
-
-#include <drivers/cros_system.h>
-
#define BBRAM_REGION_PD0 DT_PATH(named_bbram_regions, pd0)
#define BBRAM_REGION_PD1 DT_PATH(named_bbram_regions, pd1)
#define BBRAM_REGION_PD2 DT_PATH(named_bbram_regions, pd2)
@@ -343,7 +342,7 @@ static int check_reset_cause(void)
return 0;
}
-test_export_static int system_preinitialize(const struct device *unused)
+static int system_preinitialize(const struct device *unused)
{
ARG_UNUSED(unused);
diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c
index 68ebbbc482..35d4ab7c42 100644
--- a/zephyr/shim/src/tasks.c
+++ b/zephyr/shim/src/tasks.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/init.h>
+#include <zephyr/sys/atomic.h>
+#include <zephyr/shell/shell.h>
+
#include "common.h"
#include "host_command.h"
-#include "task.h"
#include "timer.h"
-
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/sys/atomic.h>
+#include "task.h"
/* Ensure that the idle task is at lower priority than lowest priority task. */
BUILD_ASSERT(EC_TASK_PRIORITY(EC_TASK_PRIO_LOWEST) < K_IDLE_PRIO,
@@ -105,7 +105,7 @@ atomic_t *task_get_event_bitmap(task_id_t cros_task_id)
data = task_get_base_data(cros_task_id);
- return data == NULL ? NULL : &data->event_mask;
+ return &data->event_mask;
}
void task_set_event(task_id_t cros_task_id, uint32_t event)
@@ -114,10 +114,8 @@ void task_set_event(task_id_t cros_task_id, uint32_t event)
data = task_get_base_data(cros_task_id);
- if (data != NULL) {
- atomic_or(&data->event_mask, event);
- k_poll_signal_raise(&data->new_event, 0);
- }
+ atomic_or(&data->event_mask, event);
+ k_poll_signal_raise(&data->new_event, 0);
}
uint32_t task_wait_event(int timeout_us)
@@ -126,8 +124,6 @@ uint32_t task_wait_event(int timeout_us)
data = task_get_base_data(task_get_current());
- __ASSERT_NO_MSG(data != NULL);
-
const k_timeout_t timeout = (timeout_us == -1) ? K_FOREVER :
K_USEC(timeout_us);
const int64_t tick_deadline =
@@ -156,12 +152,12 @@ uint32_t task_wait_event(int timeout_us)
if (events == 0) {
const int64_t ticks_left = tick_deadline - k_uptime_ticks();
- events |= TASK_EVENT_TIMER;
-
if (ticks_left > 0) {
return task_wait_event(
k_ticks_to_us_near64(ticks_left));
}
+
+ events |= TASK_EVENT_TIMER;
}
return events;
@@ -313,26 +309,18 @@ int task_start_called(void)
{
return tasks_started;
}
-/*
- * TODO(b/190203712): Implement this
- * LCOV_EXCL_START
- */
+
void task_disable_task(task_id_t tskid)
{
+ /* TODO(b/190203712): Implement this */
}
-/* LCOV_EXCL_STOP */
-/*
- * This function cannot be tested since it is architecture specific.
- * LCOV_EXCL_START
- */
void task_clear_pending_irq(int irq)
{
#if CONFIG_ITE_IT8XXX2_INTC
ite_intc_isr_clear(irq);
#endif
}
-/* LCOV_EXCL_STOP */
void task_enable_irq(int irq)
{
@@ -351,3 +339,11 @@ inline bool in_deferred_context(void)
*/
return (k_current_get() == &k_sys_work_q.thread);
}
+
+#if IS_ENABLED(CONFIG_KERNEL_SHELL) && IS_ENABLED(CONFIG_THREAD_MONITOR)
+static int taskinfo(const struct shell *shell, size_t argc, char **argv)
+{
+ return shell_execute_cmd(shell, "kernel threads");
+}
+SHELL_CMD_REGISTER(taskinfo, NULL, "Threads statistics", taskinfo);
+#endif
diff --git a/zephyr/shim/src/tcpc.c b/zephyr/shim/src/tcpc.c
index 6ddad71535..ba251a196b 100644
--- a/zephyr/shim/src/tcpc.c
+++ b/zephyr/shim/src/tcpc.c
@@ -3,8 +3,10 @@
* found in the LICENSE file.
*/
-#include "usb_pd.h"
+#include <zephyr/devicetree.h>
+#include <zephyr/sys/util.h>
#include "usb_pd_tcpm.h"
+#include "usb_pd.h"
#include "usbc/tcpc_anx7447.h"
#include "usbc/tcpc_anx7447_emul.h"
#include "usbc/tcpc_ccgxxf.h"
@@ -14,14 +16,10 @@
#include "usbc/tcpc_nct38xx.h"
#include "usbc/tcpc_ps8xxx.h"
#include "usbc/tcpc_ps8xxx_emul.h"
-#include "usbc/tcpc_raa489000.h"
#include "usbc/tcpc_rt1718s.h"
#include "usbc/tcpci.h"
#include "usbc/utils.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/sys/util.h>
-
#define HAS_TCPC_PROP(usbc_id) \
COND_CODE_1(DT_NODE_HAS_PROP(usbc_id, tcpc), (|| 1), ())
@@ -59,8 +57,6 @@
CHECK_COMPAT(PS8XXX_COMPAT, usbc_id, tcpc_id, TCPC_CONFIG_PS8XXX) \
CHECK_COMPAT(NCT38XX_TCPC_COMPAT, usbc_id, tcpc_id, \
TCPC_CONFIG_NCT38XX) \
- CHECK_COMPAT(RAA489000_TCPC_COMPAT, usbc_id, tcpc_id, \
- TCPC_CONFIG_RAA489000) \
CHECK_COMPAT(RT1718S_TCPC_COMPAT, usbc_id, tcpc_id, \
TCPC_CONFIG_RT1718S) \
CHECK_COMPAT(TCPCI_COMPAT, usbc_id, tcpc_id, TCPC_CONFIG_TCPCI) \
diff --git a/zephyr/shim/src/tcpc_nct38xx.c b/zephyr/shim/src/tcpc_nct38xx.c
index 5d3f5ac25c..9580759a6c 100644
--- a/zephyr/shim/src/tcpc_nct38xx.c
+++ b/zephyr/shim/src/tcpc_nct38xx.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/device.h>
+#include <zephyr/devicetree.h>
+
#include "config.h"
#include "usbc/tcpc_nct38xx.h"
#include "usbc/utils.h"
-#include <zephyr/device.h>
-#include <zephyr/devicetree.h>
-
#define GPIO_DEV_WITH_COMMA(id) DEVICE_DT_GET(DT_PHANDLE(id, gpio_dev)),
#define GPIO_DEV_BINDING(usbc_id, tcpc_id) \
diff --git a/zephyr/shim/src/temp_sensors.c b/zephyr/shim/src/temp_sensors.c
index ae3a367252..371d7d7fc9 100644
--- a/zephyr/shim/src/temp_sensors.c
+++ b/zephyr/shim/src/temp_sensors.c
@@ -6,7 +6,6 @@
#include "adc.h"
#include "charger/chg_rt9490.h"
#include "driver/charger/rt9490.h"
-#include "hooks.h"
#include "temp_sensor.h"
#include "temp_sensor/pct2075.h"
#include "temp_sensor/sb_tsi.h"
@@ -80,7 +79,6 @@ static int thermistor_get_temp(const struct temp_sensor_t *sensor,
.read = &thermistor_get_temp, \
.thermistor = GET_THERMISTOR_INFO( \
DT_PHANDLE(sensor_id, thermistor)), \
- .update_temperature = NULL, \
FILL_POWER_GOOD(named_id) })
#define TEMP_THERMISTOR(named_id, sensor_id) \
@@ -112,12 +110,10 @@ __maybe_unused static int pct2075_get_temp(const struct temp_sensor_t *sensor,
(DT_REG_ADDR(node_id) | I2C_FLAG_BIG_ENDIAN), \
},
-#define GET_ZEPHYR_TEMP_SENSOR_PCT2075(named_id) \
- (&(const struct zephyr_temp_sensor){ \
- .read = &pct2075_get_temp, \
- .thermistor = NULL, \
- .update_temperature = pct2075_update_temperature, \
- FILL_POWER_GOOD(named_id) })
+#define GET_ZEPHYR_TEMP_SENSOR_PCT2075(named_id) \
+ (&(const struct zephyr_temp_sensor){ .read = &pct2075_get_temp, \
+ .thermistor = NULL, \
+ FILL_POWER_GOOD(named_id) })
#define TEMP_PCT2075(named_id, sensor_id) \
[TEMP_SENSOR_ID(named_id)] = { \
@@ -148,10 +144,9 @@ __maybe_unused static int sb_tsi_get_temp(const struct temp_sensor_t *sensor,
#endif /* SB_TSI_COMPAT */
-#define GET_ZEPHYR_TEMP_SENSOR_SB_TSI(named_id) \
- (&(const struct zephyr_temp_sensor){ .read = &sb_tsi_get_temp, \
- .thermistor = NULL, \
- .update_temperature = NULL, \
+#define GET_ZEPHYR_TEMP_SENSOR_SB_TSI(named_id) \
+ (&(const struct zephyr_temp_sensor){ .read = &sb_tsi_get_temp, \
+ .thermistor = NULL, \
FILL_POWER_GOOD(named_id) })
#define TEMP_SB_TSI(named_id, sensor_id) \
@@ -179,12 +174,10 @@ __maybe_unused static int tmp112_get_temp(const struct temp_sensor_t *sensor,
.i2c_addr_flags = DT_REG_ADDR(node_id), \
},
-#define GET_ZEPHYR_TEMP_SENSOR_TMP112(named_id) \
- (&(const struct zephyr_temp_sensor){ \
- .read = &tmp112_get_temp, \
- .thermistor = NULL, \
- .update_temperature = tmp112_update_temperature, \
- FILL_POWER_GOOD(named_id) })
+#define GET_ZEPHYR_TEMP_SENSOR_TMP112(named_id) \
+ (&(const struct zephyr_temp_sensor){ .read = &tmp112_get_temp, \
+ .thermistor = NULL, \
+ FILL_POWER_GOOD(named_id) })
#define TEMP_TMP112(named_id, sensor_id) \
[TEMP_SENSOR_ID(named_id)] = { \
@@ -211,7 +204,6 @@ const struct tmp112_sensor_t tmp112_sensors[TMP112_COUNT] = {
.read = &rt9490_get_thermistor_val, \
.thermistor = GET_THERMISTOR_INFO( \
DT_PHANDLE(sensor_id, thermistor)), \
- .update_temperature = NULL, \
FILL_POWER_GOOD(named_id) })
#define TEMP_RT9490(named_id, sensor_id) \
@@ -243,20 +235,6 @@ const struct tmp112_sensor_t tmp112_sensors[TMP112_COUNT] = {
const struct temp_sensor_t temp_sensors[] = { DT_FOREACH_CHILD_SEP(
TEMP_SENSORS_NODEID, TEMP_SENSOR_ENTRY, (, )) };
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-static bool temp_sensor_check_power(const struct temp_sensor_t *sensor)
-{
-#if ANY_INST_HAS_POWER_GOOD_PIN
- if (sensor->zephyr_info->power_good_dev) {
- if (!gpio_pin_get(sensor->zephyr_info->power_good_dev,
- sensor->zephyr_info->power_good_pin))
- return false;
- }
-#endif
- return true;
-}
-
int temp_sensor_read(enum temp_sensor_id id, int *temp_ptr)
{
const struct temp_sensor_t *sensor;
@@ -265,26 +243,15 @@ int temp_sensor_read(enum temp_sensor_id id, int *temp_ptr)
return EC_ERROR_INVAL;
sensor = temp_sensors + id;
- if (!temp_sensor_check_power(sensor))
- return EC_ERROR_NOT_POWERED;
+#if ANY_INST_HAS_POWER_GOOD_PIN
+ if (sensor->zephyr_info->power_good_dev) {
+ if (!gpio_pin_get(sensor->zephyr_info->power_good_dev,
+ sensor->zephyr_info->power_good_pin))
+ return EC_ERROR_NOT_POWERED;
+ }
+#endif
return sensor->zephyr_info->read(sensor, temp_ptr);
}
-void temp_sensors_update(void)
-{
- for (int i = 0; i < TEMP_SENSOR_COUNT; i++) {
- const struct temp_sensor_t *sensor = temp_sensors + i;
-
- if (!sensor->zephyr_info->update_temperature)
- continue;
-
- if (!temp_sensor_check_power(sensor))
- continue;
-
- sensor->zephyr_info->update_temperature(sensor->idx);
- }
-}
-DECLARE_HOOK(HOOK_SECOND, temp_sensors_update, HOOK_PRIO_TEMP_SENSOR);
-
#endif /* DT_HAS_COMPAT_STATUS_OKAY(TEMP_SENSORS_COMPAT) */
diff --git a/zephyr/shim/src/thermal.c b/zephyr/shim/src/thermal.c
index fd1b0bfb52..abe6b7da9e 100644
--- a/zephyr/shim/src/thermal.c
+++ b/zephyr/shim/src/thermal.c
@@ -3,9 +3,9 @@
* found in the LICENSE file.
*/
-#include "ec_commands.h"
#include "temp_sensor.h"
#include "temp_sensor/temp_sensor.h"
+#include "ec_commands.h"
#define THERMAL_CONFIG(node_id) \
[TEMP_SENSOR_ID(node_id)] = { \
diff --git a/zephyr/shim/src/usb_muxes.c b/zephyr/shim/src/usb_muxes.c
index b3854e2ca8..3f81e97787 100644
--- a/zephyr/shim/src/usb_muxes.c
+++ b/zephyr/shim/src/usb_muxes.c
@@ -3,11 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/sys/util_macro.h>
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/sys/util_macro.h>
+/**
+ * This prevents creating struct usb_mux usb_muxes[] for platforms that didn't
+ * migrate USB mux configuration to DTS yet.
+ */
+#if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_usb_mux_chain)
/**
* @brief Check if @p mux_id is not part of @p chain_id or if @p chain_id USBC
@@ -90,3 +95,5 @@ BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == CONFIG_USB_PD_PORT_MAX_COUNT);
* MAYBE_CONST struct usb_mux USB_MUX_NODE_<node_id> = { ... };
*/
USB_MUX_FOREACH_MUX(USB_MUX_DEFINE)
+
+#endif /* #if DT_HAS_COMPAT_STATUS_OKAY(cros_ec_usb_mux_chain) */
diff --git a/zephyr/shim/src/usba.c b/zephyr/shim/src/usba.c
index a7360a9ddb..4db8c31e6a 100644
--- a/zephyr/shim/src/usba.c
+++ b/zephyr/shim/src/usba.c
@@ -5,9 +5,10 @@
#define DT_DRV_COMPAT cros_ec_usba_port_enable_pins
+#include <zephyr/devicetree.h>
#include "hooks.h"
-#include <zephyr/devicetree.h>
+#if DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT)
#define PIN(node_id, prop, idx) \
GPIO_SIGNAL(DT_PHANDLE_BY_IDX(node_id, prop, idx)),
@@ -22,3 +23,5 @@ const
#endif
int usb_port_enable[] = { DT_INST_FOREACH_STATUS_OKAY(
USBA_ENABLE_PINS) };
+
+#endif /* DT_HAS_COMPAT_STATUS_OKAY(DT_DRV_COMPAT) */
diff --git a/zephyr/shim/src/watchdog.c b/zephyr/shim/src/watchdog.c
index 413ba50484..eb82f228d5 100644
--- a/zephyr/shim/src/watchdog.c
+++ b/zephyr/shim/src/watchdog.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "config.h"
-#include "hooks.h"
-#include "watchdog.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/watchdog.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
+
+#include "config.h"
+#include "hooks.h"
+#include "watchdog.h"
LOG_MODULE_REGISTER(watchdog_shim, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/src/ztest_system.c b/zephyr/shim/src/ztest_system.c
index 13614ec8f0..5933f18f05 100644
--- a/zephyr/shim/src/ztest_system.c
+++ b/zephyr/shim/src/ztest_system.c
@@ -12,7 +12,7 @@
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
-char mock_jump_data[CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE];
+char mock_jump_data[sizeof(struct jump_data) + 256];
/* When CONFIG_RAM_SIZE is defined, this is provided by common/system.c */
#ifndef CONFIG_RAM_SIZE
diff --git a/zephyr/subsys/CMakeLists.txt b/zephyr/subsys/CMakeLists.txt
index dfd1a35871..a3837b94e8 100644
--- a/zephyr/subsys/CMakeLists.txt
+++ b/zephyr/subsys/CMakeLists.txt
@@ -1,4 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(ap_pwrseq)
-add_subdirectory(emul)
diff --git a/zephyr/subsys/ap_pwrseq/include/signal_adc.h b/zephyr/subsys/ap_pwrseq/include/signal_adc.h
index dea6d315d8..81c6a1edd4 100644
--- a/zephyr/subsys/ap_pwrseq/include/signal_adc.h
+++ b/zephyr/subsys/ap_pwrseq/include/signal_adc.h
@@ -6,8 +6,6 @@
#ifndef __AP_PWRSEQ_SIGNAL_ADC_H__
#define __AP_PWRSEQ_SIGNAL_ADC_H__
-#include <power_signals.h>
-
#define PWR_SIG_TAG_ADC PWR_ADC_
/*
diff --git a/zephyr/subsys/ap_pwrseq/include/x86_common_pwrseq.h b/zephyr/subsys/ap_pwrseq/include/x86_common_pwrseq.h
index 75390b5005..dcb2b3b968 100644
--- a/zephyr/subsys/ap_pwrseq/include/x86_common_pwrseq.h
+++ b/zephyr/subsys/ap_pwrseq/include/x86_common_pwrseq.h
@@ -7,7 +7,6 @@
#define __X86_COMMON_PWRSEQ_H__
#include <zephyr/logging/log.h>
-
#include <ap_power/ap_power_interface.h>
#include <ap_power_override_functions.h>
#include <power_signals.h>
diff --git a/zephyr/subsys/ap_pwrseq/power_host_sleep.c b/zephyr/subsys/ap_pwrseq/power_host_sleep.c
index bc38215921..30025d21ea 100644
--- a/zephyr/subsys/ap_pwrseq/power_host_sleep.c
+++ b/zephyr/subsys/ap_pwrseq/power_host_sleep.c
@@ -174,11 +174,10 @@ void ap_power_sleep_notify_transition(enum ap_power_sleep_type check_state)
ap_power_ev_send_callbacks(AP_POWER_SUSPEND);
} else if (check_state == AP_POWER_SLEEP_RESUME) {
ap_power_ev_send_callbacks(AP_POWER_RESUME);
- /*
- * Transition is done; reset sleep state after resume.
- */
- ap_power_sleep_set_notify(AP_POWER_SLEEP_NONE);
}
+
+ /* Transition is done; reset sleep state. */
+ ap_power_sleep_set_notify(AP_POWER_SLEEP_NONE);
}
#endif /* CONFIG_AP_PWRSEQ_S0IX */
diff --git a/zephyr/subsys/ap_pwrseq/power_signals.c b/zephyr/subsys/ap_pwrseq/power_signals.c
index 1ae8604a3a..a02eef6e6b 100644
--- a/zephyr/subsys/ap_pwrseq/power_signals.c
+++ b/zephyr/subsys/ap_pwrseq/power_signals.c
@@ -3,18 +3,18 @@
* found in the LICENSE file.
*/
-#include "signal_adc.h"
-#include "signal_gpio.h"
-#include "signal_vw.h"
-
#include <zephyr/kernel.h>
+#include <zephyr/toolchain.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/atomic.h>
-#include <zephyr/toolchain.h>
#include <ap_power/ap_pwrseq.h>
#include <power_signals.h>
+#include "signal_gpio.h"
+#include "signal_vw.h"
+#include "signal_adc.h"
+
LOG_MODULE_DECLARE(ap_pwrseq, CONFIG_AP_PWRSEQ_LOG_LEVEL);
#if DT_HAS_COMPAT_STATUS_OKAY(intel_ap_pwrseq)
diff --git a/zephyr/subsys/ap_pwrseq/signal_gpio.c b/zephyr/subsys/ap_pwrseq/signal_gpio.c
index f09f6b23cb..1dbd430bef 100644
--- a/zephyr/subsys/ap_pwrseq/signal_gpio.c
+++ b/zephyr/subsys/ap_pwrseq/signal_gpio.c
@@ -3,12 +3,10 @@
* found in the LICENSE file.
*/
-#include "system.h"
-
-#include <zephyr/drivers/gpio.h>
-
#include <power_signals.h>
#include <signal_gpio.h>
+#include <zephyr/drivers/gpio.h>
+#include "system.h"
#define MY_COMPAT intel_ap_pwrseq_gpio
diff --git a/zephyr/subsys/ap_pwrseq/signal_vw.c b/zephyr/subsys/ap_pwrseq/signal_vw.c
index cee88e362d..0e9e4affff 100644
--- a/zephyr/subsys/ap_pwrseq/signal_vw.c
+++ b/zephyr/subsys/ap_pwrseq/signal_vw.c
@@ -3,13 +3,12 @@
* found in the LICENSE file.
*/
-#include "signal_vw.h"
-
-#include <zephyr/drivers/espi.h>
-
#include <atomic.h>
+#include <zephyr/drivers/espi.h>
#include <x86_non_dsx_common_pwrseq_sm_handler.h>
+#include "signal_vw.h"
+
#define MY_COMPAT intel_ap_pwrseq_vw
#if HAS_VW_SIGNALS
diff --git a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c
index 6ac2b5e0ba..dbceeacc85 100644
--- a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c
+++ b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_console.c
@@ -3,10 +3,8 @@
* found in the LICENSE file.
*/
-#include <stdlib.h>
-
#include <zephyr/shell/shell.h>
-
+#include <stdlib.h>
#include <x86_non_dsx_common_pwrseq_sm_handler.h>
LOG_MODULE_DECLARE(ap_pwrseq, CONFIG_AP_PWRSEQ_LOG_LEVEL);
diff --git a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c
index 55f1414a4b..09846759ee 100644
--- a/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c
+++ b/zephyr/subsys/ap_pwrseq/x86_non_dsx_common_pwrseq_sm_handler.c
@@ -3,12 +3,11 @@
* found in the LICENSE file.
*/
-#include "zephyr_console_shim.h"
-
+#include <atomic.h>
#include <zephyr/init.h>
-#include <atomic.h>
#include <x86_non_dsx_common_pwrseq_sm_handler.h>
+#include "zephyr_console_shim.h"
static K_KERNEL_STACK_DEFINE(pwrseq_thread_stack, CONFIG_AP_PWRSEQ_STACK_SIZE);
static struct k_thread pwrseq_thread_data;
diff --git a/zephyr/subsys/emul/CMakeLists.txt b/zephyr/subsys/emul/CMakeLists.txt
deleted file mode 100644
index 3394afcc94..0000000000
--- a/zephyr/subsys/emul/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-
-add_subdirectory("ap_pwrseq")
diff --git a/zephyr/subsys/emul/Kconfig b/zephyr/subsys/emul/Kconfig
deleted file mode 100644
index 48011312d5..0000000000
--- a/zephyr/subsys/emul/Kconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-rsource "ap_pwrseq/Kconfig"
diff --git a/zephyr/subsys/emul/ap_pwrseq/CMakeLists.txt b/zephyr/subsys/emul/ap_pwrseq/CMakeLists.txt
deleted file mode 100644
index 476232d13b..0000000000
--- a/zephyr/subsys/emul/ap_pwrseq/CMakeLists.txt
+++ /dev/null
@@ -1 +0,0 @@
-zephyr_library_sources_ifdef(CONFIG_EMUL_POWER_SIGNALS emul_power_signals.c)
diff --git a/zephyr/subsys/emul/ap_pwrseq/Kconfig b/zephyr/subsys/emul/ap_pwrseq/Kconfig
deleted file mode 100644
index 309ee08eae..0000000000
--- a/zephyr/subsys/emul/ap_pwrseq/Kconfig
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-if ZTEST
-
-config EMUL_POWER_SIGNALS
- bool "Enable Power Signals Emulator"
- help
- Power signals emulator imitates the behavior of power signals
- that interact with the EC within a given platform. It enables testing
- AP Power Sequence execution in a virtual environment.
-
-if EMUL_POWER_SIGNALS
-
-module = EMUL_POWER_SIGNALS
-module-str = Power Signals Emulator
-source "subsys/logging/Kconfig.template.log_config"
-
-config EMUL_POWER_SIGNALS_WORK_QUEUE_STACK_SIZE
- int "Power Signals Emulator internal work queue stack size"
- default 1024
- help
- Power Signal Emulator has its own dedicated work queue, this defines
- work queue thread stack size.
-
-config EMUL_POWER_SIGNALS_WORK_QUEUE_PRIO
- int "Power Signals Emulator internal work queue thread priority"
- default 0
- help
- Defines work queue thread thread priority.
-
-endif # EMUL_POWER_SIGNALS
-endif # ZTEST
diff --git a/zephyr/subsys/emul/ap_pwrseq/emul_power_signals.c b/zephyr/subsys/emul/ap_pwrseq/emul_power_signals.c
deleted file mode 100644
index e8f211bb56..0000000000
--- a/zephyr/subsys/emul/ap_pwrseq/emul_power_signals.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ap_power/ap_power.h"
-#include "ap_power/ap_power_events.h"
-#include "chipset.h"
-#include "emul/emul_power_signals.h"
-#include "power_signals.h"
-#include "test_state.h"
-
-#include <zephyr/drivers/adc.h>
-#include <zephyr/drivers/espi.h>
-#include <zephyr/drivers/espi_emul.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
-
-LOG_MODULE_REGISTER(emul_power_signal, CONFIG_EMUL_POWER_SIGNALS_LOG_LEVEL);
-
-/**
- * @brief Power signal source type.
- */
-enum power_signal_emul_source {
- PWR_SIG_EMUL_SRC_GPIO,
- PWR_SIG_EMUL_SRC_VW,
- PWR_SIG_EMUL_SRC_EXT,
- PWR_SIG_EMUL_SRC_ADC,
-};
-
-/**
- * @brief Power signal containers definition.
- */
-union power_signal_emul_signal_spec {
- struct gpio_dt_spec gpio;
- struct adc_dt_spec adc;
-};
-
-/**
- * @brief Power signal descriptor.
- */
-struct power_signal_emul_signal_desc {
- const enum power_signal enum_id;
- const char *name;
- const enum power_signal_emul_source source;
- const union power_signal_emul_signal_spec spec;
-};
-
-/**
- * @brief Power signal output definition.
- */
-struct power_signal_emul_output {
- struct power_signal_emul_signal_desc desc;
- const int assert_value;
- const int assert_delay_ms;
- const int deassert_value;
- const int deassert_delay_ms;
- const int init_value;
- const bool retain;
- const bool invert;
- struct k_work_delayable d_work;
- int value;
-};
-
-enum power_signal_edge {
- EDGE_ACTIVE_ON_ASSERT,
- EDGE_ACTIVE_ON_DEASSERT,
- EDGE_ACTIVE_ON_BOTH,
-};
-
-/**
- * @brief Power signal input definition.
- */
-struct power_signal_emul_input {
- struct power_signal_emul_signal_desc desc;
- const int assert_value;
- const int init_value;
- const bool retain;
- const enum power_signal_edge edge;
- struct gpio_callback cb;
- int value;
-};
-
-/**
- * @brief Power signal node definition,
- * One node contains at least one input signal and one or more output
- * signals.
- */
-struct power_signal_emul_node {
- const char *name;
- struct power_signal_emul_input input;
- const int outputs_count;
- struct power_signal_emul_output *const outputs;
-};
-
-#define EMUL_POWER_SIGNAL_GET_SOURCE(inst) \
- COND_CODE_1( \
- DT_NODE_HAS_COMPAT(inst, intel_ap_pwrseq_gpio), \
- (PWR_SIG_EMUL_SRC_GPIO), \
- (COND_CODE_1( \
- DT_NODE_HAS_COMPAT(inst, intel_ap_pwrseq_vw), \
- (PWR_SIG_EMUL_SRC_VW), \
- (COND_CODE_1(DT_NODE_HAS_COMPAT( \
- inst, intel_ap_pwrseq_external), \
- (PWR_SIG_EMUL_SRC_EXT), \
- (PWR_SIG_EMUL_SRC_ADC))))))
-
-#define EMUL_POWER_SIGNAL_GET_SIGNAL_SPEC(inst, dir_signal) \
- { \
- COND_CODE_1(DT_NODE_HAS_COMPAT(DT_PROP(inst, dir_signal), \
- intel_ap_pwrseq_gpio), \
- (.gpio = GPIO_DT_SPEC_GET( \
- DT_PROP(inst, dir_signal), gpios)), \
- ()) \
- }
-
-#define EMUL_POWER_SIGNAL_GET_SIGNAL(inst, dir) \
- { \
- .enum_id = PWR_SIGNAL_ENUM(DT_PROP(inst, dir)), \
- .name = DT_PROP(DT_PROP(inst, dir), enum_name), \
- .source = EMUL_POWER_SIGNAL_GET_SOURCE(DT_PROP(inst, dir)), \
- .spec = EMUL_POWER_SIGNAL_GET_SIGNAL_SPEC(inst, dir), \
- }
-
-#define EMUL_POWER_SIGNAL_IN_DEF(inst) \
- { \
- .desc = EMUL_POWER_SIGNAL_GET_SIGNAL(inst, input_signal), \
- .assert_value = DT_PROP(inst, assert_value), \
- .init_value = DT_PROP_OR(inst, init_value, 0), \
- .edge = DT_STRING_TOKEN(inst, edge), \
- .retain = !DT_NODE_HAS_PROP(inst, init_value), \
- }
-
-#define EMUL_POWER_SIGNAL_OUT_DEF(inst) \
- { \
- .desc = EMUL_POWER_SIGNAL_GET_SIGNAL(inst, output_signal), \
- .assert_value = DT_PROP(inst, assert_value), \
- .assert_delay_ms = DT_PROP(inst, assert_delay_ms), \
- .deassert_value = DT_PROP(inst, deassert_value), \
- .deassert_delay_ms = DT_PROP(inst, deassert_delay_ms), \
- .init_value = DT_PROP_OR(inst, init_value, 0), \
- .retain = !DT_NODE_HAS_PROP(inst, init_value), \
- .invert = DT_PROP(inst, invert_value), \
- },
-
-#define EMUL_POWER_SIGNAL_OUT_ARRAY_DEF(inst) \
- static struct power_signal_emul_output DT_CAT(inst, _output)[] = { \
- DT_FOREACH_CHILD_STATUS_OKAY(inst, EMUL_POWER_SIGNAL_OUT_DEF) \
- };
-
-#define EMUL_POWER_SIGNAL_GET_INPUT_ENUM(inst) ENUM_##inst##_OUTPUT,
-
-#define EMUL_POWER_SIGNAL_NODES_DEF(inst) \
- enum { \
- DT_FOREACH_CHILD_STATUS_OKAY(inst, \
- EMUL_POWER_SIGNAL_GET_INPUT_ENUM) \
- DT_CAT(inst, _OUTPUT_COUNT), \
- }; \
- __COND_CODE(IS_EQ(DT_CAT(inst, _OUTPUT_COUNT), 0), (), \
- (EMUL_POWER_SIGNAL_OUT_ARRAY_DEF(inst))) \
- static struct power_signal_emul_node DT_CAT(inst, _node) = { \
- .name = DT_NODE_FULL_NAME(inst), \
- .input = EMUL_POWER_SIGNAL_IN_DEF(inst), \
- .outputs_count = inst##_OUTPUT_COUNT, \
- .outputs = __COND_CODE(IS_EQ(DT_CAT(inst, _OUTPUT_COUNT), 0), \
- (NULL), (DT_CAT(inst, _output))), \
- };
-
-DT_FOREACH_STATUS_OKAY(intel_ap_pwr_signal_emul, EMUL_POWER_SIGNAL_NODES_DEF)
-
-#define EMUL_POWER_SIGNAL_NODES_ARRAY_GET_NODES_REFS_WITH_COMMA(inst) \
- (&DT_CAT(inst, _node)),
-
-#define EMUL_POWER_SIGNAL_NODES_ARRAY_GET_NODES_REFS(inst) \
- EMUL_POWER_SIGNAL_NODES_ARRAY_GET_NODES_REFS_WITH_COMMA(inst)
-
-#define EMUL_POWER_SIGNAL_NODES_ARRAY_GET_IO_SIGNALS(inst, prop, idx) \
- EMUL_POWER_SIGNAL_NODES_ARRAY_GET_NODES_REFS( \
- DT_PHANDLE_BY_IDX(inst, prop, idx))
-
-#define EMUL_POWER_SIGNAL_NODES_ARRAY_DEF(inst) \
- static struct power_signal_emul_node *DT_CAT(inst, _nodes)[] = { \
- DT_FOREACH_PROP_ELEM( \
- inst, nodes, \
- EMUL_POWER_SIGNAL_NODES_ARRAY_GET_IO_SIGNALS) \
- };
-
-DT_FOREACH_STATUS_OKAY(intel_ap_pwr_test_platform,
- EMUL_POWER_SIGNAL_NODES_ARRAY_DEF)
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_NODES_REFS_ITEM(inst) \
- DT_CAT(inst, _nodes),
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_NODES_REFS(inst) \
- EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_NODES_REFS_ITEM(inst)
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_IO_SIGNALS(inst, prop, idx) \
- EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_NODES_REFS( \
- DT_PHANDLE_BY_IDX(inst, prop, idx))
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_NODES(inst) \
- { \
- DT_FOREACH_PROP_ELEM( \
- inst, nodes, \
- EMUL_POWER_SIGNAL_TEST_PLATFORM_GET_IO_SIGNALS) \
- }
-
-#define EMUL_POWER_SIGNAL_TEST_PLATFORM_DEF(inst) \
- const struct power_signal_emul_test_platform inst = { \
- .name_id = DT_NODE_FULL_NAME(inst), \
- .nodes_count = DT_PROP_LEN(inst, nodes), \
- .nodes = DT_CAT(inst, _nodes), \
- };
-
-DT_FOREACH_STATUS_OKAY(intel_ap_pwr_test_platform,
- EMUL_POWER_SIGNAL_TEST_PLATFORM_DEF)
-
-static K_KERNEL_STACK_DEFINE(work_q_stack,
- CONFIG_EMUL_POWER_SIGNALS_WORK_QUEUE_STACK_SIZE);
-
-struct k_work_q work_q;
-
-static const struct power_signal_emul_test_platform *cur_test_platform;
-
-static bool emul_ready;
-
-/**
- * @brief Set GPIO type power signal to specified value.
- *
- * @param spec Pointer to container for GPIO pin information specified in
- * devicetree.
- * @param value Value to be set on GPIO.
- */
-static void power_signal_emul_set_gpio_value(const struct gpio_dt_spec *spec,
- int value)
-{
- gpio_flags_t gpio_flags;
- int ret;
-
- ret = gpio_emul_flags_get(spec->port, spec->pin, &gpio_flags);
- zassert_ok(ret, "Getting GPIO flags!!");
-
- if (gpio_flags & GPIO_INPUT) {
- ret = gpio_emul_input_set(spec->port, spec->pin, value);
- } else if (gpio_flags & GPIO_OUTPUT) {
- ret = gpio_pin_set(spec->port, spec->pin, value);
- }
- zassert_ok(ret, "Setting GPIO value!!");
-}
-
-/**
- * @brief Set power signal to specified value.
- *
- * @param desc Pointer to power signal descriptor.
- * @param value Value to be set on power signal.
- */
-static void
-power_signal_emul_set_value(struct power_signal_emul_signal_desc *desc,
- int value)
-{
- LOG_DBG("Set Signal %s -> %d", desc->name, value);
-
- switch (desc->source) {
- case PWR_SIG_EMUL_SRC_GPIO:
- power_signal_emul_set_gpio_value(&desc->spec.gpio, !!value);
- break;
-
- case PWR_SIG_EMUL_SRC_EXT:
- zassert_ok(power_signal_set(desc->enum_id, value),
- "Setting %s Signal value!!", desc->name);
- __fallthrough;
-
- case PWR_SIG_EMUL_SRC_VW:
- power_signal_interrupt(desc->enum_id, value);
- break;
-
- default:
- zassert_unreachable("Undefined Signal %s!!", desc->name);
- }
-}
-
-/**
- * @brief Get GPIO type power signal value.
- *
- * @param spec Pointer to container for GPIO pin information specified in
- * devicetree.
- *
- * @return GPIO type power signal value.
- */
-static int power_signal_emul_get_gpio_value(const struct gpio_dt_spec *spec)
-{
- gpio_flags_t gpio_flags;
- int ret;
-
- ret = gpio_emul_flags_get(spec->port, spec->pin, &gpio_flags);
- zassert_ok(ret, "Getting GPIO flags!!");
-
- if (gpio_flags & GPIO_INPUT) {
- ret = gpio_pin_get(spec->port, spec->pin);
- } else if (gpio_flags & GPIO_OUTPUT) {
- ret = gpio_emul_output_get(spec->port, spec->pin);
- }
-
- return ret;
-}
-
-/**
- * @brief Get power signal value.
- *
- * @param desc Pointer to power signal descriptor.
- *
- * @return Power signal value.
- */
-static int
-power_signal_emul_get_value(struct power_signal_emul_signal_desc *desc)
-{
- int ret;
-
- if (desc->source == PWR_SIG_EMUL_SRC_GPIO) {
- ret = power_signal_emul_get_gpio_value(&desc->spec.gpio);
- } else {
- ret = power_signal_get(desc->enum_id);
- }
-
- return ret;
-}
-
-/**
- * @brief Handle GPIO type power signal interrupt.
- *
- * @param port Pointer to GPIO device.
- * @param cb Original struct gpio_callback owning this handler.
- * @param pins Mask of pins that triggers the callback handler.
- */
-static void emul_power_signal_gpio_interrupt(const struct device *port,
- struct gpio_callback *cb,
- gpio_port_pins_t pins)
-{
- struct power_signal_emul_input *in_signal =
- CONTAINER_OF(cb, struct power_signal_emul_input, cb);
- struct power_signal_emul_node *node =
- CONTAINER_OF(in_signal, struct power_signal_emul_node, input);
- int value;
- int delay;
-
- value = power_signal_emul_get_value(&in_signal->desc);
- if (value == in_signal->value) {
- return;
- }
-
- in_signal->value = value;
-
- if (!emul_ready) {
- return;
- }
-
- if (in_signal->edge == EDGE_ACTIVE_ON_DEASSERT &&
- value == in_signal->assert_value) {
- return;
- } else if (in_signal->edge == EDGE_ACTIVE_ON_ASSERT &&
- value != in_signal->assert_value) {
- return;
- }
-
- LOG_DBG("INT: Set Signal %s -> %d", in_signal->desc.name, value);
- for (int i = 0; i < node->outputs_count; i++) {
- struct power_signal_emul_output *out_signal = &node->outputs[i];
-
- out_signal->value = (value == in_signal->assert_value) ^
- out_signal->invert ?
- out_signal->assert_value :
- out_signal->deassert_value;
-
- delay = (value == in_signal->assert_value) ?
- out_signal->assert_delay_ms :
- out_signal->deassert_delay_ms;
-
- LOG_DBG("INT: Delay Signal %s", out_signal->desc.name);
- k_work_schedule_for_queue(&work_q, &out_signal->d_work,
- K_MSEC(delay));
- }
-}
-
-/**
- * @brief Handle power signal delayed work.
- *
- * This will set power signal value accordingly.
- *
- * @param work Pointer to work structure.
- */
-static void emul_signal_work_hanlder(struct k_work *work)
-{
- struct k_work_delayable *d_work = k_work_delayable_from_work(work);
- struct power_signal_emul_output *out_signal =
- CONTAINER_OF(d_work, struct power_signal_emul_output, d_work);
-
- power_signal_emul_set_value(&out_signal->desc, out_signal->value);
-}
-
-/**
- * @brief Initialize power signal emulator node.
- *
- * This will enable corresponding initiator power signal interruption and
- * its handler's power signals work structures.
- *
- * @param node Pointer to node containing power signals.
- */
-static int power_signal_init_node(struct power_signal_emul_node *node)
-{
- struct power_signal_emul_input *in_signal = &node->input;
- struct power_signal_emul_output *out_signal;
-
- if (!node->outputs_count) {
- LOG_ERR("Node does not have output signal!!");
- return -EINVAL;
- }
-
- LOG_DBG("Initializing node: %s", node->name);
- for (int i = 0; i < node->outputs_count; i++) {
- out_signal = &node->outputs[i];
-
- if (out_signal->retain) {
- out_signal->value =
- power_signal_emul_get_value(&out_signal->desc);
- } else {
- /* Not retaining previous value, override */
- power_signal_emul_set_value(&out_signal->desc,
- out_signal->init_value);
- out_signal->value = out_signal->init_value;
- }
- k_work_init_delayable(&out_signal->d_work,
- emul_signal_work_hanlder);
- }
-
- if (in_signal->retain) {
- in_signal->value =
- power_signal_emul_get_value(&in_signal->desc);
- } else {
- /* Not retaining previous value, override */
- power_signal_emul_set_value(&in_signal->desc,
- in_signal->init_value);
- in_signal->value = in_signal->init_value;
- }
- if (in_signal->desc.source == PWR_SIG_EMUL_SRC_GPIO) {
- gpio_init_callback(&in_signal->cb,
- emul_power_signal_gpio_interrupt,
- BIT(in_signal->desc.spec.gpio.pin));
-
- gpio_add_callback(in_signal->desc.spec.gpio.port,
- &in_signal->cb);
-
- gpio_pin_interrupt_configure_dt(&in_signal->desc.spec.gpio,
- GPIO_INT_EDGE_BOTH);
- }
- return 0;
-}
-
-/** See description in emul_power_signals.h */
-int power_signal_emul_load(
- const struct power_signal_emul_test_platform *test_platform)
-{
- int ret;
-
- if (cur_test_platform) {
- LOG_ERR("Power Signal Emulator Busy!!");
- return -EBUSY;
- }
-
- cur_test_platform = test_platform;
-
- LOG_DBG("Loading Emulator test: %s", cur_test_platform->name_id);
-
- for (int i = 0; i < cur_test_platform->nodes_count; i++) {
- ret = power_signal_init_node(cur_test_platform->nodes[i]);
- if (ret) {
- power_signal_emul_unload();
- return ret;
- }
- }
-
- emul_ready = true;
- LOG_DBG("Loading Emulator test Done");
- return 0;
-}
-
-/** See description in emul_power_signals.h */
-int power_signal_emul_unload(void)
-{
- struct power_signal_emul_node *node;
- struct power_signal_emul_output *out_signal;
- struct power_signal_emul_input *in_signal;
-
- if (!cur_test_platform) {
- LOG_ERR("No Test Platform Loaded!!");
- return -EINVAL;
- }
-
- emul_ready = false;
- for (int i = 0; i < cur_test_platform->nodes_count; i++) {
- node = cur_test_platform->nodes[i];
- in_signal = &node->input;
-
- if (in_signal->desc.source != PWR_SIG_EMUL_SRC_GPIO) {
- /* Currently, Only output GPIO signals are supported */
- continue;
- }
-
- for (int j = 0; j < node->outputs_count; j++) {
- static struct k_work_sync work_sync;
-
- out_signal = &node->outputs[j];
- k_work_cancel_delayable_sync(&out_signal->d_work,
- &work_sync);
- }
- gpio_pin_interrupt_configure_dt(&in_signal->desc.spec.gpio,
- GPIO_INT_DISABLE);
- if (in_signal->cb.handler) {
- gpio_remove_callback(in_signal->desc.spec.gpio.port,
- &in_signal->cb);
- }
- }
- cur_test_platform = NULL;
- return 0;
-}
-
-/**
- * @brief Initialize power signal emulator internal work queue.
- *
- * @param dev Unused parameter.
- *
- * @return 0 Return success only.
- */
-static int power_signal_emul_work_q_init(const struct device *dev)
-{
- ARG_UNUSED(dev);
- struct k_work_queue_config cfg = {
- .name = "psignal_emul",
- .no_yield = true,
- };
-
- k_work_queue_start(&work_q, work_q_stack,
- K_KERNEL_STACK_SIZEOF(work_q_stack),
- CONFIG_EMUL_POWER_SIGNALS_WORK_QUEUE_PRIO, &cfg);
- return 0;
-}
-
-SYS_INIT(power_signal_emul_work_q_init, POST_KERNEL,
- CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
diff --git a/zephyr/test/ap_power/CMakeLists.txt b/zephyr/test/ap_power/CMakeLists.txt
index 4669dac07e..7b44013961 100644
--- a/zephyr/test/ap_power/CMakeLists.txt
+++ b/zephyr/test/ap_power/CMakeLists.txt
@@ -6,8 +6,6 @@ cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
project(ap_power)
-add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
-
# Include the local test directory for shimmed_test_tasks.h
zephyr_include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
zephyr_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
diff --git a/zephyr/test/ap_power/boards/alderlake.dts b/zephyr/test/ap_power/boards/alderlake.dts
deleted file mode 100644
index 30432a9c72..0000000000
--- a/zephyr/test/ap_power/boards/alderlake.dts
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <dt-bindings/gpio_defines.h>
-
-/ {
- common-pwrseq {
- compatible = "intel,ap-pwrseq";
- s5-inactivity-timeout = <1>;
- };
-
- en_pp5000: pwr-en-pp5000-s5 {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "PP5000_S5 enable output to regulator";
- enum-name = "PWR_EN_PP5000_A";
- gpios = <&gpio0 10 0>;
- output;
- };
- en_pp3300: pwr-en-pp3300-s5 {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "PP3300_S5 enable output to LS";
- enum-name = "PWR_EN_PP3300_A";
- gpios = <&gpio0 11 0>;
- output;
- };
- rsmrst: pwr-pg-ec-rsmrst-odl {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "RSMRST power good from regulator";
- enum-name = "PWR_RSMRST";
- gpios = <&gpio0 12 0>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- ec_pch_rsmrst: pwr-ec-pch-rsmrst-odl {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "RSMRST output to PCH";
- enum-name = "PWR_EC_PCH_RSMRST";
- gpios = <&gpio0 13 0>;
- output;
- };
- slp_s0: pwr-slp-s0-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SLP_S0_L input from PCH";
- enum-name = "PWR_SLP_S0";
- gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- no-enable;
- };
- slp_s3: pwr-slp-s3-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SLP_S3_L input from PCH";
- enum-name = "PWR_SLP_S3";
- gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- slp_sus: pwr-slp-sus-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SLP_SUS_L input from PCH";
- enum-name = "PWR_SLP_SUS";
- gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
- interrupt-flags = <GPIO_INT_EDGE_BOTH>;
- };
- ec_soc_dsw_pwrok: pwr-ec-soc-dsw-pwrok {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "DSW_PWROK output to PCH";
- enum-name = "PWR_EC_SOC_DSW_PWROK";
- gpios = <&gpio0 17 0>;
- output;
- };
- pwr-vccst-pwrgd-od {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "VCCST_PWRGD output to PCH";
- enum-name = "PWR_VCCST_PWRGD";
- gpios = <&gpio0 18 0>;
- output;
- };
- pwr-imvp9-vrrdy-od {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "VRRDY input from IMVP9";
- enum-name = "PWR_IMVP9_VRRDY";
- gpios = <&gpio0 19 0>;
- };
- pch_pwrok: pwr-pch-pwrok {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "PCH_PWROK output to PCH";
- enum-name = "PWR_PCH_PWROK";
- gpios = <&gpio0 20 0>;
- output;
- };
- pwr-ec-pch-sys-pwrok {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SYS_PWROK output to PCH";
- enum-name = "PWR_EC_PCH_SYS_PWROK";
- gpios = <&gpio0 21 0>;
- output;
- };
- pwr-sys-rst-l {
- compatible = "intel,ap-pwrseq-gpio";
- dbg-label = "SYS_RESET# output to PCH";
- enum-name = "PWR_SYS_RST";
- gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
- output;
- };
- slp_s4: pwr-slp-s4 {
- compatible = "intel,ap-pwrseq-vw";
- dbg-label = "SLP_S4 virtual wire input from PCH";
- enum-name = "PWR_SLP_S4";
- virtual-wire = "ESPI_VWIRE_SIGNAL_SLP_S4";
- vw-invert;
- };
- slp_s5: pwr-slp-s5 {
- compatible = "intel,ap-pwrseq-vw";
- dbg-label = "SLP_S5 virtual wire input from PCH";
- enum-name = "PWR_SLP_S5";
- virtual-wire = "ESPI_VWIRE_SIGNAL_SLP_S5";
- vw-invert;
- };
- all_sys_pwrgd: pwr-all-sys-pwrgd {
- compatible = "intel,ap-pwrseq-external";
- dbg-label = "Combined all power good";
- enum-name = "PWR_ALL_SYS_PWRGD";
- };
- dsw_pwrok: pwr-pp3300-pwrok {
- compatible = "intel,ap-pwrseq-external";
- dbg-label = "PP3300 PWROK";
- enum-name = "PWR_DSW_PWROK";
- };
- pwr-pp1p05-pwrok {
- compatible = "intel,ap-pwrseq-external";
- dbg-label = "PP1P05 PWROK";
- enum-name = "PWR_PG_PP1P05";
- };
-
- en_pp3300_emul: en-pp3300-emul {
- compatible = "intel,ap-pwr-signal-emul";
- input-signal = <&en_pp3300>;
- init-value = <0>;
- pp3300-dsw-pwrok-emul {
- output-signal = <&dsw_pwrok>;
- assert-delay-ms = <10>;
- init-value= <0>;
- };
- };
-
- en_pp5000_emul: en-pp5000-emul {
- compatible = "intel,ap-pwr-signal-emul";
- input-signal = <&en_pp5000>;
- init-value = <0>;
- pp5000-rsmrst-emul {
- output-signal = <&rsmrst>;
- assert-delay-ms = <40>;
- init-value= <0>;
- };
- };
-
- ec_soc_dsw_pwrok_emul: ec-soc-dsw-pwrok-emul {
- compatible = "intel,ap-pwr-signal-emul";
- input-signal = <&ec_soc_dsw_pwrok>;
- init-value = <0>;
- ec-dsw-pwrok-slp-sus-emul {
- output-signal = <&slp_sus>;
- assert-delay-ms = <20>;
- init-value= <0>;
- };
- };
-
- ec_pch_rsmrst_emul: ec-pch-rsmrst-emul {
- compatible = "intel,ap-pwr-signal-emul";
- input-signal = <&ec_pch_rsmrst>;
- init-value = <0>;
- ec-pch-rsmrst-slp-s5-emul {
- output-signal = <&slp_s5>;
- assert-delay-ms = <20>;
- invert-value;
- init-value= <1>;
- };
- ec-pch-rsmrst-slp-s4-emul {
- output-signal = <&slp_s4>;
- assert-delay-ms = <30>;
- invert-value;
- init-value= <1>;
- };
- ec-pch-rsmrst-slp-s3-emul {
- output-signal = <&slp_s3>;
- assert-delay-ms = <40>;
- init-value= <0>;
- };
- ec-pch-rsmrst-slp-s0-emul {
- output-signal = <&slp_s0>;
- assert-delay-ms = <45>;
- init-value= <0>;
- };
- ec-pch-rsmrst-all-sys-pwrgd {
- output-signal = <&all_sys_pwrgd>;
- assert-delay-ms = <50>;
- init-value= <0>;
- };
- };
-
- tp-sys-g3-to-s0 {
- compatible = "intel,ap-pwr-test-platform";
- nodes = <&en_pp3300_emul &en_pp5000_emul
- &ec_soc_dsw_pwrok_emul &ec_pch_rsmrst_emul>;
- };
-
- pch_pwrok_power_fail_emul: pch-pwrok-power-fail-emul {
- compatible = "intel,ap-pwr-signal-emul";
- input-signal = <&pch_pwrok>;
- init-value = <0>;
- pch-pwrok-dsw-pwrok-emul {
- output-signal = <&dsw_pwrok>;
- assert-delay-ms = <50>;
- invert-value;
- };
- };
-
- tp-sys-s0-power-fail {
- compatible = "intel,ap-pwr-test-platform";
- nodes = <&pch_pwrok_power_fail_emul>;
- };
-
- pch_pwrok_power_down_emul: pch-pwrok-power-down-emul {
- compatible = "intel,ap-pwr-signal-emul";
- input-signal = <&pch_pwrok>;
- init-value = <0>;
- edge = "EDGE_ACTIVE_ON_ASSERT";
- pch-pwrok-dsw-pwrok-emul {
- output-signal = <&dsw_pwrok>;
- assert-delay-ms = <70>;
- invert-value;
- };
-
- pch_pwrok-rsmrst-emul {
- output-signal = <&rsmrst>;
- assert-delay-ms = <60>;
- invert-value;
- };
-
- pch-pwrok-slp-s5-emul {
- output-signal = <&slp_s5>;
- assert-delay-ms = <50>;
- };
-
- pch-pwrok-slp-s4-emul {
- output-signal = <&slp_s4>;
- assert-delay-ms = <30>;
- };
-
- pch-pwrok-slp-s3-emul {
- output-signal = <&slp_s3>;
- assert-delay-ms = <20>;
- invert-value;
- };
-
- pch-pwrok-slp-s0-emul {
- output-signal = <&slp_s0>;
- assert-delay-ms = <15>;
- invert-value;
- };
- };
-
- tp-sys-g3-to-s0-power-down {
- compatible = "intel,ap-pwr-test-platform";
- nodes = <&en_pp3300_emul &en_pp5000_emul
- &ec_soc_dsw_pwrok_emul &ec_pch_rsmrst_emul
- &pch_pwrok_power_down_emul>;
- };
-};
diff --git a/zephyr/test/ap_power/boards/native_posix.overlay b/zephyr/test/ap_power/boards/native_posix.overlay
index b30240a094..c6cd8c3790 100644
--- a/zephyr/test/ap_power/boards/native_posix.overlay
+++ b/zephyr/test/ap_power/boards/native_posix.overlay
@@ -52,6 +52,131 @@
};
};
+ common-pwrseq {
+ compatible = "intel,ap-pwrseq";
+ };
+
+ pwr-en-pp5000-s5 {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "PP5000_S5 enable output to regulator";
+ enum-name = "PWR_EN_PP5000_A";
+ gpios = <&gpio0 10 0>;
+ output;
+ };
+ pwr-en-pp3300-s5 {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "PP3300_S5 enable output to LS";
+ enum-name = "PWR_EN_PP3300_A";
+ gpios = <&gpio0 11 0>;
+ output;
+ };
+ pwr-pg-ec-rsmrst-odl {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "RSMRST power good from regulator";
+ enum-name = "PWR_RSMRST";
+ gpios = <&gpio0 12 0>;
+ interrupt-flags = <GPIO_INT_EDGE_BOTH>;
+ };
+ pwr-ec-pch-rsmrst-odl {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "RSMRST output to PCH";
+ enum-name = "PWR_EC_PCH_RSMRST";
+ gpios = <&gpio0 13 0>;
+ output;
+ };
+ pwr-slp-s0-l {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "SLP_S0_L input from PCH";
+ enum-name = "PWR_SLP_S0";
+ gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
+ interrupt-flags = <GPIO_INT_EDGE_BOTH>;
+ no-enable;
+ };
+ pwr-slp-s3-l {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "SLP_S3_L input from PCH";
+ enum-name = "PWR_SLP_S3";
+ gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
+ interrupt-flags = <GPIO_INT_EDGE_BOTH>;
+ };
+ pwr-slp-sus-l {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "SLP_SUS_L input from PCH";
+ enum-name = "PWR_SLP_SUS";
+ gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
+ interrupt-flags = <GPIO_INT_EDGE_BOTH>;
+ };
+ pwr-ec-soc-dsw-pwrok {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "DSW_PWROK output to PCH";
+ enum-name = "PWR_EC_SOC_DSW_PWROK";
+ gpios = <&gpio0 17 0>;
+ output;
+ };
+ pwr-vccst-pwrgd-od {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "VCCST_PWRGD output to PCH";
+ enum-name = "PWR_VCCST_PWRGD";
+ gpios = <&gpio0 18 0>;
+ output;
+ };
+ pwr-imvp9-vrrdy-od {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "VRRDY input from IMVP9";
+ enum-name = "PWR_IMVP9_VRRDY";
+ gpios = <&gpio0 19 0>;
+ };
+ pwr-pch-pwrok {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "PCH_PWROK output to PCH";
+ enum-name = "PWR_PCH_PWROK";
+ gpios = <&gpio0 20 0>;
+ output;
+ };
+ pwr-ec-pch-sys-pwrok {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "SYS_PWROK output to PCH";
+ enum-name = "PWR_EC_PCH_SYS_PWROK";
+ gpios = <&gpio0 21 0>;
+ output;
+ };
+ pwr-sys-rst-l {
+ compatible = "intel,ap-pwrseq-gpio";
+ dbg-label = "SYS_RESET# output to PCH";
+ enum-name = "PWR_SYS_RST";
+ gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
+ output;
+ };
+ pwr-slp-s4 {
+ compatible = "intel,ap-pwrseq-vw";
+ dbg-label = "SLP_S4 virtual wire input from PCH";
+ enum-name = "PWR_SLP_S4";
+ virtual-wire = "ESPI_VWIRE_SIGNAL_SLP_S4";
+ vw-invert;
+ };
+ pwr-slp-s5 {
+ compatible = "intel,ap-pwrseq-vw";
+ dbg-label = "SLP_S5 virtual wire input from PCH";
+ enum-name = "PWR_SLP_S5";
+ virtual-wire = "ESPI_VWIRE_SIGNAL_SLP_S5";
+ vw-invert;
+ };
+ pwr-all-sys-pwrgd {
+ compatible = "intel,ap-pwrseq-external";
+ dbg-label = "Combined all power good";
+ enum-name = "PWR_ALL_SYS_PWRGD";
+ };
+ pwr-pp3300-pwrok {
+ compatible = "intel,ap-pwrseq-external";
+ dbg-label = "PP3300 PWROK";
+ enum-name = "PWR_DSW_PWROK";
+ };
+ pwr-pp1p05-pwrok {
+ compatible = "intel,ap-pwrseq-external";
+ dbg-label = "PP1P05 PWROK";
+ enum-name = "PWR_PG_PP1P05";
+ };
+
clock: clock {
compatible = "cros,clock-control-emul";
clock-frequency = <DT_FREQ_M(100)>; /* 100 MHz */
diff --git a/zephyr/test/ap_power/include/test_mocks.h b/zephyr/test/ap_power/include/test_mocks.h
deleted file mode 100644
index 05e1d823e0..0000000000
--- a/zephyr/test/ap_power/include/test_mocks.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef __TEST_AP_POWER_TEST_MOCKS_H
-#define __TEST_AP_POWER_TEST_MOCKS_H
-
-#include <stdint.h>
-
-#include <zephyr/fff.h>
-
-/*
- * Mock declarations
- */
-
-/* Mocks for common/extpower_gpio.c */
-DECLARE_FAKE_VALUE_FUNC(int, extpower_is_present);
-
-/* Mocks for common/system.c */
-DECLARE_FAKE_VOID_FUNC(system_hibernate, uint32_t, uint32_t);
-
-#endif /* __TEST_AP_POWER_TEST_MOCKS_H */
diff --git a/zephyr/test/ap_power/include/test_state.h b/zephyr/test/ap_power/include/test_state.h
index 2a7fbe822d..cb91f2b7c7 100644
--- a/zephyr/test/ap_power/include/test_state.h
+++ b/zephyr/test/ap_power/include/test_state.h
@@ -6,8 +6,6 @@
#ifndef ZEPHYR_TEST_AP_POWER_INCLUDE_TEST_STATE_H_
#define ZEPHYR_TEST_AP_POWER_INCLUDE_TEST_STATE_H_
-#include <stdbool.h>
-
struct test_state {
bool ec_app_main_run;
};
diff --git a/zephyr/test/ap_power/prj.conf b/zephyr/test/ap_power/prj.conf
index 53c6accdd3..4dd31085bd 100644
--- a/zephyr/test/ap_power/prj.conf
+++ b/zephyr/test/ap_power/prj.conf
@@ -35,10 +35,16 @@ CONFIG_PLATFORM_EC=y
CONFIG_CROS_EC=y
CONFIG_SHIMMED_TASKS=y
CONFIG_EMUL=y
+CONFIG_LOG=y
CONFIG_GPIO=y
+CONFIG_GPIO_EMUL=y
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_AP_PWRSEQ=y
+CONFIG_X86_NON_DSX_PWRSEQ_ADL=y
+CONFIG_AP_X86_INTEL_ADL=y
+CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S4=y
+CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S5=y
CONFIG_AP_PWRSEQ_STACK_SIZE=1024
CONFIG_ESPI=y
@@ -50,9 +56,6 @@ CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD=y
CONFIG_PLATFORM_EC_HOSTCMD=y
CONFIG_PLATFORM_EC_CHIPSET_RESET_HOOK=y
-# Short delay for hibernate
-CONFIG_PLATFORM_EC_HIBERNATE_DELAY_SEC=20
-
# These items are not required.
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
CONFIG_PLATFORM_EC_SWITCH=n
diff --git a/zephyr/test/ap_power/src/ap_pwrseq.c b/zephyr/test/ap_power/src/ap_pwrseq.c
deleted file mode 100644
index 6c2fd4fd7f..0000000000
--- a/zephyr/test/ap_power/src/ap_pwrseq.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ap_power/ap_power.h"
-#include "ap_power/ap_power_interface.h"
-#include "chipset.h"
-#include "emul/emul_power_signals.h"
-#include "test_state.h"
-
-#include <zephyr/drivers/espi.h>
-#include <zephyr/drivers/espi_emul.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
-
-#include <ap_power/ap_pwrseq.h>
-
-static struct ap_power_ev_callback test_cb;
-static int power_resume_count;
-static int power_start_up_count;
-static int power_hard_off_count;
-static int power_shutdown_count;
-static int power_shutdown_complete_count;
-static int power_suspend_count;
-
-static void emul_ev_handler(struct ap_power_ev_callback *callback,
- struct ap_power_ev_data data)
-{
- switch (data.event) {
- case AP_POWER_RESUME:
- power_resume_count++;
- break;
-
- case AP_POWER_STARTUP:
- power_start_up_count++;
- break;
-
- case AP_POWER_HARD_OFF:
- power_hard_off_count++;
- break;
-
- case AP_POWER_SHUTDOWN:
- power_shutdown_count++;
- break;
-
- case AP_POWER_SHUTDOWN_COMPLETE:
- power_shutdown_complete_count++;
- break;
-
- case AP_POWER_SUSPEND:
- power_suspend_count++;
- break;
- default:
- break;
- };
-}
-
-ZTEST(ap_pwrseq, test_ap_pwrseq_0)
-{
- zassert_equal(0,
- power_signal_emul_load(
- EMUL_POWER_SIGNAL_TEST_PLATFORM(tp_sys_g3_to_s0)),
- "Unable to load test platfform `tp_sys_g3_to_s0`");
-
- k_msleep(500);
-
- zassert_equal(1, power_start_up_count,
- "AP_POWER_STARTUP event not generated");
- zassert_equal(1, power_resume_count,
- "AP_POWER_RESUME event not generated");
-}
-
-ZTEST(ap_pwrseq, test_ap_pwrseq_1)
-{
- zassert_equal(0,
- power_signal_emul_load(EMUL_POWER_SIGNAL_TEST_PLATFORM(
- tp_sys_s0_power_fail)),
- "Unable to load test platfform `tp_sys_s0_power_fail`");
-
- /*
- * Once emulated power signals are loaded, we need to wake AP power
- * Sequence thread up to start executing new set of power signals
- */
- ap_pwrseq_wake();
- k_msleep(500);
- zassert_equal(1, power_shutdown_count,
- "AP_POWER_SHUTDOWN event not generated");
- zassert_equal(1, power_shutdown_complete_count,
- "AP_POWER_SHUTDOWN_COMPLETE event not generated");
- zassert_equal(0, power_suspend_count,
- "AP_POWER_SUSPEND event generated");
-}
-
-ZTEST(ap_pwrseq, test_ap_pwrseq_2)
-{
- zassert_equal(
- 0,
- power_signal_emul_load(EMUL_POWER_SIGNAL_TEST_PLATFORM(
- tp_sys_g3_to_s0_power_down)),
- "Unable to load test platfform `tp_sys_g3_to_s0_power_down`");
-
- ap_power_exit_hardoff();
- k_msleep(2000);
- zassert_equal(3, power_shutdown_count,
- "AP_POWER_SHUTDOWN event not generated");
- zassert_equal(3, power_shutdown_complete_count,
- "AP_POWER_SHUTDOWN_COMPLETE event not generated");
- zassert_equal(1, power_suspend_count,
- "AP_POWER_SUSPEND event generated");
- zassert_equal(1, power_hard_off_count,
- "AP_POWER_HARD_OFF event generated");
-}
-
-void ap_pwrseq_after_test(void *data)
-{
- power_signal_emul_unload();
-}
-
-void *ap_pwrseq_setup_suite(void)
-{
- ap_power_ev_init_callback(&test_cb, emul_ev_handler,
- AP_POWER_RESUME | AP_POWER_STARTUP |
- AP_POWER_HARD_OFF | AP_POWER_SUSPEND |
- AP_POWER_SHUTDOWN |
- AP_POWER_SHUTDOWN_COMPLETE);
-
- ap_power_ev_add_callback(&test_cb);
-
- return NULL;
-}
-
-void ap_pwrseq_teardown_suite(void *data)
-{
- ap_power_ev_remove_callback(&test_cb);
-}
-
-ZTEST_SUITE(ap_pwrseq, ap_power_predicate_post_main, ap_pwrseq_setup_suite,
- NULL, ap_pwrseq_after_test, NULL);
diff --git a/zephyr/test/ap_power/src/board.c b/zephyr/test/ap_power/src/board.c
index f08ccf9ef7..26c9448396 100644
--- a/zephyr/test/ap_power/src/board.c
+++ b/zephyr/test/ap_power/src/board.c
@@ -6,11 +6,9 @@
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
-#include <ap_power/ap_power_interface.h>
#include <ap_power_override_functions.h>
+#include <ap_power/ap_power_interface.h>
#include <power_signals.h>
-#include <timer.h>
-#include <x86_power_signals.h>
static bool signal_PWR_ALL_SYS_PWRGD;
static bool signal_PWR_DSW_PWROK;
@@ -61,29 +59,11 @@ void board_ap_power_force_shutdown(void)
int board_ap_power_assert_pch_power_ok(void)
{
- power_signal_set(PWR_PCH_PWROK, 1);
return 0;
}
-static void generate_ec_soc_dsw_pwrok_handler(void)
-{
- int in_sig_val = power_signal_get(PWR_DSW_PWROK);
-
- if (in_sig_val != power_signal_get(PWR_EC_SOC_DSW_PWROK)) {
- power_signal_set(PWR_EC_SOC_DSW_PWROK, 1);
- }
-}
-
void board_ap_power_action_g3_s5(void)
{
- power_signal_enable(PWR_DSW_PWROK);
-
- power_signal_set(PWR_EN_PP3300_A, 1);
- power_signal_set(PWR_EN_PP5000_A, 1);
-
- power_wait_signals_timeout(IN_PGOOD_ALL_CORE, 100 * MSEC);
-
- generate_ec_soc_dsw_pwrok_handler();
}
void board_ap_power_action_s3_s0(void)
@@ -100,5 +80,10 @@ void board_ap_power_action_s0(void)
bool board_ap_power_check_power_rails_enabled(void)
{
- return true;
+ return false;
+}
+
+int extpower_is_present(void)
+{
+ return 0;
}
diff --git a/zephyr/test/ap_power/src/console_command.c b/zephyr/test/ap_power/src/console_command.c
index 7789a13919..9d38e773c7 100644
--- a/zephyr/test/ap_power/src/console_command.c
+++ b/zephyr/test/ap_power/src/console_command.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test_state.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_debug_mode, test_debug_mode_default)
{
zassert_ok(shell_execute_cmd(get_ec_shell(), "debug_mode"),
diff --git a/zephyr/test/ap_power/src/events.c b/zephyr/test/ap_power/src/events.c
index 2528d356f6..ae7d2b870f 100644
--- a/zephyr/test/ap_power/src/events.c
+++ b/zephyr/test/ap_power/src/events.c
@@ -8,18 +8,20 @@
* @brief Unit Tests for AP power events
*/
-#include "ap_power/ap_power.h"
-#include "ap_power/ap_power_events.h"
-#include "hooks.h"
-#include "test_state.h"
-
#include <zephyr/device.h>
+
#include <zephyr/drivers/espi.h>
#include <zephyr/drivers/espi_emul.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "ap_power/ap_power.h"
+#include "ap_power/ap_power_events.h"
+
+#include "hooks.h"
+#include "test_state.h"
+
/*
* Structure passed to event listeners.
*/
@@ -171,7 +173,6 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, hook_startup, HOOK_PRIO_DEFAULT);
*/
ZTEST(events, test_hooks)
{
- count_hook_startup = count_hook_shutdown = 0;
ap_power_ev_send_callbacks(AP_POWER_STARTUP);
zassert_equal(0, count_hook_shutdown, "shutdown hook called");
zassert_equal(1, count_hook_startup, "startup hook not called");
diff --git a/zephyr/test/ap_power/src/hibdelay.c b/zephyr/test/ap_power/src/hibdelay.c
deleted file mode 100644
index 11fac953ea..0000000000
--- a/zephyr/test/ap_power/src/hibdelay.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "console.h"
-#include "ec_commands.h"
-#include "test_state.h"
-
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
-ZTEST_SUITE(console_cmd_hibdelay, ap_power_predicate_post_main, NULL, NULL,
- NULL, NULL);
-
-ZTEST_USER(console_cmd_hibdelay, test_too_many_args)
-{
- zassert_ok(shell_execute_cmd(get_ec_shell(), "hibdelay 1 2"), NULL);
-}
-
-ZTEST_USER(console_cmd_hibdelay, test_no_args)
-{
- zassert_ok(shell_execute_cmd(get_ec_shell(), "hibdelay"), NULL);
-}
-
-ZTEST_USER(console_cmd_hibdelay, test_invalid_arg)
-{
- int rv = shell_execute_cmd(get_ec_shell(), "hibdelay 3.4");
-
- zassert_equal(rv, EC_ERROR_PARAM1, "Expected %d, but got %d",
- EC_ERROR_PARAM1, rv);
-}
-
-ZTEST_USER(console_cmd_hibdelay, test_valid_args)
-{
- zassert_ok(shell_execute_cmd(get_ec_shell(), "hibdelay 5"), NULL);
-}
diff --git a/zephyr/test/ap_power/src/hibernate.c b/zephyr/test/ap_power/src/hibernate.c
deleted file mode 100644
index 23030bdcb3..0000000000
--- a/zephyr/test/ap_power/src/hibernate.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "hooks.h"
-#include "test_mocks.h"
-#include "test_state.h"
-
-#include <zephyr/device.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
-
-#include <ap_power/ap_power.h>
-#include <ap_power/ap_power_events.h>
-#include <ap_power/ap_power_interface.h>
-
-ZTEST(hibernate, test_g3_hibernate)
-{
- extpower_is_present_fake.return_val = 0;
- ap_power_ev_send_callbacks(AP_POWER_HARD_OFF);
- k_sleep(K_SECONDS(30));
- zassert_equal(1, system_hibernate_fake.call_count);
-}
-
-ZTEST(hibernate, test_ac_changed)
-{
- extpower_is_present_fake.return_val = 1;
- hook_notify(HOOK_AC_CHANGE);
- k_sleep(K_SECONDS(30));
- zassert_equal(0, system_hibernate_fake.call_count);
- extpower_is_present_fake.return_val = 0;
- hook_notify(HOOK_AC_CHANGE);
- k_sleep(K_SECONDS(30));
- zassert_equal(1, system_hibernate_fake.call_count);
-}
-
-ZTEST_SUITE(hibernate, ap_power_predicate_post_main, NULL, NULL, NULL, NULL);
diff --git a/zephyr/test/ap_power/src/host_command.c b/zephyr/test/ap_power/src/host_command.c
deleted file mode 100644
index f0b3b0d732..0000000000
--- a/zephyr/test/ap_power/src/host_command.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-#include "host_command.h"
-#include "test_state.h"
-
-#include <zephyr/ztest.h>
-
-ZTEST(host_cmd, test_hibernate_get)
-{
- struct ec_response_hibernation_delay response;
- struct ec_params_hibernation_delay params = {
- .seconds = 0,
- };
-
- struct host_cmd_handler_args args = BUILD_HOST_COMMAND(
- EC_CMD_HIBERNATION_DELAY, 0, response, params);
-
- zassert_ok(host_command_process(&args));
- params.seconds = 123;
- zassert_ok(host_command_process(&args));
- zassert_equal(123, response.hibernate_delay, NULL);
-}
-
-ZTEST_SUITE(host_cmd, ap_power_predicate_post_main, NULL, NULL, NULL, NULL);
diff --git a/zephyr/test/ap_power/src/main.c b/zephyr/test/ap_power/src/main.c
index 9ed34eee4a..d653b51164 100644
--- a/zephyr/test/ap_power/src/main.c
+++ b/zephyr/test/ap_power/src/main.c
@@ -3,11 +3,10 @@
* found in the LICENSE file.
*/
-#include "ec_app_main.h"
-#include "test_state.h"
-
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "ec_app_main.h"
+#include "test_state.h"
bool ap_power_predicate_pre_main(const void *state)
{
diff --git a/zephyr/test/ap_power/src/signals.c b/zephyr/test/ap_power/src/signals.c
index 4eae187564..e8bc6e426c 100644
--- a/zephyr/test/ap_power/src/signals.c
+++ b/zephyr/test/ap_power/src/signals.c
@@ -8,22 +8,24 @@
* @brief Unit Tests for power signals API
*/
-#include "ec_tasks.h"
-#include "emul/emul_stub_device.h"
-#include "gpio.h"
-#include "gpio/gpio.h"
-#include "gpio/gpio_int.h"
-#include "power_signals.h"
-#include "test_state.h"
-
#include <zephyr/device.h>
+
#include <zephyr/drivers/espi.h>
#include <zephyr/drivers/espi_emul.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "power_signals.h"
+
+#include "ec_tasks.h"
+#include "emul/emul_stub_device.h"
+#include "gpio.h"
+#include "gpio/gpio.h"
+#include "gpio/gpio_int.h"
+#include "test_state.h"
+
extern bool gpio_test_interrupt_triggered;
static const struct device *emul_port;
diff --git a/zephyr/test/ap_power/src/test_mocks.c b/zephyr/test/ap_power/src/test_mocks.c
deleted file mode 100644
index 9eb8834ff5..0000000000
--- a/zephyr/test/ap_power/src/test_mocks.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "test_mocks.h"
-
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-/* Mocks for common/extpower_gpio.c */
-DEFINE_FAKE_VALUE_FUNC(int, extpower_is_present);
-
-/* Mocks for common/system.c */
-DEFINE_FAKE_VOID_FUNC(system_hibernate, uint32_t, uint32_t);
-
-/**
- * @brief Reset all the fakes before each test.
- */
-static void fff_reset_rule_before(const struct ztest_unit_test *test,
- void *data)
-{
- ARG_UNUSED(test);
- ARG_UNUSED(data);
-
- RESET_FAKE(extpower_is_present);
- RESET_FAKE(system_hibernate);
-}
-
-ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);
diff --git a/zephyr/test/ap_power/testcase.yaml b/zephyr/test/ap_power/testcase.yaml
index b55e2f3f47..aaf8a530a6 100644
--- a/zephyr/test/ap_power/testcase.yaml
+++ b/zephyr/test/ap_power/testcase.yaml
@@ -1,10 +1,4 @@
common:
platform_allow: native_posix
tests:
- ap_power.alderlake:
- extra_args: CONFIG_EMUL_POWER_SIGNALS=y
- CONFIG_X86_NON_DSX_PWRSEQ_ADL=y
- CONFIG_AP_X86_INTEL_ADL=y
- CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S4=y
- CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI_VW_SLP_S5=y
- DTC_OVERLAY_FILE="boards/native_posix.overlay";"boards/alderlake.dts"
+ ap_power.default: {}
diff --git a/zephyr/test/crc/main.c b/zephyr/test/crc/main.c
index f9da78bfde..0b13970d83 100644
--- a/zephyr/test/crc/main.c
+++ b/zephyr/test/crc/main.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
-#include "crc8.h"
-
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "crc8.h"
+
ZTEST_SUITE(crc_driver, NULL, NULL, NULL, NULL, NULL);
ZTEST(crc_driver, test_crc8_known_data)
diff --git a/zephyr/test/drivers/CMakeLists.txt b/zephyr/test/drivers/CMakeLists.txt
index 78c1274843..b03e3e4edd 100644
--- a/zephyr/test/drivers/CMakeLists.txt
+++ b/zephyr/test/drivers/CMakeLists.txt
@@ -38,23 +38,16 @@ add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USB_PORT_POWER_DUMB usb_port_power
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USB_RETIMER_FW_UPDATE usb_retimer_fw_update)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_ALT_MODE usbc_alt_mode)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_CONSOLE_PD usbc_console_pd)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_CTVPD usbc_ctvpd)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_SVDM_DFP_ONLY usbc_svdm_dfp_only)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_TBT_MODE usbc_tbt_mode)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_USB4_MODE usbc_usb4_mode)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_VCONN_SWAP usbc_vconn_swap)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_OCP usbc_ocp)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_USBC_PPC usbc_ppc)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_HOST_COMMANDS host_cmd)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_HOST_COMMAND_READ_MEMMAP host_cmd_read_memmap)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_SYSTEM system)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_LOCATE_CHIP_ALTS locate_chip)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_BUTTON button)
add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_CONSOLE console)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_HOST_CMD_THREAD host_command_thread)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_PI3USB9201 bc12_pi3usb9201)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_MEMMAP memmap)
-add_subdirectory_ifdef(CONFIG_LINK_TEST_SUITE_LED_COMMON led_common)
get_target_property(TEST_SOURCES_NEW app SOURCES)
diff --git a/zephyr/test/drivers/Kconfig b/zephyr/test/drivers/Kconfig
index b2a9648f21..9254bb9e31 100644
--- a/zephyr/test/drivers/Kconfig
+++ b/zephyr/test/drivers/Kconfig
@@ -33,12 +33,8 @@ config LINK_TEST_SUITE_COMMON_CHARGER
bool "Link and execute the common/charger.c tests"
config LINK_TEST_SUITE_HOST_COMMANDS
- select PLATFORM_EC_CHARGE_STATE_DEBUG
bool "Link and test the host command tests"
-config LINK_TEST_SUITE_HOST_COMMAND_READ_MEMMAP
- bool "Link and test the host command read memmap tests"
-
config LINK_TEST_SUITE_ISL923X
bool "Link and test the isl923x tests"
@@ -47,8 +43,6 @@ config LINK_TEST_SUITE_I2C_CONTROLLER
config LINK_TEST_SUITE_KEYBOARD_SCAN
bool "Link and test the keyboard_scan tests"
- select PLATFORM_EC_MKBP_EVENT_WAKEUP_MASK
- select PLATFORM_EC_MKBP_HOST_EVENT_WAKEUP_MASK
config LINK_TEST_SUITE_LED_DRIVER
bool "Link and test the led_driver tests"
@@ -104,11 +98,6 @@ config LINK_TEST_SUITE_USBC_ALT_MODE
config LINK_TEST_SUITE_USBC_CONSOLE_PD
bool"Link and test the usbc_console_pd tests"
-config LINK_TEST_SUITE_USBC_CTVPD
- bool "Link tests for charge-through VCONN-powered device support"
- select EMUL_TCPCI_PARTNER_VPD
- select LOG
-
config LINK_TEST_SUITE_USBC_OCP
bool "Link tests for common USBC OCP code"
@@ -121,11 +110,6 @@ config LINK_TEST_SUITE_USBC_SVDM_DFP_ONLY
config LINK_TEST_SUITE_USBC_TBT_MODE
bool "Link and test the usbc_tbt_mode tests"
-config LINK_TEST_SUITE_USBC_USB4_MODE
- bool "Link and test the usbc_usb4_mode tests"
- help
- Include the usbc_usb4 test suite in the binary.
-
config LINK_TEST_SUITE_USBC_VCONN_SWAP
bool "Link and test the usbc_vconn_swap tests"
help
@@ -135,19 +119,4 @@ config LINK_TEST_SUITE_CONSOLE
bool "Link and test the console tests"
select UART_INTERRUPT_DRIVEN
-config LINK_TEST_SUITE_HOST_CMD_THREAD
- bool "Link and test the host command thread override tests"
-
-config LINK_TEST_SUITE_PI3USB9201
- bool "Link and test the pi3usb9201 tests"
-
-config LINK_TEST_SUITE_MEMMAP
- bool "Link and test memory mapped tests for common/flash.c"
- select PLATFORM_EC_MAPPED_STORAGE
-
-config LINK_TEST_SUITE_LED_COMMON
- bool "Link and test the led_common.c file"
- depends on !PLATFORM_EC_LED_DT
- select PLATFORM_EC_LED_COMMON
-
source "Kconfig.zephyr"
diff --git a/zephyr/test/drivers/anx7447/prj.conf b/zephyr/test/drivers/anx7447/prj.conf
index 18d953d0c6..d297ee0725 100644
--- a/zephyr/test/drivers/anx7447/prj.conf
+++ b/zephyr/test/drivers/anx7447/prj.conf
@@ -2,5 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+CONFIG_EMUL_ANX7447=y
CONFIG_PLATFORM_EC_USB_PD_TCPC_LOW_POWER=y
CONFIG_PLATFORM_EC_USB_PD_TCPM_ANX7447=y
diff --git a/zephyr/test/drivers/anx7447/src/low_power_mode.c b/zephyr/test/drivers/anx7447/src/low_power_mode.c
index cbcea1955c..67c095b64d 100644
--- a/zephyr/test/drivers/anx7447/src/low_power_mode.c
+++ b/zephyr/test/drivers/anx7447/src/low_power_mode.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/emul.h>
+#include <zephyr/ztest.h>
+
#include "emul/tcpc/emul_tcpci.h"
#include "tcpm/anx7447_public.h"
#include "tcpm/tcpci.h"
@@ -10,9 +13,6 @@
#include "test/drivers/test_state.h"
#include "usb_pd.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/ztest.h>
-
#define ANX7447_NODE DT_NODELABEL(anx7447_emul)
static const int tcpm_anx7447_port = USBC_PORT_C0;
diff --git a/zephyr/test/drivers/anx7447/tcpc_policy.dts b/zephyr/test/drivers/anx7447/tcpc_policy.dts
index 6bdae81e73..9126d55e61 100644
--- a/zephyr/test/drivers/anx7447/tcpc_policy.dts
+++ b/zephyr/test/drivers/anx7447/tcpc_policy.dts
@@ -18,7 +18,7 @@
status="okay";
anx7447_emul: anx7447_emul@2c {
- compatible = "cros,anx7447-tcpc-emul";
+ compatible = "cros,anx7447-emul";
reg = <0x2c>;
tcpc-flags = <(
TCPC_FLAGS_VBUS_MONITOR |
diff --git a/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c b/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c
index 993c6e680c..d059870f25 100644
--- a/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c
+++ b/zephyr/test/drivers/ap_mux_control/src/ap_mux_control.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
+#include "usb_mux.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include "usb_mux.h"
-
-#include <zephyr/ztest.h>
static void ap_mux_control_before(void *data)
{
@@ -23,7 +23,7 @@ static void ap_mux_control_before(void *data)
k_sleep(K_SECONDS(1));
/* And test the assumption that setting NONE worked */
- zassert_equal(usb_mux_get(USBC_PORT_C0), USB_PD_MUX_NONE,
+ zassume_equal(usb_mux_get(USBC_PORT_C0), USB_PD_MUX_NONE,
"Failed to set mux to initial state");
}
diff --git a/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c b/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c
index fe7dab88f4..7c526f0ccb 100644
--- a/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c
+++ b/zephyr/test/drivers/ap_vdm_control/src/ap_vdm_control.c
@@ -3,123 +3,24 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
+#include "usb_mux.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include "usb_mux.h"
-#include "usb_pd_vdo.h"
-
-#include <stdint.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/ztest.h>
-
-#define TEST_PORT USBC_PORT_C0
-
-struct ap_vdm_control_fixture {
- const struct emul *tcpci_emul;
- const struct emul *charger_emul;
- struct tcpci_partner_data partner;
- struct tcpci_src_emul_data src_ext;
-};
-
-struct tcpci_cable_data passive_usb3 = {
- .identity_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_PD, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_IDENT),
- .identity_vdm[VDO_INDEX_IDH] = VDO_IDH(
- /* USB host */ false, /* USB device */ false, IDH_PTYPE_PCABLE,
- /* modal operation */ false, USB_VID_GOOGLE),
- .identity_vdm[VDO_INDEX_CSTAT] = 0,
- .identity_vdm[VDO_INDEX_PRODUCT] = VDO_PRODUCT(0x1234, 0xABCD),
- .identity_vdm[VDO_INDEX_PTYPE_CABLE1] =
- VDO_REV30_PASSIVE(USB_R30_SS_U32_U40_GEN2, USB_VBUS_CUR_3A,
- USB_REV30_LATENCY_1m, USB_REV30_TYPE_C),
- .identity_vdos = VDO_INDEX_PTYPE_CABLE1 + 1,
-
-};
-
-static void verify_vdm_req(struct ap_vdm_control_fixture *fixture,
- struct typec_vdm_req *req)
-{
- struct tcpci_partner_log_msg *msg;
- bool message_seen = 0;
-
- SYS_SLIST_FOR_EACH_CONTAINER(&fixture->partner.msg_log, msg, node)
- {
- uint16_t header = sys_get_le16(msg->buf);
-
- /* Ignore messages from ourselves */
- if (msg->sender == TCPCI_PARTNER_SENDER_PARTNER)
- continue;
-
- /*
- * Control messages, non-VDMs, and extended messages are not of
- * interest
- */
- if ((PD_HEADER_CNT(header) == 0) ||
- (PD_HEADER_TYPE(header) != PD_DATA_VENDOR_DEF) ||
- (PD_HEADER_EXT(header) != 0)) {
- continue;
- }
-
- if (req->partner_type != msg->sop)
- continue;
-
- /* We have a VDM, check entry we're interested in */
- if (memcmp(msg->buf, req->vdm_data,
- req->vdm_data_objects * sizeof(uint32_t))) {
- message_seen = true;
- break;
- }
- }
-
- zassert_true(message_seen, "Expected message not found");
-}
-
-static void *ap_vdm_control_setup(void)
-{
- static struct ap_vdm_control_fixture fixture;
- struct tcpci_partner_data *partner = &fixture.partner;
- struct tcpci_src_emul_data *src_ext = &fixture.src_ext;
-
- tcpci_partner_init(partner, PD_REV30);
- partner->extensions = tcpci_src_emul_init(src_ext, partner, NULL);
- partner->cable = &passive_usb3;
-
- /* Get references for the emulators */
- fixture.tcpci_emul = EMUL_DT_GET(DT_NODELABEL(tcpci_emul));
- fixture.charger_emul = EMUL_DT_GET(DT_NODELABEL(isl923x_emul));
-
- return &fixture;
-}
static void ap_vdm_control_before(void *data)
{
- struct ap_vdm_control_fixture *fix = data;
-
/* Set chipset on so the "AP" is on to give us commands */
test_set_chipset_to_s0();
-
- /* Connect our port partner */
- connect_source_to_port(&fix->partner, &fix->src_ext, 0, fix->tcpci_emul,
- fix->charger_emul);
-}
-
-static void ap_vdm_control_after(void *data)
-{
- struct ap_vdm_control_fixture *fix = data;
-
- disconnect_source_from_port(fix->tcpci_emul, fix->charger_emul);
- tcpci_partner_common_clear_logged_msgs(&fix->partner);
}
-ZTEST_SUITE(ap_vdm_control, drivers_predicate_post_main, ap_vdm_control_setup,
- ap_vdm_control_before, ap_vdm_control_after, NULL);
+ZTEST_SUITE(ap_vdm_control, drivers_predicate_post_main, NULL,
+ ap_vdm_control_before, NULL, NULL);
-ZTEST_F(ap_vdm_control, test_feature_present)
+ZTEST(ap_vdm_control, test_feature_present)
{
struct ec_response_get_features feat = host_cmd_get_features();
@@ -127,139 +28,3 @@ ZTEST_F(ap_vdm_control, test_feature_present)
EC_FEATURE_MASK_1(EC_FEATURE_TYPEC_AP_VDM_SEND),
"Failed to see feature present");
}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_req_bad_port)
-{
- struct ec_params_typec_control params = {
- .port = 85,
- .command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
- .vdm_req_params = {
- .vdm_data = { 0 },
- .vdm_data_objects = 1,
- .partner_type = TYPEC_PARTNER_SOP,
- },
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
-
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM,
- "Failed to see port error");
-}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_req_bad_type)
-{
- struct ec_params_typec_control params = {
- .port = TEST_PORT,
- .command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
- .vdm_req_params = {
- .vdm_data = { 0 },
- .vdm_data_objects = 1,
- .partner_type = TYPEC_PARTNER_SOP_PRIME_PRIME + 1,
- },
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
-
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM,
- "Failed to see port error");
-}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_req_bad_count)
-{
- struct ec_params_typec_control params = {
- .port = TEST_PORT,
- .command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
- .vdm_req_params = {
- .vdm_data = { 0 },
- .vdm_data_objects = 0,
- .partner_type = TYPEC_PARTNER_SOP,
- },
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
-
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM,
- "Failed to see port error");
-}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_sop_req_valid)
-{
- uint32_t vdm_req_header = VDO(USB_SID_PD, 1, CMD_DISCOVER_IDENT);
- struct typec_vdm_req req = {
- .vdm_data = { vdm_req_header },
- .vdm_data_objects = 1,
- .partner_type = TYPEC_PARTNER_SOP,
- };
-
- tcpci_partner_common_enable_pd_logging(&fixture->partner, true);
- host_cmd_typec_control_vdm_req(TEST_PORT, req);
- k_sleep(K_SECONDS(1));
-
- tcpci_partner_common_enable_pd_logging(&fixture->partner, false);
-
- /* Look for our REQ */
- verify_vdm_req(fixture, &req);
-}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_sop_prime_req_valid)
-{
- uint32_t vdm_req_header = VDO(USB_SID_PD, 1, CMD_DISCOVER_IDENT);
- struct typec_vdm_req req = {
- .vdm_data = { vdm_req_header },
- .vdm_data_objects = 1,
- .partner_type = TYPEC_PARTNER_SOP_PRIME,
- };
-
- tcpci_partner_common_enable_pd_logging(&fixture->partner, true);
- host_cmd_typec_control_vdm_req(TEST_PORT, req);
- k_sleep(K_SECONDS(1));
-
- tcpci_partner_common_enable_pd_logging(&fixture->partner, false);
-
- /* Look for our REQ */
- verify_vdm_req(fixture, &req);
-}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_sop_attention_bad)
-{
- uint32_t vdm_req_header = VDO(USB_SID_DISPLAYPORT, 1, CMD_ATTENTION);
- struct ec_params_typec_control params = {
- .port = TEST_PORT,
- .command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
- .vdm_req_params = {
- .vdm_data = { vdm_req_header },
- .vdm_data_objects = 5,
- .partner_type = TYPEC_PARTNER_SOP,
- },
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
-
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM,
- "Failed to see port error");
-}
-
-ZTEST_F(ap_vdm_control, test_send_vdm_req_in_progress)
-{
- uint32_t vdm_req_header = VDO(USB_SID_PD, 1, CMD_DISCOVER_IDENT);
- struct ec_params_typec_control params = {
- .port = TEST_PORT,
- .command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
- .vdm_req_params = {
- .vdm_data = { vdm_req_header },
- .vdm_data_objects = 1,
- .partner_type = TYPEC_PARTNER_SOP,
- },
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
-
- /*
- * First command should succeed, but given no time to process the second
- * should return busy
- */
- zassert_equal(host_command_process(&args), EC_RES_SUCCESS,
- "Failed to send successful request");
- zassert_equal(host_command_process(&args), EC_RES_BUSY,
- "Failed to see busy");
-}
diff --git a/zephyr/test/drivers/bc12_pi3usb9201/CMakeLists.txt b/zephyr/test/drivers/bc12_pi3usb9201/CMakeLists.txt
deleted file mode 100644
index 2f1925b635..0000000000
--- a/zephyr/test/drivers/bc12_pi3usb9201/CMakeLists.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-#Use of this source code is governed by a BSD-style license that can be
-#found in the LICENSE file.
-
-target_sources(app PRIVATE src/pi3usb9201.c)
-target_sources(app PRIVATE src/pi3usb9201_interrupt.c)
diff --git a/zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201_interrupt.c b/zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201_interrupt.c
deleted file mode 100644
index 959684c23b..0000000000
--- a/zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201_interrupt.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gpio_signal.h"
-#include "task.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include "usb_charge.h"
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-/* Get reference to externally linked handlers (defined in DTS) */
-#define USBC0_GPIO_PATH DT_PATH(named_gpios, usb_c0_bc12_int_l)
-#define USBC0_GPIO_DEV DEVICE_DT_GET(DT_GPIO_CTLR(USBC0_GPIO_PATH, gpios))
-#define USBC0_GPIO_PORT DT_GPIO_PIN(USBC0_GPIO_PATH, gpios)
-
-#define USBC1_GPIO_PATH DT_PATH(named_gpios, usb_c1_bc12_int_l)
-#define USBC1_GPIO_DEV DEVICE_DT_GET(DT_GPIO_CTLR(USBC1_GPIO_PATH, gpios))
-#define USBC1_GPIO_PORT DT_GPIO_PIN(USBC1_GPIO_PATH, gpios)
-
-static void toggle_gpio(const struct device *dev, gpio_pin_t pin)
-{
- static const int values[] = { 1, 0, 1 };
-
- for (int i = 0; i < ARRAY_SIZE(values); ++i) {
- gpio_emul_input_set(dev, pin, values[i]);
- }
-}
-
-FAKE_VOID_FUNC(usb_charger_task_event, int, uint32_t);
-
-struct pi3usb9201_fixture {
- const struct bc12_drv *drv[2];
- struct bc12_drv mock_drv;
-};
-
-static void *setup(void)
-{
- static struct pi3usb9201_fixture fixture;
-
- fixture.mock_drv.usb_charger_task_event = usb_charger_task_event;
-
- return &fixture;
-}
-
-static void before(void *f)
-{
- struct pi3usb9201_fixture *fixture = f;
-
- fixture->drv[0] = bc12_ports[0].drv;
- fixture->drv[1] = bc12_ports[1].drv;
-
- RESET_FAKE(usb_charger_task_event);
- test_set_chipset_to_s0();
-}
-
-static void after(void *f)
-{
- struct pi3usb9201_fixture *fixture = f;
-
- bc12_ports[0].drv = fixture->drv[0];
- bc12_ports[1].drv = fixture->drv[1];
-}
-
-ZTEST_SUITE(pi3usb9201, drivers_predicate_post_main, setup, before, after,
- NULL);
-
-ZTEST_F(pi3usb9201, test_usb0_evt)
-{
- /* Set up the driver to use the mock */
- bc12_ports[0].drv = &fixture->mock_drv;
-
- /* Trigger the event and verify that port0 was added to the task event
- * bitmap
- */
- toggle_gpio(USBC0_GPIO_DEV, USBC0_GPIO_PORT);
- zassert_true(*task_get_event_bitmap(TASK_ID_USB_CHG) & BIT(0));
-
- /* Give the task a bit of time to process the events */
- task_wake(TASK_ID_USB_CHG);
- k_msleep(500);
-
- /* Ensure that the callback was made (it should be the first, but others
- * may exist).
- */
- zassert_true(usb_charger_task_event_fake.call_count > 0);
- zassert_equal(0, usb_charger_task_event_fake.arg0_history[0]);
- zassert_equal(USB_CHG_EVENT_BC12,
- usb_charger_task_event_fake.arg1_history[0]);
-}
-
-ZTEST_F(pi3usb9201, test_usb1_evt)
-{
- /* Set up the driver to use the mock */
- bc12_ports[1].drv = &fixture->mock_drv;
-
- /* Trigger the event and verify that port1 was added to the task event
- * bitmap
- */
- toggle_gpio(USBC1_GPIO_DEV, USBC1_GPIO_PORT);
- zassert_true(*task_get_event_bitmap(TASK_ID_USB_CHG) & BIT(1));
-
- /* Give the task a bit of time to process the events */
- task_wake(TASK_ID_USB_CHG);
- k_msleep(500);
-
- /* Ensure that the callback was made (it should be the first, but others
- * may exist).
- */
- zassert_true(usb_charger_task_event_fake.call_count > 0);
- zassert_equal(1, usb_charger_task_event_fake.arg0_history[0]);
- zassert_equal(USB_CHG_EVENT_BC12,
- usb_charger_task_event_fake.arg1_history[0]);
-}
diff --git a/zephyr/test/drivers/boards/native_posix.overlay b/zephyr/test/drivers/boards/native_posix.overlay
index 1f92686c33..6a304261cc 100644
--- a/zephyr/test/drivers/boards/native_posix.overlay
+++ b/zephyr/test/drivers/boards/native_posix.overlay
@@ -8,7 +8,6 @@
#include <cros/thermistor/thermistor.dtsi>
#include <dt-bindings/gpio_defines.h>
#include <dt-bindings/pwm/pwm.h>
-#include <dt-bindings/wake_mask_event_defines.h>
#include <freq.h>
/ {
@@ -27,9 +26,7 @@
bmi160-int = &ms_bmi160_accel;
tcs3400-int = &tcs3400_clear;
gpio-wp = &gpio_wp_l;
- gpio-cbi-wp = &gpio_ec_cbi_wp;
gpio-kbd-kso2 = &gpio_ec_kso_02_inv;
- int-wp = &int_wp_l;
};
ec-console {
@@ -37,27 +34,6 @@
disabled = "events", "lpc", "hostcmd";
};
- ec-mkbp-host-event-wakeup-mask {
- compatible = "ec-wake-mask-event";
- wakeup-mask = <(
- HOST_EVENT_LID_OPEN |
- HOST_EVENT_POWER_BUTTON |
- HOST_EVENT_AC_CONNECTED |
- HOST_EVENT_AC_DISCONNECTED |
- HOST_EVENT_HANG_DETECT |
- HOST_EVENT_RTC |
- HOST_EVENT_MODE_CHANGE |
- HOST_EVENT_DEVICE |
- HOST_EVENT_KEYBOARD_RECOVERY)>;
- };
-
- ec-mkbp-event-wakeup-mask {
- compatible = "ec-wake-mask-event";
- wakeup-mask = <(MKBP_EVENT_KEY_MATRIX | \
- MKBP_EVENT_HOST_EVENT | \
- MKBP_EVENT_SENSOR_FIFO)>;
- };
-
usbc {
#address-cells = <1>;
#size-cells = <0>;
@@ -65,41 +41,16 @@
port0@0 {
compatible = "named-usbc-port";
reg = <0>;
- bc12 = <&pi3usb9201_emul0>;
chg = <&isl923x_emul>;
tcpc = <&tcpci_emul>;
ppc = <&sn5s330_emul>;
- usb-mux-chain-0 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&tcpci_mux_c0
- &virtual_mux_c0>;
- };
- };
- port0-muxes {
- tcpci_mux_c0: tcpci-mux-c0 {
- compatible = "cros-ec,usbc-mux-tcpci";
- };
- virtual_mux_c0: virtual-mux-c0 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
};
port1@1 {
compatible = "named-usbc-port";
reg = <1>;
- bc12 = <&pi3usb9201_emul1>;
tcpc = <&ps8xxx_emul>;
ppc = <&syv682x_emul>;
- usb-mux-chain-1 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&usb_c1_bb_retimer_emul
- &virtual_mux_c1>;
- };
- };
- port1-muxes {
- virtual_mux_c1: virtual-mux-c1 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
};
};
@@ -220,7 +171,6 @@
};
gpio_test: test {
gpios = <&gpio0 27 (GPIO_INPUT | GPIO_OUTPUT)>;
- enum-name = "GPIO_TEST";
};
ec_batt_pres_odl {
gpios = <&gpio0 28 GPIO_INPUT>;
@@ -231,16 +181,20 @@
no-auto-init;
};
gpio_ec_chg_led_y_c0: ec_chg_led_y_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpio0 30 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
gpio_ec_chg_led_w_c0: ec_chg_led_w_c0 {
+ #led-pin-cells = <1>;
gpios = <&gpio0 31 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
/* gpio1 */
gpio_ec_chg_led_y_c1: ec_chg_led_y_c1 {
+ #led-pin-cells = <1>;
gpios = <&gpio1 0 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
gpio_ec_chg_led_w_c1: ec_chg_led_w_c1 {
+ #led-pin-cells = <1>;
gpios = <&gpio1 1 (GPIO_INPUT | GPIO_OUTPUT_LOW)>;
};
gpio_ap_ec_int_l: ap_ec_int_l {
@@ -268,15 +222,6 @@
gpio_brd_id0: brd_id0 {
gpios = <&gpio1 8 GPIO_INPUT>;
};
- gpio_ec_cbi_wp: ec_cbi_wp {
- gpios = <&gpio1 9 GPIO_OUTPUT>;
- };
- gpio_usb_c0_bc12_int_l: usb_c0_bc12_int_l {
- gpios = <&gpio1 10 GPIO_INPUT>;
- };
- gpio_usb_c1_bc12_int_l: usb_c1_bc12_int_l {
- gpios = <&gpio1 11 GPIO_INPUT>;
- };
};
gpio1: gpio@101 {
@@ -289,7 +234,7 @@
low-level;
gpio-controller;
#gpio-cells = <2>;
- ngpios = <12>;
+ ngpios = <9>;
};
gpio-interrupts {
@@ -340,21 +285,6 @@
flags = <GPIO_INT_EDGE_BOTH>;
handler = "power_signal_interrupt";
};
- int_wp_l: wp_l {
- irq-pin = <&gpio_wp_l>;
- flags = <GPIO_INT_EDGE_BOTH>;
- handler = "switch_interrupt";
- };
- int_usb_c0_bc12: usb_c0_bc12 {
- irq-pin = <&gpio_usb_c0_bc12_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "usb0_evt";
- };
- int_usb_c1_bc12: usb_c1_bc12 {
- irq-pin = <&gpio_usb_c1_bc12_int_l>;
- flags = <GPIO_INT_EDGE_FALLING>;
- handler = "usb1_evt";
- };
};
named-i2c-ports {
@@ -389,34 +319,21 @@
default_battery: lgc_ac17a8m {
compatible = "lgc,ac17a8m", "battery-smart";
};
- ap16l5j {
- compatible = "panasonic,ap16l5j", "battery-smart";
- ship_mode_wb_support = <1>;
- sleep_mode_support = <1>;
- fet_mfgacc_support = <1>;
- };
- ap16l8j {
- compatible = "lgc,ap16l8j", "battery-smart";
- ship_mode_wb_support = <1>;
- sleep_mode_support = <1>;
- fet_cfet_mask = <0>;
- fet_mfgacc_support = <1>;
- };
};
cbi-ssfc {
- compatible = "cros-ec,cbi-ssfc";
+ compatible = "named-cbi-ssfc";
cbi_ssfc_base_sensor: base_sensor {
enum-name = "BASE_SENSOR";
size = <2>;
base_sensor_0: base0 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <1>;
default;
};
base_sensor_1: base1 {
- compatible = "cros-ec,cbi-ssfc-value";
+ compatible = "named-cbi-ssfc-value";
status = "okay";
value = <2>;
};
@@ -556,11 +473,6 @@
power-good-pin = <&gpio_ec_pg_pin_temp>;
sensor = <&temp_fan>;
};
- named_pct2075: soc {
- status = "okay";
- power-good-pin = <&gpio_ec_pg_pin_temp>;
- sensor = <&pct2075_emul>;
- };
};
/*
@@ -815,7 +727,7 @@
reg = <0x400 4>;
tcs_emul: tcs@39 {
- compatible = "zephyr,tcs3400-emul";
+ compatible = "zephyr,tcs3400";
reg = <0x39>;
error-on-ro-write;
error-on-reserved-bit-write;
@@ -823,7 +735,7 @@
};
accel_bmi160: bmi160@68 {
- compatible = "zephyr,bmi-emul";
+ compatible = "zephyr,bmi";
reg = <0x68>;
device-model = "BMI_EMUL_160";
error-on-ro-write;
@@ -841,10 +753,9 @@
#size-cells = <0>;
reg = <0x500 4>;
- pi3usb9201_emul0: pi3usb9201@5f {
- compatible = "pericom,pi3usb9201";
+ pi3usb9201_emul: pi3usb9201@5f {
+ compatible = "zephyr,pi3usb9201-emul";
reg = <0x5f>;
- irq = <&int_usb_c0_bc12>;
};
sn5s330_emul: sn5s330@40 {
@@ -869,12 +780,6 @@
#size-cells = <0>;
reg = <0x600 4>;
- pi3usb9201_emul1: pi3usb9201@5d {
- compatible = "pericom,pi3usb9201";
- reg = <0x5d>;
- irq = <&int_usb_c1_bc12>;
- };
-
syv682x_emul: syv682x@41 {
compatible = "zephyr,syv682x-emul";
reg = <0x41>;
@@ -883,10 +788,11 @@
};
usb_c1_bb_retimer_emul: bbretimer@42 {
- compatible = "intel,jhl8040r";
+ compatible = "cros,bb-retimer-emul";
reg = <0x42>;
- reset-pin = <&usb_c1_rt_rst_odl>;
- ls-en-pin = <&usb_c1_ls_en>;
+ vendor = "BB_RETIMER_VENDOR_ID_1";
+ error-on-ro-write;
+ error-on-reserved-bit-write;
};
ps8xxx_emul: ps8xxx_emul@b {
@@ -897,11 +803,6 @@
p1-i2c-addr = <0x9>;
gpio-i2c-addr = <0x1a>;
};
-
- pct2075_emul: pct2075@48 {
- compatible = "nxp,pct2075";
- reg = <0x48>;
- };
};
clock: clock {
@@ -970,18 +871,22 @@
};
pwmleds {
- compatible = "pwm-leds";
+ compatible = "cros-ec,pwm-pin-config";
pwmled_blue_left: pwmled_b_left {
+ #led-pin-cells = <1>;
pwms = <&pwm_blue_left 0 1000000 PWM_POLARITY_NORMAL>;
};
pwmled_white_left: pwmled_w_left {
+ #led-pin-cells = <1>;
pwms = <&pwm_white_left 0 1000000 PWM_POLARITY_NORMAL>;
};
pwmled_amber_right: pwmled_y_right {
+ #led-pin-cells = <1>;
pwms = <&pwm_amber_right 0 1000000 PWM_POLARITY_NORMAL>;
};
pwmled_white_right: pwmled_w_right {
+ #led-pin-cells = <1>;
pwms = <&pwm_white_right 0 1000000 PWM_POLARITY_NORMAL>;
};
};
@@ -992,42 +897,42 @@
color-off-left {
led-color = "LED_OFF";
led-id = "EC_LED_ID_LEFT_LED";
- led-pwms = <&pwmled_blue_left &pwmled_white_left>;
- led-values = <0 0>;
+ led-pins = <&pwmled_blue_left 0>,
+ <&pwmled_white_left 0>;
};
color-off-right {
led-color = "LED_OFF";
led-id = "EC_LED_ID_RIGHT_LED";
- led-pwms = <&pwmled_amber_right &pwmled_white_right>;
- led-values = <0 0>;
+ led-pins = <&pwmled_amber_right 0>,
+ <&pwmled_white_right 0>;
};
color-blue-left {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_LEFT_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pwms = <&pwmled_blue_left &pwmled_white_left>;
- led-values = <100 0>;
+ led-pins = <&pwmled_blue_left 100>,
+ <&pwmled_white_left 0>;
};
color-amber-right {
led-color = "LED_AMBER";
led-id = "EC_LED_ID_RIGHT_LED";
br-color = "EC_LED_COLOR_AMBER";
- led-pwms = <&pwmled_amber_right &pwmled_white_right>;
- led-values = <100 0>;
+ led-pins = <&pwmled_amber_right 100>,
+ <&pwmled_white_right 0>;
};
color-white-left {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_LEFT_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwmled_blue_left &pwmled_white_left>;
- led-values = <0 100>;
+ led-pins = <&pwmled_blue_left 0>,
+ <&pwmled_white_left 100>;
};
color-white-right {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_RIGHT_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pwms = <&pwmled_amber_right &pwmled_white_right>;
- led-values = <0 100>;
+ led-pins = <&pwmled_amber_right 0>,
+ <&pwmled_white_right 100>;
};
};
@@ -1051,7 +956,7 @@
reg = <0x55556666 0x1000>;
status = "okay";
buffer-size = <200>;
- };
+ };
};
@@ -1078,7 +983,7 @@
};
battery: sb@b {
- compatible = "zephyr,smart-battery-emul";
+ compatible = "zephyr,smart-battery";
reg = <0xb>;
cycle-count = <99>;
version = "BATTERY_SPEC_VER_1_1_WITH_PEC";
@@ -1089,20 +994,8 @@
dev-name = "AC17A8M";
};
- battery2: sb@3a {
- compatible = "zephyr,smart-battery-emul";
- reg = <0x3a>;
- cycle-count = <99>;
- version = "BATTERY_SPEC_VER_1_1_WITH_PEC";
- /* Real battery voltages are multiples of 4.4V. */
- desired-charg-volt = <5000>;
- desired-charg-cur = <1000>;
- mf-name = "PANASONIC";
- dev-name = "AP16L5J";
- };
-
bma_emul: bma@18 {
- compatible = "zephyr,bma255-emul";
+ compatible = "zephyr,bma255";
reg = <0x18>;
error-on-compensation-not-ready;
error-on-ro-write;
@@ -1111,7 +1004,7 @@
};
accel_bmi260: bmi260@68 {
- compatible = "zephyr,bmi-emul";
+ compatible = "zephyr,bmi";
reg = <0x68>;
device-model = "BMI_EMUL_260";
error-on-ro-write;
diff --git a/zephyr/test/drivers/button/src/main.c b/zephyr/test/drivers/button/src/main.c
index 08874d8032..c26a62dfa1 100644
--- a/zephyr/test/drivers/button/src/main.c
+++ b/zephyr/test/drivers/button/src/main.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/kernel.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "button.h"
#include "console.h"
#include "hooks.h"
@@ -11,11 +16,6 @@
#include "test/drivers/test_state.h"
#include "timer.h"
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
/*
* TODO (b/b/253284635) Timeouts here don't quite align with the button press
* duration. This is caused by an issue with the Zephyr scheduling for delayed
diff --git a/zephyr/test/drivers/chargesplash/src/chargesplash.c b/zephyr/test/drivers/chargesplash/src/chargesplash.c
index 27b3678bd8..9e5bf17019 100644
--- a/zephyr/test/drivers/chargesplash/src/chargesplash.c
+++ b/zephyr/test/drivers/chargesplash/src/chargesplash.c
@@ -3,6 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <stdbool.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/shell/shell_uart.h>
+#include <zephyr/sys/__assert.h>
+#include <zephyr/ztest.h>
+
#include "chipset.h"
#include "config.h"
#include "ec_commands.h"
@@ -10,18 +18,9 @@
#include "hooks.h"
#include "host_command.h"
#include "lid_switch.h"
+#include "timer.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include "timer.h"
-
-#include <stdbool.h>
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/sys/__assert.h>
-#include <zephyr/ztest.h>
/* Do a chargesplash host cmd */
static enum ec_status
@@ -86,7 +85,7 @@ static void set_lid(bool open, bool inhibit_boot)
"inhibit_boot should not be used with a lid close");
}
- zassert_ok(gpio_emul_input_set(lid_switch_dev, GPIO_LID_OPEN_EC_PORT,
+ zassume_ok(gpio_emul_input_set(lid_switch_dev, GPIO_LID_OPEN_EC_PORT,
open),
"Failed to set lid switch GPIO");
@@ -124,7 +123,7 @@ static void reset_state(void *unused)
set_ac_enabled(false);
}
- zassert_ok(shell_execute_cmd(get_ec_shell(), "chargesplash reset"),
+ zassume_ok(shell_execute_cmd(get_ec_shell(), "chargesplash reset"),
"'chargesplash reset' shell command failed");
}
diff --git a/zephyr/test/drivers/common/include/test/drivers/stubs.h b/zephyr/test/drivers/common/include/test/drivers/stubs.h
index 63718649f8..98f3fa1d15 100644
--- a/zephyr/test/drivers/common/include/test/drivers/stubs.h
+++ b/zephyr/test/drivers/common/include/test/drivers/stubs.h
@@ -6,12 +6,15 @@
#ifndef __TEST_DRIVERS_STUBS_H
#define __TEST_DRIVERS_STUBS_H
-#include "power.h"
-
#include <zephyr/fff.h>
+#include "power.h"
enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
+/* Structure used by usb_mux test. It is part of usb_muxes chain. */
+extern struct usb_mux usbc1_virtual_usb_mux;
+extern struct usb_mux usbc0_mux0;
+
/**
* @brief Set product ID that should be returned by board_get_ps8xxx_product_id
*
diff --git a/zephyr/test/drivers/common/include/test/drivers/test_mocks.h b/zephyr/test/drivers/common/include/test/drivers/test_mocks.h
index 6644de8d88..25217dfffe 100644
--- a/zephyr/test/drivers/common/include/test/drivers/test_mocks.h
+++ b/zephyr/test/drivers/common/include/test/drivers/test_mocks.h
@@ -6,8 +6,6 @@
#ifndef __TEST_DRIVERS_TEST_MOCKS_H
#define __TEST_DRIVERS_TEST_MOCKS_H
-#include <stdint.h>
-
#include <zephyr/fff.h>
/*
@@ -118,8 +116,4 @@ DECLARE_FAKE_VOID_FUNC(assert_post_action, const char *, unsigned int);
/* Mocks for common/lid_angle.c */
DECLARE_FAKE_VOID_FUNC(lid_angle_peripheral_enable, int);
-/* Mocks for gpio.h */
-DECLARE_FAKE_VALUE_FUNC(int, gpio_config_unused_pins);
-DECLARE_FAKE_VALUE_FUNC(int, gpio_configure_port_pin, int, int, int);
-
#endif /* __TEST_DRIVERS_TEST_MOCKS_H */
diff --git a/zephyr/test/drivers/common/include/test/drivers/test_state.h b/zephyr/test/drivers/common/include/test/drivers/test_state.h
index b4496c6af9..98cf4a283e 100644
--- a/zephyr/test/drivers/common/include/test/drivers/test_state.h
+++ b/zephyr/test/drivers/common/include/test/drivers/test_state.h
@@ -6,8 +6,6 @@
#ifndef ZEPHYR_TEST_DRIVERS_INCLUDE_TEST_STATE_H_
#define ZEPHYR_TEST_DRIVERS_INCLUDE_TEST_STATE_H_
-#include <stdbool.h>
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/zephyr/test/drivers/common/include/test/drivers/utils.h b/zephyr/test/drivers/common/include/test/drivers/utils.h
index 7be7dd5400..8a703108c3 100644
--- a/zephyr/test/drivers/common/include/test/drivers/utils.h
+++ b/zephyr/test/drivers/common/include/test/drivers/utils.h
@@ -6,21 +6,20 @@
#ifndef ZEPHYR_TEST_DRIVERS_INCLUDE_UTILS_H_
#define ZEPHYR_TEST_DRIVERS_INCLUDE_UTILS_H_
+#include <zephyr/drivers/emul.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/ztest.h>
+#include <stddef.h>
+#include <string.h>
+
#include "charger.h"
+#include "lpc.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
#include "extpower.h"
#include "host_command.h"
-#include "lpc.h"
#include "power.h"
#include "usbc/utils.h"
-#include <stddef.h>
-#include <string.h>
-
-#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/ztest.h>
-
/**
* @brief Helper macro for EMUL_GET_USBC_BINDING. If @p usbc_id has the same
* port number as @p port, then struct emul* for @p chip phandle is
@@ -72,11 +71,21 @@ void test_set_chipset_to_power_level(enum power_state new_state);
/** @brief Set chipset to G3 state. Call all necessary hooks. */
void test_set_chipset_to_g3(void);
+/*
+ * TODO(b/217755888): Implement ztest assume API upstream
+ */
+
+/**
+ * @brief Assume that this function call won't be reached
+ * @param msg Optional message to print if the assumption fails
+ */
+#define zassume_unreachable(msg, ...) zassert_unreachable(msg, ##__VA_ARGS__)
+
/**
* Run an ACPI read to the specified address.
*
* This function assumes a successful ACPI read process and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will skip the calling test.
*
* @param acpi_addr Address to query
* @return Byte read
@@ -87,7 +96,7 @@ uint8_t acpi_read(uint8_t acpi_addr);
* Run an ACPI write to the specified address.
*
* This function assumes a successful ACPI write process and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will skip the calling test.
*
* @param acpi_addr Address to write
* @param write_byte Byte to write to address
@@ -98,7 +107,7 @@ void acpi_write(uint8_t acpi_addr, uint8_t write_byte);
* Run the host command to gather our EC feature flags.
*
* This function assumes a successful host command processing and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will abort the calling test.
*
* @return The result of the host command
*/
@@ -108,7 +117,7 @@ static inline struct ec_response_get_features host_cmd_get_features(void)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND_RESPONSE(EC_CMD_GET_FEATURES, 0, response);
- zassert_ok(host_command_process(&args), "Failed to get features");
+ zassume_ok(host_command_process(&args), "Failed to get features");
return response;
}
@@ -116,7 +125,7 @@ static inline struct ec_response_get_features host_cmd_get_features(void)
* Run the host command to get the charge state for a given charger number.
*
* This function assumes a successful host command processing and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will abort the calling test.
*
* @param chgnum The charger number to query.
* @return The result of the query.
@@ -131,7 +140,7 @@ static inline struct ec_response_charge_state host_cmd_charge_state(int chgnum)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND(EC_CMD_CHARGE_STATE, 0, response, params);
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to get charge state for chgnum %d", chgnum);
return response;
}
@@ -140,7 +149,7 @@ static inline struct ec_response_charge_state host_cmd_charge_state(int chgnum)
* Run the host command to get the USB PD power info for a given port.
*
* This function assumes a successful host command processing and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will abort the calling test.
*
* @param port The USB port to get info from.
* @return The result of the query.
@@ -152,7 +161,7 @@ static inline struct ec_response_usb_pd_power_info host_cmd_power_info(int port)
struct host_cmd_handler_args args = BUILD_HOST_COMMAND(
EC_CMD_USB_PD_POWER_INFO, 0, response, params);
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to get power info for port %d", port);
return response;
}
@@ -161,7 +170,7 @@ static inline struct ec_response_usb_pd_power_info host_cmd_power_info(int port)
* Run the host command to get the Type-C status information for a given port.
*
* This function assumes a successful host command processing and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will abort the calling test.
*
* @param port The USB port to get info from.
* @return The result of the query.
@@ -173,7 +182,7 @@ static inline struct ec_response_typec_status host_cmd_typec_status(int port)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND(EC_CMD_TYPEC_STATUS, 0, response, params);
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to get Type-C state for port %d", port);
return response;
}
@@ -186,7 +195,7 @@ host_cmd_usb_pd_control(int port, enum usb_pd_control_swap swap)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND(EC_CMD_USB_PD_CONTROL, 0, response, params);
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to process usb_pd_control_swap for port %d, swap %d",
port, swap);
return response;
@@ -196,7 +205,7 @@ host_cmd_usb_pd_control(int port, enum usb_pd_control_swap swap)
* Run the host command to suspend/resume PD ports
*
* This function assumes a successful host command processing and will make a
- * call to the zassert_* API. A failure here will fail the calling test.
+ * call to the zassume_* API. A failure here will skip the calling test.
*
* @param port The USB port to operate on
* @param cmd The sub-command to run
@@ -207,7 +216,7 @@ static inline void host_cmd_pd_control(int port, enum ec_pd_control_cmd cmd)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND_PARAMS(EC_CMD_PD_CONTROL, 0, params);
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to process pd_control for port %d, cmd %d", port,
cmd);
}
@@ -231,7 +240,7 @@ host_cmd_charge_control(enum ec_charge_control_mode mode,
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND(EC_CMD_CHARGE_CONTROL, 2, response, params);
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to get charge control values");
return response;
@@ -251,7 +260,7 @@ enum ec_status host_cmd_host_event(enum ec_host_event_action action,
/**
* @brief Call the host command MOTION_SENSE with the dump sub-command
*
- * Note: this function uses the zassert_ API. It will fail the test if the host
+ * Note: this function uses the zassume_ API. It will skip the test if the host
* command fails.
*
* @param max_sensor_count The maximum number of sensor data objects to populate
@@ -540,15 +549,6 @@ void host_cmd_typec_control_clear_events(int port, uint32_t events);
*/
void host_cmd_typec_control_bist_share_mode(int port, int enable);
-/**
- * Run the host command to control PD port behavior, with the sub-command of
- * TYPEC_CONTROL_COMMAND_SEND_VDM_REQ
- *
- * @param port The USB-C port number
- * @param vdm_req VDM request data
- */
-void host_cmd_typec_control_vdm_req(int port, struct typec_vdm_req vdm_req);
-
struct host_events_ctx {
host_event_t lpc_host_events;
host_event_t lpc_host_event_mask[LPC_HOST_EVENT_COUNT];
@@ -580,7 +580,7 @@ void host_events_restore(struct host_events_ctx *host_events_ctx);
* If enabled, the device _should_ begin charging.
*
* This function assumes a successful gpio emulator call and will make a call
- * to the zassert_* API. A failure here will fail the calling test.
+ * to the zassume_* API. A failure here will abort the calling test.
*
* This function sleeps to wait for the GPIO interrupt to take place.
*
@@ -591,14 +591,10 @@ static inline void set_ac_enabled(bool enabled)
const struct device *acok_dev =
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_ACOK_OD_NODE, gpios));
- zassert_ok(gpio_emul_input_set(acok_dev, GPIO_ACOK_OD_PIN, enabled),
+ zassume_ok(gpio_emul_input_set(acok_dev, GPIO_ACOK_OD_PIN, enabled),
NULL);
- /*
- * b/253284635 - Sleep for a full second past the debounce time
- * to ensure the power button debounce logic runs.
- */
- k_sleep(K_MSEC(CONFIG_EXTPOWER_DEBOUNCE_MS + 1000));
- zassert_equal(enabled, extpower_is_present(), NULL);
+ k_sleep(K_MSEC(CONFIG_EXTPOWER_DEBOUNCE_MS + 1));
+ zassume_equal(enabled, extpower_is_present(), NULL);
}
/**
diff --git a/zephyr/test/drivers/common/src/main.c b/zephyr/test/drivers/common/src/main.c
index dab681b936..1c8497ab3f 100644
--- a/zephyr/test/drivers/common/src/main.c
+++ b/zephyr/test/drivers/common/src/main.c
@@ -3,13 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
#include "ec_app_main.h"
#include "hooks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
/**
* @brief Semaphore that signals when hooks have completed
*/
diff --git a/zephyr/test/drivers/common/src/stubs.c b/zephyr/test/drivers/common/src/stubs.c
index 69993d8a89..d07683017f 100644
--- a/zephyr/test/drivers/common/src/stubs.c
+++ b/zephyr/test/drivers/common/src/stubs.c
@@ -7,11 +7,11 @@
#include "battery_fuel_gauge.h"
#include "bc12/pi3usb9201_public.h"
#include "charge_ramp.h"
-#include "charge_state_v2.h"
#include "charger.h"
#include "charger/isl923x_public.h"
#include "charger/isl9241_public.h"
#include "config.h"
+#include <zephyr/fff.h>
#include "gpio/gpio_int.h"
#include "hooks.h"
#include "i2c/i2c.h"
@@ -19,14 +19,14 @@
#include "ppc/sn5s330_public.h"
#include "ppc/syv682x_public.h"
#include "retimer/bb_retimer_public.h"
+#include "test/drivers/stubs.h"
#include "tcpm/ps8xxx_public.h"
#include "tcpm/tcpci.h"
-#include "test/drivers/stubs.h"
#include "usb_mux.h"
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
+#include "charge_state_v2.h"
-#include <zephyr/fff.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(stubs);
@@ -40,6 +40,19 @@ LOG_MODULE_REGISTER(stubs);
* device tree.
*/
+/* BC1.2 charger detect configuration */
+const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
+ [USBC_PORT_C0] = {
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
+ },
+ [USBC_PORT_C1] = {
+ .i2c_port = I2C_PORT_USB_C1,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
+
int board_set_active_charge_port(int port)
{
int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
@@ -98,6 +111,13 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
return 0;
}
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
static uint16_t ps8xxx_product_id = PS8805_PRODUCT_ID;
@@ -128,6 +148,68 @@ int board_is_sourcing_vbus(int port)
return ppc_is_sourcing_vbus(port);
}
+/* TODO(b/239457738): Move to dts */
+struct usb_mux_chain usbc0_virtual_usb_mux_chain = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+};
+
+struct usb_mux usbc1_virtual_usb_mux = {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+};
+
+struct usb_mux_chain usbc1_virtual_usb_mux_chain = {
+ .mux = &usbc1_virtual_usb_mux,
+};
+
+struct usb_mux usbc0_mux0 = {
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = DT_REG_ADDR(DT_NODELABEL(tcpci_emul)),
+};
+
+struct usb_mux_chain usb_muxes[] = {
+ [USBC_PORT_C0] = {
+ .mux = &usbc0_mux0,
+ .next = &usbc0_virtual_usb_mux_chain,
+ },
+ [USBC_PORT_C1] = {
+#ifdef CONFIG_PLATFORM_EC_USBC_RETIMER_INTEL_BB
+ .mux = &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C1,
+ .i2c_addr_flags = DT_REG_ADDR(DT_NODELABEL(
+ usb_c1_bb_retimer_emul)),
+ },
+ .next = &usbc1_virtual_usb_mux_chain,
+#endif
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
+
+#ifdef CONFIG_PLATFORM_EC_USBC_RETIMER_INTEL_BB
+struct bb_usb_control bb_controls[] = {
+ [USBC_PORT_C0] = {
+ /* USB-C port 0 doesn't have a retimer */
+ },
+ [USBC_PORT_C1] = {
+ .usb_ls_en_gpio = GPIO_SIGNAL(DT_NODELABEL(usb_c1_ls_en)),
+ .retimer_rst_gpio =
+ GPIO_SIGNAL(DT_NODELABEL(usb_c1_rt_rst_odl)),
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(bb_controls) == USBC_PORT_COUNT);
+#endif
+
void pd_power_supply_reset(int port)
{
}
diff --git a/zephyr/test/drivers/common/src/test_mocks.c b/zephyr/test/drivers/common/src/test_mocks.c
index 21cd4c0c1b..ab6c65313d 100644
--- a/zephyr/test/drivers/common/src/test_mocks.c
+++ b/zephyr/test/drivers/common/src/test_mocks.c
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "test/drivers/test_mocks.h"
-
#include <zephyr/ztest.h>
+#include "test/drivers/test_mocks.h"
+
/* Mocks for common/init_rom.c */
DEFINE_FAKE_VALUE_FUNC(const void *, init_rom_map, const void *, int);
DEFINE_FAKE_VOID_FUNC(init_rom_unmap, const void *, int);
@@ -22,10 +22,6 @@ DEFINE_FAKE_VOID_FUNC(assert_post_action, const char *, unsigned int);
/* Mocks for common/lid_angle.c */
DEFINE_FAKE_VOID_FUNC(lid_angle_peripheral_enable, int);
-/* Mocks for gpio.h */
-DEFINE_FAKE_VALUE_FUNC(int, gpio_config_unused_pins);
-DEFINE_FAKE_VALUE_FUNC(int, gpio_configure_port_pin, int, int, int);
-
/**
* @brief Reset all the fakes before each test.
*/
@@ -44,8 +40,6 @@ static void fff_reset_rule_before(const struct ztest_unit_test *test,
RESET_FAKE(software_panic);
RESET_FAKE(assert_post_action);
RESET_FAKE(lid_angle_peripheral_enable);
- RESET_FAKE(gpio_config_unused_pins);
- RESET_FAKE(gpio_configure_port_pin);
}
ZTEST_RULE(fff_reset_rule, fff_reset_rule_before, NULL);
diff --git a/zephyr/test/drivers/common/src/test_rules.c b/zephyr/test/drivers/common/src/test_rules.c
index 42195b25d7..e1b1d59480 100644
--- a/zephyr/test/drivers/common/src/test_rules.c
+++ b/zephyr/test/drivers/common/src/test_rules.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "emul/tcpc/emul_tcpci.h"
#include "motion_sense_fifo.h"
#include "test/drivers/stubs.h"
#include "test/drivers/utils.h"
#include "usb_pd_tcpm.h"
-#include <zephyr/ztest.h>
-
static void motion_sense_fifo_reset_before(const struct ztest_unit_test *test,
void *data)
{
diff --git a/zephyr/test/drivers/common/src/utils.c b/zephyr/test/drivers/common/src/utils.c
index afea5edbac..719a3fe589 100644
--- a/zephyr/test/drivers/common/src/utils.c
+++ b/zephyr/test/drivers/common/src/utils.c
@@ -3,34 +3,38 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/shell/shell_dummy.h> /* nocheck */
+#include <zephyr/shell/shell_uart.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "acpi.h"
#include "battery.h"
#include "battery_smart.h"
#include "charge_state.h"
#include "chipset.h"
+#include "lpc.h"
#include "emul/emul_isl923x.h"
#include "emul/emul_smart_battery.h"
#include "emul/emul_stub_device.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
#include "hooks.h"
-#include "lpc.h"
#include "power.h"
#include "task.h"
#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
#include "test/drivers/utils.h"
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/ztest.h>
-
#define BATTERY_NODE DT_NODELABEL(battery)
#define GPIO_BATT_PRES_ODL_PATH DT_PATH(named_gpios, ec_batt_pres_odl)
#define GPIO_BATT_PRES_ODL_PORT DT_GPIO_PIN(GPIO_BATT_PRES_ODL_PATH, gpios)
+/*
+ * TODO(b/251281997): Switch zasserts back to zassumes when they loudly fail
+ */
+
void test_set_battery_level(int percentage)
{
struct sbat_emul_bat_data *bat;
@@ -588,21 +592,7 @@ void host_cmd_typec_control_bist_share_mode(int port, int enable)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
- zassert_ok(host_command_process(&args),
- "Failed to send Type-C control for port %d", port);
-}
-
-void host_cmd_typec_control_vdm_req(int port, struct typec_vdm_req vdm_req)
-{
- struct ec_params_typec_control params = {
- .port = port,
- .command = TYPEC_CONTROL_COMMAND_SEND_VDM_REQ,
- .vdm_req_params = vdm_req,
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_TYPEC_CONTROL, 0, params);
-
- zassert_ok(host_command_process(&args),
+ zassume_ok(host_command_process(&args),
"Failed to send Type-C control for port %d", port);
}
diff --git a/zephyr/test/drivers/common_cbi/src/test_common_cbi.c b/zephyr/test/drivers/common_cbi/src/test_common_cbi.c
index bf8da93a9e..f8348b6770 100644
--- a/zephyr/test/drivers/common_cbi/src/test_common_cbi.c
+++ b/zephyr/test/drivers/common_cbi/src/test_common_cbi.c
@@ -3,66 +3,12 @@
* found in the LICENSE file.
*/
-#include "cros_board_info.h"
#include "host_command.h"
-#include "test/drivers/test_mocks.h"
-#include "test/drivers/test_state.h"
-
-#include <zephyr/drivers/eeprom.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/ztest.h>
-#define WP_L_GPIO_PATH DT_PATH(named_gpios, wp_l)
-#define CBI_EEPROM_DEV DEVICE_DT_GET(DT_NODELABEL(cbi_eeprom))
-
-FAKE_VALUE_FUNC(int, eeprom_load, uint8_t, uint8_t *, int);
-
-static int gpio_wp_l_set(int value)
-{
- const struct device *wp_l_gpio_dev =
- DEVICE_DT_GET(DT_GPIO_CTLR(WP_L_GPIO_PATH, gpios));
-
- return gpio_emul_input_set(wp_l_gpio_dev,
- DT_GPIO_PIN(WP_L_GPIO_PATH, gpios), value);
-}
-
-static int __test_eeprom_load_default_impl(uint8_t offset, uint8_t *data,
- int len)
-{
- int ret = eeprom_read(CBI_EEPROM_DEV, offset, data, len);
-
- return ret;
-}
-
-ZTEST(common_cbi, test_cbi_latch_eeprom_wp)
-{
- const struct gpio_dt_spec *wp = GPIO_DT_FROM_ALIAS(gpio_cbi_wp);
-
- zassert_equal(gpio_emul_output_get(wp->port, wp->pin), 0);
-
- cbi_latch_eeprom_wp();
-
- zassert_equal(gpio_emul_output_get(wp->port, wp->pin), 1);
-}
-
-ZTEST(common_cbi, test_do_cbi_read__cant_load_head)
-{
- enum cbi_data_tag arbitrary_unused_tag = CBI_TAG_SKU_ID;
- uint8_t arbitrary_unused_byte_buffer[100];
- uint8_t unused_data_size;
-
- /* Force a do_cbi_read() to eeprom */
- cbi_invalidate_cache();
-
- /* Return arbitrary nonzero value */
- eeprom_load_fake.return_val = 1;
- eeprom_load_fake.custom_fake = NULL;
-
- zassert_equal(cbi_get_board_info(arbitrary_unused_tag,
- arbitrary_unused_byte_buffer,
- &unused_data_size),
- EC_ERROR_UNKNOWN);
-}
+#include "cros_board_info.h"
+#include "test/drivers/test_mocks.h"
+#include "test/drivers/test_state.h"
ZTEST(common_cbi, test_cbi_set_string__null_str)
{
@@ -80,160 +26,19 @@ ZTEST(common_cbi, test_cbi_set_string__null_str)
ZTEST(common_cbi, test_cbi_set_string)
{
- const char arbitrary_str[] = "hello cbi";
+ struct cbi_data data = { 0 };
enum cbi_data_tag arbitrary_valid_tag = CBI_TAG_SKU_ID;
+ const char *arbitrary_str = "hello cbi";
- struct cbi_data_wrapper {
- struct cbi_data data;
- uint8_t value_arr[ARRAY_SIZE(arbitrary_str)];
- };
- struct cbi_data_wrapper cbi_data = { 0 };
-
- /* Set some provided memory then check values */
uint8_t *addr_byte_after_store = cbi_set_string(
- (uint8_t *)&cbi_data, arbitrary_valid_tag, arbitrary_str);
-
- zassert_equal(cbi_data.data.tag, arbitrary_valid_tag);
- zassert_equal(cbi_data.data.size, ARRAY_SIZE(arbitrary_str));
- zassert_mem_equal(cbi_data.data.value, arbitrary_str,
- cbi_data.data.size);
-
- uint32_t expected_added_memory =
- (ARRAY_SIZE(arbitrary_str) + sizeof(cbi_data.data));
-
- /* Validate that next address for write was set appropriately */
- zassert_equal_ptr(addr_byte_after_store - expected_added_memory,
- &cbi_data.data);
-}
-
-ZTEST_USER(common_cbi, test_hc_cbi_set_then_get)
-{
- const uint8_t data[] = "I love test coverage! <3";
-
- struct actual_set_params {
- struct ec_params_set_cbi params;
- uint8_t actual_data[ARRAY_SIZE(data)];
- };
-
- struct actual_set_params hc_set_params = {
- .params = {
- .tag = CBI_TAG_SKU_ID,
- /* Force a reload */
- .flag = CBI_SET_INIT,
- .size = ARRAY_SIZE(data),
- },
- };
- struct host_cmd_handler_args set_args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_CROS_BOARD_INFO, 0, hc_set_params);
-
- memcpy(hc_set_params.params.data, data, ARRAY_SIZE(data));
-
- /* Turn off write-protect so we can actually write */
- gpio_wp_l_set(1);
-
- zassert_ok(host_command_process(&set_args));
-
- /* Now verify our write by invoking a get host command */
+ (uint8_t *)&data, arbitrary_valid_tag, arbitrary_str);
- struct ec_params_get_cbi hc_get_params = {
- .flag = CBI_GET_RELOAD,
- .tag = hc_set_params.params.tag,
- };
-
- struct test_ec_params_get_cbi_response {
- uint8_t data[ARRAY_SIZE(data)];
- };
- struct test_ec_params_get_cbi_response hc_get_response;
- struct host_cmd_handler_args get_args = BUILD_HOST_COMMAND(
- EC_CMD_GET_CROS_BOARD_INFO, 0, hc_get_response, hc_get_params);
-
- zassert_ok(host_command_process(&get_args));
- zassert_mem_equal(hc_get_response.data, hc_set_params.actual_data,
- hc_set_params.params.size);
-}
-
-ZTEST_USER(common_cbi, test_hc_cbi_set__bad_size)
-{
- const char data[] = "hello";
-
- struct actual_set_params {
- struct ec_params_set_cbi params;
- /* We want less data than we need for our size */
- uint8_t actual_data[0];
- };
- struct actual_set_params hc_set_params = {
- .params = {
- .tag = CBI_TAG_SKU_ID,
- /* Force a reload */
- .flag = CBI_SET_INIT,
- .size = ARRAY_SIZE(data),
- },
- };
- struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_CROS_BOARD_INFO, 0, hc_set_params);
-
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM);
-}
-
-ZTEST_USER(common_cbi, test_hc_cbi_set_then_get__with_too_small_response)
-{
- const uint8_t data[] = "I'm way too big of a payload for you!";
-
- struct actual_set_params {
- struct ec_params_set_cbi params;
- uint8_t actual_data[ARRAY_SIZE(data)];
- };
-
- struct actual_set_params hc_set_params = {
- .params = {
- .tag = CBI_TAG_SKU_ID,
- /* Force a reload */
- .flag = CBI_SET_INIT,
- .size = ARRAY_SIZE(data),
- },
- };
- struct host_cmd_handler_args set_args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_CROS_BOARD_INFO, 0, hc_set_params);
-
- memcpy(hc_set_params.params.data, data, ARRAY_SIZE(data));
-
- /* Turn off write-protect so we can actually write */
- gpio_wp_l_set(1);
-
- zassert_ok(host_command_process(&set_args));
-
- /* Now verify our write by invoking a get host command */
-
- struct ec_params_get_cbi hc_get_params = {
- .flag = CBI_GET_RELOAD,
- .tag = hc_set_params.params.tag,
- };
-
- struct test_ec_params_get_cbi_response {
- /*
- * Want want less space than we need to retrieve cbi data, by
- * allocating an array of size zero, we're implicitly setting
- * the response_max value of the host command to be zero. So the
- * host command will fail because it the EC knows it doesn't
- * have enough response space to actually fetch the data for the
- * host.
- */
- uint8_t data[0];
- };
- struct test_ec_params_get_cbi_response hc_get_response;
- struct host_cmd_handler_args get_args = BUILD_HOST_COMMAND(
- EC_CMD_GET_CROS_BOARD_INFO, 0, hc_get_response, hc_get_params);
-
- zassert_equal(host_command_process(&get_args), EC_RES_INVALID_PARAM);
-}
-
-static void test_common_cbi_before_after(void *test_data)
-{
- RESET_FAKE(eeprom_load);
- eeprom_load_fake.custom_fake = __test_eeprom_load_default_impl;
-
- cbi_create();
+ zassert_equal(data.tag, arbitrary_valid_tag);
+ zassert_equal(data.size, strlen(arbitrary_str) + 1);
+ zassert_mem_equal(data.value, arbitrary_str, data.size);
+ zassert_equal(addr_byte_after_store -
+ (strlen(arbitrary_str) + 1 + sizeof(data)),
+ (uint8_t *)&data);
}
-ZTEST_SUITE(common_cbi, drivers_predicate_post_main, NULL,
- test_common_cbi_before_after, test_common_cbi_before_after, NULL);
+ZTEST_SUITE(common_cbi, drivers_predicate_post_main, NULL, NULL, NULL, NULL);
diff --git a/zephyr/test/drivers/common_cbi_gpio/src/test_common_cbi_gpio.c b/zephyr/test/drivers/common_cbi_gpio/src/test_common_cbi_gpio.c
index 8e8e4f6a8b..4af62a3d8b 100644
--- a/zephyr/test/drivers/common_cbi_gpio/src/test_common_cbi_gpio.c
+++ b/zephyr/test/drivers/common_cbi_gpio/src/test_common_cbi_gpio.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "cros_board_info.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, system_get_board_version);
FAKE_VALUE_FUNC(int, cbi_set_board_info, enum cbi_data_tag, const uint8_t *,
uint8_t);
diff --git a/zephyr/test/drivers/common_charger/CMakeLists.txt b/zephyr/test/drivers/common_charger/CMakeLists.txt
index 63da1783f1..aeb77d3577 100644
--- a/zephyr/test/drivers/common_charger/CMakeLists.txt
+++ b/zephyr/test/drivers/common_charger/CMakeLists.txt
@@ -3,9 +3,4 @@
# found in the LICENSE file.
# Add source files
-target_sources(app
- PRIVATE
- src/test_charge_state_v2.c
- src/test_common_charger.c
- src/test_common_charger_mocked.c
-)
+target_sources(app PRIVATE src/test_common_charger.c)
diff --git a/zephyr/test/drivers/common_charger/src/test_charge_state_v2.c b/zephyr/test/drivers/common_charger/src/test_charge_state_v2.c
deleted file mode 100644
index 9dfeb5e734..0000000000
--- a/zephyr/test/drivers/common_charger/src/test_charge_state_v2.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "battery.h"
-#include "charge_state_v2.h"
-#include "math_util.h"
-#include "test/drivers/test_state.h"
-
-#include <zephyr/ztest.h>
-
-int battery_outside_charging_temperature(void);
-
-struct charge_state_v2_fixture {
- struct charge_state_data charge_state_data;
-};
-
-static void *setup(void)
-{
- static struct charge_state_v2_fixture fixture;
-
- return &fixture;
-}
-
-static void before(void *f)
-{
- struct charge_state_v2_fixture *fixture = f;
-
- fixture->charge_state_data = *charge_get_status();
-}
-
-static void after(void *f)
-{
- struct charge_state_v2_fixture *fixture = f;
-
- *charge_get_status() = fixture->charge_state_data;
-}
-
-ZTEST_SUITE(charge_state_v2, drivers_predicate_post_main, setup, before, after,
- NULL);
-
-ZTEST(charge_state_v2, test_battery_flag_bad_temperature)
-{
- struct charge_state_data *curr = charge_get_status();
-
- curr->batt.flags |= BATT_FLAG_BAD_TEMPERATURE;
- zassert_ok(battery_outside_charging_temperature());
-}
-
-ZTEST(charge_state_v2, test_battery_temperature_range)
-{
- struct charge_state_data *curr = charge_get_status();
- const struct battery_info *batt_info = battery_get_info();
-
- curr->batt.flags &= ~BATT_FLAG_BAD_TEMPERATURE;
-
- /* Start off without a desired voltage/current */
- curr->batt.desired_voltage = 0;
- curr->batt.desired_current = 0;
-
- /* Temperature is too high */
- curr->batt.temperature =
- CELSIUS_TO_DECI_KELVIN(batt_info->start_charging_max_c + 1);
- zassert_equal(1, battery_outside_charging_temperature());
-
- /* Temperature is too low */
- curr->batt.temperature =
- CELSIUS_TO_DECI_KELVIN(batt_info->start_charging_min_c - 1);
- zassert_equal(1, battery_outside_charging_temperature());
-
- /* Temperature is just right */
- curr->batt.temperature =
- CELSIUS_TO_DECI_KELVIN((batt_info->start_charging_max_c +
- batt_info->start_charging_min_c) /
- 2);
- zassert_ok(battery_outside_charging_temperature());
-
- /* Set an arbitrary desired current */
- curr->batt.desired_current = 3;
-
- /* Temperature is too high */
- curr->batt.temperature =
- CELSIUS_TO_DECI_KELVIN(batt_info->charging_max_c + 1);
- zassert_equal(1, battery_outside_charging_temperature());
-
- /* Set an arbitrary desired voltage */
- curr->batt.desired_voltage = 5;
-
- /* Temperature is too low */
- curr->batt.temperature =
- CELSIUS_TO_DECI_KELVIN(batt_info->charging_min_c - 1);
- zassert_equal(1, battery_outside_charging_temperature());
-
- /* Temperature is just right */
- curr->batt.temperature = CELSIUS_TO_DECI_KELVIN(
- (batt_info->charging_max_c + batt_info->charging_min_c) / 2);
- zassert_ok(battery_outside_charging_temperature());
-}
-
-ZTEST(charge_state_v2, test_current_limit_derating)
-{
- int charger_current_limit;
-
- charge_set_input_current_limit(1000, 5000);
- zassert_ok(charger_get_input_current_limit(0, &charger_current_limit));
- /*
- * ISL923x sets ICL in multiples of 20 mA, so 950 mA gets rounded down
- * to the nearest multiple of 20.
- */
- zassert_equal(
- charger_current_limit, 944,
- "%d%% derating of 1A should be 944 mA, but charger is set for %d mA",
- CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT,
- charger_current_limit);
-}
-
-ZTEST(charge_state_v2, test_minimum_current_limit)
-{
- int charger_current_limit;
-
- charge_set_input_current_limit(50, 5000);
- zassert_ok(charger_get_input_current_limit(0, &charger_current_limit));
- zassert_equal(charger_current_limit, 96,
- "Minimum input current limit should be %d mA,"
- " but current limit is %d (capped to %d)",
- 96, charger_current_limit,
- CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT);
-}
diff --git a/zephyr/test/drivers/common_charger/src/test_common_charger.c b/zephyr/test/drivers/common_charger/src/test_common_charger.c
index 46403636d6..ca9469c032 100644
--- a/zephyr/test/drivers/common_charger/src/test_common_charger.c
+++ b/zephyr/test/drivers/common_charger/src/test_common_charger.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/ztest_assert.h>
+
#include "charge_ramp.h"
#include "driver/charger/isl923x_public.h"
#include "ec_commands.h"
@@ -11,10 +15,6 @@
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-
/* Tested wrt isl923x without RAA489000 */
/* Only single charger-chip configured for the drivers overlay */
@@ -50,7 +50,7 @@ ZTEST(common_charger, test_chg_ramp_is_detected)
ZTEST(common_charger, test_chg_ramp_get_current_limit)
{
zassert_equal(chg_ramp_get_current_limit(),
- CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT);
+ CONFIG_CHARGER_INPUT_CURRENT);
}
ZTEST(common_charger, test_charger_get_min_bat_pct_for_power_on)
diff --git a/zephyr/test/drivers/common_charger/src/test_common_charger_mocked.c b/zephyr/test/drivers/common_charger/src/test_common_charger_mocked.c
deleted file mode 100644
index c353b7b6c5..0000000000
--- a/zephyr/test/drivers/common_charger/src/test_common_charger_mocked.c
+++ /dev/null
@@ -1,598 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "charge_ramp.h"
-#include "charger.h"
-#include "test/drivers/charger_utils.h"
-#include "test/drivers/test_state.h"
-
-#include <string.h>
-
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-
-/* This test suite only works if the chg_chips array is not const. */
-BUILD_ASSERT(IS_ENABLED(CONFIG_PLATFORM_EC_CHARGER_RUNTIME_CONFIG),
- "chg_chips array cannot be const.");
-
-/** Index of the charger chip we are overriding / working with. */
-#define CHG_NUM (0)
-
-/* FFF fakes for driver functions. These get assigned to members of the
- * charger_drv struct
- */
-FAKE_VALUE_FUNC(enum ec_error_list, enable_otg_power, int, int);
-FAKE_VALUE_FUNC(enum ec_error_list, set_otg_current_voltage, int, int, int);
-FAKE_VALUE_FUNC(int, is_sourcing_otg_power, int, int);
-FAKE_VALUE_FUNC(enum ec_error_list, get_actual_current, int, int *);
-FAKE_VALUE_FUNC(enum ec_error_list, get_actual_voltage, int, int *);
-FAKE_VALUE_FUNC(enum ec_error_list, set_voltage, int, int);
-FAKE_VALUE_FUNC(enum ec_error_list, get_vsys_voltage, int, int, int *);
-FAKE_VALUE_FUNC(enum ec_error_list, enable_bypass_mode, int, bool);
-FAKE_VALUE_FUNC(enum ec_error_list, set_vsys_compensation, int,
- struct ocpc_data *, int, int);
-FAKE_VALUE_FUNC(enum ec_error_list, is_icl_reached, int, bool *);
-FAKE_VALUE_FUNC(enum ec_error_list, enable_linear_charge, int, bool);
-FAKE_VALUE_FUNC(enum ec_error_list, get_battery_cells, int, int *);
-
-/**
- * @brief If non-NULL, board_get_charger_chip_count returns the value this
- * pointer points to.
- */
-static uint8_t *fake_charger_count;
-
-/**
- * @brief Override of definition from common/charger.c. Allows adjusting the
- * number of chargers. This is not an FFF mock because FFF mock return values
- * default to 0 until the test code gets a change to update it, which can cause
- * a race condition as the EC initializes. This function has the correct
- * count as soon as the program starts, which is CHARGER_NUM chargers.
- *
- * @return uint8_t Number of charger chips
- */
-uint8_t board_get_charger_chip_count(void)
-{
- if (fake_charger_count) {
- return *fake_charger_count;
- }
-
- /* Default value */
- return CHARGER_NUM;
-}
-
-struct common_charger_mocked_driver_fixture {
- /* The original driver pointer that gets restored after the tests */
- const struct charger_drv *saved_driver_ptr;
- /* Mock driver that gets substituted */
- struct charger_drv mock_driver;
-};
-
-ZTEST(common_charger_mocked_driver, test_charger_enable_otg_power__invalid)
-{
- /* charger number out of bounds */
- zassert_equal(EC_ERROR_INVAL, charger_enable_otg_power(-1, 0));
- zassert_equal(EC_ERROR_INVAL, charger_enable_otg_power(INT_MAX, 0));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_enable_otg_power__unimpl)
-{
- /* enable_otg_power is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_enable_otg_power(CHG_NUM, 1));
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_enable_otg_power)
-{
- fixture->mock_driver.enable_otg_power = enable_otg_power;
- enable_otg_power_fake.return_val = 123;
-
- zassert_equal(enable_otg_power_fake.return_val,
- charger_enable_otg_power(CHG_NUM, 1));
-
- zassert_equal(1, enable_otg_power_fake.call_count);
- zassert_equal(CHG_NUM, enable_otg_power_fake.arg0_history[0]);
- zassert_equal(1, enable_otg_power_fake.arg1_history[0]);
-}
-
-ZTEST(common_charger_mocked_driver,
- test_charger_set_otg_current_voltage__invalid)
-{
- /* charger number out of bounds */
- zassert_equal(EC_ERROR_INVAL,
- charger_set_otg_current_voltage(-1, 0, 0));
- zassert_equal(EC_ERROR_INVAL,
- charger_set_otg_current_voltage(INT_MAX, 0, 0));
-}
-
-ZTEST(common_charger_mocked_driver,
- test_charger_set_otg_current_voltage__unimpl)
-{
- /* set_otg_current_voltage is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_set_otg_current_voltage(CHG_NUM, 0, 0));
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_set_otg_current_voltage)
-{
- fixture->mock_driver.set_otg_current_voltage = set_otg_current_voltage;
- set_otg_current_voltage_fake.return_val = 123;
-
- zassert_equal(set_otg_current_voltage_fake.return_val,
- charger_set_otg_current_voltage(CHG_NUM, 10, 20));
-
- zassert_equal(1, set_otg_current_voltage_fake.call_count);
- zassert_equal(CHG_NUM, set_otg_current_voltage_fake.arg0_history[0]);
- zassert_equal(10, set_otg_current_voltage_fake.arg1_history[0]);
- zassert_equal(20, set_otg_current_voltage_fake.arg2_history[0]);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_is_sourcing_otg_power__invalid)
-{
- /* is_sourcing_otg_power is NULL */
- zassert_equal(0, charger_is_sourcing_otg_power(0));
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_is_sourcing_otg_power)
-{
- fixture->mock_driver.is_sourcing_otg_power = is_sourcing_otg_power;
- is_sourcing_otg_power_fake.return_val = 123;
-
- zassert_equal(is_sourcing_otg_power_fake.return_val,
- charger_is_sourcing_otg_power(0));
-
- zassert_equal(1, is_sourcing_otg_power_fake.call_count);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_actual_current__invalid)
-{
- /* charger number out of bounds */
- zassert_equal(EC_ERROR_INVAL, charger_get_actual_current(-1, NULL));
- zassert_equal(EC_ERROR_INVAL,
- charger_get_actual_current(INT_MAX, NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_actual_current__unimpl)
-{
- /* get_actual_current is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_get_actual_current(CHG_NUM, NULL));
-}
-
-/**
- * @brief Custom fake for get_actual_current that can write to the output param
- */
-static enum ec_error_list get_actual_current_custom_fake(int chgnum,
- int *current)
-{
- ARG_UNUSED(chgnum);
-
- *current = 1000;
-
- return EC_SUCCESS;
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_get_actual_current)
-{
- int current;
-
- fixture->mock_driver.get_actual_current = get_actual_current;
- get_actual_current_fake.custom_fake = get_actual_current_custom_fake;
-
- zassert_equal(EC_SUCCESS,
- charger_get_actual_current(CHG_NUM, &current));
-
- zassert_equal(1, get_actual_current_fake.call_count);
- zassert_equal(CHG_NUM, get_actual_current_fake.arg0_history[0]);
- zassert_equal(1000, current);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_actual_voltage__invalid)
-{
- /* charger number out of bounds */
- zassert_equal(EC_ERROR_INVAL, charger_get_actual_voltage(-1, NULL));
- zassert_equal(EC_ERROR_INVAL,
- charger_get_actual_voltage(INT_MAX, NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_actual_voltage__unimpl)
-{
- /* get_actual_voltage is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_get_actual_voltage(CHG_NUM, NULL));
-}
-
-/**
- * @brief Custom fake for get_actual_voltage that can write to the output param
- */
-static enum ec_error_list get_actual_voltage_custom_fake(int chgnum,
- int *voltage)
-{
- ARG_UNUSED(chgnum);
-
- *voltage = 2000;
-
- return EC_SUCCESS;
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_get_actual_voltage)
-{
- int voltage;
-
- fixture->mock_driver.get_actual_voltage = get_actual_voltage;
- get_actual_voltage_fake.custom_fake = get_actual_voltage_custom_fake;
-
- zassert_equal(EC_SUCCESS,
- charger_get_actual_voltage(CHG_NUM, &voltage));
-
- zassert_equal(1, get_actual_voltage_fake.call_count);
- zassert_equal(CHG_NUM, get_actual_voltage_fake.arg0_history[0]);
- zassert_equal(2000, voltage);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_set_voltage__invalid)
-{
- /* charger number out of bounds */
- zassert_equal(EC_ERROR_INVAL, charger_set_voltage(-1, 0));
- zassert_equal(EC_ERROR_INVAL, charger_set_voltage(INT_MAX, 0));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_set_voltage__unimpl)
-{
- /* set_voltage is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_set_voltage(CHG_NUM, 0));
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_set_voltage)
-{
- fixture->mock_driver.set_voltage = set_voltage;
- set_voltage_fake.return_val = 123;
-
- zassert_equal(set_voltage_fake.return_val,
- charger_set_voltage(CHG_NUM, 2000));
-
- zassert_equal(1, set_voltage_fake.call_count);
- zassert_equal(CHG_NUM, set_voltage_fake.arg0_history[0]);
- zassert_equal(2000, set_voltage_fake.arg1_history[0]);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_vsys_voltage__invalid)
-{
- /* Cannot do chgnum bounds checking because
- * charger_get_valid_chgnum() will convert chgnum to 0 unless
- * CONFIG_CHARGER_SINGLE_CHIP is turned off.
- */
-
- /* get_vsys_voltage is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_get_vsys_voltage(CHG_NUM, NULL));
-}
-
-/**
- * @brief Custom fake for get_vsys_voltage that can write to the output param
- */
-static enum ec_error_list get_vsys_voltage_custom_fake(int chgnum, int port,
- int *voltage)
-{
- ARG_UNUSED(chgnum);
- ARG_UNUSED(port);
-
- *voltage = 2000;
-
- return EC_SUCCESS;
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_get_vsys_voltage)
-{
- int vsys_voltage;
-
- fixture->mock_driver.get_vsys_voltage = get_vsys_voltage;
- get_vsys_voltage_fake.custom_fake = get_vsys_voltage_custom_fake;
-
- zassert_equal(EC_SUCCESS,
- charger_get_vsys_voltage(CHG_NUM, &vsys_voltage));
-
- zassert_equal(1, get_vsys_voltage_fake.call_count);
- zassert_equal(CHG_NUM, get_vsys_voltage_fake.arg0_history[0]);
- zassert_equal(CHG_NUM, get_vsys_voltage_fake.arg1_history[0]);
- zassert_equal(2000, vsys_voltage);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_enable_bypass_mode__invalid)
-{
- /* enable_bypass_mode is NULL */
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_enable_bypass_mode(CHG_NUM, false));
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_enable_bypass_mode)
-{
- fixture->mock_driver.enable_bypass_mode = enable_bypass_mode;
- enable_bypass_mode_fake.return_val = 123;
-
- zassert_equal(123, charger_enable_bypass_mode(CHG_NUM, true));
-
- zassert_equal(1, enable_bypass_mode_fake.call_count);
- zassert_true(enable_bypass_mode_fake.arg1_history[0]);
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_params__error_flags)
-{
- /* When one of the parameters cannot be retrieved, a corresponding flag
- * is set. Since all of the driver functions are unimplemented by
- * default, this should cause all error flags to be set.
- */
-
- struct charger_params params;
-
- charger_get_params(&params);
-
- zassert_true(params.flags & CHG_FLAG_BAD_CURRENT);
- zassert_true(params.flags & CHG_FLAG_BAD_VOLTAGE);
- zassert_true(params.flags & CHG_FLAG_BAD_INPUT_CURRENT);
- zassert_true(params.flags & CHG_FLAG_BAD_STATUS);
- zassert_true(params.flags & CHG_FLAG_BAD_OPTION);
-}
-
-ZTEST(common_charger_mocked_driver,
- test_charger_get_input_current_limit__invalid)
-{
- zassert_equal(EC_ERROR_INVAL,
- charger_get_input_current_limit(-1, false));
- zassert_equal(EC_ERROR_INVAL,
- charger_get_input_current_limit(INT_MAX, false));
-}
-
-ZTEST(common_charger_mocked_driver,
- test_charger_get_input_current_limit__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_get_input_current_limit(CHG_NUM, false));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_input_current__invalid)
-{
- zassert_equal(EC_ERROR_INVAL, charger_get_input_current(-1, NULL));
- zassert_equal(EC_ERROR_INVAL, charger_get_input_current(INT_MAX, NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_input_current__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- charger_get_input_current(CHG_NUM, NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_manufacturer_id__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_manufacturer_id(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_manufacturer_id__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_manufacturer_id(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_device_id__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_device_id(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_device_id__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_device_id(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_option__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_get_option(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_option__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_get_option(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_set_option__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_set_option(0));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_set_option__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_set_option(0));
-}
-
-ZTEST(common_charger_mocked_driver, test_chg_ramp_is_stable__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_false(chg_ramp_is_stable());
-}
-
-ZTEST(common_charger_mocked_driver, test_chg_ramp_is_stable__unimpl)
-{
- /* Returns 0 if ramp_is_stable not implemented */
- zassert_false(chg_ramp_is_stable());
-}
-
-ZTEST(common_charger_mocked_driver, test_chg_ramp_is_detected__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_false(chg_ramp_is_detected());
-}
-
-ZTEST(common_charger_mocked_driver, test_chg_ramp_is_detected__unimpl)
-{
- /* Returns 0 if ramp_is_detected not implemented */
- zassert_false(chg_ramp_is_detected());
-}
-
-ZTEST(common_charger_mocked_driver, test_chg_ramp_get_current_limit__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_false(chg_ramp_get_current_limit());
-}
-
-ZTEST(common_charger_mocked_driver, test_chg_ramp_get_current_limit__unimpl)
-{
- /* Returns 0 if ramp_get_current_limit not implemented */
- zassert_false(chg_ramp_get_current_limit());
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_post_init__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_post_init());
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_post_init__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_post_init());
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_info__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_is_null(charger_get_info());
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_info__unimpl)
-{
- zassert_is_null(charger_get_info());
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_get_status__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_get_status(NULL));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_set_mode__invalid)
-{
- uint8_t zero = 0;
-
- fake_charger_count = &zero;
- zassert_equal(EC_ERROR_INVAL, charger_set_mode(0));
-}
-
-ZTEST(common_charger_mocked_driver, test_charger_set_mode__unimpl)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED, charger_set_mode(0));
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_set_vsys_compensation)
-{
- fixture->mock_driver.set_vsys_compensation = set_vsys_compensation;
- set_vsys_compensation_fake.return_val = 123;
-
- zassert_equal(123, charger_set_vsys_compensation(CHG_NUM, NULL, 0, 0));
-
- zassert_equal(1, set_vsys_compensation_fake.call_count);
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_is_icl_reached)
-{
- fixture->mock_driver.is_icl_reached = is_icl_reached;
- is_icl_reached_fake.return_val = 123;
-
- zassert_equal(123, charger_is_icl_reached(CHG_NUM, NULL));
-
- zassert_equal(1, is_icl_reached_fake.call_count);
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_enable_linear_charge)
-{
- fixture->mock_driver.enable_linear_charge = enable_linear_charge;
- enable_linear_charge_fake.return_val = 123;
-
- zassert_equal(123, charger_enable_linear_charge(CHG_NUM, 0));
-
- zassert_equal(1, enable_linear_charge_fake.call_count);
-}
-
-ZTEST_F(common_charger_mocked_driver, test_charger_get_battery_cells)
-{
- fixture->mock_driver.get_battery_cells = get_battery_cells;
- get_battery_cells_fake.return_val = 123;
-
- zassert_equal(123, charger_get_battery_cells(CHG_NUM, NULL));
-
- zassert_equal(1, get_battery_cells_fake.call_count);
-}
-
-static void *setup(void)
-{
- static struct common_charger_mocked_driver_fixture f;
-
- zassert_true(board_get_charger_chip_count() > 0,
- "Need at least one charger chip present.");
-
- /* Back up the current charger driver and substitute our own */
- f.saved_driver_ptr = chg_chips[CHG_NUM].drv;
- chg_chips[CHG_NUM].drv = &f.mock_driver;
-
- return &f;
-}
-
-static void reset(void *data)
-{
- struct common_charger_mocked_driver_fixture *f = data;
-
- /* Reset the mock driver's function pointer table. Each tests adds these
- * as-needed
- */
- f->mock_driver = (struct charger_drv){ 0 };
-
- /* Reset fakes */
- RESET_FAKE(enable_otg_power);
- RESET_FAKE(set_otg_current_voltage);
- RESET_FAKE(is_sourcing_otg_power);
- RESET_FAKE(get_actual_current);
- RESET_FAKE(get_actual_voltage);
- RESET_FAKE(set_voltage);
- RESET_FAKE(get_vsys_voltage);
- RESET_FAKE(enable_bypass_mode);
- RESET_FAKE(set_vsys_compensation);
- RESET_FAKE(is_icl_reached);
- RESET_FAKE(enable_linear_charge);
- RESET_FAKE(get_battery_cells);
-
- fake_charger_count = NULL;
-}
-
-static void teardown(void *data)
-{
- struct common_charger_mocked_driver_fixture *f = data;
-
- /* Restore the original driver */
- chg_chips[CHG_NUM].drv = f->saved_driver_ptr;
-}
-
-ZTEST_SUITE(common_charger_mocked_driver, drivers_predicate_post_main, setup,
- reset, reset, teardown);
diff --git a/zephyr/test/drivers/console/src/shell.c b/zephyr/test/drivers/console/src/shell.c
index c7a85b8f32..7345ed2da8 100644
--- a/zephyr/test/drivers/console/src/shell.c
+++ b/zephyr/test/drivers/console/src/shell.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "test/drivers/test_state.h"
-#include "uart.h"
-
#include <zephyr/device.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/shell/shell.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "uart.h"
+#include "test/drivers/test_state.h"
+
void uart_callback(const struct device *dev, void *user_data);
void bypass_cb(const struct shell *shell, uint8_t *data, size_t len);
diff --git a/zephyr/test/drivers/default/CMakeLists.txt b/zephyr/test/drivers/default/CMakeLists.txt
index 07688db4f2..d3c488e8dd 100644
--- a/zephyr/test/drivers/default/CMakeLists.txt
+++ b/zephyr/test/drivers/default/CMakeLists.txt
@@ -1,12 +1,12 @@
target_sources(app PRIVATE
src/battery.c
src/bb_retimer.c
+ src/bc12.c
src/bma2x2.c
src/bmi_common.c
src/bmi160.c
src/bmi260.c
src/charge_manager.c
- src/charge_state_prevent_power_on.c
src/console.c
src/console_cmd/adc.c
src/console_cmd/battery.c
@@ -36,13 +36,11 @@ target_sources(app PRIVATE
src/console_cmd/port80.c
src/console_cmd/powerindebug.c
src/console_cmd/power_button.c
- src/console_cmd/pwr_avg.c
src/console_cmd/rtc.c
src/console_cmd/rw.c
src/console_cmd/shared_mem.c
src/console_cmd/sleepmask.c
src/console_cmd/sleeptimeout.c
- src/console_cmd/switch.c
src/console_cmd/sysinfo.c
src/console_cmd/tcpci_dump.c
src/console_cmd/usb_pd_console.c
@@ -81,10 +79,8 @@ target_sources(app PRIVATE
src/smart.c
src/stm_mems_common.c
src/tablet_mode.c
- src/task.c
src/tcpci.c
src/tcpci_test_common.c
- src/tcpm_header.c
src/tcs3400.c
src/temp_sensor.c
src/thermistor.c
@@ -96,7 +92,3 @@ target_sources(app PRIVATE
src/vstore.c
src/watchdog.c
)
-
-# This test does not work when power functions are mocked, so only run it for
-# the plain `drivers.default` test case.
-zephyr_library_sources_ifndef(CONFIG_POWER_SEQUENCE_MOCK src/chipset.c)
diff --git a/zephyr/test/drivers/default/boards/native_posix.overlay b/zephyr/test/drivers/default/boards/native_posix.overlay
deleted file mode 100644
index a5e73e5653..0000000000
--- a/zephyr/test/drivers/default/boards/native_posix.overlay
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "../../boards/native_posix.overlay"
-
-/*
- * The TCPCI test verfies the mux behavior in two configurations:
- * flags = USB_MUX_FLAG_NOT_TCPC;
- * flags = 0;
- *
- * When USB_MUX_FLAG_NOT_TCPC is set, the TCPCI mux driver must initialize
- * the I2C bus and address from the devicetree.
- *
- * The TCPCI mux doesn't have it's owm emulator and sends it's I2C transactions
- * through the normal TCPCI driver, which then connects to the TCPCI emulator.
- *
- * Use 2 compaible strings here so that the same I2C device node gets setup for
- * both the emulator and the TPCI mux.
- */
-&tcpci_emul {
- compatible = "cros,tcpci-generic-emul", "cros-ec,usbc-mux-tcpci";
-};
-
-/ {
- usbc {
- port0@0 {
- usb-mux-chain-0 {
- usb-muxes = <&tcpci_emul &virtual_mux_c0>;
- };
- };
- };
-};
diff --git a/zephyr/test/drivers/default/prj.conf b/zephyr/test/drivers/default/prj.conf
index c544afd4e7..9c112a6ced 100644
--- a/zephyr/test/drivers/default/prj.conf
+++ b/zephyr/test/drivers/default/prj.conf
@@ -9,6 +9,5 @@ CONFIG_PLATFORM_EC_LED_DT=y
CONFIG_PLATFORM_EC_RTC=y
CONFIG_PLATFORM_EC_VOLUME_BUTTONS=y
CONFIG_PLATFORM_EC_CONSOLE_CHANNEL=y
-CONFIG_TASK_HOSTCMD_THREAD_MAIN=y
CONFIG_SYSTEM_FAKE=y
diff --git a/zephyr/test/drivers/default/src/battery.c b/zephyr/test/drivers/default/src/battery.c
index 02f85d9662..2e06725af5 100644
--- a/zephyr/test/drivers/default/src/battery.c
+++ b/zephyr/test/drivers/default/src/battery.c
@@ -3,78 +3,26 @@
* found in the LICENSE file.
*/
-#include "battery.h"
-#include "battery_fuel_gauge.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_smart_battery.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
-#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/fff.h>
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
+#include "battery.h"
+#include "test/drivers/test_state.h"
#define GPIO_BATT_PRES_ODL_PATH DT_PATH(named_gpios, ec_batt_pres_odl)
#define GPIO_BATT_PRES_ODL_PORT DT_GPIO_PIN(GPIO_BATT_PRES_ODL_PATH, gpios)
-FAKE_VALUE_FUNC(int, battery2_write_func, const struct emul *, int, uint8_t,
- int, void *);
-FAKE_VALUE_FUNC(int, battery2_read_func, const struct emul *, int, uint8_t *,
- int, void *);
-
-bool authenticate_battery_type(int index, const char *manuf_name);
-
-extern int battery_fuel_gauge_type_override;
-
-struct battery_fixture {
- struct i2c_common_emul_data *battery_i2c_common;
- i2c_common_emul_finish_write_func finish_write_func;
- i2c_common_emul_start_read_func start_read_func;
-};
-
-static void *battery_setup(void)
-{
- static struct battery_fixture fixture;
- static const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(battery));
-
- fixture.battery_i2c_common =
- emul_smart_battery_get_i2c_common_data(emul);
-
- return &fixture;
-}
-
-static void battery_before(void *data)
-{
- struct battery_fixture *fixture = data;
-
- RESET_FAKE(battery2_write_func);
- RESET_FAKE(battery2_read_func);
- fixture->finish_write_func = fixture->battery_i2c_common->finish_write;
- fixture->start_read_func = fixture->battery_i2c_common->start_read;
-}
-
static void battery_after(void *data)
{
- struct battery_fixture *fixture = data;
const struct device *dev =
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_BATT_PRES_ODL_PATH, gpios));
/* Set default state (battery is present) */
gpio_emul_input_set(dev, GPIO_BATT_PRES_ODL_PORT, 0);
- battery_fuel_gauge_type_override = -1;
-
- i2c_common_emul_set_write_func(fixture->battery_i2c_common, NULL, NULL);
- i2c_common_emul_set_read_func(fixture->battery_i2c_common, NULL, NULL);
- fixture->battery_i2c_common->finish_write = fixture->finish_write_func;
- fixture->battery_i2c_common->start_read = fixture->start_read_func;
}
-ZTEST_SUITE(battery, drivers_predicate_post_main, battery_setup, battery_before,
- battery_after, NULL);
-
ZTEST_USER(battery, test_battery_is_present_gpio)
{
const struct device *dev =
@@ -89,172 +37,5 @@ ZTEST_USER(battery, test_battery_is_present_gpio)
zassert_equal(BP_NO, battery_is_present());
}
-ZTEST(battery, test_authenticate_battery_type)
-{
- /* Invalid index */
- zassert_false(authenticate_battery_type(BATTERY_TYPE_COUNT, NULL));
- /* Use fuel-gauge 1's manufacturer name for index 0 */
- zassert_false(authenticate_battery_type(
- 0, board_battery_info[1].fuel_gauge.manuf_name));
- /* Use the correct manufacturer name, but wrong device name (because the
- * index is 1 and not 0)
- */
- zassert_false(authenticate_battery_type(
- 1, board_battery_info[1].fuel_gauge.manuf_name));
-}
-
-ZTEST(battery, test_board_get_default_battery_type)
-{
- zassert_equal(DEFAULT_BATTERY_TYPE, board_get_default_battery_type());
-}
-
-ZTEST_F(battery, test_board_cutoff_actuates_driver)
-{
- /* We check the return type because board_is_cut_off() is set outside of
- * board_cut_off_battery() and may be changed by other factors.
- */
-
- /* Try with invalid battery type */
- battery_fuel_gauge_type_override = BATTERY_TYPE_COUNT;
- zassert_equal(EC_RES_ERROR, board_cut_off_battery());
-
- /* Setup error conditions for battery 1*/
- battery_fuel_gauge_type_override = 1;
- fixture->battery_i2c_common->finish_write = NULL;
- i2c_common_emul_set_write_func(fixture->battery_i2c_common,
- battery2_write_func, NULL);
-
- /* Check that i2c error returns EC_RES_ERROR */
- battery2_write_func_fake.return_val = -1;
- zassert_equal(EC_RES_ERROR, board_cut_off_battery());
-
- /* Check for OK when i2c succeeds */
- battery2_write_func_fake.return_val = 0;
- zassert_ok(board_cut_off_battery());
-}
-
-ZTEST_F(battery, test_sleep)
-{
- /* Try with invalid battery type */
- battery_fuel_gauge_type_override = BATTERY_TYPE_COUNT;
- zassert_equal(EC_ERROR_UNKNOWN, battery_sleep_fuel_gauge());
-
- /* Check 1st battery (lgc,ac17a8m) */
- battery_fuel_gauge_type_override = 0;
- zassert_equal(EC_ERROR_UNIMPLEMENTED, battery_sleep_fuel_gauge());
-
- /* Check 2nd battery (panasonic,ap15l5j) */
- battery_fuel_gauge_type_override = 1;
- fixture->battery_i2c_common->finish_write = NULL;
- i2c_common_emul_set_write_func(fixture->battery_i2c_common,
- battery2_write_func, NULL);
- zassert_ok(battery_sleep_fuel_gauge());
-}
-
-struct battery2_read_data {
- size_t count;
- const uint8_t *values;
-};
-
-static int battery2_read(const struct emul *target, int reg, uint8_t *val,
- int bytes, void *d)
-{
- struct battery2_read_data *data = d;
-
- if (bytes < data->count) {
- *val = data->values[bytes];
- }
-
- return 0;
-}
-
-ZTEST(battery, test_is_charge_fet_disabled__invalid_battery_type)
-{
- battery_fuel_gauge_type_override = BATTERY_TYPE_COUNT;
- zassert_equal(-1, battery_is_charge_fet_disabled());
-}
-
-ZTEST(battery, test_is_charge_fet_disabled__cfet_mask_is_0)
-{
- battery_fuel_gauge_type_override = 2;
- zassert_equal(0, battery_is_charge_fet_disabled());
-}
-
-ZTEST_F(battery, test_is_charge_fet_disabled__i2c_error)
-{
- /* Set the battery to battery 1 */
- battery_fuel_gauge_type_override = 1;
-
- /* Override the finish_write common callback since we don't actually
- * want to be messing with the emulator.
- */
- fixture->battery_i2c_common->finish_write = NULL;
-
- /* Set up an error condition for battery 1 to fail writing to i2c */
- battery2_write_func_fake.return_val = -1;
- i2c_common_emul_set_write_func(fixture->battery_i2c_common,
- battery2_write_func, NULL);
-
- /* Verify the error */
- zassert_equal(-1, battery_is_charge_fet_disabled());
-}
-
-ZTEST_F(battery, test_is_charge_fet_disabled)
-{
- /* Custom data expected to be read from the battery */
- static const uint8_t values[] = { 0x20, 0x54, 0x00, 0x00,
- 0x00, 0x00, 0x00 };
- static struct battery2_read_data data = {
- .count = ARRAY_SIZE(values),
- .values = values,
- };
-
- /* Set up the fake read function */
- battery2_read_func_fake.custom_fake = battery2_read;
- i2c_common_emul_set_read_func(fixture->battery_i2c_common,
- battery2_read_func, &data);
-
- /* Override the finish_write and start_read common callback since we
- * don't actually want to be messing with the emulator.
- */
- fixture->battery_i2c_common->finish_write = NULL;
- fixture->battery_i2c_common->start_read = NULL;
-
- zassert_equal(1, battery_is_charge_fet_disabled());
-}
-
-ZTEST(battery, test_get_disconnect_state__invalid_battery_type)
-{
- battery_fuel_gauge_type_override = BATTERY_TYPE_COUNT;
- zassert_equal(BATTERY_DISCONNECT_ERROR, battery_get_disconnect_state());
-}
-
-ZTEST_F(battery, test_get_disconnect_state__fail_i2c_read)
-{
- /* Use battery 0 */
- battery_fuel_gauge_type_override = 0;
-
- /* Configure i2c to fail on read */
- battery2_read_func_fake.return_val = -1;
- i2c_common_emul_set_read_func(fixture->battery_i2c_common,
- battery2_read_func, NULL);
-
- /* Check for disconnect error */
- zassert_equal(BATTERY_DISCONNECT_ERROR, battery_get_disconnect_state());
-}
-
-ZTEST_F(battery, test_get_disconnect_state)
-{
- static const uint8_t values[] = { 0x00, 0x20 };
- static struct battery2_read_data data = {
- .count = ARRAY_SIZE(values),
- .values = values,
- };
-
- /* Enable i2c reads and set them to always return 0x2000 */
- battery2_read_func_fake.custom_fake = battery2_read;
- i2c_common_emul_set_read_func(fixture->battery_i2c_common,
- battery2_read_func, &data);
-
- zassert_equal(BATTERY_DISCONNECTED, battery_get_disconnect_state());
-}
+ZTEST_SUITE(battery, drivers_predicate_post_main, NULL, NULL, battery_after,
+ NULL);
diff --git a/zephyr/test/drivers/default/src/bb_retimer.c b/zephyr/test/drivers/default/src/bb_retimer.c
index 78d483817a..1b1ec4bbbc 100644
--- a/zephyr/test/drivers/default/src/bb_retimer.c
+++ b/zephyr/test/drivers/default/src/bb_retimer.c
@@ -3,24 +3,25 @@
* found in the LICENSE file.
*/
-#include "chipset.h"
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "common.h"
-#include "driver/retimer/bb_retimer.h"
#include "ec_tasks.h"
#include "emul/emul_bb_retimer.h"
#include "emul/emul_common_i2c.h"
#include "hooks.h"
#include "i2c.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
#include "usb_prl_sm.h"
#include "usb_tc_sm.h"
+#include "chipset.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "driver/retimer/bb_retimer.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
#define GPIO_USB_C1_LS_EN_PATH DT_PATH(named_gpios, usb_c1_ls_en)
#define GPIO_USB_C1_LS_EN_PORT DT_GPIO_PIN(GPIO_USB_C1_LS_EN_PATH, gpios)
@@ -65,7 +66,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state)
/* Set UFP role for whole test */
tc_set_data_role(USBC_PORT_C1, PD_ROLE_UFP);
- zassert_equal(PD_ROLE_UFP, pd_get_data_role(USBC_PORT_C1));
+ zassume_equal(PD_ROLE_UFP, pd_get_data_role(USBC_PORT_C1));
/* Test none mode */
bb_emul_set_reg(emul, BB_RETIMER_REG_CONNECTION_STATE, 0x12144678);
@@ -161,8 +162,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state)
zassert_false(ack_required, "ACK is never required for BB retimer");
conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE);
exp_conn = BB_RETIMER_USB_DATA_ROLE |
- BB_RETIMER_DATA_CONNECTION_PRESENT |
- BB_RETIMER_DP_CONNECTION;
+ BB_RETIMER_DATA_CONNECTION_PRESENT;
zassert_equal(exp_conn, conn, "Expected state 0x%lx, got 0x%lx",
exp_conn, conn);
@@ -175,8 +175,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state)
zassert_false(ack_required, "ACK is never required for BB retimer");
conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE);
exp_conn = BB_RETIMER_USB_DATA_ROLE |
- BB_RETIMER_DATA_CONNECTION_PRESENT |
- BB_RETIMER_DP_CONNECTION | BB_RETIMER_IRQ_HPD;
+ BB_RETIMER_DATA_CONNECTION_PRESENT | BB_RETIMER_IRQ_HPD;
zassert_equal(exp_conn, conn, "Expected state 0x%lx, got 0x%lx",
exp_conn, conn);
@@ -189,8 +188,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_state)
zassert_false(ack_required, "ACK is never required for BB retimer");
conn = bb_emul_get_reg(emul, BB_RETIMER_REG_CONNECTION_STATE);
exp_conn = BB_RETIMER_USB_DATA_ROLE |
- BB_RETIMER_DATA_CONNECTION_PRESENT |
- BB_RETIMER_DP_CONNECTION | BB_RETIMER_HPD_LVL;
+ BB_RETIMER_DATA_CONNECTION_PRESENT | BB_RETIMER_HPD_LVL;
zassert_equal(exp_conn, conn, "Expected state 0x%lx, got 0x%lx",
exp_conn, conn);
}
@@ -253,7 +251,7 @@ ZTEST_USER(bb_retimer_no_tasks, test_bb_set_dfp_state)
set_test_runner_tid();
tc_set_data_role(USBC_PORT_C1, PD_ROLE_DFP);
- zassert_equal(PD_ROLE_DFP, pd_get_data_role(USBC_PORT_C1));
+ zassume_equal(PD_ROLE_DFP, pd_get_data_role(USBC_PORT_C1));
/* Test PD mux none mode with DFP should clear all bits in state */
bb_emul_set_reg(emul, BB_RETIMER_REG_CONNECTION_STATE, 0x12144678);
diff --git a/zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201.c b/zephyr/test/drivers/default/src/bc12.c
index 0f9e7cbbeb..db1819ec4c 100644
--- a/zephyr/test/drivers/bc12_pi3usb9201/src/pi3usb9201.c
+++ b/zephyr/test/drivers/default/src/bc12.c
@@ -3,23 +3,25 @@
* found in the LICENSE file.
*/
-#include "battery.h"
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "emul/emul_pi3usb9201.h"
+
+#include "timer.h"
+#include "usb_charge.h"
+#include "battery.h"
#include "extpower.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include "timer.h"
-#include "usb_charge.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
LOG_MODULE_REGISTER(test_drivers_bc12, LOG_LEVEL_DBG);
-#define EMUL_NODE DT_NODELABEL(pi3usb9201_emul0)
+#define EMUL_NODE DT_NODELABEL(pi3usb9201_emul)
/* Control_1 register bit definitions */
#define PI3USB9201_REG_CTRL_1_INT_MASK BIT(0)
@@ -73,9 +75,7 @@ static const struct bc12_status bc12_chg_limits[] = {
[CHG_1_0A] = { .supplier = CHARGE_SUPPLIER_PROPRIETARY,
.current_limit = 1000 },
[CHG_RESERVED] = { .supplier = CHARGE_SUPPLIER_NONE,
- /* Not charging, limit is set to default */
- .current_limit =
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT },
+ .current_limit = 0 },
[CHG_CDP] = { .supplier = CHARGE_SUPPLIER_BC12_CDP,
.current_limit = USB_CHARGER_MAX_CURR_MA },
[CHG_SDP] = { .supplier = CHARGE_SUPPLIER_BC12_SDP,
@@ -211,8 +211,7 @@ test_bc12_pi3usb9201_client_mode(enum pi3usb9201_client_sts detect_result,
NULL);
zassert_equal(charge_manager_get_supplier(), CHARGE_SUPPLIER_NONE,
NULL);
- zassert_equal(charge_manager_get_charger_current(),
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT);
+ zassert_equal(charge_manager_get_charger_current(), 0);
zassert_equal(charge_manager_get_charger_voltage(), 0);
}
@@ -261,7 +260,6 @@ ZTEST_USER(bc12, test_bc12_pi3usb9201)
test_bc12_pi3usb9201_host_mode();
for (int c = CHG_OTHER; c <= CHG_DCP; c++) {
- LOG_INF("Test client mode supplier %d", c);
test_bc12_pi3usb9201_client_mode(
c, bc12_chg_limits[c].supplier,
bc12_chg_limits[c].current_limit);
diff --git a/zephyr/test/drivers/default/src/bma2x2.c b/zephyr/test/drivers/default/src/bma2x2.c
index b66fc9d056..ce6665790d 100644
--- a/zephyr/test/drivers/default/src/bma2x2.c
+++ b/zephyr/test/drivers/default/src/bma2x2.c
@@ -3,18 +3,19 @@
* found in the LICENSE file.
*/
-#include "accelgyro.h"
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
-#include "driver/accel_bma2x2.h"
+#include "i2c.h"
#include "emul/emul_bma255.h"
#include "emul/emul_common_i2c.h"
-#include "i2c.h"
+
+#include "accelgyro.h"
#include "motion_sense.h"
+#include "driver/accel_bma2x2.h"
#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
/** How accurate comparision of vectors should be. */
#define V_EPS 8
diff --git a/zephyr/test/drivers/default/src/bmi160.c b/zephyr/test/drivers/default/src/bmi160.c
index 257040b6dd..01957672f7 100644
--- a/zephyr/test/drivers/default/src/bmi160.c
+++ b/zephyr/test/drivers/default/src/bmi160.c
@@ -3,18 +3,19 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
-#include "driver/accelgyro_bmi160.h"
-#include "driver/accelgyro_bmi_common.h"
+#include "i2c.h"
#include "emul/emul_bmi.h"
#include "emul/emul_common_i2c.h"
-#include "i2c.h"
-#include "motion_sense_fifo.h"
#include "test/drivers/test_mocks.h"
-#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "motion_sense_fifo.h"
+#include "driver/accelgyro_bmi160.h"
+#include "driver/accelgyro_bmi_common.h"
+#include "test/drivers/test_state.h"
#define BMI_NODE DT_NODELABEL(accel_bmi160)
#define BMI_ACC_SENSOR_ID SENSOR_ID(DT_NODELABEL(ms_bmi160_accel))
@@ -2138,9 +2139,9 @@ static void bmi160_before(void *fixture)
gyr_ms->rot_standard_ref = NULL;
acc_ms->rot_standard_ref = NULL;
- zassert_equal(EC_SUCCESS, acc_ms->drv->set_data_rate(acc_ms, 50000, 0),
+ zassume_equal(EC_SUCCESS, acc_ms->drv->set_data_rate(acc_ms, 50000, 0),
NULL);
- zassert_equal(EC_SUCCESS, gyr_ms->drv->set_data_rate(gyr_ms, 50000, 0),
+ zassume_equal(EC_SUCCESS, gyr_ms->drv->set_data_rate(gyr_ms, 50000, 0),
NULL);
}
diff --git a/zephyr/test/drivers/default/src/bmi260.c b/zephyr/test/drivers/default/src/bmi260.c
index 1bc45b3883..5e44d1c499 100644
--- a/zephyr/test/drivers/default/src/bmi260.c
+++ b/zephyr/test/drivers/default/src/bmi260.c
@@ -3,20 +3,21 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
-#include "driver/accelgyro_bmi260.h"
-#include "driver/accelgyro_bmi_common.h"
+#include "i2c.h"
#include "emul/emul_bmi.h"
#include "emul/emul_common_i2c.h"
-#include "i2c.h"
+
#include "motion_sense_fifo.h"
+#include "driver/accelgyro_bmi260.h"
+#include "driver/accelgyro_bmi_common.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
#define BMI_NODE DT_NODELABEL(accel_bmi260)
#define BMI_ACC_SENSOR_ID SENSOR_ID(DT_NODELABEL(ms_bmi260_accel))
#define BMI_GYR_SENSOR_ID SENSOR_ID(DT_NODELABEL(ms_bmi260_gyro))
diff --git a/zephyr/test/drivers/default/src/bmi_common.c b/zephyr/test/drivers/default/src/bmi_common.c
index bdd3999d65..302c59d27e 100644
--- a/zephyr/test/drivers/default/src/bmi_common.c
+++ b/zephyr/test/drivers/default/src/bmi_common.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
#include "accelgyro_bmi_common.h"
+#include "i2c.h"
#include "emul/emul_bmi.h"
#include "emul/emul_common_i2c.h"
-#include "i2c.h"
#include "test/drivers/test_state.h"
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
#define BMI_NODE DT_NODELABEL(accel_bmi160)
#define BMI_ACC_SENSOR_ID SENSOR_ID(DT_NODELABEL(ms_bmi160_accel))
diff --git a/zephyr/test/drivers/default/src/charge_manager.c b/zephyr/test/drivers/default/src/charge_manager.c
index d5affff95e..2729816a76 100644
--- a/zephyr/test/drivers/default/src/charge_manager.c
+++ b/zephyr/test/drivers/default/src/charge_manager.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "charge_manager.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(charge_manager, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
diff --git a/zephyr/test/drivers/default/src/charge_state_prevent_power_on.c b/zephyr/test/drivers/default/src/charge_state_prevent_power_on.c
deleted file mode 100644
index ce47ff8042..0000000000
--- a/zephyr/test/drivers/default/src/charge_state_prevent_power_on.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "charge_state.h"
-#include "charge_state_v2.h"
-#include "test/drivers/test_state.h"
-
-#include <zephyr/ztest.h>
-
-/* Test external variable defined in charge_state_v2 */
-extern int charge_prevent_power_on_automatic_power_on;
-
-struct charge_state_prevent_power_on_fixture {
- struct charge_state_data charge_state_backup;
- int automatic_power_on;
-};
-
-static void *setup(void)
-{
- static struct charge_state_prevent_power_on_fixture fixture;
-
- return &fixture;
-}
-
-static void before(void *f)
-{
- struct charge_state_prevent_power_on_fixture *fixture = f;
-
- /* Backup the current state */
- fixture->charge_state_backup = *charge_get_status();
- fixture->automatic_power_on =
- charge_prevent_power_on_automatic_power_on;
-
- /* Reset the automatic_power_on global */
- charge_prevent_power_on_automatic_power_on = 1;
-}
-
-static void after(void *f)
-{
- struct charge_state_prevent_power_on_fixture *fixture = f;
-
- /* Restore the state from 'before' */
- *charge_get_status() = fixture->charge_state_backup;
- charge_prevent_power_on_automatic_power_on =
- fixture->automatic_power_on;
-}
-
-ZTEST_SUITE(charge_state_prevent_power_on, drivers_predicate_post_main, setup,
- before, after, NULL);
-
-ZTEST(charge_state_prevent_power_on, test_allow_power_on)
-{
- struct batt_params *params = &charge_get_status()->batt;
-
- /* Force a call to refresh the battery parameters */
- params->is_present = BP_NOT_SURE;
- /* Set the charge state to be high enough */
- params->state_of_charge =
- CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON;
-
- /* Verify that we can power on when the power button was pressed */
- zassert_false(charge_prevent_power_on(true));
-}
-
-ZTEST(charge_state_prevent_power_on, test_low_charge)
-{
- struct batt_params *params = &charge_get_status()->batt;
-
- /* Force a low charge state */
- params->state_of_charge =
- CONFIG_PLATFORM_EC_CHARGER_MIN_BAT_PCT_FOR_POWER_ON - 1;
-
- /* Verify that we cannot power on during an automatic power-on */
- zassert_true(charge_prevent_power_on(false));
-}
-
-ZTEST(charge_state_prevent_power_on, test_consuming_full_input_current)
-{
- struct batt_params *params = &charge_get_status()->batt;
-
- params->state_of_charge = 50;
- zassert_true(charge_is_consuming_full_input_current());
-
- params->state_of_charge = 0;
- zassert_false(charge_is_consuming_full_input_current());
-
- params->state_of_charge = 100;
- zassert_false(charge_is_consuming_full_input_current());
-}
diff --git a/zephyr/test/drivers/default/src/chipset.c b/zephyr/test/drivers/default/src/chipset.c
deleted file mode 100644
index 89ba761c23..0000000000
--- a/zephyr/test/drivers/default/src/chipset.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "chipset.h"
-#include "console.h"
-#include "test/drivers/test_state.h"
-
-#include <stdint.h>
-
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
-#include <ap_power/ap_power.h>
-#include <ap_power/ap_power_events.h>
-
-ZTEST(chipset, test_get_ap_reset_stats__bad_pointers)
-{
- zassert_equal(EC_ERROR_INVAL, get_ap_reset_stats(NULL, 0, NULL));
-}
-
-ZTEST(chipset, test_get_ap_reset_stats__happy_path)
-{
- struct ap_reset_log_entry reset_log_entries[4];
- uint32_t actual_reset_count, reset_count;
-
- memset(reset_log_entries, 0, sizeof(reset_log_entries));
-
- /* Report two AP resets */
- report_ap_reset(CHIPSET_RESET_AP_WATCHDOG);
- report_ap_reset(CHIPSET_RESET_HANG_REBOOT);
-
- zassert_equal(EC_SUCCESS,
- get_ap_reset_stats(reset_log_entries,
- ARRAY_SIZE(reset_log_entries),
- &reset_count));
-
- /* Check the reset causes. The reset entry log is not a FIFO, so we get
- * the last two empty slots followed by the two we triggered above.
- */
- zassert_equal(0, reset_log_entries[0].reset_cause);
- zassert_equal(0, reset_log_entries[1].reset_cause);
- zassert_equal(CHIPSET_RESET_AP_WATCHDOG,
- reset_log_entries[2].reset_cause);
- zassert_equal(CHIPSET_RESET_HANG_REBOOT,
- reset_log_entries[3].reset_cause);
-
- /* Check reset count */
- actual_reset_count = test_chipset_get_ap_resets_since_ec_boot();
- zassert_equal(actual_reset_count, reset_count,
- "Found %d resets, expected %d", reset_count,
- actual_reset_count);
-}
-
-ZTEST(chipset, test_console_cmd_apreset)
-{
- struct ap_reset_log_entry reset_log_entries[4];
- uint32_t reset_count;
-
- zassert_ok(shell_execute_cmd(get_ec_shell(), "apreset"));
-
- /* Make sure an AP reset happened. The expected reset log entry is at
- * index 3 because we read out 3 empty slots first.
- */
- zassert_ok(get_ap_reset_stats(reset_log_entries,
- ARRAY_SIZE(reset_log_entries),
- &reset_count));
-
- zassert_equal(CHIPSET_RESET_CONSOLE_CMD,
- reset_log_entries[3].reset_cause);
-}
-
-ZTEST(chipset, test_console_cmd_apshutdown)
-{
- struct ap_reset_log_entry reset_log_entries[4];
- uint32_t reset_count;
-
- zassert_ok(shell_execute_cmd(get_ec_shell(), "apshutdown"));
-
- /* Make sure an AP reset happened. The expected reset log entry is at
- * index 3 because we read out 3 empty slots first.
- */
- zassert_ok(get_ap_reset_stats(reset_log_entries,
- ARRAY_SIZE(reset_log_entries),
- &reset_count));
-
- zassert_equal(CHIPSET_SHUTDOWN_CONSOLE_CMD,
- reset_log_entries[3].reset_cause);
-}
-
-static void reset(void *arg)
-{
- ARG_UNUSED(arg);
-
- test_chipset_corrupt_reset_log_checksum();
- init_reset_log();
-}
-
-ZTEST_SUITE(chipset, drivers_predicate_post_main, NULL, reset, reset, NULL);
diff --git a/zephyr/test/drivers/default/src/console.c b/zephyr/test/drivers/default/src/console.c
index c5148baf76..9e6c55c198 100644
--- a/zephyr/test/drivers/default/src/console.c
+++ b/zephyr/test/drivers/default/src/console.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/shell/shell_dummy.h>
+
#include "builtin/stdio.h"
-#include "console.h"
-#include "ec_commands.h"
#include "test/drivers/test_state.h"
+#include "console.h"
#include "uart.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
+#include "ec_commands.h"
ZTEST_USER(console, test_printf_overflow)
{
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelinfo.c b/zephyr/test/drivers/default/src/console_cmd/accelinfo.c
index aac63c01b7..39556fab43 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelinfo.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelinfo.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "config.h"
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "timer.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static void console_cmd_accelinfo_after(void *fixture)
{
ARG_UNUSED(fixture);
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelinit.c b/zephyr/test/drivers/default/src/console_cmd/accelinit.c
index 2633c05f58..e722409298 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelinit.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelinit.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "accelgyro.h"
#include "console.h"
#include "motion_sense.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, mock_init, struct motion_sensor_t *);
struct console_cmd_accelinit_fixture {
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelrange.c b/zephyr/test/drivers/default/src/console_cmd/accelrange.c
index 04ec7e6004..57e81eada4 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelrange.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelrange.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/devicetree.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "driver/accel_bma2x2.h"
#include "ec_commands.h"
@@ -12,10 +16,6 @@
#include "motion_sense.h"
#include "test/drivers/test_state.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
#define EMUL_NODE DT_NODELABEL(bma_emul)
#define BMA_ORD DT_DEP_ORD(EMUL_LABEL)
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelrate.c b/zephyr/test/drivers/default/src/console_cmd/accelrate.c
index 3a5b2cd9bf..ca5bcf338a 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelrate.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelrate.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "motion_sense.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static int original_sensor_0_s0_config_odr;
static void *console_cmd_accelrate_setup(void)
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelread.c b/zephyr/test/drivers/default/src/console_cmd/accelread.c
index e622faf58f..4a129badc1 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelread.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelread.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "accelgyro.h"
#include "console.h"
#include "ec_commands.h"
@@ -10,10 +14,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, mock_read, const struct motion_sensor_t *, int *);
FAKE_VALUE_FUNC(int, mock_set_data_rate, const struct motion_sensor_t *, int,
int);
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelres.c b/zephyr/test/drivers/default/src/console_cmd/accelres.c
index 21c0075b0f..38bd4ed697 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelres.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelres.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "accelgyro.h"
#include "console.h"
#include "driver/accel_bma2x2.h"
@@ -10,10 +14,6 @@
#include "motion_sense.h"
#include "test/drivers/test_state.h"
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, set_resolution, const struct motion_sensor_t *, int, int);
struct console_cmd_accelres_fixture {
diff --git a/zephyr/test/drivers/default/src/console_cmd/accelspoof.c b/zephyr/test/drivers/default/src/console_cmd/accelspoof.c
index fe11525531..50f8c1e650 100644
--- a/zephyr/test/drivers/default/src/console_cmd/accelspoof.c
+++ b/zephyr/test/drivers/default/src/console_cmd/accelspoof.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "motion_sense.h"
#include "test/drivers/test_state.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static void console_cmd_accelspoof_after(void *fixture)
{
ARG_UNUSED(fixture);
diff --git a/zephyr/test/drivers/default/src/console_cmd/adc.c b/zephyr/test/drivers/default/src/console_cmd/adc.c
index b366db36f6..85dfda939a 100644
--- a/zephyr/test/drivers/default/src/console_cmd/adc.c
+++ b/zephyr/test/drivers/default/src/console_cmd/adc.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
/* Default adc command, lists out channels */
ZTEST_USER(console_cmd_adc, test_adc_noname)
{
diff --git a/zephyr/test/drivers/default/src/console_cmd/battery.c b/zephyr/test/drivers/default/src/console_cmd/battery.c
index f5fa78d684..9c3e21fcf1 100644
--- a/zephyr/test/drivers/default/src/console_cmd/battery.c
+++ b/zephyr/test/drivers/default/src/console_cmd/battery.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/emul.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "battery_smart.h"
#include "console.h"
#include "ec_commands.h"
@@ -11,10 +15,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
struct console_cmd_battery_fixture {
const struct emul *emul;
struct i2c_common_emul_data *i2c_emul;
diff --git a/zephyr/test/drivers/default/src/console_cmd/button.c b/zephyr/test/drivers/default/src/console_cmd/button.c
index 0df137e90b..9272b2ce2d 100644
--- a/zephyr/test/drivers/default/src/console_cmd/button.c
+++ b/zephyr/test/drivers/default/src/console_cmd/button.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_button, test_button_no_arg)
{
int rv;
diff --git a/zephyr/test/drivers/default/src/console_cmd/cbi.c b/zephyr/test/drivers/default/src/console_cmd/cbi.c
index 297431657e..495ffd7e4c 100644
--- a/zephyr/test/drivers/default/src/console_cmd/cbi.c
+++ b/zephyr/test/drivers/default/src/console_cmd/cbi.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/shell/shell.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "test/drivers/test_state.h"
+
static void set_wp(bool value)
{
const struct gpio_dt_spec *wp = GPIO_DT_FROM_NODELABEL(gpio_wp_l);
diff --git a/zephyr/test/drivers/default/src/console_cmd/charge_manager.c b/zephyr/test/drivers/default/src/console_cmd/charge_manager.c
index 698db8b316..a4679ddd25 100644
--- a/zephyr/test/drivers/default/src/console_cmd/charge_manager.c
+++ b/zephyr/test/drivers/default/src/console_cmd/charge_manager.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "charge_manager.h"
#include "console.h"
#include "emul/emul_isl923x.h"
@@ -12,9 +15,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
struct console_cmd_charge_manager_fixture {
struct tcpci_partner_data sink_5v_3a;
struct tcpci_snk_emul_data sink_ext;
@@ -111,7 +111,7 @@ ZTEST_USER(console_cmd_charge_manager, test_chgoverride_invalid_port)
{
char cmd[256];
- zassert_true(sprintf(cmd, "chgoverride %d", CHARGE_PORT_COUNT) > 0,
+ zassume_true(sprintf(cmd, "chgoverride %d", CHARGE_PORT_COUNT) > 0,
NULL);
zassert_equal(shell_execute_cmd(get_ec_shell(), cmd), EC_ERROR_PARAM1,
NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/charge_state.c b/zephyr/test/drivers/default/src/console_cmd/charge_state.c
index 8cfd11324f..7ee91049ae 100644
--- a/zephyr/test/drivers/default/src/console_cmd/charge_state.c
+++ b/zephyr/test/drivers/default/src/console_cmd/charge_state.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "charge_state.h"
#include "charge_state_v2.h"
#include "console.h"
@@ -10,9 +13,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_charge_state, test_idle_too_few_args)
{
int rv;
@@ -116,7 +116,7 @@ ZTEST_USER(console_cmd_charge_state, test_debug_on_show_charging_progress)
charging_progress_displayed();
/* Enable debug printing */
- zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate debug on"),
+ zassume_ok(shell_execute_cmd(get_ec_shell(), "chgstate debug on"),
NULL);
/* Sleep at least 1 full iteration of the charge state loop */
@@ -159,16 +159,6 @@ ZTEST_USER(console_cmd_charge_state, test_sustain_invalid_params)
zassert_equal(shell_execute_cmd(get_ec_shell(),
"chgstate sustain 50 101"),
EC_ERROR_INVAL, NULL);
-
- /* Verify invalid lower bound (not a number) */
- zassert_equal(shell_execute_cmd(get_ec_shell(),
- "chgstate sustain a 50"),
- EC_ERROR_PARAM2);
-
- /* Verify invalid uppoer bound (not a number) */
- zassert_equal(shell_execute_cmd(get_ec_shell(),
- "chgstate sustain 30 a"),
- EC_ERROR_PARAM3);
}
struct console_cmd_charge_state_fixture {
@@ -216,7 +206,7 @@ ZTEST_USER_F(console_cmd_charge_state, test_idle_on_from_normal)
fixture->tcpci_emul, fixture->charger_emul);
/* Verify that we're in "normal" mode */
- zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
+ zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
/* Move to idle */
zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle on"));
@@ -230,11 +220,11 @@ ZTEST_USER_F(console_cmd_charge_state, test_normal_from_idle)
fixture->tcpci_emul, fixture->charger_emul);
/* Verify that we're in "normal" mode */
- zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
+ zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
/* Move to idle */
- zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle on"));
- zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_IDLE);
+ zassume_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle on"));
+ zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_IDLE);
/* Move back to normal */
zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate idle off"),
@@ -249,7 +239,7 @@ ZTEST_USER_F(console_cmd_charge_state, test_discharge_on)
fixture->tcpci_emul, fixture->charger_emul);
/* Verify that we're in "normal" mode */
- zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
+ zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
/* Enable discharge */
zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge on"),
@@ -264,12 +254,12 @@ ZTEST_USER_F(console_cmd_charge_state, test_discharge_off)
fixture->tcpci_emul, fixture->charger_emul);
/* Verify that we're in "normal" mode */
- zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
+ zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_NORMAL);
/* Enable discharge */
- zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge on"),
+ zassume_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge on"),
NULL);
- zassert_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_DISCHARGE);
+ zassume_equal(get_chg_ctrl_mode(), CHARGE_CONTROL_DISCHARGE);
/* Disable discharge */
zassert_ok(shell_execute_cmd(get_ec_shell(), "chgstate discharge off"),
diff --git a/zephyr/test/drivers/default/src/console_cmd/chargen.c b/zephyr/test/drivers/default/src/console_cmd/chargen.c
index 473ad78abb..649a1b0b1f 100644
--- a/zephyr/test/drivers/default/src/console_cmd/chargen.c
+++ b/zephyr/test/drivers/default/src/console_cmd/chargen.c
@@ -3,18 +3,17 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "system.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include "uart.h"
-
-#include <stdio.h>
-
#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/uart/serial_test.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
+#include <stdio.h>
+#include <zephyr/drivers/uart/serial_test.h>
+
+#include "console.h"
+#include "uart.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "system.h"
const char expected_output[] =
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
diff --git a/zephyr/test/drivers/default/src/console_cmd/charger.c b/zephyr/test/drivers/default/src/console_cmd/charger.c
index 420ef67fe4..9adda29a8d 100644
--- a/zephyr/test/drivers/default/src/console_cmd/charger.c
+++ b/zephyr/test/drivers/default/src/console_cmd/charger.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "dptf.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
/* Tests which need no fixture */
ZTEST_USER(console_cmd_charger, test_default_dump)
{
@@ -81,7 +81,7 @@ ZTEST_USER(console_cmd_charger, test_good_input_current)
zassert_ok(shell_execute_cmd(get_ec_shell(), "charger input 1000"),
"Failed to set input current");
- zassert_ok(charger_get_input_current_limit(0, &input_current),
+ zassume_ok(charger_get_input_current_limit(0, &input_current),
"Failed to get input current");
zassert_equal(input_current, 1000,
"Input current not set in charger: %d", input_current);
@@ -117,7 +117,7 @@ static void *console_cmd_charger_setup(void)
static struct console_cmd_charger_fixture fixture;
/* Assume we have one charger at index 0 */
- zassert_true(board_get_charger_chip_count() > 0,
+ zassume_true(board_get_charger_chip_count() > 0,
"Insufficient chargers found");
/* Get references for the emulators */
@@ -158,7 +158,7 @@ ZTEST_USER_F(console_cmd_charger, test_good_current)
/* Give the charger task time to pick up the manual current */
k_sleep(K_SECONDS(1));
- zassert_ok(charger_get_current(0, &current), "Failed to get current");
+ zassume_ok(charger_get_current(0, &current), "Failed to get current");
zassert_equal(current, 1000, "Current not set in charger: %d", current);
}
@@ -176,7 +176,7 @@ ZTEST_USER_F(console_cmd_charger, test_good_voltage)
/* Give the charger task time to pick up the manual voltage */
k_sleep(K_SECONDS(1));
- zassert_ok(charger_get_voltage(0, &voltage), "Failed to get voltage");
+ zassume_ok(charger_get_voltage(0, &voltage), "Failed to get voltage");
zassert_equal(voltage, 3000, "Voltage not set in charger: %d", voltage);
}
diff --git a/zephyr/test/drivers/default/src/console_cmd/crash.c b/zephyr/test/drivers/default/src/console_cmd/crash.c
index 4218aa74d6..bc0b5d0254 100644
--- a/zephyr/test/drivers/default/src/console_cmd/crash.c
+++ b/zephyr/test/drivers/default/src/console_cmd/crash.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "builtin/assert.h"
#include "console.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(console_cmd_crash, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/cutoff.c b/zephyr/test/drivers/default/src/console_cmd/cutoff.c
index 2b5a9c67d2..00ce40660f 100644
--- a/zephyr/test/drivers/default/src/console_cmd/cutoff.c
+++ b/zephyr/test/drivers/default/src/console_cmd/cutoff.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "console.h"
#include "ec_commands.h"
@@ -10,9 +13,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static void console_cmd_cutoff_after(void *unused)
{
ARG_UNUSED(unused);
@@ -58,7 +58,7 @@ ZTEST_USER(console_cmd_cutoff, test_clear_pending_shutdown)
{
int rv = shell_execute_cmd(get_ec_shell(), "cutoff at-shutdown");
- zassert_true(extpower_is_present(), NULL);
+ zassume_true(extpower_is_present(), NULL);
zassert_equal(EC_RES_SUCCESS, rv, "Expected %d, but got %d",
EC_RES_SUCCESS, rv);
diff --git a/zephyr/test/drivers/default/src/console_cmd/ec_features.c b/zephyr/test/drivers/default/src/console_cmd/ec_features.c
index 48e6eec819..b33ca565bc 100644
--- a/zephyr/test/drivers/default/src/console_cmd/ec_features.c
+++ b/zephyr/test/drivers/default/src/console_cmd/ec_features.c
@@ -3,27 +3,23 @@
* found in the LICENSE file.
*/
-#include "builtin/stdio.h"
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(console_cmd_ec_features, drivers_predicate_post_main, NULL, NULL,
NULL, NULL);
ZTEST_USER(console_cmd_ec_features, test_feat)
{
- char expected[50];
- int ret;
+ char expected[32];
- ret = snprintf(expected, sizeof(expected),
- " 0-31: 0x%08x\r\n32-63: 0x%08x", get_feature_flags0(),
- get_feature_flags1());
- zassert_true(ret >= 0 && ret < sizeof(expected));
+ snprintf(expected, sizeof(expected), " 0-31: 0x%08x\r\n32-63: 0x%08x",
+ get_feature_flags0(), get_feature_flags1());
CHECK_CONSOLE_CMD("feat", expected, EC_SUCCESS);
}
diff --git a/zephyr/test/drivers/default/src/console_cmd/gpio.c b/zephyr/test/drivers/default/src/console_cmd/gpio.c
index c4b83b8ab4..164f272e27 100644
--- a/zephyr/test/drivers/default/src/console_cmd/gpio.c
+++ b/zephyr/test/drivers/default/src/console_cmd/gpio.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_gpio, test_read_invoke_success)
{
zassert_ok(shell_execute_cmd(get_ec_shell(), "gpioget test"), NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/hcdebug.c b/zephyr/test/drivers/default/src/console_cmd/hcdebug.c
index 68dc6c72be..71adb02690 100644
--- a/zephyr/test/drivers/default/src/console_cmd/hcdebug.c
+++ b/zephyr/test/drivers/default/src/console_cmd/hcdebug.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static void console_cmd_hcdebug_after(void *fixture)
{
ARG_UNUSED(fixture);
diff --git a/zephyr/test/drivers/default/src/console_cmd/hibdelay.c b/zephyr/test/drivers/default/src/console_cmd/hibdelay.c
index 8275ece94d..c72a2bf66a 100644
--- a/zephyr/test/drivers/default/src/console_cmd/hibdelay.c
+++ b/zephyr/test/drivers/default/src/console_cmd/hibdelay.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(console_cmd_hibdelay, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/hostevent.c b/zephyr/test/drivers/default/src/console_cmd/hostevent.c
index 85717e88d1..af9b37edd1 100644
--- a/zephyr/test/drivers/default/src/console_cmd/hostevent.c
+++ b/zephyr/test/drivers/default/src/console_cmd/hostevent.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "include/lpc.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
#ifdef CONFIG_HOST_EVENT64
#define HOSTEVENT_PRINT_FORMAT "016" PRIx64
#else
@@ -52,7 +52,7 @@ static int console_cmd_hostevent(const char *subcommand, host_event_t mask)
"hostevent %s 0x%" HOSTEVENT_PRINT_FORMAT, subcommand,
mask);
- zassert_between_inclusive(rv, 0, CONFIG_SHELL_CMD_BUFF_SIZE,
+ zassume_between_inclusive(rv, 0, CONFIG_SHELL_CMD_BUFF_SIZE,
"hostevent console command too long");
return shell_execute_cmd(get_ec_shell(), cmd_buf);
diff --git a/zephyr/test/drivers/default/src/console_cmd/i2c_portmap.c b/zephyr/test/drivers/default/src/console_cmd/i2c_portmap.c
index 7651127218..4b2ec548a2 100644
--- a/zephyr/test/drivers/default/src/console_cmd/i2c_portmap.c
+++ b/zephyr/test/drivers/default/src/console_cmd/i2c_portmap.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(console_cmd_i2c_portmap, drivers_predicate_post_main, NULL, NULL,
NULL, NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/md.c b/zephyr/test/drivers/default/src/console_cmd/md.c
index 0db049a635..c8c3e2c130 100644
--- a/zephyr/test/drivers/default/src/console_cmd/md.c
+++ b/zephyr/test/drivers/default/src/console_cmd/md.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/shell/shell.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "test/drivers/test_state.h"
+
ZTEST_SUITE(console_cmd_md, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
@@ -36,7 +36,7 @@ ZTEST_USER(console_cmd_md, test_default_count)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "md %" PRIuPTR, (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "md %" PRIuPTR, (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -46,7 +46,7 @@ ZTEST_USER(console_cmd_md, test_count_arg)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "md %" PRIuPTR " 2", (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "md %" PRIuPTR " 2", (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -56,7 +56,7 @@ ZTEST_USER(console_cmd_md, test_byte_format)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "md .b %" PRIuPTR, (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "md .b %" PRIuPTR, (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -66,7 +66,7 @@ ZTEST_USER(console_cmd_md, test_half_format)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "md .h %" PRIuPTR, (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "md .h %" PRIuPTR, (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -76,7 +76,7 @@ ZTEST_USER(console_cmd_md, test_string_format)
char memory[] = "hello world";
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "md .s %" PRIuPTR " 12", (uintptr_t)memory) !=
+ zassume_true(sprintf(cmd, "md .s %" PRIuPTR " 12", (uintptr_t)memory) !=
0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/panic_output.c b/zephyr/test/drivers/default/src/console_cmd/panic_output.c
index 0d98ec6d08..7cc809e835 100644
--- a/zephyr/test/drivers/default/src/console_cmd/panic_output.c
+++ b/zephyr/test/drivers/default/src/console_cmd/panic_output.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "panic.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
/* Test panicinfo when a panic hasn't occurred */
ZTEST_USER(console_cmd_panic_output, test_panicinfo)
{
diff --git a/zephyr/test/drivers/default/src/console_cmd/port80.c b/zephyr/test/drivers/default/src/console_cmd/port80.c
index 1d7eb2ad03..792895eb27 100644
--- a/zephyr/test/drivers/default/src/console_cmd/port80.c
+++ b/zephyr/test/drivers/default/src/console_cmd/port80.c
@@ -8,17 +8,18 @@
* @brief Unit Tests for ESPI port 80 console command
*/
+#include <zephyr/logging/log.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "port80.h"
+
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
/**
* @brief TestPurpose: Verify port 80 console commands
*
diff --git a/zephyr/test/drivers/default/src/console_cmd/power_button.c b/zephyr/test/drivers/default/src/console_cmd/power_button.c
index d9900e8667..92d0aeaf78 100644
--- a/zephyr/test/drivers/default/src/console_cmd/power_button.c
+++ b/zephyr/test/drivers/default/src/console_cmd/power_button.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/ztest.h>
-
#include <console.h>
ZTEST_SUITE(console_cmd_power_button, NULL, NULL, NULL, NULL, NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/powerindebug.c b/zephyr/test/drivers/default/src/console_cmd/powerindebug.c
index 946960ea86..9f52a9b569 100644
--- a/zephyr/test/drivers/default/src/console_cmd/powerindebug.c
+++ b/zephyr/test/drivers/default/src/console_cmd/powerindebug.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_powerindebug, test_no_params)
{
zassert_ok(shell_execute_cmd(get_ec_shell(), "powerindebug"),
diff --git a/zephyr/test/drivers/default/src/console_cmd/pwr_avg.c b/zephyr/test/drivers/default/src/console_cmd/pwr_avg.c
deleted file mode 100644
index b21755a465..0000000000
--- a/zephyr/test/drivers/default/src/console_cmd/pwr_avg.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "battery.h"
-#include "console.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
-#include <stdio.h>
-
-#include <zephyr/shell/shell.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
-
-ZTEST_SUITE(console_cmd_pwr_avg, drivers_predicate_post_main, NULL, NULL, NULL,
- NULL);
-
-ZTEST_USER(console_cmd_pwr_avg, test_too_many_args)
-{
- zassert_equal(EC_ERROR_PARAM_COUNT,
- shell_execute_cmd(get_ec_shell(), "pwr_avg 5"));
-}
-
-ZTEST_USER(console_cmd_pwr_avg, test_printout)
-{
- int mv = battery_get_avg_voltage();
- int ma = battery_get_avg_current();
- char expected_output[1024];
- const char *buffer;
- size_t buffer_size;
-
- shell_backend_dummy_clear_output(get_ec_shell());
- zassert_ok(shell_execute_cmd(get_ec_shell(), "pwr_avg"));
-
- buffer = shell_backend_dummy_get_output(get_ec_shell(), &buffer_size);
-
- sprintf(expected_output, "mv = %d", mv);
- zassert_true(strstr(buffer, expected_output));
-
- sprintf(expected_output, "ma = %d", ma);
- zassert_true(strstr(buffer, expected_output));
-
- sprintf(expected_output, "mw = %d", mv * ma / 1000);
- zassert_true(strstr(buffer, expected_output));
-}
diff --git a/zephyr/test/drivers/default/src/console_cmd/rtc.c b/zephyr/test/drivers/default/src/console_cmd/rtc.c
index 974d3709b7..80530129af 100644
--- a/zephyr/test/drivers/default/src/console_cmd/rtc.c
+++ b/zephyr/test/drivers/default/src/console_cmd/rtc.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "system.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_rtc, test_rtc_no_arg)
{
char expected_buffer[32];
diff --git a/zephyr/test/drivers/default/src/console_cmd/rw.c b/zephyr/test/drivers/default/src/console_cmd/rw.c
index 1560254f92..aac37680f5 100644
--- a/zephyr/test/drivers/default/src/console_cmd/rw.c
+++ b/zephyr/test/drivers/default/src/console_cmd/rw.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/shell/shell.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "test/drivers/test_state.h"
+
ZTEST_SUITE(console_cmd_rw, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
@@ -43,15 +43,15 @@ ZTEST_USER(console_cmd_rw, test_read)
uint8_t memory[] = { 0x01, 0x02, 0x03, 0x04 };
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "rw .b %" PRIuPTR, (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "rw .b %" PRIuPTR, (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
- zassert_true(sprintf(cmd, "rw .h %" PRIuPTR, (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "rw .h %" PRIuPTR, (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
- zassert_true(sprintf(cmd, "rw %" PRIuPTR, (uintptr_t)memory) != 0,
+ zassume_true(sprintf(cmd, "rw %" PRIuPTR, (uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
}
@@ -71,7 +71,7 @@ ZTEST_USER(console_cmd_rw, test_write)
uint8_t memory[4] = { 0 };
char cmd[128] = { 0 };
- zassert_true(sprintf(cmd, "rw .b %" PRIuPTR " 1", (uintptr_t)memory) !=
+ zassume_true(sprintf(cmd, "rw .b %" PRIuPTR " 1", (uintptr_t)memory) !=
0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
@@ -81,7 +81,7 @@ ZTEST_USER(console_cmd_rw, test_write)
zassert_equal(0, memory[3], "memory[3] was %u", memory[3]);
memset(memory, 0, 4);
- zassert_true(sprintf(cmd, "rw .h %" PRIuPTR " 258",
+ zassume_true(sprintf(cmd, "rw .h %" PRIuPTR " 258",
(uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
@@ -91,7 +91,7 @@ ZTEST_USER(console_cmd_rw, test_write)
zassert_equal(0, memory[3], "memory[3] was %u", memory[3]);
memset(memory, 0, 4);
- zassert_true(sprintf(cmd, "rw %" PRIuPTR " 16909060",
+ zassume_true(sprintf(cmd, "rw %" PRIuPTR " 16909060",
(uintptr_t)memory) != 0,
NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), cmd), NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/shared_mem.c b/zephyr/test/drivers/default/src/console_cmd/shared_mem.c
index ed796124e4..e7b9396509 100644
--- a/zephyr/test/drivers/default/src/console_cmd/shared_mem.c
+++ b/zephyr/test/drivers/default/src/console_cmd/shared_mem.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "shared_mem.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(console_cmd_shared_mem, drivers_predicate_post_main, NULL, NULL,
NULL, NULL);
diff --git a/zephyr/test/drivers/default/src/console_cmd/sleepmask.c b/zephyr/test/drivers/default/src/console_cmd/sleepmask.c
index 40d174e6af..6ae017dc66 100644
--- a/zephyr/test/drivers/default/src/console_cmd/sleepmask.c
+++ b/zephyr/test/drivers/default/src/console_cmd/sleepmask.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "system.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
#include <zephyr/drivers/emul.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "system.h"
+
ZTEST_USER(console_cmd_sleepmask, test_no_args)
{
const struct shell *shell_zephyr = get_ec_shell();
diff --git a/zephyr/test/drivers/default/src/console_cmd/sleeptimeout.c b/zephyr/test/drivers/default/src/console_cmd/sleeptimeout.c
index 3bd8a39f3f..d802eb5948 100644
--- a/zephyr/test/drivers/default/src/console_cmd/sleeptimeout.c
+++ b/zephyr/test/drivers/default/src/console_cmd/sleeptimeout.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_sleeptimeout, test_no_params)
{
zassert_ok(shell_execute_cmd(get_ec_shell(), "sleeptimeout"),
diff --git a/zephyr/test/drivers/default/src/console_cmd/switch.c b/zephyr/test/drivers/default/src/console_cmd/switch.c
deleted file mode 100644
index f533ebe7b9..0000000000
--- a/zephyr/test/drivers/default/src/console_cmd/switch.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "console.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
-ZTEST_SUITE(console_cmd_switch, drivers_predicate_post_main, NULL, NULL, NULL,
- NULL);
-
-ZTEST_USER(console_cmd_switch, test_mmapinfo)
-{
- uint8_t *memmap_switches = host_get_memmap(EC_MEMMAP_SWITCHES);
- uint8_t before = *memmap_switches;
- char expected[32];
-
- *memmap_switches = 0x3;
- snprintf(expected, sizeof(expected), "memmap switches = 0x%x",
- *memmap_switches);
-
- CHECK_CONSOLE_CMD("mmapinfo", expected, EC_SUCCESS);
- CHECK_CONSOLE_CMD("mmapinfo", "lid_open", EC_SUCCESS);
- CHECK_CONSOLE_CMD("mmapinfo", "powerbtn", EC_SUCCESS);
-
- *memmap_switches = before;
-}
diff --git a/zephyr/test/drivers/default/src/console_cmd/sysinfo.c b/zephyr/test/drivers/default/src/console_cmd/sysinfo.c
index ba14e9158f..3aeef6510c 100644
--- a/zephyr/test/drivers/default/src/console_cmd/sysinfo.c
+++ b/zephyr/test/drivers/default/src/console_cmd/sysinfo.c
@@ -3,17 +3,17 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "system.h"
-#include "test/drivers/test_mocks.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
#include <zephyr/drivers/emul.h>
#include <zephyr/fff.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "test/drivers/test_mocks.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "system.h"
+
ZTEST_USER(console_cmd_sysinfo, test_no_args)
{
const struct shell *shell_zephyr = get_ec_shell();
diff --git a/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c b/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c
index fc8533280b..9652519cab 100644
--- a/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c
+++ b/zephyr/test/drivers/default/src/console_cmd/tcpci_dump.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(console_cmd_tcpci_dump, test_no_params)
{
int rv = shell_execute_cmd(get_ec_shell(), "tcpci_dump");
@@ -38,7 +38,7 @@ static void console_cmd_tcpci_dump_begin(void *data)
ARG_UNUSED(data);
/* Assume we have at least one TCPC */
- zassert_true(board_get_charger_chip_count() > 0,
+ zassume_true(board_get_charger_chip_count() > 0,
"Insufficient TCPCs found");
}
diff --git a/zephyr/test/drivers/default/src/console_cmd/usb_pd_console.c b/zephyr/test/drivers/default/src/console_cmd/usb_pd_console.c
index 859205f403..d521f7bb06 100644
--- a/zephyr/test/drivers/default/src/console_cmd/usb_pd_console.c
+++ b/zephyr/test/drivers/default/src/console_cmd/usb_pd_console.c
@@ -3,17 +3,17 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
#include "usb_pd.h"
-#include "usb_pd_dpm_sm.h"
+#include "usb_pd_dpm.h"
#include "usb_prl_sm.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static void console_cmd_usb_pd_after(void *fixture)
{
ARG_UNUSED(fixture);
@@ -188,10 +188,6 @@ ZTEST_USER(console_cmd_usb_pd, test_bistsharemode)
rv = shell_execute_cmd(get_ec_shell(), "pd bistsharemode disable");
zassert_equal(rv, EC_SUCCESS, "Expected %d, but got %d", EC_SUCCESS,
rv);
-
- rv = shell_execute_cmd(get_ec_shell(), "pd bistsharemode foo");
- zassert_equal(rv, EC_ERROR_PARAM2, "Expected %d, but got %d",
- EC_ERROR_PARAM2, rv);
}
ZTEST_USER(console_cmd_usb_pd, test_hard)
@@ -268,22 +264,6 @@ ZTEST_USER(console_cmd_usb_pd, test_dualrole)
rv = shell_execute_cmd(get_ec_shell(), "pd 0 dualrole x");
zassert_equal(rv, EC_ERROR_PARAM4, "Expected %d, but got %d",
EC_ERROR_PARAM4, rv);
-
- pd_set_dual_role(0, PD_DRP_TOGGLE_OFF);
- CHECK_CONSOLE_CMD("pd 0 dualrole", "dual-role toggling: off",
- EC_SUCCESS);
-
- pd_set_dual_role(0, PD_DRP_FREEZE);
- CHECK_CONSOLE_CMD("pd 0 dualrole", "dual-role toggling: freeze",
- EC_SUCCESS);
-
- pd_set_dual_role(0, PD_DRP_FORCE_SINK);
- CHECK_CONSOLE_CMD("pd 0 dualrole", "dual-role toggling: force sink",
- EC_SUCCESS);
-
- pd_set_dual_role(0, PD_DRP_FORCE_SOURCE);
- CHECK_CONSOLE_CMD("pd 0 dualrole", "dual-role toggling: force source",
- EC_SUCCESS);
}
ZTEST_USER(console_cmd_usb_pd, test_state)
@@ -313,15 +293,6 @@ ZTEST_USER(console_cmd_usb_pd, test_timer)
rv);
}
-ZTEST_USER(console_cmd_usb_pd, test_cc)
-{
- char expected_output[10];
-
- snprintf(expected_output, sizeof(expected_output), "C0 CC%d",
- pd_get_task_cc_state(0));
- CHECK_CONSOLE_CMD("pd 0 cc", expected_output, EC_SUCCESS);
-}
-
static void set_device_vdo(int port, enum tcpci_msg_type type)
{
union tbt_mode_resp_device device_resp;
diff --git a/zephyr/test/drivers/default/src/console_cmd/vboot_hash.c b/zephyr/test/drivers/default/src/console_cmd/vboot_hash.c
index bdc9dddc66..b475f344c8 100644
--- a/zephyr/test/drivers/default/src/console_cmd/vboot_hash.c
+++ b/zephyr/test/drivers/default/src/console_cmd/vboot_hash.c
@@ -2,6 +2,12 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <string.h>
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell_dummy.h>
+#include <zephyr/sys/util.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "flash.h"
#include "printf.h"
@@ -10,13 +16,6 @@
#include "test/drivers/test_state.h"
#include "vboot_hash.h"
-#include <string.h>
-
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/sys/util.h>
-#include <zephyr/ztest.h>
-
#define CUSTOM_HASH_LENGTH (32)
struct console_cmd_hash_fixture {
diff --git a/zephyr/test/drivers/default/src/console_cmd/version.c b/zephyr/test/drivers/default/src/console_cmd/version.c
index e3606b5d0e..932cc51449 100644
--- a/zephyr/test/drivers/default/src/console_cmd/version.c
+++ b/zephyr/test/drivers/default/src/console_cmd/version.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "system.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
#include <zephyr/drivers/emul.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "system.h"
+
ZTEST_USER(console_cmd_version, test_no_args)
{
const struct shell *shell_zephyr = get_ec_shell();
diff --git a/zephyr/test/drivers/default/src/console_cmd/waitms.c b/zephyr/test/drivers/default/src/console_cmd/waitms.c
index 703e233568..0d03ee7414 100644
--- a/zephyr/test/drivers/default/src/console_cmd/waitms.c
+++ b/zephyr/test/drivers/default/src/console_cmd/waitms.c
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "timer.h"
-
#include <stdio.h>
-
#include <zephyr/shell/shell.h>
#include <zephyr/ztest.h>
+#include "console.h"
+#include "timer.h"
+
static void test_int(int ms)
{
char cmd[32];
diff --git a/zephyr/test/drivers/default/src/cros_cbi.c b/zephyr/test/drivers/default/src/cros_cbi.c
index 2669abe21e..e92765cb52 100644
--- a/zephyr/test/drivers/default/src/cros_cbi.c
+++ b/zephyr/test/drivers/default/src/cros_cbi.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "cros_cbi.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/device.h>
#include <zephyr/ztest.h>
+#include "cros_cbi.h"
+#include "test/drivers/test_state.h"
+
ZTEST(cros_cbi, test_check_match)
{
int value;
diff --git a/zephyr/test/drivers/default/src/espi.c b/zephyr/test/drivers/default/src/espi.c
index e526980ef1..ac6c93f3fc 100644
--- a/zephyr/test/drivers/default/src/espi.c
+++ b/zephyr/test/drivers/default/src/espi.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <string.h>
+#include <zephyr/fff.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "gpio.h"
#include "host_command.h"
@@ -11,12 +16,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <string.h>
-
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
#define PORT 0
#define AC_OK_OD_GPIO_NAME "acok_od"
@@ -215,7 +214,7 @@ ZTEST_USER(espi, test_host_command_gpio_set)
BUILD_HOST_COMMAND_PARAMS(EC_CMD_GPIO_SET, 0, p);
/* Force value to 1 to see change */
- zassert_ok(gpio_pin_set_dt(gp, 1), NULL);
+ zassume_ok(gpio_pin_set_dt(gp, 1), NULL);
zassert_ok(host_command_process(&args), NULL);
zassert_equal(gpio_pin_get_dt(gp), p.val, NULL);
diff --git a/zephyr/test/drivers/default/src/flash.c b/zephyr/test/drivers/default/src/flash.c
index e0c6743cde..6794ca2878 100644
--- a/zephyr/test/drivers/default/src/flash.c
+++ b/zephyr/test/drivers/default/src/flash.c
@@ -3,13 +3,6 @@
* found in the LICENSE file.
*/
-#include "ec_commands.h"
-#include "emul/emul_flash.h"
-#include "flash.h"
-#include "host_command.h"
-#include "system.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
@@ -17,6 +10,13 @@
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
+#include "ec_commands.h"
+#include "emul/emul_flash.h"
+#include "flash.h"
+#include "host_command.h"
+#include "system.h"
+#include "test/drivers/test_state.h"
+
#define WP_L_GPIO_PATH DT_PATH(named_gpios, wp_l)
static int gpio_wp_l_set(int value)
@@ -135,17 +135,6 @@ ZTEST_USER(flash, test_hostcmd_flash_protect_wp_deasserted)
response.flags);
}
-ZTEST_USER(flash, test_hostcmd_flash_read__overflow)
-{
- struct ec_params_flash_read params = {
- .size = 32,
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_FLASH_READ, 0, params);
-
- zassert_equal(EC_RES_OVERFLOW, host_command_process(&args));
-}
-
#define TEST_BUF_SIZE 0x100
ZTEST_USER(flash, test_hostcmd_flash_write_and_erase)
@@ -263,7 +252,7 @@ ZTEST_USER(flash, test_hostcmd_flash_region_info_active_invalid)
zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM, NULL);
}
-ZTEST_USER(flash, test_hostcmd_flash_info_1)
+ZTEST_USER(flash, test_hostcmd_flash_info)
{
struct ec_response_flash_info_1 response;
struct host_cmd_handler_args args =
@@ -291,50 +280,6 @@ ZTEST_USER(flash, test_hostcmd_flash_info_1)
"response.write_ideal_size = %d", response.write_ideal_size);
}
-ZTEST_USER(flash, test_hostcmd_flash_info_2)
-{
- uint8_t response_buffer[sizeof(struct ec_response_flash_info_2) +
- sizeof(struct ec_flash_bank)];
- struct ec_response_flash_info_2 *response =
- (struct ec_response_flash_info_2 *)response_buffer;
- struct ec_params_flash_info_2 params = {
- .num_banks_desc = 1,
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_FLASH_INFO, 2, *response, params);
-
- /* Get the flash info. */
- zassert_ok(host_command_process(&args), NULL);
- zassert_equal(response->flash_size,
- CONFIG_FLASH_SIZE_BYTES - EC_FLASH_REGION_START, "got %d",
- response->flash_size);
- zassert_equal(response->flags, 0, "got %d", response->flags);
- zassert_equal(
- response->write_ideal_size,
- (args.response_max - sizeof(struct ec_params_flash_write)) &
- ~(CONFIG_FLASH_WRITE_SIZE - 1),
- "got %d", response->write_ideal_size);
- zassert_equal(response->num_banks_total, 1, "got %d",
- response->num_banks_total);
- zassert_equal(response->num_banks_desc, 1, "got %d",
- response->num_banks_desc);
- zassert_equal(response->banks[0].count,
- CONFIG_FLASH_SIZE_BYTES / CONFIG_FLASH_BANK_SIZE,
- "got %d", response->banks[0].count);
- zassert_equal(response->banks[0].size_exp,
- __fls(CONFIG_FLASH_BANK_SIZE), "got %d",
- response->banks[0].size_exp);
- zassert_equal(response->banks[0].write_size_exp,
- __fls(CONFIG_FLASH_WRITE_SIZE), "got %d",
- response->banks[0].write_size_exp);
- zassert_equal(response->banks[0].erase_size_exp,
- __fls(CONFIG_FLASH_ERASE_SIZE), "got %d",
- response->banks[0].erase_size_exp);
- zassert_equal(response->banks[0].protect_size_exp,
- __fls(CONFIG_FLASH_BANK_SIZE), "got %d",
- response->banks[0].protect_size_exp);
-}
-
ZTEST_USER(flash, test_console_cmd_flash_info)
{
const struct shell *shell_zephyr = get_ec_shell();
@@ -364,15 +309,12 @@ ZTEST_USER(flash, test_console_cmd_flash_info)
sprintf(format_buffer, "Protect: %4d B", CONFIG_FLASH_BANK_SIZE);
zassert_not_null(strstr(outbuffer, format_buffer));
- zassert_not_null(strstr(outbuffer, "wp_gpio_asserted: ON"));
- zassert_not_null(strstr(outbuffer, "ro_at_boot: OFF"));
- zassert_not_null(strstr(outbuffer, "all_at_boot: OFF"));
- zassert_not_null(strstr(outbuffer, "ro_now: OFF"));
- zassert_not_null(strstr(outbuffer, "all_now: OFF"));
- zassert_not_null(strstr(outbuffer, "STUCK: OFF"));
- zassert_not_null(strstr(outbuffer, "INCONSISTENT: OFF"));
- zassert_not_null(strstr(outbuffer, "UNKNOWN_ERROR: OFF"));
+ zassert_not_null(strstr(outbuffer, "wp_gpio_asserted"));
zassert_not_null(strstr(outbuffer, "Protected now"));
+ /*
+ * TODO(b/254926324): Fake crec_flash_get_protect() to get more
+ * flag messages.
+ */
}
ZTEST_USER(flash, test_console_cmd_flashwp__invalid)
@@ -472,7 +414,7 @@ static void setup_flash_region_helper(uint32_t offset, uint32_t size,
int rv;
rv = host_command_process(&erase_args);
- zassert_ok(rv, "Got %d", rv);
+ zassume_ok(rv, "Got %d", rv);
if (make_write) {
/* Sized for flash_write header plus one byte of data */
@@ -492,7 +434,7 @@ static void setup_flash_region_helper(uint32_t offset, uint32_t size,
/* Write one byte at start of region */
out_buf[sizeof(*write_params)] = 0xec;
- zassert_ok(host_command_process(&write_args), NULL);
+ zassume_ok(host_command_process(&write_args), NULL);
}
}
diff --git a/zephyr/test/drivers/default/src/gpio.c b/zephyr/test/drivers/default/src/gpio.c
index 7304324532..3dd62aaa05 100644
--- a/zephyr/test/drivers/default/src/gpio.c
+++ b/zephyr/test/drivers/default/src/gpio.c
@@ -8,27 +8,23 @@
* @brief Unit Tests for GPIO.
*/
+#include <zephyr/device.h>
+
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
#include "ec_tasks.h"
#include "gpio.h"
#include "gpio/gpio.h"
#include "gpio/gpio_int.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_mocks.h"
-#include "test/drivers/test_state.h"
#include "util.h"
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
+#include "test/drivers/test_state.h"
extern bool gpio_test_interrupt_triggered;
-
-/* Function signature for shim/src/gpio.c test_export_static */
-int init_gpios(const struct device *unused);
-
/**
* @brief TestPurpose: Verify Zephyr to EC GPIO bitmask conversion.
*
@@ -139,22 +135,14 @@ ZTEST(gpio, test_legacy_gpio_get_set_level)
{
enum gpio_signal signal = GPIO_SIGNAL(DT_NODELABEL(gpio_test));
int level;
-
/* Test invalid signal */
gpio_set_level(GPIO_COUNT, 0);
zassert_equal(0, gpio_get_level(GPIO_COUNT), "Expected level==0");
-
/* Test valid signal */
gpio_set_level(signal, 0);
- zassert_ok(gpio_or_ioex_get_level(signal, &level));
zassert_equal(0, gpio_get_level(signal), "Expected level==0");
- zassert_equal(0, level);
-
gpio_set_level(signal, 1);
- zassert_ok(gpio_or_ioex_get_level(signal, &level));
zassert_equal(1, gpio_get_level(signal), "Expected level==1");
- zassert_equal(1, level);
-
level = gpio_get_ternary(signal);
gpio_set_level_verbose(CC_CHIPSET, signal, 0);
zassert_equal(0, gpio_get_level(signal), "Expected level==0");
@@ -381,62 +369,6 @@ ZTEST(gpio, test_gpio_reset)
flags);
}
-ZTEST(gpio, test_gpio_reset_port)
-{
- const struct device *port =
- DEVICE_DT_GET(DT_GPIO_CTLR(DT_NODELABEL(gpio_test), gpios));
- enum gpio_signal signal = GPIO_SIGNAL(DT_NODELABEL(gpio_test));
- gpio_flags_t flags;
- gpio_flags_t flags_at_start[GPIO_COUNT];
-
- /* Snapshot of GPIO flags before testing */
- for (int i = 0; i < GPIO_COUNT; i++)
- flags_at_start[i] = gpio_helper_get_flags(i);
-
- /* Test reset on invalid signal */
- gpio_reset_port(NULL);
-
- /* Verify flags didn't change */
- for (int i = 0; i < GPIO_COUNT; i++) {
- flags = gpio_helper_get_flags(i);
- zassert_equal(flags_at_start[i], flags,
- "%s[%d] flags_at_start=0x%x, flags=0x%x",
- gpio_get_name(i), i, flags_at_start[i], flags);
- }
-
- /* Test reset on valid signal */
- gpio_set_flags(signal, GPIO_OUTPUT);
- flags = gpio_helper_get_flags(signal);
- zassert_equal(flags, GPIO_OUTPUT, "Flags set 0x%x", flags);
-
- gpio_reset_port(port);
-
- flags = gpio_helper_get_flags(signal);
- zassert_equal(flags, gpio_get_default_flags(signal), "Flags set 0x%x",
- flags);
-
- for (int i = 0; i < GPIO_COUNT; ++i) {
- gpio_set_flags(i, flags_at_start[i]);
- }
-}
-
-ZTEST(gpio, test_gpio_set_flags_by_mask)
-{
- gpio_set_flags_by_mask(0, BIT(27), GPIO_OUTPUT);
- zassert_equal(gpio_configure_port_pin_fake.call_count, 1);
- zassert_equal(gpio_configure_port_pin_fake.arg0_val, 0);
- zassert_equal(gpio_configure_port_pin_fake.arg1_val, 27);
- zassert_equal(gpio_configure_port_pin_fake.arg2_val,
- convert_to_zephyr_flags(GPIO_OUTPUT));
-}
-
-ZTEST(gpio, test_init_gpios_fail_on_unused_pins_custom_func)
-{
- gpio_config_unused_pins_fake.return_val = -1;
-
- zassert_equal(-1, init_gpios(NULL));
-}
-
/**
* @brief TestPurpose: Verify GPIO enable/disable interrupt.
*
@@ -486,4 +418,4 @@ static void gpio_before(void *state)
/**
* @brief Test Suite: Verifies GPIO functionality.
*/
-ZTEST_SUITE(gpio, drivers_predicate_pre_main, NULL, gpio_before, NULL, NULL);
+ZTEST_SUITE(gpio, drivers_predicate_post_main, NULL, gpio_before, NULL, NULL);
diff --git a/zephyr/test/drivers/default/src/i2c.c b/zephyr/test/drivers/default/src/i2c.c
index ca27fedbb2..caced4aedf 100644
--- a/zephyr/test/drivers/default/src/i2c.c
+++ b/zephyr/test/drivers/default/src/i2c.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "host_command.h"
#include "i2c.h"
#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(i2c, test_i2c_set_speed_success)
{
struct ec_response_i2c_control response;
@@ -52,29 +52,12 @@ ZTEST_USER(i2c, test_i2c_set_speed_success)
"response.cmd_response.speed_khz = %d",
response.cmd_response.speed_khz);
- /* Set the speed to 1000. */
- set_params.cmd_params.speed_khz = 1000;
- zassert_ok(host_command_process(&set_args), NULL);
- zassert_ok(set_args.result, NULL);
- zassert_equal(set_args.response_size, sizeof(response), NULL);
- zassert_equal(response.cmd_response.speed_khz, 400,
- "response.cmd_response.speed_khz = %d",
- response.cmd_response.speed_khz);
-
- /* Get the speed to verify. */
- zassert_ok(host_command_process(&get_args), NULL);
- zassert_ok(get_args.result, NULL);
- zassert_equal(get_args.response_size, sizeof(response), NULL);
- zassert_equal(response.cmd_response.speed_khz, 1000,
- "response.cmd_response.speed_khz = %d",
- response.cmd_response.speed_khz);
-
/* Set the speed back to 100. */
set_params.cmd_params.speed_khz = 100;
zassert_ok(host_command_process(&set_args), NULL);
zassert_ok(set_args.result, NULL);
zassert_equal(set_args.response_size, sizeof(response), NULL);
- zassert_equal(response.cmd_response.speed_khz, 1000,
+ zassert_equal(response.cmd_response.speed_khz, 400,
"response.cmd_response.speed_khz = %d",
response.cmd_response.speed_khz);
}
diff --git a/zephyr/test/drivers/default/src/i2c_passthru.c b/zephyr/test/drivers/default/src/i2c_passthru.c
index afefc4b553..67e1317876 100644
--- a/zephyr/test/drivers/default/src/i2c_passthru.c
+++ b/zephyr/test/drivers/default/src/i2c_passthru.c
@@ -3,25 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "driver/ln9310.h"
#include "ec_commands.h"
#include "host_command.h"
#include "i2c.h"
-#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
-FAKE_VALUE_FUNC(int, board_allow_i2c_passthru, const struct i2c_cmd_desc_t *);
-
-int board_allow_i2c_passthru_custom_fake(const struct i2c_cmd_desc_t *cmd_desc)
-{
- /* Only allow passthru on I2C_PORT_USB_C0 */
- return i2c_get_device_for_port(cmd_desc->port) ==
- i2c_get_device_for_port(I2C_PORT_USB_C0);
-}
-
ZTEST_USER(i2c_passthru, test_read_without_write)
{
uint8_t param_buf[sizeof(struct ec_params_i2c_passthru) +
@@ -50,55 +40,6 @@ ZTEST_USER(i2c_passthru, test_read_without_write)
sizeof(struct ec_response_i2c_passthru), NULL);
}
-ZTEST_USER(i2c_passthru, test_passthru_invalid_params)
-{
- uint16_t tcpc_addr = DT_REG_ADDR(DT_NODELABEL(tcpci_emul));
- uint8_t *out_data;
- uint8_t param_buf[sizeof(struct ec_params_i2c_passthru) +
- 2 * sizeof(struct ec_params_i2c_passthru_msg) + 1];
- uint8_t response_buf[sizeof(struct ec_response_i2c_passthru) + 2];
- struct ec_params_i2c_passthru *passthru_params =
- (struct ec_params_i2c_passthru *)&param_buf;
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_SIMPLE(EC_CMD_I2C_PASSTHRU, 0);
-
- passthru_params->port = I2C_PORT_USB_C0;
- passthru_params->num_msgs = 2;
- passthru_params->msg[0].addr_flags = tcpc_addr;
- passthru_params->msg[0].len = 1;
- passthru_params->msg[1].addr_flags = tcpc_addr | EC_I2C_FLAG_READ;
- passthru_params->msg[1].len = 2; /* 2 byte vendor ID */
-
- /* Write data follows the passthru messages */
- out_data = (uint8_t *)&passthru_params->msg[2];
- out_data[0] = 0; /* TCPC_REG_VENDOR_ID 0x0 */
-
- args.params = &param_buf;
- args.params_size = sizeof(param_buf);
- args.response = &response_buf;
- args.response_max = sizeof(response_buf);
-
- /* Set the params_size to smaller than struct ec_params_i2c_passthru */
- args.params_size = 1;
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM);
-
- /* Set the params_size so it truncates the 2nd I2C message */
- args.params_size = sizeof(struct ec_params_i2c_passthru) +
- sizeof(struct ec_params_i2c_passthru_msg);
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM);
-
- /* Don't provide enough room for the response */
- args.params_size = sizeof(param_buf);
- args.response_max = sizeof(struct ec_response_i2c_passthru) + 1;
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM);
-
- /* Don't provide the write data */
- args.response_max = sizeof(response_buf);
- args.params_size = sizeof(struct ec_params_i2c_passthru) +
- 2 * sizeof(struct ec_params_i2c_passthru_msg);
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM);
-}
-
ZTEST_USER(i2c_passthru, test_passthru_protect)
{
struct ec_response_i2c_passthru_protect response;
@@ -166,166 +107,10 @@ ZTEST_USER(i2c_passthru, test_passthru_protect_tcpcs)
};
struct host_cmd_handler_args enable_args = BUILD_HOST_COMMAND_PARAMS(
EC_CMD_I2C_PASSTHRU_PROTECT, 0, enable_params);
- uint16_t tcpc_addr = DT_REG_ADDR(DT_NODELABEL(tcpci_emul));
- uint8_t *out_data;
- uint8_t param_buf[sizeof(struct ec_params_i2c_passthru) +
- 2 * sizeof(struct ec_params_i2c_passthru_msg) + 1];
- uint8_t response_buf[sizeof(struct ec_response_i2c_passthru) + 2];
- struct ec_params_i2c_passthru *passthru_params =
- (struct ec_params_i2c_passthru *)&param_buf;
- struct ec_response_i2c_passthru *passthru_response =
- (struct ec_response_i2c_passthru *)&response_buf;
- struct host_cmd_handler_args passthru_args =
- BUILD_HOST_COMMAND_SIMPLE(EC_CMD_I2C_PASSTHRU, 0);
-
- /* If the system is unlocked, TCPC protection is disabled */
- system_is_locked_fake.return_val = false;
-
- /* Protect the all TCPC buses */
- zassert_ok(host_command_process(&enable_args), NULL);
- zassert_ok(enable_args.result, NULL);
-
- passthru_params->port = I2C_PORT_USB_C0;
- passthru_params->num_msgs = 2;
- passthru_params->msg[0].addr_flags = tcpc_addr;
- passthru_params->msg[0].len = 1;
- passthru_params->msg[1].addr_flags = tcpc_addr | EC_I2C_FLAG_READ;
- passthru_params->msg[1].len = 2; /* 2 byte vendor ID */
-
- /* Write data follows the passthru messages */
- out_data = (uint8_t *)&passthru_params->msg[2];
- out_data[0] = 0; /* TCPC_REG_VENDOR_ID 0x0 */
-
- passthru_args.params = &param_buf;
- passthru_args.params_size = sizeof(param_buf);
- passthru_args.response = &response_buf;
- passthru_args.response_max = sizeof(response_buf);
-
- zassert_ok(host_command_process(&passthru_args));
- zassert_ok(passthru_args.result);
- zassert_ok(passthru_response->i2c_status);
- zassert_equal(passthru_args.response_size,
- sizeof(struct ec_response_i2c_passthru) + 2, NULL);
-
- /* Now attempt TCPC protection while the system is locked */
- system_is_locked_fake.return_val = true;
/* Protect the all TCPC buses */
zassert_ok(host_command_process(&enable_args), NULL);
zassert_ok(enable_args.result, NULL);
-
- zassert_equal(host_command_process(&passthru_args),
- EC_RES_ACCESS_DENIED);
-}
-
-ZTEST_USER(i2c_passthru, test_passthru_restricted)
-{
- uint16_t tcpc_addr = DT_REG_ADDR(DT_NODELABEL(tcpci_emul));
- uint16_t ps8xxx_addr = DT_REG_ADDR(DT_NODELABEL(ps8xxx_emul));
- uint8_t *out_data;
- uint8_t tcpc_param_buf[sizeof(struct ec_params_i2c_passthru) +
- 2 * sizeof(struct ec_params_i2c_passthru_msg) +
- 1];
- uint8_t tcpc_rsp_buf[sizeof(struct ec_response_i2c_passthru) + 2];
- struct ec_params_i2c_passthru *tcpc_params =
- (struct ec_params_i2c_passthru *)&tcpc_param_buf;
- struct ec_response_i2c_passthru *tcpc_response =
- (struct ec_response_i2c_passthru *)&tcpc_rsp_buf;
- struct host_cmd_handler_args tcpc_args =
- BUILD_HOST_COMMAND_SIMPLE(EC_CMD_I2C_PASSTHRU, 0);
-
- uint8_t ps8xxx_param_buf[sizeof(struct ec_params_i2c_passthru) +
- 2 * sizeof(struct ec_params_i2c_passthru_msg) +
- 1];
- uint8_t ps8xxx_rsp_buf[sizeof(struct ec_response_i2c_passthru) + 2];
- struct ec_params_i2c_passthru *ps8xxx_params =
- (struct ec_params_i2c_passthru *)&ps8xxx_param_buf;
- struct ec_response_i2c_passthru *ps8xxx_response =
- (struct ec_response_i2c_passthru *)&ps8xxx_rsp_buf;
- struct host_cmd_handler_args ps8xxx_args =
- BUILD_HOST_COMMAND_SIMPLE(EC_CMD_I2C_PASSTHRU, 0);
-
- if (!IS_ENABLED(CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED)) {
- ztest_test_skip();
- return;
- }
-
- /*
- * Setup passthru command to the TCPCI emulator - which is always
- * permitted by our board_allow_i2c_passthru() fake.
- */
- tcpc_params->port = I2C_PORT_USB_C0;
- tcpc_params->num_msgs = 2;
- tcpc_params->msg[0].addr_flags = tcpc_addr;
- tcpc_params->msg[0].len = 1;
- tcpc_params->msg[1].addr_flags = tcpc_addr | EC_I2C_FLAG_READ;
- tcpc_params->msg[1].len = 2; /* 2 byte vendor ID */
-
- /* Write data follows the passthru messages */
- out_data = (uint8_t *)&tcpc_params->msg[2];
- out_data[0] = 0; /* TCPC_REG_VENDOR_ID 0x0 */
-
- tcpc_args.params = &tcpc_param_buf;
- tcpc_args.params_size = sizeof(tcpc_param_buf);
- tcpc_args.response = &tcpc_rsp_buf;
- tcpc_args.response_max = sizeof(tcpc_rsp_buf);
-
- /*
- * Setup passthru command to the PS8xxx emulator, which should be
- * rejected when the system is locked.
- */
- ps8xxx_params->port = I2C_PORT_USB_C1;
- ps8xxx_params->num_msgs = 2;
- ps8xxx_params->msg[0].addr_flags = ps8xxx_addr;
- ps8xxx_params->msg[0].len = 1;
- ps8xxx_params->msg[1].addr_flags = ps8xxx_addr | EC_I2C_FLAG_READ;
- ps8xxx_params->msg[1].len = 2; /* 2-byte vendor ID */
-
- /* Write data follows the passthru messages */
- out_data = (uint8_t *)&ps8xxx_params->msg[2];
- out_data[0] = 0; /* TCPC_REG_VENDOR_ID 0x0 */
-
- ps8xxx_args.params = &ps8xxx_param_buf;
- ps8xxx_args.params_size = sizeof(ps8xxx_param_buf);
- ps8xxx_args.response = &ps8xxx_rsp_buf;
- ps8xxx_args.response_max = sizeof(ps8xxx_rsp_buf);
-
- /* Install our board_allow_i2c_passthru() handler */
- board_allow_i2c_passthru_fake.custom_fake =
- board_allow_i2c_passthru_custom_fake;
-
- /* When the system is unlocked, no restrictions apply */
- system_is_locked_fake.return_val = false;
-
- zassert_ok(host_command_process(&tcpc_args));
- zassert_ok(tcpc_args.result);
- zassert_ok(tcpc_response->i2c_status);
- zassert_equal(tcpc_args.response_size,
- sizeof(struct ec_response_i2c_passthru) + 2, NULL);
-
- zassert_ok(host_command_process(&ps8xxx_args));
- zassert_ok(ps8xxx_args.result);
- zassert_ok(ps8xxx_response->i2c_status);
- zassert_equal(ps8xxx_args.response_size,
- sizeof(struct ec_response_i2c_passthru) + 2, NULL);
-
- /* Lock the system which enables board_allow_i2c_passthru() */
- system_is_locked_fake.return_val = true;
-
- zassert_ok(host_command_process(&tcpc_args));
- zassert_ok(tcpc_args.result);
- zassert_ok(tcpc_response->i2c_status);
- zassert_equal(tcpc_args.response_size,
- sizeof(struct ec_response_i2c_passthru) + 2, NULL);
-
- zassert_equal(host_command_process(&ps8xxx_args), EC_RES_ACCESS_DENIED);
-}
-
-static void i2c_passthru_before(void *state)
-{
- ARG_UNUSED(state);
- RESET_FAKE(board_allow_i2c_passthru);
- board_allow_i2c_passthru_fake.return_val = 1;
}
static void i2c_passthru_after(void *state)
@@ -334,5 +119,5 @@ static void i2c_passthru_after(void *state)
i2c_passthru_protect_reset();
}
-ZTEST_SUITE(i2c_passthru, drivers_predicate_post_main, NULL,
- i2c_passthru_before, i2c_passthru_after, NULL);
+ZTEST_SUITE(i2c_passthru, drivers_predicate_post_main, NULL, NULL,
+ i2c_passthru_after, NULL);
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb.c b/zephyr/test/drivers/default/src/integration/usbc/usb.c
index 31c8887bf1..9fc8f66505 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb.c
@@ -3,10 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "battery_smart.h"
-#include "driver/tcpm/ps8xxx_public.h"
#include "ec_commands.h"
#include "ec_tasks.h"
+#include "driver/tcpm/ps8xxx_public.h"
#include "emul/emul_isl923x.h"
#include "emul/emul_smart_battery.h"
#include "emul/tcpc/emul_ps8xxx.h"
@@ -23,10 +27,6 @@
#include "test/usb_pe.h"
#include "usb_tc_sm.h"
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
#define BATTERY_NODE DT_NODELABEL(battery)
#define GPIO_AC_OK_PATH DT_PATH(named_gpios, acok_od)
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c b/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c
index f2afa5be9a..07b1b5143e 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_20v_3a_pd_charger.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "battery_smart.h"
#include "emul/emul_isl923x.h"
#include "emul/emul_smart_battery.h"
@@ -11,8 +13,6 @@
#include "test/drivers/utils.h"
#include "usb_pd.h"
-#include <zephyr/ztest.h>
-
#define BATTERY_NODE DT_NODELABEL(battery)
struct usb_attach_20v_3a_pd_charger_fixture {
@@ -26,7 +26,7 @@ static inline void
connect_charger_to_port(struct usb_attach_20v_3a_pd_charger_fixture *fixture)
{
set_ac_enabled(true);
- zassert_ok(tcpci_partner_connect_to_tcpci(&fixture->charger_20v,
+ zassume_ok(tcpci_partner_connect_to_tcpci(&fixture->charger_20v,
fixture->tcpci_emul),
NULL);
@@ -43,7 +43,7 @@ static inline void disconnect_charger_from_port(
struct usb_attach_20v_3a_pd_charger_fixture *fixture)
{
set_ac_enabled(false);
- zassert_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul));
+ zassume_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul));
isl923x_emul_set_adc_vbus(fixture->charger_emul, 0);
k_sleep(K_SECONDS(1));
}
@@ -88,7 +88,7 @@ ZTEST(usb_attach_20v_3a_pd_charger, test_battery_is_charging)
const struct emul *emul = EMUL_DT_GET(BATTERY_NODE);
uint16_t battery_status;
- zassert_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS,
+ zassume_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS,
&battery_status),
NULL);
zassert_equal(battery_status & STATUS_DISCHARGING, 0,
@@ -176,9 +176,9 @@ ZTEST_F(usb_attach_20v_3a_pd_charger, test_disconnect_charge_state)
"Max charge current expected 0mA, but was %dmA",
charge_state.get_state.chg_current);
zassert_equal(charge_state.get_state.chg_input_current,
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT,
+ CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT,
"Charge input current limit expected %dmA, but was %dmA",
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT,
+ CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT,
charge_state.get_state.chg_input_current);
}
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c
index 6795e72c11..e3584470a0 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_sink.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/ztest.h>
+
#include "battery_smart.h"
#include "emul/emul_isl923x.h"
#include "emul/emul_smart_battery.h"
@@ -13,10 +16,6 @@
#include "timer.h"
#include "usb_pd.h"
-#include <stdint.h>
-
-#include <zephyr/ztest.h>
-
struct usb_attach_5v_3a_pd_sink_fixture {
struct tcpci_partner_data sink_5v_3a;
struct tcpci_snk_emul_data snk_ext;
@@ -86,7 +85,7 @@ ZTEST(usb_attach_5v_3a_pd_sink, test_battery_is_discharging)
const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(battery));
uint16_t battery_status;
- zassert_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS,
+ zassume_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS,
&battery_status));
zassert_equal(battery_status & STATUS_DISCHARGING, STATUS_DISCHARGING,
"Battery is not discharging: %d", battery_status);
@@ -159,9 +158,9 @@ ZTEST_F(usb_attach_5v_3a_pd_sink, test_disconnect_charge_state)
"Max charge current expected 0mA, but was %dmA",
charge_state.get_state.chg_current);
zassert_equal(charge_state.get_state.chg_input_current,
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT,
+ CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT,
"Charge input current limit expected %dmA, but was %dmA",
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT,
+ CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT,
charge_state.get_state.chg_input_current);
}
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c
index c57054881d..c73cf26f37 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_5v_3a_pd_source.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/sys/slist.h>
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "battery_smart.h"
#include "dps.h"
@@ -15,18 +19,11 @@
#include "test/drivers/utils.h"
#include "usb_pd.h"
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/sys/slist.h>
-#include <zephyr/ztest.h>
-
#define BATTERY_NODE DT_NODELABEL(battery)
#define GPIO_BATT_PRES_ODL_PATH DT_PATH(named_gpios, ec_batt_pres_odl)
#define GPIO_BATT_PRES_ODL_PORT DT_GPIO_PIN(GPIO_BATT_PRES_ODL_PATH, gpios)
-#define TEST_PORT 0
-
struct usb_attach_5v_3a_pd_source_fixture {
struct tcpci_partner_data source_5v_3a;
struct tcpci_src_emul_data src_ext;
@@ -39,8 +36,8 @@ static void *usb_attach_5v_3a_pd_source_setup(void)
static struct usb_attach_5v_3a_pd_source_fixture test_fixture;
/* Get references for the emulators */
- test_fixture.tcpci_emul = EMUL_GET_USBC_BINDING(TEST_PORT, tcpc);
- test_fixture.charger_emul = EMUL_GET_USBC_BINDING(TEST_PORT, chg);
+ test_fixture.tcpci_emul = EMUL_GET_USBC_BINDING(0, tcpc);
+ test_fixture.charger_emul = EMUL_GET_USBC_BINDING(0, chg);
/* Initialized the charger to supply 5V and 3A */
tcpci_partner_init(&test_fixture.source_5v_3a, PD_REV20);
@@ -73,7 +70,7 @@ static void control_battery_present(bool present)
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_BATT_PRES_ODL_PATH, gpios));
/* 0 means battery present */
- zassert_ok(gpio_emul_input_set(dev, GPIO_BATT_PRES_ODL_PORT, !present));
+ zassume_ok(gpio_emul_input_set(dev, GPIO_BATT_PRES_ODL_PORT, !present));
}
ZTEST_SUITE(usb_attach_5v_3a_pd_source, drivers_predicate_post_main,
@@ -85,7 +82,7 @@ ZTEST(usb_attach_5v_3a_pd_source, test_battery_is_charging)
const struct emul *emul = EMUL_DT_GET(BATTERY_NODE);
uint16_t battery_status;
- zassert_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS,
+ zassume_ok(sbat_emul_get_word_val(emul, SB_BATTERY_STATUS,
&battery_status));
zassert_equal(battery_status & STATUS_DISCHARGING, 0,
"Battery is discharging: %d", battery_status);
@@ -93,8 +90,7 @@ ZTEST(usb_attach_5v_3a_pd_source, test_battery_is_charging)
ZTEST(usb_attach_5v_3a_pd_source, test_charge_state)
{
- struct ec_response_charge_state state =
- host_cmd_charge_state(TEST_PORT);
+ struct ec_response_charge_state state = host_cmd_charge_state(0);
zassert_true(state.get_state.ac, "AC_OK not triggered");
zassert_true(state.get_state.chg_voltage > 0,
@@ -165,16 +161,16 @@ ZTEST_F(usb_attach_5v_3a_pd_source, test_disconnect_charge_state)
struct ec_response_charge_state charge_state;
disconnect_source_from_port(fixture->tcpci_emul, fixture->charger_emul);
- charge_state = host_cmd_charge_state(TEST_PORT);
+ charge_state = host_cmd_charge_state(0);
zassert_false(charge_state.get_state.ac, "AC_OK not triggered");
zassert_equal(charge_state.get_state.chg_current, 0,
"Max charge current expected 0mA, but was %dmA",
charge_state.get_state.chg_current);
zassert_equal(charge_state.get_state.chg_input_current,
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT,
+ CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT,
"Charge input current limit expected %dmA, but was %dmA",
- CONFIG_PLATFORM_EC_CHARGER_DEFAULT_CURRENT_LIMIT,
+ CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT,
charge_state.get_state.chg_input_current);
}
@@ -325,39 +321,3 @@ ZTEST_F(usb_attach_5v_3a_pd_source, test_dps_enable)
dps_enable(true);
zassert_true(dps_is_enabled());
}
-
-ZTEST_F(usb_attach_5v_3a_pd_source, test_dps_info)
-{
- const struct shell *shell_zephyr = get_ec_shell();
-
- const char *outbuffer;
- uint32_t buffer_size;
- /* Arbitrary array size for sprintf should not need this amount */
- char format_buffer[100];
-
- shell_backend_dummy_clear_output(shell_zephyr);
-
- /* Print current status to console */
- zassert_ok(shell_execute_cmd(shell_zephyr, "dps"), NULL);
- outbuffer = shell_backend_dummy_get_output(shell_zephyr, &buffer_size);
-
- /* Should include extra information about the charging port */
- /* Charging Port */
- sprintf(format_buffer, "C%d", TEST_PORT);
- zassert_not_null(strstr(outbuffer, format_buffer));
- /* We are a sink to a 5v3a source, so check requested mv/ma */
- sprintf(format_buffer, "Requested: %dmV/%dmA", 5000, 3000);
- zassert_not_null(strstr(outbuffer, format_buffer));
- /*
- * Measured input power is shown (values vary so not asserting on
- * numbers)
- */
- zassert_not_null(strstr(outbuffer, "Measured:"));
- /* Efficient Voltage - Value varies based on battery*/
- zassert_not_null(strstr(outbuffer, "Efficient:"));
- /* Battery Design Voltage (varies based on battery) */
- zassert_not_null(strstr(outbuffer, "Batt:"));
- /* PDMaxMV */
- sprintf(format_buffer, "PDMaxMV: %dmV", pd_get_max_voltage());
- zassert_not_null(strstr(outbuffer, format_buffer));
-}
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c b/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c
index 401a89cb11..0b65f9b135 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_attach_src_snk.c
@@ -3,24 +3,24 @@
* found in the LICENSE file.
*/
-#include "driver/tcpm/ps8xxx_public.h"
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "ec_commands.h"
#include "ec_tasks.h"
+#include "driver/tcpm/ps8xxx_public.h"
#include "emul/emul_isl923x.h"
#include "emul/tcpc/emul_ps8xxx.h"
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
#include "host_command.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
+#include "tcpm/tcpci.h"
#include "test/usb_pe.h"
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "test/drivers/utils.h"
+#include "test/drivers/test_state.h"
#define SNK_PORT USBC_PORT_C0
#define SRC_PORT USBC_PORT_C1
@@ -117,21 +117,21 @@ static void attach_src_snk_common_before(struct emul_state *my_emul_state)
/* TODO(b/217737667): Remove driver specific code. */
isl923x_emul_set_adc_vbus(charger_emul, 0);
- zassert_ok(tcpc_config[SNK_PORT].drv->init(SNK_PORT));
+ zassume_ok(tcpc_config[SNK_PORT].drv->init(SNK_PORT));
/*
* Arbitrary FW ver. The emulator should really be setting this
* during its init.
*/
tcpci_emul_set_reg(tcpci_emul_snk, PS8XXX_REG_FW_REV, 0x31);
- zassert_ok(tcpc_config[SRC_PORT].drv->init(SRC_PORT));
+ zassume_ok(tcpc_config[SRC_PORT].drv->init(SRC_PORT));
pd_set_suspend(SNK_PORT, false);
pd_set_suspend(SRC_PORT, false);
/* Reset to disconnected state. */
- zassert_ok(tcpci_emul_disconnect_partner(tcpci_emul_src));
- zassert_ok(tcpci_emul_disconnect_partner(tcpci_emul_snk));
+ zassume_ok(tcpci_emul_disconnect_partner(tcpci_emul_src));
+ zassume_ok(tcpci_emul_disconnect_partner(tcpci_emul_snk));
/* Set chipset to ON, this will set TCPM to DRP */
test_set_chipset_to_s0();
@@ -177,7 +177,7 @@ static void attach_emulated_snk(struct emul_state *my_emul_state)
tcpci_emul_set_reg(tcpci_emul_snk, TCPC_REG_EXT_STATUS,
TCPC_REG_EXT_STATUS_SAFE0V);
- zassert_ok(tcpci_partner_connect_to_tcpci(my_snk, tcpci_emul_snk),
+ zassume_ok(tcpci_partner_connect_to_tcpci(my_snk, tcpci_emul_snk),
NULL);
/* TODO(b/214401892): Check why need to give time TCPM to spin */
@@ -207,7 +207,7 @@ static void attach_emulated_src(struct emul_state *my_emul_state)
tcpci_emul_set_reg(tcpci_emul_src, TCPC_REG_EXT_STATUS,
TCPC_REG_EXT_STATUS_SAFE0V);
- zassert_ok(tcpci_partner_connect_to_tcpci(my_src, tcpci_emul_src),
+ zassume_ok(tcpci_partner_connect_to_tcpci(my_src, tcpci_emul_src),
NULL);
isl923x_emul_set_adc_vbus(charger_emul, DEFAULT_VBUS_MV);
}
@@ -542,7 +542,7 @@ struct usb_detach_test_fixture {
static void integration_usb_test_detach(const struct emul *e)
{
- zassert_ok(tcpci_emul_disconnect_partner(e));
+ zassume_ok(tcpci_emul_disconnect_partner(e));
}
static void integration_usb_test_sink_detach(struct emul_state *fixture)
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c
index 36a417d22c..47e26f97d6 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_bist_shared.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "emul/emul_isl923x.h"
#include "emul/emul_smart_battery.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
@@ -13,8 +15,6 @@
#include "usb_pd.h"
#include "util.h"
-#include <zephyr/ztest.h>
-
struct usb_pd_bist_shared_fixture {
struct tcpci_partner_data sink_5v_500ma;
struct tcpci_snk_emul_data snk_ext_500ma;
@@ -99,7 +99,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_mode)
/* Start up BIST shared test mode */
bist_data = BDO(BDO_MODE_SHARED_ENTER, 0);
- zassert_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma,
+ zassume_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma,
PD_DATA_BIST, &bist_data, 1, 0),
"Failed to send BIST enter message");
@@ -116,7 +116,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_mode)
/* Leave BIST shared test mode */
bist_data = BDO(BDO_MODE_SHARED_EXIT, 0);
- zassert_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma,
+ zassume_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma,
PD_DATA_BIST, &bist_data, 1, 0),
"Failed to send BIST exit message");
@@ -152,7 +152,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_no_snk_entry)
/* Have the source send the BIST Enter Mode */
bist_data = BDO(BDO_MODE_SHARED_ENTER, 0);
- zassert_ok(tcpci_partner_send_data_msg(&fixture->src, PD_DATA_BIST,
+ zassume_ok(tcpci_partner_send_data_msg(&fixture->src, PD_DATA_BIST,
&bist_data, 1, 0),
"Failed to send BIST enter message");
@@ -181,7 +181,7 @@ ZTEST_F(usb_pd_bist_shared, verify_bist_shared_exit_no_action)
tcpci_snk_emul_clear_last_5v_cap(&fixture->snk_ext_500ma);
bist_data = BDO(BDO_MODE_SHARED_EXIT, 0);
- zassert_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma,
+ zassume_ok(tcpci_partner_send_data_msg(&fixture->sink_5v_500ma,
PD_DATA_BIST, &bist_data, 1, 0),
"Failed to send BIST exit message");
@@ -198,7 +198,7 @@ ZTEST_F(usb_pd_bist_shared, verify_control_bist_shared_mode)
uint32_t f5v_cap;
host_cmd_typec_control_bist_share_mode(USBC_PORT_C0, 1);
- zassert_ok(tcpci_partner_send_control_msg(&fixture->sink_5v_500ma,
+ zassume_ok(tcpci_partner_send_control_msg(&fixture->sink_5v_500ma,
PD_CTRL_GET_SOURCE_CAP, 0),
"Failed to send get src cap");
/* wait tSenderResponse (26 ms) */
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c
index 1d3da4921f..e35e2a7ec1 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_ctrl_msg.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
#include "ec_tasks.h"
#include "emul/emul_isl923x.h"
@@ -14,10 +17,6 @@
#include "test/usb_pe.h"
#include "usb_pd.h"
-#include <stdint.h>
-
-#include <zephyr/ztest.h>
-
#define TEST_USB_PORT 0
BUILD_ASSERT(TEST_USB_PORT == USBC_PORT_C0);
@@ -60,13 +59,13 @@ tcpci_drp_emul_connect_partner(struct tcpci_partner_data *partner_emul,
tcpci_tcpc_alert(TEST_USB_PORT);
- zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpci_emul),
+ zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpci_emul),
NULL);
}
static void disconnect_partner(struct usb_pd_ctrl_msg_test_fixture *fixture)
{
- zassert_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul));
+ zassume_ok(tcpci_emul_disconnect_partner(fixture->tcpci_emul));
k_sleep(K_SECONDS(1));
}
diff --git a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c
index 781a0cc06a..fdea74a691 100644
--- a/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c
+++ b/zephyr/test/drivers/default/src/integration/usbc/usb_pd_rev3.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/sys/slist.h>
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "battery_smart.h"
#include "chipset.h"
@@ -17,10 +21,6 @@
#include "usb_pd.h"
#include "util.h"
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/sys/slist.h>
-#include <zephyr/ztest.h>
-
struct usb_attach_5v_3a_pd_source_rev3_fixture {
struct tcpci_partner_data source_5v_3a;
struct tcpci_src_emul_data src_ext;
@@ -62,11 +62,11 @@ static void usb_attach_5v_3a_pd_source_before(void *data)
/* Clear Alert and Status receive checks */
tcpci_src_emul_clear_alert_received(&fixture->src_ext);
tcpci_src_emul_clear_status_received(&fixture->src_ext);
- zassert_false(fixture->src_ext.alert_received);
- zassert_false(fixture->src_ext.status_received);
+ zassume_false(fixture->src_ext.alert_received);
+ zassume_false(fixture->src_ext.status_received);
/* Initial check on power state */
- zassert_true(chipset_in_state(CHIPSET_STATE_ON));
+ zassume_true(chipset_in_state(CHIPSET_STATE_ON));
}
static void usb_attach_5v_3a_pd_source_after(void *data)
@@ -112,8 +112,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, test_batt_cap)
/* See pe_give_battery_cap_entry() in common/usbc/usb_pe_drp_sm.c */
- zassert_true(battery_is_present(), "Battery must be present");
- zassert_true(IS_ENABLED(HAS_TASK_HOSTCMD) &&
+ zassume_true(battery_is_present(), "Battery must be present");
+ zassume_true(IS_ENABLED(HAS_TASK_HOSTCMD) &&
*host_get_memmap(EC_MEMMAP_BATTERY_VERSION) != 0,
"Cannot access battery data");
@@ -171,7 +171,7 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, test_batt_cap_invalid)
ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_msg)
{
- zassert_equal(pd_broadcast_alert_msg(ADO_OTP_EVENT), EC_SUCCESS);
+ zassume_equal(pd_broadcast_alert_msg(ADO_OTP_EVENT), EC_SUCCESS);
k_sleep(K_SECONDS(2));
zassert_true(fixture->src_ext.alert_received);
@@ -186,8 +186,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_on_power_state_change)
zassert_true(fixture->src_ext.status_received);
tcpci_src_emul_clear_alert_received(&fixture->src_ext);
tcpci_src_emul_clear_status_received(&fixture->src_ext);
- zassert_false(fixture->src_ext.alert_received);
- zassert_false(fixture->src_ext.status_received);
+ zassume_false(fixture->src_ext.alert_received);
+ zassume_false(fixture->src_ext.status_received);
/* Shutdown and check partner received Alert and Status messages */
hook_notify(HOOK_CHIPSET_SHUTDOWN);
@@ -196,8 +196,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_on_power_state_change)
zassert_true(fixture->src_ext.status_received);
tcpci_src_emul_clear_alert_received(&fixture->src_ext);
tcpci_src_emul_clear_status_received(&fixture->src_ext);
- zassert_false(fixture->src_ext.alert_received);
- zassert_false(fixture->src_ext.status_received);
+ zassume_false(fixture->src_ext.alert_received);
+ zassume_false(fixture->src_ext.status_received);
/* Startup and check partner received Alert and Status messages */
hook_notify(HOOK_CHIPSET_STARTUP);
@@ -206,8 +206,8 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_alert_on_power_state_change)
zassert_true(fixture->src_ext.status_received);
tcpci_src_emul_clear_alert_received(&fixture->src_ext);
tcpci_src_emul_clear_status_received(&fixture->src_ext);
- zassert_false(fixture->src_ext.alert_received);
- zassert_false(fixture->src_ext.status_received);
+ zassume_false(fixture->src_ext.alert_received);
+ zassume_false(fixture->src_ext.status_received);
/* Resume and check partner received Alert and Status messages */
hook_notify(HOOK_CHIPSET_RESUME);
@@ -247,9 +247,9 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3,
/* Clear alert and status flags set during shutdown */
tcpci_src_emul_clear_alert_received(&fixture->src_ext);
tcpci_src_emul_clear_status_received(&fixture->src_ext);
- zassert_false(fixture->src_ext.alert_received);
- zassert_false(fixture->src_ext.status_received);
- zassert_true(chipset_in_state(CHIPSET_STATE_ANY_OFF));
+ zassume_false(fixture->src_ext.alert_received);
+ zassume_false(fixture->src_ext.status_received);
+ zassume_true(chipset_in_state(CHIPSET_STATE_ANY_OFF));
/* While in S5/G3 expect nothing on invalid (too long) press */
ado = ADO_EXTENDED_ALERT_EVENT | ADO_POWER_BUTTON_PRESS;
@@ -283,9 +283,9 @@ ZTEST_F(usb_attach_5v_3a_pd_source_rev3, verify_startup_on_pd_button_press)
/* Clear alert and status flags set during shutdown */
tcpci_src_emul_clear_alert_received(&fixture->src_ext);
tcpci_src_emul_clear_status_received(&fixture->src_ext);
- zassert_false(fixture->src_ext.alert_received);
- zassert_false(fixture->src_ext.status_received);
- zassert_true(chipset_in_state(CHIPSET_STATE_ANY_OFF));
+ zassume_false(fixture->src_ext.alert_received);
+ zassume_false(fixture->src_ext.status_received);
+ zassume_true(chipset_in_state(CHIPSET_STATE_ANY_OFF));
/* While in S5/G3 expect Alert->Get_Status->Status on valid press */
ado = ADO_EXTENDED_ALERT_EVENT | ADO_POWER_BUTTON_PRESS;
diff --git a/zephyr/test/drivers/default/src/isl923x.c b/zephyr/test/drivers/default/src/isl923x.c
index 1393466c76..e17dbbe797 100644
--- a/zephyr/test/drivers/default/src/isl923x.c
+++ b/zephyr/test/drivers/default/src/isl923x.c
@@ -3,21 +3,21 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/fff.h>
+
#include "battery.h"
#include "battery_smart.h"
+#include "test/drivers/charger_utils.h"
#include "driver/charger/isl923x.h"
#include "driver/charger/isl923x_public.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_isl923x.h"
#include "system.h"
-#include "test/drivers/charger_utils.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
BUILD_ASSERT(CONFIG_CHARGER_SENSE_RESISTOR == 10 ||
CONFIG_CHARGER_SENSE_RESISTOR == 5);
@@ -681,9 +681,9 @@ ZTEST(isl923x, test_init_late_jump)
isl923x_drv.get_input_current_limit(CHARGER_NUM,
&input_current),
"Could not read input current limit.");
- zassert_equal(CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT, input_current,
+ zassert_equal(CONFIG_CHARGER_INPUT_CURRENT, input_current,
"Input current (%d) not at (%d)", input_current,
- CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT);
+ CONFIG_CHARGER_INPUT_CURRENT);
}
ZTEST(isl923x, test_isl923x_is_acok)
diff --git a/zephyr/test/drivers/default/src/led.c b/zephyr/test/drivers/default/src/led.c
index 3f727599b4..e89a3d8b66 100644
--- a/zephyr/test/drivers/default/src/led.c
+++ b/zephyr/test/drivers/default/src/led.c
@@ -3,6 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/ztest_assert.h>
+
+#include <zephyr/device.h>
+#include <zephyr/drivers/pwm.h>
+
#include "ec_commands.h"
#include "led.h"
#include "led_common.h"
@@ -10,11 +16,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/device.h>
-#include <zephyr/drivers/pwm.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-
ZTEST_SUITE(pwm_led_driver, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
diff --git a/zephyr/test/drivers/default/src/lid_angle.c b/zephyr/test/drivers/default/src/lid_angle.c
index 3611e176d4..568057d95a 100644
--- a/zephyr/test/drivers/default/src/lid_angle.c
+++ b/zephyr/test/drivers/default/src/lid_angle.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "lid_angle.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
#define LID_ANGLE_MIN_LARGE_ANGLE 0
#define LID_ANGLE_MAX_LARGE_ANGLE 360
diff --git a/zephyr/test/drivers/default/src/lid_switch.c b/zephyr/test/drivers/default/src/lid_switch.c
index 2fe7daa85a..b5da1f6608 100644
--- a/zephyr/test/drivers/default/src/lid_switch.c
+++ b/zephyr/test/drivers/default/src/lid_switch.c
@@ -3,19 +3,18 @@
* found in the LICENSE file.
*/
-#include "ec_commands.h"
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
+#include <zephyr/ztest.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <lid_switch.h>
#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
-
#include <console.h>
-#include <lid_switch.h>
+
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "ec_commands.h"
+#include "host_command.h"
#define LID_GPIO_PATH DT_PATH(named_gpios, lid_open_ec)
#define LID_GPIO_PIN DT_GPIO_PIN(LID_GPIO_PATH, gpios)
@@ -50,8 +49,8 @@ static void *lid_switch_setup(void)
static void lid_switch_before(void *unused)
{
/* Make sure that interrupt fire at the next lid open/close */
- zassert_ok(emul_lid_close());
- zassert_ok(emul_lid_open());
+ zassume_ok(emul_lid_close());
+ zassume_ok(emul_lid_open());
k_sleep(K_MSEC(100));
}
diff --git a/zephyr/test/drivers/default/src/lis2dw12.c b/zephyr/test/drivers/default/src/lis2dw12.c
index 4cacf725ba..8f5e30e559 100644
--- a/zephyr/test/drivers/default/src/lis2dw12.c
+++ b/zephyr/test/drivers/default/src/lis2dw12.c
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/emul.h>
#include "driver/accel_lis2dw12.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_lis2dw12.h"
#include "test/drivers/test_state.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/ztest.h>
-
#define LIS2DW12_NODELABEL DT_NODELABEL(ms_lis2dw12_accel)
#define LIS2DW12_SENSOR_ID SENSOR_ID(LIS2DW12_NODELABEL)
#define LIS2DW12_EMUL_NODE DT_NODELABEL(lis2dw12_emul)
diff --git a/zephyr/test/drivers/default/src/ln9310.c b/zephyr/test/drivers/default/src/ln9310.c
index 509d6831ec..414c62287c 100644
--- a/zephyr/test/drivers/default/src/ln9310.c
+++ b/zephyr/test/drivers/default/src/ln9310.c
@@ -3,17 +3,17 @@
* found in the LICENSE file.
*/
-#include "driver/ln9310.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_ln9310.h"
-#include "test/drivers/test_state.h"
-#include "timer.h"
-
+#include <zephyr/ztest.h>
#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/i2c_emul.h>
#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
+#include <zephyr/drivers/i2c_emul.h>
+
+#include "driver/ln9310.h"
+#include "emul/emul_ln9310.h"
+#include "emul/emul_common_i2c.h"
+#include "timer.h"
+#include "test/drivers/test_state.h"
/*
* TODO(b/201420132): Implement approach for tests to immediately schedule work
diff --git a/zephyr/test/drivers/default/src/locate_chip.c b/zephyr/test/drivers/default/src/locate_chip.c
index c54031c5df..6842543971 100644
--- a/zephyr/test/drivers/default/src/locate_chip.c
+++ b/zephyr/test/drivers/default/src/locate_chip.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
#include <zephyr/shell/shell.h>
+#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "host_command.h"
+
/**
* @brief TestPurpose: test the TCPC locate valid case.
*/
diff --git a/zephyr/test/drivers/default/src/motion_sense/motion_sense.c b/zephyr/test/drivers/default/src/motion_sense/motion_sense.c
index 8291e0e1c6..42ee056874 100644
--- a/zephyr/test/drivers/default/src/motion_sense/motion_sense.c
+++ b/zephyr/test/drivers/default/src/motion_sense/motion_sense.c
@@ -3,12 +3,10 @@
* found in the LICENSE file.
*/
-#include "motion_sense.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/ztest.h>
-extern enum chipset_state_mask sensor_active;
+#include "motion_sense.h"
+#include "test/drivers/test_state.h"
ZTEST_SUITE(motion_sense, drivers_predicate_post_main, NULL, NULL, NULL, NULL);
@@ -35,17 +33,3 @@ ZTEST_USER(motion_sense, ec_motion_sensor_clamp_i16)
zassert_equal(ec_motion_sensor_clamp_i16(INT16_MIN - 1), INT16_MIN,
NULL);
}
-
-ZTEST_USER(motion_sense, ec_motion_sense_get_ec_config)
-{
- /* illegal state, should be translated to S5 */
- sensor_active = 42;
- zassert_equal(motion_sense_get_ec_config(), SENSOR_CONFIG_EC_S5);
- /* all valid states */
- sensor_active = SENSOR_ACTIVE_S0;
- zassert_equal(motion_sense_get_ec_config(), SENSOR_CONFIG_EC_S0);
- sensor_active = SENSOR_ACTIVE_S3;
- zassert_equal(motion_sense_get_ec_config(), SENSOR_CONFIG_EC_S3);
- sensor_active = SENSOR_ACTIVE_S5;
- zassert_equal(motion_sense_get_ec_config(), SENSOR_CONFIG_EC_S5);
-}
diff --git a/zephyr/test/drivers/default/src/panic.c b/zephyr/test/drivers/default/src/panic.c
index a2addc786d..7dcb18e4cf 100644
--- a/zephyr/test/drivers/default/src/panic.c
+++ b/zephyr/test/drivers/default/src/panic.c
@@ -8,17 +8,18 @@
* @brief Unit Tests for panic.
*/
+#include <zephyr/device.h>
+
+#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
#include "ec_tasks.h"
#include "panic.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
-#include <zephyr/device.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
-
struct panic_test_fixture {
struct panic_data saved_pdata;
};
diff --git a/zephyr/test/drivers/default/src/panic_output.c b/zephyr/test/drivers/default/src/panic_output.c
index f815744d8c..210c862901 100644
--- a/zephyr/test/drivers/default/src/panic_output.c
+++ b/zephyr/test/drivers/default/src/panic_output.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "panic.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST_SUITE(panic_output, drivers_predicate_post_main, NULL, NULL, NULL, NULL);
ZTEST(panic_output, test_panic_printf)
diff --git a/zephyr/test/drivers/default/src/port80.c b/zephyr/test/drivers/default/src/port80.c
index 6bde1392c7..8563c2e478 100644
--- a/zephyr/test/drivers/default/src/port80.c
+++ b/zephyr/test/drivers/default/src/port80.c
@@ -8,18 +8,19 @@
* @brief Unit Tests for ESPI port 80 writes
*/
+#include <zephyr/logging/log.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "host_command.h"
#include "port80.h"
+
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
/*
* Flush any existing writes.
*/
diff --git a/zephyr/test/drivers/default/src/power_common.c b/zephyr/test/drivers/default/src/power_common.c
index 2b8ba4ac88..f96fed9f05 100644
--- a/zephyr/test/drivers/default/src/power_common.c
+++ b/zephyr/test/drivers/default/src/power_common.c
@@ -3,30 +3,31 @@
* found in the LICENSE file.
*/
-#include "battery.h"
-#include "battery_smart.h"
+#include <string.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/shell/shell_dummy.h>
+#include <zephyr/shell/shell_uart.h>
+
#include "chipset.h"
#include "common.h"
-#include "ec_tasks.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_smart_battery.h"
#include "extpower.h"
#include "hooks.h"
#include "host_command.h"
#include "power.h"
-#include "task.h"
#include "test/drivers/stubs.h"
+#include "task.h"
+#include "ec_tasks.h"
#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include <string.h>
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_smart_battery.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/ztest.h>
+#include "battery.h"
+#include "battery_smart.h"
+#include "test/drivers/utils.h"
#define BATTERY_NODE DT_NODELABEL(battery)
@@ -487,19 +488,6 @@ ZTEST(power_common, power_console_cmd)
}
/**
- * Test powerinfo console command
- */
-ZTEST_USER(power_common, powerinfo_console_cmd)
-{
- char expected_buffer[32];
-
- snprintf(expected_buffer, sizeof(expected_buffer), "power state %d",
- power_get_state());
-
- CHECK_CONSOLE_CMD("powerinfo", expected_buffer, EC_SUCCESS);
-}
-
-/**
* Common setup for hibernation delay tests. Smart discharge zone is setup,
* battery is set in safe zone (which trigger hibernation), power state is
* set to G3 and AC is disabled. system_hibernate mock is reset.
diff --git a/zephyr/test/drivers/default/src/ppc_sn5s330.c b/zephyr/test/drivers/default/src/ppc_sn5s330.c
index 664d9fed36..eb595939fc 100644
--- a/zephyr/test/drivers/default/src/ppc_sn5s330.c
+++ b/zephyr/test/drivers/default/src/ppc_sn5s330.c
@@ -3,20 +3,20 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/device.h>
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/ztest.h>
+#include <zephyr/fff.h>
+
#include "driver/ppc/sn5s330.h"
#include "driver/ppc/sn5s330_public.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_sn5s330.h"
+#include "usbc_ppc.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include "usbc_ppc.h"
-
-#include <zephyr/device.h>
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
/** This must match the index of the sn5s330 in ppc_chips[] */
#define SN5S330_PORT 0
diff --git a/zephyr/test/drivers/default/src/ppc_syv682x.c b/zephyr/test/drivers/default/src/ppc_syv682x.c
index 6e1602804e..ba2e68f2ff 100644
--- a/zephyr/test/drivers/default/src/ppc_syv682x.c
+++ b/zephyr/test/drivers/default/src/ppc_syv682x.c
@@ -3,24 +3,24 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_syv682x.h"
-#include "syv682x.h"
-#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include "timer.h"
-#include "usbc_ppc.h"
-
#include <zephyr/device.h>
#include <zephyr/devicetree/gpio.h>
-#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/drivers/gpio.h>
#include <zephyr/fff.h>
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
+#include "emul/emul_common_i2c.h"
+#include "emul/emul_syv682x.h"
+#include "test/drivers/stubs.h"
+#include "syv682x.h"
+#include "timer.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
+#include "usbc_ppc.h"
+
#define SYV682X_NODE DT_NODELABEL(syv682x_emul)
#define GPIO_USB_C1_FRS_EN_PATH DT_PATH(named_gpios, usb_c1_frs_en)
@@ -46,10 +46,10 @@ static void *syv682x_test_setup(void)
fixture.ppc_emul = EMUL_DT_GET(SYV682X_NODE);
fixture.common_data =
emul_syv682x_get_i2c_common_data(fixture.ppc_emul);
- zassert_not_null(fixture.ppc_emul, NULL);
+ zassume_not_null(fixture.ppc_emul, NULL);
fixture.frs_en_gpio_port =
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_USB_C1_FRS_EN_PATH, gpios));
- zassert_not_null(fixture.frs_en_gpio_port, NULL);
+ zassume_not_null(fixture.frs_en_gpio_port, NULL);
fixture.frs_en_gpio_pin = DT_GPIO_PIN(GPIO_USB_C1_FRS_EN_PATH, gpios);
return &fixture;
@@ -62,7 +62,7 @@ static void syv682x_test_after(void *data)
struct i2c_common_emul_data *common_data = fixture->common_data;
/* Disable the power path and clear interrupt conditions. */
- zassert_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG,
+ zassume_ok(syv682x_emul_set_reg(emul, SYV682X_CONTROL_1_REG,
SYV682X_CONTROL_1_PWR_ENB),
NULL);
syv682x_emul_set_condition(emul, SYV682X_STATUS_NONE,
@@ -120,14 +120,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_dead_battery)
* With a dead battery, the device powers up sinking VBUS, and the
* driver should keep that going.
*/
- zassert_ok(syv682x_emul_set_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_set_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG,
SYV682X_CONTROL_1_CH_SEL),
NULL);
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_VSAFE_5V,
SYV682X_CONTROL_4_NONE);
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
NULL);
zassert_true(reg & SYV682X_CONTROL_1_CH_SEL,
@@ -144,14 +144,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_vsafe0v)
uint8_t reg;
/* With VBUS at vSafe0V, init should set the default configuration. */
- zassert_ok(syv682x_emul_set_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_set_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG,
SYV682X_CONTROL_1_PWR_ENB),
NULL);
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_VSAFE_0V,
SYV682X_CONTROL_4_NONE);
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
NULL);
check_control_1_default_init(reg);
@@ -162,14 +162,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_sink_disabled)
uint8_t reg;
/* With sink disabled, init should do the same thing. */
- zassert_ok(syv682x_emul_set_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_set_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG,
SYV682X_CONTROL_1_CH_SEL),
NULL);
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_VSAFE_0V,
SYV682X_CONTROL_4_NONE);
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
NULL);
check_control_1_default_init(reg);
@@ -181,7 +181,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_common)
int ilim;
zassert_ok(ppc_init(syv682x_port), "PPC init failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
NULL);
@@ -196,7 +196,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_common)
ilim = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
zassert_equal(ilim, CONFIG_PLATFORM_EC_USB_PD_PULLUP,
"Default init, but 5V current limit set to %d", ilim);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_2_REG, &reg),
NULL);
zassert_equal(reg,
@@ -205,14 +205,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_init_common)
<< SYV682X_DSG_RON_SHIFT) |
(SYV682X_DSG_TIME_50MS << SYV682X_DSG_TIME_SHIFT),
"Default init, but CONTROL_2 is 0x%x", reg);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_3_REG, &reg),
NULL);
zassert_equal(reg,
(SYV682X_OVP_23_7 << SYV682X_OVP_BIT_SHIFT) |
SYV682X_RVS_MASK,
"Default init, but CONTROL_3 is 0x%x", reg);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_4_REG, &reg),
NULL);
zassert_equal(reg & ~SYV682X_CONTROL_4_INT_MASK,
@@ -226,7 +226,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_source_enable)
zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
"VBUS enable failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
@@ -245,7 +245,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_source_disable)
ZTEST_F(ppc_syv682x, test_syv682x_interrupt_source_oc)
{
- zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
+ zassume_ok(ppc_vbus_source_enable(syv682x_port, true),
"VBUS enable failed");
/* An OC event less than 100 ms should not cause VBUS to turn off. */
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_OC_5V,
@@ -266,7 +266,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_tsd)
* (The device will have already physically disabled them.) The state of
* the sink path is not part of the driver's API.
*/
- zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
+ zassume_ok(ppc_vbus_source_enable(syv682x_port, true),
"Source enable failed");
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_TSD,
SYV682X_CONTROL_4_NONE);
@@ -278,7 +278,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_tsd)
ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_ovp)
{
/* An OVP event should cause the driver to disable the source path. */
- zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
+ zassume_ok(ppc_vbus_source_enable(syv682x_port, true),
"Source enable failed");
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_OVP,
SYV682X_CONTROL_4_NONE);
@@ -296,12 +296,12 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_hv_oc)
* re-enable the sink path until the OC count limit is reached, at which
* point the driver should leave it disabled.
*/
- zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
+ zassume_ok(ppc_vbus_sink_enable(syv682x_port, true),
"Sink enable failed");
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_OC_HV,
SYV682X_CONTROL_4_NONE);
msleep(1);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
@@ -310,7 +310,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_hv_oc)
SYV682X_CONTROL_4_NONE);
/* Alert GPIO doesn't change so wait for delayed syv682x interrupt */
msleep(15);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB, 0,
@@ -319,7 +319,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vbus_hv_oc)
SYV682X_CONTROL_4_NONE);
/* Alert GPIO doesn't change so wait for delayed syv682x interrupt */
msleep(15);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
zassert_equal(reg & SYV682X_CONTROL_1_PWR_ENB,
@@ -339,14 +339,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vconn_oc)
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_NONE,
SYV682X_CONTROL_4_VCONN_OCP);
msleep(1);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_true(reg & (SYV682X_CONTROL_4_VCONN1 |
SYV682X_CONTROL_4_VCONN2),
"VCONN disabled after initial VCONN OC");
msleep(50);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_true(reg & (SYV682X_CONTROL_4_VCONN1 |
@@ -357,7 +357,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vconn_oc)
* should turn VCONN off.
*/
msleep(60);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_false(reg & (SYV682X_CONTROL_4_VCONN1 |
@@ -379,7 +379,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_interrupt_vconn_ov)
syv682x_emul_set_condition(fixture->ppc_emul, SYV682X_STATUS_NONE,
SYV682X_CONTROL_4_VBAT_OVP);
msleep(1);
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_true(reg & SYV682X_CONTROL_4_CC1_BPS,
@@ -402,7 +402,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_frs_enable)
* polarity. Disabling FRS should enable both CC lines.
*/
ppc_vbus_sink_enable(syv682x_port, true);
- zassert_false(ppc_is_sourcing_vbus(syv682x_port),
+ zassume_false(ppc_is_sourcing_vbus(syv682x_port),
"PPC is sourcing VBUS after sink enabled");
ppc_set_polarity(syv682x_port, 0 /* CC1 */);
ppc_set_frs_enable(syv682x_port, true);
@@ -424,14 +424,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_frs_disable)
uint8_t reg;
ppc_vbus_sink_enable(syv682x_port, true);
- zassert_false(ppc_is_sourcing_vbus(syv682x_port),
+ zassume_false(ppc_is_sourcing_vbus(syv682x_port),
"PPC is sourcing VBUS after sink enabled");
ppc_set_polarity(syv682x_port, 0 /* CC1 */);
ppc_set_frs_enable(syv682x_port, false);
zassert_equal(gpio_emul_output_get(gpio_dev, fixture->frs_en_gpio_pin),
0, "FRS disabled, but FRS GPIO not deasserted");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_4_REG, &reg),
"Reading CONTROL_4 failed");
zassert_equal(
@@ -463,7 +463,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_source_current_limit_usb_default)
zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port,
TYPEC_RP_USB),
"Could not set source current limit");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
@@ -479,7 +479,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_source_current_limit_1500ma)
zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port,
TYPEC_RP_1A5),
"Could not set source current limit");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
@@ -495,7 +495,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_source_current_limit_3000ma)
zassert_ok(ppc_set_vbus_source_current_limit(syv682x_port,
TYPEC_RP_3A0),
"Could not set source current limit");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
"Reading CONTROL_1 failed");
ilim_val = (reg & SYV682X_5V_ILIM_MASK) >> SYV682X_5V_ILIM_BIT_SHIFT;
@@ -561,7 +561,7 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_sink_enable_trivial)
* If VBUS source is already enabled, disabling VBUS sink should
* trivially succeed.
*/
- zassert_ok(ppc_vbus_source_enable(syv682x_port, true),
+ zassume_ok(ppc_vbus_source_enable(syv682x_port, true),
"VBUS enable failed");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, false),
"Sink disable failed");
@@ -576,11 +576,11 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_sink_enable_power_path)
* After enabling VBUS sink, the HV power path should be enabled in sink
* mode with the configured current limit.
*/
- zassert_ok(ppc_vbus_source_enable(syv682x_port, false),
+ zassume_ok(ppc_vbus_source_enable(syv682x_port, false),
"VBUS enable failed");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
"Sink disable failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
NULL);
zassert_true(reg & SYV682X_CONTROL_1_CH_SEL,
@@ -598,14 +598,14 @@ ZTEST_F(ppc_syv682x, test_syv682x_vbus_sink_disable)
{
uint8_t reg;
- zassert_ok(ppc_vbus_source_enable(syv682x_port, false),
+ zassume_ok(ppc_vbus_source_enable(syv682x_port, false),
"VBUS enable failed");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, true),
"Sink disable failed");
zassert_ok(ppc_vbus_sink_enable(syv682x_port, false),
"Sink disable failed");
- zassert_ok(syv682x_emul_get_reg(fixture->ppc_emul,
+ zassume_ok(syv682x_emul_get_reg(fixture->ppc_emul,
SYV682X_CONTROL_1_REG, &reg),
NULL);
zassert_true(reg & SYV682X_CONTROL_1_PWR_ENB,
diff --git a/zephyr/test/drivers/default/src/ps8xxx.c b/zephyr/test/drivers/default/src/ps8xxx.c
index cb0ac7d2d5..2aa1844c10 100644
--- a/zephyr/test/drivers/default/src/ps8xxx.c
+++ b/zephyr/test/drivers/default/src/ps8xxx.c
@@ -3,21 +3,22 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
-#include "driver/tcpm/ps8xxx.h"
-#include "driver/tcpm/ps8xxx_public.h"
#include "emul/emul_common_i2c.h"
-#include "emul/tcpc/emul_ps8xxx.h"
#include "emul/tcpc/emul_tcpci.h"
+#include "emul/tcpc/emul_ps8xxx.h"
+#include "timer.h"
#include "i2c.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
#include "test/drivers/tcpci_test_common.h"
-#include "test/drivers/test_state.h"
-#include "timer.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "tcpm/tcpci.h"
+#include "driver/tcpm/ps8xxx.h"
+#include "driver/tcpm/ps8xxx_public.h"
+#include "test/drivers/test_state.h"
#define PS8XXX_EMUL_NODE DT_NODELABEL(ps8xxx_emul)
@@ -1410,7 +1411,7 @@ static void ps8805_before(void *state)
board_set_ps8xxx_product_id(PS8805_PRODUCT_ID);
ps8xxx_emul_set_product_id(ps8xxx_emul, PS8805_PRODUCT_ID);
setup_no_fail_all();
- zassert_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1));
+ zassume_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1));
}
static void ps8805_after(void *state)
@@ -1435,7 +1436,7 @@ static void ps8815_before(void *state)
ps8xxx_emul_set_reg_id(ps8xxx_emul, PS8815_REG_ID);
ps8xxx_emul_set_product_id(ps8xxx_emul, PS8815_PRODUCT_ID);
setup_no_fail_all();
- zassert_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1));
+ zassume_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1));
}
static void ps8815_after(void *state)
@@ -1460,7 +1461,7 @@ static void ps8745_before(void *state)
ps8xxx_emul_set_product_id(ps8xxx_emul, PS8815_PRODUCT_ID);
ps8xxx_emul_set_reg_id(ps8xxx_emul, PS8745_REG_ID);
setup_no_fail_all();
- zassert_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1), NULL);
+ zassume_equal(EC_SUCCESS, ps8xxx_tcpm_drv.init(USBC_PORT_C1), NULL);
}
static void ps8745_after(void *state)
diff --git a/zephyr/test/drivers/default/src/smart.c b/zephyr/test/drivers/default/src/smart.c
index a26d84b93c..9db292ac96 100644
--- a/zephyr/test/drivers/default/src/smart.c
+++ b/zephyr/test/drivers/default/src/smart.c
@@ -3,19 +3,20 @@
* found in the LICENSE file.
*/
-#include "battery.h"
-#include "battery_smart.h"
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/shell/shell_uart.h>
+
#include "common.h"
#include "console.h"
+#include "i2c.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_smart_battery.h"
-#include "i2c.h"
-#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/ztest.h>
+#include "battery.h"
+#include "battery_smart.h"
+#include "test/drivers/test_state.h"
#define BATTERY_NODE DT_NODELABEL(battery)
diff --git a/zephyr/test/drivers/default/src/stm_mems_common.c b/zephyr/test/drivers/default/src/stm_mems_common.c
index 09f1cf8506..f7c59105b0 100644
--- a/zephyr/test/drivers/default/src/stm_mems_common.c
+++ b/zephyr/test/drivers/default/src/stm_mems_common.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/device.h>
+#include <zephyr/devicetree.h>
+#include <errno.h>
+
#include "common.h"
#include "driver/stm_mems_common.h"
#include "emul/emul_common_i2c.h"
@@ -10,12 +15,6 @@
#include "i2c/i2c.h"
#include "test/drivers/test_state.h"
-#include <errno.h>
-
-#include <zephyr/device.h>
-#include <zephyr/devicetree.h>
-#include <zephyr/ztest.h>
-
#define MOCK_EMUL EMUL_DT_GET(DT_NODELABEL(i2c_mock))
#define COMMON_DATA emul_i2c_mock_get_i2c_common_data(MOCK_EMUL)
diff --git a/zephyr/test/drivers/default/src/tablet_mode.c b/zephyr/test/drivers/default/src/tablet_mode.c
index 773f2c2bf8..d600d26072 100644
--- a/zephyr/test/drivers/default/src/tablet_mode.c
+++ b/zephyr/test/drivers/default/src/tablet_mode.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "tablet_mode.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
static void tabletmode_before(void *state)
{
ARG_UNUSED(state);
@@ -34,31 +34,27 @@ ZTEST_USER(tabletmode, test_tablet_set_mode)
int ret;
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet initial mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet initial mode: %d", ret);
tablet_set_mode(1, TABLET_TRIGGER_LID);
+
ret = tablet_get_mode();
- zassert_equal(ret, 1, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 1, "unexepcted tablet mode: %d", ret);
tablet_set_mode(1, TABLET_TRIGGER_BASE);
+
ret = tablet_get_mode();
- zassert_equal(ret, 1, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 1, "unexepcted tablet mode: %d", ret);
- /**
- * Tablet mode should remain enabled, since both _LID and _BASE were set
- * previously, and this only clears _LID.
- */
tablet_set_mode(0, TABLET_TRIGGER_LID);
+
ret = tablet_get_mode();
- zassert_equal(ret, 1, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 1, "unexepcted tablet mode: %d", ret);
- /**
- * Both _LID and _BASE are now cleared, so DUT is no longer in tablet
- * mode.
- */
tablet_set_mode(0, TABLET_TRIGGER_BASE);
+
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet mode: %d", ret);
}
/**
@@ -69,13 +65,13 @@ ZTEST_USER(tabletmode, test_tablet_disable)
int ret;
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet initial mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet initial mode: %d", ret);
tablet_disable();
tablet_set_mode(1, TABLET_TRIGGER_LID);
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet mode: %d", ret);
}
/**
@@ -86,28 +82,28 @@ ZTEST_USER(tabletmode, test_settabletmode_on_off)
int ret;
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet initial mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet initial mode: %d", ret);
ret = shell_execute_cmd(get_ec_shell(), "tabletmode");
- zassert_equal(ret, EC_SUCCESS, "unexpected command return status: %d",
+ zassert_equal(ret, EC_SUCCESS, "unexepcted command return status: %d",
ret);
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet mode: %d", ret);
ret = shell_execute_cmd(get_ec_shell(), "tabletmode on");
- zassert_equal(ret, EC_SUCCESS, "unexpected command return status: %d",
+ zassert_equal(ret, EC_SUCCESS, "unexepcted command return status: %d",
ret);
ret = tablet_get_mode();
- zassert_equal(ret, 1, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 1, "unexepcted tablet mode: %d", ret);
ret = shell_execute_cmd(get_ec_shell(), "tabletmode off");
- zassert_equal(ret, EC_SUCCESS, "unexpected command return status: %d",
+ zassert_equal(ret, EC_SUCCESS, "unexepcted command return status: %d",
ret);
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet mode: %d", ret);
}
/**
@@ -119,28 +115,28 @@ ZTEST_USER(tabletmode, test_settabletmode_forced)
int ret;
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet initial mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet initial mode: %d", ret);
ret = shell_execute_cmd(get_ec_shell(), "tabletmode on");
- zassert_equal(ret, EC_SUCCESS, "unexpected command return status: %d",
+ zassert_equal(ret, EC_SUCCESS, "unexepcted command return status: %d",
ret);
ret = tablet_get_mode();
- zassert_equal(ret, 1, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 1, "unexepcted tablet mode: %d", ret);
tablet_set_mode(0, TABLET_TRIGGER_LID);
ret = tablet_get_mode();
- zassert_equal(ret, 1, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 1, "unexepcted tablet mode: %d", ret);
ret = shell_execute_cmd(get_ec_shell(), "tabletmode reset");
- zassert_equal(ret, EC_SUCCESS, "unexpected command return status: %d",
+ zassert_equal(ret, EC_SUCCESS, "unexepcted command return status: %d",
ret);
tablet_set_mode(0, TABLET_TRIGGER_LID);
ret = tablet_get_mode();
- zassert_equal(ret, 0, "unexpected tablet mode: %d", ret);
+ zassert_equal(ret, 0, "unexepcted tablet mode: %d", ret);
}
/**
@@ -153,7 +149,7 @@ ZTEST_USER(tabletmode, test_settabletmode_too_many_args)
ret = shell_execute_cmd(get_ec_shell(),
"tabletmode too many arguments");
zassert_equal(ret, EC_ERROR_PARAM_COUNT,
- "unexpected command return status: %d", ret);
+ "unexepcted command return status: %d", ret);
}
/**
@@ -165,7 +161,7 @@ ZTEST_USER(tabletmode, test_settabletmode_unknown_arg)
ret = shell_execute_cmd(get_ec_shell(), "tabletmode X");
zassert_equal(ret, EC_ERROR_PARAM1,
- "unexpected command return status: %d", ret);
+ "unexepcted command return status: %d", ret);
}
ZTEST_SUITE(tabletmode, drivers_predicate_post_main, NULL, tabletmode_before,
diff --git a/zephyr/test/drivers/default/src/task.c b/zephyr/test/drivers/default/src/task.c
deleted file mode 100644
index 4c4087c5a1..0000000000
--- a/zephyr/test/drivers/default/src/task.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "task.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include "timer.h"
-
-#include <zephyr/ztest.h>
-
-struct tasks_fixture {
- timestamp_t fake_time;
-};
-
-static void *setup(void)
-{
- static struct tasks_fixture fixture;
-
- return &fixture;
-}
-
-static void before(void *f)
-{
- struct tasks_fixture *fixture = f;
-
- fixture->fake_time.val = 0;
-}
-
-static void after(void *f)
-{
- ARG_UNUSED(f);
-
- get_time_mock = NULL;
-}
-
-ZTEST_SUITE(tasks, drivers_predicate_post_main, setup, before, after, NULL);
-
-ZTEST(tasks, test_enable_irq)
-{
- arch_irq_disable(0);
- task_enable_irq(0);
- zassert_true(arch_irq_is_enabled(0));
-}
-
-ZTEST(tasks, test_interrupt_context)
-{
- zassert_false(in_interrupt_context());
-}
-
-ZTEST_F(tasks, test_timer_arm_before_now)
-{
- timestamp_t deadline = {
- .val = 5,
- };
-
- fixture->fake_time.val = 15;
- get_time_mock = &fixture->fake_time;
-
- zassert_ok(timer_arm(deadline, TASK_ID_MOTIONSENSE));
- zassert_equal(*task_get_event_bitmap(TASK_ID_MOTIONSENSE) &
- TASK_EVENT_TIMER,
- TASK_EVENT_TIMER);
-}
-
-ZTEST_F(tasks, test_timer_arm_busy)
-{
- timestamp_t deadline = {
- .val = UINT64_C(5000000),
- };
-
- fixture->fake_time.val = 0;
- get_time_mock = &fixture->fake_time;
-
- zassert_ok(timer_arm(deadline, TASK_ID_MOTIONSENSE));
- zassert_equal(EC_ERROR_BUSY, timer_arm(deadline, TASK_ID_MOTIONSENSE));
-}
-
-ZTEST(tasks, test_get_event_bitmap_invalid_tid)
-{
- zassert_is_null(
- task_get_event_bitmap(TASK_ID_COUNT + EXTRA_TASK_COUNT));
-}
diff --git a/zephyr/test/drivers/default/src/tcpci.c b/zephyr/test/drivers/default/src/tcpci.c
index f648b43a96..db0ad076ab 100644
--- a/zephyr/test/drivers/default/src/tcpci.c
+++ b/zephyr/test/drivers/default/src/tcpci.c
@@ -3,27 +3,25 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "common.h"
#include "ec_tasks.h"
#include "emul/emul_common_i2c.h"
#include "emul/tcpc/emul_tcpci.h"
#include "hooks.h"
#include "i2c.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
#include "test/drivers/tcpci_test_common.h"
-#include "test/drivers/test_state.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "tcpm/tcpci.h"
+#include "test/drivers/test_state.h"
#define TCPCI_EMUL_NODE DT_NODELABEL(tcpci_emul)
-/* Convenience pointer directly to the TCPCI mux under test */
-static struct usb_mux *tcpci_usb_mux;
-
/** Test TCPCI init and vbus level */
ZTEST(tcpci, test_generic_tcpci_init)
{
@@ -290,13 +288,13 @@ ZTEST(tcpci, test_generic_tcpci_debug_accessory)
/* Setup TCPCI usb mux to behave as it is used only for usb mux */
static void set_usb_mux_not_tcpc(void)
{
- tcpci_usb_mux->flags = USB_MUX_FLAG_NOT_TCPC;
+ usbc0_mux0.flags = USB_MUX_FLAG_NOT_TCPC;
}
/* Setup TCPCI usb mux to behave as it is used for usb mux and TCPC */
static void set_usb_mux_tcpc(void)
{
- tcpci_usb_mux->flags = 0;
+ usbc0_mux0.flags = 0;
}
/** Test TCPCI mux init */
@@ -533,6 +531,7 @@ void validate_mux_read_write16(const struct usb_mux *tcpci_usb_mux)
/** Test usb_mux read/write APIs */
ZTEST(tcpci, test_usb_mux_read_write)
{
+ struct usb_mux *tcpci_usb_mux = &usbc0_mux0;
const int flags_restore = tcpci_usb_mux->flags;
/* Configure mux read/writes for TCPC APIs */
@@ -553,8 +552,6 @@ static void *tcpci_setup(void)
&tcpci_tcpm_usb_mux_driver,
"Invalid config of usb_muxes in test/drivers/src/stubs.c");
- tcpci_usb_mux = (struct usb_mux *)usb_muxes[USBC_PORT_C0].mux;
-
return NULL;
}
diff --git a/zephyr/test/drivers/default/src/tcpci_test_common.c b/zephyr/test/drivers/default/src/tcpci_test_common.c
index 06f03d4834..bbc1e3f8b0 100644
--- a/zephyr/test/drivers/default/src/tcpci_test_common.c
+++ b/zephyr/test/drivers/default/src/tcpci_test_common.c
@@ -3,14 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
#include "emul/emul_common_i2c.h"
#include "emul/tcpc/emul_tcpci.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/tcpci_test_common.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "tcpm/tcpci.h"
/** Check TCPC register value */
void check_tcpci_reg_f(const struct emul *emul, int reg, uint16_t exp_val,
@@ -1019,7 +1020,7 @@ void test_tcpci_hard_reset_reinit(const struct emul *emul,
uint16_t power_status_mask;
uint16_t alert_mask;
- zassert_equal(EC_SUCCESS, drv->init(port), NULL);
+ zassume_equal(EC_SUCCESS, drv->init(port), NULL);
tcpci_emul_get_reg(emul, TCPC_REG_POWER_STATUS_MASK,
&power_status_mask);
tcpci_emul_get_reg(emul, TCPC_REG_ALERT_MASK, &alert_mask);
diff --git a/zephyr/test/drivers/default/src/tcpm_header.c b/zephyr/test/drivers/default/src/tcpm_header.c
deleted file mode 100644
index e03e09aaa5..0000000000
--- a/zephyr/test/drivers/default/src/tcpm_header.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "tcpm/tcpm.h"
-#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
-#define TCPM_TEST_PORT USBC_PORT_C0
-
-FAKE_VALUE_FUNC(int, set_vconn, int, int);
-FAKE_VALUE_FUNC(int, reset_bist_type_2, int);
-FAKE_VALUE_FUNC(int, debug_accessory, int, bool);
-FAKE_VALUE_FUNC(int, debug_detach, int);
-FAKE_VALUE_FUNC(int, hard_reset_reinit, int);
-FAKE_VALUE_FUNC(int, set_frs_enable, int, int);
-FAKE_VOID_FUNC(tcpc_dump_std_registers, int);
-
-struct tcpm_header_fixture {
- /* The original driver pointer that gets restored after the tests */
- const struct tcpm_drv *saved_driver_ptr;
- /* Mock driver that gets substituted */
- struct tcpm_drv mock_driver;
- /* Saved tcpc config flags that get restored after the tests */
- uint32_t saved_tcpc_flags;
-};
-
-ZTEST_F(tcpm_header, test_tcpm_header_drv_set_vconn_failure)
-{
- int res;
-
- tcpc_config[TCPM_TEST_PORT].flags = TCPC_FLAGS_CONTROL_VCONN;
-
- fixture->mock_driver.set_vconn = set_vconn;
- set_vconn_fake.return_val = -1;
-
- res = tcpm_set_vconn(TCPM_TEST_PORT, true);
-
- zassert_true(set_vconn_fake.call_count > 0);
- zassert_equal(-1, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_reset_bist_type_2__unimplemented)
-{
- zassert_ok(tcpm_reset_bist_type_2(TCPM_TEST_PORT));
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_reset_bist_type_2__implemented)
-{
- int res;
- const int driver_return_code = 7458; /* arbitrary */
-
- fixture->mock_driver.reset_bist_type_2 = reset_bist_type_2;
- reset_bist_type_2_fake.return_val = driver_return_code;
- res = tcpm_reset_bist_type_2(TCPM_TEST_PORT);
-
- zassert_equal(1, reset_bist_type_2_fake.call_count);
- zassert_equal(TCPM_TEST_PORT, reset_bist_type_2_fake.arg0_history[0]);
- zassert_equal(driver_return_code, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_debug_accessory__unimplemented)
-{
- zassert_ok(tcpm_debug_accessory(TCPM_TEST_PORT, true));
- zassert_ok(tcpm_debug_accessory(TCPM_TEST_PORT, false));
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_debug_accessory__implemented)
-{
- int res;
- const int driver_return_code = 7458; /* arbitrary */
-
- fixture->mock_driver.debug_accessory = debug_accessory;
- debug_accessory_fake.return_val = driver_return_code;
- res = tcpm_debug_accessory(TCPM_TEST_PORT, true);
-
- zassert_equal(1, debug_accessory_fake.call_count);
- zassert_equal(TCPM_TEST_PORT, debug_accessory_fake.arg0_history[0]);
- zassert_true(debug_accessory_fake.arg1_history[0]);
- zassert_equal(driver_return_code, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_debug_detach__unimplemented)
-{
- zassert_ok(tcpm_debug_detach(TCPM_TEST_PORT));
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_debug_detach__implemented)
-{
- int res;
- const int driver_return_code = 7458; /* arbitrary */
-
- fixture->mock_driver.debug_detach = debug_detach;
- debug_detach_fake.return_val = driver_return_code;
- res = tcpm_debug_detach(TCPM_TEST_PORT);
-
- zassert_equal(1, debug_detach_fake.call_count);
- zassert_equal(TCPM_TEST_PORT, debug_detach_fake.arg0_history[0]);
- zassert_equal(driver_return_code, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_hard_reset_reinit__unimplemented)
-{
- int res;
-
- res = tcpm_hard_reset_reinit(TCPM_TEST_PORT);
-
- zassert_equal(EC_ERROR_UNIMPLEMENTED, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_hard_reset_reinit__implemented)
-{
- int res;
- const int driver_return_code = 7458; /* arbitrary */
-
- fixture->mock_driver.hard_reset_reinit = hard_reset_reinit;
- hard_reset_reinit_fake.return_val = driver_return_code;
- res = tcpm_hard_reset_reinit(TCPM_TEST_PORT);
-
- zassert_equal(1, hard_reset_reinit_fake.call_count);
- zassert_equal(TCPM_TEST_PORT, hard_reset_reinit_fake.arg0_history[0]);
- zassert_equal(driver_return_code, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_tcpc_has_frs_control__flag)
-{
- Z_TEST_SKIP_IFNDEF(CONFIG_PLATFORM_EC_USB_PD_FRS);
- Z_TEST_SKIP_IFDEF(CONFIG_PLATFORM_EC_USB_PD_FRS_TCPC);
-
- /* Determined by tcpc flag when USB_PD_FRS_TCPC is not set. */
-
- tcpc_config[TCPM_TEST_PORT].flags = 0;
- zassert_equal(0, tcpm_tcpc_has_frs_control(TCPM_TEST_PORT));
-
- tcpc_config[TCPM_TEST_PORT].flags = TCPC_FLAGS_CONTROL_FRS;
- zassert_equal(1, tcpm_tcpc_has_frs_control(TCPM_TEST_PORT));
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_set_frs_enable__unimplemented)
-{
- Z_TEST_SKIP_IFNDEF(CONFIG_PLATFORM_EC_USB_PD_FRS);
-
- zassert_ok(tcpm_set_frs_enable(TCPM_TEST_PORT, 1));
- zassert_ok(tcpm_set_frs_enable(TCPM_TEST_PORT, 0));
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_set_frs_enable__implemented)
-{
- int res;
- const int driver_return_code = 7458; /* arbitrary */
-
- Z_TEST_SKIP_IFNDEF(CONFIG_PLATFORM_EC_USB_PD_FRS);
-
- fixture->mock_driver.set_frs_enable = set_frs_enable;
- set_frs_enable_fake.return_val = driver_return_code;
- res = tcpm_set_frs_enable(TCPM_TEST_PORT, 1);
-
- zassert_equal(1, set_frs_enable_fake.call_count);
- zassert_equal(TCPM_TEST_PORT, set_frs_enable_fake.arg0_history[0]);
- zassert_equal(1, set_frs_enable_fake.arg1_history[0]);
- zassert_equal(driver_return_code, res);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_tcpc_get_bist_test_mode__unimplemented)
-{
- int res;
- bool enabled = true; /* Should be overwritten to false */
-
- res = tcpc_get_bist_test_mode(TCPM_TEST_PORT, &enabled);
-
- zassert_equal(EC_ERROR_UNIMPLEMENTED, res);
- zassert_false(enabled);
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_get_chip_info__unimplemented)
-{
- zassert_equal(EC_ERROR_UNIMPLEMENTED,
- tcpm_get_chip_info(TCPM_TEST_PORT, 0, NULL));
-}
-
-ZTEST_F(tcpm_header, test_tcpm_header_dump_registers__std)
-{
- Z_TEST_SKIP_IFNDEF(CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP);
-
- /*
- * The driver does not implement dump_registers, so the
- * standard ones should be dumped instead.
- */
- tcpm_dump_registers(TCPM_TEST_PORT);
-
- zassert_equal(1, tcpc_dump_std_registers_fake.call_count);
- zassert_equal(TCPM_TEST_PORT,
- tcpc_dump_std_registers_fake.arg0_history[0]);
-}
-
-static void *tcpm_header_setup(void)
-{
- static struct tcpm_header_fixture fixture;
-
- return &fixture;
-}
-
-static void tcpm_header_before(void *state)
-{
- struct tcpm_header_fixture *fixture = state;
-
- RESET_FAKE(set_vconn);
- RESET_FAKE(reset_bist_type_2);
- RESET_FAKE(debug_accessory);
- RESET_FAKE(debug_detach);
- RESET_FAKE(hard_reset_reinit);
- RESET_FAKE(set_frs_enable);
- RESET_FAKE(tcpc_dump_std_registers);
-
- fixture->mock_driver = (struct tcpm_drv){ 0 };
- fixture->saved_driver_ptr = tcpc_config[TCPM_TEST_PORT].drv;
- tcpc_config[TCPM_TEST_PORT].drv = &fixture->mock_driver;
-
- fixture->saved_tcpc_flags = tcpc_config[TCPM_TEST_PORT].flags;
-}
-
-static void tcpm_header_after(void *state)
-{
- struct tcpm_header_fixture *fixture = state;
-
- tcpc_config[TCPM_TEST_PORT].drv = fixture->saved_driver_ptr;
- tcpc_config[TCPM_TEST_PORT].flags = fixture->saved_tcpc_flags;
-}
-
-ZTEST_SUITE(tcpm_header, drivers_predicate_pre_main, tcpm_header_setup,
- tcpm_header_before, tcpm_header_after, NULL);
diff --git a/zephyr/test/drivers/default/src/tcs3400.c b/zephyr/test/drivers/default/src/tcs3400.c
index dba8dc5c56..045451169e 100644
--- a/zephyr/test/drivers/default/src/tcs3400.c
+++ b/zephyr/test/drivers/default/src/tcs3400.c
@@ -3,18 +3,19 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
-#include "driver/als_tcs3400.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_tcs3400.h"
#include "i2c.h"
+#include "emul/emul_tcs3400.h"
+#include "emul/emul_common_i2c.h"
+
#include "motion_sense.h"
#include "motion_sense_fifo.h"
+#include "driver/als_tcs3400.h"
#include "test/drivers/test_state.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
#define TCS_NODE DT_NODELABEL(tcs_emul)
#define TCS_CLR_SENSOR_ID SENSOR_ID(DT_NODELABEL(tcs3400_clear))
#define TCS_RGB_SENSOR_ID SENSOR_ID(DT_NODELABEL(tcs3400_rgb))
diff --git a/zephyr/test/drivers/default/src/temp_sensor.c b/zephyr/test/drivers/default/src/temp_sensor.c
index 83d9aa3812..61441a0229 100644
--- a/zephyr/test/drivers/default/src/temp_sensor.c
+++ b/zephyr/test/drivers/default/src/temp_sensor.c
@@ -3,24 +3,19 @@
* found in the LICENSE file.
*/
-#include "common.h"
-#include "driver/temp_sensor/pct2075.h"
-#include "emul/emul_pct2075.h"
-#include "math_util.h"
-#include "temp_sensor.h"
-#include "temp_sensor/temp_sensor.h"
-#include "test/drivers/test_state.h"
-#include "timer.h"
-
-#include <math.h>
-
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
#include <zephyr/drivers/adc.h>
#include <zephyr/drivers/adc/adc_emul.h>
-#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+
+#include <math.h>
+
+#include "common.h"
+#include "temp_sensor.h"
+#include "temp_sensor/temp_sensor.h"
+#include "test/drivers/test_state.h"
#define GPIO_PG_EC_DSW_PWROK_PATH DT_PATH(named_gpios, pg_ec_dsw_pwrok)
#define GPIO_PG_EC_DSW_PWROK_PORT DT_GPIO_PIN(GPIO_PG_EC_DSW_PWROK_PATH, gpios)
@@ -115,11 +110,6 @@ ZTEST_USER(temp_sensor, test_temp_sensor_pg_pin)
named_temp_pp3300_regulator)),
&temp),
NULL);
- zassert_equal(
- EC_ERROR_NOT_POWERED,
- temp_sensor_read(TEMP_SENSOR_ID(DT_NODELABEL(named_pct2075)),
- &temp),
- NULL);
/* power ADC */
zassert_ok(gpio_emul_input_set(gpio_dev, GPIO_EC_PG_PIN_TEMP_PORT, 1),
@@ -189,92 +179,12 @@ ZTEST_USER(temp_sensor, test_temp_sensor_read)
}
}
-/** Test if temp_sensor_read() returns temperature on success for PCT2075 */
-ZTEST_USER(temp_sensor, test_temp_sensor_pct2075)
-{
- int temp;
- const struct emul *dev = EMUL_DT_GET(DT_NODELABEL(pct2075_emul));
- int mk[] = {
- MILLI_CELSIUS_TO_MILLI_KELVIN(127000),
- MILLI_CELSIUS_TO_MILLI_KELVIN(126850),
- MILLI_CELSIUS_TO_MILLI_KELVIN(125),
- MILLI_CELSIUS_TO_MILLI_KELVIN(0),
- MILLI_CELSIUS_TO_MILLI_KELVIN(-125),
- MILLI_CELSIUS_TO_MILLI_KELVIN(-54875),
- MILLI_CELSIUS_TO_MILLI_KELVIN(-55000),
- };
-
- for (int i = 0; i < ARRAY_SIZE(mk); i++) {
- pct2075_emul_set_temp(dev, mk[i]);
- /* Highly dependent on current implementation. The sensor
- * update temperature in the 1 second periodic hook, so
- * we need to wait for it.
- */
- msleep(1100);
- zassert_equal(EC_SUCCESS,
- temp_sensor_read(TEMP_SENSOR_ID(DT_NODELABEL(
- named_pct2075)),
- &temp));
- zassert_equal(MILLI_KELVIN_TO_KELVIN(mk[i]), temp);
- }
-}
-
-/** Test if temperature is not updated on I2C read fail.
- * The test highly dependent on current implementation - temp_sensor_read
- * doesn't return an error on the i2c read fail, which can/should be changed
- * in the future.
- */
-ZTEST_USER(temp_sensor, test_temp_sensor_pct2075_fail)
-{
- const struct emul *dev = EMUL_DT_GET(DT_NODELABEL(pct2075_emul));
- struct pct2075_data *data = (struct pct2075_data *)dev->data;
- int mk1 = 373000, mk2 = 273000;
- int temp;
-
- /* Set initial temperature */
- pct2075_emul_set_temp(dev, mk1);
- msleep(1100);
-
- zassert_equal(EC_SUCCESS, temp_sensor_read(TEMP_SENSOR_ID(DT_NODELABEL(
- named_pct2075)),
- &temp));
- /* Make sure the temperature is read correctly */
- zassert_equal(MILLI_KELVIN_TO_KELVIN(mk1), temp);
-
- /* Set I2C fail on the temperature register */
- i2c_common_emul_set_read_fail_reg(&data->common, PCT2075_REG_TEMP);
- pct2075_emul_set_temp(dev, mk2);
- /* Wait for potential update */
- msleep(1100);
-
- /* Make sure the temperature is not changed */
- zassert_equal(EC_SUCCESS, temp_sensor_read(TEMP_SENSOR_ID(DT_NODELABEL(
- named_pct2075)),
- &temp));
- zassert_equal(MILLI_KELVIN_TO_KELVIN(mk1), temp);
-
- /* Restore I2C */
- i2c_common_emul_set_read_fail_reg(&data->common,
- I2C_COMMON_EMUL_NO_FAIL_REG);
- /* Wait for update */
- msleep(1100);
- /* Make sure the temperature is updated */
- zassert_equal(EC_SUCCESS, temp_sensor_read(TEMP_SENSOR_ID(DT_NODELABEL(
- named_pct2075)),
- &temp));
- zassert_equal(MILLI_KELVIN_TO_KELVIN(mk2), temp);
-}
-
static void *temp_sensor_setup(void)
{
const struct device *dev =
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_PG_EC_DSW_PWROK_PATH, gpios));
const struct device *dev_pin =
DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_EC_PG_PIN_TEMP_PATH, gpios));
- const struct emul *pct2075_dev =
- EMUL_DT_GET(DT_NODELABEL(pct2075_emul));
- struct pct2075_data *pct2075_data =
- (struct pct2075_data *)pct2075_dev->data;
zassert_not_null(dev, NULL);
/* Before tests make sure that power pins are set. */
@@ -283,9 +193,6 @@ static void *temp_sensor_setup(void)
zassert_ok(gpio_emul_input_set(dev_pin, GPIO_EC_PG_PIN_TEMP_PORT, 1),
NULL);
- i2c_common_emul_set_read_fail_reg(&pct2075_data->common,
- I2C_COMMON_EMUL_NO_FAIL_REG);
-
return NULL;
}
diff --git a/zephyr/test/drivers/default/src/thermistor.c b/zephyr/test/drivers/default/src/thermistor.c
index edbe7acad5..417b482d99 100644
--- a/zephyr/test/drivers/default/src/thermistor.c
+++ b/zephyr/test/drivers/default/src/thermistor.c
@@ -3,20 +3,19 @@
* found in the LICENSE file.
*/
-#include "../driver/temp_sensor/thermistor.h"
-#include "common.h"
-#include "temp_sensor/temp_sensor.h"
-#include "test/drivers/test_state.h"
-
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
#include <zephyr/drivers/adc.h>
#include <zephyr/drivers/adc/adc_emul.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
#include <temp_sensor.h>
+#include "common.h"
+#include "../driver/temp_sensor/thermistor.h"
+#include "temp_sensor/temp_sensor.h"
+#include "test/drivers/test_state.h"
+
#define GPIO_PG_EC_DSW_PWROK_PATH DT_PATH(named_gpios, pg_ec_dsw_pwrok)
#define GPIO_PG_EC_DSW_PWROK_PORT DT_GPIO_PIN(GPIO_PG_EC_DSW_PWROK_PATH, gpios)
@@ -59,10 +58,6 @@ ZTEST_USER(thermistor, test_thermistor_power_pin)
sensor_idx++) {
const struct temp_sensor_t *sensor = &temp_sensors[sensor_idx];
- /* Skip for sensors that are not thermistors */
- if (sensor->zephyr_info->thermistor == NULL)
- continue;
-
zassert_ok(adc_emul_const_value_set(adc_dev, sensor->idx,
A_VALID_VOLTAGE),
"adc_emul_value_func_set() failed on %s",
@@ -77,10 +72,6 @@ ZTEST_USER(thermistor, test_thermistor_power_pin)
sensor_idx++) {
const struct temp_sensor_t *sensor = &temp_sensors[sensor_idx];
- /* Skip for sensors that are not thermistors */
- if (sensor->zephyr_info->thermistor == NULL)
- continue;
-
zassert_equal(EC_ERROR_NOT_POWERED,
sensor->zephyr_info->read(sensor, &temp),
"%s failed", sensor->name);
@@ -94,10 +85,6 @@ ZTEST_USER(thermistor, test_thermistor_power_pin)
sensor_idx++) {
const struct temp_sensor_t *sensor = &temp_sensors[sensor_idx];
- /* Skip for sensors that are not thermistors */
- if (sensor->zephyr_info->thermistor == NULL)
- continue;
-
zassert_equal(EC_SUCCESS,
sensor->zephyr_info->read(sensor, &temp),
"%s failed", sensor->name);
@@ -126,10 +113,6 @@ ZTEST_USER(thermistor, test_thermistor_adc_read_error)
sensor_idx++) {
const struct temp_sensor_t *sensor = &temp_sensors[sensor_idx];
- /* Skip for sensors that are not thermistors */
- if (sensor->zephyr_info->thermistor == NULL)
- continue;
-
zassert_ok(adc_emul_value_func_set(adc_dev, sensor->idx,
adc_error_func, NULL),
"adc_emul_value_func_set() failed on %s",
@@ -140,10 +123,6 @@ ZTEST_USER(thermistor, test_thermistor_adc_read_error)
sensor_idx++) {
const struct temp_sensor_t *sensor = &temp_sensors[sensor_idx];
- /* Skip for sensors that are not thermistors */
- if (sensor->zephyr_info->thermistor == NULL)
- continue;
-
zassert_equal(EC_ERROR_UNKNOWN,
sensor->zephyr_info->read(sensor, &temp),
"%s failed", sensor->name);
@@ -286,16 +265,10 @@ ZTEST_USER(thermistor, test_thermistors_adc_temperature_conversion)
const static int reference_res_arr[] = { DT_FOREACH_STATUS_OKAY(
THERMISTOR_COMPAT, GET_THERMISTOR_REF_RES) };
- for (sensor_idx = 0; sensor_idx < NAMED_TEMP_SENSORS_SIZE;
- sensor_idx++) {
- /* Skip for sensors that are not thermistors */
- if (temp_sensors[sensor_idx].zephyr_info->thermistor == NULL)
- continue;
-
+ for (sensor_idx = 0; sensor_idx < NAMED_TEMP_SENSORS_SIZE; sensor_idx++)
do_thermistor_test(&temp_sensors[sensor_idx],
reference_mv_arr[sensor_idx],
reference_res_arr[sensor_idx]);
- }
}
ZTEST_USER(thermistor, test_device_nodes_enabled)
@@ -339,10 +312,6 @@ static void thermistor_cleanup(void *state)
for (sensor_idx = 0; sensor_idx < NAMED_TEMP_SENSORS_SIZE;
sensor_idx++) {
- /* Skip for sensors that are not thermistors */
- if (temp_sensors[sensor_idx].zephyr_info->thermistor == NULL)
- continue;
-
/* Setup ADC to return 27*C (300K) which is reasonable value */
adc_emul_const_value_set(
adc_dev, temp_sensors[sensor_idx].idx,
diff --git a/zephyr/test/drivers/default/src/uart_hostcmd.c b/zephyr/test/drivers/default/src/uart_hostcmd.c
index 907dba929f..5e1e200fa9 100644
--- a/zephyr/test/drivers/default/src/uart_hostcmd.c
+++ b/zephyr/test/drivers/default/src/uart_hostcmd.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "host_command.h"
-#include "test/drivers/test_state.h"
#include "uart.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "test/drivers/test_state.h"
/** Messages used in test */
static const char msg1[] = "test";
diff --git a/zephyr/test/drivers/default/src/usb_mux.c b/zephyr/test/drivers/default/src/usb_mux.c
index 0e89cf2398..62d39e28d4 100644
--- a/zephyr/test/drivers/default/src/usb_mux.c
+++ b/zephyr/test/drivers/default/src/usb_mux.c
@@ -3,33 +3,33 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/shell/shell_uart.h>
+
#include "common.h"
#include "ec_commands.h"
#include "ec_tasks.h"
+#include <zephyr/fff.h>
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
+#include "test/drivers/stubs.h"
#include "task.h"
#include "tcpm/ps8xxx_public.h"
#include "tcpm/tcpci.h"
-#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include "usb_mux.h"
#include "usb_prl_sm.h"
#include "usb_tc_sm.h"
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/ztest.h>
+#include "usb_mux.h"
+#include "test/drivers/test_state.h"
+#include "test/drivers/utils.h"
/** Copy of original usb_muxes[USB_PORT_C1] */
-static struct usb_mux_chain usb_mux_c1;
-static struct usb_mux *usbc1_virtual_usb_mux;
+struct usb_mux_chain usb_mux_c1;
/** Number of usb mux proxies in chain */
#define NUM_OF_PROXY 3
@@ -344,26 +344,6 @@ struct usb_mux_chain proxy_chain_0 = {
.next = &proxy_chain_1,
};
-static void find_virtual_mux(void)
-{
- const struct usb_mux_chain *mux_chain;
-
- mux_chain = &usb_muxes[1];
- usbc1_virtual_usb_mux = NULL;
- while (mux_chain) {
- if (mux_chain->mux &&
- mux_chain->mux->driver == &virtual_usb_mux_driver) {
- usbc1_virtual_usb_mux =
- (struct usb_mux *)mux_chain->mux;
- break;
- }
- mux_chain = mux_chain->next;
- }
-
- __ASSERT(usbc1_virtual_usb_mux,
- "USB-C port 1 must contain a virtual mux");
-}
-
/** Setup first 3 usb muxes of port 1 with proxy */
static void setup_usb_mux_proxy_chain(void)
{
@@ -713,13 +693,13 @@ ZTEST(usb_uninit_mux, test_usb_mux_hpd_update)
mux_state_t exp_mode, mode, virt_mode;
/* Get current state of virtual usb mux and set mock */
- usbc1_virtual_usb_mux->driver->get(usbc1_virtual_usb_mux, &virt_mode);
+ usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &virt_mode);
/* Test no hpd level and no irq */
exp_mode = virt_mode;
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
- usbc1_virtual_usb_mux->driver->get(usbc1_virtual_usb_mux, &mode);
+ usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
CHECK_PROXY_FAKE_CALL_CNT(proxy_init, NUM_OF_PROXY);
@@ -731,7 +711,7 @@ ZTEST(usb_uninit_mux, test_usb_mux_hpd_update)
exp_mode = virt_mode | USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ;
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
- usbc1_virtual_usb_mux->driver->get(usbc1_virtual_usb_mux, &mode);
+ usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
@@ -743,7 +723,7 @@ ZTEST(usb_uninit_mux, test_usb_mux_hpd_update)
exp_mode = virt_mode | USB_PD_MUX_HPD_IRQ;
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
- usbc1_virtual_usb_mux->driver->get(usbc1_virtual_usb_mux, &mode);
+ usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
@@ -755,7 +735,7 @@ ZTEST(usb_uninit_mux, test_usb_mux_hpd_update)
exp_mode = virt_mode | USB_PD_MUX_HPD_LVL;
usb_mux_hpd_update(USBC_PORT_C1, exp_mode);
/* Check if virtual usb mux mode is updated correctly */
- usbc1_virtual_usb_mux->driver->get(usbc1_virtual_usb_mux, &mode);
+ usbc1_virtual_usb_mux.driver->get(&usbc1_virtual_usb_mux, &mode);
zassert_equal(exp_mode, mode, "virtual mux mode is 0x%x (!= 0x%x)",
mode, exp_mode);
CHECK_PROXY_FAKE_CALL_CNT(proxy_init, 0);
@@ -936,7 +916,6 @@ ZTEST(usb_init_mux, test_usb_mux_typec_command)
void usb_uninit_mux_before(void *state)
{
ARG_UNUSED(state);
- find_virtual_mux();
setup_usb_mux_proxy_chain();
set_test_runner_tid();
@@ -956,7 +935,6 @@ void usb_uninit_mux_after(void *state)
void usb_init_mux_before(void *state)
{
ARG_UNUSED(state);
- find_virtual_mux();
setup_usb_mux_proxy_chain();
set_test_runner_tid();
diff --git a/zephyr/test/drivers/default/src/util.c b/zephyr/test/drivers/default/src/util.c
index 342ce9b971..32f989bb0f 100644
--- a/zephyr/test/drivers/default/src/util.c
+++ b/zephyr/test/drivers/default/src/util.c
@@ -2,11 +2,11 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "test/drivers/test_state.h"
-#include "util.h"
-
-#include <zephyr/fff.h>
#include <zephyr/ztest.h>
+#include <zephyr/fff.h>
+
+#include "util.h"
+#include "test/drivers/test_state.h"
ZTEST(util, reverse)
{
diff --git a/zephyr/test/drivers/default/src/vboot_hash.c b/zephyr/test/drivers/default/src/vboot_hash.c
index 61d4260a23..04f535a89c 100644
--- a/zephyr/test/drivers/default/src/vboot_hash.c
+++ b/zephyr/test/drivers/default/src/vboot_hash.c
@@ -3,15 +3,14 @@
* found in the LICENSE file.
*/
-#include "ec_commands.h"
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
-
#include <sha256.h>
+#include "ec_commands.h"
+#include "host_command.h"
+#include "test/drivers/test_state.h"
+
ZTEST_USER(vboot_hash, test_hostcmd_abort)
{
struct ec_response_vboot_hash response;
diff --git a/zephyr/test/drivers/default/src/virtual_battery.c b/zephyr/test/drivers/default/src/virtual_battery.c
index 3b265443e8..fc29e39777 100644
--- a/zephyr/test/drivers/default/src/virtual_battery.c
+++ b/zephyr/test/drivers/default/src/virtual_battery.c
@@ -3,19 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "battery_smart.h"
#include "ec_commands.h"
#include "emul/emul_smart_battery.h"
-#include "gpio.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include "virtual_battery.h"
-
-#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
void copy_memmap_string(uint8_t *dest, int offset, int len);
@@ -230,11 +226,11 @@ ZTEST_USER(virtual_battery, test_read_regs)
word = virtual_battery_read16(SB_SPECIFICATION_INFO);
zassert_equal(expected, word, "%d != %d", expected, word);
- zassert_ok(battery_status(&expected));
+ zassume_ok(battery_status(&expected));
word = virtual_battery_read16(SB_BATTERY_STATUS);
zassert_equal(expected, word, "%d != %d", expected, word);
- zassert_ok(battery_design_voltage(&expected));
+ zassume_ok(battery_design_voltage(&expected));
word = virtual_battery_read16(SB_DESIGN_VOLTAGE);
zassert_equal(expected, word, "%d != %d", expected, word);
@@ -289,144 +285,3 @@ ZTEST(virtual_battery, test_read_data_from_host_memmap)
ZTEST_SUITE(virtual_battery, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
-
-ZTEST(virtual_battery_direct, test_bad_reg_write)
-{
- struct ec_response_i2c_passthru resp;
-
- /* Start with a zero-length write. The state machine is expecting a
- * register address to be written, so this will fail.
- */
- zassert_equal(EC_ERROR_INVAL,
- virtual_battery_handler(&resp, 0, NULL, 0, 0,
- /* write_len = */ 0, NULL));
-
- zassert_equal(EC_I2C_STATUS_NAK, resp.i2c_status);
-}
-
-ZTEST(virtual_battery_direct, test_aborted_write)
-{
- struct ec_response_i2c_passthru resp;
- int error_code;
-
- /* Arbitrary packet of bytes */
- const uint8_t packet[] = { 0xAA, 0xBB, 0xCC };
-
- /* Start with a length 1 write to set a register address. */
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0, 0,
- /* write_len = */ 1, &packet[0]));
-
- /* Now write two more bytes successfully... */
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0, 0,
- /* write_len = */ 1, &packet[1]));
- zassert_ok(error_code);
-
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0, 0,
- /* write_len = */ 1, &packet[2]));
- zassert_ok(error_code);
-
- /* ...and abruptly write 0 bytes. This will cause an error */
- zassert_equal(EC_ERROR_INVAL,
- virtual_battery_handler(&resp, 0, &error_code, 0, 0,
- /* write_len = */ 0, NULL));
-
- zassert_equal(EC_I2C_STATUS_NAK, resp.i2c_status);
-}
-
-ZTEST(virtual_battery_direct, test_aborted_read)
-{
- struct ec_response_i2c_passthru resp;
- int error_code;
-
- /* Arbitrary packet to set a register plus a buffer to read to */
- const uint8_t write_packet[] = { SB_MANUFACTURER_NAME };
- uint8_t read_packet[3] = { 0 };
-
- /* Start with a length 1 write to set a register address. */
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0, 0,
- /* write_len = */ 1,
- &write_packet[0]));
-
- /* Now read two bytes successfully... */
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0,
- /* read_len = */ 1, 0,
- &read_packet[0]));
- zassert_ok(error_code);
-
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0,
- /* read_len = */ 1, 0,
- &read_packet[1]));
- zassert_ok(error_code);
-
- /* ...and abruptly read 0 bytes. This will cause an error */
- zassert_equal(EC_ERROR_INVAL,
- virtual_battery_handler(&resp, 0, &error_code, 0,
- /* read_len = */ 0, 0,
- &read_packet[2]));
-
- zassert_equal(EC_I2C_STATUS_NAK, resp.i2c_status);
-}
-
-ZTEST(virtual_battery_direct, test_read_bad_reg)
-{
- struct ec_response_i2c_passthru resp;
- int error_code;
-
- /* Try to read from an invalid register */
- const uint8_t write_packet[] = { 0xFF };
- uint8_t read_packet[3] = { 0 };
-
- /* Start with a length 1 write to set a register address. */
- zassert_ok(virtual_battery_handler(&resp, 0, &error_code, 0, 0,
- /* write_len = */ 1,
- &write_packet[0]));
-
- /* Now try to read */
- zassert_equal(EC_ERROR_INVAL,
- virtual_battery_handler(&resp, 0, &error_code, 0,
- /* read_len = */ 1, 0,
- &read_packet[0]));
- zassert_equal(EC_ERROR_INVAL, error_code);
-}
-
-#define GPIO_BATT_PRES_ODL_PATH DT_PATH(named_gpios, ec_batt_pres_odl)
-#define GPIO_BATT_PRES_ODL_PORT DT_GPIO_PIN(GPIO_BATT_PRES_ODL_PATH, gpios)
-
-static int set_battery_present(bool batt_present)
-{
- const struct device *batt_pres_dev =
- DEVICE_DT_GET(DT_GPIO_CTLR(GPIO_BATT_PRES_ODL_PATH, gpios));
-
- return gpio_emul_input_set(batt_pres_dev, GPIO_BATT_PRES_ODL_PORT,
- !batt_present);
-}
-
-ZTEST(virtual_battery_direct, test_no_battery)
-{
- struct ec_response_i2c_passthru resp;
-
- set_battery_present(false);
-
- /* Arbitrary packet of bytes */
- const uint8_t packet[] = { 0xAA, 0xBB, 0xCC };
-
- /* Attempt a valid write operation, which will fail due to no battery */
- zassert_equal(EC_ERROR_INVAL,
- virtual_battery_handler(&resp, 0, NULL, 0, 0,
- /* write_len = */ 1, &packet[0]));
-
- zassert_equal(EC_I2C_STATUS_NAK, resp.i2c_status);
-}
-
-static void virtual_battery_direct_reset(void *arg)
-{
- reset_parse_state();
-
- set_battery_present(true);
-}
-
-/* The virtual_battery_direct suite tests the virtual battery handler directly
- * without performing I2C ops. This makes it easier to test certain corner-cases
- */
-ZTEST_SUITE(virtual_battery_direct, drivers_predicate_post_main, NULL,
- virtual_battery_direct_reset, virtual_battery_direct_reset, NULL);
diff --git a/zephyr/test/drivers/default/src/vstore.c b/zephyr/test/drivers/default/src/vstore.c
index 923d14ff00..b4264aaeb3 100644
--- a/zephyr/test/drivers/default/src/vstore.c
+++ b/zephyr/test/drivers/default/src/vstore.c
@@ -3,20 +3,19 @@
* found in the LICENSE file.
*/
-#include "ec_commands.h"
-#include "host_command.h"
-#include "system.h"
-#include "system_fake.h"
-#include "test/drivers/test_state.h"
-#include "vstore.h"
-
#include <setjmp.h>
+#include <console.h>
#include <zephyr/fff.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
-#include <console.h>
+#include "ec_commands.h"
+#include "host_command.h"
+#include "system.h"
+#include "system_fake.h"
+#include "vstore.h"
+#include "test/drivers/test_state.h"
ZTEST_SUITE(vstore, drivers_predicate_post_main, NULL, NULL, NULL, NULL);
diff --git a/zephyr/test/drivers/default/src/watchdog.c b/zephyr/test/drivers/default/src/watchdog.c
index a82800a6de..958aa3eaaa 100644
--- a/zephyr/test/drivers/default/src/watchdog.c
+++ b/zephyr/test/drivers/default/src/watchdog.c
@@ -8,19 +8,20 @@
* @brief Unit Tests for watchdog.
*/
+#include <zephyr/device.h>
+#include <zephyr/drivers/watchdog.h>
+
+#include <zephyr/logging/log.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "common.h"
#include "ec_tasks.h"
+#include <zephyr/fff.h>
#include "hooks.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
#include "watchdog.h"
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/watchdog.h>
-#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/ztest.h>
+#include "test/drivers/test_state.h"
#define wdt DEVICE_DT_GET(DT_CHOSEN(cros_ec_watchdog))
diff --git a/zephyr/test/drivers/dps/src/dps.c b/zephyr/test/drivers/dps/src/dps.c
index a573da670b..d445767df4 100644
--- a/zephyr/test/drivers/dps/src/dps.c
+++ b/zephyr/test/drivers/dps/src/dps.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "builtin/stdio.h"
#include "console.h"
#include "dps.h"
#include "test/drivers/test_state.h"
#include "timer.h"
-#include <zephyr/ztest.h>
-
struct dps_fixture {
struct dps_config_t saved_config;
int saved_debug_level;
@@ -89,7 +89,7 @@ ZTEST(dps, console_cmd__enable)
ZTEST(dps, console_cmd__disable)
{
/* Should already by enabled due to before() function */
- zassert_true(dps_is_enabled(), NULL);
+ zassume_true(dps_is_enabled(), NULL);
zassert_ok(shell_execute_cmd(get_ec_shell(), "dps dis"), NULL);
@@ -104,7 +104,7 @@ ZTEST(dps, console_cmd__fakepwr_print)
ZTEST(dps, console_cmd__fakepwr_enable_disable)
{
- zassert_false(dps_is_fake_enabled(),
+ zassume_false(dps_is_fake_enabled(),
"fakepwr shouldn't be enabled by default");
zassert_ok(shell_execute_cmd(get_ec_shell(), "dps fakepwr 100 200"),
diff --git a/zephyr/test/drivers/host_cmd/CMakeLists.txt b/zephyr/test/drivers/host_cmd/CMakeLists.txt
index 14733253c3..d1567ec635 100644
--- a/zephyr/test/drivers/host_cmd/CMakeLists.txt
+++ b/zephyr/test/drivers/host_cmd/CMakeLists.txt
@@ -21,7 +21,6 @@ target_sources(app PRIVATE
src/pd_chip_info.c
src/pd_control.c
src/pd_log.c
- src/tablet_mode.c
src/usb_pd_control.c
src/usb_pd_host_cmd.c
)
diff --git a/zephyr/test/drivers/host_cmd/src/adc.c b/zephyr/test/drivers/host_cmd/src/adc.c
index f283ef17d5..6b2bef1165 100644
--- a/zephyr/test/drivers/host_cmd/src/adc.c
+++ b/zephyr/test/drivers/host_cmd/src/adc.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/emul.h>
+#include <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
#include "adc.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, adc_read_channel, enum adc_channel);
ZTEST(hc_adc, normal_path)
diff --git a/zephyr/test/drivers/host_cmd/src/battery_cut_off.c b/zephyr/test/drivers/host_cmd/src/battery_cut_off.c
index 019362f3c8..ed9d96481d 100644
--- a/zephyr/test/drivers/host_cmd/src/battery_cut_off.c
+++ b/zephyr/test/drivers/host_cmd/src/battery_cut_off.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/emul.h>
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_smart_battery.h"
@@ -11,9 +14,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/ztest.h>
-
struct host_cmd_battery_cut_off_fixture {
const struct emul *emul;
struct i2c_common_emul_data *i2c_emul;
diff --git a/zephyr/test/drivers/host_cmd/src/battery_display_soc.c b/zephyr/test/drivers/host_cmd/src/battery_display_soc.c
index 6af3d35043..029551a49b 100644
--- a/zephyr/test/drivers/host_cmd/src/battery_display_soc.c
+++ b/zephyr/test/drivers/host_cmd/src/battery_display_soc.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "charge_state.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(battery_display_soc, happy_path)
{
const uint32_t full_charge_as_tenths =
diff --git a/zephyr/test/drivers/host_cmd/src/battery_v2.c b/zephyr/test/drivers/host_cmd/src/battery_v2.c
index a6fab89b8c..3e0ac969f9 100644
--- a/zephyr/test/drivers/host_cmd/src/battery_v2.c
+++ b/zephyr/test/drivers/host_cmd/src/battery_v2.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "ec_commands.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST(host_cmd_battery_v2, test_get_static__invalid_index)
{
struct ec_response_battery_static_info response;
diff --git a/zephyr/test/drivers/host_cmd/src/charge_manager.c b/zephyr/test/drivers/host_cmd/src/charge_manager.c
index 6bbf7a3ae3..7298b8e135 100644
--- a/zephyr/test/drivers/host_cmd/src/charge_manager.c
+++ b/zephyr/test/drivers/host_cmd/src/charge_manager.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "charge_manager.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(charge_manager, test_port_count)
{
struct ec_response_charge_port_count response = { 0 };
@@ -44,49 +44,5 @@ ZTEST_USER(charge_manager, test_port_override__0_from_off)
zassert_ok(host_command_process(&args));
}
-ZTEST_USER(charge_manager, test_charge_state_get_debug_params)
-{
- struct ec_params_charge_state params = {
- .cmd = CHARGE_STATE_CMD_GET_PARAM,
- };
- struct ec_response_charge_state response = { 0 };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_CHARGE_STATE, 0, response, params);
-
- /* Check that the following get commands work on these debug parameters.
- * The values being asserted are the default values when nothing is
- * plugged in. This should be enough since the test only needs to verify
- * that the command gets the current value. Tests that verify the
- * charging behavior exist elsewhere (under
- * default/src/integration/usbc).
- */
- params.get_param.param = CS_PARAM_DEBUG_CTL_MODE;
- zassert_ok(host_command_process(&args));
- zassert_equal(0, response.get_param.value);
-
- params.get_param.param = CS_PARAM_DEBUG_MANUAL_CURRENT;
- zassert_ok(host_command_process(&args));
- zassert_equal(0xffffffff, response.get_param.value);
-
- params.get_param.param = CS_PARAM_DEBUG_MANUAL_VOLTAGE;
- zassert_ok(host_command_process(&args));
- zassert_equal(0xffffffff, response.get_param.value);
-
- params.get_param.param = CS_PARAM_DEBUG_SEEMS_DEAD;
- zassert_ok(host_command_process(&args));
- zassert_equal(0, response.get_param.value);
-
- params.get_param.param = CS_PARAM_DEBUG_SEEMS_DISCONNECTED;
- zassert_ok(host_command_process(&args));
- zassert_equal(0, response.get_param.value);
-
- params.get_param.param = CS_PARAM_DEBUG_BATT_REMOVED;
- zassert_ok(host_command_process(&args));
- zassert_equal(0, response.get_param.value);
-
- params.get_param.param = CS_PARAM_DEBUG_MAX;
- zassert_equal(EC_ERROR_INVAL, host_command_process(&args));
-}
-
ZTEST_SUITE(charge_manager, drivers_predicate_post_main, NULL, NULL, NULL,
NULL);
diff --git a/zephyr/test/drivers/host_cmd/src/get_cmd_versions.c b/zephyr/test/drivers/host_cmd/src/get_cmd_versions.c
index 0fa7ab3770..b935b69e46 100644
--- a/zephyr/test/drivers/host_cmd/src/get_cmd_versions.c
+++ b/zephyr/test/drivers/host_cmd/src/get_cmd_versions.c
@@ -3,13 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "battery.h"
#include "charge_state.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(hc_get_cmd_versions, test_v0__both_versions)
{
struct ec_params_get_cmd_versions params = {
diff --git a/zephyr/test/drivers/host_cmd/src/get_panic_info.c b/zephyr/test/drivers/host_cmd/src/get_panic_info.c
index 85d5fdd6f2..bdb19d9a98 100644
--- a/zephyr/test/drivers/host_cmd/src/get_panic_info.c
+++ b/zephyr/test/drivers/host_cmd/src/get_panic_info.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "host_command.h"
#include "panic.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
struct host_cmd_get_panic_info_fixture {
struct panic_data saved_pdata;
};
diff --git a/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c b/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c
index 2d9410232d..907329f8a1 100644
--- a/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c
+++ b/zephyr/test/drivers/host_cmd/src/get_pd_port_caps.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(host_cmd_get_pd_port_caps, test_good_index)
{
struct ec_params_get_pd_port_caps params = { .port = 0 };
@@ -50,7 +50,7 @@ static void host_cmd_get_pd_port_caps_begin(void *data)
ARG_UNUSED(data);
/* Assume we have at least one USB-C port */
- zassert_true(board_get_usb_pd_port_count() > 0,
+ zassume_true(board_get_usb_pd_port_count() > 0,
"Insufficient TCPCs found");
}
diff --git a/zephyr/test/drivers/host_cmd/src/host_command.c b/zephyr/test/drivers/host_cmd/src/host_command.c
index a9f0fcb941..49e41acc89 100644
--- a/zephyr/test/drivers/host_cmd/src/host_command.c
+++ b/zephyr/test/drivers/host_cmd/src/host_command.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST(host_cmd_host_commands, get_command_versions__v1)
{
struct ec_response_get_cmd_versions response;
diff --git a/zephyr/test/drivers/host_cmd/src/host_command_test_protocol.c b/zephyr/test/drivers/host_cmd/src/host_command_test_protocol.c
index f4bf956e9b..9d29aeb7de 100644
--- a/zephyr/test/drivers/host_cmd/src/host_command_test_protocol.c
+++ b/zephyr/test/drivers/host_cmd/src/host_command_test_protocol.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(hc_test_protocol, test_echo_max_buffer_size)
{
struct ec_params_test_protocol params = {
diff --git a/zephyr/test/drivers/host_cmd/src/host_event_commands.c b/zephyr/test/drivers/host_cmd/src/host_event_commands.c
index 8e7fff0fe2..c2f7e72045 100644
--- a/zephyr/test/drivers/host_cmd/src/host_event_commands.c
+++ b/zephyr/test/drivers/host_cmd/src/host_event_commands.c
@@ -3,12 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
#include "include/lpc.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/ztest.h>
-
struct host_cmd_host_event_commands_fixture {
struct host_events_ctx ctx;
};
diff --git a/zephyr/test/drivers/host_cmd/src/host_event_commands_deprecated.c b/zephyr/test/drivers/host_cmd/src/host_event_commands_deprecated.c
index b0ba438bbb..6d0a386d6e 100644
--- a/zephyr/test/drivers/host_cmd/src/host_event_commands_deprecated.c
+++ b/zephyr/test/drivers/host_cmd/src/host_event_commands_deprecated.c
@@ -5,30 +5,39 @@
/* Tests for deprecated EC_CMD_HOST_EVENT_* commands */
+#include <zephyr/ztest.h>
#include "include/lpc.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/ztest.h>
-
#define HOST_EVENT_TEST_MASK_VAL EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN)
-static enum ec_status
+static void
host_event_get_wake_mask_helper(struct ec_response_host_event_mask *r)
{
+ enum ec_status ret_val;
struct host_cmd_handler_args args = BUILD_HOST_COMMAND_RESPONSE(
EC_CMD_HOST_EVENT_GET_WAKE_MASK, 0, *r);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_GET_WAKE_MASK always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
-static enum ec_status host_event_set_wake_mask_helper(uint32_t mask)
+static void host_event_set_wake_mask_helper(uint32_t mask)
{
+ enum ec_status ret_val;
struct ec_params_host_event_mask params = { .mask = mask };
struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
EC_CMD_HOST_EVENT_SET_WAKE_MASK, 0, params);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_SET_WAKE_MASK always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
/**
@@ -36,17 +45,13 @@ static enum ec_status host_event_set_wake_mask_helper(uint32_t mask)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_wake_mask)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
- rv = host_event_get_wake_mask_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- }
+ host_event_get_wake_mask_helper(&result);
+#else
+ ztest_test_skip();
+#endif
}
/**
@@ -54,24 +59,16 @@ ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_wake_mask)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_set_wake_mask)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
/* Read the current mask */
- rv = host_event_get_wake_mask_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- return;
- }
+ host_event_get_wake_mask_helper(&result);
/* Default mask is expected to be clear */
zassert_false(result.mask, "Default host event wake mask is not clear");
- zassert_ok(host_event_set_wake_mask_helper(HOST_EVENT_TEST_MASK_VAL));
+ host_event_set_wake_mask_helper(HOST_EVENT_TEST_MASK_VAL);
/* Verify the mask changed */
host_event_get_wake_mask_helper(&result);
@@ -81,25 +78,38 @@ ZTEST_USER(host_cmd_host_event_commands, test_host_event_set_wake_mask)
HOST_EVENT_TEST_MASK_VAL, result.mask);
/* Clean up the mask */
- zassert_ok(host_event_set_wake_mask_helper(0));
+ host_event_set_wake_mask_helper(0);
+#else
+ ztest_test_skip();
+#endif
}
-static enum ec_status
+static void
host_event_get_smi_mask_helper(struct ec_response_host_event_mask *r)
{
+ enum ec_status ret_val;
struct host_cmd_handler_args args = BUILD_HOST_COMMAND_RESPONSE(
EC_CMD_HOST_EVENT_GET_SMI_MASK, 0, *r);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_GET_SMI_MASK always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
-static enum ec_status host_event_set_smi_mask_helper(uint32_t mask)
+static void host_event_set_smi_mask_helper(uint32_t mask)
{
+ enum ec_status ret_val;
struct ec_params_host_event_mask params = { .mask = mask };
struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
EC_CMD_HOST_EVENT_SET_SMI_MASK, 0, params);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_SET_SMI_MASK always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
/**
@@ -107,18 +117,13 @@ static enum ec_status host_event_set_smi_mask_helper(uint32_t mask)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_smi_mask)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
- rv = host_event_get_smi_mask_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- return;
- }
+ host_event_get_smi_mask_helper(&result);
+#else
+ ztest_test_skip();
+#endif
}
/**
@@ -126,43 +131,42 @@ ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_smi_mask)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_set_smi_mask)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
/* Read the current mask */
- rv = host_event_get_smi_mask_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- return;
- }
+ host_event_get_smi_mask_helper(&result);
/* Default mask is expected to be clear */
zassert_false(result.mask, "Default host event SMI mask is not clear");
- zassert_ok(host_event_set_smi_mask_helper(HOST_EVENT_TEST_MASK_VAL));
+ host_event_set_smi_mask_helper(HOST_EVENT_TEST_MASK_VAL);
/* Verify the mask changed */
- zassert_ok(host_event_get_smi_mask_helper(&result));
+ host_event_get_smi_mask_helper(&result);
zassert_equal(result.mask, HOST_EVENT_TEST_MASK_VAL,
"Expected SMI mask 0x%08x, returned mask 0x%08x",
HOST_EVENT_TEST_MASK_VAL, result.mask);
/* Clean up the mask */
- zassert_ok(host_event_set_smi_mask_helper(0));
+ host_event_set_smi_mask_helper(0);
+#else
+ ztest_test_skip();
+#endif
}
-static enum ec_status
-host_event_get_b_helper(struct ec_response_host_event_mask *r)
+static void host_event_get_b_helper(struct ec_response_host_event_mask *r)
{
+ enum ec_status ret_val;
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND_RESPONSE(EC_CMD_HOST_EVENT_GET_B, 0, *r);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_GET_B always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
/**
@@ -170,36 +174,41 @@ host_event_get_b_helper(struct ec_response_host_event_mask *r)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_b)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
- rv = host_event_get_b_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- return;
- }
+ host_event_get_b_helper(&result);
+#else
+ ztest_test_skip();
+#endif
}
-static enum ec_status
+static void
host_event_get_sci_mask_helper(struct ec_response_host_event_mask *r)
{
+ enum ec_status ret_val;
struct host_cmd_handler_args args = BUILD_HOST_COMMAND_RESPONSE(
EC_CMD_HOST_EVENT_GET_SCI_MASK, 0, *r);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_GET_SCI_MASK always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
-static enum ec_status host_event_set_sci_mask_helper(uint32_t mask)
+static void host_event_set_sci_mask_helper(uint32_t mask)
{
+ enum ec_status ret_val;
struct ec_params_host_event_mask params = { .mask = mask };
struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
EC_CMD_HOST_EVENT_SET_SCI_MASK, 0, params);
- return host_command_process(&args);
+ ret_val = host_command_process(&args);
+
+ /* EC_CMD_HOST_EVENT_SET_SCI_MASK always returns success */
+ zassert_equal(ret_val, EC_RES_SUCCESS, "Expected %d, returned %d",
+ EC_RES_SUCCESS, ret_val);
}
/**
@@ -207,18 +216,13 @@ static enum ec_status host_event_set_sci_mask_helper(uint32_t mask)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_sci_mask)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
- rv = host_event_get_sci_mask_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- return;
- }
+ host_event_get_sci_mask_helper(&result);
+#else
+ ztest_test_skip();
+#endif
}
/**
@@ -226,32 +230,27 @@ ZTEST_USER(host_cmd_host_event_commands, test_host_event_get_sci_mask)
*/
ZTEST_USER(host_cmd_host_event_commands, test_host_event_set_sci_mask)
{
- enum ec_status rv;
+#ifdef CONFIG_HOSTCMD_X86
struct ec_response_host_event_mask result = { 0 };
/* Read the current mask */
- rv = host_event_get_sci_mask_helper(&result);
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_ok(rv, "Expected %d, returned %d", EC_RES_SUCCESS, rv);
- } else {
- zassert_equal(EC_RES_INVALID_COMMAND, rv,
- "Expected %d, returned %d",
- EC_RES_INVALID_COMMAND, rv);
- return;
- }
+ host_event_get_sci_mask_helper(&result);
/* Default mask is expected to be clear */
zassert_false(result.mask, "Default host event SCI mask is not clear");
- zassert_ok(host_event_set_sci_mask_helper(HOST_EVENT_TEST_MASK_VAL));
+ host_event_set_sci_mask_helper(HOST_EVENT_TEST_MASK_VAL);
/* Verify the mask changed */
- zassert_ok(host_event_get_sci_mask_helper(&result));
+ host_event_get_sci_mask_helper(&result);
zassert_equal(result.mask, HOST_EVENT_TEST_MASK_VAL,
"Expected SCI mask 0x%08x, returned mask 0x%08x",
HOST_EVENT_TEST_MASK_VAL, result.mask);
/* Clean up the mask */
- zassert_ok(host_event_set_sci_mask_helper(0));
+ host_event_set_sci_mask_helper(0);
+#else
+ ztest_test_skip();
+#endif
}
diff --git a/zephyr/test/drivers/host_cmd/src/host_request_expected_size.c b/zephyr/test/drivers/host_cmd/src/host_request_expected_size.c
index 19fdd9ea4a..30ff8c11b2 100644
--- a/zephyr/test/drivers/host_cmd/src/host_request_expected_size.c
+++ b/zephyr/test/drivers/host_cmd/src/host_request_expected_size.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "host_command.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
ZTEST(host_request_expected_size, test_mismatched_host_request_version)
{
const struct ec_host_request request = {
diff --git a/zephyr/test/drivers/host_cmd/src/keyboard_mkbp.c b/zephyr/test/drivers/host_cmd/src/keyboard_mkbp.c
index e77230cfaf..4c74a48ab4 100644
--- a/zephyr/test/drivers/host_cmd/src/keyboard_mkbp.c
+++ b/zephyr/test/drivers/host_cmd/src/keyboard_mkbp.c
@@ -3,12 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
#include "include/keyboard_mkbp.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/ztest.h>
-
struct keyboard_mkbp_commands_fixture {
struct ec_mkbp_config config;
};
diff --git a/zephyr/test/drivers/host_cmd/src/motion_sense.c b/zephyr/test/drivers/host_cmd/src/motion_sense.c
index 919baf7219..371ca4ae11 100644
--- a/zephyr/test/drivers/host_cmd/src/motion_sense.c
+++ b/zephyr/test/drivers/host_cmd/src/motion_sense.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "atomic.h"
#include "console.h"
#include "driver/accel_bma2x2.h"
@@ -13,10 +17,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, mock_set_range, struct motion_sensor_t *, int, int);
FAKE_VALUE_FUNC(int, mock_set_offset, const struct motion_sensor_t *,
const int16_t *, int16_t);
@@ -72,7 +72,7 @@ static void host_cmd_motion_sense_before(void *fixture)
RESET_FAKE(mock_perform_calib);
FFF_RESET_HISTORY();
- zassert_ok(shell_execute_cmd(get_ec_shell(), "accelinit 0"));
+ zassume_ok(shell_execute_cmd(get_ec_shell(), "accelinit 0"));
atomic_clear(&motion_sensors[0].flush_pending);
motion_sensors[0].config[SENSOR_CONFIG_AP].odr = 0;
@@ -305,7 +305,7 @@ ZTEST_USER(host_cmd_motion_sense, test_odr_get)
{
struct ec_response_motion_sense response;
- zassert_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0],
+ zassume_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0],
1000000, false),
NULL);
zassert_ok(host_cmd_motion_sense_odr(/*sensor_num=*/0,
@@ -322,7 +322,7 @@ ZTEST_USER(host_cmd_motion_sense, test_odr_set)
{
struct ec_response_motion_sense response;
- zassert_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0], 0,
+ zassume_ok(motion_sensors[0].drv->set_data_rate(&motion_sensors[0], 0,
false),
NULL);
zassert_ok(host_cmd_motion_sense_odr(/*sensor_num=*/0,
@@ -774,7 +774,7 @@ ZTEST(host_cmd_motion_sense, test_int_enable)
host_cmd_motion_sense_int_enable(2, &response), NULL);
/* Make sure we start off disabled */
- zassert_ok(host_cmd_motion_sense_int_enable(0, &response));
+ zassume_ok(host_cmd_motion_sense_int_enable(0, &response));
/* Test enable */
zassert_ok(host_cmd_motion_sense_int_enable(1, &response));
diff --git a/zephyr/test/drivers/host_cmd/src/pd_chip_info.c b/zephyr/test/drivers/host_cmd/src/pd_chip_info.c
index c04e74810a..95e2339899 100644
--- a/zephyr/test/drivers/host_cmd/src/pd_chip_info.c
+++ b/zephyr/test/drivers/host_cmd/src/pd_chip_info.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
#define TEST_PORT USBC_PORT_C0
#define BAD_PORT 65
@@ -20,7 +20,7 @@ static enum ec_status run_pd_chip_info(int port,
{
struct ec_params_pd_chip_info params = { .port = port, .live = true };
struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_PD_CHIP_INFO, 1, *resp, params);
+ BUILD_HOST_COMMAND(EC_CMD_PD_CHIP_INFO, 1, resp, params);
return host_command_process(&args);
}
@@ -41,7 +41,7 @@ ZTEST_USER(host_cmd_pd_chip_info, test_bad_index)
{
struct ec_response_pd_chip_info_v1 response;
- zassert_true(board_get_usb_pd_port_count() < BAD_PORT,
+ zassume_true(board_get_usb_pd_port_count() < BAD_PORT,
"Intended bad port exists");
zassert_equal(run_pd_chip_info(BAD_PORT, &response),
EC_RES_INVALID_PARAM,
@@ -53,7 +53,7 @@ static void host_cmd_pd_chip_info_begin(void *data)
ARG_UNUSED(data);
/* Assume we have at least one USB-C port */
- zassert_true(board_get_usb_pd_port_count() > 0,
+ zassume_true(board_get_usb_pd_port_count() > 0,
"Insufficient TCPCs found");
/* Set the system into S0, since the AP would drive these commands */
diff --git a/zephyr/test/drivers/host_cmd/src/pd_control.c b/zephyr/test/drivers/host_cmd/src/pd_control.c
index a881a8e0ea..e8de27f6ce 100644
--- a/zephyr/test/drivers/host_cmd/src/pd_control.c
+++ b/zephyr/test/drivers/host_cmd/src/pd_control.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
#define TEST_PORT USBC_PORT_C0
#define BAD_PORT 82
@@ -23,7 +23,7 @@ ZTEST_USER(host_cmd_pd_control, test_bad_index)
struct host_cmd_handler_args args =
BUILD_HOST_COMMAND_PARAMS(EC_CMD_PD_CONTROL, 0, params);
- zassert_true(board_get_usb_pd_port_count() < BAD_PORT,
+ zassume_true(board_get_usb_pd_port_count() < BAD_PORT,
"Intended bad port exists");
zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM,
"Failed to fail pd_control for port %d", params.chip);
@@ -47,7 +47,7 @@ ZTEST_USER(host_cmd_pd_control, test_pd_reset_resume)
* the only HC return which would cover this is a state string, which
* could be brittle.
*/
- zassert_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning");
+ zassume_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning");
host_cmd_pd_control(TEST_PORT, PD_RESET);
@@ -76,7 +76,7 @@ ZTEST_USER(host_cmd_pd_control, test_suspend_resume)
* the only HC return which would cover this is a state string, which
* could be brittle.
*/
- zassert_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning");
+ zassume_true(pd_is_port_enabled(TEST_PORT), "Port not up at beginning");
host_cmd_pd_control(TEST_PORT, PD_SUSPEND);
@@ -93,20 +93,6 @@ ZTEST_USER(host_cmd_pd_control, test_suspend_resume)
zassert_true(pd_is_port_enabled(TEST_PORT), "Port failed to resume");
}
-ZTEST_USER(host_cmd_pd_control, test_suspend_low_battery)
-{
- struct ec_params_pd_control params = { .chip = TEST_PORT,
- .subcmd = PD_SUSPEND };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_PARAMS(EC_CMD_PD_CONTROL, 0, params);
-
- /* Suspending the port for firmware update should fail at critical low
- * battery.
- */
- test_set_battery_level(1);
- zassert_equal(host_command_process(&args), EC_RES_BUSY);
-}
-
ZTEST_USER(host_cmd_pd_control, test_control_disable)
{
struct ec_params_pd_control params = { .chip = TEST_PORT,
@@ -131,7 +117,7 @@ static void host_cmd_pd_control_begin(void *data)
ARG_UNUSED(data);
/* Assume we have at least one USB-C port */
- zassert_true(board_get_usb_pd_port_count() > 0,
+ zassume_true(board_get_usb_pd_port_count() > 0,
"Insufficient TCPCs found");
/* Set the system into S0, since the AP would drive these commands */
diff --git a/zephyr/test/drivers/host_cmd/src/pd_log.c b/zephyr/test/drivers/host_cmd/src/pd_log.c
index 819f020890..a6022d8bb1 100644
--- a/zephyr/test/drivers/host_cmd/src/pd_log.c
+++ b/zephyr/test/drivers/host_cmd/src/pd_log.c
@@ -3,14 +3,13 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "event_log.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
#include "usb_pd.h"
-#include "util.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
/**
* @brief This is the maximum size of a single log entry.
@@ -21,14 +20,6 @@
#define MAX_EVENT_LOG_ENTRY_SIZE (sizeof(struct event_log_entry) + 16)
/**
- * @brief This is the maximum size of a response pd log entry.
- *
- * Each entry must contain some common data + up to 16 bytes of additional type
- * specific data.
- */
-#define MAX_RESPONSE_PD_LOG_ENTRY_SIZE (sizeof(struct ec_response_pd_log) + 16)
-
-/**
* @brief The size of the PD log entry data
*
* Logs from the PD include an additional 8 bytes of data to be sent to the AP.
@@ -129,7 +120,7 @@ ZTEST_USER_F(pd_log, test_mcu_connect)
ZTEST_USER_F(pd_log, test_read_log_entry)
{
- uint8_t response_buffer[MAX_RESPONSE_PD_LOG_ENTRY_SIZE];
+ uint8_t response_buffer[sizeof(struct ec_response_pd_log) + 16];
struct ec_response_pd_log *response =
(struct ec_response_pd_log *)response_buffer;
struct host_cmd_handler_args args =
@@ -142,25 +133,3 @@ ZTEST_USER_F(pd_log, test_read_log_entry)
zassert_equal(sizeof(struct event_log_entry), args.response_size, NULL);
zassert_equal(PD_EVENT_NO_ENTRY, response->type, NULL);
}
-
-ZTEST_USER_F(pd_log, test_log_recv_vdm)
-{
- uint8_t response_buffer[MAX_RESPONSE_PD_LOG_ENTRY_SIZE];
- uint32_t *payload = (uint32_t *)response_buffer;
- struct ec_response_pd_log *response =
- (struct ec_response_pd_log *)&payload[1];
-
- memset(response_buffer, 0, sizeof(response_buffer));
- payload[0] |= VDO_SRC_RESPONDER;
- response->type = PD_EVENT_MCU_CONNECT;
- response->size_port = 8;
- int cnt = DIV_ROUND_UP(response->size_port, sizeof(uint32_t)) + 2;
-
- pd_log_recv_vdm(0, cnt, payload);
-
- (void)log_dequeue_event(&fixture->log_entry);
-
- zassert_equal(response->type, fixture->log_entry.type,
- "type=%d, received=%d", response->type,
- fixture->log_entry.type);
-}
diff --git a/zephyr/test/drivers/host_cmd/src/tablet_mode.c b/zephyr/test/drivers/host_cmd/src/tablet_mode.c
deleted file mode 100644
index a84faa035f..0000000000
--- a/zephyr/test/drivers/host_cmd/src/tablet_mode.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_smart_battery.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "tablet_mode.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
-#include <zephyr/drivers/emul.h>
-#include <zephyr/ztest.h>
-
-struct host_cmd_tablet_mode_fixture {
- const struct emul *emul;
- struct i2c_common_emul_data *i2c_emul;
-};
-
-static void host_cmd_tablet_mode_before(void *f)
-{
- ARG_UNUSED(f);
- tablet_reset();
-}
-
-static void host_cmd_tablet_mode_after(void *f)
-{
- ARG_UNUSED(f);
- tablet_reset();
-}
-
-ZTEST_SUITE(host_cmd_tablet_mode, drivers_predicate_post_main, NULL,
- host_cmd_tablet_mode_before, host_cmd_tablet_mode_after, NULL);
-
-/* Test tablet mode can be enabled with a host command. */
-ZTEST_USER_F(host_cmd_tablet_mode, test_tablet_mode_on)
-{
- int rv;
- struct ec_params_set_tablet_mode params = {
- .tablet_mode = TABLET_MODE_FORCE_TABLET
- };
-
- struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_TABLET_MODE, UINT8_C(0), params);
-
- rv = host_command_process(&args);
- zassert_equal(EC_RES_SUCCESS, rv, "Expected EC_RES_SUCCESS, but got %d",
- rv);
- /* Return 1 if in tablet mode, 0 otherwise */
- rv = tablet_get_mode();
- zassert_equal(rv, 1, "unexpected tablet mode: %d", rv);
-}
-
-/* Test tablet mode can be disabled with a host command. */
-ZTEST_USER_F(host_cmd_tablet_mode, test_tablet_mode_off)
-{
- int rv;
- struct ec_params_set_tablet_mode params = {
- .tablet_mode = TABLET_MODE_FORCE_CLAMSHELL
- };
-
- struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_TABLET_MODE, UINT8_C(0), params);
-
- rv = host_command_process(&args);
- zassert_equal(EC_RES_SUCCESS, rv, "Expected EC_RES_SUCCESS, but got %d",
- rv);
- /* Return 1 if in tablet mode, 0 otherwise */
- rv = tablet_get_mode();
- zassert_equal(rv, 0, "unexpected tablet mode: %d", rv);
-}
-
-/* Test tablet mode can be reset with a host command. */
-ZTEST_USER_F(host_cmd_tablet_mode, test_tablet_mode_reset)
-{
- int rv;
- struct ec_params_set_tablet_mode params = {
- .tablet_mode = TABLET_MODE_DEFAULT
- };
-
- struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_TABLET_MODE, UINT8_C(0), params);
-
- rv = host_command_process(&args);
- zassert_equal(EC_RES_SUCCESS, rv, "Expected EC_RES_SUCCESS, but got %d",
- rv);
- /* Return 1 if in tablet mode, 0 otherwise */
- rv = tablet_get_mode();
- zassert_equal(rv, 0, "unexpected tablet mode: %d", rv);
-}
-
-/* Test tablet mode can handle invalid host command parameters. */
-ZTEST_USER_F(host_cmd_tablet_mode, test_tablet_mode_invalid_parameter)
-{
- int rv;
- struct ec_params_set_tablet_mode params = {
- .tablet_mode = 0xEE /* Sufficiently random, bad value.*/
- };
-
- struct host_cmd_handler_args args = BUILD_HOST_COMMAND_PARAMS(
- EC_CMD_SET_TABLET_MODE, UINT8_C(0), params);
-
- rv = host_command_process(&args);
- zassert_equal(EC_RES_INVALID_PARAM, rv,
- "Expected EC_RES_INVALID_PARAM, but got %d", rv);
- /* Return 1 if in tablet mode, 0 otherwise */
- rv = tablet_get_mode();
- zassert_equal(rv, 0, "unexpected tablet mode: %d", rv);
-}
diff --git a/zephyr/test/drivers/host_cmd/src/usb_pd_control.c b/zephyr/test/drivers/host_cmd/src/usb_pd_control.c
index f926c2b7ca..c439141da9 100644
--- a/zephyr/test/drivers/host_cmd/src/usb_pd_control.c
+++ b/zephyr/test/drivers/host_cmd/src/usb_pd_control.c
@@ -3,6 +3,9 @@
* found in the LICENSE file.
*/
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "console.h"
#include "ec_commands.h"
#include "emul/emul_isl923x.h"
@@ -13,9 +16,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
#define TEST_PORT USBC_PORT_C0
#define BAD_PORT 42
@@ -99,7 +99,7 @@ ZTEST_USER(host_cmd_usb_pd_control, test_bad_index)
{
struct ec_response_usb_pd_control_v2 response;
- zassert_true(board_get_usb_pd_port_count() < BAD_PORT,
+ zassume_true(board_get_usb_pd_port_count() < BAD_PORT,
"Intended bad port exists");
zassert_equal(run_usb_pd_control(BAD_PORT, &response),
EC_RES_INVALID_PARAM,
@@ -130,7 +130,7 @@ static void host_cmd_usb_pd_control_before(void *data)
ARG_UNUSED(data);
/* Assume we have at least one USB-C port */
- zassert_true(board_get_usb_pd_port_count() > 0,
+ zassume_true(board_get_usb_pd_port_count() > 0,
"Insufficient TCPCs found");
/* Set the system into S0, since the AP would drive these commands */
diff --git a/zephyr/test/drivers/host_cmd/src/usb_pd_host_cmd.c b/zephyr/test/drivers/host_cmd/src/usb_pd_host_cmd.c
index d95461f274..3afc90760a 100644
--- a/zephyr/test/drivers/host_cmd/src/usb_pd_host_cmd.c
+++ b/zephyr/test/drivers/host_cmd/src/usb_pd_host_cmd.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
#include "usb_pd.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
ZTEST_USER(usb_pd_host_cmd, test_hc_pd_host_event_status)
{
struct ec_response_host_event_status response;
diff --git a/zephyr/test/drivers/host_cmd_read_memmap/CMakeLists.txt b/zephyr/test/drivers/host_cmd_read_memmap/CMakeLists.txt
deleted file mode 100644
index dedb9f801f..0000000000
--- a/zephyr/test/drivers/host_cmd_read_memmap/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-target_sources(app PRIVATE
- src/read_memmap.c
-)
diff --git a/zephyr/test/drivers/host_cmd_read_memmap/src/read_memmap.c b/zephyr/test/drivers/host_cmd_read_memmap/src/read_memmap.c
deleted file mode 100644
index 17ae4109f9..0000000000
--- a/zephyr/test/drivers/host_cmd_read_memmap/src/read_memmap.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-#ifndef CONFIG_PLATFORM_EC_SWITCH
-FAKE_VOID_FUNC(switch_interrupt, int);
-#endif
-
-ZTEST(ec_cmd_read_memmap, id)
-{
- struct ec_params_read_memmap params = {
- .offset = EC_MEMMAP_ID,
- .size = 2,
- };
- uint8_t response[2];
- int rv;
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_READ_MEMMAP, 0, response, params);
-
- rv = host_command_process(&args);
-
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_equal(rv, EC_RES_INVALID_COMMAND, "Got %d", rv);
- return;
- }
-
- zassert_ok(rv, "Got %d", rv);
- /* Response should be 'E' 'C' */
- zassert_equal('E', response[0]);
- zassert_equal('C', response[1]);
-}
-
-ZTEST(ec_cmd_read_memmap, switches)
-{
- struct ec_params_read_memmap params = {
- .offset = EC_MEMMAP_SWITCHES,
- .size = 1,
- };
- uint8_t response[1];
- int rv;
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_READ_MEMMAP, 0, response, params);
-
- rv = host_command_process(&args);
-
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_equal(rv, EC_RES_INVALID_COMMAND, "Got %d", rv);
- return;
- }
-
- /* This test suite is run with CONFIG_PLATFORM_EC_SWITCH enabled
- * and disabled.
- */
- if (IS_ENABLED(CONFIG_PLATFORM_EC_SWITCH)) {
- zassert_ok(rv, "Got %d", rv);
- } else {
- zassert_equal(rv, EC_RES_UNAVAILABLE, "Got %d", rv);
- }
-}
-
-ZTEST(ec_cmd_read_memmap, invalid)
-{
- struct ec_params_read_memmap params = {
- .offset = EC_MEMMAP_ID,
- .size = UINT8_MAX,
- };
- uint8_t response[2];
- int rv;
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_READ_MEMMAP, 0, response, params);
-
- rv = host_command_process(&args);
-
- if (IS_ENABLED(CONFIG_HOSTCMD_X86)) {
- zassert_equal(rv, EC_RES_INVALID_COMMAND, "Got %d", rv);
- return;
- }
-
- /* Verify offset+size exceeding max fails */
- zassert_equal(rv, EC_RES_INVALID_PARAM, "Got %d", rv);
-
- /* Verify params.size > response_max fails */
- params.size = 4;
- zassert_equal(host_command_process(&args), EC_RES_INVALID_PARAM);
-}
-
-ZTEST_SUITE(ec_cmd_read_memmap, drivers_predicate_post_main, NULL, NULL, NULL,
- NULL);
diff --git a/zephyr/test/drivers/host_command_thread/CMakeLists.txt b/zephyr/test/drivers/host_command_thread/CMakeLists.txt
deleted file mode 100644
index 9386414deb..0000000000
--- a/zephyr/test/drivers/host_command_thread/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-target_sources(app PRIVATE src/main.c)
diff --git a/zephyr/test/drivers/host_command_thread/src/main.c b/zephyr/test/drivers/host_command_thread/src/main.c
deleted file mode 100644
index 8b315dd950..0000000000
--- a/zephyr/test/drivers/host_command_thread/src/main.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**
- * @file main.c
- *
- * WARNING:
- * Do not add tests to this binary. This test messes with the main thread and
- * can only run a single test function.
- */
-#include "host_command.h"
-#include "task.h"
-#include "test/drivers/test_state.h"
-
-#include <string.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
-#define CUSTOM_COMMAND_ID 0x0088
-
-/* Pointer to the main thread, defined in kernel/init.c */
-extern struct k_thread z_main_thread;
-
-/* 0 - did not run, 1 - true, -1 - false */
-static int last_check_main_thread_result;
-
-static enum ec_status check_main_thread(struct host_cmd_handler_args *args)
-{
- last_check_main_thread_result = in_host_command_main() ? 1 : -1;
- return EC_RES_SUCCESS;
-}
-
-DECLARE_HOST_COMMAND(CUSTOM_COMMAND_ID, check_main_thread, EC_VER_MASK(0));
-
-static void fake_main_thread(void *a, void *b, void *c)
-{
- host_command_main();
-}
-
-K_THREAD_STACK_DEFINE(fake_main_thread_stack, 4000);
-
-ZTEST_SUITE(host_cmd_thread, drivers_predicate_post_main, NULL, NULL, NULL,
- NULL);
-
-ZTEST(host_cmd_thread, test_takeover)
-{
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND_SIMPLE(CUSTOM_COMMAND_ID, 0);
- const char expected_thread_name[] = "HOSTCMD";
- struct k_thread fake_main_thread_data;
- k_tid_t tid = k_thread_create(
- &fake_main_thread_data, fake_main_thread_stack,
- K_THREAD_STACK_SIZEOF(fake_main_thread_stack), fake_main_thread,
- NULL, NULL, NULL, 1, 0, K_NO_WAIT);
-
- /* Wait for the thread to start */
- k_msleep(500);
-
- /* Get the name of the thread (must be done after the sleep) */
- const char *main_thread_name = k_thread_name_get(&z_main_thread);
-
- /* Verify that the thread is not the hostcmd thread */
- zassert_equal(EC_TASK_PRIORITY(EC_TASK_HOSTCMD_PRIO),
- k_thread_priority_get(&z_main_thread));
- zassert_equal(strlen(expected_thread_name), strlen(main_thread_name));
- zassert_mem_equal(expected_thread_name, main_thread_name,
- strlen(expected_thread_name));
-
- /* Try running a host command */
- host_command_received(&args);
- k_msleep(1000);
-
- /* Make sure that the host command ran, the result should be -1 because
- * it's not the original main thread.
- */
- zassert_equal(-1, last_check_main_thread_result);
-
- /* Kill the extra thread */
- k_thread_abort(tid);
-}
diff --git a/zephyr/test/drivers/i2c_controller/include/basic_i2c_device_emul.h b/zephyr/test/drivers/i2c_controller/include/basic_i2c_device_emul.h
index c235d64825..c60c455dfa 100644
--- a/zephyr/test/drivers/i2c_controller/include/basic_i2c_device_emul.h
+++ b/zephyr/test/drivers/i2c_controller/include/basic_i2c_device_emul.h
@@ -3,10 +3,10 @@
* found in the LICENSE file.
*/
-#include "emul/emul_common_i2c.h"
-
#include <stdint.h>
+#include "emul/emul_common_i2c.h"
+
#define BASIC_I2C_DEV_EXT_ACCESS_REG 0xFF
/**
diff --git a/zephyr/test/drivers/i2c_controller/src/basic_i2c_device_emul.c b/zephyr/test/drivers/i2c_controller/src/basic_i2c_device_emul.c
index 8d00d5d3ba..1b7810ad84 100644
--- a/zephyr/test/drivers/i2c_controller/src/basic_i2c_device_emul.c
+++ b/zephyr/test/drivers/i2c_controller/src/basic_i2c_device_emul.c
@@ -2,14 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <string.h>
+#include <zephyr/device.h>
+
#include "basic_i2c_device_emul.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_stub_device.h"
-#include <string.h>
-
-#include <zephyr/device.h>
-
#define DT_DRV_COMPAT basic_i2c_device
void basic_i2c_device_reset(const struct emul *emul)
diff --git a/zephyr/test/drivers/i2c_controller/src/i2c_controller.c b/zephyr/test/drivers/i2c_controller/src/i2c_controller.c
index 594c3e6888..0beb773297 100644
--- a/zephyr/test/drivers/i2c_controller/src/i2c_controller.c
+++ b/zephyr/test/drivers/i2c_controller/src/i2c_controller.c
@@ -2,15 +2,15 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "basic_i2c_device_emul.h"
-#include "i2c.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/device.h>
#include <zephyr/fff.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/ztest.h>
+#include "basic_i2c_device_emul.h"
+#include "i2c.h"
+#include "test/drivers/test_state.h"
+
struct i2c_controller_fixture {
int port;
int addr;
@@ -61,29 +61,6 @@ ZTEST_F(i2c_controller, write_read32_be)
expected);
}
-ZTEST_F(i2c_controller, write_read16_be)
-{
- uint16_t expected = 0x1122;
- int actual;
-
- zassert_ok(i2c_write16(fixture->port,
- fixture->addr | I2C_FLAG_BIG_ENDIAN, 0,
- expected));
-
- /* Get the first two bytes of the register space as a uint16_t */
- actual = __bswap_16(*((uint16_t *)&fixture->emul_data->regs[0]));
-
- zassert_equal(expected, actual, "got %04x, expected %08x", actual,
- expected);
-
- /* Now read back through I2C API */
- zassert_ok(i2c_read16(fixture->port,
- fixture->addr | I2C_FLAG_BIG_ENDIAN, 0, &actual));
-
- zassert_equal(expected, actual, "got %04x, expected %04x",
- (uint16_t)actual, expected);
-}
-
ZTEST_F(i2c_controller, read32_fail)
{
int ret;
@@ -121,14 +98,6 @@ ZTEST_F(i2c_controller, field_update16)
zassert_equal(set_value, actual, "got %04x, expected %04x", actual,
set_value);
-
- /* Force a failure */
- set_value = 0x0001;
- mask = 0x0001;
- i2c_common_emul_set_read_fail_reg(&fixture->emul_data->common, 0);
- zassert_equal(i2c_field_update16(fixture->port, fixture->addr, 0, mask,
- set_value),
- EC_ERROR_INVAL);
}
ZTEST_F(i2c_controller, read_offset16__one_byte)
@@ -304,89 +273,6 @@ ZTEST_F(i2c_controller, write_offset16_block)
expected);
}
-ZTEST_F(i2c_controller, pec_disabled)
-{
- uint16_t addr_flags;
- uint8_t write_data[] = {
- 0xAA,
- 0xBB,
- 0xCC,
- 0xDD,
- };
- int write_data32 = 0x11223344;
- uint8_t read_data[4];
- int actual_read_len;
- uint16_t reg = 0x01;
-
- /*
- * Verify I2C reads and writes through the various APIs fail when
- * CONFIG_PLATFORM_EC_SMBUS_PEC=n
- */
- if (IS_ENABLED(CONFIG_PLATFORM_EC_SMBUS_PEC)) {
- ztest_test_skip();
- return;
- }
-
- addr_flags = fixture->addr | I2C_FLAG_PEC;
-
- zassert_equal(i2c_read32(fixture->port, addr_flags, reg,
- (int *)read_data),
- EC_ERROR_UNIMPLEMENTED);
- zassert_equal(i2c_write32(fixture->port, addr_flags, reg, write_data32),
- EC_ERROR_UNIMPLEMENTED);
- zassert_equal(i2c_read_sized_block(fixture->port, addr_flags, reg,
- read_data, sizeof(read_data),
- &actual_read_len),
- EC_ERROR_UNIMPLEMENTED);
- zassert_equal(i2c_read_sized_block(fixture->port, addr_flags, reg,
- read_data, 0, &actual_read_len),
- EC_ERROR_INVAL);
- zassert_equal(i2c_write_block(fixture->port, addr_flags, reg,
- write_data, sizeof(write_data)),
- EC_ERROR_UNIMPLEMENTED);
-}
-
-ZTEST_F(i2c_controller, i2c_xfer_unlocked__error_paths)
-{
- uint8_t out_buffer[1];
- int out_size;
- uint8_t in_buffer[1];
- int in_size;
- int flags;
-
- /* First confirm i2c_xfer_unlocked() works with a lock. */
- out_buffer[0] = 0;
- out_size = 1;
- in_size = 1;
- flags = I2C_XFER_STOP;
-
- i2c_lock(fixture->port, 1);
- zassert_equal(i2c_port_is_locked(fixture->port), 1,
- "Port %d not locked", fixture->port);
- zassert_ok(i2c_xfer_unlocked(fixture->port, fixture->addr, out_buffer,
- out_size, in_buffer, in_size, flags));
- i2c_lock(fixture->port, 0);
- zassert_equal(i2c_port_is_locked(fixture->port), 0, "Port %d is locked",
- fixture->port);
-
- /* Try the transfer without a lock. */
- zassert_equal(i2c_xfer_unlocked(fixture->port, fixture->addr,
- out_buffer, out_size, in_buffer,
- in_size, flags),
- EC_ERROR_INVAL);
-
- /* Set an invalid flag on the transfer, expected to still pass */
- i2c_lock(fixture->port, 1);
- zassert_equal(i2c_port_is_locked(fixture->port), 1,
- "Port %d not locked", fixture->port);
- zassert_ok(i2c_xfer_unlocked(
- fixture->port, fixture->addr | I2C_FLAG_ADDR_IS_SPI, out_buffer,
- out_size, in_buffer, in_size, flags));
- i2c_lock(fixture->port, 0);
- zassert_equal(i2c_port_is_locked(fixture->port), 0, "Port %d is locked",
- fixture->port);
-}
-
static struct i2c_controller_fixture i2c_controller_fixture;
static void *setup(void)
diff --git a/zephyr/test/drivers/isl923x/src/charge_ramp_hw.c b/zephyr/test/drivers/isl923x/src/charge_ramp_hw.c
index a4e326bcec..f27791949e 100644
--- a/zephyr/test/drivers/isl923x/src/charge_ramp_hw.c
+++ b/zephyr/test/drivers/isl923x/src/charge_ramp_hw.c
@@ -3,6 +3,8 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "driver/charger/isl923x.h"
#include "driver/charger/isl923x_public.h"
#include "emul/emul_common_i2c.h"
@@ -10,8 +12,6 @@
#include "test/drivers/charger_utils.h"
#include "test/drivers/test_state.h"
-#include <zephyr/ztest.h>
-
#define CHARGER_NUM get_charger_num(&isl923x_drv)
#define ISL923X_EMUL EMUL_DT_GET(DT_NODELABEL(isl923x_emul))
diff --git a/zephyr/test/drivers/isl923x/src/console_cmd_amon_bmon.c b/zephyr/test/drivers/isl923x/src/console_cmd_amon_bmon.c
index 8eef7ea748..f8cd76d524 100644
--- a/zephyr/test/drivers/isl923x/src/console_cmd_amon_bmon.c
+++ b/zephyr/test/drivers/isl923x/src/console_cmd_amon_bmon.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/adc.h>
+#include <zephyr/drivers/adc/adc_emul.h>
+#include <zephyr/shell/shell.h>
+#include <zephyr/ztest.h>
+
#include "adc.h"
#include "console.h"
#include "driver/charger/isl923x.h"
@@ -14,11 +19,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/drivers/adc.h>
-#include <zephyr/drivers/adc/adc_emul.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/ztest.h>
-
#define ADC_DEVICE_NODE DT_NODELABEL(adc0)
#define CHARGER_NUM get_charger_num(&isl923x_drv)
#define ISL923X_EMUL EMUL_DT_GET(DT_NODELABEL(isl923x_emul))
diff --git a/zephyr/test/drivers/keyboard_scan/include/keyboard_test_utils.h b/zephyr/test/drivers/keyboard_scan/include/keyboard_test_utils.h
index c8b127ca70..0117fea09c 100644
--- a/zephyr/test/drivers/keyboard_scan/include/keyboard_test_utils.h
+++ b/zephyr/test/drivers/keyboard_scan/include/keyboard_test_utils.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c b/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c
index 2865d7efc3..149f25dfdd 100644
--- a/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c
+++ b/zephyr/test/drivers/keyboard_scan/src/keyboard_backlight.c
@@ -3,24 +3,17 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "host_command.h"
-#include "keyboard_backlight.h"
-#include "pwm_mock.h"
-#include "test/drivers/test_state.h"
-
#include <stdint.h>
#include <string.h>
-
-#include <zephyr/drivers/pwm.h>
+#include <zephyr/ztest.h>
#include <zephyr/kernel.h>
#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
-#define KBLIGHT_PWM_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(cros_ec_kblight_pwm)
-
-extern const struct kblight_drv kblight_pwm;
+#include "console.h"
+#include "host_command.h"
+#include "keyboard_backlight.h"
+#include "test/drivers/test_state.h"
/**
* @brief Send host command to set the backlight percentage
@@ -63,7 +56,7 @@ ZTEST(keyboard_backlight, host_command_get_backlight__normal)
uint8_t expected_percentage = 50;
int ret;
- zassert_ok(set_backlight_percent_helper(expected_percentage), NULL);
+ zassume_ok(set_backlight_percent_helper(expected_percentage), NULL);
/* Brief delay to allow a deferred function to enable the backlight */
k_sleep(K_MSEC(50));
@@ -85,7 +78,7 @@ ZTEST(keyboard_backlight, console_command__noargs)
const char *outbuffer;
size_t buffer_size;
- zassert_ok(set_backlight_percent_helper(70), NULL);
+ zassume_ok(set_backlight_percent_helper(70), NULL);
k_sleep(K_MSEC(50));
/* With no args, print current state */
@@ -109,7 +102,7 @@ ZTEST(keyboard_backlight, console_command__set_on)
ZTEST(keyboard_backlight, console_command__set_off)
{
- zassert_ok(set_backlight_percent_helper(40), NULL);
+ zassume_ok(set_backlight_percent_helper(40), NULL);
k_sleep(K_MSEC(50));
/* Turn back off */
@@ -128,26 +121,6 @@ ZTEST(keyboard_backlight, console_command__bad_params)
shell_execute_cmd(get_ec_shell(), "kblight 101"), NULL);
}
-ZTEST(keyboard_backlight, set_backlight__device_not_ready)
-{
- const struct pwm_dt_spec kblight_pwm_dt =
- PWM_DT_SPEC_GET(KBLIGHT_PWM_NODE);
- const struct device *pwm_dev = kblight_pwm_dt.dev;
- int initial_duty;
- int initialized_saved;
-
- initial_duty = pwm_mock_get_duty(pwm_dev, kblight_pwm_dt.channel);
-
- initialized_saved = pwm_dev->state->initialized;
- pwm_dev->state->initialized = 0;
-
- zassert_ok(kblight_pwm.set(initial_duty + 10), NULL);
- zassert_equal(initial_duty,
- pwm_mock_get_duty(pwm_dev, kblight_pwm_dt.channel), NULL);
-
- pwm_dev->state->initialized = initialized_saved;
-}
-
static void reset(void *data)
{
ARG_UNUSED(data);
diff --git a/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c b/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c
index 91b69562b1..03fb71f828 100644
--- a/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c
+++ b/zephyr/test/drivers/keyboard_scan/src/keyboard_scan.c
@@ -2,24 +2,22 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "console.h"
-#include "host_command.h"
-#include "keyboard_scan.h"
-#include "keyboard_test_utils.h"
-#include "test/drivers/test_mocks.h"
-#include "test/drivers/test_state.h"
-
#include <string.h>
-
+#include <zephyr/shell/shell_dummy.h>
+#include <zephyr/ztest.h>
#include <zephyr/drivers/emul.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/fff.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
-
#include <emul/emul_kb_raw.h>
+#include "console.h"
+#include "host_command.h"
+#include "keyboard_scan.h"
+#include "keyboard_test_utils.h"
+#include "test/drivers/test_mocks.h"
+#include "test/drivers/test_state.h"
+
ZTEST(keyboard_scan, test_boot_key)
{
const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(cros_kb_raw));
@@ -132,7 +130,7 @@ ZTEST(keyboard_scan, console_command_ksstate__force)
*/
keyboard_scan_enable(false, -1);
- zassert_false(keyboard_scan_is_enabled());
+ zassume_false(keyboard_scan_is_enabled());
zassert_ok(shell_execute_cmd(get_ec_shell(), "ksstate force"));
@@ -144,7 +142,7 @@ ZTEST(keyboard_scan, console_command_ksstate__on_off)
{
/* This command turns state change printing on/off */
- zassert_false(keyboard_scan_get_print_state_changes());
+ zassume_false(keyboard_scan_get_print_state_changes());
zassert_ok(shell_execute_cmd(get_ec_shell(), "ksstate on"));
zassert_true(keyboard_scan_get_print_state_changes());
@@ -237,7 +235,7 @@ ZTEST(keyboard_scan, host_command_simulate_key__locked)
{
uint16_t ret;
- zassert_true(system_is_locked(), "Expecting locked system.");
+ zassume_true(system_is_locked(), "Expecting locked system.");
struct ec_response_keyboard_factory_test response;
struct ec_params_mkbp_simulate_key params;
@@ -253,7 +251,7 @@ ZTEST(keyboard_scan, host_command_simulate_key__bad_params)
uint16_t ret;
system_is_locked_fake.return_val = 0;
- zassert_false(system_is_locked(), "Expecting unlocked system.");
+ zassume_false(system_is_locked(), "Expecting unlocked system.");
struct ec_response_keyboard_factory_test response;
struct ec_params_mkbp_simulate_key params = {
@@ -295,7 +293,7 @@ ZTEST(keyboard_scan, host_command_simulate__key_press)
uint16_t ret;
system_is_locked_fake.return_val = 0;
- zassert_false(system_is_locked(), "Expecting unlocked system.");
+ zassume_false(system_is_locked(), "Expecting unlocked system.");
ret = send_keypress_host_command(1, 2, 1);
zassert_equal(EC_RES_SUCCESS, ret, "Command returned %u", ret);
@@ -325,7 +323,7 @@ FAKE_VOID_FUNC(chipset_reset, int);
ZTEST(keyboard_scan, special_key_combos)
{
system_is_locked_fake.return_val = 0;
- zassert_false(system_is_locked(), "Expecting unlocked system.");
+ zassume_false(system_is_locked(), "Expecting unlocked system.");
/* Set the volume up key coordinates to something arbitrary */
int vol_up_col = 1;
@@ -334,7 +332,7 @@ ZTEST(keyboard_scan, special_key_combos)
set_vol_up_key(vol_up_row, vol_up_col);
/* Vol up and the alt keys must be in different columns */
- zassert_false(vol_up_col == KEYBOARD_COL_LEFT_ALT, NULL);
+ zassume_false(vol_up_col == KEYBOARD_COL_LEFT_ALT, NULL);
/* Hold down volume up, left alt (either alt key works), and R */
zassert_ok(send_keypress_host_command(vol_up_col, vol_up_row, 1));
diff --git a/zephyr/test/drivers/keyboard_scan/src/keyboard_test_utils.c b/zephyr/test/drivers/keyboard_scan/src/keyboard_test_utils.c
index 4141028408..7b49bd1df4 100644
--- a/zephyr/test/drivers/keyboard_scan/src/keyboard_test_utils.c
+++ b/zephyr/test/drivers/keyboard_scan/src/keyboard_test_utils.c
@@ -1,11 +1,10 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include <zephyr/drivers/emul.h>
-
#include <emul/emul_kb_raw.h>
+#include <zephyr/drivers/emul.h>
const static struct device *dev = DEVICE_DT_GET(DT_NODELABEL(cros_kb_raw));
diff --git a/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c b/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c
index 2d6560fd1e..dee2ba2d1b 100644
--- a/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c
+++ b/zephyr/test/drivers/keyboard_scan/src/mkbp_event.c
@@ -2,23 +2,19 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/fff.h>
+#include <emul/emul_kb_raw.h>
-#include "chipset.h"
#include "console.h"
#include "host_command.h"
#include "mkbp_event.h"
#include "mkbp_fifo.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-
-#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-#include <emul/emul_kb_raw.h>
/**
* @brief FFF fake that will be registered as a callback to monitor the EC->AP
@@ -37,7 +33,7 @@ struct event_fixture {
static struct event_fixture fixture;
-ZTEST(mkbp_event, test_host_command_get_events__empty)
+ZTEST(mkbp_event, host_command_get_events__empty)
{
/* Issue a host command to get the next event (from any source) */
uint16_t ret;
@@ -50,102 +46,7 @@ ZTEST(mkbp_event, test_host_command_get_events__empty)
"Expected EC_RES_UNAVAILABLE but got %d", ret);
}
-ZTEST(mkbp_event, test_activate_with_events)
-{
- const struct device *gpio_dev = DEVICE_DT_GET(
- DT_GPIO_CTLR(DT_NODELABEL(gpio_ap_ec_int_l), gpios));
- const int gpio_pin = DT_GPIO_PIN(DT_NODELABEL(gpio_ap_ec_int_l), gpios);
-
- /* Put the chipset to sleep */
- chipset_force_shutdown(CHIPSET_SHUTDOWN_BUTTON);
- k_sleep(K_SECONDS(15));
-
- /* Activate with no events, should not trigger an interrupt */
- activate_mkbp_with_events(0);
-
- /* Check that GPIO is still 1 */
- zassert_equal(1, gpio_emul_output_get(gpio_dev, gpio_pin));
-}
-
-ZTEST(mkbp_event, test_host_command_host_event_wake_mask)
-{
- struct ec_response_mkbp_event_wake_mask response = { 0 };
- struct ec_params_mkbp_event_wake_mask params = { 0 };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_MKBP_WAKE_MASK, 0, response, params);
-
- /* Set the wake mask to 0x12345678 */
- params.action = SET_WAKE_MASK;
- params.mask_type = EC_MKBP_HOST_EVENT_WAKE_MASK;
- params.new_wake_mask = 0x12345678;
-
- zassert_ok(host_command_process(&args));
-
- /* Get the wake mask */
- params.action = GET_WAKE_MASK;
-
- zassert_ok(host_command_process(&args));
- zassert_equal(0x12345678, response.wake_mask);
-}
-
-ZTEST(mkbp_event, test_host_command_event_wake_mask)
-{
- struct ec_response_mkbp_event_wake_mask response = { 0 };
- struct ec_params_mkbp_event_wake_mask params = { 0 };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_MKBP_WAKE_MASK, 0, response, params);
-
- /* Set the wake mask to 0x87654321 */
- params.action = SET_WAKE_MASK;
- params.mask_type = EC_MKBP_EVENT_WAKE_MASK;
- params.new_wake_mask = 0x87654321;
-
- zassert_ok(host_command_process(&args));
-
- /* Get the wake mask */
- params.action = GET_WAKE_MASK;
-
- zassert_ok(host_command_process(&args));
- zassert_equal(0x87654321, response.wake_mask);
-}
-
-ZTEST(mkbp_event, test_host_command_wake_mask__invalid_args)
-{
- struct ec_response_mkbp_event_wake_mask response = { 0 };
- struct ec_params_mkbp_event_wake_mask params = {
- .action = -1,
- .mask_type = -1,
- };
- struct host_cmd_handler_args args =
- BUILD_HOST_COMMAND(EC_CMD_MKBP_WAKE_MASK, 0, response, params);
-
- /* Check invalid action */
- zassert_equal(EC_RES_INVALID_PARAM, host_command_process(&args));
-
- /* Check invalid mask type in getter */
- params.action = GET_WAKE_MASK;
- zassert_equal(EC_RES_INVALID_PARAM, host_command_process(&args));
-
- /* Check invalid mask type in setter */
- params.action = SET_WAKE_MASK;
- zassert_equal(EC_RES_INVALID_PARAM, host_command_process(&args));
-}
-
-ZTEST(mkbp_event, test_console_command_wake_mask_event)
-{
- check_console_cmd("mkbpwakemask event 500",
- "MKBP event wake mask: 0x000001f4", 0, __FILE__,
- __LINE__);
- check_console_cmd("mkbpwakemask hostevent 7934",
- "MKBP host event wake mask: 0x00001efe", 0, __FILE__,
- __LINE__);
- check_console_cmd("mkbpwakemask event f", NULL, EC_ERROR_PARAM2,
- __FILE__, __LINE__);
- check_console_cmd("mkbpwakemask event", NULL, EC_ERROR_PARAM_COUNT,
- __FILE__, __LINE__);
-}
-
-ZTEST(mkbp_event, test_host_command_get_events__get_event)
+ZTEST(mkbp_event, host_command_get_events__get_event)
{
/* Dispatch a fake keyboard event and ensure it gets returned by the
* host command.
@@ -197,7 +98,7 @@ ZTEST(mkbp_event, test_host_command_get_events__get_event)
interrupt_gpio_monitor_fake.call_count);
}
-ZTEST(mkbp_event, test_no_ap_response)
+ZTEST(mkbp_event, no_ap_response)
{
/* Cause an event but do not send any host commands. This should cause
* the EC to send the interrupt to the AP 3 times before giving up.
@@ -252,7 +153,7 @@ static void *setup(void)
.handler = interrupt_gpio_monitor,
};
- zassert_ok(gpio_add_callback(interrupt_pin->port,
+ zassume_ok(gpio_add_callback(interrupt_pin->port,
&fixture.callback_config),
"Could not configure GPIO callback.");
@@ -282,8 +183,6 @@ static void reset_events(void *data)
RESET_FAKE(interrupt_gpio_monitor);
RESET_FAKE(mkbp_send_event);
mkbp_send_event_fake.return_val = 1;
-
- test_set_chipset_to_s0();
}
ZTEST_SUITE(mkbp_event, drivers_predicate_post_main, setup, reset_events,
diff --git a/zephyr/test/drivers/keyboard_scan/src/mkbp_info.c b/zephyr/test/drivers/keyboard_scan/src/mkbp_info.c
index 6fd1b0f975..b0d64eb1da 100644
--- a/zephyr/test/drivers/keyboard_scan/src/mkbp_info.c
+++ b/zephyr/test/drivers/keyboard_scan/src/mkbp_info.c
@@ -1,7 +1,11 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/fff.h>
+#include <emul/emul_kb_raw.h>
+
#include "console.h"
#include "host_command.h"
#include "keyboard_scan.h"
@@ -10,11 +14,6 @@
#include "mkbp_input_devices.h"
#include "test/drivers/test_state.h"
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-#include <emul/emul_kb_raw.h>
-
ZTEST(mkbp_info, host_command_mkbp_info__keyboard_info)
{
/* Get the number of keyboard rows and columns */
diff --git a/zephyr/test/drivers/led_common/CMakeLists.txt b/zephyr/test/drivers/led_common/CMakeLists.txt
deleted file mode 100644
index 9386414deb..0000000000
--- a/zephyr/test/drivers/led_common/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-target_sources(app PRIVATE src/main.c)
diff --git a/zephyr/test/drivers/led_common/src/main.c b/zephyr/test/drivers/led_common/src/main.c
deleted file mode 100644
index 4a712a3779..0000000000
--- a/zephyr/test/drivers/led_common/src/main.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "led_common.h"
-#include "test/drivers/test_state.h"
-
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED };
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-FAKE_VOID_FUNC(led_get_brightness_range, enum ec_led_id, uint8_t *);
-FAKE_VALUE_FUNC(int, led_set_brightness, enum ec_led_id, const uint8_t *);
-
-ZTEST_SUITE(led_common, drivers_predicate_post_main, NULL, NULL, NULL, NULL);
-
-ZTEST(led_common, test_led_is_supported)
-{
- zassert_true(led_is_supported(EC_LED_ID_BATTERY_LED));
- zassert_true(led_is_supported(EC_LED_ID_POWER_LED));
-
- zassert_false(led_is_supported(EC_LED_ID_ADAPTER_LED));
- zassert_false(led_is_supported(EC_LED_ID_LEFT_LED));
- zassert_false(led_is_supported(EC_LED_ID_RIGHT_LED));
- zassert_false(led_is_supported(EC_LED_ID_RECOVERY_HW_REINIT_LED));
- zassert_false(led_is_supported(EC_LED_ID_SYSRQ_DEBUG_LED));
-}
diff --git a/zephyr/test/drivers/led_driver/led_pins.dts b/zephyr/test/drivers/led_driver/led_pins.dts
index cf57102a3c..f1488a59d8 100644
--- a/zephyr/test/drivers/led_driver/led_pins.dts
+++ b/zephyr/test/drivers/led_driver/led_pins.dts
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
- /* Based off of `ec/zephyr/program/herobrine/led_pins_herobrine.dts`
+ /* Based off of `ec/zephyr/projects/herobrine/led_pins_herobrine.dts`
* Modified led-colors to obtain better test coverage.
*/
/ {
@@ -17,48 +17,42 @@
color_off_left: color-off-left {
led-color = "LED_OFF";
led-id = "EC_LED_ID_SYSRQ_DEBUG_LED";
- led-pins = <&gpio_ec_chg_led_y_c1
- &gpio_ec_chg_led_w_c1>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c1 0>,
+ <&gpio_ec_chg_led_w_c1 0>;
};
color_off_right: color-off-right {
led-color = "LED_OFF";
led-id = "EC_LED_ID_RIGHT_LED";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0>;
- led-values = <0 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 0>;
};
color_blue_left: color-blue-left {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_SYSRQ_DEBUG_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pins = <&gpio_ec_chg_led_y_c1
- &gpio_ec_chg_led_w_c1>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c1 1>,
+ <&gpio_ec_chg_led_w_c1 0>;
};
color_blue_right: color-blue-right {
led-color = "LED_BLUE";
led-id = "EC_LED_ID_RIGHT_LED";
br-color = "EC_LED_COLOR_BLUE";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0>;
- led-values = <1 0>;
+ led-pins = <&gpio_ec_chg_led_y_c0 1>,
+ <&gpio_ec_chg_led_w_c0 0>;
};
color_white_left: color-white-left {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_SYSRQ_DEBUG_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_ec_chg_led_y_c1
- &gpio_ec_chg_led_w_c1>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c1 0>,
+ <&gpio_ec_chg_led_w_c1 1>;
};
color_white_right: color-white-right {
led-color = "LED_WHITE";
led-id = "EC_LED_ID_RIGHT_LED";
br-color = "EC_LED_COLOR_WHITE";
- led-pins = <&gpio_ec_chg_led_y_c0
- &gpio_ec_chg_led_w_c0>;
- led-values = <0 1>;
+ led-pins = <&gpio_ec_chg_led_y_c0 0>,
+ <&gpio_ec_chg_led_w_c0 1>;
};
};
};
diff --git a/zephyr/test/drivers/led_driver/led_policy.dts b/zephyr/test/drivers/led_driver/led_policy.dts
index cad972bf11..fb6d37cb05 100644
--- a/zephyr/test/drivers/led_driver/led_policy.dts
+++ b/zephyr/test/drivers/led_driver/led_policy.dts
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* Based off of `ec/zephyr/program/herobrine/led_policy_herobrine.dts`
+/* Based off of `ec/zephyr/projects/herobrine/led_policy_herobrine.dts`
* Modified led-colors to obtain better test coverage.
*/
diff --git a/zephyr/test/drivers/led_driver/src/led.c b/zephyr/test/drivers/led_driver/src/led.c
index 135f2eab01..4e4023beb4 100644
--- a/zephyr/test/drivers/led_driver/src/led.c
+++ b/zephyr/test/drivers/led_driver/src/led.c
@@ -3,6 +3,7 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
#include "ec_commands.h"
#include "gpio.h"
#include "include/power.h"
@@ -11,8 +12,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/ztest.h>
-
#define VERIFY_LED_COLOR(color, led_id) \
{ \
const struct led_pins_node_t *pin_node = \
diff --git a/zephyr/test/drivers/led_driver/src/led_common.c b/zephyr/test/drivers/led_driver/src/led_common.c
index 2b113499a0..e11a1f1952 100644
--- a/zephyr/test/drivers/led_driver/src/led_common.c
+++ b/zephyr/test/drivers/led_driver/src/led_common.c
@@ -2,13 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/fff.h>
+
#include "host_command.h"
#include "led_common.h"
#include "test/drivers/test_state.h"
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
ZTEST(led_common, host_command__query)
{
/* Gets the brightness range for an LED */
diff --git a/zephyr/test/drivers/locate_chip/src/locate_chip.c b/zephyr/test/drivers/locate_chip/src/locate_chip.c
index 881b17a54c..5e4fd078d7 100644
--- a/zephyr/test/drivers/locate_chip/src/locate_chip.c
+++ b/zephyr/test/drivers/locate_chip/src/locate_chip.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-
#include <zephyr/ztest.h>
+#include "test/drivers/test_state.h"
+#include "host_command.h"
+
ZTEST_SUITE(locate_chip, drivers_predicate_post_main, NULL, NULL, NULL, NULL);
ZTEST_USER(locate_chip, test_invalid_request_for_eeprom)
diff --git a/zephyr/test/drivers/memmap/CMakeLists.txt b/zephyr/test/drivers/memmap/CMakeLists.txt
deleted file mode 100644
index 9386414deb..0000000000
--- a/zephyr/test/drivers/memmap/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-target_sources(app PRIVATE src/main.c)
diff --git a/zephyr/test/drivers/memmap/src/main.c b/zephyr/test/drivers/memmap/src/main.c
deleted file mode 100644
index 89ea2c52cd..0000000000
--- a/zephyr/test/drivers/memmap/src/main.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "flash.h"
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include <zephyr/ztest.h>
-
-extern const char *flash_physical_dataptr_override;
-
-static char flash[CONFIG_FLASH_SIZE_BYTES];
-
-static void after(void *f)
-{
- ARG_UNUSED(f);
- flash_physical_dataptr_override = NULL;
-}
-
-ZTEST_SUITE(memmap, drivers_predicate_post_main, NULL, NULL, after, NULL);
-
-ZTEST(memmap, test_crec_flash_dataptr__invalid)
-{
- zassert_equal(-1, crec_flash_dataptr(/*offset=*/-1, /*size_req=*/1,
- /*align=*/1, /*ptrp=*/NULL));
-}
-
-ZTEST(memmap, test_crec_flash_dataptr)
-{
- const char *ptr = NULL;
-
- zassert_equal(CONFIG_PLATFORM_EC_FLASH_SIZE_BYTES,
- crec_flash_dataptr(0, 1, 1, &ptr));
- zassert_equal(CONFIG_PLATFORM_EC_MAPPED_STORAGE_BASE, (uintptr_t)ptr);
-}
-
-ZTEST(memmap, test_crec_flash_is_erased__invalid_args)
-{
- zassert_equal(0, crec_flash_is_erased(/*offset=*/0, /*size=*/-1));
-}
-
-ZTEST(memmap, test_crec_flash_is_erased__fail)
-{
- sprintf(flash, "non empty data");
- flash_physical_dataptr_override = flash;
- zassert_equal(0, crec_flash_is_erased(/*offset=*/0, /*size=*/8));
-}
-
-ZTEST(memmap, test_crec_flash_is_erased__pass)
-{
- memset(flash, 0xff, 32);
- flash_physical_dataptr_override = flash;
- zassert_equal(1, crec_flash_is_erased(/*offset=*/0, /*size=*/32));
-}
-
-ZTEST(memmap, test_crec_flash_read__invalid_args)
-{
- zassert_equal(EC_ERROR_INVAL, crec_flash_read(/*offset=*/-1, /*size=*/0,
- /*data=*/NULL));
-}
-
-ZTEST(memmap, test_crec_flash_read)
-{
- char output[16] = { 0 };
-
- sprintf(flash, "0123456789abcdef");
- flash_physical_dataptr_override = flash;
-
- zassert_ok(crec_flash_read(/*offset=*/0, ARRAY_SIZE(output), output));
- zassert_mem_equal(output, flash, ARRAY_SIZE(output));
-}
-
-ZTEST(memmap, test_crec_flash_write__invalid_args)
-{
- zassert_equal(EC_ERROR_INVAL,
- crec_flash_write(/*offset=*/-1, /*size=*/0,
- /*data=*/NULL));
-}
-
-ZTEST(memmap, test_crec_flash_erase__invalid_args)
-{
- zassert_equal(EC_ERROR_INVAL,
- crec_flash_erase(/*offset=*/-1, /*size=*/0));
-}
diff --git a/zephyr/test/drivers/mkbp/src/mkbp_fifo.c b/zephyr/test/drivers/mkbp/src/mkbp_fifo.c
index 5d59dababd..b80febbec9 100644
--- a/zephyr/test/drivers/mkbp/src/mkbp_fifo.c
+++ b/zephyr/test/drivers/mkbp/src/mkbp_fifo.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "keyboard_config.h"
-#include "mkbp_fifo.h"
-#include "test/drivers/test_state.h"
-
+#include <zephyr/ztest.h>
#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/i2c_emul.h>
#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
+#include <zephyr/drivers/i2c_emul.h>
+
+#include "keyboard_config.h"
+#include "mkbp_fifo.h"
+#include "test/drivers/test_state.h"
/* Tests for Matrix Keyboard Protocol (MKBP) */
diff --git a/zephyr/test/drivers/power_host_sleep/src/test_power_host_sleep.c b/zephyr/test/drivers/power_host_sleep/src/test_power_host_sleep.c
index 521b4c735b..a76400a98a 100644
--- a/zephyr/test/drivers/power_host_sleep/src/test_power_host_sleep.c
+++ b/zephyr/test/drivers/power_host_sleep/src/test_power_host_sleep.c
@@ -3,6 +3,10 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/ztest_assert.h>
+
#include "ec_commands.h"
#include "hooks.h"
#include "host_command.h"
@@ -11,10 +15,6 @@
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-
#define ARBITRARY_SLEEP_TRANSITIONS 1
/*
diff --git a/zephyr/test/drivers/prj.conf b/zephyr/test/drivers/prj.conf
index 167994a11c..70ecb04422 100644
--- a/zephyr/test/drivers/prj.conf
+++ b/zephyr/test/drivers/prj.conf
@@ -44,11 +44,28 @@ CONFIG_PLATFORM_EC=y
CONFIG_CROS_EC=y
CONFIG_SHIMMED_TASKS=y
CONFIG_EMUL=y
+CONFIG_LOG=y
+CONFIG_I2C=y
+CONFIG_I2C_EMUL=y
CONFIG_GPIO=y
+CONFIG_GPIO_EMUL=y
CONFIG_PLATFORM_EC_GPIO_INIT_PRIORITY=49
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_SIMULATOR=n
CONFIG_EMUL_EEPROM_AT2X=y
+CONFIG_EMUL_SMART_BATTERY=y
+CONFIG_EMUL_BC12_DETECT_PI3USB9201=y
+CONFIG_EMUL_PPC_SYV682X=y
+CONFIG_ADC=y
+CONFIG_ADC_EMUL=y
+CONFIG_EMUL_BMA255=y
+CONFIG_EMUL_BMI=y
+CONFIG_EMUL_TCS3400=y
+CONFIG_EMUL_BB_RETIMER=y
+CONFIG_EMUL_TCPCI=y
+CONFIG_EMUL_PS8XXX=y
+CONFIG_EMUL_RTC=y
CONFIG_EMUL_TCPCI_PARTNER_DRP=y
CONFIG_EMUL_TCPCI_PARTNER_FAULTY_EXT=y
CONFIG_PLATFORM_EC_CHARGE_MANAGER=y
@@ -56,7 +73,6 @@ CONFIG_PLATFORM_EC_CHARGE_RAMP_SW=y
CONFIG_PLATFORM_EC_CHARGESPLASH=y
CONFIG_PLATFORM_EC_POWERSEQ=y
-CONFIG_PLATFORM_EC_CMD_PWR_AVG=y
CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
@@ -64,8 +80,10 @@ CONFIG_PLATFORM_EC_EXTPOWER_GPIO=y
CONFIG_PLATFORM_EC_USB_PID=0x5000
CONFIG_PLATFORM_EC_USBC=y
CONFIG_PLATFORM_EC_USB_CHARGER=y
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_USB_POWER_DELIVERY=y
CONFIG_PLATFORM_EC_USB_PD_5V_EN_CUSTOM=y
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC=y
CONFIG_PLATFORM_EC_CHARGER_DISCHARGE_ON_AC_CHARGER=y
@@ -81,11 +99,11 @@ CONFIG_PLATFORM_EC_USB_PD_REV30=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_HOSTCMD=y
CONFIG_PLATFORM_EC_USB_PD_TCPM_TUSB422=y
-CONFIG_PLATFORM_EC_USB_MUX_RUNTIME_CONFIG=y
CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y
CONFIG_PLATFORM_EC_USBC_PPC_SN5S330=y
+CONFIG_PLATFORM_EC_TEMP_SENSOR=y
CONFIG_PLATFORM_EC_TEMP_SENSOR_POWER=y
-CONFIG_PLATFORM_EC_SWITCH=y
+CONFIG_PLATFORM_EC_THERMISTOR=y
CONFIG_PLATFORM_EC_SWITCHCAP_LN9310=y
CONFIG_PLATFORM_EC_ACCEL_BMA255=y
CONFIG_PLATFORM_EC_MOTIONSENSE=y
@@ -121,6 +139,7 @@ CONFIG_ESPI_PERIPHERAL_EC_HOST_CMD=y
# Things that default to on, but aren't working yet
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+CONFIG_PLATFORM_EC_SWITCH=n
CONFIG_PLATFORM_EC_VBOOT_HASH=n
CONFIG_PLATFORM_EC_POWERSEQ_INTEL=n
CONFIG_PLATFORM_EC_POWERSEQ_PP5000_CONTROL=n
@@ -147,7 +166,9 @@ CONFIG_PLATFORM_EC_KEYBOARD_PROTOCOL_MKBP=y
CONFIG_PLATFORM_EC_MKBP_EVENT=y
CONFIG_PLATFORM_EC_MKBP_USE_GPIO=y
CONFIG_PLATFORM_EC_MKBP_INPUT_DEVICES=y
+CONFIG_EMUL_KB_RAW=y
CONFIG_PLATFORM_EC_KEYBOARD_PWRBTN_ASSERTS_KSI2=y
+CONFIG_EMUL_CROS_FLASH=y
CONFIG_FLASH_SIMULATOR=y
CONFIG_FLASH=y
CONFIG_PLATFORM_EC_VBOOT_HASH=y
@@ -169,3 +190,5 @@ CONFIG_PLATFORM_EC_TABLET_MODE=y
# Power Management (Herobrine arch enables this)
CONFIG_PM=y
+
+CONFIG_PWM_MOCK=y
diff --git a/zephyr/test/drivers/rt9490/charger.dts b/zephyr/test/drivers/rt9490/charger.dts
index 4d4a2a4f35..5a3815490f 100644
--- a/zephyr/test/drivers/rt9490/charger.dts
+++ b/zephyr/test/drivers/rt9490/charger.dts
@@ -4,21 +4,26 @@
compatible = "named-usbc-port";
reg = <0>;
chg = <&rt9490>;
- bc12 = <&rt9490>;
+ bc12 = <&rt9490_bc12>;
tcpc = <&tcpci_emul>;
};
port1@1 {
- bc12 = <&rt9490>;
+ bc12 = <&rt9490_bc12>;
};
};
+
+ rt9490_bc12: rt9490-bc12 {
+ compatible = "richtek,rt9490-bc12";
+ status = "okay";
+ };
};
&i2c0 {
- status = "okay";
+ status="okay";
rt9490: rt9490@53 {
- compatible = "zephyr,rt9490-emul", "richtek,rt9490";
+ compatible = "zephyr,rt9490-emul";
status = "okay";
reg = <0x53>;
};
diff --git a/zephyr/test/drivers/rt9490/prj.conf b/zephyr/test/drivers/rt9490/prj.conf
index 1d1b6c4c71..29c63c48f3 100644
--- a/zephyr/test/drivers/rt9490/prj.conf
+++ b/zephyr/test/drivers/rt9490/prj.conf
@@ -2,8 +2,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+CONFIG_EMUL_RT9490=y
CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=n
CONFIG_PLATFORM_EC_CHARGER_OTG=y
+CONFIG_PLATFORM_EC_CHARGER_RT9490=y
CONFIG_PLATFORM_EC_CHARGE_RAMP_HW=y
CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGER_DUMP=y
CONFIG_PLATFORM_EC_HOOKS=y
diff --git a/zephyr/test/drivers/rt9490/src/bc12.c b/zephyr/test/drivers/rt9490/src/bc12.c
index b32d50768e..eae2308c93 100644
--- a/zephyr/test/drivers/rt9490/src/bc12.c
+++ b/zephyr/test/drivers/rt9490/src/bc12.c
@@ -3,8 +3,11 @@
* found in the LICENSE file.
*/
-#include "charge_manager.h"
+#include <zephyr/ztest.h>
+#include <zephyr/fff.h>
+
#include "charger.h"
+#include "charge_manager.h"
#include "driver/charger/rt9490.h"
#include "driver/tcpm/tcpci.h"
#include "emul/emul_rt9490.h"
@@ -14,16 +17,11 @@
#include "timer.h"
#include "usb_charge.h"
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-FAKE_VALUE_FUNC(int, board_tcpc_post_init, int);
-
static const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(rt9490));
static const struct emul *tcpci_emul = EMUL_DT_GET(DT_NODELABEL(tcpci_emul));
static const int chgnum = CHARGER_SOLO;
-static void run_bc12_test(int reg_value, enum charge_supplier expected_result)
+void run_bc12_test(int reg_value, enum charge_supplier expected_result)
{
int port = 0;
@@ -31,19 +29,7 @@ static void run_bc12_test(int reg_value, enum charge_supplier expected_result)
tcpci_emul_set_reg(tcpci_emul, TCPC_REG_POWER_STATUS,
TCPC_REG_POWER_STATUS_VBUS_PRES |
TCPC_REG_POWER_STATUS_VBUS_DET);
-
- /* This is the same as calling tcpc_config[port].drv->init(port) but
- * also calls our board_tcpc_post_init_fake stub. During the init, the
- * other tasks are also running and will at times also call the same
- * function. So the verification just checks that the call count
- * increased and that the first history element matches the port we
- * provided.
- */
- RESET_FAKE(board_tcpc_post_init);
- zassert_ok(tcpm_init(port));
- zassert_true(board_tcpc_post_init_fake.call_count > 0);
- zassert_equal(port, board_tcpc_post_init_fake.arg0_history[0]);
-
+ zassert_ok(tcpc_config[port].drv->init(port), NULL);
zassert_true(tcpc_config[port].drv->check_vbus_level(port,
VBUS_PRESENT),
NULL);
diff --git a/zephyr/test/drivers/rt9490/src/charger.c b/zephyr/test/drivers/rt9490/src/charger.c
index 2d892f9432..f0d3510b89 100644
--- a/zephyr/test/drivers/rt9490/src/charger.c
+++ b/zephyr/test/drivers/rt9490/src/charger.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "battery_smart.h"
#include "charger.h"
#include "driver/charger/rt9490.h"
#include "emul/emul_rt9490.h"
#include "i2c.h"
-#include <zephyr/ztest.h>
-
static const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(rt9490));
static const int chgnum = CHARGER_SOLO;
diff --git a/zephyr/test/drivers/shim_gpio_id/gpio_id.dts b/zephyr/test/drivers/shim_gpio_id/gpio_id.dts
index cd2303cfa9..050272141f 100644
--- a/zephyr/test/drivers/shim_gpio_id/gpio_id.dts
+++ b/zephyr/test/drivers/shim_gpio_id/gpio_id.dts
@@ -5,16 +5,20 @@
/ {
/* Required to compile board_get_sku_id() from shim/gpio_id.c */
- gpio_id_sku: sku {
+ sku {
compatible = "cros-ec,gpio-id";
+
bits = <&gpio_sku_id0>;
+
system = "ternary";
};
/* Required to compile board_get_version() from shim/gpio_id.c */
- gpio_id_board: board {
+ board {
compatible = "cros-ec,gpio-id";
+
bits = <&gpio_brd_id0>;
+
system = "ternary";
};
};
diff --git a/zephyr/test/drivers/shim_gpio_id/src/test_shim_gpio_id.c b/zephyr/test/drivers/shim_gpio_id/src/test_shim_gpio_id.c
index 5e9381c2a5..035d0c1b48 100644
--- a/zephyr/test/drivers/shim_gpio_id/src/test_shim_gpio_id.c
+++ b/zephyr/test/drivers/shim_gpio_id/src/test_shim_gpio_id.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "system.h"
#include "test/drivers/test_state.h"
#include "util.h"
-#include <zephyr/ztest.h>
-
/*
* TODO(b/254924012): Test alternative GPIO when emulated gpio tristate is
* supported upstream.
diff --git a/zephyr/test/drivers/shim_pwm_hc/src/test_shim_pwm_hc.c b/zephyr/test/drivers/shim_pwm_hc/src/test_shim_pwm_hc.c
index ddc406e58c..847326c0ba 100644
--- a/zephyr/test/drivers/shim_pwm_hc/src/test_shim_pwm_hc.c
+++ b/zephyr/test/drivers/shim_pwm_hc/src/test_shim_pwm_hc.c
@@ -3,6 +3,12 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest_assert.h>
+#include <zephyr/drivers/i2c_emul.h>
+
#include "drivers/cros_displight.h"
#include "ec_commands.h"
#include "host_command.h"
@@ -10,12 +16,6 @@
#include "pwm.h"
#include "test/drivers/test_state.h"
-#include <zephyr/drivers/emul.h>
-#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-
ZTEST(shim_pwm_hc, test_pwm_set_duty_hc__kblight)
{
struct ec_params_pwm_set_duty p = {
@@ -35,8 +35,8 @@ ZTEST(shim_pwm_hc, test_pwm_set_duty_hc__kblight)
ZTEST(shim_pwm_hc, test_pwm_set_duty_hc__displight)
{
struct ec_params_pwm_set_duty p = {
- .index = DT_REG_ADDR(DT_NODELABEL(pwm_displight)),
- .pwm_type = EC_PWM_TYPE_DISPLAY_LIGHT,
+ p.index = DT_REG_ADDR(DT_NODELABEL(pwm_displight)),
+ p.pwm_type = EC_PWM_TYPE_DISPLAY_LIGHT,
/* Arbitrary 72% */
.duty = PWM_PERCENT_TO_RAW(72)
};
diff --git a/zephyr/test/drivers/shim_rtc/src/test_shim_rtc.c b/zephyr/test/drivers/shim_rtc/src/test_shim_rtc.c
index 6f4f9a43e2..b3d2dfa465 100644
--- a/zephyr/test/drivers/shim_rtc/src/test_shim_rtc.c
+++ b/zephyr/test/drivers/shim_rtc/src/test_shim_rtc.c
@@ -3,17 +3,17 @@
* found in the LICENSE file.
*/
+#include <zephyr/drivers/i2c_emul.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/ztest_assert.h>
+
#include "ec_commands.h"
#include "host_command.h"
#include "lpc.h"
#include "system.h"
#include "test/drivers/test_state.h"
-#include <zephyr/drivers/i2c_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-
ZTEST_USER(rtc_shim, test_hc_rtc_set_get_value)
{
struct ec_params_rtc set_value;
diff --git a/zephyr/test/drivers/system/src/system.c b/zephyr/test/drivers/system/src/system.c
index b615dfc2df..4e3009ceab 100644
--- a/zephyr/test/drivers/system/src/system.c
+++ b/zephyr/test/drivers/system/src/system.c
@@ -3,19 +3,19 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/shell/shell_dummy.h>
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "host_command.h"
-#include "mock/power.h"
#include "panic.h"
#include "system.h"
#include "test/drivers/stubs.h"
#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
+#include "mock/power.h"
FAKE_VALUE_FUNC(int, system_run_image_copy_with_flags, enum ec_image, int);
FAKE_VOID_FUNC(system_disable_jump);
diff --git a/zephyr/test/drivers/system/src/system_board_version_cbi.c b/zephyr/test/drivers/system/src/system_board_version_cbi.c
index cd4e40eef2..d076716e23 100644
--- a/zephyr/test/drivers/system/src/system_board_version_cbi.c
+++ b/zephyr/test/drivers/system/src/system_board_version_cbi.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "host_command.h"
#include "system.h"
-#include "test/drivers/test_mocks.h"
#include "test/drivers/test_state.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "test/drivers/test_mocks.h"
FAKE_VALUE_FUNC(int, cbi_get_board_version, uint32_t *);
diff --git a/zephyr/test/drivers/system/src/system_board_version_default.c b/zephyr/test/drivers/system/src/system_board_version_default.c
index 0ef11a8c39..bcd28cc3de 100644
--- a/zephyr/test/drivers/system/src/system_board_version_default.c
+++ b/zephyr/test/drivers/system/src/system_board_version_default.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "host_command.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(system, test_hostcmd_board_version)
{
struct ec_response_board_version response;
diff --git a/zephyr/test/drivers/system/src/system_not_board_ap_set_sku_id.c b/zephyr/test/drivers/system/src/system_not_board_ap_set_sku_id.c
index 2d4e60fdcb..8f71531bb8 100644
--- a/zephyr/test/drivers/system/src/system_not_board_ap_set_sku_id.c
+++ b/zephyr/test/drivers/system/src/system_not_board_ap_set_sku_id.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
-#include "system.h"
-
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "system.h"
+
/* Tests for !CONFIG_HOST_CMD_AP_SET_SKUID */
#define DEFAULT_BOARD_PROVIDED_SKU_ID 0
diff --git a/zephyr/test/drivers/testcase.yaml b/zephyr/test/drivers/testcase.yaml
index 68e77fab94..0aa89b560d 100644
--- a/zephyr/test/drivers/testcase.yaml
+++ b/zephyr/test/drivers/testcase.yaml
@@ -4,39 +4,24 @@ tests:
drivers.default:
timeout: 240
extra_args: CONF_FILE="prj.conf;default/prj.conf"
- DTC_OVERLAY_FILE="default/boards/native_posix.overlay"
extra_configs:
- CONFIG_LINK_TEST_SUITE_DEFAULT=y
- CONFIG_LINK_TEST_SUITE_USB_MALFUNCTION_SINK=y
- CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
- CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
+ - CONFIG_PLATFORM_EC_CBI_EEPROM=y
- CONFIG_PLATFORM_EC_USB_PD_DPS=y
- - CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED=y
- - CONFIG_PLATFORM_EC_CONSOLE_CMD_TCPC_DUMP=y
- drivers.default.bring_up:
- timeout: 240
- extra_args: CONF_FILE="prj.conf;default/prj.conf"
- DTC_OVERLAY_FILE="default/boards/native_posix.overlay"
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_DEFAULT=y
- - CONFIG_LINK_TEST_SUITE_USB_MALFUNCTION_SINK=y
- - CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
- - CONFIG_PLATFORM_EC_BRINGUP=y
- - CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
- - CONFIG_PLATFORM_EC_USB_PD_DPS=y
- - CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED=y
drivers.default.mock_power:
timeout: 240
extra_args: CONF_FILE="prj.conf;default/prj.conf"
- DTC_OVERLAY_FILE="default/boards/native_posix.overlay"
extra_configs:
- CONFIG_LINK_TEST_SUITE_DEFAULT=y
- CONFIG_LINK_TEST_SUITE_USB_MALFUNCTION_SINK=y
- CONFIG_PLATFORM_EC_BATTERY_CUT_OFF=y
- CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
- CONFIG_POWER_SEQUENCE_MOCK=y
+ - CONFIG_PLATFORM_EC_CBI_EEPROM=y
- CONFIG_PLATFORM_EC_USB_PD_DPS=y
- - CONFIG_PLATFORM_EC_I2C_PASSTHRU_RESTRICTED=y
drivers.anx7447:
extra_args: CONF_FILE="prj.conf;anx7447/prj.conf" DTC_OVERLAY_FILE="./boards/native_posix.overlay;./anx7447/tcpc_policy.dts"
extra_configs:
@@ -59,20 +44,17 @@ tests:
drivers.common_cbi:
extra_configs:
- CONFIG_LINK_TEST_SUITE_COMMON_CBI=y
- - CONFIG_PLATFORM_EC_EEPROM_CBI_WP=y
+ - CONFIG_PLATFORM_EC_CBI_EEPROM=y
drivers.common_cbi_gpio:
extra_configs:
- CONFIG_LINK_TEST_SUITE_COMMON_CBI_GPIO=y
- CONFIG_PLATFORM_EC_CBI_GPIO=y
drivers.common_charger:
extra_configs:
- - CONFIG_PLATFORM_EC_CHARGER_INPUT_CURRENT_DERATE_PCT=5
- - CONFIG_PLATFORM_EC_CHARGER_MIN_INPUT_CURRENT_LIMIT=100
- CONFIG_LINK_TEST_SUITE_COMMON_CHARGER=y
# Set to focus testing for Herobrine
# Config is y only in nissa
- CONFIG_PLATFORM_EC_CHARGER_RAA489000=n
- - CONFIG_PLATFORM_EC_CHARGER_RUNTIME_CONFIG=y
drivers.chargesplash:
timeout: 240
extra_configs:
@@ -96,19 +78,6 @@ tests:
- CONFIG_PLATFORM_EC_USB_PD_LOGGING=y
- CONFIG_PLATFORM_EC_LID_ANGLE_UPDATE=y
- CONFIG_PLATFORM_EC_HOST_COMMAND_STATUS=y
- drivers.host_cmd_read_memmap:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_HOST_COMMAND_READ_MEMMAP=y
- - CONFIG_PLATFORM_EC_HOST_COMMAND_STATUS=y
- - CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI=n
- - CONFIG_PLATFORM_EC_HOST_INTERFACE_SHI=y
- drivers.host_cmd_read_memmap.no_switches:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_HOST_COMMAND_READ_MEMMAP=y
- - CONFIG_PLATFORM_EC_HOST_COMMAND_STATUS=y
- - CONFIG_PLATFORM_EC_HOST_INTERFACE_ESPI=n
- - CONFIG_PLATFORM_EC_HOST_INTERFACE_SHI=y
- - CONFIG_PLATFORM_EC_SWITCH=n
drivers.isl923x:
extra_configs:
- CONFIG_LINK_TEST_SUITE_ISL923X=y
@@ -120,6 +89,7 @@ tests:
extra_args: DTC_OVERLAY_FILE="./boards/native_posix.overlay;i2c_controller/i2c.dts"
extra_configs:
- CONFIG_LINK_TEST_SUITE_I2C_CONTROLLER=y
+ - CONFIG_PLATFORM_EC_CBI_EEPROM=y
drivers.keyboard_scan:
extra_configs:
- CONFIG_LINK_TEST_SUITE_KEYBOARD_SCAN=y
@@ -127,14 +97,9 @@ tests:
extra_args: CONF_FILE="prj.conf;led_driver/prj.conf" DTC_OVERLAY_FILE="./boards/native_posix.overlay;./led_driver/led_pins.dts;./led_driver/led_policy.dts"
extra_configs:
- CONFIG_LINK_TEST_SUITE_LED_DRIVER=y
- drivers.led_common:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_LED_COMMON=y
- - CONFIG_PLATFORM_EC_LED_DT=n
drivers.locate_chip:
extra_configs:
- CONFIG_LINK_TEST_SUITE_LOCATE_CHIP_ALTS=y
- - CONFIG_PLATFORM_EC_CBI=n
drivers.mkbp:
extra_configs:
- CONFIG_LINK_TEST_SUITE_MKBP=y
@@ -171,6 +136,7 @@ tests:
- CONFIG_PLATFORM_EC_RTC=y
- CONFIG_PLATFORM_EC_HOSTCMD=y
- CONFIG_PLATFORM_EC_HOSTCMD_RTC=y
+ - CONFIG_EMUL_RTC=y
drivers.system:
tags:
common
@@ -185,17 +151,16 @@ tests:
extra_configs:
- CONFIG_LINK_TEST_SUITE_SYSTEM=y
- CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
+ - CONFIG_PLATFORM_EC_CBI_EEPROM=y
- CONFIG_POWER_SEQUENCE_MOCK=y
drivers.timer:
extra_configs:
- CONFIG_LINK_TEST_SUITE_TIMER=y
- drivers.usb_common:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_USB_COMMON=y
drivers.usb_port_power_dumb:
extra_args: DTC_OVERLAY_FILE="./boards/native_posix.overlay;./usb_port_power_dumb/usba.dts"
extra_configs:
- CONFIG_LINK_TEST_SUITE_USB_PORT_POWER_DUMB=y
+ - CONFIG_PLATFORM_EC_USBA=y
- CONFIG_PLATFORM_EC_USB_PORT_POWER_DUMB=y
drivers.usb_pd_discharge:
extra_configs:
@@ -217,17 +182,13 @@ tests:
- CONFIG_LINK_TEST_SUITE_USBC_ALT_MODE=y
timeout: 120
drivers.usbc_alt_mode_ec_entry:
- timeout: 120
- extra_configs:
+ extra_configs:
- CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY=n
- CONFIG_LINK_TEST_SUITE_USBC_ALT_MODE=y
- CONFIG_POWER_SEQUENCE_MOCK=y
drivers.usbc_console_pd:
extra_configs:
- CONFIG_LINK_TEST_SUITE_USBC_CONSOLE_PD=y
- drivers.usbc_ctvpd:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_USBC_CTVPD=y
drivers.usbc_ocp:
extra_configs:
- CONFIG_LINK_TEST_SUITE_USBC_OCP=y
@@ -236,25 +197,11 @@ tests:
- CONFIG_LINK_TEST_SUITE_USBC_PPC=y
drivers.usbc_svdm_dfp_only:
extra_args: CONF_FILE="prj.conf;usbc_svdm_dfp_only/prj.conf"
- DTC_OVERLAY_FILE="usbc_svdm_dfp_only/boards/native_posix.overlay"
extra_configs:
- CONFIG_LINK_TEST_SUITE_USBC_SVDM_DFP_ONLY=y
drivers.usbc_tbt_mode:
extra_configs:
- CONFIG_LINK_TEST_SUITE_USBC_TBT_MODE=y
- drivers.usbc_usb4_mode:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_USBC_USB4_MODE=y
- - CONFIG_PLATFORM_EC_USB_PD_DATA_RESET_MSG=y
drivers.usbc_vconn_swap:
extra_configs:
- CONFIG_LINK_TEST_SUITE_USBC_VCONN_SWAP=y
- drivers.host_cmd_thread:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_HOST_CMD_THREAD=y
- drivers.pi3usb9201:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_PI3USB9201=y
- drivers.memmap:
- extra_configs:
- - CONFIG_LINK_TEST_SUITE_MEMMAP=y
diff --git a/zephyr/test/drivers/timer/src/timer.c b/zephyr/test/drivers/timer/src/timer.c
index 5cbdae1ea8..d94eb7811e 100644
--- a/zephyr/test/drivers/timer/src/timer.c
+++ b/zephyr/test/drivers/timer/src/timer.c
@@ -2,15 +2,15 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+#include <zephyr/fff.h>
+#include <zephyr/shell/shell_dummy.h>
+
#include "console.h"
#include "host_command.h"
#include "test/drivers/test_state.h"
#include "timer.h"
-#include <zephyr/fff.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
-
BUILD_ASSERT(IS_ENABLED(CONFIG_HWTIMER_64BIT),
"Tests expect the 64-bit HW timer");
diff --git a/zephyr/test/drivers/usb_common/CMakeLists.txt b/zephyr/test/drivers/usb_common/CMakeLists.txt
index 0f05eb1e54..282d4f2ae4 100644
--- a/zephyr/test/drivers/usb_common/CMakeLists.txt
+++ b/zephyr/test/drivers/usb_common/CMakeLists.txt
@@ -8,7 +8,7 @@ project(usb_flags)
target_include_directories(app PRIVATE "include")
-target_sources(app PRIVATE "src/suite.c" "src/usb_common.c")
+target_sources(app PRIVATE "src/suite.c")
target_sources_ifdef(CONFIG_PLATFORM_EC_USB_PD_RUNTIME_FLAGS app PRIVATE
"src/usb_pd_flags.c")
target_sources_ifdef(CONFIG_PLATFORM_EC_USB_PD_DISCHARGE app PRIVATE
diff --git a/zephyr/test/drivers/usb_common/src/suite.c b/zephyr/test/drivers/usb_common/src/suite.c
index 36d3031881..56f3434d4c 100644
--- a/zephyr/test/drivers/usb_common/src/suite.c
+++ b/zephyr/test/drivers/usb_common/src/suite.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
-#include "suite.h"
-
#include <zephyr/fff.h>
#include <zephyr/ztest_test_new.h>
+#include "suite.h"
+
DEFINE_FAKE_VALUE_FUNC(int, board_vbus_source_enabled, int);
DEFINE_FAKE_VALUE_FUNC(int, ppc_discharge_vbus, int, int);
diff --git a/zephyr/test/drivers/usb_common/src/usb_common.c b/zephyr/test/drivers/usb_common/src/usb_common.c
deleted file mode 100644
index f286a4ffc9..0000000000
--- a/zephyr/test/drivers/usb_common/src/usb_common.c
+++ /dev/null
@@ -1,298 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-#include "suite.h"
-#include "timer.h"
-#include "usb_common.h"
-#include "usb_pd.h"
-
-#include <stdint.h>
-
-#include <zephyr/fff.h>
-#include <zephyr/ztest_assert.h>
-#include <zephyr/ztest_test_new.h>
-
-#define TEST_PORT 0
-
-ZTEST_USER(usb_common, test_get_typec_current_limit_detached)
-{
- /* If both CC lines are open, current limit should be 0 A. */
- typec_current_t current = usb_get_typec_current_limit(
- POLARITY_CC1, TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN);
- zassert_equal(current & TYPEC_CURRENT_ILIM_MASK, 0);
- zassert_equal(current & TYPEC_CURRENT_DTS_MASK, 0);
-}
-
-ZTEST_USER(usb_common, test_get_typec_current_limit_rp_default)
-{
- /* USB Default current is 500 mA. */
- typec_current_t current = usb_get_typec_current_limit(
- POLARITY_CC1, TYPEC_CC_VOLT_RP_DEF, TYPEC_CC_VOLT_OPEN);
- zassert_equal(current & TYPEC_CURRENT_ILIM_MASK, 500);
- zassert_equal(current & TYPEC_CURRENT_DTS_MASK, 0);
-}
-
-ZTEST_USER(usb_common, test_get_typec_current_limit_rp_1500)
-{
- typec_current_t current = usb_get_typec_current_limit(
- POLARITY_CC1, TYPEC_CC_VOLT_RP_1_5, TYPEC_CC_VOLT_OPEN);
- zassert_equal(current & TYPEC_CURRENT_ILIM_MASK, 1500);
- zassert_equal(current & TYPEC_CURRENT_DTS_MASK, 0);
-}
-
-ZTEST_USER(usb_common, test_get_typec_current_limit_rp_3000)
-{
- typec_current_t current = usb_get_typec_current_limit(
- POLARITY_CC1, TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_OPEN);
- zassert_equal(current & TYPEC_CURRENT_ILIM_MASK, 3000);
- zassert_equal(current & TYPEC_CURRENT_DTS_MASK, 0);
-}
-
-ZTEST_USER(usb_common, test_get_typec_current_limit_rp_dts)
-{
- /* For a DTS source, Rp 3A/Rp 1.5A indicates USB default current. The
- * DTS flag should be set.
- */
- typec_current_t current = usb_get_typec_current_limit(
- POLARITY_CC1, TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_RP_1_5);
- zassert_equal(current & TYPEC_CURRENT_ILIM_MASK, 500);
- zassert_equal(current & TYPEC_CURRENT_DTS_MASK, TYPEC_CURRENT_DTS_MASK);
-}
-
-ZTEST_USER(usb_common, test_get_snk_polarity)
-{
- zassert_equal(get_snk_polarity(TYPEC_CC_VOLT_RP_3_0,
- TYPEC_CC_VOLT_OPEN),
- POLARITY_CC1);
- zassert_equal(get_snk_polarity(TYPEC_CC_VOLT_OPEN,
- TYPEC_CC_VOLT_RP_3_0),
- POLARITY_CC2);
-}
-
-ZTEST_USER(usb_common, test_get_snk_polarity_dts)
-{
- zassert_equal(get_snk_polarity(TYPEC_CC_VOLT_RP_3_0,
- TYPEC_CC_VOLT_RP_DEF),
- POLARITY_CC1_DTS);
- zassert_equal(get_snk_polarity(TYPEC_CC_VOLT_RP_DEF,
- TYPEC_CC_VOLT_RP_3_0),
- POLARITY_CC2_DTS);
-}
-
-ZTEST_USER(usb_common, test_get_src_polarity)
-{
- zassert_equal(get_src_polarity(TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN),
- POLARITY_CC1);
- zassert_equal(get_src_polarity(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RD),
- POLARITY_CC2);
-}
-
-ZTEST_USER(usb_common, test_pd_get_cc_state)
-{
- zassert_equal(pd_get_cc_state(TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_RD),
- PD_CC_UFP_DEBUG_ACC);
- zassert_equal(pd_get_cc_state(TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN),
- PD_CC_UFP_ATTACHED);
- zassert_equal(pd_get_cc_state(TYPEC_CC_VOLT_RA, TYPEC_CC_VOLT_RA),
- PD_CC_UFP_AUDIO_ACC);
-
- zassert_equal(pd_get_cc_state(TYPEC_CC_VOLT_RP_3_0,
- TYPEC_CC_VOLT_RP_DEF),
- PD_CC_DFP_DEBUG_ACC);
- zassert_equal(pd_get_cc_state(TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_OPEN),
- PD_CC_DFP_ATTACHED);
-
- zassert_equal(pd_get_cc_state(TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN),
- PD_CC_NONE);
-}
-
-ZTEST_USER(usb_common, test_pd_board_check_request_default)
-{
- /* The default implementation accepts any RDO. Just use a basic one. */
- zassert_ok(pd_board_check_request(RDO_FIXED(0, 3000, 3000, 0), 1));
-}
-
-ZTEST_USER(usb_common, test_pd_check_requested_voltage)
-{
- uint32_t rdo;
-
- rdo = RDO_FIXED(1, 1000, 1500, 0);
- zassert_ok(pd_check_requested_voltage(rdo, 0));
-
- /* An index of 0 is invalid. */
- rdo = RDO_FIXED(0, 1000, 1500, 0);
- zassert_equal(pd_check_requested_voltage(rdo, 0), EC_ERROR_INVAL);
- /* So is an index larger than the number of source PDOs, which is 1 by
- * default.
- */
- rdo = RDO_FIXED(5, 1000, 1500, 0);
- zassert_equal(pd_check_requested_voltage(rdo, 0), EC_ERROR_INVAL);
-
- /* So is operating current too high. (This RDO doesn't make sense.) */
- rdo = RDO_FIXED(1, 1800, 1500, 0);
- zassert_equal(pd_check_requested_voltage(rdo, 0), EC_ERROR_INVAL);
- /* So is maximum current too high. */
- rdo = RDO_FIXED(1, 1000, 1800, 0);
- zassert_equal(pd_check_requested_voltage(rdo, 0), EC_ERROR_INVAL);
-}
-
-ZTEST_USER(usb_common, test_board_is_usb_pd_port_present)
-{
- zassert_true(board_is_usb_pd_port_present(TEST_PORT));
- zassert_false(board_is_usb_pd_port_present(-1));
- zassert_false(board_is_usb_pd_port_present(100));
-}
-
-ZTEST_USER(usb_common, test_board_is_dts_port)
-{
- zassert_true(board_is_dts_port(TEST_PORT));
-}
-
-ZTEST_USER(usb_common, test_drp_auto_toggle_next_state_detached)
-{
- uint64_t drp_sink_time = 0;
-
- /* If the port is detached and toggle is disabled, the next state should
- * be the configured default state.
- */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_OFF,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_DEFAULT);
-
- /* If toggle is frozen, the next state should be the current state. */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_FREEZE,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SOURCE, PD_DRP_FREEZE,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_UNATTACHED_SRC);
-
- /* If role is forced, the next state should be the forced state. */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_FORCE_SINK,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_auto_toggle_next_state(&drp_sink_time, PD_ROLE_SOURCE,
- PD_DRP_FORCE_SOURCE,
- TYPEC_CC_VOLT_OPEN,
- TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_UNATTACHED_SRC);
-
- /* If toggle is enabled but auto-toggle is not supported, the next state
- * should be based on the power role. If auto-toggle is supported, the
- * next state should be auto-toggle.
- */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SOURCE, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SRC);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SOURCE, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_DRP_AUTO_TOGGLE);
-}
-
-ZTEST_USER(usb_common, test_drp_auto_toggle_next_state_attached_to_source)
-{
- uint64_t drp_sink_time = 0;
-
- /* If the CC lines show a source attached, then the next state should be
- * a sink state. If auto-toggle is enabled, then the next state should
- * assume that the TCPC is already in AttachWait.SNK.
- */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_OPEN, TYPEC_CC_VOLT_RP_3_0, false),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_ATTACHED_WAIT_SNK);
-
- /* If the DRP state is force-source, keep toggling. */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_FORCE_SOURCE,
- TYPEC_CC_VOLT_RP_3_0, TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_auto_toggle_next_state(&drp_sink_time, PD_ROLE_SOURCE,
- PD_DRP_FORCE_SOURCE,
- TYPEC_CC_VOLT_RP_3_0,
- TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SRC);
- zassert_equal(drp_auto_toggle_next_state(&drp_sink_time, PD_ROLE_SOURCE,
- PD_DRP_FORCE_SOURCE,
- TYPEC_CC_VOLT_RP_3_0,
- TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_DRP_AUTO_TOGGLE);
-}
-
-ZTEST_USER(usb_common, test_drp_auto_toggle_next_state_attached_to_sink)
-{
- uint64_t drp_sink_time = 0;
- timestamp_t fake_time;
-
- /* If the CC lines show a sink, then the next state should be a source
- * state. If auto-toggle is enabled, then the next state should assume
- * that the TCPC is already in AttachWait.SRC.
- */
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SOURCE, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SRC);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SOURCE, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_RA, TYPEC_CC_VOLT_OPEN, false),
- DRP_TC_UNATTACHED_SRC);
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_ON,
- TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_ATTACHED_WAIT_SRC);
-
- /* If the DRP state is off or force-sink, the TCPC might be in
- * auto-toggle anyway. If the CC lines have been in this state for less
- * than 100 ms, the TCPM should stay in Unattached.SNK and wait for the
- * partner to toggle.
- */
- drp_sink_time = 0;
- fake_time.val = drp_sink_time;
- get_time_mock = &fake_time;
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_OFF,
- TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_UNATTACHED_SNK);
- /* After 100 ms, the next state should be auto-toggle. */
- drp_sink_time = 0;
- fake_time.val = drp_sink_time + 105 * MSEC;
- get_time_mock = &fake_time;
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_OFF,
- TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_DRP_AUTO_TOGGLE);
- /* After 200 ms, the next state should be Unattached.SNK, and
- * drp_sink_time should be updated.
- */
- drp_sink_time = 0;
- fake_time.val = drp_sink_time + 205 * MSEC;
- get_time_mock = &fake_time;
- zassert_equal(drp_auto_toggle_next_state(
- &drp_sink_time, PD_ROLE_SINK, PD_DRP_TOGGLE_OFF,
- TYPEC_CC_VOLT_RD, TYPEC_CC_VOLT_OPEN, true),
- DRP_TC_UNATTACHED_SNK);
- zassert_equal(drp_sink_time, fake_time.val);
-
- get_time_mock = NULL;
-}
diff --git a/zephyr/test/drivers/usb_common/src/usb_pd_discharge.c b/zephyr/test/drivers/usb_common/src/usb_pd_discharge.c
index 847840e3e5..e691d8e76b 100644
--- a/zephyr/test/drivers/usb_common/src/usb_pd_discharge.c
+++ b/zephyr/test/drivers/usb_common/src/usb_pd_discharge.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "suite.h"
-#include "usb_pd.h"
-#include "usb_pd_flags.h"
-
#include <zephyr/fff.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "suite.h"
+#include "usb_pd.h"
+#include "usb_pd_flags.h"
+
#define TEST_PORT 0
ZTEST_USER(usb_common, test_pd_set_vbus_discharge)
diff --git a/zephyr/test/drivers/usb_common/src/usb_pd_flags.c b/zephyr/test/drivers/usb_common/src/usb_pd_flags.c
index 05765da7b8..8fe73bd141 100644
--- a/zephyr/test/drivers/usb_common/src/usb_pd_flags.c
+++ b/zephyr/test/drivers/usb_common/src/usb_pd_flags.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "usb_pd.h"
-#include "usb_pd_flags.h"
-
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "usb_pd.h"
+#include "usb_pd_flags.h"
+
ZTEST_USER(usb_common, test_usb_pd_charger_otg)
{
set_usb_pd_charger_otg(USB_PD_CHARGER_OTG_ENABLED);
diff --git a/zephyr/test/drivers/usb_malfunction_sink/src/usb_malfunction_sink.c b/zephyr/test/drivers/usb_malfunction_sink/src/usb_malfunction_sink.c
index fd6cab7bad..1a78d73c7b 100644
--- a/zephyr/test/drivers/usb_malfunction_sink/src/usb_malfunction_sink.c
+++ b/zephyr/test/drivers/usb_malfunction_sink/src/usb_malfunction_sink.c
@@ -3,23 +3,22 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/ztest.h>
+
#include "battery_smart.h"
#include "emul/emul_isl923x.h"
#include "emul/emul_smart_battery.h"
#include "emul/tcpc/emul_tcpci_partner_faulty_ext.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "tcpm/tcpci.h"
-#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include "timer.h"
+#include "test/drivers/stubs.h"
#include "usb_pd.h"
#include "usb_tc_sm.h"
-
-#include <stdint.h>
-
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/ztest.h>
+#include "timer.h"
/* USB-C port used to connect port partner in this testsuite */
#define TEST_PORT 0
diff --git a/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c b/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c
index 7594a6158e..25331acc20 100644
--- a/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c
+++ b/zephyr/test/drivers/usb_port_power_dumb/src/usb_port_power_dumb.c
@@ -3,19 +3,18 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "gpio.h"
-#include "host_command.h"
-#include "test/drivers/test_state.h"
-#include "usb_charge.h"
-
#include <stdint.h>
#include <string.h>
-
#include <zephyr/kernel.h>
#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
+#include <zephyr/ztest.h>
+
+#include "console.h"
+#include "gpio.h"
+#include "host_command.h"
+#include "test/drivers/test_state.h"
+#include "usb_charge.h"
/* Expecting at least one port */
BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) >= 1);
@@ -142,7 +141,7 @@ static void reset(void *data)
ARG_UNUSED(data);
/* Turn the port off */
- zassert_ok(usb_charge_set_mode(PORT_ID, USB_CHARGE_MODE_DISABLED,
+ zassume_ok(usb_charge_set_mode(PORT_ID, USB_CHARGE_MODE_DISABLED,
USB_DISALLOW_SUSPEND_CHARGE),
NULL);
}
diff --git a/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c b/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c
index 21a471f22a..9a360761ab 100644
--- a/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c
+++ b/zephyr/test/drivers/usb_retimer_fw_update/src/usb_retimer_fw_update.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "test/drivers/stubs.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
#include "usb_common.h"
#include "usb_pd.h"
-#include <zephyr/ztest.h>
-
#define BB_RETIMER_NODE DT_NODELABEL(usb_c1_bb_retimer_emul)
#define TEST_PORT USBC_PORT_C1
@@ -40,7 +40,7 @@ static void usb_retimer_fw_update_suspend_port(void)
/* Give PD task time to suspend port */
k_sleep(K_SECONDS(1));
- zassert_true(acpi_read_and_verify() == 0,
+ zassume_true(acpi_read_and_verify() == 0,
"Failed to see successful suspend");
}
@@ -50,7 +50,7 @@ static void usb_retimer_fw_update_before(void *data)
ARG_UNUSED(data);
/* Assume our common setup of a BB retimer on C1 */
- zassert_true(EMUL_DT_GET(BB_RETIMER_NODE) != NULL,
+ zassume_true(EMUL_DT_GET(BB_RETIMER_NODE) != NULL,
"No BB retimer found on C1");
/* Set chipset to ON, since AP would drive this process */
diff --git a/zephyr/test/drivers/usbc_alt_mode/include/test_usbc_alt_mode.h b/zephyr/test/drivers/usbc_alt_mode/include/test_usbc_alt_mode.h
index ea178fcfaa..2d494af8cf 100644
--- a/zephyr/test/drivers/usbc_alt_mode/include/test_usbc_alt_mode.h
+++ b/zephyr/test/drivers/usbc_alt_mode/include/test_usbc_alt_mode.h
@@ -33,11 +33,4 @@ struct usbc_alt_mode_dp_unsupported_fixture {
struct tcpci_src_emul_data src_ext;
};
-struct usbc_alt_mode_minus_dp_configure_fixture {
- const struct emul *tcpci_emul;
- const struct emul *charger_emul;
- struct tcpci_partner_data partner;
- struct tcpci_src_emul_data src_ext;
-};
-
#endif /* ZEPHYR_TEST_DRIVERS_USBC_ALT_MODE_TEST_USBC_ALT_MODE_H_ */
diff --git a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c
index c6387aae64..43ccc3b3f3 100644
--- a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c
+++ b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "ec_commands.h"
#include "ec_tasks.h"
#include "emul/emul_isl923x.h"
@@ -11,18 +16,12 @@
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "host_command.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
+#include "tcpm/tcpci.h"
#include "test/drivers/utils.h"
+#include "test/drivers/test_state.h"
#include "test_usbc_alt_mode.h"
-#include <stdint.h>
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
#define TEST_PORT 0
/* Arbitrary */
@@ -42,7 +41,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul,
* function.
*/
set_ac_enabled(true);
- zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul),
+ zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul),
NULL);
isl923x_emul_set_adc_vbus(charger_emul,
@@ -55,7 +54,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul,
static void disconnect_partner_from_port(const struct emul *tcpc_emul,
const struct emul *charger_emul)
{
- zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul));
+ zassume_ok(tcpci_emul_disconnect_partner(tcpc_emul));
isl923x_emul_set_adc_vbus(charger_emul, 0);
k_sleep(K_SECONDS(1));
}
@@ -130,40 +129,6 @@ static void add_displayport_mode_responses(struct tcpci_partner_data *partner)
partner->dp_config_vdos = VDO_INDEX_HDR + 1;
}
-static void add_displayport_mode_responses__minus_configure_responses(
- struct tcpci_partner_data *partner)
-{
- /*
- * This is the same function as add_displayport_mode_responses() but
- * does not include the configure response so as to induce a failure to
- * enter dp alt mode
- */
-
- /* Add DisplayPort EnterMode response */
- partner->enter_mode_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_DISPLAYPORT, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_ENTER_MODE);
- partner->enter_mode_vdos = VDO_INDEX_HDR + 1;
-
- /* Add DisplayPort StatusUpdate response */
- partner->dp_status_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_DISPLAYPORT, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DP_STATUS);
- partner->dp_status_vdm[VDO_INDEX_HDR + 1] =
- /* Mainly copied from hoho */
- VDO_DP_STATUS(0, /* IRQ_HPD */
- false, /* HPD_HI|LOW - Changed*/
- 0, /* request exit DP */
- 0, /* request exit USB */
- 0, /* MF pref */
- true, /* DP Enabled */
- 0, /* power low e.g. normal */
- 0x2 /* Connected as Sink */);
- partner->dp_status_vdos = VDO_INDEX_HDR + 2;
-
- /* NO DisplayPort Configure Response */
-}
-
static void *usbc_alt_mode_setup(void)
{
static struct usbc_alt_mode_fixture fixture;
@@ -429,79 +394,3 @@ ZTEST_SUITE(usbc_alt_mode_dp_unsupported, drivers_predicate_post_main,
usbc_alt_mode_dp_unsupported_setup,
usbc_alt_mode_dp_unsupported_before,
usbc_alt_mode_dp_unsupported_after, NULL);
-
-static void *usbc_alt_mode_minus_dp_configure_setup(void)
-{
- static struct usbc_alt_mode_minus_dp_configure_fixture fixture;
- struct tcpci_partner_data *partner = &fixture.partner;
- struct tcpci_src_emul_data *src_ext = &fixture.src_ext;
-
- tcpci_partner_init(partner, PD_REV20);
- partner->extensions = tcpci_src_emul_init(src_ext, partner, NULL);
-
- /* Get references for the emulators */
- fixture.tcpci_emul = EMUL_GET_USBC_BINDING(TEST_PORT, tcpc);
- fixture.charger_emul = EMUL_GET_USBC_BINDING(TEST_PORT, chg);
-
- add_discovery_responses(partner);
- add_displayport_mode_responses__minus_configure_responses(partner);
-
- return &fixture;
-}
-
-static void usbc_alt_mode_minus_dp_configure_before(void *data)
-{
- /* Set chipset to ON, this will set TCPM to DRP */
- test_set_chipset_to_s0();
-
- /* TODO(b/214401892): Check why need to give time TCPM to spin */
- k_sleep(K_SECONDS(1));
-
- struct usbc_alt_mode_minus_dp_configure_fixture *fixture = data;
-
- connect_partner_to_port(fixture->tcpci_emul, fixture->charger_emul,
- &fixture->partner, &fixture->src_ext);
-}
-
-static void usbc_alt_mode_minus_dp_configure_after(void *data)
-{
- struct usbc_alt_mode_fixture *fixture = data;
-
- disconnect_partner_from_port(fixture->tcpci_emul,
- fixture->charger_emul);
-}
-
-ZTEST_F(usbc_alt_mode_minus_dp_configure, test_dp_mode_entry_minus_config)
-{
- if (IS_ENABLED(CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY)) {
- host_cmd_typec_control_enter_mode(TEST_PORT, TYPEC_MODE_DP);
- k_sleep(K_SECONDS(1));
- }
-
- /* Verify host command when VDOs are present. */
- struct ec_response_typec_status status;
- struct ec_params_usb_pd_get_mode_response response;
- int response_size;
-
- host_cmd_usb_pd_get_amode(TEST_PORT, 0, &response, &response_size);
-
- /* Response should be populated with a DisplayPort VDO */
- zassert_equal(response_size, sizeof(response));
- zassert_equal(response.svid, USB_SID_DISPLAYPORT);
- zassert_equal(response.vdo[0],
- fixture->partner.modes_vdm[response.opos], NULL);
-
- /* DPM configures the partner on DP mode entry */
- /* Verify port partner thinks it's *NOT* configured for DisplayPort */
- zassert_false(fixture->partner.displayport_configured);
- /* Also verify DP config is missing from mux */
- status = host_cmd_typec_status(TEST_PORT);
- zassert_not_equal((status.mux_state & USB_PD_MUX_DP_ENABLED),
- USB_PD_MUX_DP_ENABLED,
- "Failed to *NOT* see DP set in mux");
-}
-
-ZTEST_SUITE(usbc_alt_mode_minus_dp_configure, drivers_predicate_post_main,
- usbc_alt_mode_minus_dp_configure_setup,
- usbc_alt_mode_minus_dp_configure_before,
- usbc_alt_mode_minus_dp_configure_after, NULL);
diff --git a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c
index 597aac4179..dc8806151b 100644
--- a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c
+++ b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode__require_ap_mode_entry.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "test/drivers/utils.h"
-#include "test_usbc_alt_mode.h"
-
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "test/drivers/utils.h"
+#include "test_usbc_alt_mode.h"
+
/* Tests that require CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY enabled */
ZTEST_F(usbc_alt_mode, verify_displayport_mode_reentry)
@@ -97,9 +97,9 @@ ZTEST_F(usbc_alt_mode, verify_mode_exit_via_pd_host_cmd)
* entering an alternate most (DisplayPort specifically) has already
* been verified in another test
*/
- zassert_equal(response_size, sizeof(get_mode_response));
- zassert_equal(get_mode_response.svid, USB_SID_DISPLAYPORT);
- zassert_equal(get_mode_response.vdo[0],
+ zassume_equal(response_size, sizeof(get_mode_response));
+ zassume_equal(get_mode_response.svid, USB_SID_DISPLAYPORT);
+ zassume_equal(get_mode_response.vdo[0],
fixture->partner.modes_vdm[get_mode_response.opos]);
struct ec_params_usb_pd_set_mode_request set_mode_params = {
diff --git a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode_ec_mode_entry.c b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode_ec_mode_entry.c
index ef56332f55..26db31318d 100644
--- a/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode_ec_mode_entry.c
+++ b/zephyr/test/drivers/usbc_alt_mode/src/usbc_alt_mode_ec_mode_entry.c
@@ -3,17 +3,17 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/ztest_assert.h>
+#include <zephyr/ztest_test_new.h>
+
#include "ec_commands.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "mock/power.h"
#include "test/drivers/utils.h"
#include "test_usbc_alt_mode.h"
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-#include <zephyr/ztest_assert.h>
-#include <zephyr/ztest_test_new.h>
-
/* Tests that require CONFIG_PLATFORM_EC_USB_PD_REQUIRE_AP_MODE_ENTRY disabled
*/
diff --git a/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c b/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c
index 37908ce1e4..c1c7d7eb1a 100644
--- a/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c
+++ b/zephyr/test/drivers/usbc_console_pd/src/usbc_console_pd.c
@@ -3,6 +3,12 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/kernel.h>
+#include <zephyr/shell/shell_dummy.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "console.h"
#include "ec_commands.h"
#include "ec_tasks.h"
@@ -12,19 +18,12 @@
#include "emul/tcpc/emul_tcpci_partner_drp.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
#include "host_command.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
+#include "tcpm/tcpci.h"
#include "test/drivers/utils.h"
+#include "test/drivers/test_state.h"
#include "usb_pd.h"
-#include <stdint.h>
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest.h>
-
#define TEST_PORT 0
struct common_fixture {
@@ -51,7 +50,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul,
* function.
*/
set_ac_enabled(true);
- zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul),
+ zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul),
NULL);
isl923x_emul_set_adc_vbus(charger_emul,
@@ -64,7 +63,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul,
static void disconnect_partner_from_port(const struct emul *tcpc_emul,
const struct emul *charger_emul)
{
- zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL);
+ zassume_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL);
isl923x_emul_set_adc_vbus(charger_emul, 0);
k_sleep(K_SECONDS(1));
}
diff --git a/zephyr/test/drivers/usbc_ctvpd/CMakeLists.txt b/zephyr/test/drivers/usbc_ctvpd/CMakeLists.txt
deleted file mode 100644
index 36f88dfcbb..0000000000
--- a/zephyr/test/drivers/usbc_ctvpd/CMakeLists.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
-
-target_sources(app PRIVATE src/main.c)
diff --git a/zephyr/test/drivers/usbc_ctvpd/include/test_usbc_ctvpd.h b/zephyr/test/drivers/usbc_ctvpd/include/test_usbc_ctvpd.h
deleted file mode 100644
index 9ebb740da8..0000000000
--- a/zephyr/test/drivers/usbc_ctvpd/include/test_usbc_ctvpd.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef ZEPHYR_TEST_DRIVERS_USBC_ALT_MODE_TEST_USBC_ALT_MODE_H_
-#define ZEPHYR_TEST_DRIVERS_USBC_ALT_MODE_TEST_USBC_ALT_MODE_H_
-
-#include "compile_time_macros.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "emul/tcpc/emul_tcpci_partner_snk.h"
-#include "emul/tcpc/emul_tcpci_partner_src.h"
-#include "emul/tcpc/emul_tcpci_partner_vpd.h"
-#include "test/drivers/stubs.h"
-
-struct common_fixture {
- const struct emul *tcpci_emul;
- const struct emul *charger_emul;
- struct tcpci_partner_data partner;
- struct tcpci_src_emul_data src_ext;
- struct tcpci_snk_emul_data snk_ext;
- struct tcpci_vpd_emul_data vpd_ext;
-};
-
-struct usbc_ctvpd_fixture {
- struct common_fixture common;
-};
-
-#endif /* ZEPHYR_TEST_DRIVERS_USBC_ALT_MODE_TEST_USBC_ALT_MODE_H_ */
diff --git a/zephyr/test/drivers/usbc_ctvpd/src/main.c b/zephyr/test/drivers/usbc_ctvpd/src/main.c
deleted file mode 100644
index 0bd6639d83..0000000000
--- a/zephyr/test/drivers/usbc_ctvpd/src/main.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-#include "ec_tasks.h"
-#include "emul/emul_isl923x.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "emul/tcpc/emul_tcpci_partner_common.h"
-#include "emul/tcpc/emul_tcpci_partner_snk.h"
-#include "emul/tcpc/emul_tcpci_partner_src.h"
-#include "host_command.h"
-#include "tcpm/tcpci.h"
-#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
-#include "test/drivers/utils.h"
-#include "test_usbc_ctvpd.h"
-#include "usb_pd_vdo.h"
-
-#include <stdint.h>
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
-#define TEST_PORT 0
-BUILD_ASSERT(TEST_PORT == USBC_PORT_C0);
-
-struct tcpci_cable_data charge_through_vpd = {
- .identity_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_PD, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_IDENT),
- .identity_vdm[VDO_INDEX_IDH] = VDO_IDH(
- /* USB host */ false, /* USB device */ false, IDH_PTYPE_VPD,
- /* modal operation */ false, USB_VID_GOOGLE),
- .identity_vdm[VDO_INDEX_CSTAT] = 0xabcdabcd,
- .identity_vdm[VDO_INDEX_PRODUCT] = VDO_PRODUCT(0x1234, 0xabcd),
- /* Hardware version 1, firmware version 2 */
- .identity_vdm[VDO_INDEX_PTYPE_UFP1_VDO] =
- VDO_VPD(1, 2, VPD_MAX_VBUS_20V, VPD_CT_CURRENT_3A,
- VPD_VBUS_IMP(10), VPD_GND_IMP(10), VPD_CTS_SUPPORTED),
- .identity_vdos = VDO_INDEX_PTYPE_UFP1_VDO + 1,
-};
-
-static void disconnect_partner_from_port(const struct emul *tcpc_emul,
- const struct emul *charger_emul)
-{
- zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul));
- isl923x_emul_set_adc_vbus(charger_emul, 0);
- k_sleep(K_SECONDS(1));
-}
-
-static void add_discovery_responses(struct tcpci_partner_data *partner)
-{
- partner->cable = &charge_through_vpd;
- struct tcpci_cable_data *cable = partner->cable;
-
- /* Add Discover Identity response */
- cable->identity_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_PD, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_IDENT);
- cable->identity_vdm[VDO_INDEX_IDH] = VDO_IDH(
- /* USB host */ false, /* USB device */ false, IDH_PTYPE_VPD,
- /* modal operation */ false, USB_VID_GOOGLE);
- cable->identity_vdm[VDO_INDEX_CSTAT] = 0xabcdabcd;
- cable->identity_vdm[VDO_INDEX_PRODUCT] = VDO_PRODUCT(0x1234, 0x5678);
- /* Hardware version 1, firmware version 2 */
- cable->identity_vdm[VDO_INDEX_PTYPE_UFP1_VDO] =
- VDO_VPD(1, 2, VPD_MAX_VBUS_20V, VPD_CT_CURRENT_3A,
- VPD_VBUS_IMP(10), VPD_GND_IMP(10), VPD_CTS_SUPPORTED);
- cable->identity_vdos = VDO_INDEX_PTYPE_UFP1_VDO + 1;
-}
-
-static void common_before(struct common_fixture *common)
-{
- /* Set chipset to ON, this will set TCPM to DRP */
- test_set_chipset_to_s0();
-
- /* TODO(b/214401892): Check why need to give time TCPM to spin */
- k_sleep(K_SECONDS(1));
-
- connect_sink_to_port(&common->partner, common->tcpci_emul,
- common->charger_emul);
-}
-
-static void common_after(struct common_fixture *common)
-{
- disconnect_partner_from_port(common->tcpci_emul, common->charger_emul);
-}
-
-static void *usbc_ctvpd_setup(void)
-{
- static struct usbc_ctvpd_fixture fixture;
- struct common_fixture *common = &fixture.common;
- struct tcpci_partner_data *partner = &common->partner;
- struct tcpci_vpd_emul_data *vpd_ext = &common->vpd_ext;
-
- tcpci_partner_init(partner, PD_REV30);
- partner->extensions = tcpci_vpd_emul_init(vpd_ext, partner, NULL);
-
- /* Get references for the emulators */
- common->tcpci_emul = EMUL_GET_USBC_BINDING(TEST_PORT, tcpc);
- common->charger_emul = EMUL_GET_USBC_BINDING(TEST_PORT, chg);
-
- add_discovery_responses(partner);
-
- return &fixture;
-}
-
-static void usbc_ctvpd_before(void *data)
-{
- struct usbc_ctvpd_fixture *fixture = data;
-
- common_before(&fixture->common);
-}
-
-static void usbc_ctvpd_after(void *data)
-{
- struct usbc_ctvpd_fixture *fixture = data;
-
- common_after(&fixture->common);
-}
-
-ZTEST_SUITE(usbc_ctvpd, drivers_predicate_post_main, usbc_ctvpd_setup,
- usbc_ctvpd_before, usbc_ctvpd_after, NULL);
-
-ZTEST_USER_F(usbc_ctvpd, verify_discovery)
-{
- uint8_t response_buffer[EC_LPC_HOST_PACKET_SIZE];
- struct ec_response_typec_discovery *discovery =
- (struct ec_response_typec_discovery *)response_buffer;
- struct common_fixture *common = &fixture->common;
-
- host_cmd_typec_discovery(TEST_PORT, TYPEC_PARTNER_SOP_PRIME,
- response_buffer, sizeof(response_buffer));
-
- /* The host command does not count the VDM header in identity_count. */
- zassert_equal(discovery->identity_count,
- common->partner.cable->identity_vdos - 1,
- "Expected %d identity VDOs, got %d",
- common->partner.cable->identity_vdos - 1,
- discovery->identity_count);
- zassert_mem_equal(discovery->discovery_vdo,
- common->partner.cable->identity_vdm + 1,
- discovery->identity_count *
- sizeof(*discovery->discovery_vdo),
- "Discovered SOP identity ACK did not match");
-}
-
-ZTEST_USER_F(usbc_ctvpd, verify_no_vconn_swap)
-{
- struct ec_response_typec_status status =
- host_cmd_typec_status(TEST_PORT);
- enum pd_vconn_role initial_vconn_role = status.vconn_role;
-
- /* Upon initial attachment to the host port of a CT-VPD, the host (TCPM)
- * should be Source and thus VCONN Source. After entry into
- * CTAttached.SNK, the host should remain VCONN Source.
- */
- zassert_equal(initial_vconn_role, PD_ROLE_VCONN_SRC);
-
- /* The TCPM should refuse to VCONN Swap while in CTAttached.SNK. */
- zassert_ok(tcpci_partner_send_control_msg(&fixture->common.partner,
- PD_CTRL_VCONN_SWAP, 0));
- k_sleep(K_SECONDS(1));
- status = host_cmd_typec_status(TEST_PORT);
- zassert_equal(status.vconn_role, initial_vconn_role);
-}
diff --git a/zephyr/test/drivers/usbc_ocp/src/usbc_ocp.c b/zephyr/test/drivers/usbc_ocp/src/usbc_ocp.c
index a7828eb878..f269c1e81f 100644
--- a/zephyr/test/drivers/usbc_ocp/src/usbc_ocp.c
+++ b/zephyr/test/drivers/usbc_ocp/src/usbc_ocp.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "test/drivers/test_state.h"
-#include "timer.h"
-#include "usbc_ocp.h"
-
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
+#include "usbc_ocp.h"
+#include "test/drivers/test_state.h"
+#include "timer.h"
+
/* Tests for USBC OCP (Overcurrent Protection) Common Code */
#define TEST_PORT 0
diff --git a/zephyr/test/drivers/usbc_ppc/src/usbc_ppc.c b/zephyr/test/drivers/usbc_ppc/src/usbc_ppc.c
index c0cd438511..70bf887968 100644
--- a/zephyr/test/drivers/usbc_ppc/src/usbc_ppc.c
+++ b/zephyr/test/drivers/usbc_ppc/src/usbc_ppc.c
@@ -3,16 +3,16 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "test/drivers/test_state.h"
-#include "timer.h"
-#include "usbc_ppc.h"
-
#include <zephyr/kernel.h>
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
#include <zephyr/ztest_assert.h>
+#include "console.h"
+#include "test/drivers/test_state.h"
+#include "timer.h"
+#include "usbc_ppc.h"
+
/* Tests for USBC PPC Common Code */
ZTEST(usbc_ppc, test_ppc_dump__no_args)
diff --git a/zephyr/test/drivers/usbc_svdm_dfp_only/boards/native_posix.overlay b/zephyr/test/drivers/usbc_svdm_dfp_only/boards/native_posix.overlay
deleted file mode 100644
index 0e428e271a..0000000000
--- a/zephyr/test/drivers/usbc_svdm_dfp_only/boards/native_posix.overlay
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "../../boards/native_posix.overlay"
-
-/*
- * The SVDM DFP only tests explicitly do not support USB4/TBT which
- * automatically get turned on if the Burnside Bridge retimer is used.
- * Remove this device from the devicetree.
- */
- /delete-node/ &usb_c1_bb_retimer_emul;
-
- / {
- usbc {
- port1@1 {
- usb-mux-chain-1 {
- usb-muxes = <&virtual_mux_c1>;
- };
- };
- };
-};
diff --git a/zephyr/test/drivers/usbc_svdm_dfp_only/prj.conf b/zephyr/test/drivers/usbc_svdm_dfp_only/prj.conf
index 98cac2ca80..96c16cbd01 100644
--- a/zephyr/test/drivers/usbc_svdm_dfp_only/prj.conf
+++ b/zephyr/test/drivers/usbc_svdm_dfp_only/prj.conf
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
CONFIG_PLATFORM_EC_USBC_RETIMER_INTEL_BB=n
CONFIG_PLATFORM_EC_USB_PD_USB4=n
CONFIG_PLATFORM_EC_USB_PD_TBT_COMPAT_MODE=n
diff --git a/zephyr/test/drivers/usbc_svdm_dfp_only/src/usbc_svdm_dfp_only.c b/zephyr/test/drivers/usbc_svdm_dfp_only/src/usbc_svdm_dfp_only.c
index 5e55042d33..33bc767407 100644
--- a/zephyr/test/drivers/usbc_svdm_dfp_only/src/usbc_svdm_dfp_only.c
+++ b/zephyr/test/drivers/usbc_svdm_dfp_only/src/usbc_svdm_dfp_only.c
@@ -9,15 +9,15 @@
* The tests correspond to TEST.PD.PVDM.SRC.1 Discovery Process and Enter Mode
* as defined by the USB Power Delivery Compliance Test Specification.
*/
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/ztest.h>
+
+#include "usb_pd.h"
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_common.h"
#include "emul/tcpc/emul_tcpci_partner_src.h"
#include "test/drivers/test_state.h"
#include "test/drivers/utils.h"
-#include "usb_pd.h"
-
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/ztest.h>
struct usbc_svdm_dfp_only_fixture {
const struct emul *tcpci_emul;
diff --git a/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c b/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c
index 2fc895bb27..66a145c475 100644
--- a/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c
+++ b/zephyr/test/drivers/usbc_tbt_mode/src/usbc_tbt_mode.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/kernel.h>
+#include <zephyr/sys/byteorder.h>
+#include <zephyr/ztest.h>
+
#include "ec_commands.h"
#include "ec_tasks.h"
#include "emul/emul_isl923x.h"
@@ -10,18 +15,12 @@
#include "emul/tcpc/emul_tcpci.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "host_command.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
+#include "tcpm/tcpci.h"
#include "test/drivers/utils.h"
+#include "test/drivers/test_state.h"
#include "usb_pd_vdo.h"
-#include <stdint.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/ztest.h>
-
#define TEST_PORT USBC_PORT_C0
/* Remove polarity for any mux checks */
#define USB_MUX_CHECK_MASK ~USB_PD_MUX_POLARITY_INVERTED
@@ -256,7 +255,7 @@ ZTEST_F(usbc_tbt_mode, verify_tbt_entry_fail)
fixture->charger_emul);
status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
+ zassume_equal((status.mux_state & USB_MUX_CHECK_MASK),
USB_PD_MUX_USB_ENABLED, "Unexpected starting mux: 0x%02x",
status.mux_state);
@@ -296,7 +295,7 @@ ZTEST_F(usbc_tbt_mode, verify_tbt_passive_entry_exit)
verify_cable_found(fixture->partner.cable);
status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
+ zassume_equal((status.mux_state & USB_MUX_CHECK_MASK),
USB_PD_MUX_USB_ENABLED, "Unexpected starting mux: 0x%02x",
status.mux_state);
diff --git a/zephyr/test/drivers/usbc_usb4_mode/CMakeLists.txt b/zephyr/test/drivers/usbc_usb4_mode/CMakeLists.txt
deleted file mode 100644
index dcf03ae2f6..0000000000
--- a/zephyr/test/drivers/usbc_usb4_mode/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-target_sources(app PRIVATE src/usbc_usb4_mode.c)
diff --git a/zephyr/test/drivers/usbc_usb4_mode/src/usbc_usb4_mode.c b/zephyr/test/drivers/usbc_usb4_mode/src/usbc_usb4_mode.c
deleted file mode 100644
index 536f41577e..0000000000
--- a/zephyr/test/drivers/usbc_usb4_mode/src/usbc_usb4_mode.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-#include "ec_tasks.h"
-#include "emul/tcpc/emul_tcpci.h"
-#include "emul/tcpc/emul_tcpci_partner_snk.h"
-#include "host_command.h"
-#include "test/drivers/stubs.h"
-#include "tcpm/tcpci.h"
-#include "test/drivers/utils.h"
-#include "test/drivers/test_state.h"
-#include "usb_pd_vdo.h"
-
-#include <zephyr/kernel.h>
-#include <zephyr/sys/byteorder.h>
-#include <zephyr/ztest.h>
-
-#include <stdint.h>
-
-#define TEST_PORT USBC_PORT_C0
-/* Remove polarity for any mux checks */
-#define USB_MUX_CHECK_MASK ~USB_PD_MUX_POLARITY_INVERTED
-
-struct usbc_usb4_mode_fixture {
- const struct emul *tcpci_emul;
- const struct emul *charger_emul;
- struct tcpci_partner_data partner;
- struct tcpci_snk_emul_data snk_ext;
-};
-
-/* Passive USB4 cable */
-struct tcpci_cable_data passive_usb4 = {
- .identity_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_PD, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_IDENT),
- .identity_vdm[VDO_INDEX_IDH] = VDO_IDH(
- /* USB host */ false, /* USB device */ false, IDH_PTYPE_PCABLE,
- /* modal operation */ false, USB_VID_GOOGLE),
- .identity_vdm[VDO_INDEX_CSTAT] = 0,
- .identity_vdm[VDO_INDEX_PRODUCT] = VDO_PRODUCT(0x1234, 0xABCD),
- .identity_vdm[VDO_INDEX_PTYPE_CABLE1] =
- VDO_REV30_PASSIVE(USB_R30_SS_U40_GEN3, USB_VBUS_CUR_3A,
- USB_REV30_LATENCY_1m, USB_REV30_TYPE_C),
- .identity_vdos = VDO_INDEX_PTYPE_CABLE1 + 1,
-
-};
-
-static void add_sop_vdm_responses(struct tcpci_partner_data *partner)
-{
- /* Add Discover Identity response */
- partner->identity_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_PD, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_IDENT);
- partner->identity_vdm[VDO_INDEX_IDH] = VDO_IDH_REV30(
- /* USB host */ false, /* USB device */ true,
- /* ptype_u */ IDH_PTYPE_HUB, /* modal */ false,
- /* ptype_d */ IDH_PTYPE_UNDEF, /* ctype */ USB_TYPEC_RECEPTACLE,
- USB_VID_GOOGLE);
- partner->identity_vdm[VDO_INDEX_CSTAT] = 0;
- partner->identity_vdm[VDO_INDEX_PRODUCT] = VDO_PRODUCT(0x1234, 0x5678);
- partner->identity_vdm[VDO_INDEX_PTYPE_UFP1_VDO] = VDO_UFP1(
- /* capability */ (VDO_UFP1_CAPABILITY_USB20 |
- VDO_UFP1_CAPABILITY_USB32 |
- VDO_UFP1_CAPABILITY_USB4),
- /* ctype */ USB_TYPEC_RECEPTACLE,
- /* alt modes */ VDO_UFP1_ALT_MODE_TBT3,
- /* speed */ USB_R30_SS_U40_GEN3);
- partner->identity_vdm[VDO_INDEX_PTYPE_UFP2_VDO] = 0;
- partner->identity_vdos = VDO_INDEX_PTYPE_UFP2_VDO + 1;
-
- /* Add Discover SVIDs response */
- /*
- * TODO(b/260095516): USB4 entry does not depend on the contents of
- * Discover SVIDs, but a valid Discover SVID response needs to to exist
- * to ensure that discovery completes as that's a dependency in the DPM
- * module to attempt either Enter_USB or DATA_RESET.
- */
- partner->svids_vdm[VDO_INDEX_HDR] =
- VDO(USB_SID_PD, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_SVID);
- partner->svids_vdm[VDO_INDEX_HDR + 1] = VDO_SVID(USB_VID_INTEL, 0);
- partner->svids_vdos = VDO_INDEX_HDR + 2;
-
- /* Add Discover Modes response */
- /*
- * TODO(b/260095516): USB4 entry does not depend on the contents of
- * Discover Modes, but a valid Discover Modes response needs to to exist
- * to ensure that discovery completes as that's a dependency in the DPM
- * module to attempt either Enter_USB or DATA_RESET.
- */
- /* Support one mode for TBT (Intel) VID */
- partner->modes_vdm[VDO_INDEX_HDR] =
- VDO(USB_VID_INTEL, /* structured VDM */ true,
- VDO_CMDT(CMDT_RSP_ACK) | CMD_DISCOVER_MODES);
- partner->modes_vdm[VDO_INDEX_HDR + 1] = TBT_ALTERNATE_MODE;
- partner->modes_vdos = VDO_INDEX_HDR + 2;
-}
-
-static void verify_cable_found(struct tcpci_cable_data *cable)
-{
- uint8_t response_buffer[EC_LPC_HOST_PACKET_SIZE];
- struct ec_response_typec_discovery *discovery =
- (struct ec_response_typec_discovery *)response_buffer;
-
- host_cmd_typec_discovery(TEST_PORT, TYPEC_PARTNER_SOP_PRIME,
- response_buffer, sizeof(response_buffer));
-
- /* The host command does not count the VDM header in identity_count. */
- zassert_equal(discovery->identity_count, cable->identity_vdos - 1,
- "Expected %d identity VDOs, got %d",
- cable->identity_vdos - 1, discovery->identity_count);
- zassert_mem_equal(discovery->discovery_vdo, cable->identity_vdm + 1,
- discovery->identity_count *
- sizeof(*discovery->discovery_vdo),
- "Discovered SOP' identity ACK did not match");
-}
-
-static void *usbc_usb4_mode_setup(void)
-{
- static struct usbc_usb4_mode_fixture fixture;
- struct tcpci_partner_data *partner = &fixture.partner;
- struct tcpci_snk_emul_data *snk_ext = &fixture.snk_ext;
-
- tcpci_partner_init(partner, PD_REV30);
- partner->extensions = tcpci_snk_emul_init(snk_ext, partner, NULL);
-
- /* Get references for the emulators */
- fixture.tcpci_emul = EMUL_DT_GET(DT_NODELABEL(tcpci_emul));
- fixture.charger_emul = EMUL_DT_GET(DT_NODELABEL(isl923x_emul));
-
- add_sop_vdm_responses(partner);
- /* Note: cable behavior will vary by test case */
-
- return &fixture;
-}
-
-static void usbc_usb4_mode_before(void *data)
-{
- struct usbc_usb4_mode_fixture *fix = data;
-
- /* Set chipset to ON, this will set TCPM to DRP */
- test_set_chipset_to_s0();
-
- /* TODO(b/214401892): Check why need to give TCPM time to spin */
- k_sleep(K_SECONDS(1));
-
- /* Enable message logging after TCPM spin */
- tcpci_partner_common_enable_pd_logging(&fix->partner, true);
-
- /* Initialize parter port Enter_USB msg accept/reject state */
- fix->partner.enter_usb_accept = false;
-}
-
-static void usbc_usb4_mode_after(void *data)
-{
- struct usbc_usb4_mode_fixture *fix = data;
-
- disconnect_sink_from_port(fix->tcpci_emul);
- tcpci_partner_common_enable_pd_logging(&fix->partner, false);
- tcpci_partner_common_clear_logged_msgs(&fix->partner);
-}
-
-ZTEST_F(usbc_usb4_mode, verify_discovery)
-{
- uint8_t response_buffer[EC_LPC_HOST_PACKET_SIZE];
- struct ec_response_typec_discovery *discovery =
- (struct ec_response_typec_discovery *)response_buffer;
-
- connect_sink_to_port(&fixture->partner, fixture->tcpci_emul,
- fixture->charger_emul);
-
- host_cmd_typec_discovery(TEST_PORT, TYPEC_PARTNER_SOP, response_buffer,
- sizeof(response_buffer));
-
- /* The host command does not count the VDM header in identity_count. */
- zassert_equal(discovery->identity_count,
- fixture->partner.identity_vdos - 1,
- "Expected %d identity VDOs, got %d",
- fixture->partner.identity_vdos - 1,
- discovery->identity_count);
- zassert_mem_equal(
- discovery->discovery_vdo, fixture->partner.identity_vdm + 1,
- discovery->identity_count * sizeof(*discovery->discovery_vdo),
- "Discovered SOP identity ACK did not match");
-}
-
-/* Without an e-marked cable, USB4 mode cannot be entered */
-ZTEST_F(usbc_usb4_mode, verify_usb4_entry_fail)
-{
- struct ec_response_typec_status status;
-
- fixture->partner.cable = NULL;
- connect_sink_to_port(&fixture->partner, fixture->tcpci_emul,
- fixture->charger_emul);
-
- status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
- USB_PD_MUX_USB_ENABLED, "Unexpected starting mux: 0x%02x",
- status.mux_state);
-
- host_cmd_typec_control_enter_mode(TEST_PORT, TYPEC_MODE_USB4);
- k_sleep(K_SECONDS(1));
-
- /*
- * TODO(b/260095516): Notify the AP that the enter mode request
- * failed.
- */
-
- status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
- USB_PD_MUX_USB_ENABLED, "Failed to see USB still set");
- zassert_not_equal((status.mux_state & USB_MUX_CHECK_MASK),
- USB_PD_MUX_USB4_ENABLED, "Unexpected USB4 mode set");
-}
-
-/* With passive e-marked cable, USB4 mode can be entered on SOP only */
-ZTEST_F(usbc_usb4_mode, verify_usb4_passive_entry_exit)
-{
- struct ec_response_typec_status status;
-
- fixture->partner.cable = &passive_usb4;
- connect_sink_to_port(&fixture->partner, fixture->tcpci_emul,
- fixture->charger_emul);
-
- /* Instruct partner port to accept Enter_USB message */
- fixture->partner.enter_usb_accept = true;
-
- /* Verify that we properly identify a USB4 capable passive cable */
- verify_cable_found(fixture->partner.cable);
-
- status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
- USB_PD_MUX_USB_ENABLED, "Unexpected starting mux: 0x%02x",
- status.mux_state);
-
- host_cmd_typec_control_enter_mode(TEST_PORT, TYPEC_MODE_USB4);
- k_sleep(K_SECONDS(2));
-
- /*
- * TODO(b/260095516): Notify the AP that the enter mode request
- * succeeded.
- */
-
- /* Verify we entered USB4 mode */
- status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
- USB_PD_MUX_USB4_ENABLED, "Failed to see USB4 set");
-
- /* Exit modes now */
- host_cmd_typec_control_exit_modes(TEST_PORT);
- k_sleep(K_SECONDS(1));
-
- /* Verify that USB4 mode was exited by checking current mux state. */
- status = host_cmd_typec_status(TEST_PORT);
- zassert_equal((status.mux_state & USB_MUX_CHECK_MASK),
- USB_PD_MUX_USB_ENABLED, "Failed to see USB set");
-}
-
-/*
- * TODO(b/260095516): This test suite is only testing the default good case, and
- * one error case where the cable doesn't support USB4. This suite needs to be
- * expanded to cover cases where the port partner rejects Enter_USB along with
- * active cable cases.
- */
-ZTEST_SUITE(usbc_usb4_mode, drivers_predicate_post_main, usbc_usb4_mode_setup,
- usbc_usb4_mode_before, usbc_usb4_mode_after, NULL);
diff --git a/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c b/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c
index bc1eb6cd0d..324df08826 100644
--- a/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c
+++ b/zephyr/test/drivers/usbc_vconn_swap/src/usbc_vconn_swap.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <stdint.h>
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+
#include "ec_commands.h"
#include "ec_tasks.h"
#include "emul/emul_isl923x.h"
@@ -12,16 +17,10 @@
#include "emul/tcpc/emul_tcpci_partner_drp.h"
#include "emul/tcpc/emul_tcpci_partner_snk.h"
#include "host_command.h"
-#include "tcpm/tcpci.h"
#include "test/drivers/stubs.h"
-#include "test/drivers/test_state.h"
+#include "tcpm/tcpci.h"
#include "test/drivers/utils.h"
-
-#include <stdint.h>
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
+#include "test/drivers/test_state.h"
#define TEST_PORT 0
@@ -53,7 +52,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul,
* function.
*/
set_ac_enabled(true);
- zassert_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul),
+ zassume_ok(tcpci_partner_connect_to_tcpci(partner_emul, tcpc_emul),
NULL);
isl923x_emul_set_adc_vbus(charger_emul,
@@ -66,7 +65,7 @@ static void connect_partner_to_port(const struct emul *tcpc_emul,
static void disconnect_partner_from_port(const struct emul *tcpc_emul,
const struct emul *charger_emul)
{
- zassert_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL);
+ zassume_ok(tcpci_emul_disconnect_partner(tcpc_emul), NULL);
isl923x_emul_set_adc_vbus(charger_emul, 0);
k_sleep(K_SECONDS(1));
}
@@ -167,7 +166,7 @@ ZTEST_F(usbc_vconn_swap, vconn_swap_via_host_command)
struct ec_response_typec_status status =
host_cmd_typec_status(TEST_PORT);
- zassert_equal(status.vconn_role, PD_ROLE_VCONN_SRC,
+ zassume_equal(status.vconn_role, PD_ROLE_VCONN_SRC,
"TCPM did not initiate VCONN Swap after attach");
host_cmd_usb_pd_control(TEST_PORT, USB_PD_CTRL_SWAP_VCONN);
diff --git a/zephyr/test/ec_app/prj.conf b/zephyr/test/ec_app/prj.conf
index 502f5bbdc6..3b44c56b6b 100644
--- a/zephyr/test/ec_app/prj.conf
+++ b/zephyr/test/ec_app/prj.conf
@@ -13,6 +13,7 @@ CONFIG_SHELL_BACKEND_SERIAL=n
CONFIG_SERIAL=y
CONFIG_RING_BUFFER=y
+CONFIG_EMUL_CROS_FLASH=y
CONFIG_PLATFORM_EC_VBOOT_EFS2=y
CONFIG_PLATFORM_EC_VBOOT_HASH=y
CONFIG_PLATFORM_EC_HOSTCMD=y
diff --git a/zephyr/test/ec_app/src/main.c b/zephyr/test/ec_app/src/main.c
index 3c317d2a08..b106754d47 100644
--- a/zephyr/test/ec_app/src/main.c
+++ b/zephyr/test/ec_app/src/main.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest_assert.h>
+#include <zephyr/ztest_test_new.h>
+#include <zephyr/shell/shell_dummy.h>
+
#include "ec_app_main.h"
#include "hooks.h"
#include "task.h"
-#include <zephyr/shell/shell_dummy.h>
-#include <zephyr/ztest_assert.h>
-#include <zephyr/ztest_test_new.h>
-
#ifdef CONFIG_CMD_AP_RESET_LOG
ZTEST(ec_app_tests, test_init_reset_log)
{
diff --git a/zephyr/test/herobrine/CMakeLists.txt b/zephyr/test/herobrine/CMakeLists.txt
index 17b3d973a1..8209eb77fb 100644
--- a/zephyr/test/herobrine/CMakeLists.txt
+++ b/zephyr/test/herobrine/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -6,9 +6,9 @@ cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
project(herobrine)
-zephyr_include_directories("${PLATFORM_EC_PROGRAM_DIR}/herobrine/include")
+zephyr_include_directories("${PLATFORM_EC}/zephyr/projects/herobrine/include")
target_sources_ifdef(CONFIG_TEST_BOARD_CHIPSET
app PRIVATE src/board_chipset.c)
target_sources_ifdef(CONFIG_TEST_BOARD_CHIPSET
- app PRIVATE ${PLATFORM_EC_PROGRAM_DIR}/herobrine/src/board_chipset.c)
+ app PRIVATE ${PLATFORM_EC}/zephyr/projects/herobrine/src/board_chipset.c)
diff --git a/zephyr/test/herobrine/Kconfig b/zephyr/test/herobrine/Kconfig
index 8c3dc24727..415e6e58af 100644
--- a/zephyr/test/herobrine/Kconfig
+++ b/zephyr/test/herobrine/Kconfig
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/test/herobrine/README.md b/zephyr/test/herobrine/README.md
index 646c7ad985..398b27e304 100644
--- a/zephyr/test/herobrine/README.md
+++ b/zephyr/test/herobrine/README.md
@@ -1,3 +1,3 @@
-Tests for board specific code under `zephyr/program/herobrine/src`.
+Tests for board specific code under `zephyr/projects/herobrine/src`.
Run with ./twister -T zephyr/test/herobrine
diff --git a/zephyr/test/herobrine/boards/native_posix.overlay b/zephyr/test/herobrine/boards/native_posix.overlay
index d2afb38db1..bfecc9a7d5 100644
--- a/zephyr/test/herobrine/boards/native_posix.overlay
+++ b/zephyr/test/herobrine/boards/native_posix.overlay
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/test/herobrine/prj.conf b/zephyr/test/herobrine/prj.conf
index 89165e36a8..3334f11939 100644
--- a/zephyr/test/herobrine/prj.conf
+++ b/zephyr/test/herobrine/prj.conf
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/test/herobrine/src/board_chipset.c b/zephyr/test/herobrine/src/board_chipset.c
index 1463547012..77bdb14e16 100644
--- a/zephyr/test/herobrine/src/board_chipset.c
+++ b/zephyr/test/herobrine/src/board_chipset.c
@@ -1,14 +1,14 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "board_chipset.h"
-#include "hooks.h"
-
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "hooks.h"
+#include "board_chipset.h"
+
static int battery_soc_abs_value = 50;
int battery_state_of_charge_abs(int *percent)
diff --git a/zephyr/test/herobrine/testcase.yaml b/zephyr/test/herobrine/testcase.yaml
index 1ccb56582f..e5f17a3848 100644
--- a/zephyr/test/herobrine/testcase.yaml
+++ b/zephyr/test/herobrine/testcase.yaml
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/test/hooks/hooks.c b/zephyr/test/hooks/hooks.c
index bc2840eae5..7d784aa65f 100644
--- a/zephyr/test/hooks/hooks.c
+++ b/zephyr/test/hooks/hooks.c
@@ -3,13 +3,12 @@
* found in the LICENSE file.
*/
-#include "ap_power/ap_power.h"
-#include "hooks.h"
-
#include <stdbool.h>
-
#include <zephyr/ztest.h>
+#include "ap_power/ap_power.h"
+#include "hooks.h"
+
static bool h1_called;
static bool h2_called;
static bool h3_called;
diff --git a/zephyr/test/i2c/prj.conf b/zephyr/test/i2c/prj.conf
index fbf4b53cc3..ee6c43f51a 100644
--- a/zephyr/test/i2c/prj.conf
+++ b/zephyr/test/i2c/prj.conf
@@ -3,9 +3,11 @@
# found in the LICENSE file.
CONFIG_ZTEST=y
-CONFIG_ZTEST_NEW_API=y
+CONFIG_LOG=y
CONFIG_EMUL=y
+CONFIG_I2C=y
+CONFIG_I2C_EMUL=y
CONFIG_BMI160=y
CONFIG_EMUL_BMI160=y
CONFIG_SENSOR=y
diff --git a/zephyr/test/i2c/src/main.c b/zephyr/test/i2c/src/main.c
index 759fe01151..364353f06d 100644
--- a/zephyr/test/i2c/src/main.c
+++ b/zephyr/test/i2c/src/main.c
@@ -3,37 +3,26 @@
* found in the LICENSE file.
*/
-#include "common.h"
-#include "i2c.h"
-#include "i2c/i2c.h"
-
#include <zephyr/devicetree.h>
#include <zephyr/ztest.h>
+#include "common.h"
+#include "i2c/i2c.h"
+#include "i2c.h"
+
/* Unused: required for shimming i2c. */
void watchdog_reload(void)
{
}
-ZTEST_USER(i2c, test_i2c_port_count)
+static void test_i2c_port_count(void)
{
zassert_equal(I2C_PORT_COUNT, 2,
"I2C_PORT_COUNT expected to be 2 but was %d",
I2C_PORT_COUNT);
}
-ZTEST_USER(i2c, test_i2c_lock_invalid_port)
-{
- i2c_lock(-1, 1);
- zassert_equal(i2c_port_is_locked(-1), 0,
- "Negative I2C port locked, but should have failed");
-
- i2c_lock(INT_MAX, 1);
- zassert_equal(i2c_port_is_locked(INT_MAX), 0,
- "MAX_INT I2C port locked, but should have failed");
-}
-
-ZTEST_USER(i2c, test_i2c_lock)
+static void test_i2c_lock(void)
{
i2c_lock(I2C_PORT_ACCEL, 1);
zassert_equal(i2c_port_is_locked(I2C_PORT_EEPROM), 1,
@@ -65,4 +54,10 @@ ZTEST_USER(i2c, test_i2c_lock)
i2c_lock(I2C_PORT_EEPROM, 0);
}
-ZTEST_SUITE(i2c, NULL, NULL, NULL, NULL, NULL);
+/* Test case main entry. */
+void test_main(void)
+{
+ ztest_test_suite(test_i2c, ztest_user_unit_test(test_i2c_port_count),
+ ztest_user_unit_test(test_i2c_lock));
+ ztest_run_test_suite(test_i2c);
+}
diff --git a/zephyr/test/i2c_dts/prj.conf b/zephyr/test/i2c_dts/prj.conf
index 75a6e70ff7..6c008faf64 100644
--- a/zephyr/test/i2c_dts/prj.conf
+++ b/zephyr/test/i2c_dts/prj.conf
@@ -4,8 +4,11 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
+CONFIG_LOG=y
CONFIG_EMUL=y
+CONFIG_I2C=y
+CONFIG_I2C_EMUL=y
CONFIG_BMI160=y
CONFIG_EMUL_BMI160=y
CONFIG_SENSOR=y
diff --git a/zephyr/test/jump_tags/CMakeLists.txt b/zephyr/test/jump_tags/CMakeLists.txt
deleted file mode 100644
index 710195275e..0000000000
--- a/zephyr/test/jump_tags/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-cmake_minimum_required(VERSION 3.20.0)
-find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
-project(jump_tags)
-
-# Include FFF fakes
-add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
-
-FILE(GLOB test_sources src/*.c)
-target_sources(app PRIVATE ${test_sources})
diff --git a/zephyr/test/jump_tags/boards/native_posix.overlay b/zephyr/test/jump_tags/boards/native_posix.overlay
deleted file mode 100644
index 9f3238d076..0000000000
--- a/zephyr/test/jump_tags/boards/native_posix.overlay
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <board-overlays/native_posix.dts>
-#include <cros/binman.dtsi>
-
-/ {
- chosen {
- cros-ec,flash = &flash1;
- cros-ec,flash-controller = &cros_flash;
- };
- aliases {
- gpio-wp = &gpio_wp_l;
- };
- named-gpios {
- compatible = "named-gpios";
- gpio_wp_l: wp_l {
- gpios = <&gpio0 3 (GPIO_INPUT | GPIO_ACTIVE_LOW)>;
- };
- };
- cros_flash: cros-flash {
- compatible = "cros-ec,flash-emul";
- };
- flash1: flash@64000000 {
- reg = <0x64000000 DT_SIZE_K(512)>;
- };
-};
-
-&gpio0 {
- ngpios = <4>;
-};
diff --git a/zephyr/test/jump_tags/prj.conf b/zephyr/test/jump_tags/prj.conf
deleted file mode 100644
index 4e39830c0a..0000000000
--- a/zephyr/test/jump_tags/prj.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-CONFIG_CROS_EC=y
-CONFIG_FLASH=y
-CONFIG_PLATFORM_EC_CONSOLE_CMD_CHARGEN=n
-CONFIG_PLATFORM_EC=y
-CONFIG_SERIAL=y
-CONFIG_SHELL_BACKEND_DUMMY=y
-CONFIG_SHELL_BACKEND_SERIAL=n
-CONFIG_SHIMMED_TASKS=y
-CONFIG_ZTEST_NEW_API=y
-CONFIG_ZTEST=y
diff --git a/zephyr/test/jump_tags/src/jump_tags.c b/zephyr/test/jump_tags/src/jump_tags.c
deleted file mode 100644
index a2a377bb35..0000000000
--- a/zephyr/test/jump_tags/src/jump_tags.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "ec_commands.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "sysjump.h"
-#include "system.h"
-#include "system_fake.h"
-
-#include <setjmp.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
-#define TEST_BASIC_JUMP_TAG 0x9901
-#define TEST_MISSING_JUMP_TAG 0x9902
-#define TEST_MAX_JUMP_TAG 0x9903
-#define TEST_TOO_BIG_JUMP_TAG 0x9904
-
-#define TEST_JUMP_TAG_VERSION 1
-
-#define SOME_STR_VAL "JumpTagTest"
-
-void (*add_tag_func)(void);
-
-struct test_basic_jump_data_struct {
- char some_str[32];
-};
-
-struct test_max_jump_data_struct {
- char some_str[JUMP_TAG_MAX_SIZE];
-};
-
-struct test_too_big_jump_data_struct {
- char some_str[JUMP_TAG_MAX_SIZE + 1];
-};
-
-static void system_before(void *data)
-{
- add_tag_func = NULL;
- system_common_pre_init();
- system_set_shrspi_image_copy(EC_IMAGE_RO);
-}
-
-static void do_fake_sysjump(void)
-{
- jmp_buf env;
- enum ec_image target_image = system_get_image_copy() == EC_IMAGE_RO ?
- EC_IMAGE_RW :
- EC_IMAGE_RO;
-
- if (!setjmp(env)) {
- system_fake_setenv(&env);
- system_run_image_copy(target_image);
- zassert_unreachable();
- }
-
- system_set_shrspi_image_copy(target_image);
- zassert_equal(system_get_image_copy(), target_image);
-}
-
-static void add_max_jump_tag(void)
-{
- struct test_max_jump_data_struct max_tag = {
- .some_str = SOME_STR_VAL,
- };
- zassert_ok(system_add_jump_tag(TEST_MAX_JUMP_TAG, TEST_JUMP_TAG_VERSION,
- sizeof(max_tag), &max_tag));
-}
-
-static void add_too_big_jump_tag(void)
-{
- struct test_too_big_jump_data_struct too_big_tag = {
- .some_str = SOME_STR_VAL,
- };
- zassert_equal(system_add_jump_tag(TEST_TOO_BIG_JUMP_TAG,
- TEST_JUMP_TAG_VERSION,
- sizeof(too_big_tag), &too_big_tag),
- EC_ERROR_INVAL);
-}
-
-static void add_too_many_jump_tags(void)
-{
- int rv;
- struct test_max_jump_data_struct max_tag = {
- .some_str = SOME_STR_VAL,
- };
- /* Ensure at least one tag can be added, but not 10 */
- for (int i = 0; i < 10; i++) {
- rv = system_add_jump_tag(TEST_MAX_JUMP_TAG,
- TEST_JUMP_TAG_VERSION, sizeof(max_tag),
- &max_tag);
- if (rv != 0) {
- zassert_equal(rv, EC_ERROR_INVAL);
- zassert_true(i > 0);
- return;
- }
- }
- zassert_unreachable(
- "Adding too many jump tags failed to result in an error");
-}
-
-static void add_basic_jump_tag(void)
-{
- struct test_basic_jump_data_struct basic_tag = {
- .some_str = SOME_STR_VAL,
- };
- zassert_ok(system_add_jump_tag(TEST_BASIC_JUMP_TAG,
- TEST_JUMP_TAG_VERSION, sizeof(basic_tag),
- &basic_tag));
-}
-
-static void test_sysjump_hook(void)
-{
- if (add_tag_func)
- add_tag_func();
-}
-DECLARE_HOOK(HOOK_SYSJUMP, test_sysjump_hook, HOOK_PRIO_DEFAULT);
-
-static void check_for_jump_tag(int jump_tag, int expected_size)
-{
- int version;
- int size;
- const unsigned char *data;
-
- data = system_get_jump_tag(jump_tag, &version, &size);
- zassert_equal(size, expected_size);
- zassert_equal(version, TEST_JUMP_TAG_VERSION);
- zassert_equal(strcmp(data, SOME_STR_VAL), 0);
-}
-
-ZTEST(jump_tags, test_get_missing_jump_tag)
-{
- int version;
- int size;
- struct test_jump_data_struct *data;
-
- data = (struct test_jump_data_struct *)system_get_jump_tag(
- TEST_MISSING_JUMP_TAG, &version, &size);
- zassert_equal(data, NULL);
-}
-
-ZTEST(jump_tags, test_add_max_jump_tag)
-{
- add_tag_func = add_max_jump_tag;
- do_fake_sysjump();
- check_for_jump_tag(TEST_MAX_JUMP_TAG,
- sizeof(struct test_max_jump_data_struct));
-}
-
-ZTEST(jump_tags, test_too_big_jump_tag)
-{
- add_tag_func = add_too_big_jump_tag;
- do_fake_sysjump();
-}
-
-ZTEST(jump_tags, test_too_many_jump_tags)
-{
- add_tag_func = add_too_many_jump_tags;
- do_fake_sysjump();
- check_for_jump_tag(TEST_MAX_JUMP_TAG,
- sizeof(struct test_max_jump_data_struct));
-}
-
-ZTEST(jump_tags, test_add_basic_jump_tag)
-{
- add_tag_func = add_basic_jump_tag;
- do_fake_sysjump();
- check_for_jump_tag(TEST_BASIC_JUMP_TAG,
- sizeof(struct test_basic_jump_data_struct));
-}
-
-ZTEST_SUITE(jump_tags, NULL, NULL, system_before, NULL, NULL);
diff --git a/zephyr/test/jump_tags/testcase.yaml b/zephyr/test/jump_tags/testcase.yaml
deleted file mode 100644
index 11ef8d73ec..0000000000
--- a/zephyr/test/jump_tags/testcase.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-common:
- platform_allow: native_posix
-tests:
- jump_tags.default:
- extra_configs:
- - CONFIG_PLATFORM_EC_PRESERVED_END_OF_RAM_SIZE=1024
- tags:
- common
- system
diff --git a/zephyr/test/kingler/CMakeLists.txt b/zephyr/test/kingler/CMakeLists.txt
index 725831d2db..6747b2ed99 100644
--- a/zephyr/test/kingler/CMakeLists.txt
+++ b/zephyr/test/kingler/CMakeLists.txt
@@ -8,28 +8,25 @@ project(kingler)
add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
-zephyr_include_directories("${PLATFORM_EC_PROGRAM_DIR}/corsola/include")
+zephyr_include_directories("${PLATFORM_EC}/zephyr/projects/corsola/include")
target_sources(app PRIVATE src/fakes.c)
target_sources_ifdef(CONFIG_TEST_STEELIX_RUSTY
-app PRIVATE ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/kingler/board_steelix.c)
+app PRIVATE ${PLATFORM_EC}/zephyr/projects/corsola/src/kingler/board_steelix.c)
target_sources_ifdef(CONFIG_TEST_FORM_FACTOR_CONVERTIBLE
app PRIVATE src/tablet.c)
target_sources_ifdef(CONFIG_TEST_FORM_FACTOR_CLAMSHELL
app PRIVATE src/clamshell.c)
target_sources_ifdef(CONFIG_VARIANT_CORSOLA_DB_DETECTION
-app PRIVATE ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/variant_db_detection.c)
+app PRIVATE ${PLATFORM_EC}/zephyr/projects/corsola/src/variant_db_detection.c)
target_sources_ifdef(CONFIG_TEST_DB_DETECT_TYPEC
app PRIVATE src/db_detect_typec.c)
target_sources_ifdef(CONFIG_TEST_DB_DETECT_HDMI
- app PRIVATE src/db_detect_hdmi.c
- ${PLATFORM_EC}/zephyr/shim/src/usb_muxes.c
- ${PLATFORM_EC}/driver/usb_mux/usb_mux.c
- ${PLATFORM_EC}/driver/usb_mux/virtual.c)
+ app PRIVATE src/db_detect_hdmi.c)
target_sources_ifdef(CONFIG_TEST_DB_DETECT_NONE
app PRIVATE src/db_detect_none.c)
target_sources_ifdef(CONFIG_TEST_ALT_SENSOR_PROBE
app PRIVATE src/alt_sensor.c)
target_sources_ifdef(CONFIG_TEST_KINGLER_CCD
-app PRIVATE src/ccd.c ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/board.c)
+app PRIVATE src/ccd.c ${PLATFORM_EC}/zephyr/projects/corsola/src/board.c)
diff --git a/zephyr/test/kingler/README.md b/zephyr/test/kingler/README.md
index 84dadc105b..bac3afced2 100644
--- a/zephyr/test/kingler/README.md
+++ b/zephyr/test/kingler/README.md
@@ -1,3 +1,3 @@
-Tests for board specific code under `zephyr/program/corsola/src/kingler`.
+Tests for board specific code under `zephyr/projects/corsola/src/kingler`.
Run with ./twister -T zephyr/test/kingler
diff --git a/zephyr/test/kingler/common.dts b/zephyr/test/kingler/common.dts
index c04844f227..39b6f25036 100644
--- a/zephyr/test/kingler/common.dts
+++ b/zephyr/test/kingler/common.dts
@@ -13,28 +13,10 @@
port0@0 {
compatible = "named-usbc-port";
reg = <0>;
- usb-mux-chain-0 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&virtual_mux_0>;
- };
};
port1@1 {
compatible = "named-usbc-port";
reg = <1>;
- usb-mux-chain-1 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&virtual_mux_1>;
- };
- };
- port0-muxes {
- virtual_mux_0: virtual-mux-0 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
- };
- port1-muxes {
- virtual_mux_1: virtual-mux-1 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
};
};
diff --git a/zephyr/test/kingler/prj.conf b/zephyr/test/kingler/prj.conf
index c8ef8e4304..2eb14afb0e 100644
--- a/zephyr/test/kingler/prj.conf
+++ b/zephyr/test/kingler/prj.conf
@@ -18,9 +18,13 @@ CONFIG_PLATFORM_EC_GMR_TABLET_MODE=y
CONFIG_PLATFORM_EC_TABLET_MODE=y
CONFIG_PLATFORM_EC_LID_ANGLE=y
+CONFIG_I2C=y
CONFIG_I2C_NPCX=n
+CONFIG_PLATFORM_EC_CBI_EEPROM=y
CONFIG_PLATFORM_EC_BOARD_VERSION_CBI=y
CONFIG_EEPROM=y
+CONFIG_EEPROM_AT24=y
CONFIG_EEPROM_SIMULATOR=n
CONFIG_EMUL_EEPROM_AT2X=y
+CONFIG_EEPROM_SHELL=n
diff --git a/zephyr/test/kingler/src/alt_sensor.c b/zephyr/test/kingler/src/alt_sensor.c
index 7cd0ceddfa..fa00a5e874 100644
--- a/zephyr/test/kingler/src/alt_sensor.c
+++ b/zephyr/test/kingler/src/alt_sensor.c
@@ -1,18 +1,18 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "zephyr/kernel.h"
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/ztest.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
#include "gpio_signal.h"
#include "hooks.h"
-#include "zephyr/kernel.h"
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/ztest.h>
-/* SSFC field defined in zephyr/program/corsola/cbi_steelix.dts */
+/* SSFC field defined in zephyr/projects/corsola/cbi_steelix.dts */
#define SSFC_BASE_MAIN_SENSOR (0x1)
#define SSFC_BASE_ALT_SENSOR (0x1 << 1)
diff --git a/zephyr/test/kingler/src/ccd.c b/zephyr/test/kingler/src/ccd.c
index eb375fcfe7..1b46631dc6 100644
--- a/zephyr/test/kingler/src/ccd.c
+++ b/zephyr/test/kingler/src/ccd.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
-#include "gpio/gpio_int.h"
-#include "gpio_signal.h"
-#include "hooks.h"
-
+#include "zephyr/kernel.h"
#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/fff.h>
-#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
+#include "gpio_signal.h"
+#include "gpio/gpio_int.h"
+#include "hooks.h"
+
FAKE_VOID_FUNC(typec_set_sbu, int, bool);
/* fake definitions to pass build */
FAKE_VOID_FUNC(bmi3xx_interrupt, enum gpio_signal);
diff --git a/zephyr/test/kingler/src/clamshell.c b/zephyr/test/kingler/src/clamshell.c
index 9871db1ca0..88595cc114 100644
--- a/zephyr/test/kingler/src/clamshell.c
+++ b/zephyr/test/kingler/src/clamshell.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include "zephyr/kernel.h"
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/ztest.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
#include "gpio_signal.h"
#include "hooks.h"
#include "tablet_mode.h"
-#include "zephyr/kernel.h"
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/ztest.h>
static void *clamshell_setup(void)
{
diff --git a/zephyr/test/kingler/src/db_detect_hdmi.c b/zephyr/test/kingler/src/db_detect_hdmi.c
index 04a65269ad..35cf92ae5e 100644
--- a/zephyr/test/kingler/src/db_detect_hdmi.c
+++ b/zephyr/test/kingler/src/db_detect_hdmi.c
@@ -3,43 +3,13 @@
* found in the LICENSE file.
*/
-#include "baseboard_usbc_config.h"
-#include "ec_commands.h"
-#include "gpio_signal.h"
-#include "hooks.h"
-#include "usb_mux.h"
-#include "variant_db_detection.h"
#include "zephyr/kernel.h"
-
#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/fff.h>
#include <zephyr/ztest.h>
-FAKE_VALUE_FUNC(int, corsola_is_dp_muxable, int);
-FAKE_VOID_FUNC(svdm_set_hpd_gpio, int, int);
-
-#define FFF_FAKES_LIST(FAKE) \
- FAKE(corsola_is_dp_muxable) \
- FAKE(svdm_set_hpd_gpio)
-
-static void db_hdmi_rule_before(const struct ztest_unit_test *test, void *data)
-{
- ARG_UNUSED(test);
- ARG_UNUSED(data);
- FFF_FAKES_LIST(RESET_FAKE);
- FFF_RESET_HISTORY();
-}
-ZTEST_RULE(db_hdmi_rule, db_hdmi_rule_before, NULL);
-
-uint8_t board_get_usb_pd_port_count(void)
-{
- return 2;
-}
-
-enum tcpc_cc_polarity pd_get_polarity(int port)
-{
- return 0;
-}
+#include "gpio_signal.h"
+#include "hooks.h"
+#include "variant_db_detection.h"
static void *db_detection_setup(void)
{
@@ -103,31 +73,11 @@ ZTEST(db_detection, test_db_detect_hdmi)
gpio_emul_output_get(ps185_pwrdn_gpio, ps185_pwrdn_pin),
NULL);
- /* Verify x_ec_interrupt is enabled, and plug */
+ /* Verify x_ec_interrupt is enabled */
interrupt_count = 0;
zassert_ok(gpio_emul_input_set(int_x_ec_gpio, int_x_ec_pin, 1), NULL);
k_sleep(K_MSEC(100));
- corsola_is_dp_muxable_fake.return_val = 1;
-
zassert_equal(interrupt_count, 1, "interrupt_count=%d",
interrupt_count);
-
- zassert_false(usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED, NULL);
-
- /* invoke hdmi interrupt, the argument doesn't care, just pass 0 */
- hdmi_hpd_interrupt(0);
-
- k_sleep(K_MSEC(500));
-
- zassert_equal(svdm_set_hpd_gpio_fake.call_count, 1);
- zassert_true(usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED, NULL);
-
- /* unplug */
- zassert_ok(gpio_emul_input_set(int_x_ec_gpio, int_x_ec_pin, 0), NULL);
-
- hdmi_hpd_interrupt(0);
- k_sleep(K_MSEC(500));
-
- zassert_false(usb_mux_get(USBC_PORT_C1) & USB_PD_MUX_DP_ENABLED, NULL);
}
diff --git a/zephyr/test/kingler/src/db_detect_none.c b/zephyr/test/kingler/src/db_detect_none.c
index 1bf9c05701..9f37db04af 100644
--- a/zephyr/test/kingler/src/db_detect_none.c
+++ b/zephyr/test/kingler/src/db_detect_none.c
@@ -3,18 +3,17 @@
* found in the LICENSE file.
*/
+#include <stdlib.h>
+#include <zephyr/kernel.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/ztest.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
#include "gpio_signal.h"
#include "hooks.h"
#include "variant_db_detection.h"
-#include <stdlib.h>
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
static void *db_detection_setup(void)
{
const struct device *wp_gpio =
diff --git a/zephyr/test/kingler/src/db_detect_typec.c b/zephyr/test/kingler/src/db_detect_typec.c
index 6662f485bc..53716fe552 100644
--- a/zephyr/test/kingler/src/db_detect_typec.c
+++ b/zephyr/test/kingler/src/db_detect_typec.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "gpio_signal.h"
-#include "hooks.h"
-#include "variant_db_detection.h"
#include "zephyr/kernel.h"
-
#include <zephyr/drivers/gpio/gpio_emul.h>
#include <zephyr/ztest.h>
+#include "gpio_signal.h"
+#include "hooks.h"
+#include "variant_db_detection.h"
+
static void *db_detection_setup(void)
{
const struct device *hdmi_prsnt_gpio = DEVICE_DT_GET(
diff --git a/zephyr/test/kingler/src/fakes.c b/zephyr/test/kingler/src/fakes.c
index f5a3c30b0b..9b3194f18a 100644
--- a/zephyr/test/kingler/src/fakes.c
+++ b/zephyr/test/kingler/src/fakes.c
@@ -3,9 +3,8 @@
* found in the LICENSE file.
*/
-#include "gpio_signal.h"
-
#include <zephyr/fff.h>
+#include "gpio_signal.h"
FAKE_VOID_FUNC(power_button_interrupt, enum gpio_signal);
FAKE_VOID_FUNC(button_interrupt, enum gpio_signal);
diff --git a/zephyr/test/kingler/src/tablet.c b/zephyr/test/kingler/src/tablet.c
index a2355e2b9d..68be2b2b68 100644
--- a/zephyr/test/kingler/src/tablet.c
+++ b/zephyr/test/kingler/src/tablet.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include "zephyr/kernel.h"
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/ztest.h>
+
#include "cros_board_info.h"
#include "cros_cbi.h"
#include "gpio_signal.h"
#include "hooks.h"
#include "tablet_mode.h"
-#include "zephyr/kernel.h"
-
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/ztest.h>
static void *tablet_setup(void)
{
diff --git a/zephyr/test/kingler/testcase.yaml b/zephyr/test/kingler/testcase.yaml
index 282ece6e63..9b7e9f58ff 100644
--- a/zephyr/test/kingler/testcase.yaml
+++ b/zephyr/test/kingler/testcase.yaml
@@ -6,36 +6,36 @@ common:
platform_allow: native_posix
tests:
kingler.steelix:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/steelix/cbi.dtsi;../program/corsola/npcx_gpio.dtsi"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/cbi_steelix.dts;../projects/corsola/gpio_steelix.dts"
extra_configs:
- CONFIG_TEST_STEELIX_RUSTY=y
- CONFIG_TEST_FORM_FACTOR_CONVERTIBLE=y
kingler.rusty:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/steelix/cbi.dtsi;../program/corsola/npcx_gpio.dtsi"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/cbi_steelix.dts;../projects/corsola/gpio_steelix.dts"
extra_configs:
- CONFIG_TEST_STEELIX_RUSTY=y
- CONFIG_TEST_FORM_FACTOR_CLAMSHELL=y
kingler.db_detect_typec:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/npcx_gpio.dtsi;"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/gpio_steelix.dts;"
extra_configs:
- CONFIG_TEST_DB_DETECT_TYPEC=y
- CONFIG_VARIANT_CORSOLA_DB_DETECTION=y
kingler.db_detect_hdmi:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/npcx_gpio.dtsi"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/gpio_steelix.dts"
extra_configs:
- CONFIG_TEST_DB_DETECT_HDMI=y
- CONFIG_VARIANT_CORSOLA_DB_DETECTION=y
kingler.db_detect_none:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/steelix/cbi.dtsi;../program/corsola/npcx_gpio.dtsi"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/cbi_steelix.dts;../projects/corsola/gpio_steelix.dts"
extra_configs:
- CONFIG_TEST_DB_DETECT_NONE=y
- CONFIG_VARIANT_CORSOLA_DB_DETECTION=y
kingler.ccd:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/steelix/cbi.dtsi;../program/corsola/npcx_gpio.dtsi"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/cbi_steelix.dts;../projects/corsola/gpio_steelix.dts"
extra_configs:
- CONFIG_TEST_KINGLER_CCD=y
kingler.alt_sensor:
- extra_args: DTC_OVERLAY_FILE="./common.dts;../program/corsola/npcx_interrupts.dtsi;../program/corsola/steelix/interrupts.dtsi;../program/corsola/steelix/cbi.dtsi;../program/corsola/npcx_gpio.dtsi"
+ extra_args: DTC_OVERLAY_FILE="./common.dts;../projects/corsola/interrupts_kingler.dts;../projects/corsola/interrupts_steelix.dts;../projects/corsola/cbi_steelix.dts;../projects/corsola/gpio_steelix.dts"
extra_configs:
- CONFIG_TEST_STEELIX_RUSTY=y
- CONFIG_TEST_ALT_SENSOR_PROBE=y
diff --git a/zephyr/test/krabby/CMakeLists.txt b/zephyr/test/krabby/CMakeLists.txt
index dbab1bd19c..bb96633d5b 100644
--- a/zephyr/test/krabby/CMakeLists.txt
+++ b/zephyr/test/krabby/CMakeLists.txt
@@ -8,21 +8,19 @@ project(krabby)
add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
-zephyr_include_directories("${PLATFORM_EC_PROGRAM_DIR}/corsola/include")
+zephyr_include_directories("${PLATFORM_EC}/zephyr/projects/corsola/include")
target_sources(app PRIVATE
src/stubs.c
- ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/krabby/usbc_config.c
- ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/krabby/usb_pd_policy.c)
+ ${PLATFORM_EC}/zephyr/projects/corsola/src/krabby/usbc_config.c)
target_sources_ifdef(CONFIG_TEST_KRABBY
app PRIVATE
src/charger_workaround.c
src/usb_mux_init.c
- src/usbc_config.c
- ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/krabby/charger_workaround.c)
+ ${PLATFORM_EC}/zephyr/projects/corsola/src/krabby/charger_workaround.c)
target_sources_ifdef(CONFIG_TEST_TENTACRUEL
app PRIVATE
src/temp_tentacruel.c
- ${PLATFORM_EC_PROGRAM_DIR}/corsola/src/krabby/temp_tentacruel.c)
+ ${PLATFORM_EC}/zephyr/projects/corsola/src/krabby/temp_tentacruel.c)
diff --git a/zephyr/test/krabby/README.md b/zephyr/test/krabby/README.md
index 027cdec4a4..8262d85fcc 100644
--- a/zephyr/test/krabby/README.md
+++ b/zephyr/test/krabby/README.md
@@ -1,3 +1,3 @@
-Tests for board specific code under `zephyr/program/corsola/src/krabby`.
+Tests for board specific code under `zephyr/projects/corsola/src/krabby`.
Run with ./twister -T zephyr/test/krabby
diff --git a/zephyr/test/krabby/adc_temp.dts b/zephyr/test/krabby/adc_temp.dts
index c0d17cca13..28e98adf64 100644
--- a/zephyr/test/krabby/adc_temp.dts
+++ b/zephyr/test/krabby/adc_temp.dts
@@ -6,11 +6,28 @@
#include <cros/thermistor/thermistor.dtsi>
/ {
+ adc0: adc {
+ compatible = "zephyr,adc-emul";
+ nchannels = <1>;
+ ref-internal-mv = <3300>;
+ #io-channel-cells = <1>;
+ status = "okay";
+ };
+
+ named-adc-channels {
+ compatible = "named-adc-channels";
+
+ adc_charger: charger {
+ enum-name = "ADC_TEMP_SENSOR_CHARGER";
+ io-channels = <&adc0 0>;
+ };
+ };
+
name_temp_charger: charger {
- compatible = "cros-ec,temp-sensor-thermistor";
+ compatible = "cros-ec,temp-sensor-thermistor";
- thermistor = <&thermistor_rt9490>;
- adc = <&adc_charger>;
+ thermistor = <&thermistor_rt9490>;
+ adc = <&adc_charger>;
};
named-temp-sensors {
diff --git a/zephyr/test/krabby/common.dts b/zephyr/test/krabby/common.dts
index 9e94392561..b8f1eb0733 100644
--- a/zephyr/test/krabby/common.dts
+++ b/zephyr/test/krabby/common.dts
@@ -31,34 +31,17 @@
reg = <0>;
chg = <&charger>;
tcpc = <&tcpci_emul>;
- ppc = <&ppc0_emul>;
- usb-mux-chain-0 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&virtual_mux_0>;
- };
- };
- port0-muxes {
- virtual_mux_0: virtual-mux-0 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
};
port1@1 {
compatible = "named-usbc-port";
status = "okay";
reg = <1>;
- tcpc = <&tcpci_emul>;
- ppc = <&ppc1_emul>;
usb-mux-chain-1 {
compatible = "cros-ec,usb-mux-chain";
usb-muxes = <&tusb1064_mux_1>;
};
};
- port1-muxes {
- virtual_mux_1: virtual-mux-1 {
- compatible = "cros-ec,usbc-mux-virtual";
- };
- };
};
batteries {
@@ -66,33 +49,6 @@
compatible = "lgc,ac17a8m", "battery-smart";
};
};
-
- named-adc-channels {
- compatible = "named-adc-channels";
-
- adc_vbus_c0 {
- enum-name = "ADC_VBUS_C0";
- io-channels = <&adc0 0>;
- mul = <10>;
- };
- adc_board_id0 {
- enum-name = "ADC_BOARD_ID_0";
- io-channels = <&adc0 1>;
- };
- adc_board_id1 {
- enum-name = "ADC_BOARD_ID_1";
- io-channels = <&adc0 2>;
- };
- adc_vbus_c1 {
- enum-name = "ADC_VBUS_C1";
- io-channels = <&adc0 7>;
- mul = <10>;
- };
- adc_charger: charger {
- enum-name = "ADC_TEMP_SENSOR_CHARGER";
- io-channels = <&adc0 5>;
- };
- };
};
&i2c_ctrl0 {
@@ -105,7 +61,7 @@
};
battery: sb@b {
- compatible = "zephyr,smart-battery-emul";
+ compatible = "zephyr,smart-battery";
reg = <0xb>;
cycle-count = <99>;
version = "BATTERY_SPEC_VER_1_1_WITH_PEC";
@@ -121,31 +77,6 @@
status = "okay";
reg = <0x82>;
};
-
- ppc0_emul: syv682x@42 {
- compatible = "zephyr,syv682x-emul";
- status = "okay";
- reg = <0x42>;
- frs_en_gpio = <&gpio_ec_x_gpio1>;
- alert_gpio = <&gpio_x_ec_gpio2>;
- };
-
- ppc1_emul: syv682x@43 {
- compatible = "zephyr,syv682x-emul";
- status = "okay";
- reg = <0x43>;
- /*
- * the gpio pins are intentionally reused in both ppc emuls, to
- * avoid handling different frs-en pin names on krabby and
- * tentacruel.
- */
- frs_en_gpio = <&gpio_ec_x_gpio1>;
- alert_gpio = <&gpio_x_ec_gpio2>;
- };
-};
-
-&adc0 {
- status = "okay";
};
&i2c_ctrl4 {
diff --git a/zephyr/test/krabby/pinctrl.dts b/zephyr/test/krabby/pinctrl.dts
index ecc7b88538..9d01591238 100644
--- a/zephyr/test/krabby/pinctrl.dts
+++ b/zephyr/test/krabby/pinctrl.dts
@@ -5,5 +5,3 @@
/* remove pinctrl to avoid pull in too many unwanted dependency */
/delete-node/ &pinctrl;
-
-/delete-node/ &{/hibernate-wake-pins};
diff --git a/zephyr/test/krabby/prj.conf b/zephyr/test/krabby/prj.conf
index 2f2a03923b..ddf5a29c21 100644
--- a/zephyr/test/krabby/prj.conf
+++ b/zephyr/test/krabby/prj.conf
@@ -6,34 +6,34 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_ASSERT_VERBOSE=1
CONFIG_ZTEST_NEW_API=y
-CONFIG_ASSERT=y
CONFIG_ADC=y
+CONFIG_ASSERT=y
CONFIG_CROS_EC=y
CONFIG_EMUL=y
+CONFIG_EMUL_RT9490=y
+CONFIG_EMUL_SMART_BATTERY=y
+CONFIG_EMUL_TCPCI=y
+CONFIG_EMUL_TUSB1064=y
+CONFIG_I2C=y
+CONFIG_I2C_EMUL=y
CONFIG_PLATFORM_EC=y
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
+CONFIG_PLATFORM_EC_CHARGER=y
+CONFIG_PLATFORM_EC_CHARGER_RT9490=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=20
-CONFIG_PLATFORM_EC_CHARGE_MANAGER=y
-CONFIG_PLATFORM_EC_CHARGE_RAMP_HW=y
-CONFIG_PLATFORM_EC_GPIO_INIT_PRIORITY=49
+CONFIG_PLATFORM_EC_CHARGE_MANAGER=n
CONFIG_PLATFORM_EC_HOOKS=y
CONFIG_PLATFORM_EC_HOSTCMD=y
CONFIG_PLATFORM_EC_LID_SWITCH=n
CONFIG_PLATFORM_EC_SWITCH=n
CONFIG_PLATFORM_EC_USBC=y
-CONFIG_PLATFORM_EC_USB_CHARGER=y
-CONFIG_PLATFORM_EC_USB_DRP_ACC_TRYSRC=y
+CONFIG_PLATFORM_EC_USB_CHARGER=n
CONFIG_PLATFORM_EC_USB_MUX_TUSB546=y
-CONFIG_PLATFORM_EC_USB_MUX_VIRTUAL=y
-CONFIG_PLATFORM_EC_USB_PD_DISCHARGE=y
CONFIG_PLATFORM_EC_USB_PD_DISCHARGE_PPC=y
-CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_ADC_EACH_PORT=y
CONFIG_PLATFORM_EC_USB_POWER_DELIVERY=y
CONFIG_PLATFORM_EC_VBOOT_HASH=n
-
-CONFIG_PLATFORM_EC_USBC_PPC=y
-CONFIG_PLATFORM_EC_USBC_PPC_SYV682X=y
diff --git a/zephyr/test/krabby/src/charger_workaround.c b/zephyr/test/krabby/src/charger_workaround.c
index 5582fe5c64..afd3fe5f0c 100644
--- a/zephyr/test/krabby/src/charger_workaround.c
+++ b/zephyr/test/krabby/src/charger_workaround.c
@@ -3,6 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
#include "charger.h"
#include "driver/charger/rt9490.h"
#include "emul/emul_rt9490.h"
@@ -10,11 +15,6 @@
#include "i2c.h"
#include "system.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/emul.h>
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
FAKE_VALUE_FUNC(int, board_get_version);
const struct emul *emul = EMUL_DT_GET(DT_NODELABEL(charger));
diff --git a/zephyr/test/krabby/src/stubs.c b/zephyr/test/krabby/src/stubs.c
index df1613528d..7731aad43f 100644
--- a/zephyr/test/krabby/src/stubs.c
+++ b/zephyr/test/krabby/src/stubs.c
@@ -4,12 +4,38 @@
*/
#include "adc.h"
+#include "usbc_ppc.h"
#include "charge_ramp.h"
#include "charge_state.h"
-#include "usbc_ppc.h"
-__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+int board_set_active_charge_port(int port)
+{
+ return 0;
+}
+
+int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
+{
+ return 0;
+}
+
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+}
+
+const struct batt_params *charger_current_battery_params(void)
+{
+ static const struct batt_params params = {};
+
+ return &params;
+}
+
+int board_get_battery_soc(void)
+{
+ return 0;
+}
+
+void pd_power_supply_reset(void)
{
}
@@ -18,7 +44,29 @@ int pd_check_vconn_swap(int port)
return 0;
}
-int board_get_adjusted_usb_pd_port_count(int port)
+void pd_set_input_current_limit(int port, uint32_t max_ma,
+ uint32_t supply_voltage)
{
- return 2;
}
+
+int pd_set_power_supply_ready(int port)
+{
+ return 0;
+}
+
+void usb_charger_vbus_change(int port, int vbus_level)
+{
+}
+
+int charge_manager_get_active_charge_port(void)
+{
+ return 0;
+}
+
+struct ppc_config_t ppc_chips[] = {};
+
+unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
+
+#ifdef CONFIG_MUX_INIT_ADC
+const struct adc_t adc_channels[] = {};
+#endif
diff --git a/zephyr/test/krabby/src/temp_tentacruel.c b/zephyr/test/krabby/src/temp_tentacruel.c
index 1eaefad988..863adfaf81 100644
--- a/zephyr/test/krabby/src/temp_tentacruel.c
+++ b/zephyr/test/krabby/src/temp_tentacruel.c
@@ -3,24 +3,25 @@
* found in the LICENSE file.
*/
-#include "charge_state.h"
+#include <zephyr/kernel.h>
+#include <zephyr/ztest.h>
+#include <zephyr/drivers/adc.h>
+#include <zephyr/drivers/adc/adc_emul.h>
+
#include "charger.h"
+#include "charge_state.h"
#include "charger_profile_override.h"
#include "common.h"
#include "config.h"
#include "hooks.h"
+#include "util.h"
#include "temp_sensor.h"
#include "temp_sensor/temp_sensor.h"
-#include "util.h"
-
-#include <zephyr/drivers/adc.h>
-#include <zephyr/drivers/adc/adc_emul.h>
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
#define ADC_DEVICE_NODE DT_NODELABEL(adc0)
#define CHARGER_TEMP TEMP_SENSOR_ID(DT_NODELABEL(temp_charger))
#define ORIGINAL_CURRENT 5000
+#define TEMP_THRESHOLD 55
struct charge_state_data curr;
static int fake_voltage;
@@ -33,17 +34,16 @@ static uint16_t current_table[] = {
3600,
3000,
2400,
- 1600,
+ 1800,
};
int setup_faketemp(int fake_voltage)
{
const struct device *adc_dev = DEVICE_DT_GET(ADC_DEVICE_NODE);
- const uint8_t channel_id =
- DT_IO_CHANNELS_INPUT(DT_NODELABEL(adc_charger));
int emul_temp;
- emul_temp = adc_emul_const_value_set(adc_dev, channel_id, fake_voltage);
+ emul_temp = adc_emul_const_value_set(
+ adc_dev, temp_sensors[CHARGER_TEMP].idx, fake_voltage);
return emul_temp;
}
@@ -56,7 +56,7 @@ static void ignore_first_minute(void)
ZTEST(temp_tentacruel, test_decrease_current)
{
- fake_voltage = 411;
+ fake_voltage = 376;
curr.batt.flags |= BATT_FLAG_RESPONSIVE;
count = 0;
@@ -80,7 +80,7 @@ ZTEST(temp_tentacruel, test_decrease_current)
ZTEST(temp_tentacruel, test_increase_current)
{
- fake_voltage = 446;
+ fake_voltage = 380;
curr.batt.flags |= BATT_FLAG_RESPONSIVE;
count = 3;
diff --git a/zephyr/test/krabby/src/usb_mux_init.c b/zephyr/test/krabby/src/usb_mux_init.c
index 8d1e4e81eb..665f1c7b7e 100644
--- a/zephyr/test/krabby/src/usb_mux_init.c
+++ b/zephyr/test/krabby/src/usb_mux_init.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/devicetree.h>
+#include <zephyr/drivers/emul.h>
+#include <zephyr/ztest.h>
+
#include "driver/usb_mux/tusb1064.h"
#include "emul/emul_tusb1064.h"
#include "usb_mux.h"
#include "usbc/usb_muxes.h"
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/emul.h>
-#include <zephyr/ztest.h>
-
const static struct emul *emul = EMUL_DT_GET(DT_NODELABEL(tusb1064_mux_1));
const static int tusb1064_port = USB_MUX_PORT(DT_NODELABEL(tusb1064_mux_1));
diff --git a/zephyr/test/krabby/src/usbc_config.c b/zephyr/test/krabby/src/usbc_config.c
deleted file mode 100644
index 0b6c8bc80d..0000000000
--- a/zephyr/test/krabby/src/usbc_config.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "adc.h"
-#include "charge_manager.h"
-#include "driver/ppc/syv682x.h"
-#include "driver/ppc/syv682x_public.h"
-#include "emul/emul_common_i2c.h"
-#include "emul/emul_syv682x.h"
-#include "i2c/i2c.h"
-#include "usb_pd.h"
-#include "usbc_ppc.h"
-
-#include <zephyr/devicetree.h>
-#include <zephyr/drivers/emul.h>
-#include <zephyr/ztest.h>
-
-bool ppc_sink_enabled(int port)
-{
- const struct emul *emul = (port == 0) ?
- EMUL_DT_GET(DT_NODELABEL(ppc0_emul)) :
- EMUL_DT_GET(DT_NODELABEL(ppc1_emul));
- uint8_t val = 0;
-
- syv682x_emul_get_reg(emul, SYV682X_CONTROL_1_REG, &val);
-
- return !(val & (SYV682X_CONTROL_1_PWR_ENB | SYV682X_CONTROL_1_HV_DR));
-}
-
-ZTEST(usbc_config, test_set_active_charge_port)
-{
- /* reset ppc state */
- zassert_ok(board_set_active_charge_port(CHARGE_PORT_NONE), NULL);
- zassert_false(ppc_sink_enabled(0), NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
-
- /* sourcing port 0, expect port 0 not sinkable */
- zassert_ok(pd_set_power_supply_ready(0));
- zassert_not_equal(board_set_active_charge_port(0), 0, NULL);
- zassert_true(board_vbus_source_enabled(0), NULL);
- zassert_false(board_vbus_source_enabled(1), NULL);
- zassert_false(ppc_sink_enabled(0), NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
-
- /* sinking port 1 */
- zassert_ok(board_set_active_charge_port(1), NULL);
- zassert_false(ppc_sink_enabled(0), NULL);
- zassert_true(ppc_sink_enabled(1), NULL);
-
- /*
- * sinking an invalid port should return error and doesn't change
- * any state
- */
- zassert_not_equal(board_set_active_charge_port(2), 0, NULL);
- zassert_true(board_vbus_source_enabled(0), NULL);
- zassert_false(board_vbus_source_enabled(1), NULL);
- zassert_false(ppc_sink_enabled(0), NULL);
- zassert_true(ppc_sink_enabled(1), NULL);
-
- /* turn of sourcing, sinking port 0 */
- pd_power_supply_reset(0);
- zassert_ok(board_set_active_charge_port(0), NULL);
- zassert_true(ppc_sink_enabled(0), NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
-
- /* sinking port 1 */
- zassert_ok(board_set_active_charge_port(1), NULL);
- zassert_false(ppc_sink_enabled(0), NULL);
- zassert_true(ppc_sink_enabled(1), NULL);
-
- /* back to port 0 */
- zassert_ok(board_set_active_charge_port(0), NULL);
- zassert_true(ppc_sink_enabled(0), NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
-
- /* reset */
- zassert_ok(board_set_active_charge_port(CHARGE_PORT_NONE), NULL);
- zassert_false(board_vbus_source_enabled(0), NULL);
- zassert_false(board_vbus_source_enabled(1), NULL);
- zassert_false(ppc_sink_enabled(0), NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
-}
-
-ZTEST(usbc_config, test_set_active_charge_port_fail)
-{
- const struct emul *ppc0 = EMUL_DT_GET(DT_NODELABEL(ppc0_emul));
-
- /* Verify that failure on ppc0 doesn't affect ppc1 */
- i2c_common_emul_set_write_fail_reg(
- emul_syv682x_get_i2c_common_data(ppc0),
- I2C_COMMON_EMUL_FAIL_ALL_REG);
-
- zassert_ok(board_set_active_charge_port(1), NULL);
- zassert_true(ppc_sink_enabled(1), NULL);
- zassert_ok(board_set_active_charge_port(CHARGE_PORT_NONE), NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
- zassert_ok(board_set_active_charge_port(1), NULL);
- zassert_true(ppc_sink_enabled(1), NULL);
-
- /* trying to enable ppc0 results in error */
- zassert_not_equal(board_set_active_charge_port(0), 0, NULL);
- zassert_false(ppc_sink_enabled(1), NULL);
-}
-
-ZTEST(usbc_config, test_adc_channel)
-{
- zassert_equal(board_get_vbus_adc(0), ADC_VBUS_C0, NULL);
- zassert_equal(board_get_vbus_adc(1), ADC_VBUS_C1, NULL);
- zassert_equal(board_get_vbus_adc(99), ADC_VBUS_C0, NULL);
-}
-
-static void reset_ppc_state(void *fixture)
-{
- const struct emul *ppc0 = EMUL_DT_GET(DT_NODELABEL(ppc0_emul));
- const struct emul *ppc1 = EMUL_DT_GET(DT_NODELABEL(ppc1_emul));
-
- i2c_common_emul_set_write_fail_reg(
- emul_syv682x_get_i2c_common_data(ppc0),
- I2C_COMMON_EMUL_NO_FAIL_REG);
- i2c_common_emul_set_write_fail_reg(
- emul_syv682x_get_i2c_common_data(ppc1),
- I2C_COMMON_EMUL_NO_FAIL_REG);
-
- ppc_vbus_source_enable(0, false);
- ppc_vbus_source_enable(1, false);
- board_set_active_charge_port(CHARGE_PORT_NONE);
-}
-
-ZTEST_SUITE(usbc_config, NULL, NULL, reset_ppc_state, NULL, NULL);
diff --git a/zephyr/test/krabby/testcase.yaml b/zephyr/test/krabby/testcase.yaml
index 781d82db4b..a748e45be5 100644
--- a/zephyr/test/krabby/testcase.yaml
+++ b/zephyr/test/krabby/testcase.yaml
@@ -6,12 +6,15 @@ common:
platform_allow: native_posix
tests:
krabby.default:
- extra_args: DTC_OVERLAY_FILE="common.dts;../program/corsola/ite_interrupts.dtsi;../program/corsola/ite_gpio.dtsi;pinctrl.dts"
+ extra_args: DTC_OVERLAY_FILE="common.dts;../projects/corsola/interrupts_krabby.dts;../projects/corsola/gpio_krabby.dts;pinctrl.dts"
extra_configs:
- CONFIG_TEST_KRABBY=y
- CONFIG_MUX_INIT_ADC=y
krabby.tentacruel:
- extra_args: DTC_OVERLAY_FILE="common.dts;adc_temp.dts;../program/corsola/interrupts_tentacruel.dtsi;../program/corsola/gpio_tentacruel.dtsi;../program/corsola/thermistor_tentacruel.dtsi;pinctrl.dts"
+ extra_args: DTC_OVERLAY_FILE="common.dts;adc_temp.dts;../projects/corsola/interrupts_tentacruel.dts;../projects/corsola/gpio_tentacruel.dts;../projects/corsola/thermistor_tentacruel.dts;pinctrl.dts"
extra_configs:
- CONFIG_TEST_TENTACRUEL=y
+ - CONFIG_PLATFORM_EC_TEMP_SENSOR=y
+ - CONFIG_PLATFORM_EC_THERMISTOR=y
- CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y
+ - CONFIG_ADC_EMUL=y
diff --git a/zephyr/test/math/src/fixed_point_int_sqrtf.c b/zephyr/test/math/src/fixed_point_int_sqrtf.c
index 4403980a96..a76567b9d7 100644
--- a/zephyr/test/math/src/fixed_point_int_sqrtf.c
+++ b/zephyr/test/math/src/fixed_point_int_sqrtf.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "math.h"
#include "math_util.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(math, int_sqrtf_negative)
{
zassert_equal(int_sqrtf(-100), 0);
diff --git a/zephyr/test/math/src/mask.c b/zephyr/test/math/src/mask.c
index c986834eb8..c38b756eda 100644
--- a/zephyr/test/math/src/mask.c
+++ b/zephyr/test/math/src/mask.c
@@ -3,13 +3,12 @@
* found in the LICENSE file.
*/
-#include "math.h"
-#include "math_util.h"
-
#include <inttypes.h>
-
#include <zephyr/ztest.h>
+#include "math.h"
+#include "math_util.h"
+
ZTEST_USER(math, bitmask_uint64)
{
zassert_equal(bitmask_uint64(-1), 0);
diff --git a/zephyr/test/math/src/math_util.c b/zephyr/test/math/src/math_util.c
index 184dd2b999..a3f26d3fea 100644
--- a/zephyr/test/math/src/math_util.c
+++ b/zephyr/test/math/src/math_util.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "builtin/stdio.h"
+#include <zephyr/ztest.h>
+
#include "common.h"
#include "math.h"
#include "math_util.h"
-
-#include <zephyr/ztest.h>
+#include "builtin/stdio.h"
ZTEST_USER(math, arc_cos__x_below_range)
{
diff --git a/zephyr/test/math/src/vector.c b/zephyr/test/math/src/vector.c
index e588be52af..87dad3a78d 100644
--- a/zephyr/test/math/src/vector.c
+++ b/zephyr/test/math/src/vector.c
@@ -3,11 +3,11 @@
* found in the LICENSE file.
*/
+#include <zephyr/ztest.h>
+
#include "math.h"
#include "math_util.h"
-#include <zephyr/ztest.h>
-
ZTEST_USER(math, cosine_of_angle_diff__zero_magnitude_vector)
{
intv3_t v0 = { 0, 0, 0 };
diff --git a/zephyr/test/qcom_power/boards/native_posix.overlay b/zephyr/test/qcom_power/boards/native_posix.overlay
index 9af8f4cd13..f062f27614 100644
--- a/zephyr/test/qcom_power/boards/native_posix.overlay
+++ b/zephyr/test/qcom_power/boards/native_posix.overlay
@@ -65,10 +65,7 @@
enum-name = "GPIO_PMIC_KPD_PWR_ODL";
};
gpio_pmic_resin_l: pmic_resin_l {
- /* Real hardware will allow reading even if GPIO_INPUT
- * is not set, but the gpio_emul will not.
- */
- gpios = <&gpio0 21 (GPIO_INPUT | GPIO_OUTPUT_HIGH)>;
+ gpios = <&gpio0 21 GPIO_OUTPUT_HIGH>;
enum-name = "GPIO_PMIC_RESIN_L";
};
gpio_warm_reset_l: warm_reset_l {
@@ -90,10 +87,6 @@
gpios = <&gpio0 25 (GPIO_INPUT | GPIO_PULL_UP)>;
enum-name = "GPIO_POWER_BUTTON_L";
};
- gpio_switchcap_pg: src_vph_pwr_pg {
- gpios = <&gpio0 26 GPIO_INPUT_PULL_DOWN>;
- enum-name = "GPIO_SWITCHCAP_PG";
- };
};
gpio-interrupts {
@@ -140,10 +133,9 @@
};
switchcap {
- compatible = "cros-ec,switchcap-gpio";
+ compatible = "switchcap-gpio";
enable-pin = <&gpio_switchcap_on>;
- power-good-pin = <&gpio_switchcap_pg>;
- poff-delay-ms = <1>;
+ power-good-pin = <&gpio_switchcap_pg_int_l>;
};
};
diff --git a/zephyr/test/qcom_power/prj.conf b/zephyr/test/qcom_power/prj.conf
index 2a160bd7da..a74109ddde 100644
--- a/zephyr/test/qcom_power/prj.conf
+++ b/zephyr/test/qcom_power/prj.conf
@@ -14,9 +14,12 @@ CONFIG_NATIVE_UART_0_ON_STDINOUT=y
CONFIG_CROS_EC=y
CONFIG_EMUL=y
+CONFIG_EMUL_CROS_FLASH=y
CONFIG_FLASH=y
CONFIG_GPIO=y
+CONFIG_GPIO_EMUL=y
CONFIG_GPIO_GET_CONFIG=y
+CONFIG_LOG=y
CONFIG_PLATFORM_EC=y
CONFIG_RING_BUFFER=y
CONFIG_SERIAL=y
@@ -37,3 +40,4 @@ CONFIG_PLATFORM_EC_POWERSEQ_HOST_SLEEP=y
CONFIG_PLATFORM_EC_POWERSEQ_SC7280=y
CONFIG_PLATFORM_EC_POWER_BUTTON=y
CONFIG_PLATFORM_EC_POWER_SLEEP_FAILURE_DETECTION=y
+CONFIG_PLATFORM_EC_SWITCHCAP_GPIO=y
diff --git a/zephyr/test/qcom_power/src/main.c b/zephyr/test/qcom_power/src/main.c
index 8de3f051d6..22dd1fe2ec 100644
--- a/zephyr/test/qcom_power/src/main.c
+++ b/zephyr/test/qcom_power/src/main.c
@@ -3,55 +3,35 @@
* found in the LICENSE file.
*/
-#include "console.h"
-#include "ec_app_main.h"
-#include "gpio.h"
-#include "gpio_signal.h"
-#include "hooks.h"
-#include "host_command.h"
-#include "lid_switch.h"
-#include "power.h"
-#include "power/qcom.h"
-#include "task.h"
-
-#include <setjmp.h>
-
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/gpio/gpio_emul.h>
-#include <zephyr/fff.h>
#include <zephyr/kernel.h>
-#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest.h>
+#include <zephyr/drivers/gpio/gpio_emul.h>
+#include <zephyr/drivers/gpio.h>
+#include <zephyr/shell/shell_dummy.h>
+#include <zephyr/fff.h>
-/* For simplicity, enforce that all the gpios are on the same controller. */
-#define GPIO_DEVICE \
- DEVICE_DT_GET(DT_GPIO_CTLR(DT_PATH(named_gpios, ap_rst_l), gpios))
-#define ASSERT_SAME_CONTROLLER(x) \
- BUILD_ASSERT(DT_DEP_ORD(DT_GPIO_CTLR(DT_PATH(named_gpios, ap_rst_l), \
- gpios)) == \
- DT_DEP_ORD(DT_GPIO_CTLR(DT_PATH(named_gpios, x), gpios)))
-
-#define AP_RST_L_PIN DT_GPIO_PIN(DT_PATH(named_gpios, ap_rst_l), gpios)
-ASSERT_SAME_CONTROLLER(ap_rst_l);
-#define POWER_GOOD_PIN DT_GPIO_PIN(DT_PATH(named_gpios, mb_power_good), gpios)
-ASSERT_SAME_CONTROLLER(mb_power_good);
-#define AP_SUSPEND_PIN DT_GPIO_PIN(DT_PATH(named_gpios, ap_suspend), gpios)
-ASSERT_SAME_CONTROLLER(ap_suspend);
-#define SWITCHCAP_PG_PIN \
- DT_GPIO_PIN(DT_PATH(named_gpios, src_vph_pwr_pg), gpios)
-ASSERT_SAME_CONTROLLER(src_vph_pwr_pg);
-#define PMIC_RESIN_L_PIN DT_GPIO_PIN(DT_PATH(named_gpios, pmic_resin_l), gpios)
-ASSERT_SAME_CONTROLLER(pmic_resin_l);
-#define EC_PWR_BTN_ODL_PIN \
- DT_GPIO_PIN(DT_PATH(named_gpios, ec_pwr_btn_odl), gpios)
-ASSERT_SAME_CONTROLLER(ec_pwr_btn_odl);
-#define LID_OPEN_EC_PIN DT_GPIO_PIN(DT_PATH(named_gpios, lid_open_ec), gpios)
-ASSERT_SAME_CONTROLLER(lid_open_ec);
-#define PMIC_KPD_PWR_ODL_PIN \
- DT_GPIO_PIN(DT_PATH(named_gpios, pmic_kpd_pwr_odl), gpios)
-ASSERT_SAME_CONTROLLER(pmic_kpd_pwr_odl);
+#include <setjmp.h>
+
+#include "gpio_signal.h"
+#include "power/qcom.h"
+#include "battery.h"
+#include "ec_app_main.h"
+#include "power.h"
+#include "console.h"
+#include "task.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "lid_switch.h"
+
+#define AP_RST_L_NODE DT_PATH(named_gpios, ap_rst_l)
+#define POWER_GOOD_NODE DT_PATH(named_gpios, mb_power_good)
+#define AP_SUSPEND_NODE DT_PATH(named_gpios, ap_suspend)
+#define SWITCHCAP_PG_NODE DT_PATH(named_gpios, switchcap_pg_int_l)
+#define PMIC_RESIN_L_NODE DT_PATH(named_gpios, pmic_resin_l)
+#define EC_PWR_BTN_ODL_NODE DT_PATH(named_gpios, ec_pwr_btn_odl)
+#define LID_OPEN_EC_NODE DT_PATH(named_gpios, lid_open_ec)
static int chipset_reset_count;
static bool set_power_good_on_reset;
@@ -65,9 +45,11 @@ DECLARE_HOOK(HOOK_CHIPSET_RESET, do_chipset_reset, HOOK_PRIO_DEFAULT);
static void do_chipset_shutdown(void)
{
if (set_power_good_on_reset) {
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *power_good_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(POWER_GOOD_NODE, gpios));
- gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 1);
+ gpio_emul_input_set(power_good_dev,
+ DT_GPIO_PIN(POWER_GOOD_NODE, gpios), 1);
}
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, do_chipset_shutdown, HOOK_PRIO_DEFAULT);
@@ -76,10 +58,6 @@ DEFINE_FFF_GLOBALS;
FAKE_VALUE_FUNC(int, system_can_boot_ap);
FAKE_VALUE_FUNC(int, battery_wait_for_stable);
-int battery_is_present(void)
-{
- return 1;
-}
/* Tests the chipset_ap_rst_interrupt() handler when in S3.
*
@@ -90,11 +68,15 @@ int battery_is_present(void)
*/
static void do_chipset_ap_rst_interrupt_in_s3(int times)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ap_rst_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_RST_L_NODE, gpios));
+ static const struct device *ap_suspend_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_SUSPEND_NODE, gpios));
/* Preconditions */
power_signal_enable_interrupt(GPIO_AP_SUSPEND);
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 1));
power_set_state(POWER_S3);
task_wake(TASK_ID_CHIPSET);
k_sleep(K_MSEC(10));
@@ -105,15 +87,18 @@ static void do_chipset_ap_rst_interrupt_in_s3(int times)
/* Pulse gpio_ap_rst_l `times` */
for (int i = 0; i < times; ++i) {
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 0));
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 1));
+ zassert_ok(gpio_emul_input_set(
+ ap_rst_dev, DT_GPIO_PIN(AP_RST_L_NODE, gpios), 0));
+ zassert_ok(gpio_emul_input_set(
+ ap_rst_dev, DT_GPIO_PIN(AP_RST_L_NODE, gpios), 1));
}
/* Wait for timeout AP_RST_TRANSITION_TIMEOUT. */
k_sleep(K_MSEC(500));
/* Verify that gpio_ap_suspend is ignored. */
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 0));
k_sleep(K_MSEC(10));
zassert_equal(power_get_state(), POWER_S3);
/* Verify that HOOK_CHIPSET_RESET was called once. */
@@ -155,15 +140,18 @@ ZTEST(qcom_power, test_notify_chipset_reset_s3)
*/
static void do_chipset_ap_rst_interrupt_in_s0(int times)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ap_rst_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_RST_L_NODE, gpios));
shell_backend_dummy_clear_output(get_ec_shell());
chipset_reset_count = 0;
/* Pulse gpio_ap_rst_l `times` */
for (int i = 0; i < times; ++i) {
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 0));
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 1));
+ zassert_ok(gpio_emul_input_set(
+ ap_rst_dev, DT_GPIO_PIN(AP_RST_L_NODE, gpios), 0));
+ zassert_ok(gpio_emul_input_set(
+ ap_rst_dev, DT_GPIO_PIN(AP_RST_L_NODE, gpios), 1));
}
/* Wait for timeout AP_RST_TRANSITION_TIMEOUT. */
@@ -230,57 +218,39 @@ void warm_reset_callback(const struct device *gpio_dev,
struct gpio_callback *callback_struct,
gpio_port_pins_t pins)
{
- if ((pins & BIT(PMIC_RESIN_L_PIN)) == 0) {
+ if ((pins & BIT(DT_GPIO_PIN(PMIC_RESIN_L_NODE, gpios))) == 0) {
return;
}
- if (gpio_emul_output_get(gpio_dev, PMIC_RESIN_L_PIN)) {
- gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 0);
- }
-}
-
-static void set_power_good(struct k_work *work)
-{
- static const struct device *gpio_dev = GPIO_DEVICE;
-
- gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 1);
-}
-K_WORK_DEFINE(set_power_good_work, set_power_good);
+ if (gpio_emul_output_get(gpio_dev,
+ DT_GPIO_PIN(PMIC_RESIN_L_NODE, gpios))) {
+ static const struct device *ap_rst_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_RST_L_NODE, gpios));
-/* PMIC_KPD_PWR_ODL is a signal to turn the power on. The signal that
- * it worked is POWER_GOOD.
- */
-void power_good_callback(const struct device *gpio_dev,
- struct gpio_callback *callback_struct,
- gpio_port_pins_t pins)
-{
- if ((pins & BIT(PMIC_KPD_PWR_ODL_PIN)) == 0) {
- return;
- }
- if (!gpio_emul_output_get(gpio_dev, PMIC_KPD_PWR_ODL_PIN)) {
- /* Set power good in the work queue, instead of now. */
- k_work_submit(&set_power_good_work);
+ gpio_emul_input_set(ap_rst_dev,
+ DT_GPIO_PIN(AP_RST_L_NODE, gpios), 0);
}
}
/* Call chipset_reset, wait for PMIC_RESIN_L, pulse ap_rsl_l. */
ZTEST(qcom_power, test_chipset_reset_success)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ap_rst_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_RST_L_NODE, gpios));
+ static const struct device *pmic_resin_l_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(PMIC_RESIN_L_NODE, gpios));
const char *buffer;
size_t buffer_size;
/* Setup callback. */
gpio_init_callback(&gpio_callback, warm_reset_callback,
- BIT(PMIC_RESIN_L_PIN));
- zassert_ok(gpio_add_callback(gpio_dev, &gpio_callback));
- zassert_ok(gpio_pin_interrupt_configure(gpio_dev, PMIC_RESIN_L_PIN,
- GPIO_INT_EDGE_BOTH));
+ BIT(DT_GPIO_PIN(PMIC_RESIN_L_NODE, gpios)));
+ zassert_ok(gpio_add_callback(pmic_resin_l_dev, &gpio_callback));
/* Reset. The reason doesn't really matter. */
shell_backend_dummy_clear_output(get_ec_shell());
chipset_reset(CHIPSET_RESET_KB_WARM_REBOOT);
k_sleep(K_MSEC(100));
- gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 1);
+ gpio_emul_input_set(ap_rst_dev, DT_GPIO_PIN(AP_RST_L_NODE, gpios), 1);
/* Long enough for a cold reset, although we don't expect one. */
k_sleep(K_MSEC(1000));
@@ -298,7 +268,8 @@ ZTEST(qcom_power, test_chipset_reset_success)
/* Sent the host command, set the gpio, wait for transition to S3. */
ZTEST(qcom_power, test_request_sleep)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ap_suspend_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_SUSPEND_NODE, gpios));
struct ec_params_host_sleep_event params = {
.sleep_event = HOST_SLEEP_EVENT_S3_SUSPEND,
};
@@ -306,7 +277,8 @@ ZTEST(qcom_power, test_request_sleep)
EC_CMD_HOST_SLEEP_EVENT, UINT8_C(0), params);
zassert_ok(host_command_process(&args));
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 1));
k_sleep(K_SECONDS(16));
zassert_equal(power_get_state(), POWER_S3);
zassert_false(host_is_event_set(EC_HOST_EVENT_HANG_DETECT));
@@ -342,88 +314,53 @@ ZTEST(qcom_power, test_chipset_force_shutdown)
ZTEST(qcom_power, test_power_button)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
-
- /* Setup callback. */
- gpio_init_callback(&gpio_callback, power_good_callback,
- BIT(PMIC_KPD_PWR_ODL_PIN));
- zassert_ok(gpio_add_callback(gpio_dev, &gpio_callback));
+ static const struct device *ec_pwr_btn_odl_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(EC_PWR_BTN_ODL_NODE, gpios));
power_set_state(POWER_G3);
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 0));
- zassert_ok(gpio_emul_input_set(gpio_dev, PMIC_RESIN_L_PIN, 1));
k_sleep(K_MSEC(10));
zassert_equal(power_get_state(), POWER_G3);
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 0));
k_sleep(K_MSEC(100));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 1));
k_sleep(K_MSEC(500));
zassert_equal(power_get_state(), POWER_S0);
}
ZTEST(qcom_power, test_power_button_no_power_good)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ec_pwr_btn_odl_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(EC_PWR_BTN_ODL_NODE, gpios));
+ static const struct device *power_good_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(POWER_GOOD_NODE, gpios));
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 0));
+ zassert_ok(gpio_emul_input_set(power_good_dev,
+ DT_GPIO_PIN(POWER_GOOD_NODE, gpios), 0));
power_set_state(POWER_G3);
k_sleep(K_MSEC(10));
zassert_equal(power_get_state(), POWER_G3);
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 0));
k_sleep(K_MSEC(100));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 1));
k_sleep(K_MSEC(1500));
zassert_equal(power_get_state(), POWER_S5, "power_state=%d",
power_get_state());
}
-ZTEST(qcom_power, test_power_button_no_switchcap_good)
-{
- static const struct device *gpio_dev = GPIO_DEVICE;
-
- zassert_ok(gpio_emul_input_set(gpio_dev, SWITCHCAP_PG_PIN, 0));
- power_set_state(POWER_G3);
- k_sleep(K_MSEC(10));
- zassert_equal(power_get_state(), POWER_G3);
-
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
- k_sleep(K_MSEC(100));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
- k_sleep(K_SECONDS(10));
- zassert_equal(power_get_state(), POWER_S5, "power_state=%d",
- power_get_state());
-}
-
-ZTEST(qcom_power, test_power_button_no_pmic_resin_pullup)
-{
- const char *buffer;
- size_t buffer_size;
- static const struct device *gpio_dev = GPIO_DEVICE;
-
- power_set_state(POWER_G3);
- k_sleep(K_MSEC(10));
- zassert_equal(power_get_state(), POWER_G3);
-
- shell_backend_dummy_clear_output(get_ec_shell());
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 0));
- zassert_ok(gpio_emul_input_set(gpio_dev, PMIC_RESIN_L_PIN, 0));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
- k_sleep(K_MSEC(100));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
- k_sleep(K_SECONDS(10));
- zassert_equal(power_get_state(), POWER_S5, "power_state=%d",
- power_get_state());
-
- buffer = shell_backend_dummy_get_output(get_ec_shell(), &buffer_size);
- zassert_not_null(strstr(buffer, "PMIC_RESIN_L not pulled up by PMIC"),
- "Invalid console output %s", buffer);
-}
-
ZTEST(qcom_power, test_power_button_battery_low)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ec_pwr_btn_odl_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(EC_PWR_BTN_ODL_NODE, gpios));
RESET_FAKE(system_can_boot_ap);
system_can_boot_ap_fake.return_val = 0;
@@ -432,9 +369,13 @@ ZTEST(qcom_power, test_power_button_battery_low)
k_sleep(K_MSEC(10));
zassert_equal(power_get_state(), POWER_G3);
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 0));
k_sleep(K_MSEC(100));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 1));
/* > CAN_BOOT_AP_CHECK_TIMEOUT + CAN_BOOT_AP_CHECK_WAIT */
k_sleep(K_MSEC(1800));
zassert_equal(power_get_state(), POWER_S5);
@@ -442,7 +383,8 @@ ZTEST(qcom_power, test_power_button_battery_low)
ZTEST(qcom_power, test_host_sleep_event_resume)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ap_suspend_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_SUSPEND_NODE, gpios));
struct ec_params_host_sleep_event params = {
.sleep_event = HOST_SLEEP_EVENT_S3_RESUME,
};
@@ -451,14 +393,16 @@ ZTEST(qcom_power, test_host_sleep_event_resume)
/* Get into S3 first */
power_signal_enable_interrupt(GPIO_AP_SUSPEND);
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 1));
power_set_state(POWER_S3);
task_wake(TASK_ID_CHIPSET);
k_sleep(K_MSEC(10));
zassert_equal(power_get_state(), POWER_S3);
/* Exit suspend via gpio. */
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 0));
k_sleep(K_MSEC(100));
zassert_equal(power_get_state(), POWER_S0, "power_state=%d",
power_get_state());
@@ -470,29 +414,40 @@ ZTEST(qcom_power, test_host_sleep_event_resume)
power_get_state());
/* Check that AP_SUSPEND interrupts are disabled & we are in S0. */
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 1));
k_sleep(K_MSEC(100));
zassert_equal(power_get_state(), POWER_S0);
}
ZTEST(qcom_power, test_power_button_off)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ec_pwr_btn_odl_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(EC_PWR_BTN_ODL_NODE, gpios));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 0));
k_sleep(K_SECONDS(9));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 1));
k_sleep(K_MSEC(500));
zassert_equal(power_get_state(), POWER_S5);
}
ZTEST(qcom_power, test_power_button_off_cancel)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ec_pwr_btn_odl_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(EC_PWR_BTN_ODL_NODE, gpios));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 0));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 0));
k_sleep(K_SECONDS(4));
- zassert_ok(gpio_emul_input_set(gpio_dev, EC_PWR_BTN_ODL_PIN, 1));
+ zassert_ok(gpio_emul_input_set(ec_pwr_btn_odl_dev,
+ DT_GPIO_PIN(EC_PWR_BTN_ODL_NODE, gpios),
+ 1));
k_sleep(K_MSEC(500));
zassert_equal(power_get_state(), POWER_S0);
}
@@ -501,10 +456,12 @@ ZTEST(qcom_power, test_no_power_good)
{
const char *buffer;
size_t buffer_size;
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *power_good_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(POWER_GOOD_NODE, gpios));
shell_backend_dummy_clear_output(get_ec_shell());
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 0));
+ zassert_ok(gpio_emul_input_set(power_good_dev,
+ DT_GPIO_PIN(POWER_GOOD_NODE, gpios), 0));
k_sleep(K_MSEC(500));
zassert_equal(power_get_state(), POWER_S5, "power_state=%d",
power_get_state());
@@ -517,10 +474,12 @@ ZTEST(qcom_power, test_no_power_good_then_good)
{
const char *buffer;
size_t buffer_size;
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *power_good_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(POWER_GOOD_NODE, gpios));
shell_backend_dummy_clear_output(get_ec_shell());
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 0));
+ zassert_ok(gpio_emul_input_set(power_good_dev,
+ DT_GPIO_PIN(POWER_GOOD_NODE, gpios), 0));
set_power_good_on_reset = true;
k_sleep(K_MSEC(500));
zassert_equal(power_get_state(), POWER_S5, "power_state=%d",
@@ -534,15 +493,18 @@ ZTEST(qcom_power, test_no_power_good_then_good)
ZTEST(qcom_power, test_lid_open_power_on)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *lid_open_ec_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(LID_OPEN_EC_NODE, gpios));
- zassert_ok(gpio_emul_input_set(gpio_dev, LID_OPEN_EC_PIN, 0));
+ zassert_ok(gpio_emul_input_set(
+ lid_open_ec_dev, DT_GPIO_PIN(LID_OPEN_EC_NODE, gpios), 0));
power_set_state(POWER_G3);
k_sleep(K_MSEC(100));
zassert_equal(power_get_state(), POWER_G3);
zassert_false(lid_is_open());
- zassert_ok(gpio_emul_input_set(gpio_dev, LID_OPEN_EC_PIN, 1));
+ zassert_ok(gpio_emul_input_set(
+ lid_open_ec_dev, DT_GPIO_PIN(LID_OPEN_EC_NODE, gpios), 1));
k_sleep(K_MSEC(500));
zassert_equal(power_get_state(), POWER_S0, "power_state=%d",
power_get_state());
@@ -594,9 +556,11 @@ ZTEST(qcom_power, test_power_chipset_init_sysjump_power_good)
ZTEST(qcom_power, test_power_chipset_init_sysjump_power_off)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *power_good_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(POWER_GOOD_NODE, gpios));
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 0));
+ zassert_ok(gpio_emul_input_set(power_good_dev,
+ DT_GPIO_PIN(POWER_GOOD_NODE, gpios), 0));
system_set_reset_flags(EC_RESET_FLAG_SYSJUMP);
zassert_equal(power_chipset_init(), POWER_G3);
power_set_state(POWER_G3);
@@ -621,7 +585,18 @@ ZTEST(qcom_power, test_power_chipset_init_ap_off)
void start_in_s0(void *fixture)
{
- static const struct device *gpio_dev = GPIO_DEVICE;
+ static const struct device *ap_rst_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_RST_L_NODE, gpios));
+ static const struct device *power_good_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(POWER_GOOD_NODE, gpios));
+ static const struct device *ap_suspend_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(AP_SUSPEND_NODE, gpios));
+ static const struct device *switchcap_pg_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(SWITCHCAP_PG_NODE, gpios));
+ static const struct device *pmic_resin_l_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(PMIC_RESIN_L_NODE, gpios));
+ static const struct device *lid_open_ec_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(LID_OPEN_EC_NODE, gpios));
RESET_FAKE(system_can_boot_ap);
system_can_boot_ap_fake.return_val = 1;
@@ -629,12 +604,18 @@ void start_in_s0(void *fixture)
power_signal_disable_interrupt(GPIO_AP_SUSPEND);
power_signal_enable_interrupt(GPIO_AP_RST_L);
- zassert_ok(gpio_emul_input_set(gpio_dev, POWER_GOOD_PIN, 1));
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_SUSPEND_PIN, 0));
- zassert_ok(gpio_emul_input_set(gpio_dev, AP_RST_L_PIN, 1));
- zassert_ok(gpio_emul_input_set(gpio_dev, SWITCHCAP_PG_PIN, 1));
- zassert_ok(gpio_pin_set(gpio_dev, PMIC_RESIN_L_PIN, 1));
- zassert_ok(gpio_emul_input_set(gpio_dev, LID_OPEN_EC_PIN, 1));
+ zassert_ok(gpio_emul_input_set(power_good_dev,
+ DT_GPIO_PIN(POWER_GOOD_NODE, gpios), 1));
+ zassert_ok(gpio_emul_input_set(ap_suspend_dev,
+ DT_GPIO_PIN(AP_SUSPEND_NODE, gpios), 0));
+ zassert_ok(gpio_emul_input_set(ap_rst_dev,
+ DT_GPIO_PIN(AP_RST_L_NODE, gpios), 1));
+ zassert_ok(gpio_emul_input_set(
+ switchcap_pg_dev, DT_GPIO_PIN(SWITCHCAP_PG_NODE, gpios), 1));
+ zassert_ok(gpio_pin_set(pmic_resin_l_dev,
+ DT_GPIO_PIN(PMIC_RESIN_L_NODE, gpios), 1));
+ zassert_ok(gpio_emul_input_set(
+ lid_open_ec_dev, DT_GPIO_PIN(LID_OPEN_EC_NODE, gpios), 1));
power_set_state(POWER_S0);
power_signal_interrupt(GPIO_AP_SUSPEND);
task_wake(TASK_ID_CHIPSET);
@@ -648,9 +629,9 @@ void start_in_s0(void *fixture)
void qcom_cleanup(void *fixture)
{
if (gpio_callback.handler != NULL) {
- static const struct device *gpio_dev = GPIO_DEVICE;
-
- gpio_remove_callback(gpio_dev, &gpio_callback);
+ static const struct device *pmic_resin_l_dev =
+ DEVICE_DT_GET(DT_GPIO_CTLR(PMIC_RESIN_L_NODE, gpios));
+ gpio_remove_callback(pmic_resin_l_dev, &gpio_callback);
gpio_callback.handler = NULL;
}
host_clear_events(EC_HOST_EVENT_MASK(EC_HOST_EVENT_HANG_DETECT));
diff --git a/zephyr/test/rex/CMakeLists.txt b/zephyr/test/rex/CMakeLists.txt
index ddee5d0120..3bca2df494 100644
--- a/zephyr/test/rex/CMakeLists.txt
+++ b/zephyr/test/rex/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -6,9 +6,9 @@ cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
project(rex)
-zephyr_include_directories("${PLATFORM_EC_PROGRAM_DIR}/rex/include")
+zephyr_include_directories("${PLATFORM_EC}/zephyr/projects/rex/include")
add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
target_sources_ifdef(CONFIG_TEST_USB_PD_POLICY app PRIVATE src/usb_pd_policy.c)
-target_sources_ifdef(CONFIG_TEST_USB_PD_POLICY app PRIVATE ${PLATFORM_EC_PROGRAM_DIR}/rex/src/usb_pd_policy.c)
+target_sources_ifdef(CONFIG_TEST_USB_PD_POLICY app PRIVATE ${PLATFORM_EC}/zephyr/projects/rex/src/usb_pd_policy.c)
diff --git a/zephyr/test/rex/README.md b/zephyr/test/rex/README.md
index 454ed6ebb8..ef1848a627 100644
--- a/zephyr/test/rex/README.md
+++ b/zephyr/test/rex/README.md
@@ -1,3 +1,3 @@
-Tests for board specific code under `zephyr/program/rex/src`.
+Tests for board specific code under `zephyr/projects/rex/src`.
Run with ./twister -T zephyr/test/rex
diff --git a/zephyr/test/rex/boards/native_posix.overlay b/zephyr/test/rex/boards/native_posix.overlay
index c4d4413ad7..b27b199a12 100644
--- a/zephyr/test/rex/boards/native_posix.overlay
+++ b/zephyr/test/rex/boards/native_posix.overlay
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors
+/* Copyright 2022 The ChromiumOS Authors.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/zephyr/test/rex/src/usb_pd_policy.c b/zephyr/test/rex/src/usb_pd_policy.c
index 3f7406bdad..d977bec0a1 100644
--- a/zephyr/test/rex/src/usb_pd_policy.c
+++ b/zephyr/test/rex/src/usb_pd_policy.c
@@ -3,16 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/fff.h>
+#include <zephyr/ztest.h>
+
#include "charge_manager.h"
#include "chipset.h"
#include "ec_commands.h"
-#include "usb_charge.h"
#include "usb_pd.h"
#include "usbc_ppc.h"
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
DECLARE_FAKE_VALUE_FUNC(int, chipset_in_state, int);
DEFINE_FAKE_VALUE_FUNC(int, chipset_in_state, int);
DECLARE_FAKE_VALUE_FUNC(int, ppc_vbus_source_enable, int, int);
diff --git a/zephyr/test/rex/testcase.yaml b/zephyr/test/rex/testcase.yaml
index 54e6f6cb55..a05855ea52 100644
--- a/zephyr/test/rex/testcase.yaml
+++ b/zephyr/test/rex/testcase.yaml
@@ -1,4 +1,4 @@
-# Copyright 2022 The ChromiumOS Authors
+# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/zephyr/test/system_common/prj.conf b/zephyr/test/system_common/prj.conf
index 67dc659eed..02ba4c42a1 100644
--- a/zephyr/test/system_common/prj.conf
+++ b/zephyr/test/system_common/prj.conf
@@ -5,6 +5,7 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_CROS_EC=y
+CONFIG_LOG=y
CONFIG_PLATFORM_EC_CROS_FWID_VERSION=y
CONFIG_PLATFORM_EC=y
diff --git a/zephyr/test/system_common/src/build_info.c b/zephyr/test/system_common/src/build_info.c
index 1057a3c013..7983c1f0a4 100644
--- a/zephyr/test/system_common/src/build_info.c
+++ b/zephyr/test/system_common/src/build_info.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "host_command.h"
-#include "system.h"
-
#include <zephyr/device.h>
#include <zephyr/fff.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "host_command.h"
+#include "system.h"
+
ZTEST_SUITE(host_cmd_get_build_info, NULL, NULL, NULL, NULL, NULL);
FAKE_VALUE_FUNC(const char *, system_get_build_info);
diff --git a/zephyr/test/system_common/src/get_version.c b/zephyr/test/system_common/src/get_version.c
index a5e4fd5365..87a41bad58 100644
--- a/zephyr/test/system_common/src/get_version.c
+++ b/zephyr/test/system_common/src/get_version.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "host_command.h"
-#include "system.h"
-
#include <zephyr/device.h>
#include <zephyr/fff.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "host_command.h"
+#include "system.h"
+
ZTEST_SUITE(host_cmd_get_version, NULL, NULL, NULL, NULL, NULL);
__override const char *system_get_version(enum ec_image copy)
diff --git a/zephyr/test/system_common/src/reboot.c b/zephyr/test/system_common/src/reboot.c
index 18b5f0fd38..759b93d89f 100644
--- a/zephyr/test/system_common/src/reboot.c
+++ b/zephyr/test/system_common/src/reboot.c
@@ -3,14 +3,14 @@
* found in the LICENSE file.
*/
-#include "host_command.h"
-#include "system.h"
-
#include <zephyr/device.h>
#include <zephyr/fff.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "host_command.h"
+#include "system.h"
+
FAKE_VOID_FUNC(system_reset, int);
FAKE_VOID_FUNC(system_hibernate, uint32_t, uint32_t);
diff --git a/zephyr/test/system_common/src/system_is_locked.c b/zephyr/test/system_common/src/system_is_locked.c
index d880e4e117..2ea9f3038b 100644
--- a/zephyr/test/system_common/src/system_is_locked.c
+++ b/zephyr/test/system_common/src/system_is_locked.c
@@ -3,12 +3,12 @@
* found in the LICENSE file.
*/
-#include "system.h"
-
#include <zephyr/shell/shell_dummy.h>
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "system.h"
+
ZTEST_USER(system_is_locked, test_syslock_console_cmd)
{
/*
diff --git a/zephyr/test/system_shim/CMakeLists.txt b/zephyr/test/system_shim/CMakeLists.txt
index 92b55a47e6..5db9cb285d 100644
--- a/zephyr/test/system_shim/CMakeLists.txt
+++ b/zephyr/test/system_shim/CMakeLists.txt
@@ -9,16 +9,5 @@ project(system_shim_test)
# Include FFF fakes
add_subdirectory(${PLATFORM_EC}/zephyr/test/test_utils test_utils)
-target_sources(app
- PRIVATE
- src/suite.c
- ${PLATFORM_EC}/zephyr/shim/src/system.c
-)
-target_include_directories(app PRIVATE include)
-
-dt_has_chosen(has_bbram PROPERTY "cros-ec,bbram")
-if(has_bbram)
- target_sources(app PRIVATE src/test_system.c)
-else()
- target_sources(app PRIVATE src/no_chosen.c)
-endif()
+target_sources(app PRIVATE test_system.c
+ ${PLATFORM_EC}/zephyr/shim/src/system.c)
diff --git a/zephyr/test/system_shim/boards/native_posix.overlay b/zephyr/test/system_shim/boards/native_posix.overlay
index b08ea4bf7a..0bcda0f513 100644
--- a/zephyr/test/system_shim/boards/native_posix.overlay
+++ b/zephyr/test/system_shim/boards/native_posix.overlay
@@ -6,6 +6,9 @@
#include <board-overlays/native_posix.dts>
/ {
+ chosen {
+ cros-ec,bbram = &bbram;
+ };
bbram: test-bbram-dev {
compatible = "zephyr,bbram-emul";
@@ -30,7 +33,7 @@
offset = <0x07>;
size = <0x05>;
};
- scratchpad: scratchpad {
+ scratchpad {
offset = <0x0c>;
size = <0x04>;
};
diff --git a/zephyr/test/system_shim/include/fakes.h b/zephyr/test/system_shim/include/fakes.h
deleted file mode 100644
index 29031a10b7..0000000000
--- a/zephyr/test/system_shim/include/fakes.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef ZEPHYR_TEST_SYSTEM_SHIM_INCLUDE_FAKES_H_
-#define ZEPHYR_TEST_SYSTEM_SHIM_INCLUDE_FAKES_H_
-
-#include <stdint.h>
-
-#include <zephyr/fff.h>
-
-DECLARE_FAKE_VALUE_FUNC(int, cros_system_native_posix_get_reset_cause,
- const struct device *);
-DECLARE_FAKE_VALUE_FUNC(uint64_t, cros_system_native_posix_deep_sleep_ticks,
- const struct device *);
-DECLARE_FAKE_VALUE_FUNC(int, cros_system_native_posix_hibernate,
- const struct device *, uint32_t, uint32_t);
-DECLARE_FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_vendor,
- const struct device *);
-DECLARE_FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_name,
- const struct device *);
-DECLARE_FAKE_VALUE_FUNC(const char *,
- cros_system_native_posix_get_chip_revision,
- const struct device *);
-DECLARE_FAKE_VALUE_FUNC(int, cros_system_native_posix_soc_reset,
- const struct device *);
-DECLARE_FAKE_VOID_FUNC(watchdog_reload);
-DECLARE_FAKE_VOID_FUNC(board_hibernate);
-
-#endif /* ZEPHYR_TEST_SYSTEM_SHIM_INCLUDE_FAKES_H_ */
diff --git a/zephyr/test/system_shim/prj.conf b/zephyr/test/system_shim/prj.conf
index 6888f70a53..fa7bd9fc04 100644
--- a/zephyr/test/system_shim/prj.conf
+++ b/zephyr/test/system_shim/prj.conf
@@ -6,17 +6,6 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_PLATFORM_EC=y
CONFIG_CROS_EC=y
+CONFIG_LOG=y
CONFIG_BBRAM=y
CONFIG_BBRAM_EMUL=y
-
-CONFIG_PLATFORM_EC_BOARD_RESET_AFTER_POWER_ON=y
-
-# Make console work
-CONFIG_SERIAL=y
-CONFIG_SHELL_BACKEND_DUMMY=y
-CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE=1000
-CONFIG_SHELL_BACKEND_SERIAL=n
-
-# Make cros_system driver work
-CONFIG_PM=y
-CONFIG_CROS_SYSTEM_NATIVE_POSIX=y
diff --git a/zephyr/test/system_shim/src/no_chosen.c b/zephyr/test/system_shim/src/no_chosen.c
deleted file mode 100644
index 0e41d562b9..0000000000
--- a/zephyr/test/system_shim/src/no_chosen.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "fakes.h"
-#include "system.h"
-
-#include <zephyr/ztest.h>
-
-ZTEST(system, test_fail_get_bbram_no_device)
-{
- zassert_equal(EC_ERROR_INVAL, system_get_bbram(0, NULL));
-}
-
-ZTEST(system, test_fail_set_scratchpad)
-{
- zassert_equal(-EC_ERROR_INVAL, system_set_scratchpad(0));
-}
-
-ZTEST(system, test_fail_get_scratchpad)
-{
- zassert_equal(-EC_ERROR_INVAL, system_get_scratchpad(NULL));
-}
diff --git a/zephyr/test/system_shim/src/suite.c b/zephyr/test/system_shim/src/suite.c
deleted file mode 100644
index b430780d0a..0000000000
--- a/zephyr/test/system_shim/src/suite.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "fakes.h"
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/bbram.h>
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-DEFINE_FAKE_VALUE_FUNC(int, cros_system_native_posix_get_reset_cause,
- const struct device *);
-DEFINE_FAKE_VALUE_FUNC(uint64_t, cros_system_native_posix_deep_sleep_ticks,
- const struct device *);
-DEFINE_FAKE_VALUE_FUNC(int, cros_system_native_posix_hibernate,
- const struct device *, uint32_t, uint32_t);
-DEFINE_FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_vendor,
- const struct device *);
-DEFINE_FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_name,
- const struct device *);
-DEFINE_FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_revision,
- const struct device *);
-DEFINE_FAKE_VALUE_FUNC(int, cros_system_native_posix_soc_reset,
- const struct device *);
-DEFINE_FAKE_VOID_FUNC(watchdog_reload);
-DEFINE_FAKE_VOID_FUNC(board_hibernate);
-
-static void system_before_after(void *test_data)
-{
- const struct device *bbram_dev =
- DEVICE_DT_GET_OR_NULL(DT_CHOSEN(cros_ec_bbram));
-
- RESET_FAKE(cros_system_native_posix_get_reset_cause);
- RESET_FAKE(cros_system_native_posix_deep_sleep_ticks);
- RESET_FAKE(cros_system_native_posix_hibernate);
- RESET_FAKE(cros_system_native_posix_get_chip_vendor);
- RESET_FAKE(cros_system_native_posix_get_chip_name);
- RESET_FAKE(cros_system_native_posix_get_chip_revision);
- RESET_FAKE(cros_system_native_posix_soc_reset);
- RESET_FAKE(watchdog_reload);
- RESET_FAKE(board_hibernate);
-
- if (bbram_dev != NULL) {
- bbram_emul_set_invalid(bbram_dev, false);
- }
-}
-
-ZTEST_SUITE(system, NULL, NULL, system_before_after, system_before_after, NULL);
diff --git a/zephyr/test/system_shim/src/test_system.c b/zephyr/test/system_shim/test_system.c
index 56031a4b67..3bf43d6669 100644
--- a/zephyr/test/system_shim/src/test_system.c
+++ b/zephyr/test/system_shim/test_system.c
@@ -3,12 +3,7 @@
* found in the LICENSE file.
*/
-#include "drivers/cros_system.h"
-#include "fakes.h"
-#include "system.h"
-
#include <setjmp.h>
-
#include <zephyr/device.h>
#include <zephyr/drivers/bbram.h>
#include <zephyr/fff.h>
@@ -17,6 +12,8 @@
#include <zephyr/ztest_assert.h>
#include <zephyr/ztest_test_new.h>
+#include "system.h"
+
LOG_MODULE_REGISTER(test);
#define BBRAM_REGION_OFF(name) \
@@ -27,14 +24,27 @@ LOG_MODULE_REGISTER(test);
static char mock_data[64] =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@";
-int system_preinitialize(const struct device *unused);
-
-ZTEST(system, test_invalid_bbram_index)
+FAKE_VALUE_FUNC(uint64_t, cros_system_native_posix_deep_sleep_ticks,
+ const struct device *);
+FAKE_VALUE_FUNC(int, cros_system_native_posix_hibernate, const struct device *,
+ uint32_t, uint32_t);
+FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_vendor,
+ const struct device *);
+FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_name,
+ const struct device *);
+FAKE_VALUE_FUNC(const char *, cros_system_native_posix_get_chip_revision,
+ const struct device *);
+FAKE_VALUE_FUNC(int, cros_system_native_posix_soc_reset, const struct device *);
+FAKE_VOID_FUNC(watchdog_reload);
+
+static void system_before_after(void *test_data)
{
- zassert_equal(EC_ERROR_INVAL,
- system_get_bbram(SYSTEM_BBRAM_IDX_TRY_SLOT + 1, NULL));
+ RESET_FAKE(cros_system_native_posix_deep_sleep_ticks);
+ RESET_FAKE(cros_system_native_posix_hibernate);
}
+ZTEST_SUITE(system, NULL, NULL, system_before_after, system_before_after, NULL);
+
ZTEST(system, test_bbram_get)
{
const struct device *const bbram_dev =
@@ -87,15 +97,6 @@ ZTEST(system, test_system_set_get_scratchpad)
zassert_equal(scratch_read, scratch_set);
}
-ZTEST(system, test_system_get_scratchpad_fail)
-{
- const struct device *bbram_dev =
- DEVICE_DT_GET(DT_CHOSEN(cros_ec_bbram));
-
- zassert_ok(bbram_emul_set_invalid(bbram_dev, true));
- zassert_equal(-EC_ERROR_INVAL, system_get_scratchpad(NULL));
-}
-
static jmp_buf jmp_hibernate;
static int _test_cros_system_native_posix_hibernate(const struct device *dev,
@@ -135,7 +136,6 @@ ZTEST(system, test_system_hibernate)
sys_dev);
zassert_equal(cros_system_native_posix_hibernate_fake.arg1_val, secs);
zassert_equal(cros_system_native_posix_hibernate_fake.arg2_val, msecs);
- zassert_equal(board_hibernate_fake.call_count, 1);
}
ZTEST(system, test_system_hibernate__failure)
@@ -255,45 +255,3 @@ ZTEST_USER(system, test_system_console_cmd__idlestats)
zassert_equal(cros_system_native_posix_deep_sleep_ticks_fake.call_count,
1);
}
-
-ZTEST(system, test_init_invalid_reset_cause)
-{
- cros_system_native_posix_get_reset_cause_fake.return_val = -1;
- zassert_equal(-1, system_preinitialize(NULL));
-}
-
-ZTEST(system, test_init_cause_vcc1_rst_pin)
-{
- cros_system_native_posix_get_reset_cause_fake.return_val = VCC1_RST_PIN;
- chip_save_reset_flags(0);
- system_clear_reset_flags(0xffffffff);
-
- zassert_ok(system_preinitialize(NULL));
- zassert_equal(EC_RESET_FLAG_RESET_PIN, system_get_reset_flags());
-
- chip_save_reset_flags(EC_RESET_FLAG_INITIAL_PWR);
- zassert_ok(system_preinitialize(NULL));
- zassert_equal(EC_RESET_FLAG_RESET_PIN | EC_RESET_FLAG_POWER_ON |
- EC_RESET_FLAG_POWER_ON,
- system_get_reset_flags());
-}
-
-ZTEST(system, test_init_cause_debug_rst)
-{
- cros_system_native_posix_get_reset_cause_fake.return_val = DEBUG_RST;
- chip_save_reset_flags(0);
- system_clear_reset_flags(0xffffffff);
-
- zassert_ok(system_preinitialize(NULL));
- zassert_equal(EC_RESET_FLAG_SOFT, system_get_reset_flags());
-}
-
-ZTEST(system, test_init_cause_watchdog_rst)
-{
- cros_system_native_posix_get_reset_cause_fake.return_val = WATCHDOG_RST;
- chip_save_reset_flags(0);
- system_clear_reset_flags(0xffffffff);
-
- zassert_ok(system_preinitialize(NULL));
- zassert_equal(EC_RESET_FLAG_WATCHDOG, system_get_reset_flags());
-}
diff --git a/zephyr/test/system_shim/testcase.yaml b/zephyr/test/system_shim/testcase.yaml
index 29b5fa55c0..3374c7f5f3 100644
--- a/zephyr/test/system_shim/testcase.yaml
+++ b/zephyr/test/system_shim/testcase.yaml
@@ -1,8 +1,15 @@
common:
platform_allow: native_posix
- tags:
- system
tests:
system_shim.default:
- extra_args: DTC_OVERLAY_FILE="./default.overlay"
- system_shim.no_chosen: {}
+ tags:
+ system
+ extra_configs:
+ # Make console work
+ - CONFIG_SERIAL=y
+ - CONFIG_SHELL_BACKEND_DUMMY=y
+ - CONFIG_SHELL_BACKEND_DUMMY_BUF_SIZE=1000
+ - CONFIG_SHELL_BACKEND_SERIAL=n
+ # Make cros_system driver work
+ - CONFIG_PM=y
+ - CONFIG_CROS_SYSTEM_NATIVE_POSIX=y
diff --git a/zephyr/test/tasks/main.c b/zephyr/test/tasks/main.c
index bbf752c656..8bfe9eb602 100644
--- a/zephyr/test/tasks/main.c
+++ b/zephyr/test/tasks/main.c
@@ -3,15 +3,14 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <stdbool.h>
+#include <zephyr/ztest.h>
+
#include "ec_tasks.h"
#include "task.h"
#include "timer.h"
-#include <stdbool.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/ztest.h>
-
/* Second for platform/ec task API (in microseconds). */
#define TASK_SEC(s) (s * 1000 * 1000)
diff --git a/zephyr/test/test_utils/tasks_fakes.c b/zephyr/test/test_utils/tasks_fakes.c
index d688c6cc24..b4068afa21 100644
--- a/zephyr/test/test_utils/tasks_fakes.c
+++ b/zephyr/test/test_utils/tasks_fakes.c
@@ -3,10 +3,9 @@
* found in the LICENSE file.
*/
-#include "task_id.h"
-
-#include <zephyr/fff.h>
#include <zephyr/sys/atomic.h>
+#include <zephyr/fff.h>
+#include "task_id.h"
/*
* The fakes below are needed to satisfy the final link, but are never
diff --git a/zephyr/test/uart_printf/CMakeLists.txt b/zephyr/test/uart_printf/CMakeLists.txt
deleted file mode 100644
index 8844bfb7be..0000000000
--- a/zephyr/test/uart_printf/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-cmake_minimum_required(VERSION 3.20.0)
-
-find_package(Zephyr COMPONENTS unittest REQUIRED HINTS $ENV{ZEPHYR_BASE})
-project(uart_printf)
-
-target_sources(testbinary
- PRIVATE
- ../../../common/uart_printf.c
- src/fakes.cc
- src/main.cc
-)
-
-target_include_directories(testbinary
- PRIVATE
- include
-)
diff --git a/zephyr/test/uart_printf/include/common.h b/zephyr/test/uart_printf/include/common.h
deleted file mode 100644
index 79af9594b3..0000000000
--- a/zephyr/test/uart_printf/include/common.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef ZEPHYR_TEST_UART_PRINTF_INCLUDE_COMMON_H_
-#define ZEPHYR_TEST_UART_PRINTF_INCLUDE_COMMON_H_
-
-#define EC_SUCCESS 0
-#define EC_ERROR_OVERFLOW -1
-
-#endif /* ZEPHYR_TEST_UART_PRINTF_INCLUDE_COMMON_H_ */
diff --git a/zephyr/test/uart_printf/include/printf.h b/zephyr/test/uart_printf/include/printf.h
deleted file mode 100644
index b6fcf6337d..0000000000
--- a/zephyr/test/uart_printf/include/printf.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef ZEPHYR_TEST_UART_PRINTF_INCLUDE_PRINTF_H_
-#define ZEPHYR_TEST_UART_PRINTF_INCLUDE_PRINTF_H_
-
-#include <zephyr/fff.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef int (*vfnprintf_addchar_t)(void *, int);
-DECLARE_FAKE_VALUE_FUNC(int, vfnprintf, vfnprintf_addchar_t, void *,
- const char *, va_list);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZEPHYR_TEST_UART_PRINTF_INCLUDE_PRINTF_H_ */
diff --git a/zephyr/test/uart_printf/include/uart.h b/zephyr/test/uart_printf/include/uart.h
deleted file mode 100644
index 51fd42a17e..0000000000
--- a/zephyr/test/uart_printf/include/uart.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef ZEPHYR_TEST_UART_PRINTF_INCLUDE_UART_H_
-#define ZEPHYR_TEST_UART_PRINTF_INCLUDE_UART_H_
-
-#include <zephyr/fff.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int uart_putc(int c);
-int uart_puts(const char *outstr);
-int uart_put(const char *out, int len);
-int uart_put_raw(const char *out, int len);
-int uart_printf(const char *format, ...);
-
-DECLARE_FAKE_VALUE_FUNC(int, uart_tx_char_raw, void *, int);
-DECLARE_FAKE_VOID_FUNC(uart_tx_start);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ZEPHYR_TEST_UART_PRINTF_INCLUDE_UART_H_ */
diff --git a/zephyr/test/uart_printf/prj.conf b/zephyr/test/uart_printf/prj.conf
deleted file mode 100644
index 744afcce87..0000000000
--- a/zephyr/test/uart_printf/prj.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-CONFIG_ZTEST=y
-CONFIG_ZTEST_NEW_API=y
-CONFIG_CPLUSPLUS=y
-CONFIG_STD_CPP20=y
-CONFIG_LIB_CPLUSPLUS=y
diff --git a/zephyr/test/uart_printf/src/fakes.cc b/zephyr/test/uart_printf/src/fakes.cc
deleted file mode 100644
index 0bb5fea1eb..0000000000
--- a/zephyr/test/uart_printf/src/fakes.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <zephyr/fff.h>
-#include <zephyr/ztest.h>
-
-#include "printf.h"
-#include "uart.h"
-
-DEFINE_FFF_GLOBALS;
-
-/* printf.h */
-DEFINE_FAKE_VALUE_FUNC(int, vfnprintf, vfnprintf_addchar_t, void *,
- const char *, va_list);
-
-/* uart.h */
-DEFINE_FAKE_VALUE_FUNC(int, uart_tx_char_raw, void *, int);
-DEFINE_FAKE_VOID_FUNC(uart_tx_start);
-
-static void fake_reset_rule_before(const struct ztest_unit_test *test,
- void *data)
-{
- ARG_UNUSED(test);
- ARG_UNUSED(data);
-
- /* printf.h */
- RESET_FAKE(vfnprintf);
-
- /* uart.h */
- RESET_FAKE(uart_tx_char_raw);
- RESET_FAKE(uart_tx_start);
-}
-
-ZTEST_RULE(fake_reset, fake_reset_rule_before, nullptr);
diff --git a/zephyr/test/uart_printf/src/main.cc b/zephyr/test/uart_printf/src/main.cc
deleted file mode 100644
index 9feb6a7ae9..0000000000
--- a/zephyr/test/uart_printf/src/main.cc
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <cstring>
-#include <string>
-
-#include <zephyr/ztest.h>
-
-#include "common.h"
-#include "printf.h"
-#include "uart.h"
-
-ZTEST_SUITE(uart_printf, nullptr, nullptr, nullptr, nullptr, nullptr);
-
-ZTEST(uart_printf, test_uart_putc)
-{
- int return_vals[] = { 0, -1 };
-
- SET_RETURN_SEQ(uart_tx_char_raw, return_vals, 2);
-
- zassert_ok(uart_putc(5));
- zassert_equal(EC_ERROR_OVERFLOW, uart_putc(5));
-}
-
-ZTEST(uart_printf, test_uart_put_success)
-{
- const std::string test_string = "test string";
- std::string output_string;
-
- /* Print the whole string */
- zassert_equal(test_string.size(),
- static_cast<size_t>(uart_put(test_string.c_str(),
- test_string.size())));
- zassert_equal(test_string.size(), uart_tx_char_raw_fake.call_count);
-
- /* Copy the history so it's easier to assert */
- for (size_t i = 0; i < test_string.size(); ++i) {
- output_string += uart_tx_char_raw_fake.arg1_history[i];
- }
-
- /* Verify that the string was passed to uart_tx_char_raw() */
- zassert_equal(test_string, output_string);
-}
-
-ZTEST(uart_printf, test_uart_put_fail_tx)
-{
- const char test_string[] = "\n";
-
- uart_tx_char_raw_fake.return_val = -1;
-
- /* Try printing the newline */
- zassert_equal(0, uart_put(test_string, 1));
- zassert_equal(1, uart_tx_char_raw_fake.call_count);
- zassert_equal('\r', uart_tx_char_raw_fake.arg1_val);
-}
-
-ZTEST(uart_printf, test_uart_puts_fail_tx)
-{
- const char test_string[] = "\n\0";
-
- uart_tx_char_raw_fake.return_val = -1;
-
- /* Try printing the newline */
- zassert_equal(EC_ERROR_OVERFLOW, uart_puts(test_string));
- zassert_equal(1, uart_tx_char_raw_fake.call_count);
- zassert_equal('\r', uart_tx_char_raw_fake.arg1_val);
-}
-
-ZTEST(uart_printf, test_uart_put_raw_fail_tx)
-{
- const char test_string[] = "\n";
-
- uart_tx_char_raw_fake.return_val = -1;
-
- /* Try printing the newline */
- zassert_equal(0, uart_put_raw(test_string, 1));
- zassert_equal(1, uart_tx_char_raw_fake.call_count);
- zassert_equal('\n', uart_tx_char_raw_fake.arg1_val);
-}
-
-static int vfnprintf_custom_fake_expect_int_arg;
-static int vfnprintf_custom_fake(vfnprintf_addchar_t, void *, const char *,
- va_list alist)
-{
- zassert_equal(vfnprintf_custom_fake_expect_int_arg, va_arg(alist, int));
- return 0;
-}
-ZTEST(uart_printf, test_uart_printf)
-{
- const char test_format[] = "d=%d";
-
- vfnprintf_custom_fake_expect_int_arg = 5;
- vfnprintf_fake.custom_fake = vfnprintf_custom_fake;
-
- zassert_ok(
- uart_printf(test_format, vfnprintf_custom_fake_expect_int_arg));
- zassert_equal(1, vfnprintf_fake.call_count);
- zassert_equal(test_format, vfnprintf_fake.arg2_val);
-}
diff --git a/zephyr/test/uart_printf/testcase.yaml b/zephyr/test/uart_printf/testcase.yaml
deleted file mode 100644
index 0315abab6f..0000000000
--- a/zephyr/test/uart_printf/testcase.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-tests:
- uart.printf:
- tags: uart
- type: unit
diff --git a/zephyr/test/vboot_efs2/boards/native_posix.overlay b/zephyr/test/vboot_efs2/boards/native_posix.overlay
index 83b9e9b365..ced94c28b1 100644
--- a/zephyr/test/vboot_efs2/boards/native_posix.overlay
+++ b/zephyr/test/vboot_efs2/boards/native_posix.overlay
@@ -59,18 +59,8 @@
port0@0 {
compatible = "named-usbc-port";
reg = <0>;
- bc12 = <&pi3usb9201_emul>;
chg = <&isl923x_emul>;
tcpc = <&tcpci_emul>;
- usb-mux-chain-1 {
- compatible = "cros-ec,usb-mux-chain";
- usb-muxes = <&tcpci_mux_c0>;
- };
- };
- port0-muxes {
- tcpci_mux_c0: tcpci-mux-c0 {
- compatible = "cros-ec,usbc-mux-tcpci";
- };
};
};
i2c2: i2c@500 {
@@ -81,10 +71,6 @@
#size-cells = <0>;
reg = <0x500 4>;
- pi3usb9201_emul: pi3usb9201@5f {
- compatible = "pericom,pi3usb9201";
- reg = <0x5f>;
- };
tcpci_emul: tcpci_emul@82 {
compatible = "cros,tcpci-generic-emul";
status = "okay";
@@ -126,7 +112,7 @@
&i2c0 {
battery: sb@b {
- compatible = "zephyr,smart-battery-emul";
+ compatible = "zephyr,smart-battery";
reg = <0xb>;
cycle-count = <99>;
version = "BATTERY_SPEC_VER_1_1_WITH_PEC";
diff --git a/zephyr/test/vboot_efs2/prj.conf b/zephyr/test/vboot_efs2/prj.conf
index 0b894dd082..f085fa8f73 100644
--- a/zephyr/test/vboot_efs2/prj.conf
+++ b/zephyr/test/vboot_efs2/prj.conf
@@ -2,14 +2,22 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+CONFIG_ADC=y
+CONFIG_ADC_EMUL=y
CONFIG_CROS_EC=y
+CONFIG_EMUL_CROS_FLASH=y
+CONFIG_EMUL_SMART_BATTERY=y
+CONFIG_EMUL_TCPCI=y
CONFIG_FLASH=y
+CONFIG_I2C=y
+CONFIG_I2C_EMUL=y
CONFIG_PLATFORM_EC=y
CONFIG_PLATFORM_EC_BACKLIGHT_LID=n
+CONFIG_PLATFORM_EC_BATTERY=y
CONFIG_PLATFORM_EC_BATTERY_FUEL_GAUGE=y
CONFIG_PLATFORM_EC_BATTERY_PRESENT_GPIO=y
CONFIG_PLATFORM_EC_BATTERY_SMART=y
-CONFIG_PLATFORM_EC_BC12_SINGLE_DRIVER=y
+CONFIG_PLATFORM_EC_BC12_DETECT_PI3USB9201=y
CONFIG_PLATFORM_EC_CHARGER_ISL9238=y
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR=10
CONFIG_PLATFORM_EC_CHARGER_SENSE_RESISTOR_AC=10
diff --git a/zephyr/test/vboot_efs2/src/main.c b/zephyr/test/vboot_efs2/src/main.c
index 6fb9e8ba02..1558fb75f0 100644
--- a/zephyr/test/vboot_efs2/src/main.c
+++ b/zephyr/test/vboot_efs2/src/main.c
@@ -14,8 +14,8 @@
#include "usb_mux.h"
#include "usbc_ppc.h"
#include "vboot.h"
-#include "zephyr/devicetree.h"
+#include "zephyr/devicetree.h"
#include <stdint.h>
#include <zephyr/drivers/gpio/gpio_emul.h>
@@ -372,8 +372,8 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
}
@@ -393,6 +393,25 @@ int pd_set_power_supply_ready(int port)
enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_COUNT };
+/* BC1.2 charger detect configuration */
+const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
+ [USBC_PORT_C0] = {
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
+ },
+};
+
+struct usb_mux_chain usb_muxes[] = {
+ [USBC_PORT_C0] = {
+ .mux = &(struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = DT_REG_ADDR(DT_NODELABEL(tcpci_emul)),
+ },
+ },
+};
+
/* USBC PPC configuration */
struct ppc_config_t ppc_chips[] = {
[USBC_PORT_C0] = {
diff --git a/zephyr/zmake/tests/test_jobserver.py b/zephyr/zmake/tests/test_jobserver.py
deleted file mode 100644
index a79e6dc280..0000000000
--- a/zephyr/zmake/tests/test_jobserver.py
+++ /dev/null
@@ -1,201 +0,0 @@
-# Copyright 2022 The ChromiumOS Authors
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Test jobserver functionality."""
-
-import logging
-import os
-import threading
-from asyncio import subprocess
-
-import pytest # pylint:disable=import-error
-import zmake.jobserver
-
-
-def _do_test_jobserver(
- jobs, commandline_jobs=0, use_client=False, open_pipe=True
-):
- """Test a jobserver configured with a specified number of jobs."""
-
- effective_jobs = jobs
- pipe = None
- if use_client:
- makeflags = f" -j{jobs}"
- if jobs > 1:
- pipe = os.pipe()
- # GNU make puts one less job in the pipe than allowed, since you
- # get one job "for free" without contacting the jobserver. Or
- # another way of looking at is that make consumes one slot for you
- # before calling your job just in case you aren't jobserver aware.
- os.write(pipe[1], b"A" * (jobs - 1))
- os.set_inheritable(pipe[0], True)
- os.set_inheritable(pipe[1], True)
- makeflags += f" --jobserver-auth={pipe[0]},{pipe[1]}"
- if not open_pipe:
- os.close(pipe[0])
- os.close(pipe[1])
- effective_jobs = 1
- jobserver = zmake.jobserver.GNUMakeJobClient.from_environ(
- env={"MAKEFLAGS": makeflags}, jobs=commandline_jobs
- )
- else:
- jobserver = zmake.jobserver.GNUMakeJobServer(jobs=jobs)
- pipe = jobserver._inheritable_pipe # pylint:disable=protected-access
- if jobs == 1:
- makeflags = " -j1"
- else:
- makeflags = f" -j{jobs} --jobserver-auth={pipe[0]},{pipe[1]}"
-
- lock = threading.Condition()
- started_threads = 0
- ended_threads = 0
- active_threads = 0
- please_exit = threading.Semaphore(0)
- thread_count = jobs + 5
- if commandline_jobs:
- effective_jobs = commandline_jobs
-
- def _my_thread():
- nonlocal started_threads
- nonlocal active_threads
- nonlocal ended_threads
- nonlocal pipe
-
- with lock:
- started_threads += 1
- lock.notify_all()
- with jobserver.get_job():
- with lock:
- active_threads += 1
- lock.notify_all()
- proc = jobserver.popen(
- [
- "sh",
- "-c",
- 'echo "MAKEFLAGS=${MAKEFLAGS}"; ls /proc/self/fd',
- ],
- stdout=subprocess.PIPE,
- universal_newlines=True,
- )
- proc.wait()
- output = proc.stdout.readlines()
- assert output[0] == f"MAKEFLAGS={makeflags}\n"
- if pipe:
- if effective_jobs > 1:
- assert f"{pipe[0]}\n" in output
- assert f"{pipe[1]}\n" in output
- else:
- assert f"{pipe[0]}\n" not in output
- assert f"{pipe[1]}\n" not in output
-
- please_exit.acquire() # pylint:disable=consider-using-with
- with lock:
- active_threads -= 1
- ended_threads += 1
- lock.notify_all()
-
- logging.debug("Starting %s threads", thread_count)
- for _ in range(thread_count):
- threading.Thread(target=_my_thread, daemon=True).start()
-
- with lock:
- lock.wait_for(
- lambda: started_threads == thread_count
- and active_threads == effective_jobs,
- 10,
- )
- logging.debug("Asserting %s active_threads", effective_jobs)
- assert started_threads == thread_count
- assert active_threads == effective_jobs
- assert ended_threads == 0
-
- logging.debug("Ending %s threads", 5)
- for _ in range(5):
- please_exit.release()
-
- with lock:
- lock.wait_for(
- lambda: active_threads == effective_jobs and ended_threads == 5, 10
- )
- logging.debug("Asserting %s active_threads", effective_jobs)
- assert started_threads == thread_count
- assert active_threads == effective_jobs
- assert ended_threads == 5
-
- logging.debug("Ending %s threads", thread_count - 5)
- for _ in range(thread_count - 5):
- please_exit.release()
-
- with lock:
- lock.wait_for(lambda: ended_threads == thread_count, 10)
- logging.debug("Asserting %s active_threads", 0)
- assert started_threads == thread_count
- assert active_threads == 0
- assert ended_threads == thread_count
-
-
-def test_jobserver_10():
- """Test a jobserver configured with 10 jobs."""
- _do_test_jobserver(10)
-
-
-def test_jobserver_2():
- """Test a jobserver configured with 2 jobs."""
- _do_test_jobserver(2)
-
-
-def test_jobserver_1():
- """Test a jobserver configured with 1 job."""
- _do_test_jobserver(1)
-
-
-def test_jobclient_10():
- """Test a jobclient configured with 10 jobs."""
- _do_test_jobserver(10, use_client=True)
-
-
-def test_jobclient_2():
- """Test a jobserver configured with 2 jobs."""
- _do_test_jobserver(2, use_client=True)
-
-
-def test_jobclient_1():
- """Test a jobserver configured with 1 job."""
- _do_test_jobserver(1, use_client=True)
-
-
-def test_jobclient_10_j1():
- """Test a jobclient configured with 10 jobs but zmake -j1 was called."""
- _do_test_jobserver(10, commandline_jobs=1, use_client=True)
-
-
-def test_jobclient_1_j1():
- """Test a jobserver configured with 1 job but zmake -j1 was called."""
- _do_test_jobserver(1, commandline_jobs=1, use_client=True)
-
-
-def test_jobclient_missing():
- """Test a jobclient with no MAKEFLAGS."""
- jobserver = zmake.jobserver.GNUMakeJobClient.from_environ(env={})
- assert jobserver is None
-
-
-def test_jobclient_dryrun():
- """Test a jobclient make dryrun in MAKEFLAGS."""
- with pytest.raises(SystemExit) as pytest_wrapped_e:
- zmake.jobserver.GNUMakeJobClient.from_environ(
- env={"MAKEFLAGS": "n -j1"}
- )
- assert pytest_wrapped_e.type == SystemExit
- assert pytest_wrapped_e.value.code == 0
-
-
-def test_jobclient_10_no_pipes():
- """Test a jobclient configured with 10 jobs but the file descriptors are missing."""
- _do_test_jobserver(10, use_client=True, open_pipe=False)
-
-
-def test_jobclient_1_no_pipes():
- """Test a jobclient configured with 1 job but the file descriptors are missing."""
- _do_test_jobserver(1, use_client=True, open_pipe=False)
diff --git a/zephyr/zmake/zmake/__main__.py b/zephyr/zmake/zmake/__main__.py
index 2b7358d1f1..23fb58eca6 100644
--- a/zephyr/zmake/zmake/__main__.py
+++ b/zephyr/zmake/zmake/__main__.py
@@ -10,7 +10,6 @@ import os
import pathlib
import sys
-import zmake.jobserver as jobserver
import zmake.multiproc as multiproc
import zmake.zmake as zm
@@ -64,7 +63,7 @@ def maybe_reexec(argv):
os.execve(sys.executable, [sys.executable, "-m", "zmake", *argv], env)
-def call_with_namespace(func, namespace, **kwds):
+def call_with_namespace(func, namespace):
"""Call a function with arguments applied from a Namespace.
Args:
@@ -74,6 +73,7 @@ def call_with_namespace(func, namespace, **kwds):
Returns:
The result of calling the callable.
"""
+ kwds = {}
sig = inspect.signature(func)
names = [p.name for p in sig.parameters.values()]
for name, value in vars(namespace).items():
@@ -392,11 +392,8 @@ def main(argv=None):
multiproc.LOG_JOB_NAMES = False
logging.basicConfig(format=log_format, level=opts.log_level)
- # Create the jobserver client BEFORE any pipes get opened in LogWriter
- jobserver_client = jobserver.GNUMakeJobClient.from_environ(jobs=opts.jobs)
- multiproc.LogWriter.reset()
- zmake = call_with_namespace(zm.Zmake, opts, jobserver=jobserver_client)
+ zmake = call_with_namespace(zm.Zmake, opts)
try:
subcommand_method = getattr(zmake, opts.subcommand.replace("-", "_"))
result = call_with_namespace(subcommand_method, opts)
diff --git a/zephyr/zmake/zmake/jobserver.py b/zephyr/zmake/zmake/jobserver.py
index c1c9538b35..a3d6287da2 100644
--- a/zephyr/zmake/zmake/jobserver.py
+++ b/zephyr/zmake/zmake/jobserver.py
@@ -3,17 +3,13 @@
# found in the LICENSE file.
"""Module for job counters, limiting the amount of concurrent executions."""
-import fcntl
-import functools
import logging
import multiprocessing
import os
import re
import select
-import selectors
import shlex
import subprocess
-import sys
import zmake
@@ -30,8 +26,7 @@ class JobHandle:
pass
def __exit__(self, exc_type, exc_value, traceback):
- if self.release_func:
- self.release_func(*self.args, **self.kwargs)
+ self.release_func(*self.args, **self.kwargs)
class JobClient:
@@ -46,16 +41,6 @@ class JobClient:
"""Get the environment variables necessary to share the job server."""
return {}
- @staticmethod
- def is_sequential():
- """Returns True if the jobserver is using -j1."""
- return False
-
- @staticmethod
- def pass_fds():
- """Returns the file descriptors that should be passed to subprocesses."""
- return []
-
def popen(self, argv, **kwargs):
"""Start a process using subprocess.Popen
@@ -68,9 +53,7 @@ class JobClient:
# the bare minimum (PATH only). This prevents us from building obscure
# dependencies on the environment variables.
kwargs.setdefault("env", {"PATH": "/bin:/usr/bin"})
- kwargs.setdefault("pass_fds", [])
kwargs["env"].update(self.env())
- kwargs["pass_fds"] += self.pass_fds()
logger = logging.getLogger(self.__class__.__name__)
logger.debug(
@@ -79,53 +62,17 @@ class JobClient:
" " if kwargs["env"] else "",
zmake.util.repr_command(argv),
)
- return subprocess.Popen( # pylint:disable=consider-using-with
- argv, **kwargs
- )
+ return subprocess.Popen(argv, **kwargs)
class GNUMakeJobClient(JobClient):
- """A job client for GNU make.
+ """A job client for GNU make."""
- A client of jobserver is allowed to run 1 job without contacting the
- jobserver, so maintain an optional self._internal_pipe to hold that
- job.
- """
-
- def __init__(self, inheritable_pipe, jobs, internal_jobs=0, makeflags=None):
- self._makeflags = makeflags
- self._inheritable_pipe = inheritable_pipe
- self.jobs = jobs
- self._selector = selectors.DefaultSelector()
- if internal_jobs:
- self._internal_pipe = os.pipe()
- os.write(self._internal_pipe[1], b"+" * internal_jobs)
- os.set_blocking(self._internal_pipe[0], False)
- self._selector.register(
- self._internal_pipe[0],
- selectors.EVENT_READ,
- self._internal_pipe[1],
- )
- else:
- self._internal_pipe = None
- if self._inheritable_pipe is not None:
- os.set_blocking(self._inheritable_pipe[0], False)
- self._selector.register(
- self._inheritable_pipe[0],
- selectors.EVENT_READ,
- self._inheritable_pipe[1],
- )
-
- def __del__(self):
- if self._inheritable_pipe:
- os.close(self._inheritable_pipe[0])
- os.close(self._inheritable_pipe[1])
- if self._internal_pipe:
- os.close(self._internal_pipe[0])
- os.close(self._internal_pipe[1])
+ def __init__(self, read_fd, write_fd):
+ self._pipe = [read_fd, write_fd]
@classmethod
- def from_environ(cls, env=None, jobs=0):
+ def from_environ(cls, env=None):
"""Create a job client from an environment with the MAKEFLAGS variable.
If we are started under a GNU Make Job Server, we can search
@@ -134,57 +81,22 @@ class GNUMakeJobClient(JobClient):
respectively. If we don't find this environment variable (or
the string inside of it), this will raise an OSError.
- The specification for MAKEFLAGS is:
- * If the first char is "n", this is a dry run, just exit.
- * If the flags contains -j1, go to sequential mode.
- * If the flags contains --jobserver-auth=R,W AND those file
- descriptors are valid, use the jobserver. Otherwise output a
- warning.
-
Args:
env: Optionally, the environment to search.
- jobs: The number of jobs set by the user on the command line.
Returns:
- A GNUMakeJobClient configured appropriately or None if there is
- no MAKEFLAGS environment variable.
+ A GNUMakeJobClient configured appropriately.
"""
if env is None:
env = os.environ
makeflags = env.get("MAKEFLAGS")
if not makeflags:
- return None
+ raise OSError("MAKEFLAGS is not set in the environment")
match = re.search(r"--jobserver-auth=(\d+),(\d+)", makeflags)
- if match:
- pipe = [int(x) for x in match.groups()]
- if jobs:
- pipe = None
- logging.warning(
- "-jN forced on command line; ignoring GNU make jobserver"
- )
- else:
- try:
- # Use F_GETFD to see if file descriptors are valid
- fcntl.fcntl(pipe[0], fcntl.F_GETFD)
- fcntl.fcntl(pipe[1], fcntl.F_GETFD)
- logging.info("using GNU make jobserver")
- except OSError:
- pipe = None
- logging.warning(
- "No file descriptors; ignoring GNU make jobserver"
- )
- else:
- pipe = None
- if not jobs:
- match = re.search(r"-j(\d+)", makeflags)
- if match:
- jobs = int(match.group(1))
- if jobs == 1:
- logging.info("Running in sequential mode (-j1)")
- if makeflags[0] == "n":
- logging.info("MAKEFLAGS contained dry-run flag")
- sys.exit(0)
- return cls(pipe, jobs, internal_jobs=1, makeflags=makeflags)
+ if not match:
+ raise OSError("MAKEFLAGS did not contain jobserver flags")
+ read_fd, write_fd = map(int, match.groups())
+ return cls(read_fd, write_fd)
def get_job(self):
"""Claim a job.
@@ -192,38 +104,12 @@ class GNUMakeJobClient(JobClient):
Returns:
A JobHandle object.
"""
- while True:
- ready_items = self._selector.select()
- if len(ready_items) > 0:
- read_fd = ready_items[0][0].fd
- write_fd = ready_items[0][0].data
- try:
- byte = os.read(read_fd, 1)
- return JobHandle(
- functools.partial(os.write, write_fd, byte)
- )
- except BlockingIOError:
- pass
+ byte = os.read(self._pipe[0], 1)
+ return JobHandle(lambda: os.write(self._pipe[1], byte))
def env(self):
"""Get the environment variables necessary to share the job server."""
- if self._makeflags:
- return {"MAKEFLAGS": self._makeflags}
- flag = ""
- if self.jobs:
- flag += f" -j{self.jobs}"
- if self.jobs != 1 and self._inheritable_pipe is not None:
- flag += " --jobserver-auth={},{}".format(*self._inheritable_pipe)
- return {"MAKEFLAGS": flag}
-
- def is_sequential(self):
- return self.jobs == 1
-
- def pass_fds(self):
- """Returns the file descriptors that should be passed to subprocesses."""
- if self.jobs != 1 and self._inheritable_pipe is not None:
- return self._inheritable_pipe
- return []
+ return {"MAKEFLAGS": "--jobserver-auth={},{}".format(*self._pipe)}
class GNUMakeJobServer(GNUMakeJobClient):
@@ -234,10 +120,11 @@ class GNUMakeJobServer(GNUMakeJobClient):
"""
def __init__(self, jobs=0):
+ [read_fd, write_fd] = os.pipe()
+ super().__init__(read_fd, write_fd)
if not jobs:
jobs = multiprocessing.cpu_count()
elif jobs > select.PIPE_BUF:
jobs = select.PIPE_BUF
- super().__init__(os.pipe(), jobs)
- os.write(self._inheritable_pipe[1], b"+" * jobs)
+ os.write(self._pipe[1], b"+" * jobs)
diff --git a/zephyr/zmake/zmake/multiproc.py b/zephyr/zmake/zmake/multiproc.py
index a668bcb961..0838f5f1f8 100644
--- a/zephyr/zmake/zmake/multiproc.py
+++ b/zephyr/zmake/zmake/multiproc.py
@@ -43,8 +43,7 @@ class LogWriter:
# A local pipe use to signal the look that a new file descriptor was added and
# should be included in the select statement.
- _logging_interrupt_pipe = []
-
+ _logging_interrupt_pipe = os.pipe()
# A condition variable used to synchronize logging operations.
_logging_cv = threading.Condition()
# A map of file descriptors to their LogWriter
@@ -55,14 +54,7 @@ class LogWriter:
@classmethod
def reset(cls):
"""Reset this module to its starting state (useful for tests)"""
- with LogWriter._logging_cv:
- LogWriter._logging_map.clear()
- if len(LogWriter._logging_interrupt_pipe) > 1:
- os.write(LogWriter._logging_interrupt_pipe[1], b"x")
- else:
- cls._logging_interrupt_pipe = os.pipe()
- LogWriter._logging_thread = None
- LogWriter._logging_cv.notify_all()
+ LogWriter._logging_map.clear()
def __init__(
self,
@@ -143,21 +135,20 @@ class LogWriter:
removed from the map as it is no longer valid.
"""
with LogWriter._logging_cv:
- if file_descriptor in LogWriter._logging_map:
- writer = LogWriter._logging_map[file_descriptor]
- if file_descriptor.closed:
- del LogWriter._logging_map[file_descriptor]
- LogWriter._logging_cv.notify_all()
- return
- line = file_descriptor.readline()
- if not line:
- # EOF
- del LogWriter._logging_map[file_descriptor]
- LogWriter._logging_cv.notify_all()
- return
- line = line.rstrip("\n")
- if line:
- writer.log_line(line)
+ writer = LogWriter._logging_map[file_descriptor]
+ if file_descriptor.closed:
+ del LogWriter._logging_map[file_descriptor]
+ LogWriter._logging_cv.notify_all()
+ return
+ line = file_descriptor.readline()
+ if not line:
+ # EOF
+ del LogWriter._logging_map[file_descriptor]
+ LogWriter._logging_cv.notify_all()
+ return
+ line = line.rstrip("\n")
+ if line:
+ writer.log_line(line)
@classmethod
def _prune_logging_fds(cls):
@@ -304,9 +295,6 @@ class Executor:
Args:
func: A function which returns an int result code or throws an
exception.
-
- Returns:
- A join function which will wait until this task is finished.
"""
with self.lock:
thread = threading.Thread(
@@ -314,7 +302,6 @@ class Executor:
)
thread.start()
self.threads.append(thread)
- return thread.join
def wait(self):
"""Wait for a result to be available.
diff --git a/zephyr/zmake/zmake/zmake.py b/zephyr/zmake/zmake/zmake.py
index fb88dae7e9..f81f157054 100644
--- a/zephyr/zmake/zmake/zmake.py
+++ b/zephyr/zmake/zmake/zmake.py
@@ -187,10 +187,13 @@ class Zmake:
if jobserver:
self.jobserver = jobserver
else:
- self.jobserver = zmake.jobserver.GNUMakeJobServer(jobs=jobs)
+ try:
+ self.jobserver = zmake.jobserver.GNUMakeJobClient.from_environ()
+ except OSError:
+ self.jobserver = zmake.jobserver.GNUMakeJobServer(jobs=jobs)
self.executor = zmake.multiproc.Executor()
- self._sequential = self.jobserver.is_sequential() and not goma
+ self._sequential = jobs == 1 and not goma
self.failed_projects = []
@property
@@ -240,7 +243,6 @@ class Zmake:
delete_intermediates=False,
static_version=False,
save_temps=False,
- wait_for_executor=True,
):
"""Locate and configure the specified projects."""
# Resolve build_dir if needed.
@@ -267,6 +269,7 @@ class Zmake:
coverage=coverage,
allow_warnings=allow_warnings,
extra_cflags=extra_cflags,
+ multiproject=len(projects) > 1,
delete_intermediates=delete_intermediates,
static_version=static_version,
save_temps=save_temps,
@@ -276,11 +279,11 @@ class Zmake:
result = self.executor.wait()
if result:
return result
+ result = self.executor.wait()
+ if result:
+ return result
non_test_projects = [p for p in projects if not p.config.is_test]
if len(non_test_projects) > 1 and coverage and build_after_configure:
- result = self.executor.wait()
- if result:
- return result
result = self._merge_lcov_files(
projects=non_test_projects,
build_dir=build_dir,
@@ -289,11 +292,6 @@ class Zmake:
if result:
self.failed_projects.append(str(build_dir / "all_builds.info"))
return result
- elif wait_for_executor:
- result = self.executor.wait()
- if result:
- return result
-
return 0
def build(
@@ -387,10 +385,8 @@ class Zmake:
delete_intermediates=False,
static_version=True,
save_temps=False,
- wait_for_executor=False,
)
- if not result:
- result = self.executor.wait()
+
if result:
self.logger.error(
"compare-builds failed to build all projects at %s",
@@ -444,364 +440,372 @@ class Zmake:
coverage=False,
allow_warnings=False,
extra_cflags=None,
+ multiproject=False,
delete_intermediates=False,
static_version=False,
save_temps=False,
):
"""Set up a build directory to later be built by "zmake build"."""
try:
- with self.jobserver.get_job():
- # Clobber build directory if requested.
- if clobber and build_dir.exists():
- self.logger.info(
- "Clearing build directory %s due to --clobber",
- build_dir,
- )
- shutil.rmtree(build_dir)
+ # Clobber build directory if requested.
+ if clobber and build_dir.exists():
+ self.logger.info(
+ "Clearing build directory %s due to --clobber", build_dir
+ )
+ shutil.rmtree(build_dir)
+
+ generated_include_dir = (build_dir / "include").resolve()
+ base_config = zmake.build_config.BuildConfig(
+ cmake_defs={
+ "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+ "DTS_ROOT": str(self.module_paths["ec"] / "zephyr"),
+ "SYSCALL_INCLUDE_DIRS": str(
+ self.module_paths["ec"]
+ / "zephyr"
+ / "include"
+ / "drivers"
+ ),
+ "USER_CACHE_DIR": str(
+ self.module_paths["ec"]
+ / "build"
+ / "zephyr"
+ / "user-cache"
+ ),
+ "ZEPHYR_BASE": str(self.zephyr_base),
+ "ZMAKE_INCLUDE_DIR": str(generated_include_dir),
+ "ZMAKE_PROJECT_NAME": project.config.project_name,
+ **(
+ {"EXTRA_EC_VERSION_FLAGS": "--static"}
+ if static_version
+ else {}
+ ),
+ **(
+ {"EXTRA_CFLAGS": "-save-temps=obj"}
+ if save_temps
+ else {}
+ ),
+ },
+ )
+
+ # Prune the module paths to just those required by the project.
+ module_paths = project.prune_modules(self.module_paths)
+
+ module_config = zmake.modules.setup_module_symlinks(
+ build_dir / "modules", module_paths
+ )
+
+ # Symlink the Zephyr base into the build directory so it can
+ # be used in the build phase.
+ util.update_symlink(self.zephyr_base, build_dir / "zephyr_base")
+
+ dts_overlay_config = project.find_dts_overlays(module_paths)
- generated_include_dir = (build_dir / "include").resolve()
- base_config = zmake.build_config.BuildConfig(
+ toolchain_support = project.get_toolchain(
+ module_paths, override=toolchain
+ )
+ toolchain_config = toolchain_support.get_build_config()
+
+ if bringup:
+ base_config |= zmake.build_config.BuildConfig(
+ kconfig_defs={"CONFIG_PLATFORM_EC_BRINGUP": "y"}
+ )
+ if coverage:
+ base_config |= zmake.build_config.BuildConfig(
+ kconfig_defs={"CONFIG_COVERAGE": "y"}
+ )
+ if allow_warnings:
+ base_config |= zmake.build_config.BuildConfig(
+ cmake_defs={"ALLOW_WARNINGS": "ON"}
+ )
+ if extra_cflags:
+ base_config |= zmake.build_config.BuildConfig(
+ cmake_defs={"EXTRA_CFLAGS": extra_cflags},
+ )
+ if self.goma:
+ base_config |= zmake.build_config.BuildConfig(
cmake_defs={
- "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
- "DTS_ROOT": str(self.module_paths["ec"] / "zephyr"),
- "SYSCALL_INCLUDE_DIRS": str(
- self.module_paths["ec"]
- / "zephyr"
- / "include"
- / "drivers"
- ),
- "USER_CACHE_DIR": str(
- self.module_paths["ec"]
- / "build"
- / "zephyr"
- / "user-cache"
- ),
- "ZEPHYR_BASE": str(self.zephyr_base),
- "ZMAKE_INCLUDE_DIR": str(generated_include_dir),
- "ZMAKE_PROJECT_NAME": project.config.project_name,
- **(
- {"EXTRA_EC_VERSION_FLAGS": "--static"}
- if static_version
- else {}
- ),
- **(
- {"EXTRA_CFLAGS": "-save-temps=obj"}
- if save_temps
- else {}
- ),
+ "CMAKE_C_COMPILER_LAUNCHER": self.gomacc,
+ "CMAKE_CXX_COMPILER_LAUNCHER": self.gomacc,
},
)
- # Prune the module paths to just those required by the project.
- module_paths = project.prune_modules(self.module_paths)
-
- module_config = zmake.modules.setup_module_symlinks(
- build_dir / "modules", module_paths
+ if not build_dir.exists():
+ build_dir.mkdir()
+ if not generated_include_dir.exists():
+ generated_include_dir.mkdir()
+ processes = []
+ files_to_write = []
+ self.logger.info(
+ "Building %s in %s.", project.config.project_name, build_dir
+ )
+ for build_name, build_config in project.iter_builds():
+ config: zmake.build_config.BuildConfig = (
+ base_config
+ | toolchain_config
+ | module_config
+ | dts_overlay_config
+ | build_config
)
- # Symlink the Zephyr base into the build directory so it can
- # be used in the build phase.
- util.update_symlink(self.zephyr_base, build_dir / "zephyr_base")
-
- dts_overlay_config = project.find_dts_overlays(module_paths)
+ config_json = config.as_json()
+ config_json_file = build_dir / f"cfg-{build_name}.json"
+ if config_json_file.is_file():
+ if config_json_file.read_text() == config_json:
+ self.logger.info(
+ "Skip reconfiguring %s:%s due to previous cmake run of "
+ "equivalent configuration. Run with --clobber if this "
+ "optimization is undesired.",
+ project.config.project_name,
+ build_name,
+ )
+ continue
+ config_json_file.unlink()
- toolchain_support = project.get_toolchain(
- module_paths, override=toolchain
- )
- toolchain_config = toolchain_support.get_build_config()
+ files_to_write.append((config_json_file, config_json))
- if bringup:
- base_config |= zmake.build_config.BuildConfig(
- kconfig_defs={"CONFIG_PLATFORM_EC_BRINGUP": "y"}
- )
- if coverage:
- base_config |= zmake.build_config.BuildConfig(
- kconfig_defs={"CONFIG_COVERAGE": "y"}
- )
- if allow_warnings:
- base_config |= zmake.build_config.BuildConfig(
- cmake_defs={"ALLOW_WARNINGS": "ON"}
- )
- if extra_cflags:
- base_config |= zmake.build_config.BuildConfig(
- cmake_defs={"EXTRA_CFLAGS": extra_cflags},
- )
- if self.goma:
- base_config |= zmake.build_config.BuildConfig(
- cmake_defs={
- "CMAKE_C_COMPILER_LAUNCHER": self.gomacc,
- "CMAKE_CXX_COMPILER_LAUNCHER": self.gomacc,
- },
+ output_dir = build_dir / "build-{}".format(build_name)
+ if output_dir.exists():
+ self.logger.info(
+ "Clobber %s due to configuration changes.", output_dir
)
+ shutil.rmtree(output_dir)
- if not build_dir.exists():
- build_dir.mkdir()
- if not generated_include_dir.exists():
- generated_include_dir.mkdir()
self.logger.info(
- "Building %s in %s.", project.config.project_name, build_dir
+ "Configuring %s:%s.",
+ project.config.project_name,
+ build_name,
)
- # To reconstruct a Project object later, we need to know the
- # name and project directory.
- (build_dir / "project_name.txt").write_text(
- project.config.project_name
+
+ kconfig_file = build_dir / "kconfig-{}.conf".format(build_name)
+ proc = config.popen_cmake(
+ self.jobserver,
+ project.config.project_dir,
+ output_dir,
+ kconfig_file,
+ stdin=subprocess.DEVNULL,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ encoding="utf-8",
+ errors="replace",
)
- util.update_symlink(
- project.config.project_dir, build_dir / "project"
+ job_id = "{}:{}".format(project.config.project_name, build_name)
+ zmake.multiproc.LogWriter.log_output(
+ self.logger,
+ logging.DEBUG,
+ proc.stdout,
+ log_level_override_func=cmake_log_level_override,
+ job_id=job_id,
)
+ zmake.multiproc.LogWriter.log_output(
+ self.logger,
+ logging.ERROR,
+ proc.stderr,
+ log_level_override_func=cmake_log_level_override,
+ job_id=job_id,
+ )
+ if self._sequential:
+ if proc.wait():
+ raise OSError(get_process_failure_msg(proc))
+ else:
+ processes.append(proc)
+ for proc in processes:
+ if proc.wait():
+ raise OSError(get_process_failure_msg(proc))
+
+ for path, contents in files_to_write:
+ path.write_text(contents)
+
+ # To reconstruct a Project object later, we need to know the
+ # name and project directory.
+ (build_dir / "project_name.txt").write_text(
+ project.config.project_name
+ )
+ util.update_symlink(
+ project.config.project_dir, build_dir / "project"
+ )
- wait_funcs = []
- for build_name, build_config in project.iter_builds():
- config: zmake.build_config.BuildConfig = (
- base_config
- | toolchain_config
- | module_config
- | dts_overlay_config
- | build_config
- )
-
- wait_func = self.executor.append(
- func=functools.partial(
- self._configure_one_build,
- config=config,
- build_dir=build_dir,
- build_name=build_name,
- project=project,
- )
- )
- wait_funcs.append(wait_func)
- # Outside the with...get_job above.
- for wait_func in wait_funcs:
- wait_func()
-
+ output_files = []
if build_after_configure:
- self._build(
+ result = self._build(
build_dir=build_dir,
project=project,
coverage=coverage,
+ output_files_out=output_files,
+ multiproject=multiproject,
static_version=static_version,
- delete_intermediates=delete_intermediates,
)
+ if result:
+ self.failed_projects.append(project.config.project_name)
+ return result
+
+ if delete_intermediates:
+ outdir = build_dir / "output"
+ for child in build_dir.iterdir():
+ if child != outdir:
+ logging.debug("Deleting %s", child)
+ if not child.is_symlink() and child.is_dir():
+ shutil.rmtree(child)
+ else:
+ child.unlink()
return 0
except Exception:
self.failed_projects.append(project.config.project_name)
raise
- def _configure_one_build(
- self,
- config,
- build_dir,
- build_name,
- project,
- ):
- """Run cmake and maybe ninja on one build dir."""
- with self.jobserver.get_job():
- config_json = config.as_json()
- config_json_file = build_dir / f"cfg-{build_name}.json"
- if config_json_file.is_file():
- if config_json_file.read_text() == config_json:
- self.logger.info(
- "Skip reconfiguring %s:%s due to previous cmake run of "
- "equivalent configuration. Run with --clobber if this "
- "optimization is undesired.",
- project.config.project_name,
- build_name,
- )
- return 0
- config_json_file.unlink()
-
- output_dir = build_dir / "build-{}".format(build_name)
- if output_dir.exists():
- self.logger.info(
- "Clobber %s due to configuration changes.",
- output_dir,
- )
- shutil.rmtree(output_dir)
-
- self.logger.info(
- "Configuring %s:%s.",
- project.config.project_name,
- build_name,
- )
-
- kconfig_file = build_dir / "kconfig-{}.conf".format(build_name)
- proc = config.popen_cmake(
- self.jobserver,
- project.config.project_dir,
- output_dir,
- kconfig_file,
- stdin=subprocess.DEVNULL,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- encoding="utf-8",
- errors="replace",
- )
- job_id = "{}:{}".format(project.config.project_name, build_name)
- zmake.multiproc.LogWriter.log_output(
- self.logger,
- logging.DEBUG,
- proc.stdout,
- log_level_override_func=cmake_log_level_override,
- job_id=job_id,
- )
- zmake.multiproc.LogWriter.log_output(
- self.logger,
- logging.ERROR,
- proc.stderr,
- log_level_override_func=cmake_log_level_override,
- job_id=job_id,
- )
- if proc.wait():
- raise OSError(get_process_failure_msg(proc))
- config_json_file.write_text(config_json)
- return 0
-
def _build(
self,
build_dir,
project: zmake.project.Project,
+ output_files_out=None,
coverage=False,
+ multiproject=False,
static_version=False,
- delete_intermediates=False,
):
"""Build a pre-configured build directory."""
- with self.jobserver.get_job():
- dirs: Dict[str, pathlib.Path] = {}
-
- build_dir = build_dir.resolve()
+ def wait_and_check_success(procs, writers):
+ """Wait for processes to complete and check for errors
+
+ Args:
+ procs: List of subprocess.Popen objects to check
+ writers: List of LogWriter objects to check
+
+ Returns:
+ True if all if OK
+ False if an error was found (so that zmake should exit)
+ """
+ bad = None
+ for proc in procs:
+ if proc.wait() and not bad:
+ bad = proc
+ if bad:
+ # Just show the first bad process for now. Both builds likely
+ # produce the same error anyway. If they don't, the user can
+ # still take action on the errors/warnings provided. Showing
+ # multiple 'Execution failed' messages is not very friendly
+ # since it exposes the fragmented nature of the build.
+ raise OSError(get_process_failure_msg(bad))
- # Compute the version string.
- version_string = zmake.version.get_version_string(
- project.config.project_name,
- build_dir / "zephyr_base",
- zmake.modules.locate_from_directory(build_dir / "modules"),
- static=static_version,
- )
+ # Let all output be produced before exiting
+ for writer in writers:
+ writer.wait()
+ return True
+
+ procs = []
+ log_writers = []
+ dirs: Dict[str, pathlib.Path] = {}
+
+ build_dir = build_dir.resolve()
+
+ # Compute the version string.
+ version_string = zmake.version.get_version_string(
+ project.config.project_name,
+ build_dir / "zephyr_base",
+ zmake.modules.locate_from_directory(build_dir / "modules"),
+ static=static_version,
+ )
- # The version header needs to generated during the build phase
- # instead of configure, as the tree may have changed since
- # configure was run.
- zmake.version.write_version_header(
- version_string,
- build_dir / "include" / "ec_version.h",
- "zmake",
- static=static_version,
- )
+ # The version header needs to generated during the build phase
+ # instead of configure, as the tree may have changed since
+ # configure was run.
+ zmake.version.write_version_header(
+ version_string,
+ build_dir / "include" / "ec_version.h",
+ "zmake",
+ static=static_version,
+ )
- gcov = "gcov.sh-not-found"
- wait_funcs = []
- for build_name, _ in project.iter_builds():
+ gcov = "gcov.sh-not-found"
+ for build_name, _ in project.iter_builds():
+ with self.jobserver.get_job():
dirs[build_name] = build_dir / "build-{}".format(build_name)
gcov = dirs[build_name] / "gcov.sh"
- wait_func = self.executor.append(
- func=functools.partial(
- self._build_one_dir,
- build_name=build_name,
- dirs=dirs,
- coverage=coverage,
- project=project,
- )
+ cmd = ["/usr/bin/ninja", "-C", dirs[build_name].as_posix()]
+ if self.goma:
+ # Go nuts ninja, goma does the heavy lifting!
+ cmd.append("-j1024")
+ elif multiproject:
+ cmd.append("-j1")
+ # Only tests will actually build with coverage enabled.
+ if coverage and not project.config.is_test:
+ cmd.append("all.libraries")
+ self.logger.info(
+ "Building %s:%s: %s",
+ project.config.project_name,
+ build_name,
+ util.repr_command(cmd),
+ )
+ proc = self.jobserver.popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ encoding="utf-8",
+ errors="replace",
+ # TODO(b/239619222): Filter os.environ for ninja.
+ env=os.environ,
+ )
+ job_id = "{}:{}".format(project.config.project_name, build_name)
+ dirs[build_name].mkdir(parents=True, exist_ok=True)
+ build_log = open( # pylint:disable=consider-using-with
+ dirs[build_name] / "build.log",
+ "w",
+ )
+ out = zmake.multiproc.LogWriter.log_output(
+ logger=self.logger,
+ log_level=logging.INFO,
+ file_descriptor=proc.stdout,
+ log_level_override_func=ninja_stdout_log_level_override,
+ job_id=job_id,
+ tee_output=build_log,
+ )
+ err = zmake.multiproc.LogWriter.log_output(
+ self.logger,
+ logging.ERROR,
+ proc.stderr,
+ job_id=job_id,
)
- wait_funcs.append(wait_func)
- # Outside the with...get_job above.
- for wait_func in wait_funcs:
- wait_func()
- with self.jobserver.get_job():
- # Run the packer.
- packer_work_dir = build_dir / "packer"
- output_dir = build_dir / "output"
- for newdir in output_dir, packer_work_dir:
- if not newdir.exists():
- newdir.mkdir()
-
- # For non-tests, they won't link with coverage, so don't pack the
- # firmware. Also generate a lcov file.
- if coverage and not project.config.is_test:
+ if self._sequential:
+ if not wait_and_check_success([proc], [out, err]):
+ return 2
+ else:
+ procs.append(proc)
+ log_writers += [out, err]
+
+ if not wait_and_check_success(procs, log_writers):
+ return 2
+
+ # Run the packer.
+ packer_work_dir = build_dir / "packer"
+ output_dir = build_dir / "output"
+ for newdir in output_dir, packer_work_dir:
+ if not newdir.exists():
+ newdir.mkdir()
+
+ if output_files_out is None:
+ output_files_out = []
+ # For non-tests, they won't link with coverage, so don't pack the
+ # firmware. Also generate a lcov file.
+ if coverage and not project.config.is_test:
+ with self.jobserver.get_job():
self._run_lcov(
build_dir,
output_dir / "zephyr.info",
initial=True,
gcov=gcov,
)
- else:
- for output_file, output_name in project.packer.pack_firmware(
- packer_work_dir,
- self.jobserver,
- dirs,
- version_string=version_string,
- ):
- shutil.copy2(output_file, output_dir / output_name)
- self.logger.debug("Output file '%s' created.", output_file)
-
- if delete_intermediates:
- outdir = build_dir / "output"
- for child in build_dir.iterdir():
- if child != outdir:
- logging.debug("Deleting %s", child)
- if not child.is_symlink() and child.is_dir():
- shutil.rmtree(child)
- else:
- child.unlink()
- return 0
-
- def _build_one_dir(self, build_name, dirs, coverage, project):
- """Builds one sub-dir of a configured project (build-ro, etc)."""
-
- with self.jobserver.get_job():
- cmd = ["/usr/bin/ninja", "-C", dirs[build_name].as_posix()]
- if self.goma:
- # Go nuts ninja, goma does the heavy lifting!
- cmd.append("-j1024")
- elif self._sequential:
- cmd.append("-j1")
- # Only tests will actually build with coverage enabled.
- if coverage and not project.config.is_test:
- cmd.append("all.libraries")
- self.logger.info(
- "Building %s:%s: %s",
- project.config.project_name,
- build_name,
- util.repr_command(cmd),
- )
- proc = self.jobserver.popen(
- cmd,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- encoding="utf-8",
- errors="replace",
- # TODO(b/239619222): Filter os.environ for ninja.
- env=os.environ,
- )
- job_id = "{}:{}".format(project.config.project_name, build_name)
- dirs[build_name].mkdir(parents=True, exist_ok=True)
- build_log = open( # pylint:disable=consider-using-with
- dirs[build_name] / "build.log",
- "w",
- )
- out = zmake.multiproc.LogWriter.log_output(
- logger=self.logger,
- log_level=logging.INFO,
- file_descriptor=proc.stdout,
- log_level_override_func=ninja_stdout_log_level_override,
- job_id=job_id,
- tee_output=build_log,
- )
- err = zmake.multiproc.LogWriter.log_output(
- self.logger,
- logging.ERROR,
- proc.stderr,
- job_id=job_id,
- )
-
- if proc.wait():
- raise OSError(get_process_failure_msg(proc))
+ else:
+ for output_file, output_name in project.packer.pack_firmware(
+ packer_work_dir,
+ self.jobserver,
+ dirs,
+ version_string=version_string,
+ ):
+ shutil.copy2(output_file, output_dir / output_name)
+ self.logger.debug("Output file '%s' created.", output_file)
+ output_files_out.append(output_file)
- # Let all output be produced before exiting
- out.wait()
- err.wait()
- return 0
+ return 0
def _run_lcov(
self,
@@ -865,33 +869,34 @@ class Zmake:
pathlib.Path(build_dir) / project.config.project_name
)
all_lcov_files.append(project_build_dir / "output" / "zephyr.info")
- # Merge info files into a single lcov.info
- self.logger.info("Merging coverage data into %s.", output_file)
- cmd = [
- "/usr/bin/lcov",
- "-o",
- output_file,
- "--rc",
- "lcov_branch_coverage=1",
- ]
- for info in all_lcov_files:
- cmd += ["-a", info]
- proc = self.jobserver.popen(
- cmd,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- encoding="utf-8",
- errors="replace",
- )
- zmake.multiproc.LogWriter.log_output(
- self.logger, logging.ERROR, proc.stderr, job_id="lcov"
- )
- zmake.multiproc.LogWriter.log_output(
- self.logger, logging.DEBUG, proc.stdout, job_id="lcov"
- )
- if proc.wait():
- raise OSError(get_process_failure_msg(proc))
- return 0
+ with self.jobserver.get_job():
+ # Merge info files into a single lcov.info
+ self.logger.info("Merging coverage data into %s.", output_file)
+ cmd = [
+ "/usr/bin/lcov",
+ "-o",
+ output_file,
+ "--rc",
+ "lcov_branch_coverage=1",
+ ]
+ for info in all_lcov_files:
+ cmd += ["-a", info]
+ proc = self.jobserver.popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ encoding="utf-8",
+ errors="replace",
+ )
+ zmake.multiproc.LogWriter.log_output(
+ self.logger, logging.ERROR, proc.stderr, job_id="lcov"
+ )
+ zmake.multiproc.LogWriter.log_output(
+ self.logger, logging.DEBUG, proc.stdout, job_id="lcov"
+ )
+ if proc.wait():
+ raise OSError(get_process_failure_msg(proc))
+ return 0
def list_projects(self, fmt, search_dir):
"""List project names known to zmake on stdout.