From 3f560db8974b16907b4a3fb3755d98f75276ff67 Mon Sep 17 00:00:00 2001 From: Ting Shen Date: Thu, 15 Dec 2022 15:38:07 +0800 Subject: zephyr: reorganize dts files in krabby test The DTC_OVERLAY_FILE line in testcase.yaml is too long now. Migrate to the latest project.overlay style to manage the dts files better. BUG=none TEST=twister -v -i --coverage -p native_posix -p unit_testing \ -T zephyr/test/krabby BRANCH=none Change-Id: Idb5332f84690f8c46bc23b7715b625f247e62d95 Signed-off-by: Ting Shen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4109550 Tested-by: Ting Shen Reviewed-by: Eric Yilun Lin Auto-Submit: Ting Shen Commit-Queue: Eric Yilun Lin Code-Coverage: Zoss --- zephyr/test/krabby/adc_temp.dts | 23 ---- zephyr/test/krabby/cbi_sensor.dts | 123 ------------------ zephyr/test/krabby/common.dts | 159 ------------------------ zephyr/test/krabby/common.dtsi | 159 ++++++++++++++++++++++++ zephyr/test/krabby/krabby.default.overlay | 13 ++ zephyr/test/krabby/krabby.tentacruel.overlay | 178 +++++++++++++++++++++++++++ zephyr/test/krabby/pinctrl.dts | 40 ------ zephyr/test/krabby/testcase.yaml | 4 +- 8 files changed, 352 insertions(+), 347 deletions(-) delete mode 100644 zephyr/test/krabby/adc_temp.dts delete mode 100644 zephyr/test/krabby/cbi_sensor.dts delete mode 100644 zephyr/test/krabby/common.dts create mode 100644 zephyr/test/krabby/common.dtsi create mode 100644 zephyr/test/krabby/krabby.default.overlay create mode 100644 zephyr/test/krabby/krabby.tentacruel.overlay delete mode 100644 zephyr/test/krabby/pinctrl.dts diff --git a/zephyr/test/krabby/adc_temp.dts b/zephyr/test/krabby/adc_temp.dts deleted file mode 100644 index c0d17cca13..0000000000 --- a/zephyr/test/krabby/adc_temp.dts +++ /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 - -/ { - name_temp_charger: charger { - compatible = "cros-ec,temp-sensor-thermistor"; - - thermistor = <&thermistor_rt9490>; - adc = <&adc_charger>; - }; - - named-temp-sensors { - compatible = "cros-ec,temp-sensors"; - temp_charger: charger { - status = "okay"; - sensor = <&name_temp_charger>; - }; - }; -}; diff --git a/zephyr/test/krabby/cbi_sensor.dts b/zephyr/test/krabby/cbi_sensor.dts deleted file mode 100644 index 46e6ccf9ca..0000000000 --- a/zephyr/test/krabby/cbi_sensor.dts +++ /dev/null @@ -1,123 +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 { - /* - * motion sense's <>_INT_EVENT is handled - * by alias. Using the alias, each driver creates - * its own <>_INT_EVENT. - */ - bmi3xx-int = &base_accel; - bma4xx-int = &lid_accel; - }; - named-i2c-ports { - compatible = "named-i2c-ports"; - - i2c_sensor: i2c-sensor { - i2c-port = <&i2c_ctrl0>; - enum-names = "I2C_PORT_SENSOR"; - }; - i2c_eeprom: i2c-eeprom { - i2c-port = <&i2c_ctrl0>; - enum-names = "I2C_PORT_EEPROM"; - }; - }; - gpio-interrupts { - int_base_imu: base_imu { - handler = "base_sensor_interrupt"; - }; - - int_lid_imu: lid_imu { - handler = "lid_sensor_interrupt"; - }; - }; - /* - * change all underlying sensor drivers to bmi260 to have a easier way - * to mock interrupt handlers. - */ - motionsense-sensor-data { - bmi323_data: bmi323-drv-data { - compatible = "cros-ec,drvdata-bmi260"; - status = "okay"; - }; - - bma422_data: bma422-drv-data { - compatible = "cros-ec,drvdata-bmi260"; - status = "okay"; - }; - }; - motionsense-sensor-alt { - alt_lid_accel: alt-lid-accel { - compatible = "cros-ec,bmi260-accel"; - status = "okay"; - - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_LID"; - port = <&i2c_sensor>; - drv-data = <&bma422_data>; - alternate-for = <&lid_accel>; - mutex = <&lid_mutex>; - }; - - alt_base_accel: alt-base-accel { - compatible = "cros-ec,bmi260-accel"; - status = "okay"; - - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_BASE"; - port = <&i2c_sensor>; - drv-data = <&bmi323_data>; - alternate-for = <&base_accel>; - mutex = <&base_mutex>; - }; - - alt_base_gyro: alt-base-gyro { - compatible = "cros-ec,bmi260-gyro"; - status = "okay"; - - active-mask = "SENSOR_ACTIVE_S0_S3"; - location = "MOTIONSENSE_LOC_BASE"; - port = <&i2c_sensor>; - drv-data = <&bmi323_data>; - alternate-for = <&base_gyro>; - mutex = <&base_mutex>; - }; - }; -}; - -&i2c_ctrl0 { - status="okay"; - - cbi_eeprom: eeprom@50 { - compatible = "atmel,at24"; - reg = <0x50>; - size = <2048>; - pagesize = <16>; - address-width = <8>; - timeout = <5>; - }; -}; - -&lid_accel { - compatible = "cros-ec,bmi260-accel"; -}; - -&base_accel { - compatible = "cros-ec,bmi260-accel"; -}; - -&base_gyro { - compatible = "cros-ec,bmi260-gyro"; -}; - -&icm42607_data { - compatible = "cros-ec,drvdata-bmi260"; -}; - -&lis2dw12_data { - compatible = "cros-ec,drvdata-bmi260"; -}; diff --git a/zephyr/test/krabby/common.dts b/zephyr/test/krabby/common.dts deleted file mode 100644 index 9e94392561..0000000000 --- a/zephyr/test/krabby/common.dts +++ /dev/null @@ -1,159 +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 - -/ { - pinctrl: pinctrl { - compatible = "ite,it8xxx2-pinctrl"; - status = "disabled"; - }; - - named-i2c-ports { - compatible = "named-i2c-ports"; - - i2c_charger: charger { - i2c-port = <&i2c_ctrl0>; - enum-names = "I2C_PORT_CHARGER", - "I2C_PORT_BATTERY"; - }; - }; - - usbc { - #address-cells = <1>; - #size-cells = <0>; - - port0@0 { - compatible = "named-usbc-port"; - status = "okay"; - 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 { - default_battery: lgc_ac17a8m { - 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 { - status="okay"; - - charger: rt9490@53 { - compatible = "zephyr,rt9490-emul"; - status = "okay"; - reg = <0x53>; - }; - - battery: sb@b { - compatible = "zephyr,smart-battery-emul"; - reg = <0xb>; - 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 = "LGC"; - dev-name = "AC17A8M"; - }; - - tcpci_emul: tcpci_emul@82 { - compatible = "cros,tcpci-generic-emul"; - 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 { - status="okay"; - - tusb1064_mux_1: tusb1064-mux-1@44 { - compatible = "zephyr,tusb1064-emul"; - reg = <0x44>; - board-init = "tusb1064_mux_1_board_init"; - }; -}; diff --git a/zephyr/test/krabby/common.dtsi b/zephyr/test/krabby/common.dtsi new file mode 100644 index 0000000000..9e94392561 --- /dev/null +++ b/zephyr/test/krabby/common.dtsi @@ -0,0 +1,159 @@ +/* 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 + +/ { + pinctrl: pinctrl { + compatible = "ite,it8xxx2-pinctrl"; + status = "disabled"; + }; + + named-i2c-ports { + compatible = "named-i2c-ports"; + + i2c_charger: charger { + i2c-port = <&i2c_ctrl0>; + enum-names = "I2C_PORT_CHARGER", + "I2C_PORT_BATTERY"; + }; + }; + + usbc { + #address-cells = <1>; + #size-cells = <0>; + + port0@0 { + compatible = "named-usbc-port"; + status = "okay"; + 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 { + default_battery: lgc_ac17a8m { + 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 { + status="okay"; + + charger: rt9490@53 { + compatible = "zephyr,rt9490-emul"; + status = "okay"; + reg = <0x53>; + }; + + battery: sb@b { + compatible = "zephyr,smart-battery-emul"; + reg = <0xb>; + 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 = "LGC"; + dev-name = "AC17A8M"; + }; + + tcpci_emul: tcpci_emul@82 { + compatible = "cros,tcpci-generic-emul"; + 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 { + status="okay"; + + tusb1064_mux_1: tusb1064-mux-1@44 { + compatible = "zephyr,tusb1064-emul"; + reg = <0x44>; + board-init = "tusb1064_mux_1_board_init"; + }; +}; diff --git a/zephyr/test/krabby/krabby.default.overlay b/zephyr/test/krabby/krabby.default.overlay new file mode 100644 index 0000000000..1e88870327 --- /dev/null +++ b/zephyr/test/krabby/krabby.default.overlay @@ -0,0 +1,13 @@ +/* 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.dtsi" +#include "../program/corsola/ite_gpio.dtsi" +#include "../program/corsola/ite_interrupts.dtsi" + +/* remove pinctrl to avoid pull in too many unwanted dependency */ +/delete-node/ &pinctrl; + +/delete-node/ &{/hibernate-wake-pins}; diff --git a/zephyr/test/krabby/krabby.tentacruel.overlay b/zephyr/test/krabby/krabby.tentacruel.overlay new file mode 100644 index 0000000000..553c19fb69 --- /dev/null +++ b/zephyr/test/krabby/krabby.tentacruel.overlay @@ -0,0 +1,178 @@ +/* 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.dtsi" +#include "../program/corsola/ite_gpio.dtsi" +#include "../program/corsola/ite_interrupts.dtsi" +#include "../program/corsola/ite_motionsense.dtsi" +#include "../program/corsola/tentacruel/cbi.dtsi" +#include "../program/corsola/tentacruel/thermistor.dtsi" + +/* remove pinctrl to avoid pull in too many unwanted dependency */ +/delete-node/ &pinctrl; + +/delete-node/ &{/hibernate-wake-pins}; + +/ { + name_temp_charger: charger { + compatible = "cros-ec,temp-sensor-thermistor"; + + thermistor = <&thermistor_rt9490>; + adc = <&adc_charger>; + }; + + named-temp-sensors { + compatible = "cros-ec,temp-sensors"; + temp_charger: charger { + status = "okay"; + sensor = <&name_temp_charger>; + }; + }; + + named-gpios { + /delete-node/ usb_c0_ppc_bc12_int_odl; + + usb_c0_ppc_int_odl: usb_c0_ppc_int_odl { + gpios = <&gpiod 1 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_PPC_INT_ODL"; + }; + + usb_c0_bc12_int_odl: usb_c0_bc12_int_odl { + gpios = <&gpiof 1 GPIO_INPUT>; + enum-name = "GPIO_USB_C0_BC12_INT_ODL"; + }; + + /delete-node/ usb_c0_ppc_frsinfo; + + usb_c0_frs_en: usb_c0_frs_en { + gpios = <&gpiof 0 GPIO_OUTPUT_LOW>; + enum-name = "GPIO_USB_C0_FRS_EN"; + }; + }; + + gpio-interrupts { + /delete-node/ usb_c0_ppc_bc12; + }; + + aliases { + /* + * motion sense's <>_INT_EVENT is handled + * by alias. Using the alias, each driver creates + * its own <>_INT_EVENT. + */ + bmi3xx-int = &base_accel; + bma4xx-int = &lid_accel; + }; + + named-i2c-ports { + compatible = "named-i2c-ports"; + + i2c_sensor: i2c-sensor { + i2c-port = <&i2c_ctrl0>; + enum-names = "I2C_PORT_SENSOR"; + }; + i2c_eeprom: i2c-eeprom { + i2c-port = <&i2c_ctrl0>; + enum-names = "I2C_PORT_EEPROM"; + }; + }; + + gpio-interrupts { + int_base_imu: base_imu { + handler = "base_sensor_interrupt"; + }; + + int_lid_imu: lid_imu { + handler = "lid_sensor_interrupt"; + }; + }; + + /* + * change all underlying sensor drivers to bmi260 to have a easier way + * to mock interrupt handlers. + */ + motionsense-sensor-data { + bmi323_data: bmi323-drv-data { + compatible = "cros-ec,drvdata-bmi260"; + status = "okay"; + }; + + bma422_data: bma422-drv-data { + compatible = "cros-ec,drvdata-bmi260"; + status = "okay"; + }; + }; + + motionsense-sensor-alt { + alt_lid_accel: alt-lid-accel { + compatible = "cros-ec,bmi260-accel"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_LID"; + port = <&i2c_sensor>; + drv-data = <&bma422_data>; + alternate-for = <&lid_accel>; + mutex = <&lid_mutex>; + }; + + alt_base_accel: alt-base-accel { + compatible = "cros-ec,bmi260-accel"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + port = <&i2c_sensor>; + drv-data = <&bmi323_data>; + alternate-for = <&base_accel>; + mutex = <&base_mutex>; + }; + + alt_base_gyro: alt-base-gyro { + compatible = "cros-ec,bmi260-gyro"; + status = "okay"; + + active-mask = "SENSOR_ACTIVE_S0_S3"; + location = "MOTIONSENSE_LOC_BASE"; + port = <&i2c_sensor>; + drv-data = <&bmi323_data>; + alternate-for = <&base_gyro>; + mutex = <&base_mutex>; + }; + }; +}; + +&i2c_ctrl0 { + status="okay"; + + cbi_eeprom: eeprom@50 { + compatible = "atmel,at24"; + reg = <0x50>; + size = <2048>; + pagesize = <16>; + address-width = <8>; + timeout = <5>; + }; +}; + +&lid_accel { + compatible = "cros-ec,bmi260-accel"; +}; + +&base_accel { + compatible = "cros-ec,bmi260-accel"; +}; + +&base_gyro { + compatible = "cros-ec,bmi260-gyro"; +}; + +&icm42607_data { + compatible = "cros-ec,drvdata-bmi260"; +}; + +&lis2dw12_data { + compatible = "cros-ec,drvdata-bmi260"; +}; diff --git a/zephyr/test/krabby/pinctrl.dts b/zephyr/test/krabby/pinctrl.dts deleted file mode 100644 index 7a5ed4feb0..0000000000 --- a/zephyr/test/krabby/pinctrl.dts +++ /dev/null @@ -1,40 +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. - */ - -/* remove pinctrl to avoid pull in too many unwanted dependency */ -/delete-node/ &pinctrl; - -/delete-node/ &{/hibernate-wake-pins}; - -/ { - named-gpios { - /delete-node/ usb_c0_ppc_bc12_int_odl; - - usb_c0_ppc_int_odl: usb_c0_ppc_int_odl { - gpios = <&gpiod 1 GPIO_INPUT>; - enum-name = "GPIO_USB_C0_PPC_INT_ODL"; - }; - - usb_c0_bc12_int_odl: usb_c0_bc12_int_odl { - gpios = <&gpiof 1 GPIO_INPUT>; - enum-name = "GPIO_USB_C0_BC12_INT_ODL"; - }; - - /delete-node/ usb_c0_ppc_frsinfo; - - usb_c0_frs_en: usb_c0_frs_en { - gpios = <&gpiof 0 GPIO_OUTPUT_LOW>; - enum-name = "GPIO_USB_C0_FRS_EN"; - }; - }; - - gpio-interrupts { - int_base_imu: base_imu { - handler = "motion_interrupt"; - }; - - /delete-node/ usb_c0_ppc_bc12; - }; -}; diff --git a/zephyr/test/krabby/testcase.yaml b/zephyr/test/krabby/testcase.yaml index 0994091c5a..3a8c0770e1 100644 --- a/zephyr/test/krabby/testcase.yaml +++ b/zephyr/test/krabby/testcase.yaml @@ -6,12 +6,12 @@ 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="krabby.default.overlay" 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/ite_interrupts.dtsi;../program/corsola/ite_gpio.dtsi;../program/corsola/tentacruel/thermistor.dtsi;pinctrl.dts;../program/corsola/ite_motionsense.dtsi;../program/corsola/tentacruel/cbi.dtsi;cbi_sensor.dts"" + extra_args: DTC_OVERLAY_FILE="krabby.tentacruel.overlay" extra_configs: - CONFIG_TEST_TENTACRUEL=y - CONFIG_PLATFORM_EC_CHARGER_PROFILE_OVERRIDE=y -- cgit v1.2.1