diff options
author | Ivan Chen <yulunchen@google.com> | 2023-05-17 03:32:45 +0000 |
---|---|---|
committer | Ivan Chen <yulunchen@google.com> | 2023-05-17 03:32:45 +0000 |
commit | d7c9c6beb03ee5725232b9ac3bfe4825e1e227cb (patch) | |
tree | 3a0d6776c0e76e325d1b087cd51a850cb871358e /include | |
parent | 8641442366bd7c2c133e302a57f904dfac3c896b (diff) | |
parent | b34dc2ae9022e2fbb57ae6477891ff32954c62fd (diff) | |
download | chrome-ec-d7c9c6beb03ee5725232b9ac3bfe4825e1e227cb.tar.gz |
Merge remote-tracking branch cros/main into firmware-brya-14505.B-mainfirmware-brya-14505.B-main
Generated by: util/update_release_branch.py --board brya firmware-brya-14505.B-main
Relevant changes:
git log --oneline 8641442366..b34dc2ae90 -- board/brya board/brya
util/getversion.sh
BRANCH=None
TEST=`make -j buildall`
Force-Relevant-Builds: all
Change-Id: I63149b4c1782b3ed57f2556755901c21f5f1e3e9
Signed-off-by: Ivan Chen <yulunchen@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/charge_state.h | 6 | ||||
-rw-r--r-- | include/charge_state_v2.h | 9 | ||||
-rw-r--r-- | include/config.h | 33 | ||||
-rw-r--r-- | include/crypto/elliptic_curve_key.h | 20 | ||||
-rw-r--r-- | include/lid_switch.h | 6 | ||||
-rw-r--r-- | include/system.h | 6 | ||||
-rw-r--r-- | include/test_util.h | 14 | ||||
-rw-r--r-- | include/trng.h | 7 |
8 files changed, 89 insertions, 12 deletions
diff --git a/include/charge_state.h b/include/charge_state.h index 34576dc333..ed7ca0a4d9 100644 --- a/include/charge_state.h +++ b/include/charge_state.h @@ -83,7 +83,7 @@ enum led_pwr_state { * only to control the LEDs (with one not-quite-correct exception). For V2 * we use a different set of states internally. */ -enum charge_state_v2 { +enum charge_state { ST_IDLE = 0, ST_DISCHARGE, ST_CHARGE, @@ -98,7 +98,7 @@ struct charge_state_data { int batt_is_charging; struct charger_params chg; struct batt_params batt; - enum charge_state_v2 state; + enum charge_state state; int requested_voltage; int requested_current; int desired_input_current; @@ -126,7 +126,7 @@ enum led_pwr_state led_pwr_get_state(void); /** * Return current charge v2 state. */ -__test_only enum charge_state_v2 charge_get_state_v2(void); +__test_only enum charge_state charge_get_state(void); /** * Return non-zero if battery is so low we want to keep AP off. diff --git a/include/charge_state_v2.h b/include/charge_state_v2.h deleted file mode 100644 index 72fd8a88ff..0000000000 --- a/include/charge_state_v2.h +++ /dev/null @@ -1,9 +0,0 @@ -/* Copyright 2014 The ChromiumOS Authors - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef __CROS_EC_CHARGE_STATE_V2_H -#define __CROS_EC_CHARGE_STATE_V2_H - -#endif /* __CROS_EC_CHARGE_STATE_V2_H */ diff --git a/include/config.h b/include/config.h index a3a2edb1ed..dfc684f278 100644 --- a/include/config.h +++ b/include/config.h @@ -665,6 +665,12 @@ #undef CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV /* + * Check the specific battery status to judge whether the battery is + * initialized and stable when the battery wakes up from ship mode. + */ +#undef CONFIG_BATTERY_STBL_STAT + +/* * Some batteries don't update full capacity timely or don't update it at all. * On such systems, compensation is required to guarantee remaining_capacity * will be equal to full_capacity eventually. This used to be done in ACPI. @@ -6411,6 +6417,33 @@ #define CONFIG_BATTERY_V1 #endif +/* + * Check the specific battery status to judge whether the battery is + * initialized and stable when the battery wakes up from ship mode. + * Use two MASKs to provide logical AND and logical OR options for different + * status. For example: + * + * Logical OR -- just check one of TCA/TDA mask: + * #define CONFIG_BATT_ALARM_MASK1 \ + * (STATUS_TERMINATE_CHARGE_ALARM | STATUS_TERMINATE_DISCHARGE_ALARM) + * #define CONFIG_BATT_ALARM_MASK2 0xFFFF + * + * Logical AND -- check both TCA/TDA mask: + * #define CONFIG_BATT_ALARM_MASK1 STATUS_TERMINATE_CHARGE_ALARM + * #define CONFIG_BATT_ALARM_MASK2 STATUS_TERMINATE_DISCHARGE_ALARM + * + * The default configuration is logical OR. + */ +#ifdef CONFIG_BATTERY_STBL_STAT +#ifndef CONFIG_BATT_ALARM_MASK1 +#define CONFIG_BATT_ALARM_MASK1 \ + (STATUS_TERMINATE_CHARGE_ALARM | STATUS_TERMINATE_DISCHARGE_ALARM) +#endif +#ifndef CONFIG_BATT_ALARM_MASK2 +#define CONFIG_BATT_ALARM_MASK2 0xFFFF +#endif +#endif + /*****************************************************************************/ /* Define derived USB PD Discharge common path */ #if defined(CONFIG_USB_PD_DISCHARGE_GPIO) || \ diff --git a/include/crypto/elliptic_curve_key.h b/include/crypto/elliptic_curve_key.h new file mode 100644 index 0000000000..1e56f5d428 --- /dev/null +++ b/include/crypto/elliptic_curve_key.h @@ -0,0 +1,20 @@ +/* Copyright 2023 The ChromiumOS Authors + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Helpers for the boringssl elliptic curve key interface. */ + +#ifndef __CROS_EC_ELLIPTIC_CURVE_KEY_H +#define __CROS_EC_ELLIPTIC_CURVE_KEY_H + +#include "openssl/ec_key.h" +#include "openssl/mem.h" + +/** + * Generate a p256 ECC key. + * @return key on success, nullptr on failure + */ +bssl::UniquePtr<EC_KEY> generate_elliptic_curve_key(); + +#endif /* __CROS_EC_ELLIPTIC_CURVE_KEY_H */ diff --git a/include/lid_switch.h b/include/lid_switch.h index 3d639b5782..8b62d89949 100644 --- a/include/lid_switch.h +++ b/include/lid_switch.h @@ -5,6 +5,12 @@ /* Lid switch API for Chrome EC */ +/* + * TODO(b/272518464): Work around coreboot GCC preprocessor bug. + * #line marks the *next* line, so it is off by one. + */ +#line 13 + #ifndef __CROS_EC_LID_SWITCH_H #define __CROS_EC_LID_SWITCH_H diff --git a/include/system.h b/include/system.h index c7884199e1..064656fd5f 100644 --- a/include/system.h +++ b/include/system.h @@ -5,6 +5,12 @@ /* System module for Chrome EC */ +/* + * TODO(b/272518464): Work around coreboot GCC preprocessor bug. + * #line marks the *next* line, so it is off by one. + */ +#line 13 + #ifndef __CROS_EC_SYSTEM_H #define __CROS_EC_SYSTEM_H diff --git a/include/test_util.h b/include/test_util.h index 4f9869ab61..54da6a1d6c 100644 --- a/include/test_util.h +++ b/include/test_util.h @@ -19,6 +19,7 @@ extern "C" { #include "ec_commands.h" #include "math_util.h" #include "stack_trace.h" +#include "string.h" #ifdef CONFIG_ZTEST #include "ec_tasks.h" @@ -115,6 +116,19 @@ extern "C" { } \ } while (0) +#define TEST_ASSERT_ARRAY_NE(s, d, n) \ + do { \ + if (n < 0) \ + return EC_ERROR_UNKNOWN; \ + \ + if (memcmp(&s[0], &d[0], n) == 0) { \ + ccprintf("%s:%d: ASSERT_ARRAY_NE failed\n", __FILE__, \ + __LINE__); \ + task_dump_trace(); \ + return EC_ERROR_UNKNOWN; \ + } \ + } while (0) + #define TEST_ASSERT_MEMSET(d, c, n) \ do { \ if (n < 0) \ diff --git a/include/trng.h b/include/trng.h index ca8144eeec..06fbcc8544 100644 --- a/include/trng.h +++ b/include/trng.h @@ -26,6 +26,13 @@ void trng_init(void); /** + * Generate true random number. + * + * Not supported by all platforms. + **/ +uint32_t trng_rand(void); + +/** * Shutdown the true random number generator. * * The opposite operation of trng_init(), disable the hardware resources |