summaryrefslogtreecommitdiff
path: root/zephyr/test/kingler
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/test/kingler')
-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
13 files changed, 50 insertions, 119 deletions
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