summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zephyr/emul/tcpc/emul_anx7447.c10
-rw-r--r--zephyr/emul/tcpc/emul_ps8xxx.c7
-rw-r--r--zephyr/emul/tcpc/emul_tcpci.c3
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_generic.c7
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_common.c3
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_drp.c3
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c3
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_snk.c3
-rw-r--r--zephyr/emul/tcpc/emul_tcpci_partner_src.c3
-rw-r--r--zephyr/program/corsola/src/kingler/usbc_config.c9
-rw-r--r--zephyr/shim/src/console.c30
-rw-r--r--zephyr/shim/src/gpio.c10
-rw-r--r--zephyr/shim/src/gpio_id.c5
-rw-r--r--zephyr/shim/src/gpio_int.c10
-rw-r--r--zephyr/shim/src/ioex.c8
-rw-r--r--zephyr/shim/src/ioex_drv.c49
16 files changed, 85 insertions, 78 deletions
diff --git a/zephyr/emul/tcpc/emul_anx7447.c b/zephyr/emul/tcpc/emul_anx7447.c
index 9514afdeed..9f92bf8ab1 100644
--- a/zephyr/emul/tcpc/emul_anx7447.c
+++ b/zephyr/emul/tcpc/emul_anx7447.c
@@ -3,11 +3,6 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT cros_anx7447_emul
-
-#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(anx7447_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
#include "emul/emul_common_i2c.h"
#include "emul/emul_stub_device.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -17,8 +12,13 @@ LOG_MODULE_REGISTER(anx7447_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#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_emul
+
+LOG_MODULE_REGISTER(anx7447_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
/**
* @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 d54d0b7c3e..af4dee4960 100644
--- a/zephyr/emul/tcpc/emul_ps8xxx.c
+++ b/zephyr/emul/tcpc/emul_ps8xxx.c
@@ -3,11 +3,7 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT cros_ps8xxx_emul
-
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(ps8xxx_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
-
#include "driver/tcpm/ps8xxx.h"
#include "emul/emul_common_i2c.h"
#include "emul/emul_stub_device.h"
@@ -21,8 +17,11 @@ LOG_MODULE_REGISTER(ps8xxx_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/drivers/i2c_emul.h>
#include <zephyr/ztest.h>
+#define DT_DRV_COMPAT cros_ps8xxx_emul
#define PS8XXX_REG_MUX_IN_HPD_ASSERTION MUX_IN_HPD_ASSERTION_REG
+LOG_MODULE_REGISTER(ps8xxx_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
/** Run-time data used by the emulator */
struct ps8xxx_emul_data {
/** Common I2C data used by "hidden" ports */
diff --git a/zephyr/emul/tcpc/emul_tcpci.c b/zephyr/emul/tcpc/emul_tcpci.c
index fa6caea4ca..f444584344 100644
--- a/zephyr/emul/tcpc/emul_tcpci.c
+++ b/zephyr/emul/tcpc/emul_tcpci.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "emul/emul_common_i2c.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -18,6 +17,8 @@ LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/sys/byteorder.h>
#include <zephyr/ztest.h>
+LOG_MODULE_REGISTER(tcpci_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
/**
* @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 795459a45c..fcb453de38 100644
--- a/zephyr/emul/tcpc/emul_tcpci_generic.c
+++ b/zephyr/emul/tcpc/emul_tcpci_generic.c
@@ -3,10 +3,7 @@
* found in the LICENSE file.
*/
-#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 "emul/emul_common_i2c.h"
#include "emul/emul_stub_device.h"
@@ -19,6 +16,10 @@ LOG_MODULE_REGISTER(tcpci_generic_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/drivers/i2c_emul.h>
#include <zephyr/ztest.h>
+#define DT_DRV_COMPAT cros_tcpci_generic_emul
+
+LOG_MODULE_REGISTER(tcpci_generic_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
+
/**
* @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 e9fd9ad9ef..40dbb4682a 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_common.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_common.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(tcpci_partner, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -18,6 +17,8 @@ LOG_MODULE_REGISTER(tcpci_partner, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/sys/byteorder.h>
#include <zephyr/ztest.h>
+LOG_MODULE_REGISTER(tcpci_partner, 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_drp.c b/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
index 82a7b045b3..80f9baf97b 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_drp.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(tcpci_drp_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -18,6 +17,8 @@ LOG_MODULE_REGISTER(tcpci_drp_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/kernel.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 c5de54f562..47580a0f33 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_faulty_ext.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(tcpci_faulty_ext, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -15,6 +14,8 @@ LOG_MODULE_REGISTER(tcpci_faulty_ext, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/kernel.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 d9ff23762a..c8719086f7 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_snk.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(tcpci_snk_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -15,6 +14,8 @@ LOG_MODULE_REGISTER(tcpci_snk_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/kernel.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 b823926dd3..142254ec35 100644
--- a/zephyr/emul/tcpc/emul_tcpci_partner_src.c
+++ b/zephyr/emul/tcpc/emul_tcpci_partner_src.c
@@ -4,7 +4,6 @@
*/
#include <zephyr/logging/log.h>
-LOG_MODULE_REGISTER(tcpci_src_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include "common.h"
#include "emul/tcpc/emul_tcpci.h"
@@ -15,6 +14,8 @@ LOG_MODULE_REGISTER(tcpci_src_emul, CONFIG_TCPCI_EMUL_LOG_LEVEL);
#include <zephyr/kernel.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/program/corsola/src/kingler/usbc_config.c b/zephyr/program/corsola/src/kingler/usbc_config.c
index 7531904c4a..5b243bae93 100644
--- a/zephyr/program/corsola/src/kingler/usbc_config.c
+++ b/zephyr/program/corsola/src/kingler/usbc_config.c
@@ -5,6 +5,11 @@
/* 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 "charger.h"
#include "console.h"
#include "driver/bc12/pi3usb9201_public.h"
@@ -25,10 +30,6 @@
#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)
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index 7bc8990789..6e78fc29c8 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -3,21 +3,6 @@
* 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 <stdbool.h>
-#include <string.h>
-
-#include <zephyr/kernel.h>
-#include <zephyr/logging/log.h>
-#include <zephyr/shell/shell_uart.h>
-#include <zephyr/sys/printk.h>
-#include <zephyr/sys/ring_buffer.h>
-
/*
* TODO(b/238433667): Include EC printf functions
* (crec_vsnprintf/crec_snprintf) until we switch to the standard
@@ -31,6 +16,21 @@
#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 \
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c
index 347640a7ab..a629c77a11 100644
--- a/zephyr/shim/src/gpio.c
+++ b/zephyr/shim/src/gpio.c
@@ -3,11 +3,6 @@
* 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
@@ -17,6 +12,11 @@
#include "ioexpander.h"
#include "system.h"
+#include <zephyr/device.h>
+#include <zephyr/init.h>
+#include <zephyr/kernel.h>
+#include <zephyr/logging/log.h>
+
LOG_MODULE_REGISTER(gpio_shim, LOG_LEVEL_ERR);
/*
diff --git a/zephyr/shim/src/gpio_id.c b/zephyr/shim/src/gpio_id.c
index 154924866d..e157e2d487 100644
--- a/zephyr/shim/src/gpio_id.c
+++ b/zephyr/shim/src/gpio_id.c
@@ -3,14 +3,15 @@
* 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 CONVERT_NUMERAL_SYSTEM_EVAL(system, bits, nbits) \
system##_from_bits(bits, nbits)
#define CONVERT_NUMERAL_SYSTEM(system, bits, nbits) \
diff --git a/zephyr/shim/src/gpio_int.c b/zephyr/shim/src/gpio_int.c
index c6339b497c..761e7e7b3c 100644
--- a/zephyr/shim/src/gpio_int.c
+++ b/zephyr/shim/src/gpio_int.c
@@ -3,11 +3,6 @@
* 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
@@ -16,6 +11,11 @@
#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>
+
LOG_MODULE_REGISTER(gpio_int, LOG_LEVEL_ERR);
/*
diff --git a/zephyr/shim/src/ioex.c b/zephyr/shim/src/ioex.c
index 2b8d3b2cc4..afda051c8a 100644
--- a/zephyr/shim/src/ioex.c
+++ b/zephyr/shim/src/ioex.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#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>
-#ifdef __REQUIRE_ZEPHYR_GPIOS__
-#undef __REQUIRE_ZEPHYR_GPIOS__
-#endif
-#include "ioexpander.h"
LOG_MODULE_REGISTER(ioex_shim, LOG_LEVEL_ERR);
diff --git a/zephyr/shim/src/ioex_drv.c b/zephyr/shim/src/ioex_drv.c
index 0f1db5eb31..98f67a4459 100644
--- a/zephyr/shim/src/ioex_drv.c
+++ b/zephyr/shim/src/ioex_drv.c
@@ -3,40 +3,15 @@
* found in the LICENSE file.
*/
-#define DT_DRV_COMPAT cros_ioex_port
-#define DT_DRV_COMPAT_CHIP cros_ioex_chip
-
-#include <errno.h>
-
-#include <zephyr/device.h>
-#include <zephyr/drivers/gpio.h>
-#include <zephyr/drivers/i2c.h>
#ifdef __REQUIRE_ZEPHYR_GPIOS__
#undef __REQUIRE_ZEPHYR_GPIOS__
#endif
#include "common.h"
#include "config.h"
-#include "gpio.h"
-#include "i2c.h"
-#include "ioexpander.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 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
@@ -46,6 +21,30 @@
#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);