diff options
Diffstat (limited to 'zephyr/include')
20 files changed, 28 insertions, 224 deletions
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 */ |