diff options
author | YH Lin <yueherngl@chromium.org> | 2022-12-03 00:17:55 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-12-05 17:43:18 +0000 |
commit | dd732876495ed4942d00b9f9ca8dd3b01bad7120 (patch) | |
tree | bdff671e5ad3e71e30ab56f4f084f34a2fd72e28 /include | |
parent | 184d13e77614be3be5374d3fef9d1edf66ec8687 (diff) | |
download | chrome-ec-factory-brya-14909.124.B-main.tar.gz |
Revert "Merge remote-tracking branch cros/main into factory-brya-14909.124.B-main"factory-brya-14909.124.B-main
This reverts commit 184d13e77614be3be5374d3fef9d1edf66ec8687.
Reason for revert: broken build due to ec-utils.
Original change's description:
> Merge remote-tracking branch cros/main into factory-brya-14909.124.B-main
>
> Generated by: util/update_release_branch.py --baseboard brya --relevant_paths_file
> baseboard/brya/relevant-paths.txt factory-brya-14909.124.B-main
>
> Relevant changes:
>
> git log --oneline 19d4d68ffa..aa40b859b3 -- baseboard/brya board/agah
> board/anahera board/banshee board/brya board/crota board/felwinter
> board/gimble board/kano board/mithrax board/osiris board/primus
> board/redrix board/taeko board/taniks board/vell board/volmar
> driver/bc12/pi3usb9201_public.* driver/charger/bq25710.*
> driver/ppc/nx20p348x.* driver/ppc/syv682x_public.*
> driver/retimer/bb_retimer_public.* driver/tcpm/nct38xx.*
> driver/tcpm/ps8xxx_public.* driver/tcpm/tcpci.* include/power/alderlake*
> include/intel_x86.h power/alderlake* power/intel_x86.c
> util/getversion.sh
>
> e6da633c38 driver: Sort header files
> 234a87ae2d tcpci: Add FRS enable to driver structure
> a56be59ccd tcpm_header: add test for tcpm_dump_registers
> 57b3256963 Rename CONFIG_CHARGER_INPUT_CURRENT to _CHARGER_DEFAULT_CURRENT_LIMIT
> e420c8ff9a marasov: Modify TypeC and TypeA configuration.
> 43b53e0045 Add default implementation of board_set_charge_limit
> b75dc90677 Add CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT
> f1b563c350 baseboard: Sort header files
> 7d01b1e58d driver/retimer/ps8818.h: Add I2C ADDR FLAGS 0x30, 0x58, 0x70
> ec31407993 Add CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT
> 8f89f69a5b crota: disable lid angle sensor for clamshell
>
> BRANCH=None
> BUG=b:260630630 b:163093572 b:259002141 b:255184961 b:259354679
> BUG=b:247100970 b:254328661
> TEST=`emerge-brya chromeos-ec`
>
> Force-Relevant-Builds: all
> Change-Id: I0ecfa0e6af68631283c7a9e8f1afb9d827176c62
> Signed-off-by: YH Lin <yueherngl@google.com>
Bug: b:260630630 b:163093572 b:259002141 b:255184961 b:259354679
Bug: b:247100970 b:254328661
Change-Id: Ia14942d1bd6a502062399d77cb59d1f4b549b2c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4077247
Auto-Submit: YH Lin <yueherngl@chromium.org>
Tested-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Commit-Queue: YH Lin <yueherngl@chromium.org>
Diffstat (limited to 'include')
89 files changed, 136 insertions, 506 deletions
diff --git a/include/accelgyro.h b/include/accelgyro.h index b51a0ea148..74824b2611 100644 --- a/include/accelgyro.h +++ b/include/accelgyro.h @@ -6,8 +6,8 @@ #ifndef __CROS_EC_ACCELGYRO_H #define __CROS_EC_ACCELGYRO_H -#include "math_util.h" #include "motion_sense.h" +#include "math_util.h" /* Header file for accelerometer / gyro drivers. */ diff --git a/include/base32.h b/include/base32.h index d1acc6ab95..a1816afb60 100644 --- a/include/base32.h +++ b/include/base32.h @@ -8,8 +8,6 @@ #ifndef __CROS_EC_BASE32_H #define __CROS_EC_BASE32_H -#include <stdint.h> - /* Symbol map for base32 encoding */ extern const char base32_map[33]; diff --git a/include/battery.h b/include/battery.h index be93b44c21..51fcd68696 100644 --- a/include/battery.h +++ b/include/battery.h @@ -220,7 +220,7 @@ enum battery_present battery_is_present(void); * If battery support is not enabled and the board does not specifically * provide its own implementation, assume a battery is never present. */ -test_mockable_static_inline enum battery_present battery_is_present(void) +static inline enum battery_present battery_is_present(void) { return BP_NO; } diff --git a/include/battery_fuel_gauge.h b/include/battery_fuel_gauge.h index efcf18530c..0a2a4064bb 100644 --- a/include/battery_fuel_gauge.h +++ b/include/battery_fuel_gauge.h @@ -9,7 +9,6 @@ #define __CROS_EC_BATTERY_FUEL_GAUGE_H #include "battery.h" - #include <stdbool.h> /* Number of writes needed to invoke battery cutoff command */ diff --git a/include/benchmark.h b/include/benchmark.h deleted file mode 100644 index 190580ebb7..0000000000 --- a/include/benchmark.h +++ /dev/null @@ -1,157 +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. - * - * Benchmark utility functions. - */ - -#ifndef __CROS_EC_BENCHMARK_H -#define __CROS_EC_BENCHMARK_H - -#include <stdint.h> - -#include <array> -#include <functional> -#include <optional> -#include <string_view> - -extern "C" { -#include "clock.h" -#include "console.h" -#include "timer.h" -#include "util.h" -#include "watchdog.h" -} - -/* Benchmark execution options */ -struct BenchmarkOptions { - /* Number of test iterations */ - int num_iterations = 10; - /* Whether to reload the watchdog between executions of f() */ - bool reload_watchdog = true; - /* Whether to enable fast CPU clock during the test (when supported) */ - bool use_fast_cpu = true; -}; - -/* The result of a benchmark run with various timing metrics. - * All time measurements are in micro seconds, except the average that - * is captured in nanoseconds for increased resolution. - */ -struct BenchmarkResult { - /* Name of the test, used when printing results */ - std::string_view name; - /* Total elapsed time (us) for all iterations */ - uint32_t elapsed_time; - /* Average elapsed time (ns) for a single iteration */ - uint32_t average_time; - /* Minimum elapsed time (us) for a single iteration */ - uint32_t min_time; - /* Maximum elapsed time (us) for a single iteration */ - uint32_t max_time; -}; - -/* Benchmark main class responsible for running the experiments and - * collecting/printing the results. - * Note that the implementation intentionally avoid dynamic memory allocations - * and stores up to MAX_NUM_RESULTS results into a std::array. - */ -template <int MAX_NUM_RESULTS = 5> class Benchmark { - public: - explicit Benchmark(const BenchmarkOptions &options = BenchmarkOptions()) - : options_(options){}; - - /* Run benchmark of the function f(). - * - * TODO(b/253099367): replace std::optional with StatusOr - */ - std::optional<BenchmarkResult> - run(const std::string_view benchmark_name, std::function<void()> f) - { - if (benchmark_name.empty()) { - ccprintf("%s: benchmark_name cannot be empty\n", - __func__); - return {}; - } - if (num_results_ >= MAX_NUM_RESULTS) { - ccprintf("%s: cannot store new BenchmarkResults\n", - __func__); - return {}; - } - - BenchmarkResult &result = results_[num_results_++]; - result.name = benchmark_name; - result.elapsed_time = 0; - - if (options_.use_fast_cpu) - clock_enable_module(MODULE_FAST_CPU, 1); - - bool valid_min_max = false; - for (int i = 0; i < options_.num_iterations; ++i) { - timestamp_t start_time = get_time(); - f(); - uint32_t iteration_time = time_since32(start_time); - - if (options_.reload_watchdog) - watchdog_reload(); - - if (valid_min_max) { - result.max_time = - MAX(result.max_time, iteration_time); - result.min_time = - MIN(result.min_time, iteration_time); - } else { - result.max_time = iteration_time; - result.min_time = iteration_time; - valid_min_max = true; - } - result.elapsed_time += iteration_time; - } - - if (options_.use_fast_cpu) - clock_enable_module(MODULE_FAST_CPU, 0); - - result.average_time = - (result.elapsed_time) / options_.num_iterations; - - return result; - } - - void print_results() const - { - print_header(); - for (int i = 0; i < num_results_; ++i) - print_result(results_[i]); - } - - private: - const BenchmarkOptions options_; - std::array<BenchmarkResult, MAX_NUM_RESULTS> results_; - int num_results_ = 0; - - /* Print table header with column names */ - void print_header() const - { - constexpr char kSeparator[] = "--------------------------"; - - ccprintf("%16s | %15s | %13s | %13s | %13s | %13s\n", - "Test Name", "Num Iterations", "Elapsed (us)", - "Min (us)", "Max (us)", "Avg (us)"); - ccprintf("%.*s | %.*s | %.*s | %.*s | %.*s | %.*s\n", 16, - kSeparator, 15, kSeparator, 13, kSeparator, 13, - kSeparator, 13, kSeparator, 13, kSeparator); - cflush(); - } - - /* Print a single benchmark result */ - int print_result(const BenchmarkResult &result) const - { - ccprintf("%16s | %15u | %13u | %13u | %13u | %13u\n", - result.name.data(), options_.num_iterations, - result.elapsed_time, result.min_time, result.max_time, - result.average_time); - cflush(); - return EC_SUCCESS; - } -}; - -#endif /* __CROS_EC_BENCHMARK_H */ diff --git a/include/bluetooth_le_ll.h b/include/bluetooth_le_ll.h index ec2bb7f7e7..d17aec8a57 100644 --- a/include/bluetooth_le_ll.h +++ b/include/bluetooth_le_ll.h @@ -3,8 +3,8 @@ * found in the LICENSE file. */ -#include "btle_hci_int.h" #include "common.h" +#include "btle_hci_int.h" enum ll_state_t { UNINITIALIZED, diff --git a/include/body_detection.h b/include/body_detection.h index 7ab7ab3e6d..8fea5d84e1 100644 --- a/include/body_detection.h +++ b/include/body_detection.h @@ -6,8 +6,8 @@ #ifndef __CROS_EC_BODY_DETECTION_H #define __CROS_EC_BODY_DETECTION_H -#include <stdbool.h> #include <stdint.h> +#include <stdbool.h> enum body_detect_states { BODY_DETECTION_OFF_BODY, BODY_DETECTION_ON_BODY }; diff --git a/include/button.h b/include/button.h index b38191aaf5..f0c71d7f3f 100644 --- a/include/button.h +++ b/include/button.h @@ -10,8 +10,8 @@ #include "common.h" #include "compile_time_macros.h" -#include "ec_commands.h" #include "gpio_signal.h" +#include "ec_commands.h" #define BUTTON_FLAG_ACTIVE_HIGH BIT(0) #define BUTTON_FLAG_DISABLED BIT(1) /* Button disabled */ diff --git a/include/charge_manager.h b/include/charge_manager.h index 2d4155f09d..459673a630 100644 --- a/include/charge_manager.h +++ b/include/charge_manager.h @@ -300,19 +300,14 @@ int board_set_active_charge_port(int charge_port); /** * Set the charge current limit. * - * The default implementation of this function derates charge_ma by - * CONFIG_CHARGER_INPUT_CURRENT_PCT (if configured), and clamps charge_ma to - * a lower bound of CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT (if configured). - * * @param port PD port. * @param supplier Identified CHARGE_SUPPLIER_*. * @param charge_ma Desired charge current limit, <= max_ma. * @param max_ma Maximum charge current limit, >= charge_ma. * @param charge_mv Negotiated charge voltage (mV). */ -__override_proto void board_set_charge_limit(int port, int supplier, - int charge_ma, int max_ma, - int charge_mv); +void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, + int charge_mv); /** * Get whether the port is sourcing power on VBUS. diff --git a/include/charge_state.h b/include/charge_state.h index dcf3430954..221947b9d1 100644 --- a/include/charge_state.h +++ b/include/charge_state.h @@ -6,8 +6,8 @@ #define __CROS_EC_CHARGE_STATE_H #include "common.h" -#include "stdbool.h" #include "timer.h" +#include "stdbool.h" /* Stuff that's common to all charger implementations can go here. */ @@ -158,19 +158,18 @@ static inline int battery_is_below_threshold(enum batt_threshold_type type, #endif /** - * @brief whether or not the charge state will prevent power-on + * Return non-zero if the battery level is too low to allow power on, even if + * a charger is attached. * * @param power_button_pressed True if the power-up attempt is caused by a * power button press. - * @return True if the battery level is too low to allow power on, even if a - * charger is attached. */ #ifdef CONFIG_BATTERY -bool charge_prevent_power_on(bool power_button_pressed); +int charge_prevent_power_on(int power_button_pressed); #else -static inline bool charge_prevent_power_on(bool power_button_pressed) +static inline int charge_prevent_power_on(int power_button_pressed) { - return false; + return 0; } #endif diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h index 6d0b936f4a..0817204774 100644 --- a/include/charge_state_v2.h +++ b/include/charge_state_v2.h @@ -3,6 +3,8 @@ * found in the LICENSE file. */ +#include <stdbool.h> + #include "battery.h" #include "battery_smart.h" #include "charger.h" @@ -11,8 +13,6 @@ #include "ocpc.h" #include "timer.h" -#include <stdbool.h> - #ifndef __CROS_EC_CHARGE_STATE_V2_H #define __CROS_EC_CHARGE_STATE_V2_H @@ -71,10 +71,6 @@ int charge_set_output_current_limit(int chgnum, int ma, int mv); * Set the charge input current limit. This value is stored and sent every * time AC is applied. * - * The input current limit is automatically derated by - * CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT (if configured), and is clamped to - * no less than CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT mA (if configured). - * * @param ma New input current limit in mA * @param mv Negotiated charge voltage in mV. * @return EC_SUCCESS or error diff --git a/include/charger.h b/include/charger.h index df3f3f65dd..e4c10ec7a9 100644 --- a/include/charger.h +++ b/include/charger.h @@ -393,7 +393,7 @@ enum ec_error_list charger_enable_linear_charge(int chgnum, bool enable); * @param enable: Whether to enable or disable bypass mode. * @return EC_SUCCESS on success, error otherwise. */ -enum ec_error_list charger_enable_bypass_mode(int chgnum, bool enable); +enum ec_error_list charger_enable_bypass_mode(int chgnum, int enable); /** * Get the charger configuration for the number of battery cells diff --git a/include/chipset.h b/include/chipset.h index ead2a9680e..fd7455f9f7 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -299,20 +299,4 @@ static inline enum chipset_shutdown_reason chipset_get_shutdown_reason(void) #endif /* !CONFIG_CMD_AP_RESET_LOG */ -#ifdef TEST_BUILD -/** - * @brief Gets the number of AP resets since the EC booted. Takes the reset log - * mutex for thread safety. - * - * @return uint32_t AP reset count - */ -uint32_t test_chipset_get_ap_resets_since_ec_boot(void); - -/** - * @brief Corrupts the stored reset log checksum, which forces init_reset_log() - * to wipe the log and fully reset. - */ -void test_chipset_corrupt_reset_log_checksum(void); -#endif /* TEST_BUILD */ - #endif /* __CROS_EC_CHIPSET_H */ diff --git a/include/common.h b/include/common.h index 02f7449d81..6f76157b6c 100644 --- a/include/common.h +++ b/include/common.h @@ -8,14 +8,13 @@ #ifndef __CROS_EC_COMMON_H #define __CROS_EC_COMMON_H -#include "compile_time_macros.h" - -#include <inttypes.h> #include <stdint.h> +#include <inttypes.h> + +#include "compile_time_macros.h" #ifdef CONFIG_ZEPHYR #include "fpu.h" - #include <zephyr/sys/util.h> #include <zephyr/toolchain.h> #ifdef CONFIG_ZTEST diff --git a/include/config.h b/include/config.h index 8d78921cde..f0b528bead 100644 --- a/include/config.h +++ b/include/config.h @@ -221,12 +221,6 @@ /* The threshold duration to change to off_body */ #undef CONFIG_BODY_DETECTION_STATIONARY_DURATION -/* Send the SCI event to notify host when body status change */ -#undef CONFIG_BODY_DETECTION_NOTIFY_MODE_CHANGE - -/* Always enable the body detection function in S0 */ -#undef CONFIG_BODY_DETECTION_ALWAYS_ENABLE_IN_S0 - /* * Use the old standard reference frame for accelerometers. The old * reference frame is: @@ -1041,38 +1035,7 @@ * this should be set to 512 mA in order to not brown-out low-current USB * charge ports in accordance with USB-PD r3.0 Sec. 7.3 */ -#undef CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT - -/* - * Minimum current limit that will ever be set for chargers, even if a lower - * limit is requested. This will allow the charger to draw more power than - * the requested limit. - * - * If set, this should usually be set to no more than 2.5W divided by the - * maximum supported input voltage in order to satisfy USB-PD pSnkStdby - * requirements. Higher values may help devices stay alive under low-battery - * conditions at the cost of violating standby power limits. - * - * Many boards set this to large values, since historically this number was - * usually equal to CONFIG_CHARGER_DEFAULT_CURRENT_LIMIT. New boards should - * avoid doing so if possible. - */ -#undef CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMIT - -/* - * Percentage derating factor applied to charger input current limits. - * - * Desired charger current is reduced by this many percent when programming - * chargers via the charge manager, which is usually used to account for - * chargers that draw slightly more current than the programmed limit or to - * provide some margin for accuracy. For example, if this value is set to 4 - * and input current is limited to 1000 mA, the charger will be given a limit - * of 960 mA. - * - * Boards requiring more complex control over input current should leave this - * undefined and override board_set_charge_limit instead. - */ -#undef CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCT +#undef CONFIG_CHARGER_INPUT_CURRENT /* * This config option is used to enable IDCHG trigger for prochot. This macro @@ -1370,9 +1333,6 @@ */ #undef CONFIG_OCPC_DEF_RBATT_MOHMS -/* Set a default OCPC drive limit for legacy boards */ -#define CONFIG_OCPC_DEF_DRIVELIMIT_MILLIVOLTS 10 - /* Enable trickle charging */ #undef CONFIG_TRICKLE_CHARGING @@ -4038,6 +3998,9 @@ /* Default stack size to use for tasks, in bytes */ #undef CONFIG_STACK_SIZE +/* Use 32-bit timer for clock source on stm32. */ +#undef CONFIG_STM_HWTIMER32 + /* Compile charger detect for STM32 */ #undef CONFIG_STM32_CHARGER_DETECT @@ -4511,12 +4474,10 @@ * TYPEC_SM - Type-C deals with CC lines voltage level connections * PRL_SM - Protocol handles flow and chunking TX and RX messages * PE - Policy Engine handles PD communication flow - * DPM - Device Policy Manager layer is used to determine port policy */ #define CONFIG_USB_TYPEC_SM #define CONFIG_USB_PRL_SM #define CONFIG_USB_PE_SM -#define CONFIG_USB_DPM_SM /* Enables PD Console commands */ #define CONFIG_USB_PD_CONSOLE_CMD @@ -6966,9 +6927,4 @@ #define HAS_GPU_DRIVER #endif -/* Default to 1024 for end of ram data (panic and jump data) */ -#ifndef CONFIG_PRESERVED_END_OF_RAM_SIZE -#define CONFIG_PRESERVED_END_OF_RAM_SIZE 1024 -#endif - #endif /* __CROS_EC_CONFIG_H */ diff --git a/include/console.h b/include/console.h index 03abbe5732..ddfba89926 100644 --- a/include/console.h +++ b/include/console.h @@ -10,7 +10,6 @@ #include "common.h" #include "config.h" - #include <stdbool.h> #ifdef CONFIG_ZEPHYR diff --git a/include/crc8.h b/include/crc8.h index ca1a98eb43..c20314311e 100644 --- a/include/crc8.h +++ b/include/crc8.h @@ -7,8 +7,6 @@ #ifndef __CROS_EC_CRC8_H #define __CROS_EC_CRC8_H -#include <stdint.h> - /** * crc8 * Return CRC-8 of the data, using x^8 + x^2 + x + 1 polynomial. A table-based diff --git a/include/dps.h b/include/dps.h index c4d2c884b1..8794220ab2 100644 --- a/include/dps.h +++ b/include/dps.h @@ -6,10 +6,10 @@ #ifndef __CROS_EC_DPS__H #define __CROS_EC_DPS__H -#include "common.h" - #include <stdbool.h> +#include "common.h" + #define DPS_FLAG_DISABLED BIT(0) #define DPS_FLAG_NO_SRCCAP BIT(1) #define DPS_FLAG_WAITING BIT(2) diff --git a/include/driver/accel_lis2dw12_public.h b/include/driver/accel_lis2dw12_public.h index 163bc8ae21..5596e6ba6a 100644 --- a/include/driver/accel_lis2dw12_public.h +++ b/include/driver/accel_lis2dw12_public.h @@ -8,7 +8,6 @@ #ifndef __CROS_EC_DRIVER_ACCEL_LIS2DW12_PUBLIC_H #define __CROS_EC_DRIVER_ACCEL_LIS2DW12_PUBLIC_H -#include "config.h" #include "gpio_signal.h" extern const struct accelgyro_drv lis2dw12_drv; diff --git a/include/driver/accelgyro_bmi260.h b/include/driver/accelgyro_bmi260.h index baf78e9e00..5d55a85acc 100644 --- a/include/driver/accelgyro_bmi260.h +++ b/include/driver/accelgyro_bmi260.h @@ -10,8 +10,8 @@ #include "accelgyro.h" #include "common.h" -#include "driver/accelgyro_bmi260_public.h" #include "mag_bmm150.h" +#include "driver/accelgyro_bmi260_public.h" #define BMI260_CHIP_ID 0x00 /* BMI260 chip identifier */ diff --git a/include/driver/accelgyro_bmi_common.h b/include/driver/accelgyro_bmi_common.h index 01a9ecffd6..371d3d97ce 100644 --- a/include/driver/accelgyro_bmi_common.h +++ b/include/driver/accelgyro_bmi_common.h @@ -10,8 +10,8 @@ #include "accelgyro.h" #include "accelgyro_bmi160.h" #include "accelgyro_bmi260.h" -#include "accelgyro_bmi_common_public.h" #include "mag_bmm150.h" +#include "accelgyro_bmi_common_public.h" #if !defined(CONFIG_ACCELGYRO_BMI_COMM_SPI) && \ !defined(CONFIG_ACCELGYRO_BMI_COMM_I2C) diff --git a/include/driver/retimer/anx7483_public.h b/include/driver/retimer/anx7483_public.h index 4f44c4d180..83ad32508e 100644 --- a/include/driver/retimer/anx7483_public.h +++ b/include/driver/retimer/anx7483_public.h @@ -38,14 +38,6 @@ enum anx7483_eq_setting { ANX7483_EQ_SETTING_12_5DB = 15, }; -/* Flat gain tuning */ -enum anx7483_fg_setting { - ANX7483_FG_SETTING_NEG_1_5DB = 0, - ANX7483_FG_SETTING_0_5DB = 1, - ANX7483_FG_SETTING_0_3DB = 2, - ANX7483_FG_SETTING_1_2DB = 3, -}; - enum anx7483_tune_pin { ANX7483_PIN_UTX1, ANX7483_PIN_UTX2, @@ -60,11 +52,6 @@ enum ec_error_list anx7483_set_eq(const struct usb_mux *me, enum anx7483_tune_pin pin, enum anx7483_eq_setting eq); -/* Adjust the flat gain for a pin */ -enum ec_error_list anx7483_set_fg(const struct usb_mux *me, - enum anx7483_tune_pin pin, - enum anx7483_fg_setting fg); - /* * Configure datasheet defaults for tuning registers at this mux setting. * Return int so function can be used directly for board_set. diff --git a/include/driver/retimer/bb_retimer.h b/include/driver/retimer/bb_retimer.h index b47743f882..460156803e 100644 --- a/include/driver/retimer/bb_retimer.h +++ b/include/driver/retimer/bb_retimer.h @@ -8,8 +8,8 @@ #ifndef __CROS_EC_BB_RETIMER_H #define __CROS_EC_BB_RETIMER_H -#include "driver/retimer/bb_retimer_public.h" #include "usb_mux.h" +#include "driver/retimer/bb_retimer_public.h" /* Burnside Bridge I2C Configuration Space */ #define BB_RETIMER_REG_VENDOR_ID 0 diff --git a/include/driver/retimer/ps8818_public.h b/include/driver/retimer/ps8818_public.h index bdecb7a0d4..3f0aba963b 100644 --- a/include/driver/retimer/ps8818_public.h +++ b/include/driver/retimer/ps8818_public.h @@ -9,10 +9,7 @@ #ifndef __CROS_EC_USB_RETIMER_PS8818_H #define __CROS_EC_USB_RETIMER_PS8818_H -#define PS8818_I2C_ADDR0_FLAGS 0x28 -#define PS8818_I2C_ADDR1_FLAGS 0x30 -#define PS8818_I2C_ADDR2_FLAGS 0x58 -#define PS8818_I2C_ADDR3_FLAGS 0x70 +#define PS8818_I2C_ADDR_FLAGS 0x28 /* * PAGE 0 Register Definitions diff --git a/include/driver/temp_sensor/pct2075.h b/include/driver/temp_sensor/pct2075.h index 2d374bb2ba..e79ac0e97a 100644 --- a/include/driver/temp_sensor/pct2075.h +++ b/include/driver/temp_sensor/pct2075.h @@ -21,7 +21,6 @@ #define PCT2075_REG_CONF 0x01 #define PCT2075_REG_THYST 0x02 #define PCT2075_REG_TOS 0x03 -#define PCT2075_REG_TIDLE 0x04 /* * I2C port and address information for all the board PCT2075 sensors should be @@ -68,8 +67,4 @@ int pct2075_get_val_mk(int idx, int *temp_mk_ptr); */ void pct2075_init(void); -#ifdef CONFIG_ZEPHYR -void pct2075_update_temperature(int idx); -#endif /* CONFIG_ZEPHYR */ - #endif /* __CROS_EC_PCT2075_H */ diff --git a/include/driver/temp_sensor/thermistor.h b/include/driver/temp_sensor/thermistor.h index 3e220b2505..46b7763747 100644 --- a/include/driver/temp_sensor/thermistor.h +++ b/include/driver/temp_sensor/thermistor.h @@ -8,8 +8,6 @@ #ifndef __CROS_EC_TEMP_SENSOR_THERMISTOR_H #define __CROS_EC_TEMP_SENSOR_THERMISTOR_H -#include <stdint.h> - struct thermistor_data_pair { uint8_t mv; /* Scaled voltage level at ADC (in mV) */ uint8_t temp; /* Temperature in Celsius */ diff --git a/include/driver/temp_sensor/tmp112.h b/include/driver/temp_sensor/tmp112.h index 3c9a0a004b..56d55d9133 100644 --- a/include/driver/temp_sensor/tmp112.h +++ b/include/driver/temp_sensor/tmp112.h @@ -63,8 +63,4 @@ int tmp112_get_val_mk(int idx, int *temp_mk_ptr); */ void tmp112_init(void); -#ifdef CONFIG_ZEPHYR -void tmp112_update_temperature(int idx); -#endif /* CONFIG_ZEPHYR */ - #endif /* __CROS_EC_TMP112_H */ diff --git a/include/ec_commands.h b/include/ec_commands.h index 6c30528d44..892787e4dc 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -416,7 +416,6 @@ extern "C" { /* * Report device orientation * Bits Definition - * 4 Off Body/On Body status: 0 = Off Body. * 3:1 Device DPTF Profile Number (DDPN) * 0 = Reserved for backward compatibility (indicates no valid * profile number. Host should fall back to using TBMD). @@ -429,8 +428,6 @@ extern "C" { #define EC_ACPI_MEM_TBMD_MASK 0x1 #define EC_ACPI_MEM_DDPN_SHIFT 1 #define EC_ACPI_MEM_DDPN_MASK 0x7 -#define EC_ACPI_MEM_STTB_SHIFT 4 -#define EC_ACPI_MEM_STTB_MASK 0x1 /* * Report device features. Uses the same format as the host command, except: @@ -755,7 +752,6 @@ enum host_event_code { * * - TABLET/LAPTOP mode * - detachable base attach/detach event - * - on body/off body transition event */ EC_HOST_EVENT_MODE_CHANGE = 29, @@ -1735,9 +1731,6 @@ struct ec_params_flash_read { * struct ec_params_flash_write - Parameters for the flash write command. * @offset: Byte offset to write. * @size: Size to write in bytes. - * @data: Data to write. - * @data.words32: uint32_t data to write. - * @data.bytes: uint8_t data to write. */ struct ec_params_flash_write { uint32_t offset; @@ -2840,8 +2833,8 @@ struct ec_motion_sense_activity { uint8_t activity; /* one of enum motionsensor_activity */ uint8_t enable; /* 1: enable, 0: disable */ uint8_t reserved; - uint16_t parameters[4]; /* activity dependent parameters */ -} __ec_todo_packed; + uint16_t parameters[3]; /* activity dependent parameters */ +} __ec_todo_unpacked; /* Module flag masks used for the dump sub-command. */ #define MOTIONSENSE_MODULE_FLAG_ACTIVE BIT(0) @@ -3310,22 +3303,6 @@ struct ec_params_usb_charge_set_mode { } __ec_align1; /*****************************************************************************/ -/* Tablet mode commands */ - -/* Set tablet mode */ -#define EC_CMD_SET_TABLET_MODE 0x0031 - -enum tablet_mode_override { - TABLET_MODE_DEFAULT, - TABLET_MODE_FORCE_TABLET, - TABLET_MODE_FORCE_CLAMSHELL, -}; - -struct ec_params_set_tablet_mode { - uint8_t tablet_mode; /* enum tablet_mode_override */ -} __ec_align1; - -/*****************************************************************************/ /* Persistent storage for host */ /* Maximum bytes that can be read/written in a single command */ @@ -6739,7 +6716,6 @@ struct ec_response_regulator_get_voltage { enum typec_partner_type { TYPEC_PARTNER_SOP = 0, TYPEC_PARTNER_SOP_PRIME = 1, - TYPEC_PARTNER_SOP_PRIME_PRIME = 2, }; struct ec_params_typec_discovery { @@ -6771,7 +6747,6 @@ enum typec_control_command { TYPEC_CONTROL_COMMAND_TBT_UFP_REPLY, TYPEC_CONTROL_COMMAND_USB_MUX_SET, TYPEC_CONTROL_COMMAND_BIST_SHARE_MODE, - TYPEC_CONTROL_COMMAND_SEND_VDM_REQ, }; /* Modes (USB or alternate) that a type-C port may enter. */ @@ -6797,17 +6772,6 @@ struct typec_usb_mux_set { uint8_t mux_flags; } __ec_align1; -#define VDO_MAX_SIZE 7 - -struct typec_vdm_req { - /* VDM data, including VDM header */ - uint32_t vdm_data[VDO_MAX_SIZE]; - /* Number of 32-bit fields filled in */ - uint8_t vdm_data_objects; - /* Partner to address - see enum typec_partner_type */ - uint8_t partner_type; -} __ec_align1; - struct ec_params_typec_control { uint8_t port; uint8_t command; /* enum typec_control_command */ @@ -6829,8 +6793,6 @@ struct ec_params_typec_control { struct typec_usb_mux_set mux_params; /* Used for BIST_SHARE_MODE */ uint8_t bist_share_mode; - /* Used for VMD_REQ */ - struct typec_vdm_req vdm_req_params; uint8_t placeholder[128]; }; } __ec_align1; diff --git a/include/ec_ec_comm_client.h b/include/ec_ec_comm_client.h index 57c599a365..9b506dd402 100644 --- a/include/ec_ec_comm_client.h +++ b/include/ec_ec_comm_client.h @@ -8,9 +8,8 @@ #ifndef EC_EC_COMM_CLIENT_H_ #define EC_EC_COMM_CLIENT_H_ -#include "config.h" - #include <stdint.h> +#include "config.h" /** * Sends EC_CMD_BATTERY_GET_DYNAMIC command to server, and writes the diff --git a/include/ec_ec_comm_server.h b/include/ec_ec_comm_server.h index 9728e021a8..0eb094fea3 100644 --- a/include/ec_ec_comm_server.h +++ b/include/ec_ec_comm_server.h @@ -8,11 +8,10 @@ #ifndef EC_EC_COMM_SERVER_H_ #define EC_EC_COMM_SERVER_H_ +#include <stdint.h> #include "consumer.h" #include "queue.h" -#include <stdint.h> - extern struct queue const ec_ec_comm_server_input; extern struct queue const ec_ec_comm_server_output; diff --git a/include/event_log.h b/include/event_log.h index 5438a34414..bd3b88510b 100644 --- a/include/event_log.h +++ b/include/event_log.h @@ -6,8 +6,6 @@ #ifndef __CROS_EC_EVENT_LOG_H #define __CROS_EC_EVENT_LOG_H -#include <stdint.h> - struct event_log_entry { uint32_t timestamp; /* relative timestamp in milliseconds */ uint8_t type; /* event type, caller-defined */ diff --git a/include/fan.h b/include/fan.h index 7c64f4e31b..31af7a58ff 100644 --- a/include/fan.h +++ b/include/fan.h @@ -8,10 +8,6 @@ #ifndef __CROS_EC_FAN_H #define __CROS_EC_FAN_H -#include "config.h" - -#include <stdint.h> - #ifdef CONFIG_ZEPHYR #ifdef CONFIG_PLATFORM_EC_FAN @@ -44,7 +40,6 @@ struct fan_rpm { int rpm_min; int rpm_start; int rpm_max; - uint8_t rpm_deviation; }; /* Characteristic of each physical fan */ diff --git a/include/flash_log.h b/include/flash_log.h index 36e3be6738..7141a8b67a 100644 --- a/include/flash_log.h +++ b/include/flash_log.h @@ -6,9 +6,9 @@ #ifndef __CROS_EC_EVENT_LOG_H #define __CROS_EC_EVENT_LOG_H +#include "config.h" #include "common.h" #include "compile_time_macros.h" -#include "config.h" #include "stddef.h" enum flash_event_type { diff --git a/include/fpsensor.h b/include/fpsensor.h index a59eea1b89..3963df86a7 100644 --- a/include/fpsensor.h +++ b/include/fpsensor.h @@ -8,11 +8,10 @@ #ifndef __CROS_EC_FPSENSOR_H #define __CROS_EC_FPSENSOR_H +#include <stdint.h> #include "common.h" #include "ec_commands.h" -#include <stdint.h> - #ifndef SPI_FP_DEVICE #define SPI_FP_DEVICE (&spi_devices[0]) #endif diff --git a/include/fpsensor_crypto.h b/include/fpsensor_crypto.h index f000b841e4..7dff9238fa 100644 --- a/include/fpsensor_crypto.h +++ b/include/fpsensor_crypto.h @@ -8,10 +8,10 @@ #ifndef __CROS_EC_FPSENSOR_CRYPTO_H #define __CROS_EC_FPSENSOR_CRYPTO_H -#include "sha256.h" - #include <stddef.h> +#include "sha256.h" + #define HKDF_MAX_INFO_SIZE 128 #define HKDF_SHA256_MAX_BLOCK_COUNT 255 diff --git a/include/fpsensor_state.h b/include/fpsensor_state.h index d8f112afcd..ce454233fa 100644 --- a/include/fpsensor_state.h +++ b/include/fpsensor_state.h @@ -8,15 +8,16 @@ #ifndef __CROS_EC_FPSENSOR_STATE_H #define __CROS_EC_FPSENSOR_STATE_H +#include <stdbool.h> +#include <stdint.h> + #include "atomic.h" #include "common.h" -#include "driver/fingerprint/fpsensor.h" #include "ec_commands.h" #include "link_defs.h" #include "timer.h" -#include <stdbool.h> -#include <stdint.h> +#include "driver/fingerprint/fpsensor.h" /* if no special memory regions are defined, fallback on regular SRAM */ #ifndef FP_FRAME_SECTION diff --git a/include/gpio.h b/include/gpio.h index 086ed9131f..54464d1bfb 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -21,10 +21,6 @@ */ #ifdef CONFIG_ZEPHYR #include <zephyr/drivers/gpio.h> -#include <zephyr/dt-bindings/gpio/ite-it8xxx2-gpio.h> -#include <zephyr/dt-bindings/gpio/nuvoton-npcx-gpio.h> - -#include <dt-bindings/native-posix-gpio.h> /* * Some flag definitions are duplicated by our private devicetree binding @@ -83,16 +79,7 @@ /* GPIO_INT_DSLEEP not supported by Zephyr */ /* GPIO_INT_SHARED not supported by Zephyr */ -#if DT_HAS_COMPAT_STATUS_OKAY(nuvoton_npcx_gpio) -#define GPIO_VOLTAGE_1P8 NPCX_GPIO_VOLTAGE_1P8 -#define GPIO_SEL_1P8V GPIO_VOLTAGE_1P8 -#elif DT_HAS_COMPAT_STATUS_OKAY(ite_it8xxx2_gpio) -#define GPIO_VOLTAGE_1P8 IT8XXX2_GPIO_VOLTAGE_1P8 #define GPIO_SEL_1P8V GPIO_VOLTAGE_1P8 -#elif DT_HAS_COMPAT_STATUS_OKAY(zephyr_gpio_emul) -#define GPIO_VOLTAGE_1P8 NATIVE_POSIX_GPIO_VOLTAGE_1P8 -#define GPIO_SEL_1P8V GPIO_VOLTAGE_1P8 -#endif /* GPIO_ALTERNATE not supported by Zephyr */ /* GPIO_LOCKED not supported by Zephyr */ /* GPIO_HIB_WAKE_HIGH not supported by Zephyr */ diff --git a/include/gpio_list.h b/include/gpio_list.h index e5a90b4e89..17fc0d3b09 100644 --- a/include/gpio_list.h +++ b/include/gpio_list.h @@ -67,9 +67,9 @@ const int gpio_ih_count = ARRAY_SIZE(gpio_irq_handlers); #define PIN(a, b...) \ static const int _pin_##a##_##b \ __attribute__((unused, section(".unused"))) = __LINE__; -#include "ioexpander.h" - #include "gpio.wrap" + +#include "ioexpander.h" #define IOEX_EXPIN(ioex, port, index) (ioex), (port), BIT(index) /* diff --git a/include/host_command.h b/include/host_command.h index 7efd54e297..59389107c7 100644 --- a/include/host_command.h +++ b/include/host_command.h @@ -8,8 +8,8 @@ #ifndef __CROS_EC_HOST_COMMAND_H #define __CROS_EC_HOST_COMMAND_H -#include "common.h" #include "compiler.h" +#include "common.h" #include "ec_commands.h" #ifdef __cplusplus diff --git a/include/hwtimer.h b/include/hwtimer.h index 9058563e7a..093a44cad1 100644 --- a/include/hwtimer.h +++ b/include/hwtimer.h @@ -8,8 +8,6 @@ #ifndef __CROS_EC_HWTIMER_H #define __CROS_EC_HWTIMER_H -#include <stdint.h> - /** * Programs when the next timer should fire an interrupt. * diff --git a/include/i2c_bitbang.h b/include/i2c_bitbang.h index c9b0587410..9c7c730518 100644 --- a/include/i2c_bitbang.h +++ b/include/i2c_bitbang.h @@ -5,10 +5,10 @@ #ifndef __CROS_EC_I2C_BITBANG_H #define __CROS_EC_I2C_BITBANG_H -#include "i2c.h" - #include <stdbool.h> +#include "i2c.h" + extern const struct i2c_drv bitbang_drv; extern const struct i2c_port_t i2c_bitbang_ports[]; diff --git a/include/keyboard_8042.h b/include/keyboard_8042.h index bd56106f1d..34c98c2a38 100644 --- a/include/keyboard_8042.h +++ b/include/keyboard_8042.h @@ -8,8 +8,8 @@ #ifndef __CROS_EC_KEYBOARD_8042_H #define __CROS_EC_KEYBOARD_8042_H -#include "button.h" #include "common.h" +#include "button.h" /** * Called by power button handler and button interrupt handler. diff --git a/include/keyboard_8042_sharedlib.h b/include/keyboard_8042_sharedlib.h index 2f8dfdc242..bd7a7b5ec7 100644 --- a/include/keyboard_8042_sharedlib.h +++ b/include/keyboard_8042_sharedlib.h @@ -8,12 +8,12 @@ #ifndef __CROS_EC_KEYBOARD_8042_SHAREDLIB_H #define __CROS_EC_KEYBOARD_8042_SHAREDLIB_H +#include <stddef.h> + #include "button.h" #include "keyboard_config.h" #include "keyboard_protocol.h" -#include <stddef.h> - struct button_8042_t { uint16_t scancode; int repeat; diff --git a/include/keyboard_backlight.h b/include/keyboard_backlight.h index 929dbfa90e..cf68805235 100644 --- a/include/keyboard_backlight.h +++ b/include/keyboard_backlight.h @@ -32,6 +32,12 @@ struct kblight_drv { int (*set)(int percent); /** + * Get the current brightness + * @return Brightness in percentage + */ + int (*get)(void); + + /** * Enable or disable keyboard backlight * @param enable: 1=Enable, 0=Disable. * @return EC_SUCCESS or EC_ERROR_* diff --git a/include/keyboard_protocol.h b/include/keyboard_protocol.h index 8f10c7bd0e..7b9006fcc0 100644 --- a/include/keyboard_protocol.h +++ b/include/keyboard_protocol.h @@ -8,8 +8,8 @@ #ifndef __CROS_EC_KEYBOARD_PROTOCOL_H #define __CROS_EC_KEYBOARD_PROTOCOL_H -#include "button.h" #include "common.h" +#include "button.h" /* Routines common to all protocols */ diff --git a/include/keyboard_raw.h b/include/keyboard_raw.h index 350791998f..dca7b3c79a 100644 --- a/include/keyboard_raw.h +++ b/include/keyboard_raw.h @@ -16,8 +16,6 @@ #include "gpio_signal.h" #include "keyboard_config.h" -#include <stdbool.h> - /* Column values for keyboard_raw_drive_column() */ enum keyboard_column_index { KEYBOARD_COLUMN_ALL = -2, /* Drive all columns */ @@ -64,14 +62,6 @@ int keyboard_raw_read_rows(void); */ void keyboard_raw_enable_interrupt(int enable); -/** - * Enable or disable keyboard alternative function. - * - * @param enable 1 enable KSI/KSO alternative function, - * 0 set all KSI/KSO pins to normal GPIO. - */ -void keybaord_raw_config_alt(bool enable); - #ifdef HAS_TASK_KEYSCAN /** diff --git a/include/mag_cal.h b/include/mag_cal.h index 82453c5235..66281bba4e 100644 --- a/include/mag_cal.h +++ b/include/mag_cal.h @@ -8,10 +8,10 @@ #ifndef __CROS_EC_MAG_CAL_H #define __CROS_EC_MAG_CAL_H -#include "kasa.h" -#include "mat44.h" #include "math_util.h" +#include "mat44.h" #include "vec4.h" +#include "kasa.h" #define MAG_CAL_MAX_SAMPLES 0xffff #define MAG_CAL_MIN_BATCH_WINDOW_US (2 * SECOND) diff --git a/include/math_util.h b/include/math_util.h index 6b4b8cb3e5..51065d2bce 100644 --- a/include/math_util.h +++ b/include/math_util.h @@ -8,10 +8,8 @@ #ifndef __CROS_EC_MATH_UTIL_H #define __CROS_EC_MATH_UTIL_H -#include "config.h" -#include "limits.h" - #include <stdint.h> +#include "limits.h" #ifdef CONFIG_FPU typedef float fp_t; diff --git a/include/mock/fpsensor_state_mock.h b/include/mock/fpsensor_state_mock.h index c683ba5deb..32450e3cc0 100644 --- a/include/mock/fpsensor_state_mock.h +++ b/include/mock/fpsensor_state_mock.h @@ -6,12 +6,12 @@ #ifndef __MOCK_FPSENSOR_STATE_MOCK_H #define __MOCK_FPSENSOR_STATE_MOCK_H -#include "driver/fingerprint/fpsensor.h" -#include "ec_commands.h" - #include <stdbool.h> #include <stdint.h> +#include "driver/fingerprint/fpsensor.h" +#include "ec_commands.h" + extern const uint8_t default_fake_tpm_seed[FP_CONTEXT_TPM_BYTES]; extern const uint8_t default_fake_fp_positive_match_salt[FP_MAX_FINGER_COUNT] diff --git a/include/mock/tcpc_mock.h b/include/mock/tcpc_mock.h index fef45b492b..2f3a78c69a 100644 --- a/include/mock/tcpc_mock.h +++ b/include/mock/tcpc_mock.h @@ -4,8 +4,8 @@ */ /* Mock for the TCPC interface */ -#include "usb_pd.h" #include "usb_pd_tcpm.h" +#include "usb_pd.h" /* Controller for TCPC state */ struct mock_tcpc_ctrl { diff --git a/include/mock/usb_pd_dpm_mock.h b/include/mock/usb_pd_dpm_mock.h index 266cad4aef..8f91cfb390 100644 --- a/include/mock/usb_pd_dpm_mock.h +++ b/include/mock/usb_pd_dpm_mock.h @@ -8,7 +8,7 @@ #define __MOCK_USB_PD_DPM_MOCK_H #include "common.h" -#include "usb_pd_dpm_sm.h" +#include "usb_pd_dpm.h" /* Defaults should all be 0 values. */ struct mock_dpm_port_t { diff --git a/include/mock/usb_pe_sm_mock.h b/include/mock/usb_pe_sm_mock.h index 778e7943c4..819f086c5a 100644 --- a/include/mock/usb_pe_sm_mock.h +++ b/include/mock/usb_pe_sm_mock.h @@ -8,8 +8,8 @@ #define __MOCK_USB_PE_SM_MOCK_H #include "common.h" -#include "usb_pd_tcpm.h" #include "usb_pe_sm.h" +#include "usb_pd_tcpm.h" struct mock_pe_port_t { enum tcpci_msg_type sop; diff --git a/include/mock/usb_prl_mock.h b/include/mock/usb_prl_mock.h index 7758700d3a..eef1d8de63 100644 --- a/include/mock/usb_prl_mock.h +++ b/include/mock/usb_prl_mock.h @@ -9,9 +9,7 @@ #include "common.h" #include "usb_emsg.h" -#include "usb_pd.h" #include "usb_pd_tcpm.h" -#include "usb_pe_sm.h" void mock_prl_reset(void); diff --git a/include/mock/usb_tc_sm_mock.h b/include/mock/usb_tc_sm_mock.h index 2dc09ade8b..532f2bfb54 100644 --- a/include/mock/usb_tc_sm_mock.h +++ b/include/mock/usb_tc_sm_mock.h @@ -8,9 +8,9 @@ #define __MOCK_USB_TC_SM_MOCK_H #include "common.h" +#include "usb_tc_sm.h" #include "usb_pd.h" #include "usb_pd_tcpm.h" -#include "usb_tc_sm.h" struct mock_tc_port_t { int rev; diff --git a/include/motion_sense.h b/include/motion_sense.h index ac074055aa..6033d52ff9 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -283,12 +283,6 @@ int sensor_init_done(struct motion_sensor_t *sensor); void sensor_board_proc_double_tap(void); /** - * Board specific function to double check lid angle calculation is possible. - * - */ -int sensor_board_is_lid_angle_available(void); - -/** * Commit the data in a sensor's raw_xyz vector. This operation might have * different meanings depending on the CONFIG_ACCEL_FIFO flag. * @@ -360,8 +354,4 @@ ec_motion_sensor_fill_values(struct ec_response_motion_sensor_data *dst, dst->data[2] = v[2]; } -#ifdef CONFIG_ZTEST -enum sensor_config motion_sense_get_ec_config(void); -#endif - #endif /* __CROS_EC_MOTION_SENSE_H */ diff --git a/include/newton_fit.h b/include/newton_fit.h index dc0a8ffe6e..2fb1994083 100644 --- a/include/newton_fit.h +++ b/include/newton_fit.h @@ -9,8 +9,8 @@ #define __CROS_EC_NEWTON_FIT_H #include "queue.h" -#include "stdbool.h" #include "vec3.h" +#include "stdbool.h" struct newton_fit_orientation { /** An orientations. */ diff --git a/include/ocpc.h b/include/ocpc.h index 20ec35c797..da1c6907d4 100644 --- a/include/ocpc.h +++ b/include/ocpc.h @@ -42,16 +42,15 @@ struct ocpc_data { /** Set the VSYS target for the secondary charger IC. * - * @param desired_charger_input_current: Pointer to desired_input_current + * @param curr: Pointer to desired_input_current * @param ocpc: Pointer to OCPC data - * @param desired_batt_current_ma: The desired voltage - * @param desired_batt_voltage_mv: The desired current + * @param voltage_mv: The desired voltage + * @param current_ma: The desired current * @return EC_SUCCESS on success, error otherwise. */ -int ocpc_config_secondary_charger(int *desired_charger_input_current, - struct ocpc_data *ocpc, - int desired_batt_voltage_mv, - int desired_batt_current_ma); +int ocpc_config_secondary_charger(int *desired_input_current, + struct ocpc_data *ocpc, int voltage_mv, + int current_ma); /** Get the runtime data from the various ADCs. * @@ -60,8 +59,8 @@ int ocpc_config_secondary_charger(int *desired_charger_input_current, void ocpc_get_adcs(struct ocpc_data *ocpc); /* Set the PID constants for the charging loop */ -__override_proto void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki, - int *ki_div, int *kd, int *kd_div); +__overridable void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki, + int *ki_div, int *kd, int *kd_div); /* ** Set up some initial values for the OCPC data structure. This will call off diff --git a/include/panic.h b/include/panic.h index 25829017ea..8eda475f2a 100644 --- a/include/panic.h +++ b/include/panic.h @@ -9,14 +9,13 @@ #ifndef __CROS_EC_PANIC_H #define __CROS_EC_PANIC_H -#include "common.h" -#include "software_panic.h" - #include <stdarg.h> #include <stdint.h> - #include <stdnoreturn.h> +#include "common.h" +#include "software_panic.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/include/printf.h b/include/printf.h index a06d8e1c7b..f797ca593e 100644 --- a/include/printf.h +++ b/include/printf.h @@ -8,13 +8,12 @@ #ifndef __CROS_EC_PRINTF_H #define __CROS_EC_PRINTF_H -#include "common.h" -#include "console.h" - #include <stdarg.h> /* For va_list */ #include <stdbool.h> #include <stddef.h> /* For size_t */ +#include "console.h" #include <stdio.h> +#include "common.h" /** * Buffer size in bytes large enough to hold the largest possible timestamp. diff --git a/include/pwm.h b/include/pwm.h index b56f9f8c1a..48963d9d3c 100644 --- a/include/pwm.h +++ b/include/pwm.h @@ -6,10 +6,10 @@ #ifndef __CROS_EC_PWM_H #define __CROS_EC_PWM_H -#include "util.h" - #include <inttypes.h> +#include "util.h" + #define PWM_RAW_TO_PERCENT(v) DIV_ROUND_NEAREST((uint32_t)(v)*100, UINT16_MAX) #define PWM_PERCENT_TO_RAW(v) ((uint32_t)(v)*UINT16_MAX / 100) diff --git a/include/queue_policies.h b/include/queue_policies.h index eb80d3673b..aceb477ef6 100644 --- a/include/queue_policies.h +++ b/include/queue_policies.h @@ -7,9 +7,9 @@ #ifndef __CROS_EC_QUEUE_POLICIES_H #define __CROS_EC_QUEUE_POLICIES_H +#include "queue.h" #include "consumer.h" #include "producer.h" -#include "queue.h" /* * The direct notification policy manages a 1-to-1 producer consumer model. diff --git a/include/rgb_keyboard.h b/include/rgb_keyboard.h index 8c16f6f7e8..56a3e09a91 100644 --- a/include/rgb_keyboard.h +++ b/include/rgb_keyboard.h @@ -3,12 +3,12 @@ * found in the LICENSE file. */ +#include <stdbool.h> + #include "common.h" #include "ec_commands.h" #include "stddef.h" -#include <stdbool.h> - /* Use this instead of '3' for readability where applicable. */ #define SIZE_OF_RGB sizeof(struct rgb_s) diff --git a/include/rma_auth.h b/include/rma_auth.h index 0b02a1bdc6..2ad9299fed 100644 --- a/include/rma_auth.h +++ b/include/rma_auth.h @@ -8,10 +8,10 @@ #ifndef __CROS_EC_RMA_AUTH_H #define __CROS_EC_RMA_AUTH_H -#include "common.h" /* For __packed. */ - #include <stdint.h> +#include "common.h" /* For __packed. */ + /* Current challenge protocol version */ #define RMA_CHALLENGE_VERSION 0 diff --git a/include/shared_mem.h b/include/shared_mem.h index 482d3a6dec..307ce9f5e5 100644 --- a/include/shared_mem.h +++ b/include/shared_mem.h @@ -18,7 +18,6 @@ #define __CROS_EC_SHARED_MEM_H #include "common.h" - #include <stddef.h> /** diff --git a/include/stillness_detector.h b/include/stillness_detector.h index 67269c6db4..79de2de79f 100644 --- a/include/stillness_detector.h +++ b/include/stillness_detector.h @@ -9,7 +9,6 @@ #include "common.h" #include "math_util.h" #include "stdbool.h" - #include <stdint.h> struct still_det { diff --git a/include/sysjump.h b/include/sysjump.h index b7779b9c86..7d86df2e61 100644 --- a/include/sysjump.h +++ b/include/sysjump.h @@ -21,16 +21,6 @@ #define JUMP_DATA_SIZE_V1 12 /* Size of version 1 jump data struct */ #define JUMP_DATA_SIZE_V2 16 /* Size of version 2 jump data struct */ -#define JUMP_TAG_MAX_SIZE 255 - -#if !defined(CONFIG_RAM_SIZE) || !(CONFIG_RAM_SIZE > 0) -/* Disable check by setting jump data min address to zero */ -#define JUMP_DATA_MIN_ADDRESS 0 -#else -#define JUMP_DATA_MIN_ADDRESS \ - (CONFIG_RAM_BASE + CONFIG_RAM_SIZE - CONFIG_PRESERVED_END_OF_RAM_SIZE) -#endif - struct jump_data { /* * Add new fields to the _start_ of the struct, since we copy it to the diff --git a/include/system.h b/include/system.h index c7884199e1..ed811e9626 100644 --- a/include/system.h +++ b/include/system.h @@ -8,6 +8,8 @@ #ifndef __CROS_EC_SYSTEM_H #define __CROS_EC_SYSTEM_H +#include <stdnoreturn.h> + #include "atomic.h" #include "common.h" #include "compile_time_macros.h" @@ -15,8 +17,6 @@ #include "ec_commands.h" #include "timer.h" -#include <stdnoreturn.h> - #ifdef CONFIG_ZEPHYR #ifdef CONFIG_CPU_CORTEX_M /* @@ -214,7 +214,7 @@ int system_jumped_late(void); * This may ONLY be called from within a HOOK_SYSJUMP handler. * * @param tag Data type - * @param size Size of data; must be less than JUMP_TAG_MAX_SIZE bytes. + * @param size Size of data; must be less than 255 bytes. * @param version Data version, so that tag data can evolve as firmware * is updated. * @param data Pointer to data to save diff --git a/include/task.h b/include/task.h index a527ca695a..bc7314169e 100644 --- a/include/task.h +++ b/include/task.h @@ -15,9 +15,8 @@ extern "C" { #include "atomic_t.h" #include "common.h" #include "compile_time_macros.h" -#include "task_id.h" - #include <stdbool.h> +#include "task_id.h" /* Task event bitmasks */ /* Tasks may use the bits in TASK_EVENT_CUSTOM_BIT for their own events */ diff --git a/include/task_id.h b/include/task_id.h index 9ddc61678b..e617d820b5 100644 --- a/include/task_id.h +++ b/include/task_id.h @@ -16,8 +16,6 @@ #include "config.h" #include "task_filter.h" -#include <stdint.h> - /* define the name of the header containing the list of tasks */ #define STRINGIFY0(name) #name #define STRINGIFY(name) STRINGIFY0(name) diff --git a/include/test_util.h b/include/test_util.h index efdee22cc6..004e8aaf0d 100644 --- a/include/test_util.h +++ b/include/test_util.h @@ -19,9 +19,8 @@ extern "C" { #include "stack_trace.h" #ifdef CONFIG_ZTEST -#include "ec_tasks.h" - #include <zephyr/ztest.h> +#include "ec_tasks.h" #endif /* CONFIG_ZTEST */ /* This allows tests to be easily commented out in run_test for debugging */ @@ -125,7 +124,6 @@ enum test_state_t { TEST_STATE_STEP_7, TEST_STATE_STEP_8, TEST_STATE_STEP_9, - TEST_STATE_STEP_10, TEST_STATE_PASSED, TEST_STATE_FAILED, }; diff --git a/include/tests/enum_strings.h b/include/tests/enum_strings.h index 7654dc9377..2ad0725f8f 100644 --- a/include/tests/enum_strings.h +++ b/include/tests/enum_strings.h @@ -5,8 +5,8 @@ /* Defines helper function that convert Enums to strings for prints in tests */ -#include "usb_pd.h" #include "usb_pd_tcpm.h" +#include "usb_pd.h" #ifndef __CROS_EC_TEST_ENUM_STINGS_H #define __CROS_EC_TEST_ENUM_STINGS_H diff --git a/include/trng.h b/include/trng.h index 3b28796ed0..cf8326e5bf 100644 --- a/include/trng.h +++ b/include/trng.h @@ -5,11 +5,10 @@ #ifndef __EC_INCLUDE_TRNG_H #define __EC_INCLUDE_TRNG_H +#include <common.h> #include <stddef.h> #include <stdint.h> -#include <common.h> - /** * Initialize the true random number generator. * diff --git a/include/uart.h b/include/uart.h index 086c407695..851b331fd2 100644 --- a/include/uart.h +++ b/include/uart.h @@ -8,11 +8,10 @@ #ifndef __CROS_EC_UART_H #define __CROS_EC_UART_H +#include <stdarg.h> /* For va_list */ #include "common.h" #include "gpio_signal.h" -#include <stdarg.h> /* For va_list */ - /** * Initialize the UART module. */ @@ -53,7 +52,7 @@ int uart_puts(const char *outstr); * * @param out Pointer to data to send * @param len Length of transfer in bytes - * @return number of characters successfully written. + * @return EC_SUCCESS, or non-zero if output was truncated. */ int uart_put(const char *out, int len); @@ -62,7 +61,7 @@ int uart_put(const char *out, int len); * * @param out Pointer to data to send * @param len Length of transfer in bytes - * @return number of characters successfully written. + * @return EC_SUCCESS, or non-zero if output was truncated. */ int uart_put_raw(const char *out, int len); diff --git a/include/update_fw.h b/include/update_fw.h index a4f56942a7..dc520c2eb9 100644 --- a/include/update_fw.h +++ b/include/update_fw.h @@ -6,10 +6,10 @@ #ifndef __CROS_EC_UPDATE_FW_H #define __CROS_EC_UPDATE_FW_H -#include "compile_time_macros.h" - #include <stddef.h> +#include "compile_time_macros.h" + /* * This file contains structures used to facilitate EC firmware updates * over USB (and over TPM for cr50). diff --git a/include/usb_common.h b/include/usb_common.h index f93178322e..bad1a0c058 100644 --- a/include/usb_common.h +++ b/include/usb_common.h @@ -6,7 +6,6 @@ #define __CROS_EC_USB_COMMON_H /* Functions that are shared between old and new PD stacks */ -#include "ec_commands.h" #include "usb_pd.h" #include "usb_pd_tcpm.h" diff --git a/include/usb_dp_alt_mode.h b/include/usb_dp_alt_mode.h index 275580b407..83dc35b085 100644 --- a/include/usb_dp_alt_mode.h +++ b/include/usb_dp_alt_mode.h @@ -12,11 +12,11 @@ #ifndef __CROS_EC_USB_DP_ALT_MODE_H #define __CROS_EC_USB_DP_ALT_MODE_H -#include "tcpm/tcpm.h" -#include "usb_pd_dpm_sm.h" - #include <stdint.h> +#include "tcpm/tcpm.h" +#include "usb_pd_dpm.h" + /* * Initialize DP state for the specified port. * diff --git a/include/usb_mode.h b/include/usb_mode.h index 5c6f71b372..4cf7710960 100644 --- a/include/usb_mode.h +++ b/include/usb_mode.h @@ -12,11 +12,11 @@ #ifndef __CROS_EC_USB_MODE_H #define __CROS_EC_USB_MODE_H +#include <stdint.h> + #include "tcpm/tcpm.h" #include "usb_pd_tcpm.h" -#include <stdint.h> - /* * Initialize USB4 state for the specified port. * diff --git a/include/usb_pd.h b/include/usb_pd.h index e4ab8f6432..92580252a5 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -8,15 +8,14 @@ #ifndef __CROS_EC_USB_PD_H #define __CROS_EC_USB_PD_H +#include <stdbool.h> +#include <stdint.h> #include "common.h" #include "ec_commands.h" #include "usb_pd_tbt.h" #include "usb_pd_tcpm.h" #include "usb_pd_vdo.h" -#include <stdbool.h> -#include <stdint.h> - /* PD Host command timeout */ #define PD_HOST_COMMAND_TIMEOUT_US SECOND @@ -477,6 +476,7 @@ struct partner_active_modes { * VDM object is minimum of VDM header + 6 additional data objects. */ #define VDO_HDR_SIZE 1 +#define VDO_MAX_SIZE 7 #define VDM_VER10 0 #define VDM_VER20 1 @@ -3189,6 +3189,13 @@ __override_proto void board_process_pd_alert(int port); */ void board_reset_pd_mcu(void); +/** + * Return true if specified PD port is debug accessory. + * + * @param port USB-C port number + */ +bool pd_is_debug_acc(int port); + /* * Notify the AP that we have entered into DisplayPort Alternate Mode. This * sets a DP_ALT_MODE_ENTERED MKBP event which may wake the AP. diff --git a/include/usb_pd_dpm_sm.h b/include/usb_pd_dpm.h index 8fdd147be1..c74357d588 100644 --- a/include/usb_pd_dpm_sm.h +++ b/include/usb_pd_dpm.h @@ -21,15 +21,6 @@ */ void dpm_init(int port); -/** - * Runs the Device Policy Manager State Machine - * - * @param port USB-C port number - * @param evt system event, ie: PD_EVENT_RX - * @param en 0 to disable the machine, 1 to enable the machine - */ -void dpm_run(int port, int evt, int en); - /* * Informs the DPM that a mode exit is complete. * @@ -52,14 +43,6 @@ void dpm_set_mode_exit_request(int port); void dpm_data_reset_complete(int port); /* - * Informs the DPM that PE layer is in ready state so that data role can be - * checked and DPM can know to exit the idle state. - * - * @param port USB-C port number - */ -void dpm_set_pe_ready(int port, bool enable); - -/* * Informs the DPM that a VDM ACK was received. * * @param port USB-C port number @@ -83,6 +66,13 @@ void dpm_vdm_naked(int port, enum tcpci_msg_type type, uint16_t svid, uint8_t vdm_cmd); /* + * Drives the Policy Engine through entry/exit mode process + * + * @param port USB-C port number + */ +void dpm_run(int port); + +/* * Determines the current allocation for the connection, past the basic * CONFIG_USB_PD_PULLUP value set by the TC (generally 1.5 A) * diff --git a/include/usb_pd_tcpc.h b/include/usb_pd_tcpc.h index 7af0a570e4..a89030cdb7 100644 --- a/include/usb_pd_tcpc.h +++ b/include/usb_pd_tcpc.h @@ -8,9 +8,8 @@ #ifndef __CROS_EC_USB_PD_TCPC_H #define __CROS_EC_USB_PD_TCPC_H -#include "usb_pd_tcpm.h" - #include <stdint.h> +#include "usb_pd_tcpm.h" /* If we are a TCPC but not a TCPM, then we implement the peripheral TCPCI */ #if defined(CONFIG_USB_PD_TCPC) && !defined(CONFIG_USB_PD_TCPM_STUB) diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h index 199682122c..f3f449721e 100644 --- a/include/usb_pd_tcpm.h +++ b/include/usb_pd_tcpm.h @@ -8,13 +8,12 @@ #ifndef __CROS_EC_USB_PD_TCPM_H #define __CROS_EC_USB_PD_TCPM_H +#include <stdbool.h> #include "common.h" #include "compiler.h" #include "ec_commands.h" #include "i2c.h" -#include <stdbool.h> - /* Time to wait for TCPC to complete transmit */ #define PD_T_TCPC_TX_TIMEOUT (100 * MSEC) diff --git a/include/usb_pd_timer.h b/include/usb_pd_timer.h index 687c980243..439b30513d 100644 --- a/include/usb_pd_timer.h +++ b/include/usb_pd_timer.h @@ -8,11 +8,11 @@ #ifndef __CROS_EC_USB_PD_TIMER_H #define __CROS_EC_USB_PD_TIMER_H +#include <stdbool.h> + #include "atomic.h" #include "atomic_bit.h" -#include <stdbool.h> - /* * List of all timers that will be managed by usb_pd_timer */ diff --git a/include/usb_prl_sm.h b/include/usb_prl_sm.h index 5671f8300e..99b69f156f 100644 --- a/include/usb_prl_sm.h +++ b/include/usb_prl_sm.h @@ -8,10 +8,11 @@ #ifndef __CROS_EC_USB_PRL_H #define __CROS_EC_USB_PRL_H #include "common.h" -#include "timer.h" #include "usb_pd.h" #include "usb_pd_tcpm.h" #include "usb_sm.h" +#include "timer.h" +#include "usb_pd_tcpm.h" /** * Returns TX success time stamp. diff --git a/include/usb_tbt_alt_mode.h b/include/usb_tbt_alt_mode.h index ff2ad44ed0..378cd0ccce 100644 --- a/include/usb_tbt_alt_mode.h +++ b/include/usb_tbt_alt_mode.h @@ -11,12 +11,12 @@ #ifndef __CROS_EC_USB_TBT_ALT_MODE_H #define __CROS_EC_USB_TBT_ALT_MODE_H +#include <stdint.h> + #include "tcpm/tcpm.h" -#include "usb_pd_dpm_sm.h" +#include "usb_pd_dpm.h" #include "usb_pd_tcpm.h" -#include <stdint.h> - /* * Initialize Thunderbolt state for the specified port. * diff --git a/include/usb_tc_sm.h b/include/usb_tc_sm.h index 009e5db089..ec6473edfd 100644 --- a/include/usb_tc_sm.h +++ b/include/usb_tc_sm.h @@ -8,9 +8,9 @@ #ifndef __CROS_EC_USB_TC_H #define __CROS_EC_USB_TC_H +#include "usb_sm.h" #include "usb_pd.h" #include "usb_pd_tcpm.h" -#include "usb_sm.h" enum try_src_override_t { TRY_SRC_OVERRIDE_OFF, diff --git a/include/util.h b/include/util.h index 9db98f2b3f..dc2e038705 100644 --- a/include/util.h +++ b/include/util.h @@ -16,7 +16,6 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> - #include <strings.h> #ifdef CONFIG_ZEPHYR #include <zephyr/sys/util.h> diff --git a/include/vb21_struct.h b/include/vb21_struct.h index b23eb0cd30..c8b49ac05e 100644 --- a/include/vb21_struct.h +++ b/include/vb21_struct.h @@ -14,10 +14,10 @@ #ifndef VBOOT_REFERENCE_VB21_STRUCT_H_ #define VBOOT_REFERENCE_VB21_STRUCT_H_ -#include "2id.h" - #include <stdint.h> +#include "2id.h" + /* * Magic numbers used by vb21_struct_common.magic. * diff --git a/include/vboot.h b/include/vboot.h index 9a3013ebbc..55359e8044 100644 --- a/include/vboot.h +++ b/include/vboot.h @@ -7,11 +7,11 @@ #define __CROS_EC_INCLUDE_VBOOT_H #include "common.h" +#include "vb21_struct.h" #include "rsa.h" #include "sha256.h" #include "stdbool.h" #include "timer.h" -#include "vb21_struct.h" /** * Validate key contents. diff --git a/include/watchdog.h b/include/watchdog.h index 5e6e5626e6..d6768425ce 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -8,10 +8,10 @@ #ifndef __CROS_EC_WATCHDOG_H #define __CROS_EC_WATCHDOG_H -#include "config.h" - #include <stdint.h> +#include "config.h" + /** * Initialize the watchdog. * |