diff options
Diffstat (limited to 'zephyr/shim/include')
33 files changed, 82 insertions, 214 deletions
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> /** |